MCPcopy Create free account
hub / github.com/DFHack/dfhack / doCheckMovement

Method doCheckMovement

plugins/siege-engine.cpp:1664–1711  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1662 }
1663
1664 void doCheckMovement()
1665 {
1666 if (flags.bits.parabolic || distance_flown != 0 ||
1667 fall_counter != fall_delay || item == NULL)
1668 return;
1669
1670 auto engine = find_engine(origin_pos);
1671 if (!engine || !engine->hasTarget())
1672 return;
1673
1674 auto L = Lua::Core::State;
1675 color_ostream_proxy out(Core::getInstance().getConsole());
1676
1677 df::unit *op_unit = getOperatorUnit(engine->bld, true);
1678 int skill = op_unit ? Units::getEffectiveSkill(op_unit, job_skill::SIEGEOPERATE) : 0;
1679
1680 // Dabbling can't aim
1681 if (skill < skill_rating::Novice)
1682 aimAtArea(engine, skill);
1683 else
1684 {
1685 lua_pushcfunction(L, safeAimProjectile);
1686 lua_pushlightuserdata(L, this);
1687 lua_pushlightuserdata(L, engine);
1688 lua_pushlightuserdata(L, op_unit);
1689 lua_pushinteger(L, skill);
1690
1691 if (!Lua::Core::SafeCall(out, 4, 0))
1692 aimAtArea(engine, skill);
1693 }
1694
1695 bool forbid_ammo = DF_GLOBAL_VALUE(standing_orders_forbid_used_ammo, false);
1696 if (forbid_ammo)
1697 item->flags.bits.forbid = true;
1698
1699 switch (item->getType())
1700 {
1701 case item_type::CAGE:
1702 flags.bits.bouncing = false;
1703 break;
1704 case item_type::BIN:
1705 case item_type::BARREL:
1706 flags.bits.bouncing = false;
1707 break;
1708 default:
1709 break;
1710 }
1711 }
1712
1713 void doLaunchContents()
1714 {

Callers

nothing calls this directly

Calls 7

find_engineFunction · 0.85
getOperatorUnitFunction · 0.85
lua_pushlightuserdataFunction · 0.85
lua_pushintegerFunction · 0.85
SafeCallFunction · 0.85
hasTargetMethod · 0.80
getTypeMethod · 0.80

Tested by

no test coverage detected