forked from ReikaKalseki/DragonIndustries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentities.lua
156 lines (150 loc) · 3.49 KB
/
entities.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
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
require "strings"
function getObjectTier(proto)
--return splitAfter(proto.name, "%-")
local val = 1
for num in string.gmatch(proto.name, "%d+") do
--log(num)
val = math.max(val, tonumber(num))
end
return val
end
function createTotalResistance()
local ret = {}
for name,damage in pairs(data.raw["damage-type"]) do
table.insert(ret, {type = name, percent = 100})
end
return ret
end
function addCategoryResistance(category, type_, reduce, percent)
if not data.raw[category] then error("No such category '" .. category .. "'!") end
for k,v in pairs(data.raw[category]) do
addResistance(category, k, type_, reduce, percent)
end
end
function addResistance(category, name, type_, reduce, percent)
if not reduce then reduce = 0 end
if not percent then percent = 0 end
if data.raw["damage-type"][type_] == nil then
log("Adding resistance to '" .. category .. "/" .. name .. "' with damage type '" .. type_ .. "', which does not exist!")
end
local obj = data.raw[category][name]
if obj.resistances == nil then
obj.resistances = {}
end
local resistance = createResistance(type_, reduce, percent)
for k,v in pairs(obj.resistances) do
if v.type == type_ then --if resistance to that type already present, overwrite-with-max rather than have two for same type
v.decrease = math.max(v.decrease and v.decrease or 0, reduce)
v.percent = math.max(v.percent and v.percent or 0, percent)
return
end
end
table.insert(data.raw[category][name].resistances, resistance)
end
function createResistance(type_, reduce, percent_)
return
{
type = type_,
decrease = reduce,
percent = percent_
}
end
entityCategories = {
"arrow",
"artillery-flare",
"artillery-projectile",
"beam",
"character-corpse",
"cliff",
"corpse",
"rail-remnants",
"deconstructible-tile-proxy",
"entity-ghost",
"accumulator",
"artillery-turret",
"beacon",
"boiler",
"burner-generator",
"character",
"arithmetic-combinator",
"decider-combinator",
"constant-combinator",
"container",
"logistic-container",
"infinity-container",
"assembling-machine",
"rocket-silo",
"furnace",
"electric-energy-interface",
"electric-pole",
"unit-spawner",
"fish",
"combat-robot",
"construction-robot",
"logistic-robot",
"gate",
"generator",
"heat-interface",
"heat-pipe",
"inserter",
"lab",
"lamp",
"land-mine",
"market",
"mining-drill",
"offshore-pump",
"pipe",
"infinity-pipe",
"pipe-to-ground",
"player-port",
"power-switch",
"programmable-speaker",
"pump",
"radar",
"curved-rail",
"straight-rail",
"rail-chain-signal",
"rail-signal",
"reactor",
"roboport",
"simple-entity",
"simple-entity-with-owner",
"simple-entity-with-force",
"solar-panel",
"storage-tank",
"train-stop",
"loader-1x1",
"loader",
"splitter",
"transport-belt",
"underground-belt",
"tree",
"turret",
"ammo-turret",
"electric-turret",
"fluid-turret",
"unit",
"car",
"artillery-wagon",
"cargo-wagon",
"fluid-wagon",
"locomotive",
"wall",
"explosion",
"flame-thrower-explosion",
"fire",
"stream",
"flying-text",
"highlight-box",
"item-entity",
"item-request-proxy",
"particle-source",
"projectile",
"resource",
"rocket-silo-rocket",
"rocket-silo-rocket-shadow",
"smoke-with-trigger",
"speech-bubble",
"sticker",
"tile-ghost",
}