X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_lights.qc;h=852f1efc01d70cda4a73a3d903a67c20a67e1601;hp=f7382d1666b15b6c295903b3fa90260be3c720a2;hb=05d2779856eda44ed6c8779ab55380fa006cfcb4;hpb=9c09a961b8674e3a808889d3f34d71855018d3bc diff --git a/qcsrc/server/g_lights.qc b/qcsrc/server/g_lights.qc index f7382d166..852f1efc0 100644 --- a/qcsrc/server/g_lights.qc +++ b/qcsrc/server/g_lights.qc @@ -1,9 +1,14 @@ -#include "_all.qh" +#include "g_lights.qh" -void train_next(); +#include +#include + +void train_next(entity this); const float LOOP = 1; +.float speed; + const float DNOSHADOW = 2; const float DFOLLOW = 4; .float light_lev; @@ -32,99 +37,99 @@ flags: "NOSHADOW" will not cast shadows in realtime lighting mode "FOLLOW" will follow the entity which "targetname" matches "target" */ -void dynlight_think() +void dynlight_think(entity this) { - if(!self.owner) - remove(self); + if(!this.owner) + delete(this); - self.nextthink = time + 0.1; + this.nextthink = time + 0.1; } -void dynlight_find_aiment() +void dynlight_find_aiment(entity this) { entity targ; - if (!self.target) - objerror ("dynlight: no target to follow"); + if (!this.target) + objerror (this, "dynlight: no target to follow"); - targ = find(world, targetname, self.target); - self.movetype = MOVETYPE_FOLLOW; - self.aiment = targ; - self.owner = targ; - self.punchangle = targ.angles; - self.view_ofs = self.origin - targ.origin; - self.v_angle = self.angles - targ.angles; - self.think = dynlight_think; - self.nextthink = time + 0.1; + targ = find(NULL, targetname, this.target); + set_movetype(this, MOVETYPE_FOLLOW); + this.aiment = targ; + this.owner = targ; + this.punchangle = targ.angles; + this.view_ofs = this.origin - targ.origin; + this.v_angle = this.angles - targ.angles; + setthink(this, dynlight_think); + this.nextthink = time + 0.1; } -void dynlight_find_path() +void dynlight_find_path(entity this) { entity targ; - if (!self.target) - objerror ("dynlight: no target to follow"); + if (!this.target) + objerror (this, "dynlight: no target to follow"); - targ = find(world, targetname, self.target); - self.target = targ.target; - setorigin (self, targ.origin); - self.think = train_next; - self.nextthink = time + 0.1; + targ = find(NULL, targetname, this.target); + this.target = targ.target; + setorigin(this, targ.origin); + setthink(this, train_next); + this.nextthink = time + 0.1; } -void dynlight_find_target() +void dynlight_find_target(entity this) { entity targ; - if (!self.target) - objerror ("dynlight: no target to follow"); + if (!this.target) + objerror (this, "dynlight: no target to follow"); - targ = find(world, targetname, self.target); - setattachment(self, targ, self.dtagname); - self.owner = targ; - self.think = dynlight_think; - self.nextthink = time + 0.1; + targ = find(NULL, targetname, this.target); + setattachment(this, targ, this.dtagname); + this.owner = targ; + setthink(this, dynlight_think); + this.nextthink = time + 0.1; } -void dynlight_use() +void dynlight_use(entity this, entity actor, entity trigger) { - if (self.light_lev == 0) - self.light_lev = self.lefty; + if (this.light_lev == 0) + this.light_lev = this.lefty; else - self.light_lev = 0; + this.light_lev = 0; } -void spawnfunc_dynlight() +spawnfunc(dynlight) { - if (!self.light_lev) - self.light_lev = 200; - if (!self.color) - self.color = '1 1 1'; - self.lefty = self.light_lev; - self.use = dynlight_use; - setsize (self, '0 0 0', '0 0 0'); - setorigin (self, self.origin); - //self.pflags = PFLAGS_FULLDYNAMIC; - self.solid = SOLID_NOT; - //self.blocked = func_null; - //if (self.spawnflags & DNOSHADOW) - // self.pflags = self.pflags + PFLAGS_NOSHADOW; - //if (self.spawnflags & START_OFF) - // self.light_lev = 0; + if (!this.light_lev) + this.light_lev = 200; + if (!this.color) + this.color = '1 1 1'; + this.lefty = this.light_lev; + this.use = dynlight_use; + setsize (this, '0 0 0', '0 0 0'); + setorigin(this, this.origin); + //this.pflags = PFLAGS_FULLDYNAMIC; + this.solid = SOLID_NOT; + //this.blocked = func_null; + //if (this.spawnflags & DNOSHADOW) + // this.pflags = this.pflags + PFLAGS_NOSHADOW; + //if (this.spawnflags & START_OFF) + // this.light_lev = 0; //tag attaching - if (self.dtagname) + if (this.dtagname) { - InitializeEntity(self, dynlight_find_target, INITPRIO_FINDTARGET); + InitializeEntity(this, dynlight_find_target, INITPRIO_FINDTARGET); return; } // entity following - if (self.spawnflags & DFOLLOW) + if (this.spawnflags & DFOLLOW) { - InitializeEntity(self, dynlight_find_aiment, INITPRIO_FINDTARGET); + InitializeEntity(this, dynlight_find_aiment, INITPRIO_FINDTARGET); return; } // path following - if (self.target) -// if (!(self.spawnflags & DFOLLOW)) + if (this.target) +// if (!(this.spawnflags & DFOLLOW)) { - self.movetype = MOVETYPE_NOCLIP; - if (!self.speed) - self.speed = 100; - InitializeEntity(self, dynlight_find_path, INITPRIO_FINDTARGET); + set_movetype(this, MOVETYPE_NOCLIP); + if (!this.speed) + this.speed = 100; + InitializeEntity(this, dynlight_find_path, INITPRIO_FINDTARGET); return; } }