author | Wuzzy <almikes@aol.com> |
Wed, 16 Nov 2016 18:02:22 +0100 | |
changeset 11893 | 25a6faa5ac46 |
parent 10758 | 0f3a0f117810 |
child 11894 | dd3cbbde7876 |
permissions | -rw-r--r-- |
9836 | 1 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
9906
93c16a4b0c6a
Only emit roomNameUpdated when it actually is changed
unc0rr
parents:
9902
diff
changeset
|
2 |
HedgewarsScriptLoad("/Scripts/Params.lua") |
9836 | 3 |
|
4 |
local gravity = 100 |
|
9908 | 5 |
local mingravity |
6 |
local maxgravity |
|
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
7 |
local mingravity_normal |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
8 |
local maxgravity_normal |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
9 |
local mingravity_low |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
10 |
local maxgravity_low |
9908 | 11 |
local delta = 0 |
12 |
local period |
|
13 |
local periodtimer = 0 |
|
9836 | 14 |
local wdGameTicks = 0 |
15 |
local wdTTL = 0 |
|
9908 | 16 |
local mln = 1000000 |
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
17 |
local lowGravityUsed = false |
9836 | 18 |
|
9985
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
19 |
local script2_onNewTurn |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
20 |
local script2_onGameTick20 |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
21 |
local script2_onGameStart |
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
22 |
local script2_onHogAttack |
9985
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
23 |
|
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
24 |
|
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
25 |
function grav_onNewTurn() |
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
26 |
lowGravityUsed = false |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
27 |
if maxgravity_normal == nil then |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
28 |
gravity = mingravity_normal |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
29 |
else |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
30 |
mingravity = mingravity_normal |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
31 |
maxgravity = maxgravity_normal |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
32 |
if period > 0 then |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
33 |
delta = div(maxgravity_normal - mingravity_normal, period) |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
34 |
end |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
35 |
end |
10738
62659c427e5d
Fix setting gravity multiplied by million for a moment of time on new turn on certain circumstances
unc0rr
parents:
10509
diff
changeset
|
36 |
if delta ~= nil and period == nil then |
62659c427e5d
Fix setting gravity multiplied by million for a moment of time on new turn on certain circumstances
unc0rr
parents:
10509
diff
changeset
|
37 |
SetGravity(gravity) |
62659c427e5d
Fix setting gravity multiplied by million for a moment of time on new turn on certain circumstances
unc0rr
parents:
10509
diff
changeset
|
38 |
else |
62659c427e5d
Fix setting gravity multiplied by million for a moment of time on new turn on certain circumstances
unc0rr
parents:
10509
diff
changeset
|
39 |
SetGravity(div(gravity, mln)) |
62659c427e5d
Fix setting gravity multiplied by million for a moment of time on new turn on certain circumstances
unc0rr
parents:
10509
diff
changeset
|
40 |
end |
62659c427e5d
Fix setting gravity multiplied by million for a moment of time on new turn on certain circumstances
unc0rr
parents:
10509
diff
changeset
|
41 |
|
9836 | 42 |
wdGameTicks = GameTime |
9985
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
43 |
|
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
44 |
if script2_onNewTurn ~= nil then |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
45 |
script2_onNewTurn() |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
46 |
end |
9816 | 47 |
end |
48 |
||
9985
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
49 |
function grav_onGameTick20() |
9898
b87695f82d2e
Don't set gravity to normal immediately on turn end, let watchdog do its job if game gets frozen
unc0rr
parents:
9836
diff
changeset
|
50 |
if wdGameTicks + 15000 < GameTime then |
9816 | 51 |
SetGravity(100) |
9908 | 52 |
else |
53 |
if wdTTL ~= TurnTimeLeft then |
|
54 |
wdGameTicks = GameTime |
|
55 |
end |
|
56 |
||
57 |
if delta == nil then |
|
58 |
if periodtimer == 0 then |
|
59 |
periodtimer = period * 2 |
|
10758
0f3a0f117810
Random gravity values interval should include maxgravity
unc0rr
parents:
10738
diff
changeset
|
60 |
SetGravity(div(GetRandom(maxgravity - mingravity + 1) + mingravity, mln)) |
9908 | 61 |
else |
62 |
periodtimer = periodtimer - 1 |
|
63 |
end |
|
64 |
elseif delta == 0 then |
|
65 |
SetGravity(gravity) |
|
66 |
else |
|
67 |
if delta > 0 and gravity + delta > maxgravity then |
|
68 |
gravity = maxgravity |
|
69 |
delta = -delta |
|
10509 | 70 |
elseif delta < 0 and gravity + delta < mingravity then |
9908 | 71 |
gravity = mingravity |
72 |
delta = -delta |
|
73 |
else |
|
74 |
gravity = gravity + delta |
|
75 |
end |
|
76 |
||
77 |
SetGravity(div(gravity, mln)) |
|
78 |
end |
|
9816 | 79 |
end |
9836 | 80 |
|
81 |
wdTTL = TurnTimeLeft |
|
9985
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
82 |
|
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
83 |
if script2_onGameTick20 ~= nil then |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
84 |
script2_onGameTick20() |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
85 |
end |
9816 | 86 |
end |
9836 | 87 |
|
9985
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
88 |
function onParameters() |
9906
93c16a4b0c6a
Only emit roomNameUpdated when it actually is changed
unc0rr
parents:
9902
diff
changeset
|
89 |
parseParams() |
9908 | 90 |
|
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
91 |
gravity = tonumber(params["g"]) or 100 |
9908 | 92 |
|
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
93 |
mingravity_normal = gravity |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
94 |
if mingravity_normal > 0 then |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
95 |
mingravity_low = div(mingravity_normal, 2) |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
96 |
else |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
97 |
mingravity_low = mingravity_normal * 2 |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
98 |
end |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
99 |
mingravity = mingravity_normal |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
100 |
if type(tonumber(params["g2"])) == "number" then |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
101 |
maxgravity_normal = tonumber(params["g2"]) |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
102 |
if maxgravity_normal > 0 then |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
103 |
maxgravity_low = div(maxgravity_normal, 2) |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
104 |
else |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
105 |
maxgravity_low = maxgravity_normal * 2 |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
106 |
end |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
107 |
maxgravity = maxgravity_normal |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
108 |
end |
9908 | 109 |
period = params["period"] |
110 |
||
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
111 |
if type(mingravity) == "number" and type(maxgravity) == "number" then |
9908 | 112 |
if period ~= nil then |
113 |
period = div(period, 40) |
|
114 |
else |
|
115 |
period = 125 |
|
116 |
end |
|
117 |
||
10509 | 118 |
mingravity = mingravity * mln |
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
119 |
mingravity_normal = mingravity_normal * mln |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
120 |
mingravity_low = mingravity_low * mln |
10509 | 121 |
maxgravity = maxgravity * mln |
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
122 |
maxgravity_normal = maxgravity_normal * mln |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
123 |
maxgravity_low = maxgravity_low * mln |
10509 | 124 |
|
9908 | 125 |
if mingravity > maxgravity then |
126 |
mingravity, maxgravity = maxgravity, mingravity |
|
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
127 |
mingravity_normal, maxgravity_normal = maxgravity_normal, mingravity_normal |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
128 |
mingravity_low, maxgravity_low = maxgravity_low, mingravity_low |
9908 | 129 |
end |
130 |
||
131 |
gravity = mingravity |
|
132 |
||
133 |
if period > 0 then |
|
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
134 |
delta = div(maxgravity_normal - mingravity_normal, period) |
9908 | 135 |
else |
136 |
period = -period |
|
137 |
delta = nil |
|
138 |
end |
|
139 |
end |
|
9985
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
140 |
|
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
141 |
secondScript = params["script2"] |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
142 |
|
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
143 |
if secondScript ~= nil then |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
144 |
onParameters = nil |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
145 |
HedgewarsScriptLoad("/Scripts/Multiplayer/" .. secondScript .. ".lua") |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
146 |
|
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
147 |
script2_onNewTurn = onNewTurn |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
148 |
script2_onGameTick20 = onGameTick20 |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
149 |
script2_onGameStart = onGameStart |
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
150 |
script2_onHogAttack = onHogAttack |
9985
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
151 |
|
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
152 |
if onParameters ~= nil then |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
153 |
onParameters() |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
154 |
end |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
155 |
end |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
156 |
|
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
157 |
onNewTurn = grav_onNewTurn |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
158 |
onGameTick20 = grav_onGameTick20 |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
159 |
onGameStart = grav_onGameStart |
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
160 |
onHogAttack = grav_onHogAttack |
9836 | 161 |
end |
162 |
||
9985
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
163 |
function grav_onGameStart() |
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
164 |
DisableGameFlags(gfLowGravity) |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
165 |
|
9908 | 166 |
if delta == nil then |
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
167 |
v = string.format(loc("random in range from %i%% to %i%% with period of %i msec"), div(mingravity_normal, mln), div(maxgravity_normal, mln), period * 40) |
9908 | 168 |
elseif period ~= nil then |
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
169 |
v = string.format(loc("changing range from %i%% to %i%% with period of %i msec"), div(mingravity_normal, mln), div(maxgravity_normal, mln), period * 40) |
9908 | 170 |
else |
9910 | 171 |
v = gravity .. "%" |
9908 | 172 |
end |
173 |
||
9836 | 174 |
ShowMission(loc("Gravity"), |
9908 | 175 |
loc("Current setting is ") .. v, |
176 |
loc("Setup:|'g=150', where 150 is 150% of normal gravity") .. "|" |
|
177 |
.. loc("or 'g=50, g2=150, period=4000' for gravity changing|from 50 to 150 and back with period of 4000 msec") |
|
178 |
.. "||" .. loc("Set period to negative value for random gravity"), |
|
9836 | 179 |
0, 5000) |
9985
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
180 |
|
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
181 |
if script2_onGameStart ~= nil then |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
182 |
script2_onGameStart() |
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
183 |
end |
9902 | 184 |
end |
9985
42cd42e44c9a
GravRacer, GravHigh, GravMutant, Grav... uhm... shoppamap? Easy! Gravity script could be combined with any other script now.
unc0rr
parents:
9910
diff
changeset
|
185 |
|
11893
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
186 |
function grav_onHogAttack(ammoType) |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
187 |
if ammoType == amLowGravity then |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
188 |
lowGravityUsed = true |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
189 |
if maxgravity_normal == nil then |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
190 |
gravity = mingravity_low |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
191 |
else |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
192 |
mingravity = mingravity_low |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
193 |
maxgravity = maxgravity_low |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
194 |
if period > 0 then |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
195 |
delta = div(maxgravity_low - mingravity_low, period) |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
196 |
end |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
197 |
end |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
198 |
end |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
199 |
if script2_onHogAttack ~= nil then |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
200 |
script2_onHogAttack() |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
201 |
end |
25a6faa5ac46
Fix low gravity utility not working in Gravity script (fixes #13)
Wuzzy <almikes@aol.com>
parents:
10758
diff
changeset
|
202 |
end |