10 /*QUAKED dynlight (0 1 0) (-8 -8 -8) (8 8 8) START_OFF NOSHADOW FOLLOW
11 Dynamic spawnfunc_light.
12 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.
13 It can spin around it's own axis in all the above cases.
14 If targeted, it will toggle between on or off.
16 "light_lev" spawnfunc_light radius, default 200
17 "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
18 "style" lightstyle, same as for static lights
19 "angles" initial orientation
20 "avelocity" a vector value, the direction and speed it rotates in
21 "skin" cubemap number, must be 16 or above
22 "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
23 "targetname" will toggle on and off when triggered
24 "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
25 "speed" the speed it will travel along the path, default 100
27 "START_OFF" spawnfunc_light will be in off state until targeted
28 "NOSHADOW" will not cast shadows in realtime lighting mode
29 "FOLLOW" will follow the entity which "targetname" matches "target"
36 self.nextthink = time + 0.1;
38 void dynlight_find_aiment()
42 objerror ("dynlight: no target to follow");
44 targ = find(world, targetname, self.target);
45 self.movetype = MOVETYPE_FOLLOW;
48 self.punchangle = targ.angles;
49 self.view_ofs = self.origin - targ.origin;
50 self.v_angle = self.angles - targ.angles;
51 self.think = dynlight_think;
52 self.nextthink = time + 0.1;
54 void dynlight_find_path()
58 objerror ("dynlight: no target to follow");
60 targ = find(world, targetname, self.target);
61 self.target = targ.target;
62 setorigin (self, targ.origin);
63 self.think = train_next;
64 self.nextthink = time + 0.1;
66 void dynlight_find_target()
70 objerror ("dynlight: no target to follow");
72 targ = find(world, targetname, self.target);
73 setattachment(self, targ, self.dtagname);
75 self.think = dynlight_think;
76 self.nextthink = time + 0.1;
80 if (self.light_lev == 0)
81 self.light_lev = self.lefty;
85 void spawnfunc_dynlight()
93 self.lefty = self.light_lev;
94 self.use = dynlight_use;
95 setsize (self, '0 0 0', '0 0 0');
96 setorigin (self, self.origin);
97 //self.pflags = PFLAGS_FULLDYNAMIC;
98 self.solid = SOLID_NOT;
99 //self.blocked = func_null;
100 //if (self.spawnflags & DNOSHADOW)
101 // self.pflags = self.pflags + PFLAGS_NOSHADOW;
102 //if (self.spawnflags & START_OFF)
103 // self.light_lev = 0;
108 InitializeEntity(self, dynlight_find_target, INITPRIO_FINDTARGET);
113 if (self.spawnflags & DFOLLOW)
115 InitializeEntity(self, dynlight_find_aiment, INITPRIO_FINDTARGET);
120 // if (!(self.spawnflags & DFOLLOW))
122 self.movetype = MOVETYPE_NOCLIP;
125 InitializeEntity(self, dynlight_find_path, INITPRIO_FINDTARGET);