dRegions_Events: type: world debug: false events: - on player left clicks block with i@dRegions_Tool: - - determine passively CANCELLED - - if ! { - - take i@dRegions_Tool - - run s@dRegions_Msg 'def:<&4><&l>ERROR<&co><&r> <&a>You should not have this!' instantly - - queue stop - } - - run s@dRegions_Msg 'def:<&a>Set POS1 to ' - - flag player dRegionToolPOS1: - + on player clicks block with i@dRegions_Tool: + - determine passively CANCELLED + - if ! { + - take i@dRegions_Tool + - run s@dRegions_Msg 'def:<&4><&l>ERROR<&co><&r> <&a>You should not have this!' instantly + - queue stop + } + - define pos ']:POS1||POS2>' + - run s@dRegions_Msg 'def:<&a>Set %pos% to ' + - flag player dRegionTool%pos%: - on player right clicks block with i@dRegions_Tool: - - determine passively CANCELLED - - if ! { - - take i@dRegions_Tool - - run s@dRegions_Msg 'def:<&4><&l>ERROR<&co><&r> <&a>You should not have this!' instantly - - queue stop - } - - run s@dRegions_Msg 'def:<&a>Set POS1 to ' - - flag player dRegionToolPOS1: dRegions_Msg: type: item material: i@human_skull display name: "<&4>[<&6>dRegions<&4>]" lore: - <&5>Click for Info script: - ^define text '<&4>[<&6>dRegions<&4>] <&co>' - ^define hover '{}' - ^define click '/dregions' - ^define button "text:'%text%',clickEvent:{action:run_command,value:'%click%'},hoverEvent:{action:show_item,value:'%hover%'}" - ^define spacer "text:' '" - ^define msg "text:'%1%'" - ^execute as_server "tellraw {text:'',extra:[{%button%},{%spacer%},{%msg%}]}" dRegions_Tool: type: item debug: false - no_id: true material: m@wood_axe - display name: Region Selector + display name: dRegion Selector lore: - - <&7>Used for selecting regions. - <&7><&o>Left<&7> click to set pos1 - <&7><&o>Right<&7> click to set pos2 - +dWE_Commands: -SetBlocksCommand: type: command debug: false - name: /set - description: Sets each block in the selected region. - usage: //set [<<>material<>>] + name: dwe + description: Denizen World Editor + usage: /dwe + aliases: '' + allowed help: + - determine true script: - - define material - - define 1 l@CurrentSelectedRegion1 - - define 2 l@CurrentSelectedRegion2 - - if %material% == null || %material% !matches material narrate "Must specify a valid material." - else if == null narrate "Must select corner 1 with left-click." - else if == null narrate "Must select corner 2 with right-click." - else { - - define blocks - - define undoMaterials - - modifyblock %blocks% - - flag global "UndoableActions:->:set_blocks;;%list%" - } + - define arg1 '' + - define args 'li@help|tool|expand|contract|inset|outset|set|undo' + - if ! inject locally help + else inject locally %arg1% + +# +# END dWE Command Script Basics +#-------------------------------------- +# +# dWE Command Arguments +# +# Each of these subscripts is an argument for the root command. +# + help: + - if inject locally msgsHelpAdmin instantly + else inject locally msgsHelpUser instantly + - define footerText '<&f><&sp><&sp>Authors<&co> <&7>|Anthony| <&7>calico-kid' + - inject locally msgsFooter instantly + - queue stop + + tool: + - if { + - give i@dRestaurantTool + - run s@dRegions_Msg 'def:<&a>Right click to select pos1' + - run s@dRegions_Msg 'def:<&a>Left click to select pos2' + - queue stop + } + + set: + # Need config options for maxblocks to change + # Need config option for undo history size + - define material '' + - define POS1 '' + - define POS2 '' + - if %material% == null || %material% !matches material run s@dRegions_Msg 'def:<&c>Must specify a valid material.' + else if run s@dRegions_Msg 'def:<&c>Must select corner 1 with left-click.' + else if run s@dRegions_Msg 'def:Must select corner 2 with right-click.' + else { + - define blocks + - define undoMaterials + - modifyblock %blocks% %material% + - flag player 'dWE_UndoHistory:->:set_blocks;;%undoMaterials%' + } + + + undo: + - define last_action '' + - if run s@dRegions_Msg 'def:<&6>Nothing to undo!' + else { + - inject locally 'p:undo_' + - flag global 'UndoableActions:<-:%last_action%' + } + + undo_set_blocks: + - define cuboid '' + - define materials '' + - modifyblock %cuboid% %materials% + - run s@dRegions_Msg 'def:<&a>Undo complete!' + + + +# +# END dWE Command Arguments +#-------------------------------------- +# +# dWE Command Messages +# +# These are not complete! They are mostly just stubs till the rest is fleshed out! +# + msgsHeader: + - narrate "<&5>|----------------------------------------|" + - narrate "<&5>|<&sp><&sp><&sp><&6>dWorldEditor <&7>%msgsHeaderTitle%" +# - narrate "<&5>|<&sp><&sp><&sp><&e>MineConomy <&f>Exclusive" + - narrate "<&5>|<&f>" + + msgsFooter: + - define anthony "text:'<&7>|Anthony|',clickEvent:{action:open_url,value:'http://mineconomy.org'},hoverEvent:{action:show_item,value:'{}'}" + - define morphan "text:'<&7>Morphan1',clickEvent:{action:open_url,value:'http://google.com'},hoverEvent:{action:show_item,value:'{}'}" + - define spacer "text:' '" + - define prefix "text:'<&5>| <&f>Authors: '" + - execute as_server "tellraw {text:'',extra:[{%prefix%},{%anthony%},{%spacer%},{%morphan%}]}" + - narrate "<&d>|-----------S-c-r-o-l-l---U-p-------------|" + + msgsHelpAdmin: + - define msgsHeaderTitle 'Admin Help' + - inject locally msgsHeader instantly + - narrate "<&5>|<&sp><&sp><&sp><&f>" + - narrate "<&5>|<&sp><&sp><&f>" + - narrate "<&5>|<&sp><&sp><&f>" + - narrate "<&5>|<&sp><&sp><&f>" + - narrate "<&5>|<&sp><&sp><&f>" + - narrate "<&5>|<&sp><&sp><&f>" + - narrate "<&5>|<&sp><&f>" + + msgsHelpUser: + - define msgsHeaderTitle 'User Help' + - inject locally msgsHeader instantly + - narrate "<&5>|<&sp><&sp><&sp><&sp><&f>" + - narrate "<&5>|<&sp><&sp><&f>" + - narrate "<&5>|<&sp><&sp><&f>" + - narrate "<&5>|<&sp><&f>" -UndoCommand: - type: command - debug: false +# +# END dWE Command Messages +#-------------------------------------- - name: /undo - description: Undo the last action. - usage: //undo - script: - - define last_action - - if %last_action% == null narrate "Nothing to undo." - else { - - ^inject locally "path:" - - ^flag global "UndoableActions:<-:%last_action%" - } - set_blocks: - - define cuboid - - define materials - - modifyblock %cuboid% %materials% - - narrate "Successfully undid all modified blocks."