Reorganized scripts folder. Deleted digmat.rb because it's redundant with digSmart and it has a higher FPS impact.

develop
expwnent 2014-06-27 03:46:22 -04:00
parent 187ce3c58b
commit 0f5bbd5631
19 changed files with 15 additions and 77 deletions

@ -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)

@ -5,14 +5,14 @@
local args = {...} local args = {...}
if args[1] ~= nil then if args[1] ~= nil then
print("feeding-timers usage") print("fix/feeding-timers usage")
print(" feeding-timers") print(" fix/feeding-timers")
print(" reset the feeding timers of all units as appropriate") 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(" 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(" run this script every n time units")
print(" repeat -cancel feeding-timers") print(" repeat -cancel fix/feeding-timers")
print(" stop automatically running this script") print(" stop automatically running this script")
return return
end end

@ -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 --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 -- author expwnent
local args = {...} local args = {...}
if args[1] ~= nil then if args[1] ~= nil then
print("growthbug usage") print("fix/growthbug usage")
print(" growthbug") print(" fix/growthbug")
print(" fix the growth bug for all units on the map") print(" fix the growth bug for all units on the map")
print(" growthbug help") print(" fix/growthbug help")
print(" print this help message") 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(" run this script every n time units")
print(" repeat -cancel growthbug") print(" repeat -cancel fix/growthbug")
print(" stop automatically running this script") print(" stop automatically running this script")
end end

@ -5,20 +5,20 @@
--[[Example usage: --[[Example usage:
...syndrome stuff... ...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: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: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: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: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: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: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:fullheal][SYN_CLASS:\SKILL_UNIT_ID] Fully heals unit.
[SYN_CLASS:DICEROLL_20] If diceroll is at least 20... [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 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={...} local args={...}