Staff Pick: dFurnitureEditor
By
XenmaiCreated: 2016/07/12 07:36:18 UTC-07:00 (8 years and 164 days ago)
Edited: 2017/04/09 16:09:24 UTC-07:00 (7 years and 258 days ago)
Likes: 2
Staff pick as of: 2016/07/12 13:01:15 UTC-07:00 (8 years and 164 days ago)
Denizen Version: Release Build #1631
Script Version: 0.10
Description:
dFurnitureEditor is an inventory GUI based furniture editor (surprise!). It lets you create and remove props, as well as add and tweak their model components, without even needing to open a script file. This is all done thanks to armor stands, and the changes take place as soon as you make them. No need for reloads.
Prop parts have some available options including: their offset position relative to the prop center, their rotation angles, wether or not they are small (small armor stands render smaller items), the item they hold, wether or not the player can sit on them and wether or not they emit fire particles.
If you want to get some sample props to get you started, you can do so at https://github.com/Xenmai/dFurnitureEditor/blob/master/Samples.yml. Just feel free to copy and paste the contents of the file into your Models.yml file inside your dFurnitureEditor folder. WARNING: Stop the server before pasting the samples, save the file, and then start it again. Manually editing the file while the server is live can result in data loss due to rollbacks and overrides.
It still lacks polishing and documentation, and I'll most likely add more utilities to it as time progresses.
For any questions regarding this script, or anything else, feel free to ping me in the IRC.
Usage:
/dfe edit -a *opens the main editor GUI
/dfe place Stool -p *places the prop named Stool at your current location with your current yaw
/dfe place Stool 0 *places the prop named Stool at your current location with yaw 0
/dfe remove 3 *removes the placed prop with ID
<--script-tracker-->
tags=furniture,props,chair,table,stool,decoration,models
<--!script-tracker-->
Download script |
View raw scriptdFurnitureEditor_Version:
type: version
author: Xenmai
name: dFurnitureEditor
version: 0.10
description: An advanced menu for editing and placing/removing furniture Models
id: 98
# _____ _ _____ _ _
# / ____| | | / ____| (_) | |
# | | ___ _ __ ___ _ __ ___ __ _ _ __ __| | | (___ ___ _ __ _ _ __ | |_ ___
# | | / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` | \___ \ / __| '__| | '_ \| __/ __|
# | |___| (_) | | | | | | | | | | | (_| | | | | (_| | ____) | (__| | | | |_) | |_\__ \
# \_____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_| |_____/ \___|_| |_| .__/ \__|___/
# | |
# |_|
dFE_Command:
type: command
debug: false
name: dfe
description: "Main dFE command. Allows for editing and placing Models."
usage: /dfe [edit|place]
aliases:
- dfurnitureeditor
allowed help:
- determine <player.is_op||<context.server>>
tab complete:
- if !<player.is_op||<context.server>> queue clear
- determine <li@edit|place.filter[starts_with[<context.args.last>]]>
script:
- if !<player.is_op||<context.server>> {
- narrate "<red>You do not have permission for that command."
- queue clear
}
- if <context.args.size.is[==].to[0]> {
- narrate "> GENERAL dFE INFORMATION:"
- narrate "Author: xenmai"
- narrate "Denizen Version: Release Build #1623"
- narrate "Script Version: 0.9 (alpha)"
}
- choose <context.args.get[1]||null>:
# Opens the general dFE editor GUI.
- case edit:
- flag <player> dFE:!
- if <context.args.size.is[==].to[2]> {
- if <context.args.get[2].is[==].to[-a]> {
- define model -all
}
else {
- narrate "Invalid second argument specified. Please use -a, -s, -t, a positive integer or a model name."
- queue clear
}
}
else if <context.args.size.is[==].to[3]> {
- if <context.args.get[2].is[==].to[-s]> {
- define model <yaml[dFE_Placed_Props].read[<player.flag[dFE_Selection]>.model]>
}
else if <context.args.get[2].is[==].to[-t]> {
- define model <yaml[dFE_Placed_Props].read[<player.target.flag[dFE.ID]>.model]>
}
else if <context.args.get[2].is[==].to[<context.args.get[2].as_int||null>]> && <context.args.get[2].is[MORE].to[0]> {
- define model <yaml[dFE_Placed_Props].read[<context.args.get[2]>.model]>
}
else if <context.args.get[2].matches[<&lb>a-zA-Z0-9_<&rb>+]> {
- define model <context.args.get[2]>
}
else {
- narrate "Invalid second argument specified. Please use -a, -s, -t, a positive integer or a model name."
- queue clear
}
- if <context.args.get[3].is[==].to[-a]> {
- define part -all
}
else if <context.args.get[3].matches[<&lb>a-zA-Z0-9_<&rb>+]> {
- define part <context.args.get[3]>
}
else {
- narrate "Invalid third argument specified. Please use -a or a part name."
- queue clear
}
}
else {
- narrate "Invalid number of arguments specified. Proper usage is '/dfe edit [-a/-s/-t/#/<<>model<>>] [-a/<<>part<>>]'."
- queue clear
}
- run dFE_Task_Edit def:<def[model]>|<def[part]||null> instantly
# Selects a placed prop for later ease of moving or removing.
- case select:
- if <context.args.size.is[!=].to[2]> {
- narrate "Invalid number of arguments specified. Proper usage is '/dfe select [-t/#]'."
- queue clear
}
- if <context.args.get[2].is[==].to[-t]> {
- run dFE_Task_Select def:<player.target.flag[dFE.ID]> instantly
}
else if <context.args.get[2].is[==].to[<context.args.get[2].as_int||null>]> && <context.args.get[2].is[MORE].to[0]> {
- run dFE_Task_Select def:<context.args.get[2]> instantly
}
else {
- narrate "Invalid second argument specified. Please use -t or a positive integer."
}
# Moves a placed prop to your position.
- case move:
- if <context.args.size.is[!=].to[2]> {
- narrate "Invalid number of arguments specified. Proper usage is '/dfe move [-s/#]'."
- queue clear
}
- if <context.args.get[2].is[==].to[-s]> {
- run dFE_Task_Move def:<player.flag[dFE_Selection]>|<player.location.block> instantly
}
else if <context.args.get[2].is[==].to[<context.args.get[2].as_int||null>]> && <context.args.get[2].is[MORE].to[0]> {
- run dFE_Task_Move def:<context.args.get[2]>|<player.location.block> instantly
}
else {
- narrate "Invalid second argument specified. Please use -s or a positive integer."
}
# Rotates a placed drop to a yaw.
- case rotate:
- if <context.args.size.is[!=].to[3]> {
- narrate "Invalid number of arguments specified. Proper usage is '/dfe rotate [-s/-t/#] [#]'."
- queue clear
}
- if <context.args.get[2].is[==].to[-s]> {
- run dFE_Task_Rotate def:<player.flag[dFE_Selection]>|<context.args.get[3]> instantly
}
else if <context.args.get[2].is[==].to[-t]> {
- run dFE_Task_Rotate def:<player.target.flag[dFE.ID]>|<context.args.get[3]> instantly
}
else if <context.args.get[2].is[==].to[<context.args.get[2].as_int||null>]> && <context.args.get[2].is[MORE].to[0]> {
- run dFE_Task_Rotate def:<context.args.get[2]>|<context.args.get[3]> instantly
}
else {
- narrate "Invalid second argument specified. Please use -s, -t or a positive integer."
}
# Places a prop at your current location.
# For example, '/dfe place Stool -p' will place a Stool model with your yaw.
- case place:
- if <context.args.size.is[!=].to[3]> {
- narrate "Invalid number of arguments specified. Proper usage is '/dfe place [<<>model<>>] [-p/#.#]'."
- queue clear
}
- if <context.args.get[3].is[==].to[-p]> {
- run dFE_Task_Place def:<player.location.block>|<player.location.yaw>|<context.args.get[2]> instantly
} else if <context.args.get[3].round_to[2]||false> || <context.args.get[3].is[==].to[<context.args.get[3].as_int||null>]> {
- run dFE_Task_Place def:<player.location.block>|<context.args.get[3].round_to[2]>|<context.args.get[2]> instantly
} else {
- narrate "Invalid third argument specified. Please use -p or a number."
}
# Removes a prop at your current location.
# For example, '/dfe remove -t' will remove the placed movel you are looking at.
- case remove:
- if <context.args.size.is[!=].to[2]> {
- narrate "Invalid number of arguments specified. Proper usage is '/dfe remove [-s/-t/#]'."
- queue clear
}
- if <context.args.get[2].is[==].to[-s]> {
- run dFE_Task_Remove def:<player.flag[dFE_Selection]> instantly
} else if <context.args.get[2].is[==].to[-t]> {
- run dFE_Task_Remove def:<player.target.flag[dFE.ID]> instantly
} else if <context.args.get[2].is[==].to[<context.args.get[2].as_int||null>]> && <context.args.get[2].is[MORE].to[0]> {
- run dFE_Task_Remove def:<context.args.get[2]> instantly
} else {
- narrate "Invalid second argument specified. Please use -s, -t or a positive integer."
}
# Changes the placed prop with an old ID to a new one.
- case changeid:
- if <context.args.size.is[!=].to[3]> {
- narrate "Invalid number of arguments specified. Proper usage is '/dfe changeid [#] [#]'."
- queue clear
}
- run dFE_Task_ChangeId def:<context.args.get[2]>|<context.args.get[3]> instantly
# _______ _ _____ _ _
# |__ __| | | / ____| (_) | |
# | | __ _ ___| | __ | (___ ___ _ __ _ _ __ | |_ ___
# | |/ _` / __| |/ / \___ \ / __| '__| | '_ \| __/ __|
# | | (_| \__ \ < ____) | (__| | | | |_) | |_\__ \
# |_|\__,_|___/_|\_\ |_____/ \___|_| |_| .__/ \__|___/
# | |
# |_|
# Places certain model at a location with a specified yaw.
dFE_Task_Place:
type: task
debug: false
definitions: loc|yaw|model
script:
- if <yaml[dFE_Models].list_keys[].contains[<def[model]>].not> {
- narrate "Model with name <def[model]> doesn't exist. Make sure you're specifying the correct model."
- queue clear
}
- light <def[loc].below> <def[loc].light>
- light <def[loc].below.below> <def[loc].light>
- define id 1
- while <yaml[dFE_Placed_Props].list_keys[].contains[<def[id]>]> {
- define id <def[id].add[1]>
}
- yaml id:dFE_Placed_Props set <def[id]>.location:<def[loc]>
- yaml id:dFE_Placed_Props set <def[id]>.yaw:<def[yaw]>
- yaml id:dFE_Placed_Props set <def[id]>.model:<def[model]>
- foreach <yaml[dFE_Models].list_keys[<def[model]>]> {
- define location l@<yaml[dFE_Models].read[<def[model]>.<def[value]>.location]>
- define angle <yaml[dFE_Models].read[<def[model]>.<def[value]>.angle].split[,].as_list.parse[to_radians].separated_by[,]||0,0,0>
- define small <yaml[dFE_Models].read[<def[model]>.<def[value]>.small]>
- define item <yaml[dFE_Models].read[<def[model]>.<def[value]>.item]||air>
- define type <yaml[dFE_Models].read[<def[model]>.<def[value]>.type]>
- define sityaw <yaml[dFE_Models].read[<def[model]>.<def[value]>.yaw]||0>
- spawn armor_stand[marker=true;max_health=0.1;visible=false;gravity=false;is_small=<def[small]>;equipment=air|air|air|<def[item]>;armor_pose=head|<def[angle]>] <def[loc].center.add[<def[location].rotate_around_y[<def[yaw].to_radians.mul[-1]>]>].with_pose[0,<def[yaw].add[<def[sityaw]>]>]> save:entity
- if <def[type].is[==].to[sit]> {
- flag <entry[entity].spawned_entities.after[li@]> dFE.Utility:Sit
- adjust <entry[entity].spawned_entities.after[li@]> marker:false
} else if <def[type].is[==].to[fire]> {
- flag <entry[entity].spawned_entities.after[li@]> dFE.Utility:Fire
- flag <entry[entity].spawned_entities.after[li@]> dFE.Burn_Time:<yaml[dFE_Models].read[<def[model]>.<def[value]>.time]>
- adjust <entry[entity].spawned_entities.after[li@]> marker:false
}
- flag <entry[entity].spawned_entities.after[li@]> dFE.ID:<def[id]>
- yaml id:dFE_Placed_Props set <def[id]>.entities:->:<entry[entity].spawned_entities.after[li@]>
}
- narrate "Placed <def[model]> at location <def[loc].simple> with ID <def[id]>."
# Removes certain placed prop.
dFE_Task_Remove:
type: task
debug: false
definitions: id
script:
- if <def[id].is[==].to[<def[id].as_int>].not> || <def[id].is[LESS].to[0]> {
- narrate "Invalid ID specified. Please use a positive integer."
- queue clear
}
- if <yaml[dFE_Placed_Props].list_keys[].contains[<def[id]>].not> {
- narrate "Placed prop with ID <def[id]> doesn't exist. Make sure you're specifying the correct ID."
- queue clear
}
- light <yaml[dFE_Placed_Props].read[<def[id]>.location].as_location.below> reset
- light <yaml[dFE_Placed_Props].read[<def[id]>.location].as_location.below.below> reset
- remove <yaml[dFE_Placed_Props].read[<def[id]>.entities]>
- narrate "Removed <yaml[dFE_Placed_Props].read[<def[id]>.model]> at location <yaml[dFE_Placed_Props].read[<def[id]>.location].as_location.simple> with ID <def[id]>."
- yaml id:dFE_Placed_Props set <def[id]>:!
# Selects certain placed prop.
dFE_Task_Select:
type: task
debug: false
definitions: id
script:
- if <def[id].is[==].to[<def[id].as_int>].not> || <def[id].is[LESS].to[0]> {
- narrate "Invalid ID specified. Please use a positive integer."
- queue clear
}
- if <yaml[dFE_Placed_Props].list_keys[].contains[<def[id]>].not> {
- narrate "Placed prop with ID <def[id]> doesn't exist. Make sure you're specifying the correct ID."
- queue clear
}
- flag <player> dFE_Selection:<def[id]>
- narrate "Selected <yaml[dFE_Placed_Props].read[<def[id]>.model]> with ID <def[id]>."
# Moves certain placed prop to a location.
dFE_Task_Move:
type: task
debug: true
definitions: id|loc
script:
- if <def[id].is[==].to[<def[id].as_int>].not> || <def[id].is[LESS].to[0]> {
- narrate "Invalid ID specified. Please use a positive integer."
- queue clear
}
- if <yaml[dFE_Placed_Props].list_keys[].contains[<def[id]>].not> {
- narrate "Placed prop with ID <def[id]> doesn't exist. Make sure you're specifying the correct ID."
- queue clear
}
- if <def[loc].is[==].to[<def[loc].as_location>].not> {
- narrate "Invalid location specified. Please use a dLocation."
- queue clear
}
- light <yaml[dFE_Placed_Props].read[<def[id]>.location].as_location.below> reset
- light <yaml[dFE_Placed_Props].read[<def[id]>.location].as_location.below.below> reset
- foreach <yaml[dFE_Placed_Props].read[<def[id]>.entities]> {
- teleport <def[value]> <def[value].location.add[<def[loc]>].sub[<yaml[dFE_Placed_Props].read[<def[id]>.location].as_location>].with_pose[0,<def[value].location.yaw>]>
}
- light <def[loc].below> <def[loc].light>
- light <def[loc].below.below> <def[loc].light>
- yaml id:dFE_Placed_Props set <def[id]>.location:<def[loc]>
- narrate "Moved <yaml[dFE_Placed_Props].read[<def[id]>.model]> with ID <def[id]> to location <def[loc].simple>."
# Rotates a placed drop to match a yaw.
dFE_Task_Rotate:
type: task
debug: false
definitions: id|yaw
script:
- if <def[id].is[==].to[<def[id].as_int>].not> || <def[id].is[LESS].to[0]> {
- narrate "Invalid ID specified. Please use a positive integer."
- queue clear
}
- if <yaml[dFE_Placed_Props].list_keys[].contains[<def[id]>].not> {
- narrate "Placed prop with ID <def[id]> doesn't exist. Make sure you're specifying the correct ID."
- queue clear
}
- if !<def[yaw].round_to[2]||false> && <def[yaw].is[==].to[<def[yaw].as_int>].not> {
- narrate "Invalid yaw specified. Please use a number."
- queue clear
}
- foreach <yaml[dFE_Placed_Props].read[<def[id]>.entities]> {
- teleport <def[value]> <yaml[dFE_Placed_Props].read[<def[id]>.location].as_location.center.add[<def[value].location.sub[<yaml[dFE_Placed_Props].read[<def[id]>.location].as_location.center>].rotate_around_y[<def[yaw].sub[<yaml[dFE_Placed_Props].read[<def[id]>.yaw]>].to_radians.mul[-1]>]>].with_pose[0,<def[yaw]>]>
}
- yaml id:dFE_Placed_Props set <def[id]>.yaw:<def[yaw]>
- narrate "Rotated <yaml[dFE_Placed_Props].read[<def[id]>.model]> with ID <def[id]> to yaw <def[yaw]>."
# Opens the Editor Menu for certain model and part.
dFE_Task_Edit:
type: task
debug: false
definitions: model|part
script:
- if <def[model]> == -all {
- narrate "Opening main Editor menu."
- inventory open d:in@Editor_Menu
- queue clear
}
- if <yaml[dFE_Models].list_keys[].contains[<def[model]>].not> {
- narrate "Model with name <def[model]> doesn't exist. Make sure you're specifying the correct model."
- queue clear
}
- if <def[part]> == -all {
- flag <player> dFE.Editing1:<def[model]>
- narrate "Editing model <def[model]>."
- inventory open d:in@Model_Menu
- queue clear
}
- if <yaml[dFE_Models].list_keys[<def[model]>].contains[<def[part]>].not> {
- narrate "Part with name <def[part]> doesn't exist. Make sure you're specifying the correct part."
- queue clear
}
- flag <player> dFE.Editing1:<def[model]>
- flag <player> dFE.Editing2:<def[part]>
- narrate "Editing <def[part]> from model <def[model]>."
- inventory open d:in@Part_Menu
# Changes the ID of a placed prop.
dFE_Task_ChangeId:
type: task
debug: false
definitions: old|new
script:
- if <def[old].is[==].to[<def[old].as_int>].not> || <def[new].is[==].to[<def[new].as_int>].not> {
- narrate "Invalid IDs specified. Please use two positive integers."
- queue clear
}
- if <def[old].is[LESS].to[1]> || <def[new].is[LESS].to[1]> {
- narrate "Invalid IDs specified. Please use two positive integers."
- queue clear
}
- if <def[new]> >= <def[old]> {
- narrate "The new id must be lower than the old one."
- queue clear
}
- if <yaml[dFE_Placed_Props].list_keys[].contains[<def[old]>].not> {
- narrate "Placed prop with ID <def[old]> doesn't exist. Make sure you're specifying the correct ID."
- queue clear
}
- if <yaml[dFE_Placed_Props].list_keys[].contains[<def[new]>]> {
- narrate "Placed prop with ID <def[new]> already exists. Make sure you're specifying an unused ID."
- queue clear
}
- foreach <yaml[dFE_Placed_Props].list_keys[<def[old]>]> {
- yaml id:dFE_Placed_Props set <def[new]>.<def[value]>:<yaml[dFE_Placed_Props].read[<def[old]>.<def[value]>]>
}
- yaml id:dFE_Placed_Props set <def[old]>:!
- narrate "Changed placed prop with old ID <def[old]> to new ID <def[new]>"
# Updates placed models to match their latest values.
dFE_Task_Update:
type: task
debug: true
definitions: model
script:
- foreach <yaml[dFE_Placed_Props].list_keys[]> {
- if <yaml[dFE_Placed_Props].read[<def[value]>.model].is[==].to[<def[model]>]> {
- define loc <yaml[dFE_Placed_Props].read[<def[value]>.location]>
- define model <yaml[dFE_Placed_Props].read[<def[value]>.model]>
- define yaw <yaml[dFE_Placed_Props].read[<def[value]>.yaw]>
- define id <def[value]>
- remove <yaml[dFE_Placed_Props].read[<def[id]>.entities]>
- yaml id:dFE_Placed_Props set <def[id]>:!
- yaml id:dFE_Placed_Props set <def[id]>.location:<def[loc]>
- yaml id:dFE_Placed_Props set <def[id]>.model:<def[model]>
- yaml id:dFE_Placed_Props set <def[id]>.yaw:<def[yaw]>
- foreach <yaml[dFE_Models].list_keys[<def[model]>]> {
- define location l@<yaml[dFE_Models].read[<def[model]>.<def[value]>.location]>
- define angle <yaml[dFE_Models].read[<def[model]>.<def[value]>.angle].split[,].as_list.parse[to_radians].separated_by[,]>
- define small <yaml[dFE_Models].read[<def[model]>.<def[value]>.small]>
- define item <yaml[dFE_Models].read[<def[model]>.<def[value]>.item]||air>
- define type <yaml[dFE_Models].read[<def[model]>.<def[value]>.type]>
- define sityaw <yaml[dFE_Models].read[<def[model]>.<def[value]>.yaw]||0>
- spawn armor_stand[marker=true;max_health=0.1;visible=false;gravity=false;is_small=<def[small]>;equipment=air|air|air|<def[item]>;armor_pose=head|<def[angle]>] <def[loc].center.add[<def[location].rotate_around_y[<def[yaw].to_radians.mul[-1]>]>].with_pose[0,<def[yaw].add[<def[sityaw]>]>]> save:entity
- if <def[type].is[==].to[sit]> {
- flag <entry[entity].spawned_entities.after[li@]> dFE.Utility:Sit
- adjust <entry[entity].spawned_entities.after[li@]> marker:false
} else if <def[type].is[==].to[fire]> {
- flag <entry[entity].spawned_entities.after[li@]> dFE.Utility:Fire
- flag <entry[entity].spawned_entities.after[li@]> dFE.Burn_Time:<yaml[dFE_Models].read[<def[model]>.<def[value]>.time]>
- adjust <entry[entity].spawned_entities.after[li@]> marker:false
}
- flag <entry[entity].spawned_entities.after[li@]> dFE.ID:<def[id]>
- yaml id:dFE_Placed_Props set <def[id]>.entities:->:<entry[entity].spawned_entities.after[li@]>
}
}
}
- narrate "Updated all placed props <def[model]> props."
# Plays fire in an entity position for a minute.
dFE_Task_Fire:
type: task
debug: true
definitions: entity|time
script:
- if <def[time].is[==].to[<def[time].as_int>].not> || <def[time].is[LESS].than[1]> {
- narrate "Invalid time specified!"
- queue clear
}
- repeat <def[time].mul[2]> {
- if <def[entity].is_spawned.not||true> {
- queue clear
}
- if <def[entity].location.find.entities[player].within[16].size.is[MORE].than[0]> {
- playeffect <def[entity].location> effect:flame data:0.001 quantity:<yaml[dFE_Models].read[<yaml[dFE_Placed_Props].read[<def[entity].flag[dFE.ID]>.model]>.quantity]> offset:0.05,0.05,0.05
}
- wait 10t
}
# __ __ _ _ _____ _ _
# \ \ / / | | | | / ____| (_) | |
# \ \ /\ / /__ _ __| | __| | | (___ ___ _ __ _ _ __ | |_ ___
# \ \/ \/ / _ \| '__| |/ _` | \___ \ / __| '__| | '_ \| __/ __|
# \ /\ / (_) | | | | (_| | ____) | (__| | | | |_) | |_\__ \
# \/ \/ \___/|_| |_|\__,_| |_____/ \___|_| |_| .__/ \__|___/
# | |
# |_|
dFE_World:
type: world
debug: false
events:
# Loads the files, or creates them if it doesn't exist yet.
on server start:
- foreach li@dFE_Models|dFE_Placed_Props {
- if <server.has_file[/dFurnitureEditor/<def[value]>.yml]> {
- yaml "load:/dFurnitureEditor/<def[value]>.yml" id:<def[value]>
}
else {
- yaml create id:<def[value]>
- yaml "savefile:/dFurnitureEditor/<def[value]>.yml" id:<def[value]>
}
}
# Loads the files, or creates them if it doesn't exist yet.
on reload scripts:
- foreach li@dFE_Models|dFE_Placed_Props {
- if <server.has_file[/dFurnitureEditor/<def[value]>.yml]> {
- yaml "savefile:/dFurnitureEditor/<def[value]>.yml" id:<def[value]>
- yaml "load:/dFurnitureEditor/<def[value]>.yml" id:<def[value]>
}
else {
- yaml create id:<def[value]>
- yaml "savefile:/dFurnitureEditor/<def[value]>.yml" id:<def[value]>
}
}
# Saves and unloads the data.
on shutdown:
- foreach li@dFE_Models|dFE_Placed_Props {
- yaml "savefile:/dFurnitureEditor/<def[value]>.yml" id:<def[value]>
- yaml unload id:<def[value]>
}
# Listener for the Editor Menu. Prevents clicking items.
on player clicks in Editor_Menu:
- determine passively cancelled
- choose <context.item.display.strip_color>:
- case "Exit":
- inventory close
- case "Create Model":
- inventory close
- narrate "Enter name for the new model."
- flag player dFE.CreateModel
- default:
- if <context.item.material> == m@workbench {
- inventory close
- flag player dFE.Editing1:<context.item.display.strip_color>
- inventory open d:in@Model_Menu
}
# Prevents dragging items.
on player drags in Editor_Menu:
- determine cancelled
# Listener for the Prop Menu. Prevents clicking items.
on player clicks in Model_Menu:
- determine passively cancelled
- choose <context.item.display.strip_color>:
- case "Return":
- inventory open d:in@Editor_Menu
- case "Delete Model":
- if <player.has_flag[dFE.DeleteModel].not> {
- flag <player> dFE.DeleteModel duration:2s
- narrate "<yellow>Click again to confirm."
- queue clear
}
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>:!
- narrate "Model <yellow><player.flag[dFE.Editing1]> <gray>deleted!"
- inventory open d:in@Editor_Menu
- case "Create Part":
- inventory close
- narrate "Enter name for the new part."
- flag player dFE.CreatePart
- default:
- if <context.item.material> == m@armor_stand {
- inventory close
- flag player dFE.Editing2:<context.item.display.strip_color>
- inventory open d:in@Part_Menu
}
# Prevents dragging items.
on player drags in Model_Menu:
- determine cancelled
# Listener for the Part Menu. Prevents clicking items.
on player clicks in Part_Menu:
- determine passively cancelled
- choose <context.item.display.strip_color>:
- case "Return":
- inventory open d:in@Model_Menu
- case "Delete Part":
- if <player.has_flag[dFE.DeletePart].not> {
- flag <player> dFE.DeletePart duration:2s
- narrate "<yellow>Click again to confirm."
- queue clear
}
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>:!
- narrate "Part <yellow><player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]> <gray>deleted!"
- inventory open d:in@Model_Menu
- case "Type":
- inventory close
- narrate "Enter type of the element (normal, sit and fire allowed)."
- flag player dFE.SetType
- case "Location":
- inventory close
- narrate "Enter location offset value as x,y,z."
- flag player dFE.SetLocation
- case "Angle":
- inventory close
- narrate "Enter head angle values as a,b,c."
- flag player dFE.SetAngle
- case "Small":
- inventory close
- narrate "Small state toggled."
- if <yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.small]> == true {
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.small:false
}
else {
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.small:true
}
- run dFE_Task_Update def:<player.flag[dFE.Editing1]> instantly
- inventory open d:in@Part_Menu
- case "Item":
- inventory close
- narrate "Enter name of item to equip."
- flag player dFE.SetItem
- case "Time":
- inventory close
- if <context.click> == left {
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.time:++
} else if <context.click> == right {
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.time:--
}
- run dFE_Task_Update def:<player.flag[dFE.Editing1]> instantly
- inventory open d:in@Part_Menu
- case "Yaw":
- inventory close
- if <context.click> == left {
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.yaw:++
} else if <context.click> == right {
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.yaw:--
}
- run dFE_Task_Update def:<player.flag[dFE.Editing1]> instantly
- inventory open d:in@Part_Menu
# Prevents dragging items.
on player drags in Part_Menu:
- determine cancelled
# Listens to the chat as input for names and values.
on player chats:
# Enter name for the new prop.
- if <player.has_flag[dFE.CreateModel]> {
- determine passively cancelled
# Checks for input to be alphanumerical & _.
- if <context.message.matches[<&lb>a-zA-Z0-9_<&rb>+].not> {
- narrate "Prop names must be alphanumerical & _, please try again with a valid name."
- queue clear
}
- if <yaml[dFE_Models].list_keys[].contains[<context.message>]> {
- narrate "Prop name <context.message> already in use!"
}
else {
- yaml id:dFE_Models set <context.message>:empty
- narrate "Prop <context.message> created!"
}
- flag player dFE.CreateModel:!
- flag player dFE.Editing1:<context.message>
- inventory open d:in@Model_Menu
# Enter name for the new part.
} else if <player.has_flag[dFE.CreatePart]> {
- determine passively cancelled
# Checks for input to be alphanumerical & _.
- if <context.message.matches[<&lb>a-zA-Z0-9_<&rb>+].not> {
- narrate "Part names must be alphanumerical & _, please try again with a valid name."
- queue clear
}
- if <yaml[dFE_Models].list_keys[<player.flag[dFE.Editing1]>].contains[<context.message>]> {
- narrate "Part name already in use!"
}
else {
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<context.message>.location:0,0,0
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<context.message>.angle:0,0,0
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<context.message>.small:false
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<context.message>.item:stone
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<context.message>.type:normal
- narrate "Part <context.message> created!"
}
- flag player dFE.CreatePart:!
- flag player dFE.Editing2:<context.message>
- inventory open d:in@Part_Menu
# Enter location offset value as x,y,z.
} else if <player.has_flag[dFE.SetLocation]> {
- determine passively cancelled
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.location:<context.message>
- narrate "Location offset set to <context.message>!"
- run dFE_Task_Update def:<player.flag[dFE.Editing1]> instantly
- flag player dFE.SetLocation:!
- inventory open d:in@Part_Menu
# Enter head angle values as a,b,c.
} else if <player.has_flag[dFE.SetAngle]> {
- determine passively cancelled
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.angle:<context.message>
- narrate "Rotation angle set to <context.message>!"
- run dFE_Task_Update def:<player.flag[dFE.Editing1]> instantly
- flag player dFE.SetAngle:!
- inventory open d:in@Part_Menu
# Enter item name to equip.
} else if <player.has_flag[dFE.SetItem]> {
- determine passively cancelled
- if <li@sit|fire.contains[<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.type]>]> {
- narrate "You can't give an item to a this type of element! Please change the element type to normal first."
- queue clear
}
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.item:<context.message>
- narrate "Item name set to <context.message>!"
- run dFE_Task_Update def:<player.flag[dFE.Editing1]> instantly
- flag player dFE.SetItem:!
- inventory open d:in@Part_Menu
# Enter element type.
} else if <player.has_flag[dFE.SetType]> {
- determine passively cancelled
- if <li@normal|sit|fire.contains[<context.message>].not> {
- narrate "Invalid element type! Valid types are normal, sit and fire."
- queue clear
}
- if <context.message> == normal {
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.item:air
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.time:!
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.yaw:!
} else if <context.message> == sit {
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.item:!
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.time:!
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.yaw:0.0
} else if <context.message> == fire {
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.item:!
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.time:15.0
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.yaw:!
} else {
- narrate "Invalid element type! Use normal, sit or fire."
- queue clear
}
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.type:<context.message>
- narrate "Element type set to <context.message>!"
- run dFE_Task_Update def:<player.flag[dFE.Editing1]> instantly
- flag player dFE.SetType:!
- inventory open d:in@Part_Menu
}
# Listener for sitting components in placed Models.
on player right clicks at entity:
- determine passively cancelled
- foreach <context.entity.location.find.entities[armor_stand].within[2].filter[has_flag[dFE.Utility]]> {
- if <context.entity.flag[dFE.ID]> == <def[value].flag[dFE.ID]> {
- define entity <def[value]>
}
}
- choose <def[entity].flag[dFE.Utility]||null>:
- case "Sit":
- if <def[entity].has_passenger> && <def[entity].passenger.is[!=].to[<player>]||false> {
- narrate "That position is already occupied by another person!"
- queue clear
}
- mount <player>|<def[entity]> <def[entity].location>
- case "Fire":
- define time <def[entity].flag[dFE.Burn_Time]>
- run dFE_Task_Fire def:<def[entity]>|<def[time].as_int> instantly
# Hourly backups to avoid data loss on server crash. Also BC's script-tracker.
on system time hourly:
- webget "http://stats.denizenscript.com/tracker?script=98&players=<server.list_online_players.size>&script_version=0.8.2&models=<yaml[dFE_Models].list_keys[].size>&placed_props=<yaml[dFE_Placed_Props].list_keys[].size>&tps=<server.recent_tps>"
- foreach li@dFE_Models|dFE_Placed_Props {
- yaml "savefile:/dFurnitureEditor/<def[value]>.yml" id:dFE_<def[value]>
}
# _____ _ _____ _ _
# |_ _| | | / ____| (_) | |
# | | _ ____ _____ _ __ | |_ ___ _ __ _ _ | (___ ___ _ __ _ _ __ | |_ ___
# | | | '_ \ \ / / _ \ '_ \| __/ _ \| '__| | | | \___ \ / __| '__| | '_ \| __/ __|
# _| |_| | | \ V / __/ | | | || (_) | | | |_| | ____) | (__| | | | |_) | |_\__ \
# |_____|_| |_|\_/ \___|_| |_|\__\___/|_| \__, | |_____/ \___|_| |_| .__/ \__|___/
# __/ | | |
# |___/ |_|
Editor_Menu:
type: inventory
debug: false
inventory: chest
size: 54
title: "Editor Menu"
slots:
- "[i@green_wool[display_name=<&b>Exit]] [i@air] [i@blue_wool[display_name=<&b>Create Model]] [i@air] [] [] [] [] []"
- "[i@air] [i@air] [i@air] [i@air] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
procedural items:
- define items li@
- foreach <yaml[dFE_Models].list_keys[].as_list.alphanumeric||li@> {
- define items "<def[items].include[i@workbench[display_name=<&b><def[value]>;lore=<&d>Parts:|<yaml[dFE_Models].list_keys[<def[value]>].as_list.alphanumeric.after[li@]||None>]]>"
}
- determine <def[items]>
Model_Menu:
type: inventory
debug: false
inventory: chest
size: 54
title: "Model: <player.flag[dFE.Editing1]>"
slots:
- "[i@green_wool[display_name=<&b>Return]] [i@air] [i@red_wool[display_name=<&b>Delete Model]] [i@air] [i@blue_wool[display_name=<&b>Create Part]] [i@air] [] [] []"
- "[i@air] [i@air] [i@air] [i@air] [i@air] [i@air] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
procedural items:
- define items li@
- foreach <yaml[dFE_Models].list_keys[<player.flag[dFE.Editing1]>].as_list.alphanumeric||li@> {
- define part <def[value]>
- define lore li@
- foreach <yaml[dFE_Models].list_keys[<player.flag[dFE.Editing1]>.<def[part]>].as_list.alphanumeric> {
- define lore "<def[lore].include[<&d><def[value]>: <&5><&o><yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<def[part]>.<def[value]>]>]>"
}
- define items "<def[items].include[i@armor_stand[display_name=<&b><def[part]>;lore=<def[lore]>]]>"
}
- determine <def[items]>
Part_Menu:
type: inventory
debug: false
inventory: chest
size: 18
title: "Model: <player.flag[dFE.Editing1]> Part: <player.flag[dFE.Editing2]>"
slots:
- "[i@green_wool[display_name=<&b>Return]] [i@air] [i@red_wool[display_name=<&b>Delete Part]] [i@air] [] [] [] [] []"
- "[i@air] [i@air] [i@air] [i@air] [] [] [] [] []"
procedural items:
- define items li@
- foreach <yaml[dFE_Models].list_keys[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>].as_list.exclude[entities|marker].alphanumeric||li@> {
- define items <def[items].include[i@paper[display_name=<&b><def[value]>;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.<def[value]>]>]]>
}
- determine <def[items]>
View History