mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-13 13:49:33 +02:00
wagons immune to friendly fire
This commit is contained in:
parent
1bd500b085
commit
a67b50263d
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user