update structures

develop
Ben Lubar 2020-03-02 22:29:53 -06:00
parent c29b606a4a
commit 7784e569a5
No known key found for this signature in database
GPG Key ID: 92939677AB59EDA4
3 changed files with 24 additions and 24 deletions

@ -1 +1 @@
Subproject commit 614548ce67ef3d154297167ecacfd9b8c2d49875 Subproject commit 5653a57e0978a78c1f1ef125b63359fefa7660f2

@ -123,55 +123,55 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
case unit_action_type::None: case unit_action_type::None:
break; break;
case unit_action_type::Move: case unit_action_type::Move:
action->data.move.timer = 1; action->data.Move.timer = 1;
break; break;
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.
if (action->data.attack.timer1 > 1) if (action->data.Attack.timer1 > 1)
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. // timer2 reaches zero.
if (action->data.attack.timer2 > 1) if (action->data.Attack.timer2 > 1)
action->data.attack.timer2 = 1; action->data.Attack.timer2 = 1;
break; break;
case unit_action_type::HoldTerrain: case unit_action_type::HoldTerrain:
action->data.holdterrain.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;
break; break;
case unit_action_type::Job: case unit_action_type::Job:
action->data.job.timer = 1; action->data.Job.timer = 1;
// could also patch the unit->job.current_job->completion_timer // could also patch the unit->job.current_job->completion_timer
break; break;
case unit_action_type::Talk: case unit_action_type::Talk:
action->data.talk.timer = 1; action->data.Talk.timer = 1;
break; break;
case unit_action_type::Unsteady: case unit_action_type::Unsteady:
action->data.unsteady.timer = 1; action->data.Unsteady.timer = 1;
break; break;
case unit_action_type::Dodge: case unit_action_type::Dodge:
action->data.dodge.timer = 1; action->data.Dodge.timer = 1;
break; break;
case unit_action_type::Recover: case unit_action_type::Recover:
action->data.recover.timer = 1; action->data.Recover.timer = 1;
break; break;
case unit_action_type::StandUp: case unit_action_type::StandUp:
action->data.standup.timer = 1; action->data.StandUp.timer = 1;
break; break;
case unit_action_type::LieDown: case unit_action_type::LieDown:
action->data.liedown.timer = 1; action->data.LieDown.timer = 1;
break; break;
case unit_action_type::Job2: case unit_action_type::Job2:
action->data.job2.timer = 1; action->data.Job2.timer = 1;
// could also patch the unit->job.current_job->completion_timer // could also patch the unit->job.current_job->completion_timer
break; break;
case unit_action_type::PushObject: case unit_action_type::PushObject:
action->data.pushobject.timer = 1; action->data.PushObject.timer = 1;
break; break;
case unit_action_type::SuckBlood: case unit_action_type::SuckBlood:
action->data.suckblood.timer = 1; action->data.SuckBlood.timer = 1;
break; break;
case unit_action_type::Jump: case unit_action_type::Jump:
case unit_action_type::ReleaseTerrain: case unit_action_type::ReleaseTerrain:

@ -1825,17 +1825,17 @@ static command_result GetUnitListInside(color_ostream &stream, const BlockReques
case unit_action_type::Move: case unit_action_type::Move:
if (unit->path.path.x.size() > 0) if (unit->path.path.x.size() > 0)
{ {
send_unit->set_subpos_x(lerp(0, unit->path.path.x[0] - unit->pos.x, (float)(action->data.move.timer_init - action->data.move.timer) / action->data.move.timer_init)); send_unit->set_subpos_x(lerp(0, unit->path.path.x[0] - unit->pos.x, (float)(action->data.Move.timer_init - action->data.Move.timer) / action->data.Move.timer_init));
send_unit->set_subpos_y(lerp(0, unit->path.path.y[0] - unit->pos.y, (float)(action->data.move.timer_init - action->data.move.timer) / action->data.move.timer_init)); send_unit->set_subpos_y(lerp(0, unit->path.path.y[0] - unit->pos.y, (float)(action->data.Move.timer_init - action->data.Move.timer) / action->data.Move.timer_init));
send_unit->set_subpos_z(lerp(0, unit->path.path.z[0] - unit->pos.z, (float)(action->data.move.timer_init - action->data.move.timer) / action->data.move.timer_init)); send_unit->set_subpos_z(lerp(0, unit->path.path.z[0] - unit->pos.z, (float)(action->data.Move.timer_init - action->data.Move.timer) / action->data.Move.timer_init));
} }
break; break;
case unit_action_type::Job: case unit_action_type::Job:
{ {
auto facing = send_unit->mutable_facing(); auto facing = send_unit->mutable_facing();
facing->set_x(action->data.job.x - unit->pos.x); facing->set_x(action->data.Job.x - unit->pos.x);
facing->set_y(action->data.job.y - unit->pos.y); facing->set_y(action->data.Job.y - unit->pos.y);
facing->set_z(action->data.job.z - unit->pos.z); facing->set_z(action->data.Job.z - unit->pos.z);
} }
default: default:
break; break;