Fix Hold->HoldTerrain, also use a proper fix for Attack

develop
Quietust 2014-11-25 11:30:25 -06:00
parent d0b0f03060
commit 84d24ca13f
1 changed files with 7 additions and 8 deletions

@ -115,16 +115,15 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
case unit_action_type::Attack: case unit_action_type::Attack:
// Attacks are executed when timer1 reaches zero, which will be // Attacks are executed when timer1 reaches zero, which will be
// on the following tick. // on the following tick.
action->data.attack.timer1 = 1; if (action->data.attack.timer1 > 1)
action->data.attack.timer1 = 1;
// Attack actions are completed, and new ones generated, when // Attack actions are completed, and new ones generated, when
// timer2 reaches zero. If set to 1 this never seems to occur. // timer2 reaches zero.
// Setting to zero makes next tick generate a new attack action if (action->data.attack.timer2 > 1)
// every time, thereby allowing target enemy/body part re-selection action->data.attack.timer2 = 1;
// take place.
action->data.attack.timer2 = 0;
break; break;
case unit_action_type::Hold: case unit_action_type::HoldTerrain:
action->data.hold.timer = 1; action->data.holdterrain.timer = 1;
break; break;
case unit_action_type::Climb: case unit_action_type::Climb:
action->data.climb.timer = 1; action->data.climb.timer = 1;