|
1 local item_categories = |
|
2 { |
|
3 "item", |
|
4 "item-with-entity-data", |
|
5 "rail-planner", |
|
6 "capsule", |
|
7 "repair-tool", |
|
8 "blueprint", |
|
9 "deconstruction-item", |
|
10 "upgrade-item", |
|
11 "blueprint-book", |
|
12 "copy-paste-tool", |
|
13 "module", |
|
14 "tool", |
|
15 "gun", |
|
16 "ammo", |
|
17 "space-platform-starter-pack", |
|
18 "armor", |
|
19 "spidertron-remote", |
|
20 } |
|
21 |
|
22 local entity_categories = |
|
23 { |
|
24 "container", |
|
25 "storage-tank", |
|
26 "transport-belt", |
|
27 "underground-belt", |
|
28 "splitter", |
|
29 "loader", |
|
30 "inserter", |
|
31 "electric-pole", |
|
32 "pipe", |
|
33 "pipe-to-ground", |
|
34 "pump", |
|
35 "straight-rail", |
|
36 "half-diagonal-rail", |
|
37 "curved-rail-a", |
|
38 "curved-rail-b", |
|
39 "elevated-straight-rail", |
|
40 "elevated-half-diagonal-rail", |
|
41 "elevated-curved-rail-a", |
|
42 "elevated-curved-rail-b", |
|
43 "legacy-straight-rail", |
|
44 "legacy-curved-rail", |
|
45 "rail-ramp", |
|
46 "rail-support", |
|
47 "train-stop", |
|
48 "rail-signal", |
|
49 "rail-chain-signal", |
|
50 "locomotive", |
|
51 "cargo-wagon", |
|
52 "fluid-wagon", |
|
53 "artillery-wagon", |
|
54 "car", |
|
55 "spider-vehicle", |
|
56 "logistic-robot", |
|
57 "construction-robot", |
|
58 "logistic-container", |
|
59 "roboport", |
|
60 "lamp", |
|
61 "arithmetic-combinator", |
|
62 "decider-combinator", |
|
63 "selector-combinator", |
|
64 "constant-combinator", |
|
65 "power-switch", |
|
66 "programmable-speaker", |
|
67 "display-panel", |
|
68 "boiler", |
|
69 "generator", |
|
70 "fusion-reactor", |
|
71 "fusion-generator", |
|
72 "mining-drill", |
|
73 "offshore-pump", |
|
74 "furnace", |
|
75 "assembling-machine", |
|
76 "agricultural-tower", |
|
77 "lab", |
|
78 "lightning-attractor", |
|
79 "reactor", |
|
80 "beacon", |
|
81 "rocket-silo", |
|
82 "cargo-landing-pad", |
|
83 "space-platform-hub", |
|
84 "cargo-bay", |
|
85 "asteroid-collector", |
|
86 "thruster", |
|
87 "wall", |
|
88 "gate", |
|
89 "radar", |
|
90 "land-mine", |
|
91 "ammo-turret", |
|
92 "electric-turret", |
|
93 "fluid-turret", |
|
94 "artillery-turret", |
|
95 "plant", |
|
96 "simple-entity-with-force", |
|
97 "simple-entity-with-owner", |
|
98 "electric-energy-interface", |
|
99 "linked-container", |
|
100 "proxy-container", |
|
101 "heat-interface", |
|
102 "lane-splitter", |
|
103 "linked-belt", |
|
104 "valve", |
|
105 "infinity-cargo-wagon", |
|
106 "infinity-container", |
|
107 "infinity-pipe", |
|
108 "burner-generator", |
|
109 "resource", |
|
110 "cargo-pod", |
|
111 "temporary-container", |
|
112 "asteroid", |
|
113 "combat-robot", |
|
114 "unit", |
|
115 "turret", |
|
116 "unit-spawner", |
|
117 "spider-unit", |
|
118 "segmented-unit", |
|
119 "cliff", |
|
120 "character", |
|
121 "fish", |
|
122 "tree", |
|
123 "simple-entity", |
|
124 "lightning", |
|
125 "corpse", |
|
126 "rail-remnants", |
|
127 "explosion", |
|
128 "particle-source", |
|
129 "fire", |
|
130 "sticker", |
|
131 "stream", |
|
132 "artillery-flare", |
|
133 "artillery-projectile", |
|
134 "projectile", |
|
135 "segment", |
|
136 "spider-leg", |
|
137 "beam", |
|
138 "character-corpse", |
|
139 "speech-bubble", |
|
140 "smoke-with-trigger", |
|
141 "entity-ghost", |
|
142 "arrow", |
|
143 "highlight-box", |
|
144 "item-entity", |
|
145 "item-request-proxy", |
|
146 "loader-1x1", |
|
147 "rocket-silo-rocket", |
|
148 "rocket-silo-rocket-shadow", |
|
149 "tile-ghost", |
|
150 "market", |
|
151 "capture-robot", |
|
152 "solar-panel", |
|
153 } |
|
154 |
|
155 local function find_entity(name) |
|
156 for _, entity_category in pairs(entity_categories) |
|
157 do |
|
158 if data.raw[entity_category] and data.raw[entity_category][name] |
|
159 then |
|
160 return data.raw[entity_category][name] |
|
161 end |
|
162 end |
|
163 return nil |
|
164 end |
|
165 |
|
166 for _, item_type in pairs(item_categories) |
|
167 do |
|
168 for _, item in pairs(data.raw[item_type] or {}) |
|
169 do |
|
170 local new_descriptions = {} |
|
171 local refining_recipe = data.raw.recipe[item.name.."-refining"] |
|
172 local recycling_recipe = data.raw.recipe[item.name.."-recycling"] |
|
173 |
|
174 if recycling_recipe ~= nil |
|
175 then |
|
176 local recycling_results = {""} |
|
177 for _, result in pairs(recycling_recipe.results) |
|
178 do |
|
179 table.insert(recycling_results, "[img="..result.type.."."..result.name.."]") |
|
180 end |
|
181 table.insert(new_descriptions, { |
|
182 "more-descriptions-mod.recycling", |
|
183 tostring(recycling_recipe.energy_required), |
|
184 recycling_results |
|
185 }) |
|
186 end |
|
187 |
|
188 if mods["promethium-quality"] |
|
189 then |
|
190 if refining_recipe ~= nil |
|
191 then |
|
192 table.insert(new_descriptions, { |
|
193 "more-descriptions-mod.refining-cost", |
|
194 tostring(refining_recipe.energy_required), |
|
195 }) |
|
196 elseif recycling_recipe ~= nil |
|
197 then |
|
198 table.insert(new_descriptions, { |
|
199 "more-descriptions-mod.cannot-be-refined", |
|
200 }) |
|
201 end |
|
202 end |
|
203 |
|
204 local entity = item.place_result and find_entity(item.place_result) or nil |
|
205 if entity ~= nil |
|
206 then |
|
207 if entity.collision_box |
|
208 then |
|
209 local cb = entity.collision_box |
|
210 local width = math.ceil(cb[2][1] - cb[1][1]) |
|
211 local height = math.ceil(cb[2][2] - cb[1][2]) |
|
212 table.insert(new_descriptions, { |
|
213 "more-descriptions-mod.size", |
|
214 tostring(width), |
|
215 tostring(height), |
|
216 }) |
|
217 end |
|
218 end |
|
219 |
|
220 if #new_descriptions > 0 |
|
221 then |
|
222 local main_description = item.localised_description |
|
223 and {"", item.localised_description, "\n"} |
|
224 or { |
|
225 "?", |
|
226 {"", {"entity-description."..item.name}, "\n"}, |
|
227 {"", {"item-description."..item.name}, "\n"}, |
|
228 "" |
|
229 } |
|
230 item.localised_description = { |
|
231 "", |
|
232 main_description, |
|
233 } |
|
234 for i, k in pairs(new_descriptions) |
|
235 do |
|
236 if i ~= 1 |
|
237 then |
|
238 table.insert(item.localised_description, "\n") |
|
239 end |
|
240 table.insert(item.localised_description, k) |
|
241 end |
|
242 end |
|
243 end |
|
244 end |
|
245 |
|
246 for _, recipe in pairs(data.raw.recipe) |
|
247 do |
|
248 local new_descriptions = {} |
|
249 |
|
250 if recipe.allow_productivity |
|
251 then |
|
252 table.insert(new_descriptions, {"more-descriptions-mod.allows-productivity"}) |
|
253 end |
|
254 |
|
255 if #new_descriptions > 0 |
|
256 then |
|
257 local main_description = recipe.localised_description |
|
258 and {"", recipe.localised_description, "\n"} |
|
259 or { |
|
260 "?", |
|
261 {"", {"recipe-description."..recipe.name}, "\n"}, |
|
262 "" |
|
263 } |
|
264 recipe.localised_description = { |
|
265 "", |
|
266 main_description, |
|
267 } |
|
268 for i, k in pairs(new_descriptions) |
|
269 do |
|
270 if i ~= 1 |
|
271 then |
|
272 table.insert(recipe.localised_description, "\n") |
|
273 end |
|
274 table.insert(recipe.localised_description, k) |
|
275 end |
|
276 end |
|
277 end |