script/lever: synchronize linked buildings as the game does

develop
jj 2012-11-22 03:17:41 +01:00
parent 5f92561cd9
commit fd9a4ffafa
1 changed files with 3 additions and 5 deletions

@ -13,16 +13,14 @@ def lever_pull_job(bld)
end
def lever_pull_cheat(bld)
bld.state = (bld.state == 0 ? 1 : 0)
bld.linked_mechanisms.each { |i|
i.general_refs.grep(DFHack::GeneralRefBuildingHolderst).each { |r|
tg = r.building_tg
next if tg.gate_flags.closing or tg.gate_flags.opening
r.building_tg.setTriggerState(tg.gate_flags.closed ? 0 : 1)
r.building_tg.setTriggerState(bld.state)
}
}
bld.state = (bld.state == 0 ? 1 : 0)
puts lever_descr(bld)
end