]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move dynlight to mapobjects
authorMario <mario@smbclan.net>
Sat, 9 Jun 2018 16:29:39 +0000 (02:29 +1000)
committerMario <mario@smbclan.net>
Sat, 9 Jun 2018 16:29:39 +0000 (02:29 +1000)
qcsrc/common/mapobjects/misc/_mod.inc
qcsrc/common/mapobjects/misc/_mod.qh
qcsrc/common/mapobjects/misc/dynlight.qc [new file with mode: 0644]
qcsrc/common/mapobjects/misc/dynlight.qh [new file with mode: 0644]
qcsrc/server/_mod.inc
qcsrc/server/_mod.qh
qcsrc/server/g_lights.qc [deleted file]
qcsrc/server/g_lights.qh [deleted file]

index 3698cf8224e0317f8e1c6421b13b9dd238a28ab1..498f6c521e941c861d7049855699324bfd502666 100644 (file)
@@ -1,5 +1,6 @@
 // generated file; do not modify
 #include <common/mapobjects/misc/corner.qc>
+#include <common/mapobjects/misc/dynlight.qc>
 #include <common/mapobjects/misc/follow.qc>
 #include <common/mapobjects/misc/laser.qc>
 #include <common/mapobjects/misc/teleport_dest.qc>
index 5b156176e1dc8feee7b1e4dc08db680526cd23f7..3415919f8993799be9acc23fdb1c16a54a6508ef 100644 (file)
@@ -1,5 +1,6 @@
 // generated file; do not modify
 #include <common/mapobjects/misc/corner.qh>
+#include <common/mapobjects/misc/dynlight.qh>
 #include <common/mapobjects/misc/follow.qh>
 #include <common/mapobjects/misc/laser.qh>
 #include <common/mapobjects/misc/teleport_dest.qh>
