v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
22
assets/devel/objects/greycapsule/greycapsule.lua
Normal file
22
assets/devel/objects/greycapsule/greycapsule.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
require "/scripts/util.lua"
|
||||
|
||||
function die(smash)
|
||||
local pos = entity.position()
|
||||
local spreadRange = config.getParameter("spreadRange", 2)
|
||||
local candidateSpaces = {}
|
||||
for x = pos[1] - spreadRange, pos[1] + spreadRange do
|
||||
for y = pos[2] - spreadRange, pos[2] + spreadRange do
|
||||
table.insert(candidateSpaces, {x, y})
|
||||
end
|
||||
end
|
||||
|
||||
shuffle(candidateSpaces)
|
||||
|
||||
local toPlace = config.getParameter("spreadFactor", 2)
|
||||
while #candidateSpaces > 0 and toPlace > 0 do
|
||||
if world.placeObject("greycapsule", candidateSpaces[1], 1, {}) then
|
||||
toPlace = toPlace - 1
|
||||
end
|
||||
table.remove(candidateSpaces, 1)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue