Use init_ai_object for dropped robots

zicodxx reported a problem where poison=overwrite builds caused robots
dropped by other robots not to spawn.  I diagnosed it as a problem
caused by not setting `dying_start_time` and proposed using
`init_ai_object` to set this (and other) fields.  Kreatordxx posted pull
request #311 to implement this for dropped robots.  However, his pull
had the unfortunate side effect of zeroing the dropped robot's velocity.
This change is based on his pull, but with the `init_ai_object` call
moved higher so that the velocity is (unnecessarily) zeroed by
`init_ai_object`, then initialized to `new_velocity` by `drop_powerup`
(as it always was).

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/293>
Patch-inspired-by: kreatordxx <https://github.com/dxx-rebirth/dxx-rebirth/pull/311>
This commit is contained in:
Kp 2017-01-17 02:38:21 +00:00
parent b644ab575c
commit cc885f17a3

View file

@ -948,6 +948,7 @@ objptridx_t drop_powerup(int type, int id, int num, const vms_vector &init_vel,
{
Net_create_objnums[Net_create_loc++] = objnum;
}
init_ai_object(obj, ai_behavior::AIB_NORMAL, segment_none);
//Set polygon-object-specific data
obj->rtype.pobj_info.model_num = Robot_info[get_robot_id(obj)].model_num;
@ -964,7 +965,6 @@ objptridx_t drop_powerup(int type, int id, int num, const vms_vector &init_vel,
obj->shields = Robot_info[get_robot_id(obj)].strength;
obj->ctype.ai_info.behavior = ai_behavior::AIB_NORMAL;
ai_local *ailp = &obj->ctype.ai_info.ail;
ailp->player_awareness_type = player_awareness_type_t::PA_WEAPON_ROBOT_COLLISION;
ailp->player_awareness_time = F1_0*3;