This repository has been archived by the owner on Nov 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathdoelightning.qc
194 lines (161 loc) · 4.65 KB
/
doelightning.qc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
// lightning trail
// pmack
// sept 96
// float ltrailLastUsed; -- now an entity field.
float LT_TOGGLE = 1;
float LT_ACTIVE = 2;
void() ltrail_chain =
{
SUB_UseTargets();
self.think = SUB_Null;
};
void() ltrail_fire =
{
local entity myTarget;
if (self.classname != "ltrail_end")
{
if (!self.sounds)
sound (self, CHAN_VOICE, "weapons/lhit.wav", 1, ATTN_NORM);
myTarget = find(world, targetname, self.target);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
WriteEntity (MSG_BROADCAST, self);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
WriteCoord (MSG_BROADCAST, myTarget.origin_x);
WriteCoord (MSG_BROADCAST, myTarget.origin_y);
WriteCoord (MSG_BROADCAST, myTarget.origin_z);
LightningDamage (self.origin, myTarget.origin, self, self.currentammo);
}
if ( self.items < time)
{
self.think = ltrail_chain;
self.nextthink = time + self.frags;
}
else
{
self.think = ltrail_fire;
self.nextthink = time + 0.05;
}
};
void() ltrail_start_fire =
{
// if it's a toggle ltrail, we ignore triggers from ltrail_end's
// when toggled off.
if (self.spawnflags & LT_TOGGLE)
{
// user is not a lightning trail - change activity state.
if ( other.classname != "ltrail_end" )
{
if (self.spawnflags & LT_ACTIVE)
// currently active
{
self.spawnflags = self.spawnflags - LT_ACTIVE;
return;
}
else
// not active
{
self.spawnflags = self.spawnflags + LT_ACTIVE;
}
}
// user is lightning trail, but trail has been turned off.
// ignore the message.
else if (!(self.spawnflags & LT_ACTIVE))
return;
}
if (self.classname == "ltrail_start")
{
self.items = time + self.weapon;
ltrail_fire();
self.ltrailLastUsed = time;
}
else if (self.classname == "ltrail_relay")
{
self.items = time + self.weapon;
ltrail_fire();
}
else
{
self.think = ltrail_chain;
self.nextthink = time + self.frags;
}
};
/*QUAKED ltrail_start (0 1 0) (-8 -8 -8) (8 8 8) LT_TOGGLE START_ON X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Starting point of a lightning trail.
Set currentammo to amount of damage you want the lightning to do.
Default is 25.
Set frags to amount of time before next item is triggered.
Default is 0.3 seconds.
Set weapon to amount of time to be firing the lightning.
Default is 0.3 seconds.
Set the LT_TOGGLE checkbox if you want the lightning shooter to continuously fire until triggered again.
*/
void() ltrail_start =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
self.ltrailLastUsed = time;
precache_sound ("weapons/lhit.wav");
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_BBOX;
self.use = ltrail_start_fire;
if (self.currentammo == 0)
self.currentammo = 25;
if (self.weapon == 0)
self.weapon = 0.3;
if (self.frags == 0)
self.frags = 0.3;
if (self.spawnflags & LT_ACTIVE)
{
self.items = time + 99999999;
self.think = ltrail_fire;
self.nextthink = time + 0.1;
}
};
/*QUAKED ltrail_relay (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Relay point of a lightning trail.
Set currentammo to amount of damage you want the lightning to do.
Default is 25.
Set frags to amount of time before next item is triggered.
Default is 0.3 seconds.
Set weapon to amount of time to be firing the lightning.
Default is 0.3 seconds.
*/
void() ltrail_relay =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_sound ("weapons/lhit.wav");
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_BBOX;
self.use = ltrail_start_fire;
if (self.currentammo == 0)
self.currentammo = 25;
if (self.weapon == 0)
self.weapon = 0.3;
if (self.frags == 0)
self.frags = 0.3;
};
/*QUAKED ltrail_end (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Ending point of a lightning trail.
Does not fire any lightning.
Set frags to amount of time before next item is triggered.
Default is 0.3 seconds.
*/
void() ltrail_end =
{
if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
return;
precache_sound ("weapons/lhit.wav");
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_BBOX;
self.use = ltrail_start_fire;
if (self.currentammo == 0)
self.currentammo = 25;
if (self.weapon == 0)
self.weapon = 0.3;
if (self.frags == 0)
self.frags = 0.3;
};