]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/func/conveyor.qc
Explicitly check for ACTIVE_ACTIVE
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / conveyor.qc
index 375a6adb867bca7c02d800a7a26c05b43548b31d..4214a73239628f1a06a405cda73f7d094a18e4cd 100644 (file)
@@ -17,9 +17,9 @@ void conveyor_think(entity this)
                IL_REMOVE(g_conveyed, it);
        });
 
-       if(this.state)
+       if(this.active == ACTIVE_ACTIVE)
        {
-               FOREACH_ENTITY_RADIUS((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1, !it.conveyor.state && isPushable(it),
+               FOREACH_ENTITY_RADIUS((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1, !it.conveyor.active && isPushable(it),
                {
                        vector emin = it.absmin;
                        vector emax = it.absmax;
@@ -63,23 +63,6 @@ void conveyor_think(entity this)
 
 #ifdef SVQC
 
-void conveyor_use(entity this, entity actor, entity trigger)
-{
-       this.state = !this.state;
-
-       this.SendFlags |= SF_TRIGGER_UPDATE;
-}
-
-void conveyor_reset(entity this)
-{
-       if(this.spawnflags & CONVEYOR_START_ENABLED)
-       {
-               this.state = STATE_ON;
-       }
-
-       this.SendFlags |= SF_TRIGGER_UPDATE;
-}
-
 bool conveyor_send(entity this, entity to, int sendflags)
 {
        WriteHeader(MSG_ENTITY, ENT_CLIENT_CONVEYOR);
@@ -96,14 +79,14 @@ bool conveyor_send(entity this, entity to, int sendflags)
                WriteVector(MSG_ENTITY, this.movedir);
 
                WriteByte(MSG_ENTITY, this.speed);
-               WriteByte(MSG_ENTITY, this.state);
+               WriteByte(MSG_ENTITY, this.active);
 
                WriteString(MSG_ENTITY, this.targetname);
                WriteString(MSG_ENTITY, this.target);
        }
 
        if(sendflags & SF_TRIGGER_UPDATE)
-               WriteByte(MSG_ENTITY, this.state);
+               WriteByte(MSG_ENTITY, this.active);
 
        return true;
 }
@@ -114,14 +97,14 @@ void conveyor_init(entity this)
        this.movedir *= this.speed;
        setthink(this, conveyor_think);
        this.nextthink = time;
+       this.setactive = generic_netlinked_setactive;
        IFTARGETED
        {
-               this.use = conveyor_use;
-               this.reset = conveyor_reset;
-               this.reset(this);
+               // backwards compatibility
+               this.use = generic_netlinked_legacy_use;
        }
-       else
-               this.state = STATE_ON;
+       this.reset = generic_netlinked_reset;
+       this.reset(this);
 
        FixSize(this);
 
@@ -179,7 +162,7 @@ NET_HANDLE(ENT_CLIENT_CONVEYOR, bool isnew)
                this.movedir = ReadVector();
 
                this.speed = ReadByte();
-               this.state = ReadByte();
+               this.active = ReadByte();
 
                this.targetname = strzone(ReadString());
                this.target = strzone(ReadString());
@@ -188,7 +171,7 @@ NET_HANDLE(ENT_CLIENT_CONVEYOR, bool isnew)
        }
 
        if(sendflags & SF_TRIGGER_UPDATE)
-               this.state = ReadByte();
+               this.active = ReadByte();
 
        return true;
 }