mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-01-18 03:21:47 +02:00
Merge pull request #653 from plague006/fix/qol
Check that entities are valid in redmew_qol
This commit is contained in:
commit
934adaa9f6
@ -37,7 +37,7 @@ local random_train_color =
|
||||
Token.register(
|
||||
function(event)
|
||||
local entity = event.created_entity
|
||||
if entity and entity.name == 'locomotive' then
|
||||
if entity and entity.valid and entity.name == 'locomotive' then
|
||||
entity.color = Utils.random_RGB()
|
||||
end
|
||||
end
|
||||
@ -56,7 +56,7 @@ local restrict_chest =
|
||||
Token.register(
|
||||
function(event)
|
||||
local entity = event.created_entity
|
||||
if entity and (entity.name == 'logistic-chest-passive-provider' or entity.type == 'container') then
|
||||
if entity and entity.valid and (entity.name == 'logistic-chest-passive-provider' or entity.type == 'container') then
|
||||
local chest_inventory = entity.get_inventory(defines.inventory.chest)
|
||||
if #chest_inventory + 1 == chest_inventory.getbar() then
|
||||
chest_inventory.setbar(2)
|
||||
@ -93,7 +93,7 @@ local change_backer_name =
|
||||
Token.register(
|
||||
function(event)
|
||||
local entity = event.created_entity
|
||||
if entity and entity.backer_name then
|
||||
if entity and entity.valid and entity.backer_name then
|
||||
entity.backer_name = pick_name() or entity.backer_name
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user