Skip to content

Commit

Permalink
Lots of tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
expwnent committed Jul 9, 2014
1 parent 1ce38f3 commit a8f810c
Show file tree
Hide file tree
Showing 24 changed files with 76 additions and 783 deletions.
34 changes: 11 additions & 23 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,29 @@ DFHack future
syndrome-util.lua
makes it easier to deal with unit syndromes
scripts/
forumdwarves.lua
forum-dwarves.lua
helps copies df viewscreens to a file
fullheal.lua
full-heal.lua
fully heals a unit
removewear.lua
remove-wear.lua
removes wear from all items in the fort
repeat.lua
repeatedly calls a script or a plugin
ShowUnitSyndromes.rb
shows syndromes affecting units and other relevant info
skillChange.lua
changes the skill of a unit
Spawnunit.lua
creates units!
skillroll.lua
invokes dfhack commands based on random chances
teleport.lua
teleports units
scripts/devel/
printArgs.lua
print-args.lua
scripts/fix/
blooddel.lua
blood-del.lua
makes it so civs don't bring barrels full of blood ichor or goo
feeding-timers.lua
reset the feeding timers of all units
growthbug.lua
growth-bug.lua
fixes the growth bug
scripts/gui/
hackWish.lua
hack-wish.lua
creates items out of any material
unit-info-viewer.lua
displays information about units
Expand All @@ -60,18 +54,15 @@ DFHack future
forces events: caravan, migrants, diplomat, megabeast, curiousbeast, mischievousbeast, flier, siege, nightcreature
item-trigger.lua
triggers commands based on equipping, unequipping, and wounding units with items
itemsyndrome.lua
adds and removes syndromes to units when they equip and unequip items
interaction-trigger.lua
triggers commands when interactions happen
invader-item-destroyer.lua
destroys invaders' items when they die
moddable-gods.lua
standardized version of Putnam's moddable gods script
moddableGods.lua
makes raw moddable gods possible
projectileExpansion.lua
adds extra functionality to projectiles
outside-only.lua
register buildings as outside only or inside only
replaces outsideOnly plugin
projectile-trigger.lua
standardized version of projectileExpansion
reaction-trigger.lua
Expand All @@ -97,10 +88,7 @@ DFHack future
New plugins:

Misc improvements:
new script in utils.lua for standardized argument processing
outside-only
now buildings have to be registered as inside or outside only, and it checks periodically to see when buildings change outsideness
converted from plugin to script
new function in utils.lua for standardized argument processing

Removed
digmat.rb: digFlood does the same functionality with less FPS impact
Expand Down
1 change: 1 addition & 0 deletions library/lua/repeat-util.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- lua/plugins/repeatUtil.lua
-- author expwnent
-- tools for registering callbacks periodically
-- vaguely based on a script by Putnam

local _ENV = mkmodule("repeat-util")
Expand Down
7 changes: 4 additions & 3 deletions library/lua/syndrome-util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function findUnitSyndrome(unit,syn_id)
return nil
end

