diff options
| author | Alexander Gavrilov | 2012-09-14 12:14:36 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-09-14 12:14:36 +0400 |
| commit | aaf5d181bd2a54e378c91b7a02a558126c4d5105 (patch) | |
| tree | a4280a93f405612f3f8454d33a8992c558fd6f58 /scripts | |
| parent | c927623050708da1276e109899549b6f2577180f (diff) | |
| download | dfhack-aaf5d181bd2a54e378c91b7a02a558126c4d5105.tar.gz dfhack-aaf5d181bd2a54e378c91b7a02a558126c4d5105.tar.bz2 dfhack-aaf5d181bd2a54e378c91b7a02a558126c4d5105.tar.xz | |
Add yet one more performance-oriented tweak for temperature updates.
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/fix/stable-temp.lua | 33 | ||||
| -rw-r--r-- | scripts/setfps.lua | 10 |
2 files changed, 35 insertions, 8 deletions
diff --git a/scripts/fix/stable-temp.lua b/scripts/fix/stable-temp.lua index d06d0fcc..27a88ef7 100644 --- a/scripts/fix/stable-temp.lua +++ b/scripts/fix/stable-temp.lua @@ -1,5 +1,9 @@ -- Reset item temperature to the value of their tile. +local args = {...} + +local apply = (args[1] == 'apply') + local count = 0 local types = {} @@ -9,13 +13,16 @@ local function update_temp(item,btemp) local tid = item:getType() types[tid] = (types[tid] or 0) + 1 end - item.temperature = btemp - item.temperature_fraction = 0 - if item.contaminants then - for _,c in ipairs(item.contaminants) do - c.temperature = btemp - c.temperature_fraction = 0 + if apply then + item.temperature = btemp + item.temperature_fraction = 0 + + if item.contaminants then + for _,c in ipairs(item.contaminants) do + c.temperature = btemp + c.temperature_fraction = 0 + end end end @@ -23,7 +30,9 @@ local function update_temp(item,btemp) update_temp(sub,btemp) end - item:checkTemperatureDamage() + if apply then + item:checkTemperatureDamage() + end end local last_frame = df.global.world.frame_counter-1 @@ -39,7 +48,11 @@ for _,item in ipairs(df.global.world.items.all) do end end -print('Items updated: '..count) +if apply then + print('Items updated: '..count) +else + print('Items not in equilibrium: '..count) +end local tlist = {} for k,_ in pairs(types) do tlist[#tlist+1] = k end @@ -47,3 +60,7 @@ table.sort(tlist, function(a,b) return types[a] > types[b] end) for _,k in ipairs(tlist) do print(' '..df.item_type[k]..':', types[k]) end + +if not apply then + print("Use 'fix/stable-temp apply' to force-change temperature.") +end diff --git a/scripts/setfps.lua b/scripts/setfps.lua new file mode 100644 index 00000000..690f8270 --- /dev/null +++ b/scripts/setfps.lua @@ -0,0 +1,10 @@ +-- Set the FPS cap at runtime. + +local cap = ... +local capnum = tonumber(cap) + +if not capnum or capnum < 1 then + qerror('Invalid FPS cap value: '..cap) +end + +df.global.enabler.fps = capnum |
