mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-01-18 03:21:47 +02:00
commit
1692f094e8
@ -114,68 +114,68 @@ local function scale_floor(count)
|
||||
end
|
||||
|
||||
local on_play_particle = Token.register(function (params)
|
||||
params.surface.create_entity(params.prototype)
|
||||
params.surface.create_particle(params.prototype)
|
||||
end)
|
||||
|
||||
local function play_particle_sequence(surface, sequences)
|
||||
local create_entity = surface.create_entity
|
||||
local create_particle = surface.create_particle
|
||||
for i = 1, #sequences do
|
||||
local sequence = sequences[i]
|
||||
local frame = sequence.frame
|
||||
if frame == 1 then
|
||||
create_entity(sequence.prototype)
|
||||
create_particle(sequence.prototype)
|
||||
else
|
||||
Task.set_timeout_in_ticks(frame, on_play_particle, {surface = surface, prototype = sequence.prototype})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---@param create_entity function a reference to a surface.create_entity
|
||||
---@param create_particle function a reference to a surface.create_particle
|
||||
---@param particle_count number particle count to spawn
|
||||
---@param position Position
|
||||
function CreateParticles.destroy_rock(create_entity, particle_count, position)
|
||||
function CreateParticles.destroy_rock(create_particle, particle_count, position)
|
||||
for _ = scale_floor(particle_count), 1, -1 do
|
||||
settings.particles_spawned_buffer = settings.particles_spawned_buffer + 1
|
||||
create_entity({
|
||||
position = position,
|
||||
create_particle({
|
||||
name = 'stone-particle',
|
||||
position = position,
|
||||
movement = {random(-5, 5) * 0.01, random(-5, 5) * 0.01},
|
||||
frame_speed = 1,
|
||||
vertical_speed = random(12, 14) * 0.01,
|
||||
height = random(9, 11) * 0.1,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
---@param create_entity function a reference to a surface.create_entity
|
||||
---@param particle_count number particle count to spawn
|
||||
---@param position Position
|
||||
function CreateParticles.blood_explosion(create_entity, particle_count, position)
|
||||
for _ = particle_count, 1, -1 do
|
||||
create_entity({
|
||||
position = position,
|
||||
name = 'blood-particle',
|
||||
movement = {random(-5, 5) * 0.01, random(-5, 5) * 0.01},
|
||||
vertical_speed = random(12, 14) * 0.01,
|
||||
frame_speed = 1,
|
||||
vertical_speed = random(10, 12) * 0.01,
|
||||
height = random(5, 15) * 0.1,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
---@param create_entity function a reference to a surface.create_entity
|
||||
---@param create_particle function a reference to a surface.create_particle
|
||||
---@param particle_count number particle count to spawn
|
||||
---@param position Position
|
||||
function CreateParticles.mine_rock(create_entity, particle_count, position)
|
||||
function CreateParticles.blood_explosion(create_particle, particle_count, position)
|
||||
for _ = particle_count, 1, -1 do
|
||||
create_particle({
|
||||
name = 'blood-particle',
|
||||
position = position,
|
||||
movement = {random(-5, 5) * 0.01, random(-5, 5) * 0.01},
|
||||
height = random(5, 15) * 0.1,
|
||||
vertical_speed = random(10, 12) * 0.01,
|
||||
frame_speed = 1,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
---@param create_particle function a refrence to a surface.create_particle
|
||||
---@param particle_count number particle count to spawn
|
||||
---@param position Position
|
||||
function CreateParticles.mine_rock(create_particle, particle_count, position)
|
||||
for _ = scale_floor(particle_count), 1, -1 do
|
||||
settings.particles_spawned_buffer = settings.particles_spawned_buffer + 1
|
||||
create_entity({
|
||||
position = position,
|
||||
create_particle({
|
||||
name = 'stone-particle',
|
||||
position = position,
|
||||
movement = {random(-5, 5) * 0.01, random(-5, 5) * 0.01},
|
||||
frame_speed = 1,
|
||||
vertical_speed = random(8, 10) * 0.01,
|
||||
height = random(5, 8) * 0.1,
|
||||
vertical_speed = random(8, 10) * 0.01,
|
||||
frame_speed = 1,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user