#include "triggers.qh"
+bool isPushable(entity e)
+{
+ if(e.pushable)
+ return true;
+#ifdef SVQC
+ if(IS_VEHICLE(e))
+ return false;
+ if(e.iscreature)
+ return true;
+ if (ITEM_IS_LOOT(e))
+ {
+ return true;
+ }
+ switch(e.classname)
+ {
+ case "body":
+ return true;
+ case "bullet": // antilagged bullets can't hit this either
+ return false;
+ }
+ if (e.projectiledeathtype)
+ return true;
+#endif
+#ifdef CSQC
+ if(e.flags & FL_PROJECTILE)
+ return true;
+ if(e.isplayermodel)
+ return true;
+#endif
+ return false;
+}
+
void SUB_DontUseTargets(entity this, entity actor, entity trigger) { }
void SUB_UseTargets(entity this, entity actor, entity trigger);
void generic_netlinked_reset(entity this)
{
- IFTARGETED
+ if(this.targetname && this.targetname != "")
{
if(this.spawnflags & START_ENABLED)
{
this.setactive(this, ACTIVE_TOGGLE);
}
-bool autocvar_g_triggers_debug = true;
-
-void trigger_init(entity this)
-{
- string m = this.model;
- EXACTTRIGGER_INIT;
- if(autocvar_g_triggers_debug)
- {
- if(m != "")
- {
- precache_model(m);
- _setmodel(this, m); // no precision needed
- }
- setorigin(this, this.origin);
- if(this.scale)
- setsize(this, this.mins * this.scale, this.maxs * this.scale);
- else
- setsize(this, this.mins, this.maxs);
- }
-
- if(autocvar_g_triggers_debug)
- BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
-}
-
void trigger_link(entity this, bool(entity this, entity to, int sendflags) sendfunc)
{
setSendEntity(this, sendfunc);
this.angles = '0 0 0';
this.modelindex = ReadShort();
+ if (this.modelindex)
+ setmodelindex(this, this.modelindex);
this.mins = ReadVector();
this.maxs = ReadVector();
this.scale = ReadByte() / 16;
==============================
*/
-void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventReuse)
+void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventReuse, int skiptargets)
{
//
// check for a delay
//
if (this.delay)
{
- // create a temp object to fire at a later time
- entity t = new(DelayedUse);
+ // create a temp object to fire at a later time
+ entity t = new_pure(DelayedUse);
t.nextthink = time + this.delay;
setthink(t, DelayThink);
t.enemy = actor;
t.message = this.message;
t.killtarget = this.killtarget;
- t.target = this.target;
- t.target2 = this.target2;
- t.target3 = this.target3;
- t.target4 = this.target4;
+ if(!(skiptargets & BIT(1))) t.target = this.target;
+ if(!(skiptargets & BIT(2))) t.target2 = this.target2;
+ if(!(skiptargets & BIT(3))) t.target3 = this.target3;
+ if(!(skiptargets & BIT(4))) t.target4 = this.target4;
t.antiwall_flag = this.antiwall_flag;
return;
}
for(int i = 0; i < 4; ++i)
{
+ if(skiptargets & BIT(i + 1))
+ continue;
switch(i)
{
default:
}
}
-void SUB_UseTargets(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, false); }
-void SUB_UseTargets_PreventReuse(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, true); }
+void SUB_UseTargets(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, false, 0); }
+void SUB_UseTargets_PreventReuse(entity this, entity actor, entity trigger) { SUB_UseTargets_Ex(this, actor, trigger, true, 0); }
+void SUB_UseTargets_SkipTargets(entity this, entity actor, entity trigger, int skiptargets) { SUB_UseTargets_Ex(this, actor, trigger, false, skiptargets); }