diff --git a/maps/mountain_fortress_v2/locomotive.lua b/maps/mountain_fortress_v2/locomotive.lua index 27319410..2a6dd58b 100644 --- a/maps/mountain_fortress_v2/locomotive.lua +++ b/maps/mountain_fortress_v2/locomotive.lua @@ -37,13 +37,16 @@ function Public.locomotive_spawn(surface, position) global.locomotive.color = {0, 255, 0} global.locomotive_cargo.minable = false + global.locomotive.minable = false for y = -1, 0, 0.05 do local scale = math.random(50, 100) * 0.01 rendering.draw_sprite({sprite = "item/raw-fish", orientation = math.random(0, 100) * 0.01, x_scale = scale, y_scale = scale, tint = {math.random(75, 255), math.random(75, 255), math.random(75, 255)}, render_layer = "selection-box", target = global.locomotive_cargo, target_offset = {-0.7 + math.random(0, 140) * 0.01, y}, surface = surface}) end - Immersive_cargo_wagons.register_wagon(global.locomotive) + local wagon = Immersive_cargo_wagons.register_wagon(global.locomotive) + wagon.entity_count = 999 + local wagon = Immersive_cargo_wagons.register_wagon(global.locomotive_cargo) wagon.entity_count = 999 diff --git a/maps/mountain_fortress_v2/main.lua b/maps/mountain_fortress_v2/main.lua index a1d5cc2a..fa34490f 100644 --- a/maps/mountain_fortress_v2/main.lua +++ b/maps/mountain_fortress_v2/main.lua @@ -189,9 +189,17 @@ function Public.reset_map() set_difficulty() end +local wagon_types = { + ["cargo-wagon"] = true, + ["artillery-wagon"] = true, + ["fluid-wagon"] = true, + ["locomotive"] = true, +} + local function protect_train(event) - if event.entity.force.index ~= 1 then return end --Player Force - if event.entity == global.locomotive_cargo then + local entity = event.entity + if entity.force.index ~= 1 then return end --Player Force + if wagon_types[entity.type] then if event.cause then if event.cause.force.index == 2 then return