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:
parent
5a0d34fa5d
commit
1a48cbdf60
File diff suppressed because it is too large
Load Diff
52
tools/scrap.lua
Normal file
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
|
Loading…
x
Reference in New Issue
Block a user