Registry Mirror
搜索
Skip to content
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Files
Expand file tree
master
Breadcrumbs
scripts
/
elevate-physical.lua
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
41 lines (38 loc) · 1.27 KB
master
Breadcrumbs
scripts
/
elevate-physical.lua
Copy path
Top
File metadata and controls
Code
Blame
41 lines (38 loc) · 1.27 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
-- Elevate all the physical attributes of a unit
function ElevatePhysicalAttributes(value)
local unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor! Aborting with extreme prejudice.")
return
end
--print name of dwarf
print("Adjusting "..dfhack.df2console(dfhack.units.getReadableName(unit)))
--walk through available attributes, adjust current to max
if unit.body then
for k,v in pairs(unit.body.physical_attrs) do
if value ~= nil then
print("Adjusting current value for "..tostring(k).." of "..v.value.." to the value of "..value)
v.value=value
else
print("Adjusting current value for "..tostring(k).." of "..v.value.." to max value of "..v.max_value)
v.value=v.max_value
--below will reset values back to "normal"
--v.value=v.max_value/2
end
end
end
end
--script execution starts here
local opt = ...
opt = tonumber(opt) --luacheck: retype
if opt ~= nil then
if opt >=0 and opt <=5000 then
ElevatePhysicalAttributes(opt)
end
if opt <0 or opt >5000 then
error('Invalid number!')
end
end
if opt == nil then
ElevatePhysicalAttributes()
end
You can’t perform that action at this time.