IL_REMOVE(g_conveyed, it);
});
- if(this.state)
+ if(this.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;
#ifdef SVQC
-void conveyor_use(entity this, entity actor, entity trigger)
+void conveyor_setactive(entity this, int act)
{
- this.state = !this.state;
+ int old_status = this.active;
+ if(act == ACTIVE_TOGGLE)
+ {
+ if(this.active == ACTIVE_ACTIVE)
+ {
+ this.active = ACTIVE_NOT;
+ }
+ else
+ {
+ this.active = ACTIVE_ACTIVE;
+ }
+ }
+ else
+ {
+ this.active = act;
+ }
- this.SendFlags |= SF_TRIGGER_UPDATE;
+ if (this.active != old_status)
+ {
+ this.SendFlags |= SF_TRIGGER_UPDATE;
+ }
+}
+
+// Compatibility with old maps
+void conveyor_use(entity this, entity actor, entity trigger)
+{
+ conveyor_setactive(this, ACTIVE_TOGGLE);
}
void conveyor_reset(entity this)
{
- if(this.spawnflags & CONVEYOR_START_ENABLED)
+ IFTARGETED
{
- this.state = STATE_ON;
+ if(this.spawnflags & CONVEYOR_START_ENABLED)
+ {
+ this.active = ACTIVE_ACTIVE;
+ }
+ }
+ else
+ {
+ this.active = ACTIVE_ACTIVE;
}
this.SendFlags |= SF_TRIGGER_UPDATE;
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;
}
this.movedir *= this.speed;
setthink(this, conveyor_think);
this.nextthink = time;
+ this.setactive = conveyor_setactive;
IFTARGETED
{
+ // backwards compatibility
this.use = conveyor_use;
- this.reset = conveyor_reset;
- this.reset(this);
}
- else
- this.state = STATE_ON;
+ this.reset = conveyor_reset;
+ this.reset(this);
FixSize(this);
this.movedir = ReadVector();
this.speed = ReadByte();
- this.state = ReadByte();
+ this.active = ReadByte();
this.targetname = strzone(ReadString());
this.target = strzone(ReadString());
}
if(sendflags & SF_TRIGGER_UPDATE)
- this.state = ReadByte();
+ this.active = ReadByte();
return true;
}