forked from Choumiko/FARL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.lua
More file actions
25 lines (24 loc) · 748 Bytes
/
lib.lua
File metadata and controls
25 lines (24 loc) · 748 Bytes
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
local function copyPrototype(type, name, newName, change_results)
if not data.raw[type][name] then error("type "..type.." "..name.." doesn't exist") end
local p = table.deepcopy(data.raw[type][name])
p.name = newName
if p.minable and p.minable.result then
p.minable.result = newName
end
if change_results then
if p.place_result then
p.place_result = newName
end
if p.result then
p.result = newName
end
if p.take_result then
p.take_result = newName
end
if p.placed_as_equipment_result then
p.placed_as_equipment_result = newName
end
end
return p
end
return copyPrototype