-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathweather.lua
46 lines (36 loc) · 1.24 KB
/
weather.lua
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
--name weather
--desc make it rain $$$$$$
--author sekc
local function getClientClassByName(name)
local c = eclipse.getAllClientClasses()
while c:exists() do
if c:name() == name then
return c
end
c = c:next()
end
return false
end
function onCreateMove(cmd)
if not (cmd.tickcount > 0) or not (cmd.tickcount % 64 == 0) then return end
local precipitation = entitylist.getEntity(2047)
local precipitationClientClass = getClientClassByName("CPrecipitation")
if not precipitation:exists() then
precipitationClientClass:create(2047, 0)
end
precipitation = entitylist.getEntity(2047)
if precipitation:exists() then
precipitation:setPropInt("DT_Precipitation", "m_nPrecipType", ui.getConfigBool("weather snow") and 1 or 0)
precipitation:preDataUpdate(0)
precipitation:onPreDataChanged(0)
precipitation:setMins(Vector(-32767, -32767, -32767))
precipitation:setMaxs(Vector(32767, 32767, 32767))
precipitation:onDataChanged(0)
precipitation:postDataUpdate(0)
end
end
function onUI()
ui.checkbox("snow?", "weather snow")
end
eclipse.registerHook("createMove", onCreateMove)
eclipse.registerHook("UI", onUI)