Compare commits

...

2 commits

Author SHA1 Message Date
Simon Brodtmann
e0df3f1335 Add flames and explosions to transition 2025-06-06 14:25:52 +02:00
Simon Brodtmann
d09b66deb5 Increase speed of rocket a bit 2025-06-06 14:25:17 +02:00
2 changed files with 70 additions and 8 deletions

View file

@ -79,9 +79,9 @@ local rocket = table.deepcopy(data.raw["rocket-silo-rocket"]["rocket-silo-rocket
rocket.name = "provisional-rocket"
rocket.inventory_size = 40
rocket.rising_speed = 1 / (14 * 60)
rocket.engine_starting_speed = 1 / (11 * 60)
rocket.flying_speed = 1 / (4000 * 60)
rocket.flying_acceleration = 0.005
rocket.engine_starting_speed = 1 / (8 * 60)
rocket.flying_speed = 1 / (3000 * 60)
rocket.flying_acceleration = 0.007
rocket.rocket_sprite.layers[1].filename = Lignumis.graphics .. "entity/wooden-rocket-silo/rocket-static-pod.png"
local rocket_part_recipe = {

View file

@ -84,6 +84,56 @@ local function explode_silo(silo)
silo.die()
end
local get_random_position = function(box, x_scale, y_scale)
x_scale = x_scale or 1
y_scale = y_scale or 1
local x1 = box.left_top.x
local y1 = box.left_top.y
local x2 = box.right_bottom.x
local y2 = box.right_bottom.y
local x = ((x2 - x1) * x_scale * (math.random() - 0.5)) + ((x1 + x2) / 2)
local y = ((y2 - y1) * y_scale * (math.random() - 0.5)) + ((y1 + y2) / 2)
return { x, y }
end
local function burn_silo(silo)
local surface = silo.surface
local box = silo.bounding_box
for k = 1, 6 do
local position = get_random_position(box, 0.8, 0.5)
surface.create_entity
{
name = "crash-site-fire-flame",
position = position
}
local fire = surface.create_entity
{
name = "crash-site-fire-smoke",
position = position
}
fire.time_to_live = math.random(59 * 9, 59 * 14 - 1)
fire.time_to_next_effect = math.random(59 * 2)
end
end
local function pre_explode_silo(silo)
local surface = silo.surface
local box = silo.bounding_box
for k = 1, 3 do
local explosions = surface.create_entity
{
name = "crash-site-explosion-smoke",
position = get_random_position(box, 0.8, 0.5)
}
explosions.time_to_live = math.random(59 * 6, 59 * 11 - 1)
explosions.time_to_next_effect = math.random(59 * 3)
end
end
ToNauvis.events[defines.events.on_rocket_launch_ordered] = function(event)
if not event.rocket_silo or event.rocket_silo.name ~= "provisional-rocket-silo" then return end
@ -103,18 +153,30 @@ ToNauvis.events[defines.events.on_rocket_launch_ordered] = function(event)
end
end
local transit_tick = game.tick + (26 * 59)
local explode_tick = game.tick + (31 * 59)
local burn_tick = game.tick + (14 * 59)
local pre_explode_tick = game.tick + (17 * 59)
local transit_tick = game.tick + (23 * 59)
local explode_tick = game.tick + (28 * 59)
script.on_nth_tick(explode_tick, function()
explode_silo(event.rocket_silo)
script.on_nth_tick(explode_tick, nil)
script.on_nth_tick(burn_tick, function()
burn_silo(event.rocket_silo)
script.on_nth_tick(burn_tick, nil)
end)
script.on_nth_tick(pre_explode_tick, function()
pre_explode_silo(event.rocket_silo)
script.on_nth_tick(pre_explode_tick, nil)
end)
script.on_nth_tick(transit_tick, function()
transit_player(player.index)
script.on_nth_tick(transit_tick, nil)
end)
script.on_nth_tick(explode_tick, function()
explode_silo(event.rocket_silo)
script.on_nth_tick(explode_tick, nil)
end)
end
ToNauvis.events[defines.events.on_post_entity_died] = function(event)