X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Fphysical_items%2Fphysical_items.qc;h=aad331527335362cc2d48c5b04a1c801fc51eb9e;hb=75f32635eb47f324db31c8f257c935018dedbc23;hp=aaad9d47be599b59c91a7c879014d0deb8dc6535;hpb=3bdee6303ce762a39c2ad67a70745668ba298043;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc b/qcsrc/common/mutators/mutator/physical_items/physical_items.qc index aaad9d47b..aad331527 100644 --- a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc +++ b/qcsrc/common/mutators/mutator/physical_items/physical_items.qc @@ -31,8 +31,8 @@ REGISTER_MUTATOR(physical_items, cvar("g_physical_items")) .vector spawn_origin, spawn_angles; -void physical_item_think() -{SELFPARAM(); +void physical_item_think(entity this) +{ self.nextthink = time; self.alpha = self.owner.alpha; // apply fading and ghosting @@ -68,8 +68,8 @@ void physical_item_think() remove(self); // the real item is gone, remove this } -void physical_item_touch() -{SELFPARAM(); +void physical_item_touch(entity this) +{ if(!self.cnt) // not for dropped items if (ITEM_TOUCH_NEEDKILL()) { @@ -89,55 +89,53 @@ void physical_item_damage(entity this, entity inflictor, entity attacker, float } MUTATOR_HOOKFUNCTION(physical_items, Item_Spawn) -{SELFPARAM(); - if(self.owner == world && autocvar_g_physical_items <= 1) - return false; - if (self.spawnflags & 1) // floating item - return false; +{ + entity item = M_ARGV(0, entity); + + if(item.owner == world && autocvar_g_physical_items <= 1) + return; + if (item.spawnflags & 1) // floating item + return; // The actual item can't be physical and trigger at the same time, so make it invisible and use a second entity for physics. // Ugly hack, but unless SOLID_TRIGGER is gotten to work with MOVETYPE_PHYSICS in the engine it can't be fixed. entity wep; wep = spawn(); - _setmodel(wep, self.model); - setsize(wep, self.mins, self.maxs); - setorigin(wep, self.origin); - wep.angles = self.angles; - wep.velocity = self.velocity; + _setmodel(wep, item.model); + setsize(wep, item.mins, item.maxs); + setorigin(wep, item.origin); + wep.angles = item.angles; + wep.velocity = item.velocity; - wep.owner = self; + wep.owner = item; wep.solid = SOLID_CORPSE; wep.movetype = MOVETYPE_PHYSICS; wep.takedamage = DAMAGE_AIM; wep.effects |= EF_NOMODELFLAGS; // disable the spinning - wep.colormap = self.owner.colormap; - wep.glowmod = self.owner.glowmod; + wep.colormap = item.owner.colormap; + wep.glowmod = item.owner.glowmod; wep.damageforcescale = autocvar_g_physical_items_damageforcescale; - wep.dphitcontentsmask = self.dphitcontentsmask; - wep.cnt = (self.owner != world); + wep.dphitcontentsmask = item.dphitcontentsmask; + wep.cnt = (item.owner != world); - wep.think = physical_item_think; + setthink(wep, physical_item_think); wep.nextthink = time; - wep.touch = physical_item_touch; + settouch(wep, physical_item_touch); wep.event_damage = physical_item_damage; if(!wep.cnt) { // fix the spawn origin setorigin(wep, wep.origin + '0 0 1'); - entity oldself; - oldself = self; WITHSELF(wep, builtin_droptofloor()); } wep.spawn_origin = wep.origin; - wep.spawn_angles = self.angles; - - self.effects |= EF_NODRAW; // hide the original weapon - self.movetype = MOVETYPE_FOLLOW; - self.aiment = wep; // attach the original weapon - self.SendEntity3 = func_null; + wep.spawn_angles = item.angles; - return false; + item.effects |= EF_NODRAW; // hide the original weapon + item.movetype = MOVETYPE_FOLLOW; + item.aiment = wep; // attach the original weapon + item.SendEntity3 = func_null; } #endif