dFurnitureEditor_Version:
type: version
author: Xenmai
name: dFurnitureEditor
version: 0.9
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.8 (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].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 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 {
- 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].read[Models].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:<yaml[dFE_Models].read[<def[model]>]>
- if <def[type].is[==].to[sit]> {
- flag <entry[<yaml[dFE_Models].read[<def[model]>]>].spawned_entities.after[li@]> dFE_Sit
- adjust <entry[<yaml[dFE_Models].read[<def[model]>]>].spawned_entities.after[li@]> marker:false
}
else if <def[type].is[==].to[fire]> {
- flag <entry[<yaml[dFE_Models].read[<def[model]>]>].spawned_entities.after[li@]> dFE_Fire
}
- flag <entry[<yaml[dFE_Models].read[<def[model]>]>].spawned_entities.after[li@]> dFE_ID:<def[id]>
- yaml id:dFE_Placed_Props set <def[id]>.entities:->:<entry[<yaml[dFE_Models].read[<def[model]>]>].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].read[Models].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]>
- define type <yaml[dFE_Models].read[<def[model]>.<def[value]>.type]>
- spawn armor_stand[marker=false;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]>]> save:<yaml[dFE_Models].read[<def[model]>]>
- if <def[type].is[==].to[sit]> {
- flag <entry[<yaml[dFE_Models].read[<def[model]>]>].spawned_entities.after[li@]> dFE_Sit
- adjust <entry[<yaml[dFE_Models].read[<def[model]>]>].spawned_entities.after[li@]> marker:false
}
else if <def[type].is[==].to[fire]> {
- flag <entry[<yaml[dFE_Models].read[<def[model]>]>].spawned_entities.after[li@]> dFE_Fire
}
- flag <entry[<yaml[dFE_Models].read[<def[model]>]>].spawned_entities.after[li@]> dFE_ID:<def[id]>
- yaml id:dFE_Placed_Props set <def[id]>.entities:->:<entry[<yaml[dFE_Models].read[<def[model]>]>].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
script:
- repeat 119 {
- 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:<yaml[dFE_Models].read[<yaml[dFE_Placed_Props].read[<def[entity].flag[dFE_ID]>.model]>.offset]>
}
- wait 10t
}
# __ __ _ _ _____ _ _
# \ \ / / | | | | / ____| (_) | |
# \ \ /\ / /__ _ __| | __| | | (___ ___ _ __ _ _ __ | |_ ___
# \ \/ \/ / _ \| '__| |/ _` | \___ \ / __| '__| | '_ \| __/ __|
# \ /\ / (_) | | | | (_| | ____) | (__| | | | |_) | |_\__ \
# \/ \/ \___/|_| |_|\__,_| |_____/ \___|_| |_| .__/ \__|___/
# | |
# |_|
dFE_World:
type: world
- debug: true
+ 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]> {
- if <yaml.list.contains[<def[value]>].not> {
- 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.slot>:
- case 1:
- inventory close
- case 3:
- inventory close
- narrate "Enter name for the new prop."
- flag player dFE.CreateProp
- case 4:
- inventory close
- narrate "Enter name of the prop to delete."
- flag player dFE.DeleteProp
- 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.slot>:
- case 1:
- inventory close
- inventory open d:in@Editor_Menu
- case 3:
- inventory close
- narrate "Enter name for the new part."
- flag player dFE.CreatePart
- case 4:
- inventory close
- narrate "Enter name of the part to delete."
- flag player dFE.DeletePart
- 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 close
- 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 "Yaw":
- inventory close
- narrate "Enter value of sitting yaw."
- flag player dFE.SetYaw
# 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.CreateProp]> {
- 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].read[Models].contains[<context.message>]> {
- narrate "Prop name <context.message> already in use!"
}
else {
- yaml id:dFE_Models set Models:->:<context.message>
- narrate "Prop <context.message> created!"
}
- flag player dFE.CreateProp:!
- inventory open d:in@Editor_Menu
}
# Enter name of prop to delete.
else if <player.has_flag[dFE.DeleteProp]> {
- determine passively cancelled
- if <yaml[dFE_Models].read[Models].contains[<context.message>]> {
- yaml id:dFE_Models set Models:<-:<context.message>
- yaml id:dFE_Models set <context.message>:!
- narrate "Prop <context.message> deleted!"
}
else {
- narrate "Prop <context.message> doesn't exist!"
}
- flag player dFE.DeleteProp:!
- inventory open d:in@Editor_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:!
- inventory open d:in@Model_Menu
}
# Enter name of part to delete.
else if <player.has_flag[dFE.DeletePart]> {
- determine passively cancelled
- if <yaml[dFE_Models].list_keys[<player.flag[dFE.Editing1]>].contains[<context.message>]> {
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<context.message>:!
- narrate "Part <context.message> deleted!"
- run dFE_Task_Update def:<player.flag[dFE.Editing1]> instantly
}
else {
- narrate "Part <context.message> doesn't exist!"
}
- flag player dFE.DeletePart:!
- inventory open d:in@Model_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 <li@sit|fire.contains[<context.message>]> {
- yaml id:dFE_Models set <player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.item:air
- narrate "Element item set to air!"
}
- 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
- define entity <context.entity.location.find.entities[armor_stand].within[1.2].filter[has_flag[dFE_Sit]].get[1]>
- if <def[entity]||null> == null {
- queue clear
}
- 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.with_pose[0,<player.location.yaw.add[180]>]>
# Listener for fire components in placed Models.
on system time minutely:
- foreach <yaml[dFE_Placed_Props].list_keys[]> {
- foreach <yaml[dFE_Placed_Props].read[<def[value]>.entities]> {
- define entity <def[value]>
- if <def[entity].has_flag[dFE_Fire]> {
- run dFE_Task_Fire def:<def[entity]> 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].read[Models].size>&placed_props=<yaml[dFE_Placed_Props].list_keys[].size>&tps=<server.recent_tps>"
- foreach li@Models|Placed_Props {
- yaml "savefile:/dFurnitureEditor/dFE_<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@air] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
procedural items:
- define items "li@i@blue_wool[display_name=<&b>Create a new prop]|i@red_wool[display_name=<&b>Delete a prop]"
- foreach <yaml[dFE_Models].read[Models].as_list.alphanumeric> {
- 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: "Prop Menu"
slots:
- "[i@green_wool[display_name=<&b>Return]] [i@air] [] [] [i@air] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
- "[] [] [] [] [] [] [] [] []"
procedural items:
- define items "li@i@blue_wool[display_name=<&b>Create a new part]|i@red_wool[display_name=<&b>Delete a part]"
- if <yaml[dFE_Models].list_keys[<player.flag[dFE.Editing1]>].as_list.alphanumeric||null> != null {
- foreach <yaml[dFE_Models].list_keys[<player.flag[dFE.Editing1]>].as_list.alphanumeric> {
- define items "<def[items].include[i@armor_stand[display_name=<&b><def[value]>;lore=<&d>Location: <&5><&o><yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<def[value]>.location]>|<&d>Angle: <&5><&o><yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<def[value]>.angle]>|<&d>Small: <&5><&o><yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<def[value]>.small]>|<&d>Item: <&5><&o><yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<def[value]>.item]>|<&d>Type: <&5><&o><yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<def[value]>.type]>]]>"
}
}
- determine <def[items]>
Part_Menu:
type: inventory
debug: false
inventory: chest
size: 9
title: "Part Menu"
slots:
- "[i@green_wool[display_name=<&b>Return]] [i@air] [] [] [] [] [] [] []"
procedural items:
- if <yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.type]> == "normal" {
- define items "li@i@paper[display_name=<&b>Type;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.type]>]|i@paper[display_name=<&b>Location;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.location]>]|i@paper[display_name=<&b>Angle;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.angle]>]|i@paper[display_name=<&b>Small;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.small]>]|i@paper[display_name=<&b>Item;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.item]>]"
}
else if <yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.type]> == "sit" {
- define items "li@i@paper[display_name=<&b>Type;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.type]>]|i@paper[display_name=<&b>Location;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.location]>]|i@paper[display_name=<&b>Yaw;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.yaw]>]"
}
else if <yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.type]> == "fire" {
- define items "li@i@paper[display_name=<&b>Type;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.type]>]|i@paper[display_name=<&b>Location;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.location]>]|i@paper[display_name=<&b>Offset;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.offset]>]|i@paper[display_name=<&b>Quantity;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.quantity]>]"
}
else if <yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.type]> == "banner" {
- define items "li@i@paper[display_name=<&b>Type;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.type]>]|i@paper[display_name=<&b>Location;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.location]>]"
}
else if <yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.type]> == "container" {
- define items "li@i@paper[display_name=<&b>Type;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.type]>]|i@paper[display_name=<&b>Location;lore=li@<yaml[dFE_Models].read[<player.flag[dFE.Editing1]>.<player.flag[dFE.Editing2]>.location]>]"
}
- determine <def[items]>