This was most noticeable with door .wait <= 1 but would eventually occur
at higher wait values if players hang around in the trigger field.
Also the door(s) usually did not stay open for the full .wait time after
the player left the trigger field, as some time had passed since the
.door_finished timestamp was set.
To make this reliable AND efficient requires updating the state of the
door(s), instead of maintaining a separate state in the trigger field entity.
#endif
return;
- if (time < this.door_finished)
+ if (this.owner.state == STATE_UP)
return;
// check if door is locked
if (!door_check_keys(this, toucher))
return;
- this.door_finished = time + 1;
+ if (this.owner.state == STATE_TOP)
+ {
+ if (this.owner.nextthink < this.owner.ltime + this.owner.wait)
+ {
+ entity e = this.owner;
+ do {
+ e.nextthink = e.ltime + e.wait;
+ e = e.enemy;
+ } while (e != this.owner);
+ }
+ return;
+ }
door_use(this.owner, toucher, NULL);
}