-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandomFire.lua
More file actions
40 lines (30 loc) · 1.36 KB
/
RandomFire.lua
File metadata and controls
40 lines (30 loc) · 1.36 KB
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
function RandomFire(zonetable,Tstart,dT,Duration,minimumDurationFire,maximumDurationFire)
local zonetable = zonetable
local Tstart = Tstart or 0
local dt = dt or nil
local Duration = Duration or nil
local minimumDurationFire = minimumDurationFire or 600
local maximumDurationFire = maximumDurationFire or 3600
function SelectZone()
local varZone = math.random(1,#zonetable)
local FireZone = zonetable[varZone]
local FireZone = ZONE:New(FireZone)
StartAFire(FireZone)
end
local firecoord = nil
function StartAFire(FireZone)
local rnd = math.random(1,8) -- Smoke size 1 = small smoke and fire; 8 = huge smoke
firecoord = FireZone:GetRandomCoordinate() -- Core.Point#COORDINATE
firecoord:BigSmokeAndFire(rnd, nil, nil)
local fireDuration = math.random(minimumDurationFire,maximumDurationFire)
local endFire=TIMER:New(EndAFire,firecoord)
endFire:Start(fireDuration)
end
function EndAFire(firecoord)
firecoord:StopBigSmokeAndFire()
end
local startFire = TIMER:New(SelectZone,zonetable,minimumDurationFire,maximumDurationFire)
startFire:Start(Tstart,dT,Duration)
end
-- RandomFire({Table with zones},start first fire,delta between fire,end all fires, minimumDurationFire , maximumDurationFire)
RandomFire({"Fireplace1","Fireplace2","Fireplace3"},600,120,10000,600,3000)