SERVER: Fix entity relinking with Pack-A-Punch

This commit is contained in:
cypress 2023-10-19 17:09:47 -04:00
parent 81693dcd77
commit 6fe33b26d9

View file

@ -1088,6 +1088,10 @@ void() power_switch =
// Pack-a-Punch // Pack-a-Punch
// -------------------- // --------------------
// //
// cypress 19 OCT 2023 -- Changed storage from .owner to .usedent,
// as .owner causes issues with entity relinking, subsequently breaking
// PlayerIsLooking().
//
void removeinpap() { void removeinpap() {
//remove(self); //remove(self);
@ -1095,9 +1099,9 @@ void removeinpap() {
//Self = floating gun //Self = floating gun
void velocity_reduce_output() { void velocity_reduce_output() {
makevectors(self.owner.angles); makevectors(self.usedent.angles);
self.velocity = [0,0,0]; self.velocity = [0,0,0];
setorigin(self, self.owner.origin + v_forward*25); setorigin(self, self.usedent.origin + v_forward*25);
//start floating back into pap //start floating back into pap
self.velocity = v_forward*-1.5; self.velocity = v_forward*-1.5;
@ -1106,13 +1110,13 @@ void velocity_reduce_output() {
//Self = floating gun //Self = floating gun
void velocity_reduce_output_in() { void velocity_reduce_output_in() {
self.velocity = [0,0,0]; self.velocity = [0,0,0];
setorigin(self, self.owner.origin); setorigin(self, self.usedent.origin);
} }
void() reset_pap = void() reset_pap =
{ {
self.weapon = 0; self.weapon = 0;
self.owner = 0; self.usedent = 0;
if (self.goaldummy) { if (self.goaldummy) {
@ -1166,14 +1170,14 @@ void PapUpgrade(entity pap, entity buyer) {
floatmodelin.movetype = MOVETYPE_NOCLIP; floatmodelin.movetype = MOVETYPE_NOCLIP;
floatmodelin.solid = SOLID_NOT; floatmodelin.solid = SOLID_NOT;
floatmodelin.owner = pap; floatmodelin.usedent = pap;
floatmodelin.velocity = v_forward*-25; floatmodelin.velocity = v_forward*-25;
floatmodelin.think = velocity_reduce_output_in; floatmodelin.think = velocity_reduce_output_in;
floatmodelin.nextthink = time + 1; floatmodelin.nextthink = time + 1;
//model goes velocity_reduce_output //model goes velocity_reduce_output
pap.owner = self; pap.usedent = self;
pap.goaldummy = floatmodelin; pap.goaldummy = floatmodelin;
pap.think = PapSendOut; pap.think = PapSendOut;
pap.nextthink = time + 3.5; pap.nextthink = time + 3.5;