shockwave_spawn("models/ctf/shockwavetransring.md3", org - '0 0 15', -0.8, 0, 1);
}
+// TODO add FlagDamage, replace weird hurttrigger handling inside trigger_hurt code by it
void FlagTouch()
{
if(gameover) return;
float t;
entity player;
string s, s0, h0, h1;
+
+ if (self.cnt == FLAG_CARRY)
+ return;
+
+ if (self.cnt == FLAG_DROPPED)
+ {
+ if(ITEM_TOUCH_NEEDKILL())
+ {
+ self.pain_finished = 0; // return immediately
+ return;
+ }
+ }
+
if (other.classname != "player")
return;
if (other.health < 1) // ignore dead players
return;
- if (self.cnt == FLAG_CARRY)
- return;
-
if (self.cnt == FLAG_BASE)
if (other.team == self.team)
if (other.flagcarried) // he's got a flag
}
#define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return
+#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
+#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER) || ((dt) == DEATH_SLIME) || ((dt) == DEATH_LAVA) || ((dt) == DEATH_SWAMP))
+
void URI_Get_Callback(float id, float status, string data)
{
if(url_URI_Get_Callback(id, status, data))
{
if(self.owner)
return;
+ if(ITEM_DAMAGE_NEEDKILL(deathtype))
+ {
+ // touching lava, or hurt trigger
+ // what shall we do?
+ // immediately return is bad
+ // maybe start a shorter countdown?
+ }
if(vlen(force) <= 0)
return;
if(time > self.pushltime)
if(self.owner) // already carried
return;
+
+ if(ITEM_TOUCH_NEEDKILL())
+ {
+ // touching sky, or nodrop
+ // what shall we do?
+ // immediately return is bad
+ // maybe start a shorter countdown?
+ }
+
if(other.classname != "player")
return;
if(other.deadflag != DEAD_NO)
entity e, head;
// remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky)
- if (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
+ if(self.classname == "droppedweapon")
{
- remove(self);
- return;
+ if (ITEM_TOUCH_NEEDKILL())
+ {
+ remove(self);
+ return;
+ }
}
+
if (other.classname != "player")
return;
if (other.deadflag)
return item.bot_pickupbasevalue * c;
}
+void Item_Damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+{
+ if(ITEM_DAMAGE_NEEDKILL(deathtype))
+ RemoveItem();
+}
.float is_item;
void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue)
self.think = RemoveItem;
self.nextthink = time + 20;
+ self.takedamage = DAMAGE_YES;
+ self.event_damage = Item_Damage;
+
if(self.strength_finished || self.invincible_finished || self.superweapons_finished)
/*
if(self.items == 0)