1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-10-18 06:30:41 +00:00

relhell:: ads:: turrets no longer shoot after being destroyed

This commit is contained in:
Zeno Rogue 2024-10-01 22:18:54 +02:00
parent 8f99dd9ca4
commit 7114406290

View File

@ -313,6 +313,8 @@ bool bad_turret = false;
void handle_turret(ads_object *t, ld& angle_at_time) { void handle_turret(ads_object *t, ld& angle_at_time) {
ld ctime = t->pt_main.shift; ld ctime = t->pt_main.shift;
if(t->last_shot >= t->life_end) return;
auto p = at_or_null(cds_last, t->owner); auto p = at_or_null(cds_last, t->owner);
if(!p) return; if(!p) return;
auto t1 = p->V * t->at * ads_matrix(Id, ctime); auto t1 = p->V * t->at * ads_matrix(Id, ctime);
@ -405,6 +407,7 @@ void handle_turret(ads_object *t, ld& angle_at_time) {
if(nts.err < 0.01 && ctime > t->last_shot + 1 && it0->second.err < 0.01) { if(nts.err < 0.01 && ctime > t->last_shot + 1 && it0->second.err < 0.01) {
t->last_shot = t->last_shot + floor(ctime - t->last_shot); t->last_shot = t->last_shot + floor(ctime - t->last_shot);
if(t->last_shot >= t->life_end) return;
ld angle = lerp(it0->second.angle, nts.angle, ilerp(it0->first, ctime, t->last_shot)); ld angle = lerp(it0->second.angle, nts.angle, ilerp(it0->first, ctime, t->last_shot));
// println(hlog, "shooting at angle ", angle, " at time ", t->last_shot); // println(hlog, "shooting at angle ", angle, " at time ", t->last_shot);
ads_matrix S0 = ads_inverse(p->V) * t1 * spin(angle) * twist::uxpush(turret_length * ads_scale) * lorentz(0, 2, ads_missile_rapidity); ads_matrix S0 = ads_inverse(p->V) * t1 * spin(angle) * twist::uxpush(turret_length * ads_scale) * lorentz(0, 2, ads_missile_rapidity);