-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdata-updates.lua
126 lines (115 loc) · 3.96 KB
/
data-updates.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
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
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by heyqule.
--- DateTime: 8/29/2022 7:51 PM
---
require 'constant'
-- Add script to regular rockets
if settings.startup['firework-rocket-add-firework-regular-rocket'].value then
table.insert(data.raw['projectile']['explosive-rocket']['action']['action_delivery']['target_effects'], {
type='script',
effect_id=REGULAR_ROCKET_EFFECT_ID
})
table.insert(data.raw['projectile']['rocket']['action']['action_delivery']['target_effects'], {
type='script',
effect_id=REGULAR_ROCKET_EFFECT_ID
})
end
if settings.startup['firework-rocket-fire-hazard'].value then
local target_probability = settings.startup['firework-rocket-fire-hazard-chance'].value / 100
for key, explosion in pairs(data.raw['explosion']) do
if string.find(key, "firework-") then
explosion['created_effect'] = {
{
type = "direct",
probability = target_probability,
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "create-fire",
entity_name = "fire-flame",
initial_ground_flame_count = 40,
offset_deviation = {{-5,-5}, {5, 5}}
}
},
}
}
}
end
end
end
if settings.startup['firework-rocket-fire-hazard'].value then
local target_probability = settings.startup['firework-rocket-fire-hazard-chance'].value / 100
for key, explosion in pairs(data.raw['explosion']) do
if string.find(key, "firework-") then
explosion['created_effect'] = {
{
type = "direct",
probability = target_probability,
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "create-fire",
entity_name = "fire-flame",
initial_ground_flame_count = 40,
offset_deviation = {{-5,-5}, {5, 5}}
}
},
}
}
}
end
end
end
local process_death_effect = function(entity, chance)
local target_probability = chance / 100
if entity['dying_trigger_effect'] == nil then
entity['dying_trigger_effect'] = {}
end
table.insert(entity['dying_trigger_effect'],
{
type='script',
effect_id=RANDOM_ROCKET_EFFECT_ID,
probability = target_probability,
}
)
end
if settings.startup['firework-rocket-unit-death'].value then
local applicable_types = {
"unit", "character"
}
for _, type in pairs(applicable_types) do
for _, unit in pairs(data.raw[type]) do
process_death_effect(unit, settings.startup['firework-rocket-unit-death-chance'].value)
end
end
end
if settings.startup['firework-rocket-structure-death'].value then
local applicable_types = {
"unit-spawner",
"turret",
"artillery-turret",
"assembling-machine",
"radar",
"boiler",
"generator",
"furnace",
"ammo-turret",
"electric-turret",
"fluid-turret",
"rocket-silo",
"roboport",
"mining-drill",
}
for _, type in pairs(applicable_types) do
for _, unit in pairs(data.raw[type]) do
process_death_effect(unit, settings.startup['firework-rocket-structure-death-chance'].value)
end
end
end