Merge branch 'master' of git://github.com/peterix/dfhack

develop
Quietust 2012-07-17 10:39:20 -05:00
commit 9705497a7e
5 changed files with 62 additions and 70 deletions

@ -330,7 +330,10 @@ install(DIRECTORY lua/
FILES_MATCHING PATTERN "*.lua")
install(DIRECTORY ${dfhack_SOURCE_DIR}/scripts
DESTINATION ${DFHACK_DATA_DESTINATION})
DESTINATION ${DFHACK_DATA_DESTINATION}
FILES_MATCHING PATTERN "*.lua"
PATTERN "*.rb"
)
# Unused for so long that it's not even relevant now...
if(BUILD_DEVEL)

@ -14,8 +14,6 @@
# DF_GDB_OPTS: Options to pass to gdb, if it's being run
# DF_VALGRIND_OPTS: Options to pass to valgrind, if it's being run
# DF_HELGRIND_OPTS: Options to pass to helgrind, if it's being run
# DF_RESET_OPTS: Options to pass the reset command at the end of
# this script
# DF_POST_CMD: Shell command to be run at very end of script
DF_DIR=$(dirname "$0")
@ -33,6 +31,9 @@ if [ -r "./$RC" ]; then
. "./$RC"
fi
# Save current terminal settings
old_tty_settings=$(stty -g)
# Now run
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./stonesense/deplibs":"./hack"
@ -67,8 +68,9 @@ case "$1" in
;;
esac
# Reset terminal to sane state in case of a crash
# reset $DF_RESET_OPTS
# Restore previous terminal settings
stty "$old_tty_settings"
echo -e "\n"
if [ -n "$DF_POST_CMD" ]; then
eval $DF_POST_CMD

@ -1856,14 +1856,18 @@ command_result df_zone (color_ostream &out, vector <string> & parameters)
// if followed by another parameter, check if it's numeric
if(i < parameters.size()-1)
{
stringstream ss(parameters[i+1]);
int new_building = -1;
ss >> new_building;
if(new_building != -1)
auto & str = parameters[i+1];
if(str.size() > 0 && str[0] >= '0' && str[0] <= '9')
{
i++;
target_building = new_building;
out << "Assign selected unit(s) to building #" << target_building <<std::endl;
stringstream ss(parameters[i+1]);
int new_building = -1;
ss >> new_building;
if(new_building != -1)
{
i++;
target_building = new_building;
out << "Assign selected unit(s) to building #" << target_building <<std::endl;
}
}
}
if(target_building == -1)

@ -1,58 +0,0 @@
function fixnaked()
local total_fixed = 0
local total_uncovered = 0
local total_noshirt = 0
local total_noshoes = 0
for fnUnitCount,fnUnit in ipairs(df.global.world.units.all) do
if fnUnit.race == df.global.ui.race_id then
local listEvents = fnUnit.status.recent_events
--for lkey,lvalue in pairs(listEvents) do
-- print(df.unit_thought_type[lvalue.type],lvalue.type,lvalue.age,lvalue.subtype,lvalue.severity)
--end
local found = 1
local fixed = 0
while found == 1 do
local events = fnUnit.status.recent_events
found = 0
for k,v in pairs(events) do
if v.type == 109 then
events:erase(k)
found = 1
total_uncovered = total_uncovered + 1
fixed = 1
break
end
if v.type == 110 then
events:erase(k)
found = 1
total_noshirt = total_noshirt + 1
fixed = 1
break
end
if v.type == 111 then
events:erase(k)
found = 1
total_noshoes = total_noshoes + 1
fixed = 1
break
end
end
end
if fixed == 1 then
total_fixed = total_fixed + 1
print(total_fixed, total_uncovered+total_noshirt+total_noshoes,dfhack.TranslateName(dfhack.units.getVisibleName(fnUnit)))
end
end
end
print("thought 109 = "..df.unit_thought_type[109])
print("thought 110 = "..df.unit_thought_type[110])
print("thought 111 = "..df.unit_thought_type[111])
print("Total Fixed: "..total_fixed)
print("Total thoughts removed: "..total_uncovered)
print("Total thoughts removed: "..total_noshirt)
print("Total thoughts removed: "..total_noshoes)
end
fixnaked()

@ -0,0 +1,41 @@
function fixnaked()
local total_fixed = 0
local total_removed = 0
for fnUnitCount,fnUnit in ipairs(df.global.world.units.all) do
if fnUnit.race == df.global.ui.race_id then
local listEvents = fnUnit.status.recent_events
--for lkey,lvalue in pairs(listEvents) do
-- print(df.unit_thought_type[lvalue.type],lvalue.type,lvalue.age,lvalue.subtype,lvalue.severity)
--end
local found = 1
local fixed = 0
while found == 1 do
local events = fnUnit.status.recent_events
found = 0
for k,v in pairs(events) do
if v.type == df.unit_thought_type.Uncovered
or v.type == df.unit_thought_type.NoShirt
or v.type == df.unit_thought_type.NoShoes
or v.type == df.unit_thought_type.NoCloak
or v.type == df.unit_thought_type.OldClothing
or v.type == df.unit_thought_type.TatteredClothing
or v.type == df.unit_thought_type.RottedClothing then
events:erase(k)
found = 1
total_removed = total_removed + 1
fixed = 1
break
end
end
end
if fixed == 1 then
total_fixed = total_fixed + 1
print(total_fixed, total_removed, dfhack.TranslateName(dfhack.units.getVisibleName(fnUnit)))
end
end
end
print("Total Fixed: "..total_fixed)
end
fixnaked()