dFurnitureEditor_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 > tab complete: - if !> queue clear - determine ]]> script: - if !> { - narrate "You do not have permission for that command." - queue clear } - if { - narrate "> GENERAL dFE INFORMATION:" - narrate "Author: xenmai" - narrate "Denizen Version: Release Build #1623" - narrate "Script Version: 0.9 (alpha)" } - choose : # Opens the general dFE editor GUI. - case edit: - flag dFE:! - if { - if { - 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 { - if { - define model .model]> } else if { - define model .model]> } else if ]> && { - define model .model]> } else if a-zA-Z0-9_<&rb>+]> { - define model } else { - narrate "Invalid second argument specified. Please use -a, -s, -t, a positive integer or a model name." - queue clear } - if { - define part -all } else if a-zA-Z0-9_<&rb>+]> { - define part } 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:| instantly # Selects a placed prop for later ease of moving or removing. - case select: - if { - narrate "Invalid number of arguments specified. Proper usage is '/dfe select [-t/#]'." - queue clear } - if { - run dFE_Task_Select def: instantly } else if ]> && { - run dFE_Task_Select def: instantly } else { - narrate "Invalid second argument specified. Please use -t or a positive integer." } # Moves a placed prop to your position. - case move: - if { - narrate "Invalid number of arguments specified. Proper usage is '/dfe move [-s/#]'." - queue clear } - if { - run dFE_Task_Move def:| instantly } else if ]> && { - run dFE_Task_Move def:| instantly } else { - narrate "Invalid second argument specified. Please use -s or a positive integer." } # Rotates a placed drop to a yaw. - case rotate: - if { - narrate "Invalid number of arguments specified. Proper usage is '/dfe rotate [-s/-t/#] [#]'." - queue clear } - if { - run dFE_Task_Rotate def:| instantly } else if { - run dFE_Task_Rotate def:| instantly } else if ]> && { - run dFE_Task_Rotate def:| 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 { - narrate "Invalid number of arguments specified. Proper usage is '/dfe place [<<>model<>>] [-p/#.#]'." - queue clear } - if { - run dFE_Task_Place def:|| instantly } else if || ]> { - run dFE_Task_Place def:|| 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 { - narrate "Invalid number of arguments specified. Proper usage is '/dfe remove [-s/-t/#]'." - queue clear } - if { - run dFE_Task_Remove def: instantly } else if { - run dFE_Task_Remove def: instantly } else if ]> && { - run dFE_Task_Remove def: 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 { - narrate "Invalid number of arguments specified. Proper usage is '/dfe changeid [#] [#]'." - queue clear } - run dFE_Task_ChangeId def:| instantly # _______ _ _____ _ _ # |__ __| | | / ____| (_) | | # | | __ _ ___| | __ | (___ ___ _ __ _ _ __ | |_ ___ # | |/ _` / __| |/ / \___ \ / __| '__| | '_ \| __/ __| # | | (_| \__ \ < ____) | (__| | | | |_) | |_\__ \ # |_|\__,_|___/_|\_\ |_____/ \___|_| |_| .__/ \__|___/ # | | # |_| # Places certain model at a location with a specified yaw. dFE_Task_Place: type: task debug: false definitions: loc|yaw|model script: - if ].not> { - narrate "Model with name doesn't exist. Make sure you're specifying the correct model." - queue clear } - light - light - define id 1 - while ]> { - define id } - yaml id:dFE_Placed_Props set .location: - yaml id:dFE_Placed_Props set .yaw: - yaml id:dFE_Placed_Props set .model: - foreach ]> { - define location l@..location]> - define angle ..angle].split[,].as_list.parse[to_radians].separated_by[,]||0,0,0> - define small ..small]> - define item ..item]||air> - define type ..type]> - define sityaw ..yaw]||0> - spawn armor_stand[marker=true;max_health=0.1;visible=false;gravity=false;is_small=;equipment=air|air|air|;armor_pose=head|] ]>].with_pose[0,]>]> save:entity - if { - flag dFE.Utility:Sit - adjust marker:false } else if { - flag dFE.Utility:Fire - flag dFE.Burn_Time:..time]> - adjust marker:false } - flag dFE.ID: - yaml id:dFE_Placed_Props set .entities:->: } - narrate "Placed at location with ID ." # Removes certain placed prop. dFE_Task_Remove: type: task debug: false definitions: id script: - if ].not> || { - narrate "Invalid ID specified. Please use a positive integer." - queue clear } - if ].not> { - narrate "Placed prop with ID doesn't exist. Make sure you're specifying the correct ID." - queue clear } - light .location].as_location.below> reset - light .location].as_location.below.below> reset - remove .entities]> - narrate "Removed .model]> at location .location].as_location.simple> with ID ." - yaml id:dFE_Placed_Props set :! # Selects certain placed prop. dFE_Task_Select: type: task debug: false definitions: id script: - if ].not> || { - narrate "Invalid ID specified. Please use a positive integer." - queue clear } - if ].not> { - narrate "Placed prop with ID doesn't exist. Make sure you're specifying the correct ID." - queue clear } - flag dFE_Selection: - narrate "Selected .model]> with ID ." # Moves certain placed prop to a location. dFE_Task_Move: type: task debug: true definitions: id|loc script: - if ].not> || { - narrate "Invalid ID specified. Please use a positive integer." - queue clear } - if ].not> { - narrate "Placed prop with ID doesn't exist. Make sure you're specifying the correct ID." - queue clear } - if ].not> { - narrate "Invalid location specified. Please use a dLocation." - queue clear } - light .location].as_location.below> reset - light .location].as_location.below.below> reset - foreach .entities]> { - teleport ].sub[.location].as_location>].with_pose[0,]> } - light - light - yaml id:dFE_Placed_Props set .location: - narrate "Moved .model]> with ID to location ." # Rotates a placed drop to match a yaw. dFE_Task_Rotate: type: task debug: false definitions: id|yaw script: - if ].not> || { - narrate "Invalid ID specified. Please use a positive integer." - queue clear } - if ].not> { - narrate "Placed prop with ID doesn't exist. Make sure you're specifying the correct ID." - queue clear } - if ! && ].not> { - narrate "Invalid yaw specified. Please use a number." - queue clear } - foreach .entities]> { - teleport .location].as_location.center.add[.location].as_location.center>].rotate_around_y[.yaw]>].to_radians.mul[-1]>]>].with_pose[0,]> } - yaml id:dFE_Placed_Props set .yaw: - narrate "Rotated .model]> with ID to yaw ." # Opens the Editor Menu for certain model and part. dFE_Task_Edit: type: task debug: false definitions: model|part script: - if == -all { - narrate "Opening main Editor menu." - inventory open d:in@Editor_Menu - queue clear } - if ].not> { - narrate "Model with name doesn't exist. Make sure you're specifying the correct model." - queue clear } - if == -all { - flag dFE.Editing1: - narrate "Editing model ." - inventory open d:in@Model_Menu - queue clear } - if ].contains[].not> { - narrate "Part with name doesn't exist. Make sure you're specifying the correct part." - queue clear } - flag dFE.Editing1: - flag dFE.Editing2: - narrate "Editing from 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 ].not> || ].not> { - narrate "Invalid IDs specified. Please use two positive integers." - queue clear } - if || { - narrate "Invalid IDs specified. Please use two positive integers." - queue clear } - if >= { - narrate "The new id must be lower than the old one." - queue clear } - if ].not> { - narrate "Placed prop with ID doesn't exist. Make sure you're specifying the correct ID." - queue clear } - if ]> { - narrate "Placed prop with ID already exists. Make sure you're specifying an unused ID." - queue clear } - foreach ]> { - yaml id:dFE_Placed_Props set .:.]> } - yaml id:dFE_Placed_Props set :! - narrate "Changed placed prop with old ID to new ID " # Updates placed models to match their latest values. dFE_Task_Update: type: task debug: true definitions: model script: - foreach { - if .model].is[==].to[]> { - define loc .location]> - define model .model]> - define yaw .yaw]> - define id - remove .entities]> - yaml id:dFE_Placed_Props set :! - yaml id:dFE_Placed_Props set .location: - yaml id:dFE_Placed_Props set .model: - yaml id:dFE_Placed_Props set .yaw: - foreach ]> { - define location l@..location]> - define angle ..angle].split[,].as_list.parse[to_radians].separated_by[,]> - define small ..small]> - define item ..item]||air> - define type ..type]> - define sityaw ..yaw]||0> - spawn armor_stand[marker=true;max_health=0.1;visible=false;gravity=false;is_small=;equipment=air|air|air|;armor_pose=head|] ]>].with_pose[0,]>]> save:entity - if { - flag dFE.Utility:Sit - adjust marker:false } else if { - flag dFE.Utility:Fire - flag dFE.Burn_Time:..time]> - adjust marker:false } - flag dFE.ID: - yaml id:dFE_Placed_Props set .entities:->: } } } - narrate "Updated all placed props props." # Plays fire in an entity position for a minute. dFE_Task_Fire: type: task debug: true definitions: entity|time script: - if ].not> || { - narrate "Invalid time specified!" - queue clear } - repeat { - if { - queue clear } - if { - playeffect effect:flame data:0.001 quantity:.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 .yml]> { - yaml "load:/dFurnitureEditor/.yml" id: } else { - yaml create id: - yaml "savefile:/dFurnitureEditor/.yml" id: } } # Loads the files, or creates them if it doesn't exist yet. on reload scripts: - foreach li@dFE_Models|dFE_Placed_Props { - if .yml]> { - yaml "savefile:/dFurnitureEditor/.yml" id: - yaml "load:/dFurnitureEditor/.yml" id: } else { - yaml create id: - yaml "savefile:/dFurnitureEditor/.yml" id: } } # Saves and unloads the data. on shutdown: - foreach li@dFE_Models|dFE_Placed_Props { - yaml "savefile:/dFurnitureEditor/.yml" id: - yaml unload id: } # Listener for the Editor Menu. Prevents clicking items. on player clicks in Editor_Menu: - determine passively cancelled - choose : - case "Exit": - inventory close - case "Create Model": - inventory close - narrate "Enter name for the new model." - flag player dFE.CreateModel - default: - if == m@workbench { - inventory close - flag player dFE.Editing1: - 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 : - case "Return": - inventory open d:in@Editor_Menu - case "Delete Model": - if { - flag dFE.DeleteModel duration:2s - narrate "Click again to confirm." - queue clear } - yaml id:dFE_Models set :! - narrate "Model 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 == m@armor_stand { - inventory close - flag player dFE.Editing2: - 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 : - case "Return": - inventory open d:in@Model_Menu - case "Delete Part": - if { - flag dFE.DeletePart duration:2s - narrate "Click again to confirm." - queue clear } - yaml id:dFE_Models set .:! - narrate "Part . 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 ..small]> == true { - yaml id:dFE_Models set ..small:false } else { - yaml id:dFE_Models set ..small:true } - run dFE_Task_Update def: 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 == left { - yaml id:dFE_Models set ..time:++ } else if == right { - yaml id:dFE_Models set ..time:-- } - run dFE_Task_Update def: instantly - inventory open d:in@Part_Menu - case "Yaw": - inventory close - if == left { - yaml id:dFE_Models set ..yaw:++ } else if == right { - yaml id:dFE_Models set ..yaw:-- } - run dFE_Task_Update def: 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 { - determine passively cancelled # Checks for input to be alphanumerical & _. - if a-zA-Z0-9_<&rb>+].not> { - narrate "Prop names must be alphanumerical & _, please try again with a valid name." - queue clear } - if ]> { - narrate "Prop name already in use!" } else { - yaml id:dFE_Models set :empty - narrate "Prop created!" } - flag player dFE.CreateModel:! - flag player dFE.Editing1: - inventory open d:in@Model_Menu # Enter name for the new part. } else if { - determine passively cancelled # Checks for input to be alphanumerical & _. - if a-zA-Z0-9_<&rb>+].not> { - narrate "Part names must be alphanumerical & _, please try again with a valid name." - queue clear } - if ].contains[]> { - narrate "Part name already in use!" } else { - yaml id:dFE_Models set ..location:0,0,0 - yaml id:dFE_Models set ..angle:0,0,0 - yaml id:dFE_Models set ..small:false - yaml id:dFE_Models set ..item:stone - yaml id:dFE_Models set ..type:normal - narrate "Part created!" } - flag player dFE.CreatePart:! - flag player dFE.Editing2: - inventory open d:in@Part_Menu # Enter location offset value as x,y,z. } else if { - determine passively cancelled - yaml id:dFE_Models set ..location: - narrate "Location offset set to !" - run dFE_Task_Update def: instantly - flag player dFE.SetLocation:! - inventory open d:in@Part_Menu # Enter head angle values as a,b,c. } else if { - determine passively cancelled - yaml id:dFE_Models set ..angle: - narrate "Rotation angle set to !" - run dFE_Task_Update def: instantly - flag player dFE.SetAngle:! - inventory open d:in@Part_Menu # Enter item name to equip. } else if { - determine passively cancelled - if ..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 ..item: - narrate "Item name set to !" - run dFE_Task_Update def: instantly - flag player dFE.SetItem:! - inventory open d:in@Part_Menu # Enter element type. } else if { - determine passively cancelled - if ].not> { - narrate "Invalid element type! Valid types are normal, sit and fire." - queue clear } - if == normal { - yaml id:dFE_Models set ..item:air - yaml id:dFE_Models set ..time:! - yaml id:dFE_Models set ..yaw:! } else if == sit { - yaml id:dFE_Models set ..item:! - yaml id:dFE_Models set ..time:! - yaml id:dFE_Models set ..yaw:0.0 } else if == fire { - yaml id:dFE_Models set ..item:! - yaml id:dFE_Models set ..time:15.0 - yaml id:dFE_Models set ..yaw:! } else { - narrate "Invalid element type! Use normal, sit or fire." - queue clear } - yaml id:dFE_Models set ..type: - narrate "Element type set to !" - run dFE_Task_Update def: 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 { - if == { - define entity } } - choose : - case "Sit": - if && ]||false> { - narrate "That position is already occupied by another person!" - queue clear } - mount | - case "Fire": - define time - run dFE_Task_Fire def:| 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=&script_version=0.8.2&models=&placed_props=&tps=" - foreach li@dFE_Models|dFE_Placed_Props { - yaml "savefile:/dFurnitureEditor/.yml" id:dFE_ } # _____ _ _____ _ _ # |_ _| | | / ____| (_) | | # | | _ ____ _____ _ __ | |_ ___ _ __ _ _ | (___ ___ _ __ _ _ __ | |_ ___ # | | | '_ \ \ / / _ \ '_ \| __/ _ \| '__| | | | \___ \ / __| '__| | '_ \| __/ __| # _| |_| | | \ 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 { - define items ";lore=<&d>Parts:|].as_list.alphanumeric.after[li@]||None>]]>" } - determine Model_Menu: type: inventory debug: false inventory: chest size: 54 title: "Model: " 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 ].as_list.alphanumeric||li@> { - define part - define lore li@ - foreach .].as_list.alphanumeric> { - define lore ": <&5><&o>..]>]>" } - define items ";lore=]]>" } - determine Part_Menu: type: inventory debug: false inventory: chest size: 18 title: "Model: Part: " 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 .].as_list.exclude[entities|marker].alphanumeric||li@> { - define items ;lore=li@..]>]]> } - determine