--usage: syndrome.ResetPolicy.DoNothing, syndrome.ResetPolicy.ResetDuration, etc
--usage: syndromeUtil.ResetPolicy.DoNothing, syndromeUtil.ResetPolicy.ResetDuration, etc
ResetPolicy = ResetPolicy or utils.invert({
"DoNothing",
"ResetDuration",
Expand All @@ -37,7 +37,7 @@ function eraseSyndrome(unit,syndromeId,oldestFirst)
end
local syndromes = unit.syndromes.active
for i=i1,iN,d do
if syndromes[i].type == syndromeId then
if syndromes[i]['type'] == syndromeId then
syndromes:erase(i)
return true
end
Expand All @@ -52,7 +52,8 @@ function eraseSyndromes(unit,syndromeId)
end
return count
end
--target is a df.unit, syndrome is a df.syndrome, resetPolicy is one of syndrome.ResetPolicy

--target is a df.unit, syndrome is a df.syndrome, resetPolicy is one of syndromeUtil.ResetPolicy
--if the target has an instance of the syndrome already, the reset policy takes effect
--returns true if the unit did not have the syndrome before calling and false otherwise
function infectWithSyndrome(target,syndrome,resetPolicy)
Expand Down
5 changes: 3 additions & 2 deletions scripts/devel/printArgs.lua → scripts/devel/print-args.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
--printArgs.lua
--print-args.lua
--author expwnent
--prints all the arguments on their own line with quotes around them. useful for debugging

local args = {...}
print("printArgs")
print("print-args")
for _,arg in ipairs(args) do
print("'"..arg.."'")
end

2 changes: 1 addition & 1 deletion scripts/fix/blooddel.lua → scripts/fix/blood-del.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--blooddel.lua
--blood-del.lua
--makes it so that civs won't come with barrels full of blood, ichor, or goo
--author Urist Da Vinci
--edited by expwnent
Expand Down
30 changes: 19 additions & 11 deletions scripts/fix/growthbug.lua → scripts/fix/growth-bug.lua
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
--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 fix/growthBug now". see repeat.lua for details
-- author expwnent
--growth-bug.lua: 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 fix/growth-bug -now". see repeat.lua for details
--author expwnent

local args = {...}
if args[1] ~= nil then
print("fix/growthbug usage")
print(" fix/growthbug")
local utils = require 'utils'

validArgs = validArgs or utils.invert({
'help',
'now'
})

local args = utils.processArgs({...}, validArgs)

if args.help or not next(args) then
print("fix/growth-bug usage")
print(" fix/growth-bug")
print(" fix the growth bug for all units on the map")
print(" fix/growthbug help")
print(" fix/growth-bug -help")
print(" print this help message")
print(" repeat -time [n] [years/months/ticks/days/etc] -command fix/growthbug")
print(" repeat -time [n] [years/months/ticks/days/etc] -command fix/growth-bug now")
print(" run this script every n time units")
print(" repeat -cancel fix/growthbug")
print(" repeat -cancel fix/growth-bug")
print(" stop automatically running this script")
end

local count = 0
for _,unit in ipairs(df.global.world.units.all) do
local offset = unit.relations.birth_time % 10;
if offset ~= 0 then
count = count+1
unit.relations.birth_time = unit.relations.birth_time - offset
count = count+1
end
end
print("Fixed growth bug for "..count.." units.")
Expand Down
1 change: 1 addition & 0 deletions scripts/forumdwarves.lua → scripts/forum-dwarves.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- scripts/forum-dwarves.lua
-- Save a copy of a text screen for the DF forums. Use 'forumdwarves help' for more details.
-- original author: Caldfir
-- edited by expwnent
Expand Down
14 changes: 7 additions & 7 deletions scripts/fullheal.lua → scripts/full-heal.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--fullheal.lua
--full-heal.lua
--author Kurik Amudnil, Urist DaVinci
--edited by expwnent

Expand All @@ -12,16 +12,16 @@ for _,arg in ipairs(args) do
elseif tonumber(arg) then
unit = df.unit.find(tonumber(arg))
elseif arg == 'help' or arg == '-help' or arg == '-h' then
print('fullheal: heal a unit completely from anything, optionally including death.')
print(' fullheal [unitId]')
print('full-heal: heal a unit completely from anything, optionally including death.')
print(' full-heal [unitId]')
print(' heal the unit with the given id')
print(' fullheal -r [unitId]')
print(' full-heal -r [unitId]')
print(' heal the unit with the given id and bring them back from death if they are dead')
print(' fullheal')
print(' full-heal')
print(' heal the currently selected unit')
print(' fullheal -r')
print(' full-heal -r')
print(' heal the currently selected unit and bring them back from death if they are dead')
print(' fullheal help')
print(' full-heal help')
print(' print this help message')
return
end
Expand Down
3 changes: 2 additions & 1 deletion scripts/gui/hackWish.lua → scripts/gui/hack-wish.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- hackWish.lua
-- hack-wish.lua
-- Allows for script-based wishing.
-- author Putnam
-- edited by expwnent
Expand Down Expand Up @@ -249,3 +249,4 @@ else
hackWish(unit)
end
end

10 changes: 7 additions & 3 deletions scripts/modtools/create-item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

local utils = require 'utils'

validArgs = --[[validArgs or]] utils.invert({
validArgs = validArgs or utils.invert({
'help',
'creator',
'material',
'item',
'creature',
'caste',
-- 'creature',
-- 'caste',
'matchingGloves',
'matchingShoes'
})
Expand Down Expand Up @@ -38,6 +38,10 @@ arguments:
specify the itemdef of the item to be created
examples:
WEAPON:ITEM_WEAPON_PICK
-matchingShoes
create two of this item
-matchingGloves
create two of this item, and set handedness appropriately
]])
return
end
Expand Down
2 changes: 2 additions & 0 deletions scripts/modtools/force.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ local args = utils.processArgs({...}, validArgs)
if next(args) == nil or args.help then
print([[force usage
arguments:
-help
print this help message
-eventType event
specify the type of the event to trigger
examples:
Expand Down
6 changes: 5 additions & 1 deletion scripts/modtools/invader-item-destroyer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ end
--TODO: delete corpses?
end]]

validArgs = --[[validArgs or]] utils.invert({
validArgs = validArgs or utils.invert({
'clear',
'help',
'allRaces',
Expand All @@ -113,6 +113,10 @@ end
if args.help then
print([[scripts/modtools/invader-item-destroyer.lua usage
arguments:
-help
print this help message
-clear
reset all registered data
-allEntities [true/false]
set whether it should delete items from invaders from any civ
-allItems [true/false]
Expand Down
2 changes: 1 addition & 1 deletion scripts/modtools/item-trigger.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--scripts/modtools/attack-trigger.lua
--author expwnent
--based on itemsyndrome by Putnam
--triggers scripts when a unit attacks another with a weapon type, a weapon of a particular material
--triggers scripts when a unit attacks another with a weapon type, a weapon of a particular material, or a weapon contaminated with a particular material, or when a unit equips/unequips a particular item type, an item of a particular material, or an item contaminated with a particular material

local eventful = require 'plugins.eventful'
local utils = require 'utils'
Expand Down
Loading

0 comments on commit a8f810c

Please sign in to comment.