From cce17fc764e20438772af111908fd2e6aeea3619 Mon Sep 17 00:00:00 2001 From: MikeyRay Date: Mon, 27 Mar 2023 02:30:28 +0200 Subject: [PATCH] SERVER: Implement "not here" flag for box --- source/server/entities/machines.qc | 33 +++++++++++++++++++----------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/source/server/entities/machines.qc b/source/server/entities/machines.qc index 2f09075..9c63ef5 100644 --- a/source/server/entities/machines.qc +++ b/source/server/entities/machines.qc @@ -1083,6 +1083,9 @@ void() power_switch = // -------------------- // +#define MBOX_SPAWNFLAG_NOTHERE 1 +#define MBOX_SPAWNFLAG_NOLIGHT 2 + void() updateBoxGlow { if(self.goaldummy) @@ -1302,7 +1305,7 @@ void() findboxspot = newspot.angles_y += 90; // Spawn the Box Glow if permitted - if (!(self.owner.spawnflags & 2)) + if (!(self.owner.spawnflags & MBOX_SPAWNFLAG_NOLIGHT)) { entity g; g = spawn(); @@ -1329,7 +1332,7 @@ void() findboxspot = void() remove_box = { - if (!(self.owner.spawnflags & 2)) + if (!(self.owner.spawnflags & MBOX_SPAWNFLAG_NOLIGHT)) setmodel(self.owner.goaldummy, ""); self.owner.frame = 0; // set box frame @@ -1662,22 +1665,28 @@ void() mystery_box = setorigin(self, self.origin); setmodel (self, "models/machines/mystery.mdl"); setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX); - - if (!(self.spawnflags & 2)) - { - local entity g; - g = spawn(); - self.goaldummy = g; - setmodel(g,"models/machines/mglow$.mdl"); - setorigin(g,self.origin); - g.angles = self.angles; - } self.touch = mystery_touch; boxOrigin = self.origin; boxLocations[boxCount] = self; boxCount++; + + // Temporary hack for random box spawns until rewrite - Mikey (27/03/2023, DD/MM/YYYY) + if(self.spawnflags & MBOX_SPAWNFLAG_NOTHERE) { + entity temp = spawn(); + + temp.owner = self; + temp.think = findboxspot; + temp.nextthink = time + 0.1; + } else if(!(self.spawnflags & MBOX_SPAWNFLAG_NOLIGHT)) { + entity g = spawn(); + + self.goaldummy = g; + setmodel(g,"models/machines/mglow$.mdl"); + setorigin(g,self.origin); + g.angles = self.angles; + } } //