Code: Select all
local function do_dump(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. do_dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end
function on_script_trigger_effect(event)
local nuke_death_zone = 300
if event.effect_id == "chart-nuke-area" then
game.print("Asking game to generate for us")
end
if event.effect_id == "nuke-landed" then
game.print("Nuke go boom")
end
log("Got trigger from " .. event.effect_id .. " " .. do_dump(event.target_position) .. " " .. do_dump(event.target_entity) .. " " .. do_dump(event.source_position) .. " " .. do_dump(event.source_entity))
end
script.on_event(defines.events.on_script_trigger_effect, on_script_trigger_effect)
Code: Select all
data.raw["artillery-flare"]["artillery-flare"].created_effect =
{
type = "direct",
action_delitery =
{
type = "instant",
target_effects =
{
{
type = "script",
effect_id = "chart-nuke-area"
}
}
}
}
data:extend(
{
{
type = "artillery-projectile",
name = "atomic-artillery-projectile",
flags = {"not-on-map"},
acceleration = 0,
direction_only = true,
reveal_map = true,
map_color = {r=1, g=1, b=0},
picture =
{
filename = "__AtomicArtillery__/graphics/entity/artillery-projectile/hr-atomic-shell.png",
width = 64,
height = 64,
scale = 0.5,
},
shadow =
{
filename = "__base__/graphics/entity/artillery-projectile/hr-shell-shadow.png",
width = 64,
height = 64,
scale = 0.5,
},
chart_picture =
{
filename = "__AtomicArtillery__/graphics/entity/artillery-projectile/atomic-artillery-shoot-map-visualization.png",
flags = { "icon" },
frame_count = 1,
width = 64,
height = 64,
priority = "high",
scale = 0.25,
},
--Damage rebalanced via https://nuclearsecrecy.com/nukemap/ to match an airbusrt 7kt warhead (roughly the energy yield from 30Kg of u235 in a little-boy style fission nuke) with all values (500m air burst)
-- Note: Radius of 1340 too large, breaks map generation.
-- 750 also too large.
action =
{
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "script",
effect_id = "nuke-landed"
},
--Damage effects
{
--Technically kills everything at once, but we can't get a nice radar update without this.
type = "nested-result",
action =
{
--Roughly the thermal pulse and moderate wind damage limit.
radius = death_zone_size,
type = "area",
action_delivery = {
type = "instant",
target_effects = {
{
type = "damage",
damage = { amount = 5000, type = "impact" },
},
},
},
},
},
{
--Fireball size
type = "destroy-cliffs",
radius = fireball_size,
explosion = "explosion"
},
--Sound effects
{
type = "play-sound",
sound = sounds.nuclear_explosion(0.9),
play_on_target_position = false,
-- min_distance = 200,
max_distance = fireball_size*15,
-- volume_modifier = 1,
audible_distance_modifier = 3
},
{
type = "play-sound",
sound = sounds.nuclear_explosion_aftershock(0.4),
play_on_target_position = false,
-- min_distance = 200,
max_distance = fireball_size*45,
-- volume_modifier = 1,
audible_distance_modifier = 3
},
--Graphical effects
{
type = "set-tile",
tile_name = "nuclear-ground",
radius = fireball_size,
apply_projection = true,
tile_collision_mask = { "water-tile" },
},
{
type = "create-entity",
entity_name = "nuke-explosion"
},
{
type = "camera-effect",
effect = "screen-burn",
duration = 60,
ease_in_duration = 5,
ease_out_duration = 60,
delay = 0,
strength = 6,
full_strength_max_distance = fireball_size*15,
max_distance = fireball_size*45
},
{
type = "create-entity",
entity_name = "huge-scorchmark",
check_buildability = true,
},
{
type = "invoke-tile-trigger",
repeat_count = 1,
},
{
type = "destroy-decoratives",
include_soft_decoratives = true, -- soft decoratives are decoratives with grows_through_rail_path = true
include_decals = true,
invoke_decorative_trigger = true,
decoratives_with_trigger_only = false, -- if true, destroys only decoratives that have trigger_effect set
radius = fireball_size -- large radius for demostrative purposes
},
-- {
-- type = "create-decorative",
-- decorative = "nuclear-ground-patch",
-- spawn_min_radius = 11.5,
-- spawn_max_radius = 12.5,
-- spawn_min = 30,
-- spawn_max = 40,
-- apply_projection = true,
-- spread_evenly = true
-- },
}
}
},
final_action =
{
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "create-entity",
entity_name = "small-scorchmark",
check_buildability = true
}
}
}
},
animation =
{
filename = "__base__/graphics/entity/bullet/bullet.png",
frame_count = 1,
width = 3,
height = 50,
priority = "high"
}
},})
- Load artillery turret with nuclear shell (or put the same 'script, nuke-landed' text in a normal artillery shell to save needing the artwork from the AtomicArtillery mod I'm hacking on)
- Fire shell at distant target
- Observe console output
- Wait for shell to impact
- Observe console output
- Load artillery turret with nuclear shell (or put the same 'script, nuke-landed' text in a normal artillery shell to save needing the artwork from the AtomicArtillery mod I'm hacking on)
- Fire shell at distant target
- "Asking game to generate for us" appears in console instantly once the arty strike is called down
- Wait for shell to impact
- "Nuke go boom" appears just as shell impacts ground
- Load artillery turret with nuclear shell (or put the same 'script, nuke-landed' text in a normal artillery shell to save needing the artwork from the AtomicArtillery mod I'm hacking on)
- Fire shell at distant target
- No result from the created_effect modifications appears to be present.
- Wait for shell to impact
- "Nuke go boom" appears just as shell impacts ground