From: Rudolf Polzer Date: Fri, 13 Jan 2012 17:27:13 +0000 (+0100) Subject: fix some things about superweapon pickups X-Git-Tag: xonotic-v0.6.0~177^2^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=12b26110ebb9f0de4732d80e4916c08766c2128c;p=xonotic%2Fxonotic-data.pk3dir.git fix some things about superweapon pickups --- diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 828c81049..28b9be23c 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -542,6 +542,17 @@ void Item_Touch (void) } } +void Item_Reset() +{ + Item_Show(self, !self.state); + setorigin (self, self.origin); + self.think = SUB_Null; + self.nextthink = 0; + + if((self.flags & FL_POWERUP) | (self.weapons & WEPBIT_SUPERWEAPONS)) // do not spawn powerups initially! + Item_ScheduleInitialRespawn(self); +} + void Item_FindTeam() { entity head, e; @@ -568,22 +579,10 @@ void Item_FindTeam() head.effects &~= EF_NODRAW; } - if(e.flags & FL_POWERUP) // do not spawn powerups initially! - Item_ScheduleInitialRespawn(e); + Item_Reset(); } } -void Item_Reset() -{ - Item_Show(self, !self.state); - setorigin (self, self.origin); - self.think = SUB_Null; - self.nextthink = 0; - - if(self.flags & FL_POWERUP) // do not spawn powerups initially! - Item_ScheduleInitialRespawn(self); -} - // Savage: used for item garbage-collection // TODO: perhaps nice special effect? void RemoveItem(void) @@ -829,6 +828,10 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, self.bot_pickupbasevalue = pickupbasevalue; self.mdl = itemmodel; self.item_pickupsound = pickupsound; + if(self.weapons) + self.weapon = WEP_FIRST + log2of(lowestbit(self.weapons)); + else + self.weapon = 0; // let mappers override respawntime if(!self.respawntime) // both set { @@ -862,8 +865,8 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, self.effects = self.effects | EF_NODRAW; // marker for item team search InitializeEntity(self, Item_FindTeam, INITPRIO_FINDTARGET); } - else if(self.flags & FL_POWERUP) // do not spawn powerups initially! - Item_ScheduleInitialRespawn(self); + else + Item_Reset(); } /* replace items in minstagib @@ -1008,7 +1011,7 @@ void weapon_defaultspawnfunc(float wpn) if(!self.respawntime) { - if(self.weapons & WEPBIT_SUPERWEAPONS) + if(e.weapons & WEPBIT_SUPERWEAPONS) { self.respawntime = g_pickup_respawntime_superweapon; self.respawntimejitter = g_pickup_respawntimejitter_superweapon; @@ -1020,7 +1023,7 @@ void weapon_defaultspawnfunc(float wpn) } } - if(self.weapons & WEPBIT_SUPERWEAPONS) + if(e.weapons & WEPBIT_SUPERWEAPONS) if(!self.superweapons_finished) self.superweapons_finished = autocvar_g_balance_superweapons_time;