WriteVector(MSG_ENTITY, this.origin);
- WriteString(MSG_ENTITY, this.target);
- WriteString(MSG_ENTITY, this.target2);
- WriteString(MSG_ENTITY, this.target3);
- WriteString(MSG_ENTITY, this.target4);
- WriteString(MSG_ENTITY, this.targetname);
- WriteByte(MSG_ENTITY, this.target_random);
+ sf = 0;
+ sf = BITSET(sf, BIT(0), this.target_random);
+
+ sf = BITSET(sf, BIT(1), this.target && this.target != "");
+ sf = BITSET(sf, BIT(2), this.target2 && this.target2 != "");
+ sf = BITSET(sf, BIT(3), this.target3 && this.target3 != "");
+ sf = BITSET(sf, BIT(4), this.target4 && this.target4 != "");
+ sf = BITSET(sf, BIT(5), this.targetname && this.targetname != "");
+
+ WriteByte(MSG_ENTITY, sf);
+ if(sf & BIT(1))
+ WriteString(MSG_ENTITY, this.target);
+ if(sf & BIT(2))
+ WriteString(MSG_ENTITY, this.target2);
+ if(sf & BIT(3))
+ WriteString(MSG_ENTITY, this.target3);
+ if(sf & BIT(4))
+ WriteString(MSG_ENTITY, this.target4);
+ if(sf & BIT(5))
+ WriteString(MSG_ENTITY, this.targetname);
WriteByte(MSG_ENTITY, this.wait);
this.origin = ReadVector();
setorigin(this, this.origin);
- this.target = strzone(ReadString());
- this.target2 = strzone(ReadString());
- this.target3 = strzone(ReadString());
- this.target4 = strzone(ReadString());
- this.targetname = strzone(ReadString());
- this.target_random = ReadByte();
+ int targbits = ReadByte();
+ this.target_random = (targbits & BIT(0));
+
+ this.target = ((targbits & BIT(1)) ? strzone(ReadString()) : string_null);
+ this.target2 = ((targbits & BIT(2)) ? strzone(ReadString()) : string_null);
+ this.target3 = ((targbits & BIT(3)) ? strzone(ReadString()) : string_null);
+ this.target4 = ((targbits & BIT(4)) ? strzone(ReadString()) : string_null);
+ this.targetname = ((targbits & BIT(5)) ? strzone(ReadString()) : string_null);
this.wait = ReadByte();
void dynlight_find_aiment(entity this)
{
entity targ;
- if (!this.target)
+ if (!this.target || this.target == "")
objerror (this, "dynlight: no target to follow");
targ = find(NULL, targetname, this.target);
void dynlight_find_path(entity this)
{
entity targ;
- if (!this.target)
+ if (!this.target || this.target == "")
objerror (this, "dynlight: no target to follow");
targ = find(NULL, targetname, this.target);
void dynlight_find_target(entity this)
{
entity targ;
- if (!this.target)
+ if (!this.target || this.target == "")
objerror (this, "dynlight: no target to follow");
targ = find(NULL, targetname, this.target);
#include "magicear.qh"
#ifdef SVQC
-float magicear_matched;
-float W_Tuba_HasPlayed(entity pl, .entity weaponentity, string melody, float instrument, float ignorepitch, float mintempo, float maxtempo);
+#include <common/weapons/weapon/tuba.qh>
+bool magicear_matched;
string trigger_magicear_processmessage(entity ear, entity source, float teamsay, entity privatesay, string msgin)
{
float domatch, dotrigger, matchstart, l;
/*
* t_swamp.c
-* Adds spawnfunc_trigger_swamp and suppoart routines for xonotic 1.2.1+
+* Adds spawnfunc_trigger_swamp and support routines for nexuiz 1.2.1+ and xonotic
* Author tZork (Jakob MG)
* jakob@games43.se
* 2005 11 29
*/
-.float swamp_interval; //Hurt players in swamp with this interval
-.float swamp_slowdown; //Players in swamp get slowd down by this mutch 0-1 is slowdown 1-~ is speedup (!?)
-.float swamp_lifetime; // holds the points remaining until slug dies (not quite health!)
-.entity swampslug;
-
-#ifdef SVQC
-spawnfunc(trigger_swamp);
-#endif
-void swamp_touch(entity this, entity toucher);
-void swampslug_think(entity this);
-
/*
* Uses a entity calld swampslug to handle players in the swamp
//Slug dead? then remove curses.
if(GetResource(this, RES_HEALTH) <= 0)
{
- this.owner.in_swamp = 0;
+ if(this.owner.swampslug == this)
+ {
+ this.owner.in_swamp = false;
+ this.owner.swampslug = NULL;
+ }
delete(this);
//centerprint(this.owner,"Killing slug...\n");
return;
EXACTTRIGGER_TOUCH(this, toucher);
// Chech if player alredy got a swampslug.
- if(toucher.in_swamp != 1)
+ if(!toucher.in_swamp)
{
// If not attach one.
//centerprint(toucher,"Entering swamp!\n");
- toucher.swampslug = spawn();
+ if(!toucher.swampslug) // just incase
+ toucher.swampslug = spawn();
toucher.swampslug.swamp_lifetime = 2;
setthink(toucher.swampslug, swampslug_think);
toucher.swampslug.nextthink = time;
toucher.swampslug.dmg = this.dmg;
toucher.swampslug.swamp_interval = this.swamp_interval;
toucher.swamp_slowdown = this.swamp_slowdown;
- toucher.in_swamp = 1;
+ toucher.in_swamp = true;
return;
}
- //toucher.in_swamp = 1;
+ //toucher.in_swamp = true;
//Revitalize players swampslug
toucher.swampslug.swamp_lifetime = 2;
}
/*QUAKED spawnfunc_trigger_swamp (.5 .5 .5) ?
-Players gettin into the swamp will
-get slowd down and damaged
+Players in the swamp will be
+slowed down and damaged over time
*/
spawnfunc(trigger_swamp)
{
.float swamp_interval; //Hurt players in swamp with this interval
.float swamp_slowdown; //Players in swamp get slowd down by this mutch 0-1 is slowdown 1-~ is speedup (!?)
-.entity swampslug;
-.float in_swamp; // bool
+.bool in_swamp;
.entity swampslug; // Uses this to release from swamp ("untouch" fix)
+
+.float swamp_interval; //Hurt players in swamp with this interval
+.float swamp_slowdown; //Players in swamp get slowd down by this mutch 0-1 is slowdown 1-~ is speedup (!?)
+.float swamp_lifetime; // holds the points remaining until slug dies (not quite health!)
+
+#ifdef SVQC
+spawnfunc(trigger_swamp);
+#endif
+void swamp_touch(entity this, entity toucher);
+void swampslug_think(entity this);
classfield(Tuba) .float tuba_volume_initial;
classfield(Tuba) .int tuba_instrument;
#endif
+
+#ifdef SVQC
+bool W_Tuba_HasPlayed(entity pl, .entity weaponentity, string melody, int instrument, bool ignorepitch, float mintempo, float maxtempo);
+#endif
#include "../common/mapobjects/teleporters.qh"
#include "../common/mapobjects/target/spawnpoint.qh"
#include <common/mapobjects/trigger/counter.qh>
+#include <common/mapobjects/trigger/swamp.qh>
#include "../common/vehicles/all.qh"
if(this.conveyor)
IL_REMOVE(g_conveyed, this);
this.conveyor = NULL; // prevent conveyors at the previous location from moving a freshly spawned player
+ if(this.swampslug)
+ delete(this.swampslug);
+ this.in_swamp = false;
STAT(HUD, this) = HUD_NORMAL;
this.event_damage = PlayerDamage;