From 0f5bbd5631e9fa6c06a6f46c3bd96659c484204b Mon Sep 17 00:00:00 2001 From: expwnent Date: Fri, 27 Jun 2014 03:46:22 -0400 Subject: [PATCH] Reorganized scripts folder. Deleted digmat.rb because it's redundant with digSmart and it has a higher FPS impact. --- scripts/{ => devel}/onReportExample.lua | 0 scripts/{ => devel}/onStrikeExample.lua | 0 scripts/{ => devel}/printArgs.lua | 0 scripts/digmat.rb | 62 ------------------- scripts/{ => fix}/blooddel.lua | 0 scripts/{ => fix}/feeding-timers.lua | 10 +-- scripts/{ => fix}/growthbug.lua | 12 ++-- scripts/{ => gui}/dfstatus.lua | 0 scripts/{ => gui}/hackWish.lua | 0 scripts/{ => gui}/unit-info-viewer.lua | 0 scripts/{ => modtools}/Spawnunit.lua | 0 scripts/{ => modtools}/force.lua | 0 scripts/{ => modtools}/invasion-now.lua | 0 scripts/{ => modtools}/itemsyndrome.lua | 0 scripts/{ => modtools}/moddableGods.lua | 0 .../{ => modtools}/projectileExpansion.lua | 0 scripts/{ => modtools}/shapechange.lua | 0 scripts/{ => modtools}/skillChange.lua | 0 scripts/{ => modtools}/skillroll.lua | 8 +-- 19 files changed, 15 insertions(+), 77 deletions(-) rename scripts/{ => devel}/onReportExample.lua (100%) rename scripts/{ => devel}/onStrikeExample.lua (100%) rename scripts/{ => devel}/printArgs.lua (100%) delete mode 100644 scripts/digmat.rb rename scripts/{ => fix}/blooddel.lua (100%) rename scripts/{ => fix}/feeding-timers.lua (86%) rename scripts/{ => fix}/growthbug.lua (75%) rename scripts/{ => gui}/dfstatus.lua (100%) rename scripts/{ => gui}/hackWish.lua (100%) rename scripts/{ => gui}/unit-info-viewer.lua (100%) rename scripts/{ => modtools}/Spawnunit.lua (100%) rename scripts/{ => modtools}/force.lua (100%) rename scripts/{ => modtools}/invasion-now.lua (100%) rename scripts/{ => modtools}/itemsyndrome.lua (100%) rename scripts/{ => modtools}/moddableGods.lua (100%) rename scripts/{ => modtools}/projectileExpansion.lua (100%) rename scripts/{ => modtools}/shapechange.lua (100%) rename scripts/{ => modtools}/skillChange.lua (100%) rename scripts/{ => modtools}/skillroll.lua (79%) diff --git a/scripts/onReportExample.lua b/scripts/devel/onReportExample.lua similarity index 100% rename from scripts/onReportExample.lua rename to scripts/devel/onReportExample.lua diff --git a/scripts/onStrikeExample.lua b/scripts/devel/onStrikeExample.lua similarity index 100% rename from scripts/onStrikeExample.lua rename to scripts/devel/onStrikeExample.lua diff --git a/scripts/printArgs.lua b/scripts/devel/printArgs.lua similarity index 100% rename from scripts/printArgs.lua rename to scripts/devel/printArgs.lua diff --git a/scripts/digmat.rb b/scripts/digmat.rb deleted file mode 100644 index 683c1d8f1..000000000 --- a/scripts/digmat.rb +++ /dev/null @@ -1,62 +0,0 @@ -# dig a mineral vein/layer, add tiles as they are discovered - -# reuses the dig mode (upstairs etc) of the selected tile - -if df.cursor.x < 0 - puts "Place the game cursor on a tile to dig" - throw :script_finished -end - -tile = df.map_tile_at(df.cursor) -if tile.shape_basic != :Wall or tile.designation.hidden - puts "Place the game cursor on an unmined, discovered tile" - throw :script_finished -end - -def digmat_watch(tile, digmode, tilelist) - # watch the tile, expand mining operations when dug out - tilelist << [tile.x, tile.y, tile.z] - if tilelist.length == 1 - df.onupdate_register_once("digmat", 10) { - tilelist.dup.each { |x, y, z| - t = df.map_tile_at(x, y, z) - if t.shape_basic != :Wall - digmat_around(t, digmode, tilelist) - tilelist.delete [x, y, z] - end - } - tilelist.empty? - } - end - tilelist.uniq! -end - -def digmat_around(tile, digmode=tile.designation.dig, tilelist=[]) - digmode = :Default if digmode == :No - [-1, 0, 1].each { |dz| - next if digmode == :Default and dz != 0 - next if tile.z+dz < 1 or tile.z+dz > df.world.map.z_count-2 - [-1, 0, 1].each { |dy| - next if tile.y+dy < 1 or tile.y+dy > df.world.map.y_count-2 - [-1, 0, 1].each { |dx| - next if tile.x+dx < 1 or tile.x+dx > df.world.map.x_count-2 - ntile = tile.offset(dx, dy, dz) - next if not ntile - next if ntile.designation.hidden - next if ntile.designation.dig != :No - next if ntile.shape_basic != :Wall - next if not ntile.mat_info === tile.mat_info - - # ignore damp/warm stone walls - next if [-1, 0, 1].find { |ddy| [-1, 0, 1].find { |ddx| - t = ntile.offset(ddx, ddy) and t.designation.flow_size > 1 - } } - - ntile.dig(digmode) - digmat_watch(ntile, digmode, tilelist) - } - } - } -end - -digmat_around(tile) diff --git a/scripts/blooddel.lua b/scripts/fix/blooddel.lua similarity index 100% rename from scripts/blooddel.lua rename to scripts/fix/blooddel.lua diff --git a/scripts/feeding-timers.lua b/scripts/fix/feeding-timers.lua similarity index 86% rename from scripts/feeding-timers.lua rename to scripts/fix/feeding-timers.lua index b679dc953..545d3c2e2 100644 --- a/scripts/feeding-timers.lua +++ b/scripts/fix/feeding-timers.lua @@ -5,14 +5,14 @@ local args = {...} if args[1] ~= nil then - print("feeding-timers usage") - print(" feeding-timers") + print("fix/feeding-timers usage") + print(" fix/feeding-timers") print(" reset the feeding timers of all units as appropriate") - print(" feeding-timers help") + print(" fix/feeding-timers help") print(" print this help message") - print(" repeat -time [n] [years/months/ticks/days/etc] -command feeding-timers") + print(" repeat -time [n] [years/months/ticks/days/etc] -command fix/feeding-timers") print(" run this script every n time units") - print(" repeat -cancel feeding-timers") + print(" repeat -cancel fix/feeding-timers") print(" stop automatically running this script") return end diff --git a/scripts/growthbug.lua b/scripts/fix/growthbug.lua similarity index 75% rename from scripts/growthbug.lua rename to scripts/fix/growthbug.lua index 949cc1411..85e707d99 100644 --- a/scripts/growthbug.lua +++ b/scripts/fix/growthbug.lua @@ -1,17 +1,17 @@ --growthbug: units only grow when the current tick is 0 mod 10, so only 1/10 units will grow naturally. this script periodically sets the birth time of each unit so that it will grow ---to run periodically, use "repeat -time 2 months -command growthBug now". see repeat.lua for details +--to run periodically, use "repeat -time 2 months -command fix/growthBug now". see repeat.lua for details -- author expwnent local args = {...} if args[1] ~= nil then - print("growthbug usage") - print(" growthbug") + print("fix/growthbug usage") + print(" fix/growthbug") print(" fix the growth bug for all units on the map") - print(" growthbug help") + print(" fix/growthbug help") print(" print this help message") - print(" repeat -time [n] [years/months/ticks/days/etc] -command growthbug") + print(" repeat -time [n] [years/months/ticks/days/etc] -command fix/growthbug") print(" run this script every n time units") - print(" repeat -cancel growthbug") + print(" repeat -cancel fix/growthbug") print(" stop automatically running this script") end diff --git a/scripts/dfstatus.lua b/scripts/gui/dfstatus.lua similarity index 100% rename from scripts/dfstatus.lua rename to scripts/gui/dfstatus.lua diff --git a/scripts/hackWish.lua b/scripts/gui/hackWish.lua similarity index 100% rename from scripts/hackWish.lua rename to scripts/gui/hackWish.lua diff --git a/scripts/unit-info-viewer.lua b/scripts/gui/unit-info-viewer.lua similarity index 100% rename from scripts/unit-info-viewer.lua rename to scripts/gui/unit-info-viewer.lua diff --git a/scripts/Spawnunit.lua b/scripts/modtools/Spawnunit.lua similarity index 100% rename from scripts/Spawnunit.lua rename to scripts/modtools/Spawnunit.lua diff --git a/scripts/force.lua b/scripts/modtools/force.lua similarity index 100% rename from scripts/force.lua rename to scripts/modtools/force.lua diff --git a/scripts/invasion-now.lua b/scripts/modtools/invasion-now.lua similarity index 100% rename from scripts/invasion-now.lua rename to scripts/modtools/invasion-now.lua diff --git a/scripts/itemsyndrome.lua b/scripts/modtools/itemsyndrome.lua similarity index 100% rename from scripts/itemsyndrome.lua rename to scripts/modtools/itemsyndrome.lua diff --git a/scripts/moddableGods.lua b/scripts/modtools/moddableGods.lua similarity index 100% rename from scripts/moddableGods.lua rename to scripts/modtools/moddableGods.lua diff --git a/scripts/projectileExpansion.lua b/scripts/modtools/projectileExpansion.lua similarity index 100% rename from scripts/projectileExpansion.lua rename to scripts/modtools/projectileExpansion.lua diff --git a/scripts/shapechange.lua b/scripts/modtools/shapechange.lua similarity index 100% rename from scripts/shapechange.lua rename to scripts/modtools/shapechange.lua diff --git a/scripts/skillChange.lua b/scripts/modtools/skillChange.lua similarity index 100% rename from scripts/skillChange.lua rename to scripts/modtools/skillChange.lua diff --git a/scripts/skillroll.lua b/scripts/modtools/skillroll.lua similarity index 79% rename from scripts/skillroll.lua rename to scripts/modtools/skillroll.lua index 6f8aeae9c..8a5567694 100644 --- a/scripts/skillroll.lua +++ b/scripts/modtools/skillroll.lua @@ -5,20 +5,20 @@ --[[Example usage: ...syndrome stuff... -[SYN_CLASS:\COMMAND][SYN_CLASS:skillroll][SYN_CLASS:\WORKER_ID] For autoSyndrome/syndromeTrigger. +[SYN_CLASS:\COMMAND][SYN_CLASS:modtools/skillroll][SYN_CLASS:\WORKER_ID] For autoSyndrome/syndromeTrigger. [SYN_CLASS:MELEE_COMBAT] Can use any skill, including NONE (no bonus) [SYN_CLASS:20] Rolls uniformly from 1 to 20 inclusive. Skill will be weighted to this value. [SYN_CLASS:DICEROLL_1] If diceroll ends up as one... [SYN_CLASS:kill][SYN_CLASS:\SKILL_UNIT_ID] Theoretical kill-given-unit-id command; slayrace doesn't do so. [SYN_CLASS:DICEROLL_10] If diceroll is between 1 and 10 (2-10, inclusive)... -[SYN_CLASS:force][SYN_CLASS:migrants][SYN_CLASS:player] Force migrants. +[SYN_CLASS:modtools/force][SYN_CLASS:migrants][SYN_CLASS:player] Force migrants. [SYN_CLASS:DICEROLL_19] If diceroll is between 10 and 19 (11-19, inclusive)... [SYN_CLASS:fullheal][SYN_CLASS:\SKILL_UNIT_ID] Fully heals unit. [SYN_CLASS:DICEROLL_20] If diceroll is at least 20... -[SYN_CLASS:shapechange][SYN_CLASS:\SKILL_UNIT_ID] Turns unit into any creature permanently. +[SYN_CLASS:modtools/shapechange][SYN_CLASS:\SKILL_UNIT_ID] Turns unit into any creature permanently. or from the console -skillroll workerId MELEE_COMBAT 20 DICEROLL_1 kill workerId DICEROLL_10 force migrants player DICEROLL_19 fullheal workerId DICEROLL_20 shapechange workerId +modtools/skillroll workerId MELEE_COMBAT 20 DICEROLL_1 kill workerId DICEROLL_10 modtools/force migrants player DICEROLL_19 fullheal workerId DICEROLL_20 modtools/shapechange workerId ]] local args={...}