dFurnitureEditor_Version: type: version author: Xenmai name: dFurnitureEditor version: 0.5 description: An advanced menu for editing and placing/removing furniture props id: 98 # ___ ___ ___ ___ ___ ___ ___ __ __ ____ __ ___ ____ __ ____ ______ __ # // // \\ ||\\//|| ||\\//|| // \\ ||\ || || \\ (( \ // || \\ || || \\ | || | (( \ # (( (( )) || \/ || || \/ || ||=|| ||\\|| || )) \\ (( ||_// || ||_// || \\ # \\__ \\_// || || || || || || || \|| ||_// \_)) \\__ || \\ || || || \_)) # dFurnitureEditor: type: command debug: false name: dfe description: "Main dFE command. Allows for editing and placing props." 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 } - choose : # Opens the general dFE inventory GUI - case edit: - flag player CreateProp:! - flag player DeleteProp:! - flag player CreatePart:! - flag player DeletePart:! - flag player SetLocation:! - flag player SetAngle:! - flag player SetItem:! - flag player SetType:! - inventory open d:in@Editor_Menu # Places a prop at your current location. # For example, "/dfe place Stool" will place a created prop called Stool. - case place: - define loc - define yaw #- light - foreach ]> { - define location l@..location]> - define angle ..angle].split[,].as_list.parse[to_radians].separated_by[,]> - define small ..small]> - define item ..item]> - define type ..type]> - spawn armor_stand[visible=false;gravity=false;is_small=;equipment=air|air|air|;armor_pose=head|] ]>].with_pose[0,]> save:]> - if { - flag ]>].spawned_entities.after[li@]> sit } else if { - flag ]>].spawned_entities.after[li@]> fire } - define entities |]>].spawned_entities.after[li@]> } - define entities ].as_list> - flag server _:->: - narrate "Placed at !" # Removes a prop at your current location. # For example, "/dfe remove Stool" will remove a placed Stool at your location. - case remove: - define loc - remove _]> #- light reset - flag server _:! - narrate "Removed at !" - default: - narrate "<&c>Invalid argument specified!" # __ __ ___ ____ __ ____ __ ___ ____ __ ____ ______ __ # || || // \\ || \\ || || \\ (( \ // || \\ || || \\ | || | (( \ # \\ /\ // (( )) ||_// || || )) \\ (( ||_// || ||_// || \\ # \V/\V/ \\_// || \\ ||__| ||_// \_)) \\__ || \\ || || || \_)) # dFE_Listener: type: world debug: false events: # Loads the file, or creates it if it doesn't exist yet. on server start: - if { - yaml "load:/dFurnitureEditor/props.yml" id:props } else { - yaml create id:props - yaml id:props set props:->:Stool - define part li@Leg1|Leg2|Leg3|Leg4|Plank|Sitting - define location li@-0.1,-2.4,0.25|-0.25,-2.4,-0.1|0.1,-2.4,-0.25|0.25,-2.4,0.1|0,-1.35,0|0,-1.65,0 - define angle li@0,0,0|0,90,0|0,180,0|0,270,0|0,0,0|0,0,0 - define small li@false|false|false|false|false|false - define item li@stick|stick|stick|stick|wood_plate|air - define type li@normal|normal|normal|normal|normal|sit - repeat 6 { - yaml id:props set Stool.]>.location:]> - yaml id:props set Stool.]>.angle:]> - yaml id:props set Stool.]>.small:]> - yaml id:props set Stool.]>.item:]> - yaml id:props set Stool.]>.type:]> } - yaml id:props set props:->:Log - define part li@Log1|Log2|Log3|Log4|Log5|Sitting1|Sitting2|Sitting3 - define location li@0,-1.6,1|0,-1.6,0.375|0,-1.6,-0.25|0,-1.6,-0.875|0,-1.6,-1.5|0,-1.6,1|0,-1.6,0|0,-1.6,-1 - define angle li@90,0,0|90,0,0|90,0,0|90,0,0|90,0,0|0,0,0|0,0,0|0,0,0 - define small li@false|false|false|false|false|false|false|false - define item li@log|log|log|log|log|air|air|air - define type li@normal|normal|normal|normal|normal|sit|sit|sit - repeat 8 { - yaml id:props set Log.]>.location:]> - yaml id:props set Log.]>.angle:]> - yaml id:props set Log.]>.small:]> - yaml id:props set Log.]>.item:]> - yaml id:props set Log.]>.type:]> } - yaml "savefile:/dFurnitureEditor/props.yml" id:props } # Saves and unloads the data. on shutdown: - yaml "savefile:/dFurnitureEditor/props.yml" id:props - yaml unload id:props # Places a created prop. on place command: - determine passively fulfilled # Listener for the Editor Menu. Prevents clicking items. on player clicks in Editor_Menu: - determine passively cancelled - choose : - case 1: - inventory close - case 3: - inventory close - narrate "Enter name for the new prop." - flag player CreateProp - case 4: - inventory close - narrate "Enter name of the prop to delete." - flag player DeleteProp - default: - if == m@workbench { - inventory close - flag player Editing1: - inventory open d:in@Prop_Menu } # Prevents dragging items. on player drags in Editor_Menu: - determine cancelled # Listener for the Prop Menu. Prevents clicking items. on player clicks in Prop_Menu: - determine passively cancelled - choose : - case 1: - inventory close - inventory open d:in@Editor_Menu - case 3: - inventory close - narrate "Enter name for the new part." - flag player CreatePart - case 4: - inventory close - narrate "Enter name of the part to delete." - flag player DeletePart - default: - if == m@armor_stand { - inventory close - flag player Editing2: - inventory open d:in@Part_Menu } # Prevents dragging items. on player drags in Prop_Menu: - determine cancelled # Listener for the Part Menu. Prevents clicking items. on player clicks in Part_Menu: - determine passively cancelled - choose : - case 3: - inventory close - narrate "Enter location offset value as x,y,z." - flag player SetLocation - case 4: - inventory close - narrate "Enter head angle values as a,b,c." - flag player SetAngle - case 5: - inventory close - narrate "Small state toggled." - if ..small]> == true { - yaml id:props set ..small:false } else { - yaml id:props set ..small:true } - yaml "savefile:/dFurnitureEditor/props.yml" id:props - inventory open d:in@Part_Menu - case 6: - inventory close - narrate "Enter name of item to equip." - flag player SetItem - case 7: - inventory close - narrate "Enter type of the element (normal, sit and fire allowed)." - flag player SetType - case 1: - inventory close - inventory open d:in@Prop_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: - # Checks for input to be alphanumerical & _. + - - if a-zA-Z0-9_<&rb>+].not> { - - narrate "Prop/Part names must be alphanumerical & _, please try again with a valid name" - - queue clear - } # 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:props set props:->: - yaml "savefile:/dFurnitureEditor/props.yml" id:props - narrate "Prop created!" } - flag player CreateProp:! - inventory open d:in@Editor_Menu } # Enter name of prop to delete. else if { - determine passively cancelled - if ]> { - yaml id:props set props:<-: - yaml id:props set :! - yaml "savefile:/dFurnitureEditor/props.yml" id:props - narrate "Prop deleted!" } else { - narrate "Prop doesn't exist!" } - flag player DeleteProp:! - inventory open d:in@Editor_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:props set ..location:0,0,0 - yaml id:props set ..angle:0,0,0 - yaml id:props set ..small:false - yaml id:props set ..item:stone - yaml id:props set ..type:normal - yaml "savefile:/dFurnitureEditor/props.yml" id:props - narrate "Part created!" } - flag player CreatePart:! - inventory open d:in@Prop_Menu } # Enter name of part to delete. else if { - determine passively cancelled - if ].contains[]> { - yaml id:props set .:! - yaml "savefile:/dFurnitureEditor/props.yml" id:props - narrate "Part deleted!" } else { - narrate "Part doesn't exist!" } - flag player DeletePart:! - inventory open d:in@Prop_Menu } # Enter location offset value as x,y,z. else if { - determine passively cancelled - yaml id:props set ..location: - yaml "savefile:/dFurnitureEditor/props.yml" id:props - narrate "Location offset set to !" - flag player SetLocation:! - inventory open d:in@Part_Menu } # Enter head angle values as a,b,c. else if { - determine passively cancelled - yaml id:props set ..angle: - yaml "savefile:/dFurnitureEditor/props.yml" id:props - narrate "Rotation angle set to !" - flag player 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:props set ..item: - yaml "savefile:/dFurnitureEditor/props.yml" id:props - narrate "Item name set to !" - flag player 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 ]> { - yaml id:props set ..item:air - narrate "Element item set to air!" } - yaml id:props set ..type: - yaml "savefile:/dFurnitureEditor/props.yml" id:props - narrate "Element type set to !" - flag player SetType:! - inventory open d:in@Part_Menu } # Listener for sitting components in placed props. on player right clicks at entity: - determine passively cancelled - define entity - if == null { - queue clear } - mount | ]> # Listener for fire components in placed props. on system time minutely: - foreach { - define entity - repeat 120 { - if { - queue clear } - if { - playeffect effect:flame data:0.001 quantity:5 offset:0.1,0.1,0.1 } - wait 10t } } # BC's data tracker. on system time hourly: - webget "http://morphanone.space/webizen.aspx/tracker?script=98&players=" # __ __ __ __ __ ____ __ __ ______ ___ ____ _ _ __ ___ ____ __ ____ ______ __ # || ||\ || || || || ||\ || | || | // \\ || \\ \\// (( \ // || \\ || || \\ | || | (( \ # || ||\\|| \\ // ||== ||\\|| || (( )) ||_// )/ \\ (( ||_// || ||_// || \\ # || || \|| \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 { - define items ";lore=<&d>Parts:|].as_list.alphanumeric.after[li@]||None>]]>" } - determine Prop_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 ].as_list.alphanumeric||null> != null { - foreach ].as_list.alphanumeric> { - define items ";lore=<&d>Location: <&5><&o>..location]>|<&d>Angle: <&5><&o>..angle]>|<&d>Small: <&5><&o>..small]>|<&d>Item: <&5><&o>..item]>|<&d>Type: <&5><&o>..type]>]]>" } } - determine 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: - define items "li@i@paper[display_name=<&b>Location;lore=li@..location]>]|i@paper[display_name=<&b>Angle;lore=li@..angle]>]|i@paper[display_name=<&b>Small;lore=li@..small]>]|i@paper[display_name=<&b>Item;lore=li@..item]>]|i@paper[display_name=<&b>Type;lore=li@..type]>]" - determine