diff --git a/qcsrc/common/mapobjects/misc/dynlight.qc b/qcsrc/common/mapobjects/misc/dynlight.qc
new file mode 100644 (file)
index 0000000..7c70b84
--- /dev/null
@@ -0,0 +1,135 @@
+#include "dynlight.qh"
+
+#ifdef SVQC
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
+const float LOOP = 1;
+
+.float speed;
+
+//const int DNOSHADOW = 2;
+const int DFOLLOW = 4;
+.float light_lev;
+.float lefty;
+.vector color;
+.string dtagname;
+
+/*QUAKED dynlight (0 1 0) (-8 -8 -8) (8 8 8) START_OFF NOSHADOW FOLLOW
+Dynamic spawnfunc_light.
+Can do one of these things: sit still and be just a silly spawnfunc_light, travel along a path, follow an entity around, attach to a tag on an entity.
+It can spin around it's own axis in all the above cases.
+If targeted, it will toggle between on or off.
+keys:
+"light_lev" spawnfunc_light radius, default 200
+"color" spawnfunc_light color in rgb and brightness, 1 1 1 produces bright white, up to 255 255 255 (nuclear blast), recommended values up to 1 1 1, default 1 1 1
+"style" lightstyle, same as for static lights
+"angles" initial orientation
+"avelocity" a vector value, the direction and speed it rotates in
+"skin" cubemap number, must be 16 or above
+"dtagname" will attach to this tag on the entity which "targetname" matches "target". If the "target" is either not an md3 model or is missing tags, it will attach to the targets origin. Note that the "target" must be visible to the spawnfunc_light
+"targetname" will toggle on and off when triggered
+"target" if issued with a target, preferrably spawnfunc_path_corner, it will move along the path. If also issued with the FOLLOW spawnflag, then this is the entity it will follow. If issued with the "tagname" key it will attach it to this targets tag called "tagname", does not work together with FOLLOW or path movement
+"speed" the speed it will travel along the path, default 100
+flags:
+"START_OFF" spawnfunc_light will be in off state until targeted
+"NOSHADOW" will not cast shadows in realtime lighting mode
+"FOLLOW" will follow the entity which "targetname" matches "target"
+*/
+void dynlight_think(entity this)
+{
+       if(!this.owner)
+               delete(this);
+
+       this.nextthink = time + 0.1;
+}
+void dynlight_find_aiment(entity this)
+{
+       entity targ;
+       if (!this.target)
+               objerror (this, "dynlight: no target to follow");
+
+       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(entity this)
+{
+       entity targ;
+       if (!this.target)
+               objerror (this, "dynlight: no target to follow");
+
+       targ = find(NULL, targetname, this.target);
+       this.target = targ.target;
+       setorigin(this, targ.origin);
+       setthink(this, train_next); // TODO: reliant on the train's pathing functions
+       this.nextthink = time + 0.1;
+}
+void dynlight_find_target(entity this)
+{
+       entity targ;
+       if (!this.target)
+               objerror (this, "dynlight: no target to follow");
+
+       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(entity this, entity actor, entity trigger)
+{
+       if (this.light_lev == 0)
+               this.light_lev = this.lefty;
+       else
+               this.light_lev = 0;
+}
+spawnfunc(dynlight)
+{
+       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 (this.dtagname)
+       {
+               InitializeEntity(this, dynlight_find_target, INITPRIO_FINDTARGET);
+               return;
+       }
+
+// entity following
+       if (this.spawnflags & DFOLLOW)
+       {
+               InitializeEntity(this, dynlight_find_aiment, INITPRIO_FINDTARGET);
+               return;
+       }
+// path following
+       if (this.target)
+//     if (!(this.spawnflags & DFOLLOW))
+       {
+               set_movetype(this, MOVETYPE_NOCLIP);
+               if (!this.speed)
+                       this.speed = 100;
+               InitializeEntity(this, dynlight_find_path, INITPRIO_FINDTARGET);
+               return;
+       }
+}
+#endif
diff --git a/qcsrc/common/mapobjects/misc/dynlight.qh b/qcsrc/common/mapobjects/misc/dynlight.qh
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once
index cffc7f5078b3402d5cd2d071cf2530ca620213c8..ca0dec4bb3c251c33bbf565c2e48e5d7ff5c71cd 100644 (file)
@@ -6,7 +6,6 @@
 #include <server/client.qc>
 #include <server/g_damage.qc>
 #include <server/g_hook.qc>
-#include <server/g_lights.qc>
 #include <server/g_subs.qc>
 #include <server/g_world.qc>
 #include <server/handicap.qc>
index cb66bc888b4987585230b53e49dd3af4bcc23e14..c87bb2a03274f89768541e222ee8934732630648 100644 (file)
@@ -6,7 +6,6 @@
 #include <server/client.qh>
 #include <server/g_damage.qh>
 #include <server/g_hook.qh>
-#include <server/g_lights.qh>
 #include <server/g_subs.qh>
 #include <server/g_world.qh>
 #include <server/handicap.qh>
diff --git a/qcsrc/server/g_lights.qc b/qcsrc/server/g_lights.qc
deleted file mode 100644 (file)
index 852f1ef..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-#include "g_lights.qh"
-
-#include <server/defs.qh>
-#include <server/miscfunctions.qh>
-
-void train_next(entity this);
-
-const float LOOP = 1;
-
-.float speed;
-
-const float DNOSHADOW = 2;
-const float DFOLLOW = 4;
-.float light_lev;
-.float lefty;
-.vector color;
-.string dtagname;
-
-/*QUAKED dynlight (0 1 0) (-8 -8 -8) (8 8 8) START_OFF NOSHADOW FOLLOW
-Dynamic spawnfunc_light.
-Can do one of these things: sit still and be just a silly spawnfunc_light, travel along a path, follow an entity around, attach to a tag on an entity.
-It can spin around it's own axis in all the above cases.
-If targeted, it will toggle between on or off.
-keys:
-"light_lev" spawnfunc_light radius, default 200
-"color" spawnfunc_light color in rgb and brightness, 1 1 1 produces bright white, up to 255 255 255 (nuclear blast), recommended values up to 1 1 1, default 1 1 1
-"style" lightstyle, same as for static lights
-"angles" initial orientation
-"avelocity" a vector value, the direction and speed it rotates in
-"skin" cubemap number, must be 16 or above
-"dtagname" will attach to this tag on the entity which "targetname" matches "target". If the "target" is either not an md3 model or is missing tags, it will attach to the targets origin. Note that the "target" must be visible to the spawnfunc_light
-"targetname" will toggle on and off when triggered
-"target" if issued with a target, preferrably spawnfunc_path_corner, it will move along the path. If also issued with the FOLLOW spawnflag, then this is the entity it will follow. If issued with the "tagname" key it will attach it to this targets tag called "tagname", does not work together with FOLLOW or path movement
-"speed" the speed it will travel along the path, default 100
-flags:
-"START_OFF" spawnfunc_light will be in off state until targeted
-"NOSHADOW" will not cast shadows in realtime lighting mode
-"FOLLOW" will follow the entity which "targetname" matches "target"
-*/
-void dynlight_think(entity this)
-{
-       if(!this.owner)
-               delete(this);
-
-       this.nextthink = time + 0.1;
-}
-void dynlight_find_aiment(entity this)
-{
-       entity targ;
-       if (!this.target)
-               objerror (this, "dynlight: no target to follow");
-
-       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(entity this)
-{
-       entity targ;
-       if (!this.target)
-               objerror (this, "dynlight: no target to follow");
-
-       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(entity this)
-{
-       entity targ;
-       if (!this.target)
-               objerror (this, "dynlight: no target to follow");
-
-       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(entity this, entity actor, entity trigger)
-{
-       if (this.light_lev == 0)
-               this.light_lev = this.lefty;
-       else
-               this.light_lev = 0;
-}
-spawnfunc(dynlight)
-{
-       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 (this.dtagname)
-       {
-               InitializeEntity(this, dynlight_find_target, INITPRIO_FINDTARGET);
-               return;
-       }
-
-// entity following
-       if (this.spawnflags & DFOLLOW)
-       {
-               InitializeEntity(this, dynlight_find_aiment, INITPRIO_FINDTARGET);
-               return;
-       }
-// path following
-       if (this.target)
-//     if (!(this.spawnflags & DFOLLOW))
-       {
-               set_movetype(this, MOVETYPE_NOCLIP);
-               if (!this.speed)
-                       this.speed = 100;
-               InitializeEntity(this, dynlight_find_path, INITPRIO_FINDTARGET);
-               return;
-       }
-}
diff --git a/qcsrc/server/g_lights.qh b/qcsrc/server/g_lights.qh
deleted file mode 100644 (file)
index 6f70f09..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once