Skip to content

Instantly share code, notes, and snippets.

@warmist
Created April 10, 2012 19:56
Show Gist options
  • Save warmist/2354042 to your computer and use it in GitHub Desktop.
Save warmist/2354042 to your computer and use it in GitHub Desktop.
Imigrant check
vec=df.global.world.units.all
pos=df.global.cursor
civ=df.global.ui.civ_id
fixed=false
for k,v in pairs(vec) do
if v.pos.x==pos.x and v.pos.y==pos.y and v.pos.z==pos.z then
print("unit id at cursor position:"..v.id)
print("Flags2:")
for f_name,f_val in pairs(v.flags2) do
print(f_name,f_val)
end
print("My civ id:"..civ.." vs his civ_id:"..v.civ_id)
if v.civ_id == civ and v.flags2.resident == true then
print("unit is from own civ but has resident flag set. removing it now.")
v.flags2.resident = false
fixed=true
else
print("unit at cursor position is either not own civ or has the resident flag not set.")
end
end
end
if fixed==false then
print("there was nothing to fix at the cursor postion.")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment