It's a bit awkward that some triggers require the model field unset and
others require it unchanged, so rather than having duplicated code that
restores it after it was unset, an argument is added to control that
behaviour.
This should have been included in
2b46f62db61e8ca869fc591d9ebe4053c3e876d7
and/or
0f843f8c9e7891ba3029ac5a18c6ebebde3a30da
See also: https://gitlab.com/xonotic/xonotic-data.pk3dir/-/issues/2838
void func_ladder_init(entity this)
{
- string m = this.model;
- EXACTTRIGGER_INIT;
- // restore the model string unset in WarpZoneLib_ExactTrigger_Init()
- // see: https://gitlab.com/xonotic/xonotic-data.pk3dir/-/issues/2838
- this.model = m;
+ WarpZoneLib_ExactTrigger_Init(this, false);
BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
func_ladder_link(this);
setthink(this, func_ladder_think);
spawnfunc(trigger_impulse)
{
this.active = ACTIVE_ACTIVE;
- EXACTTRIGGER_INIT;
+ WarpZoneLib_ExactTrigger_Init(this, false);
BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
if(this.radius)
{
SetMovedir(this);
- EXACTTRIGGER_INIT;
+ WarpZoneLib_ExactTrigger_Init(this, false);
BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
this.active = ACTIVE_ACTIVE;
this.use = trigger_push_use;
#define move_out_of_solid(e) WarpZoneLib_MoveOutOfSolid(e)
bool WarpZoneLib_ExactTrigger_Touch(entity this, entity toucher, bool touchfunc);
-void WarpZoneLib_ExactTrigger_Init(entity this);
// WARNING: this kills the trace globals
#define EXACTTRIGGER_TOUCH(e,t) if(!WarpZoneLib_ExactTrigger_Touch((e), (t), true)) return // intended for use in touch funcs
-#define EXACTTRIGGER_INIT WarpZoneLib_ExactTrigger_Init(this)
+#define EXACTTRIGGER_INIT WarpZoneLib_ExactTrigger_Init(this, true)
this.scale = this.modelscale;
if(!this.scale)
this.scale = 1;
- string m;
- m = this.model;
- WarpZoneLib_ExactTrigger_Init(this);
- 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);
+
+ WarpZoneLib_ExactTrigger_Init(this, false);
+
setSendEntity(this, WarpZone_Send);
this.SendFlags = 0xFFFFFF;
BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
#endif
#include "common.qh"
-void WarpZoneLib_ExactTrigger_Init(entity this)
+void WarpZoneLib_ExactTrigger_Init(entity this, bool unsetmodel)
{
vector mi, ma;
if (this.movedir == '0 0 0')
else
setsize(this, this.mins, this.maxs);
set_movetype(this, MOVETYPE_NONE);
- this.model = "";
+
+ if (unsetmodel)
+ this.model = "";
}
bool WarpZoneLib_MoveOutOfSolid(entity e);
#ifdef SVQC
-void WarpZoneLib_ExactTrigger_Init(entity this);
+void WarpZoneLib_ExactTrigger_Init(entity this, bool unsetmodel);
#endif