1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-15 13:53:09 +02:00

Update junkyard to 1.1

This commit is contained in:
Quadrum 2021-03-26 17:47:30 +01:00
parent 5a0d34fa5d
commit 1a48cbdf60
2 changed files with 507 additions and 496 deletions

File diff suppressed because it is too large Load Diff

52
tools/scrap.lua Normal file

@ -0,0 +1,52 @@
local Public = {}
local math_random = math.random
local scrap_list = {
"crash-site-spaceship-wreck-small-1",
"crash-site-spaceship-wreck-small-2",
"crash-site-spaceship-wreck-small-3",
"crash-site-spaceship-wreck-small-4",
"crash-site-spaceship-wreck-small-5",
"crash-site-spaceship-wreck-small-6"
}
function Public.create_scrap(surface, position)
local scraps = {
"crash-site-spaceship-wreck-small-1",
"crash-site-spaceship-wreck-small-1",
"crash-site-spaceship-wreck-small-2",
"crash-site-spaceship-wreck-small-2",
"crash-site-spaceship-wreck-small-3",
"crash-site-spaceship-wreck-small-3",
"crash-site-spaceship-wreck-small-4",
"crash-site-spaceship-wreck-small-4",
"crash-site-spaceship-wreck-small-5",
"crash-site-spaceship-wreck-small-5",
"crash-site-spaceship-wreck-small-6"
}
surface.create_entity({name = scraps[math_random(1, #scraps)], position = position, force = "neutral"})
end
function Public.random_scrap_name()
return scrap_list[math_random(1, #scrap_list)]
end
function Public.get_scrap_name(index)
if index > #scrap_list then return scrap_list[1] end
if index < 1 then return scrap_list[1] end
return scrap_list[index]
end
function Public.get_scraps()
return scrap_list
end
function Public.get_scrap_true_array()
local true_array = {}
for _, e in pairs (scrap_list) do
true_array[e] = true
end
return true_array
end
return Public