8 const float DNOSHADOW = 2;
9 const float DFOLLOW = 4;
15 /*QUAKED dynlight (0 1 0) (-8 -8 -8) (8 8 8) START_OFF NOSHADOW FOLLOW
16 Dynamic spawnfunc_light.
17 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.
18 It can spin around it's own axis in all the above cases.
19 If targeted, it will toggle between on or off.
21 "light_lev" spawnfunc_light radius, default 200
22 "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
23 "style" lightstyle, same as for static lights
24 "angles" initial orientation
25 "avelocity" a vector value, the direction and speed it rotates in
26 "skin" cubemap number, must be 16 or above
27 "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
28 "targetname" will toggle on and off when triggered
29 "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
30 "speed" the speed it will travel along the path, default 100
32 "START_OFF" spawnfunc_light will be in off state until targeted
33 "NOSHADOW" will not cast shadows in realtime lighting mode
34 "FOLLOW" will follow the entity which "targetname" matches "target"
41 self.nextthink = time + 0.1;
43 void dynlight_find_aiment()
47 objerror ("dynlight: no target to follow");
49 targ = find(world, targetname, self.target);
50 self.movetype = MOVETYPE_FOLLOW;
53 self.punchangle = targ.angles;
54 self.view_ofs = self.origin - targ.origin;
55 self.v_angle = self.angles - targ.angles;
56 self.think = dynlight_think;
57 self.nextthink = time + 0.1;
59 void dynlight_find_path()
63 objerror ("dynlight: no target to follow");
65 targ = find(world, targetname, self.target);
66 self.target = targ.target;
67 setorigin (self, targ.origin);
68 self.think = train_next;
69 self.nextthink = time + 0.1;
71 void dynlight_find_target()
75 objerror ("dynlight: no target to follow");
77 targ = find(world, targetname, self.target);
78 setattachment(self, targ, self.dtagname);
80 self.think = dynlight_think;
81 self.nextthink = time + 0.1;
85 if (self.light_lev == 0)
86 self.light_lev = self.lefty;
96 self.lefty = self.light_lev;
97 self.use = dynlight_use;
98 setsize (self, '0 0 0', '0 0 0');
99 setorigin (self, self.origin);
100 //self.pflags = PFLAGS_FULLDYNAMIC;
101 self.solid = SOLID_NOT;
102 //self.blocked = func_null;
103 //if (self.spawnflags & DNOSHADOW)
104 // self.pflags = self.pflags + PFLAGS_NOSHADOW;
105 //if (self.spawnflags & START_OFF)
106 // self.light_lev = 0;
111 InitializeEntity(self, dynlight_find_target, INITPRIO_FINDTARGET);
116 if (self.spawnflags & DFOLLOW)
118 InitializeEntity(self, dynlight_find_aiment, INITPRIO_FINDTARGET);
123 // if (!(self.spawnflags & DFOLLOW))
125 self.movetype = MOVETYPE_NOCLIP;
128 InitializeEntity(self, dynlight_find_path, INITPRIO_FINDTARGET);