diff --git a/maps/biter_battles/biter_battles.lua b/maps/biter_battles/biter_battles.lua index 911ca972..2dcba257 100644 --- a/maps/biter_battles/biter_battles.lua +++ b/maps/biter_battles/biter_battles.lua @@ -1604,10 +1604,10 @@ end --anti construction robot cheese local function on_robot_built_entity(event) if event.robot.force.name == 'north' then - if event.created_entity.position.y >= -1 * storage.horizontal_border_width / 2 then - local x = event.created_entity.position.x - local y = event.created_entity.position.y - event.created_entity.die('south') + if event.entity.position.y >= -1 * storage.horizontal_border_width / 2 then + local x = event.entity.position.x + local y = event.entity.position.y + event.entity.die('south') search_for_ghost = game.surfaces['surface'].find_entities({ { x, y }, { x + 1, y + 1 } }) for _, e in pairs(search_for_ghost) do if e.type == 'entity-ghost' then @@ -1619,10 +1619,10 @@ local function on_robot_built_entity(event) end end if event.robot.force.name == 'south' then - if event.created_entity.position.y <= storage.horizontal_border_width / 2 then - local x = event.created_entity.position.x - local y = event.created_entity.position.y - event.created_entity.die('north') + if event.entity.position.y <= storage.horizontal_border_width / 2 then + local x = event.entity.position.x + local y = event.entity.position.y + event.entity.die('north') search_for_ghost = game.surfaces['surface'].find_entities({ { x, y }, { x + 1, y + 1 } }) for _, e in pairs(search_for_ghost) do if e.type == 'entity-ghost' then diff --git a/maps/biter_battles_v2/functions.lua b/maps/biter_battles_v2/functions.lua index a6523a4c..4f83c993 100644 --- a/maps/biter_battles_v2/functions.lua +++ b/maps/biter_battles_v2/functions.lua @@ -207,14 +207,14 @@ function Public.init_player(player) end function Public.no_turret_creep(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end - if not no_turret_blacklist[event.created_entity.type] then + if not no_turret_blacklist[event.entity.type] then return end - local surface = event.created_entity.surface + local surface = event.entity.surface local spawners = surface.find_entities_filtered({ type = 'unit-spawner', area = { { entity.position.x - 70, entity.position.y - 70 }, { entity.position.x + 70, entity.position.y + 70 } } }) if #spawners == 0 then diff --git a/maps/biter_battles_v2/main.lua b/maps/biter_battles_v2/main.lua index 5609c9f6..270a1132 100644 --- a/maps/biter_battles_v2/main.lua +++ b/maps/biter_battles_v2/main.lua @@ -49,13 +49,13 @@ end local function on_built_entity(event) Functions.no_turret_creep(event) - Functions.add_target_entity(event.created_entity) + Functions.add_target_entity(event.entity) end local function on_robot_built_entity(event) Functions.no_turret_creep(event) Terrain.deny_construction_bots(event) - Functions.add_target_entity(event.created_entity) + Functions.add_target_entity(event.entity) end local function on_entity_died(event) diff --git a/maps/biter_battles_v2/terrain.lua b/maps/biter_battles_v2/terrain.lua index 7b10d1eb..25881d8a 100644 --- a/maps/biter_battles_v2/terrain.lua +++ b/maps/biter_battles_v2/terrain.lua @@ -793,14 +793,14 @@ function Public.deny_construction_bots(event) if not robot_build_restriction[event.robot.force.name] then return end - if not robot_build_restriction[event.robot.force.name](event.created_entity.position.y) then + if not robot_build_restriction[event.robot.force.name](event.entity.position.y) then return end local inventory = event.robot.get_inventory(defines.inventory.robot_cargo) - inventory.insert({ name = event.created_entity.name, count = 1 }) - event.robot.surface.create_entity({ name = 'explosion', position = event.created_entity.position }) + inventory.insert({ name = event.entity.name, count = 1 }) + event.robot.surface.create_entity({ name = 'explosion', position = event.entity.position }) game.print('Team ' .. event.robot.force.name .. "'s construction drone had an accident.", { r = 200, g = 50, b = 100 }) - event.created_entity.destroy() + event.entity.destroy() end return Public diff --git a/maps/biter_hatchery/main.lua b/maps/biter_hatchery/main.lua index f62d5b57..209a4871 100644 --- a/maps/biter_hatchery/main.lua +++ b/maps/biter_hatchery/main.lua @@ -357,14 +357,14 @@ local function on_robot_built_entity(event) if not robot_build_restriction[event.robot.force.name] then return end - if not robot_build_restriction[event.robot.force.name](event.created_entity.position.x) then + if not robot_build_restriction[event.robot.force.name](event.entity.position.x) then return end local inventory = event.robot.get_inventory(defines.inventory.robot_cargo) - inventory.insert({ name = event.created_entity.name, count = 1 }) - event.robot.surface.create_entity({ name = 'explosion', position = event.created_entity.position }) + inventory.insert({ name = event.entity.name, count = 1 }) + event.robot.surface.create_entity({ name = 'explosion', position = event.entity.position }) game.print('Team ' .. event.robot.force.name .. "'s construction drone had an accident.", { r = 200, g = 50, b = 100 }) - event.created_entity.destroy() + event.entity.destroy() end local function on_entity_damaged(event) diff --git a/maps/cave_choppy/infinity_chest.lua b/maps/cave_choppy/infinity_chest.lua index 7db62d97..7d93d684 100644 --- a/maps/cave_choppy/infinity_chest.lua +++ b/maps/cave_choppy/infinity_chest.lua @@ -29,7 +29,7 @@ function Public.create_chest(surface, position, storage) end local function built_entity(event) - local entity = event.created_entity + local entity = event.entity if not entity or not entity.valid or entity.name ~= 'infinity-chest' then return end diff --git a/maps/cave_choppy/player_elevator.lua b/maps/cave_choppy/player_elevator.lua index f4cea89e..cb38fe97 100644 --- a/maps/cave_choppy/player_elevator.lua +++ b/maps/cave_choppy/player_elevator.lua @@ -87,7 +87,7 @@ local function check_player_ports() end local function built_entity(event) - local entity = event.created_entity + local entity = event.entity if not entity or not entity.valid then return end diff --git a/maps/chronosphere/on_event.lua b/maps/chronosphere/on_event.lua index 915b672e..f7c3e322 100644 --- a/maps/chronosphere/on_event.lua +++ b/maps/chronosphere/on_event.lua @@ -291,7 +291,7 @@ function Public.on_entity_damaged(event) end function Public.on_built_entity(event) - local entity = event.created_entity + local entity = event.entity if not entity or not entity.valid then return end diff --git a/maps/crab_defender/main.lua b/maps/crab_defender/main.lua index a76ea691..eb6e2d9e 100644 --- a/maps/crab_defender/main.lua +++ b/maps/crab_defender/main.lua @@ -1095,7 +1095,7 @@ local deny_buildings_tbl = { } local function deny_building(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -1110,7 +1110,7 @@ local function deny_building(event) inventory.insert({ name = entity.name, count = 1 }) end end - event.created_entity.surface.create_entity( + event.entity.surface.create_entity( { name = 'flying-text', position = entity.position, @@ -1129,7 +1129,7 @@ end local on_built_entity = function (event) local get_score = Score.get_table().score_table local this = FDT.get() - local entity = event.created_entity + local entity = event.entity if not entity or not entity.valid then return @@ -1188,7 +1188,7 @@ local on_built_entity = function (event) end local on_robot_built_entity = function (event) - local entity = event.created_entity + local entity = event.entity local surface = entity.surface if not surface or not surface.valid then diff --git a/maps/desert_oasis.lua b/maps/desert_oasis.lua index ee97b590..d9b7c270 100644 --- a/maps/desert_oasis.lua +++ b/maps/desert_oasis.lua @@ -234,12 +234,12 @@ local type_whitelist = { } local function deny_building(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end - if type_whitelist[event.created_entity.type] then + if type_whitelist[event.entity.type] then return end @@ -254,7 +254,7 @@ local function deny_building(event) inventory.insert({ name = entity.name, count = 1 }) end - event.created_entity.surface.create_entity( + event.entity.surface.create_entity( { name = 'flying-text', position = entity.position, diff --git a/maps/dungeons/tiered_dungeon.lua b/maps/dungeons/tiered_dungeon.lua index bdb68604..25fb9dbc 100644 --- a/maps/dungeons/tiered_dungeon.lua +++ b/maps/dungeons/tiered_dungeon.lua @@ -612,7 +612,7 @@ end local function on_built_entity(event) local dungeontable = DungeonsTable.get_dungeontable() - local entity = event.created_entity + local entity = event.entity if not entity or not entity.valid then return end diff --git a/maps/fish_defender/main.lua b/maps/fish_defender/main.lua index 06d8a144..0ad9d4fa 100644 --- a/maps/fish_defender/main.lua +++ b/maps/fish_defender/main.lua @@ -1034,7 +1034,7 @@ end local function on_built_entity(event) local get_score = Score.get_table().score_table local this = FDT.get() - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -1076,7 +1076,7 @@ local function on_built_entity(event) end local function on_robot_built_entity(event) - local entity = event.created_entity + local entity = event.entity local entity_limits = FDT.get('entity_limits') if entity_limits[entity.name] then local surface = entity.surface diff --git a/maps/fish_defender_v1/fish_defender.lua b/maps/fish_defender_v1/fish_defender.lua index 6f52c27d..c2f3e4af 100644 --- a/maps/fish_defender_v1/fish_defender.lua +++ b/maps/fish_defender_v1/fish_defender.lua @@ -1563,7 +1563,7 @@ end local function on_built_entity(event) local get_score = Score.get_table().score_table - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -1605,7 +1605,7 @@ local function on_built_entity(event) end local function on_robot_built_entity(event) - local entity = event.created_entity + local entity = event.entity if storage.entity_limits[entity.name] then local surface = entity.surface if storage.entity_limits[entity.name].placed < storage.entity_limits[entity.name].limit then diff --git a/maps/fish_defender_v2/main.lua b/maps/fish_defender_v2/main.lua index a458b6f6..47ad2bab 100644 --- a/maps/fish_defender_v2/main.lua +++ b/maps/fish_defender_v2/main.lua @@ -1094,7 +1094,7 @@ local function on_player_joined_game(event) end local function deny_building(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -1111,7 +1111,7 @@ local function deny_building(event) end end - event.created_entity.surface.create_entity( + event.entity.surface.create_entity( { name = 'flying-text', position = entity.position, @@ -1132,7 +1132,7 @@ local function on_built_entity(event) return end - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -1175,7 +1175,7 @@ local function on_built_entity(event) end local function on_robot_built_entity(event) - local entity = event.created_entity + local entity = event.entity if deny_building(event) then return end diff --git a/maps/journey/functions.lua b/maps/journey/functions.lua index cc0fa633..da039327 100644 --- a/maps/journey/functions.lua +++ b/maps/journey/functions.lua @@ -282,7 +282,7 @@ function Public.mothership_message_queue(journey) end function Public.deny_building(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -297,7 +297,7 @@ function Public.deny_building(event) end function Public.register_built_silo(event, journey) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end diff --git a/maps/journey/unique_modifiers.lua b/maps/journey/unique_modifiers.lua index 9553fdd3..9098b709 100644 --- a/maps/journey/unique_modifiers.lua +++ b/maps/journey/unique_modifiers.lua @@ -126,7 +126,7 @@ Public.matter_anomaly = { end end, on_robot_built_entity = function (event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -138,7 +138,7 @@ Public.matter_anomaly = { end end, on_built_entity = function (event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -227,7 +227,7 @@ Public.replicant_fauna = { Public.tarball = { on_robot_built_entity = function (event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -240,7 +240,7 @@ Public.tarball = { entity.minable = false end, on_built_entity = function (event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -368,7 +368,7 @@ Public.oceanic = { surface.clear(true) end, on_robot_built_entity = function (event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -380,7 +380,7 @@ Public.oceanic = { end end, on_built_entity = function (event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -564,7 +564,7 @@ Public.low_mass = { Public.dense_atmosphere = { on_robot_built_entity = function (event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -576,7 +576,7 @@ Public.dense_atmosphere = { end end, on_built_entity = function (event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -600,7 +600,7 @@ end Public.lazy_bastard = { on_robot_built_entity = function (event, journey) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -612,7 +612,7 @@ Public.lazy_bastard = { end end, on_built_entity = function (event, journey) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end diff --git a/maps/labyrinth.lua b/maps/labyrinth.lua index 84c9d905..37510a09 100644 --- a/maps/labyrinth.lua +++ b/maps/labyrinth.lua @@ -1235,16 +1235,16 @@ local loaders = { ['express-loader'] = true } local function on_built_entity(event) - if not event.created_entity or not event.created_entity.valid then + if not event.entity or not event.entity.valid then return end local get_score = Score.get_table().score_table - local name = event.created_entity.name + local name = event.entity.name if inserters[name] then - local surface = event.created_entity.surface + local surface = event.entity.surface local a = { - left_top = { x = event.created_entity.position.x - 2, y = event.created_entity.position.y - 2 }, - right_bottom = { x = event.created_entity.position.x + 2, y = event.created_entity.position.y + 2 } + left_top = { x = event.entity.position.x - 2, y = event.entity.position.y - 2 }, + right_bottom = { x = event.entity.position.x + 2, y = event.entity.position.y + 2 } } local chest = surface.find_entities_filtered { area = a, name = 'infinity-chest', limit = 1 } if not chest[1] then @@ -1273,14 +1273,14 @@ local function on_built_entity(event) end if loaders[name] then - local surface = event.created_entity.surface + local surface = event.entity.surface local a = { - left_top = { x = event.created_entity.position.x - 2, y = event.created_entity.position.y - 2 }, - right_bottom = { x = event.created_entity.position.x + 2, y = event.created_entity.position.y + 2 } + left_top = { x = event.entity.position.x - 2, y = event.entity.position.y - 2 }, + right_bottom = { x = event.entity.position.x + 2, y = event.entity.position.y + 2 } } local found = surface.find_entities_filtered { area = a, name = 'infinity-chest' } if found[1] then - event.created_entity.die('enemy') + event.entity.die('enemy') if event.player_index then local player = game.players[event.player_index] player.print('The mysterious chest noticed your greed and devoured your device.', { r = 0.75, g = 0.0, b = 0.0 }) @@ -1290,11 +1290,11 @@ local function on_built_entity(event) end if name == 'flamethrower-turret' or name == 'laser-turret' then - if event.created_entity.position.y < 0 then + if event.entity.position.y < 0 then if event.player_index then local player = game.players[event.player_index] player.insert({ name = name, count = 1 }) - event.created_entity.destroy() + event.entity.destroy() if get_score then if get_score[player.force.name] then if get_score[player.force.name].players[player.name] then @@ -1307,7 +1307,7 @@ local function on_built_entity(event) if event.robot then local inventory = event.robot.get_inventory(defines.inventory.robot_cargo) inventory.insert({ name = name, count = 1 }) - event.created_entity.destroy() + event.entity.destroy() end end end @@ -1315,14 +1315,14 @@ local function on_built_entity(event) end if name == 'gun-turret' then - local surface = event.created_entity.surface + local surface = event.entity.surface local amount_of_enemy_structures = surface.count_entities_filtered( { name = { 'spitter-spawner', 'biter-spawner' }, area = { - { event.created_entity.position.x - 18, event.created_entity.position.y - 18 }, - { event.created_entity.position.x + 18, event.created_entity.position.y + 18 } + { event.entity.position.x - 18, event.entity.position.y - 18 }, + { event.entity.position.x + 18, event.entity.position.y + 18 } }, force = 'enemy', limit = 1 @@ -1332,7 +1332,7 @@ local function on_built_entity(event) if event.player_index and amount_of_enemy_structures > 0 then local player = game.players[event.player_index] player.insert({ name = name, count = 1 }) - event.created_entity.destroy() + event.entity.destroy() player.print('Their nests aura seems to deny the placement of any close turrets.', { r = 0.75, g = 0.0, b = 0.0 }) if get_score then if get_score[player.force.name] then @@ -1346,7 +1346,7 @@ local function on_built_entity(event) if event.robot and amount_of_enemy_structures > 0 then local inventory = event.robot.get_inventory(defines.inventory.robot_cargo) inventory.insert({ name = name, count = 1 }) - event.created_entity.destroy() + event.entity.destroy() end end end diff --git a/maps/minesweeper/main.lua b/maps/minesweeper/main.lua index c82d76d3..79fffe7e 100644 --- a/maps/minesweeper/main.lua +++ b/maps/minesweeper/main.lua @@ -489,7 +489,7 @@ local function on_player_changed_position(event) end local function deny_building(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end diff --git a/maps/mountain_fortress_v3/entities.lua b/maps/mountain_fortress_v3/entities.lua index 5cafab51..23dd993e 100644 --- a/maps/mountain_fortress_v3/entities.lua +++ b/maps/mountain_fortress_v3/entities.lua @@ -1476,7 +1476,7 @@ local function on_entity_spawned(event) end local function on_built_entity(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -1576,7 +1576,7 @@ local function on_built_entity(event) end local function on_robot_built_entity(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end diff --git a/maps/mountain_fortress_v3/ic/functions.lua b/maps/mountain_fortress_v3/ic/functions.lua index 51be47aa..cdd1c51f 100644 --- a/maps/mountain_fortress_v3/ic/functions.lua +++ b/maps/mountain_fortress_v3/ic/functions.lua @@ -1237,7 +1237,7 @@ function Public.create_car_room(car) end function Public.create_car(event) - local ce = event.created_entity + local ce = event.entity local player = game.get_player(event.player_index) diff --git a/maps/mountain_fortress_v3/ic/main.lua b/maps/mountain_fortress_v3/ic/main.lua index 258dca91..eee0247c 100644 --- a/maps/mountain_fortress_v3/ic/main.lua +++ b/maps/mountain_fortress_v3/ic/main.lua @@ -52,7 +52,7 @@ local function on_robot_mined_entity(event) end local function on_built_entity(event) - local ce = event.created_entity + local ce = event.entity if not ce or not ce.valid then return diff --git a/maps/mountain_fortress_v3/icw/linked_chests.lua b/maps/mountain_fortress_v3/icw/linked_chests.lua index 8fd6257d..5b72ece4 100644 --- a/maps/mountain_fortress_v3/icw/linked_chests.lua +++ b/maps/mountain_fortress_v3/icw/linked_chests.lua @@ -622,7 +622,7 @@ local function on_built_entity(event, mode, bypass) if this.disable_normal_placement and not mode then return end - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -702,7 +702,7 @@ local function built_entity_robot(event) if this.disable_normal_placement then return end - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -781,7 +781,7 @@ local function built_entity_robot(event) create_chest(entity) return else - local created = event.created_entity + local created = event.entity if created and created.valid then local inventory = robot.get_inventory(defines.inventory.robot_cargo) inventory.insert({ name = created.name, count = 1 }) @@ -793,7 +793,7 @@ local function built_entity_robot(event) end if disable_link_chest_cheese_mode then - local created = event.created_entity + local created = event.entity if created and created.valid then local inventory = robot.get_inventory(defines.inventory.robot_cargo) inventory.insert({ name = created.name, count = 1 }) @@ -1227,7 +1227,7 @@ Gui.on_click( player.remove_item({ name = 'coin', count = this.cost_to_convert }) player.opened = nil - event.created_entity = entity + event.entity = entity event.entity = entity event.player_index = player.index AG.append_scenario_history(player, entity, player.name .. ' converted chest (' .. entity.unit_number .. ')') diff --git a/maps/mountain_fortress_v3/icw/main.lua b/maps/mountain_fortress_v3/icw/main.lua index 8c448572..829a0c4b 100644 --- a/maps/mountain_fortress_v3/icw/main.lua +++ b/maps/mountain_fortress_v3/icw/main.lua @@ -173,7 +173,7 @@ Event.add( defines.events.on_built_entity, function (event) local icw = ICW.get() - return Functions.create_wagon(icw, event.created_entity) + return Functions.create_wagon(icw, event.entity) end ) diff --git a/maps/native_war/main.lua b/maps/native_war/main.lua index e199a17b..5027a18c 100644 --- a/maps/native_war/main.lua +++ b/maps/native_war/main.lua @@ -349,9 +349,9 @@ end local function on_built_entity(event) local player = game.players[event.player_index] - if event.created_entity.name == 'radar' then - local unit_number = event.created_entity.unit_number - local entity = event.created_entity + if event.entity.name == 'radar' then + local unit_number = event.entity.unit_number + local entity = event.entity storage.map_forces[player.force.name].radar[unit_number] = entity end end @@ -525,19 +525,19 @@ local function on_robot_built_entity(event) if not robot_build_restriction[event.robot.force.name] then return end - if not robot_build_restriction[event.robot.force.name](event.created_entity.position.x, event.created_entity.position.y) then - if event.created_entity.name == 'radar' then - local unit_number = event.created_entity.unit_number - local entity = event.created_entity + if not robot_build_restriction[event.robot.force.name](event.entity.position.x, event.entity.position.y) then + if event.entity.name == 'radar' then + local unit_number = event.entity.unit_number + local entity = event.entity storage.map_forces[event.robot.force.name].radar[unit_number] = entity end return end local inventory = event.robot.get_inventory(defines.inventory.robot_cargo) - inventory.insert({ name = event.created_entity.name, count = 1 }) - event.robot.surface.create_entity({ name = 'explosion', position = event.created_entity.position }) + inventory.insert({ name = event.entity.name, count = 1 }) + event.robot.surface.create_entity({ name = 'explosion', position = event.entity.position }) game.print('Team ' .. event.robot.force.name .. "'s construction drone had an accident.", { r = 200, g = 50, b = 100 }) - event.created_entity.destroy() + event.entity.destroy() end local function on_entity_damaged(event) diff --git a/maps/native_war/xp.lua b/maps/native_war/xp.lua index 689dd192..0f0af7a7 100644 --- a/maps/native_war/xp.lua +++ b/maps/native_war/xp.lua @@ -242,7 +242,7 @@ local function on_pre_player_mined_item(event) end local function on_built_entity(event) - local created_entity = event.created_entity + local created_entity = event.entity if not created_entity.valid then return end diff --git a/maps/pirates/api_events.lua b/maps/pirates/api_events.lua index 6fd03adc..4840c314 100644 --- a/maps/pirates/api_events.lua +++ b/maps/pirates/api_events.lua @@ -2359,7 +2359,7 @@ local function event_on_rocket_launched(event) end local function event_on_built_entity(event) - local entity = event.created_entity + local entity = event.entity if not entity then return end diff --git a/maps/planet_prison.lua b/maps/planet_prison.lua index ddf5fab6..865a175d 100644 --- a/maps/planet_prison.lua +++ b/maps/planet_prison.lua @@ -1710,7 +1710,7 @@ local function merchant_exploit_check(ent) end local function on_built_entity(e) - local ent = e.created_entity + local ent = e.entity if not ent or not ent.valid then return end diff --git a/maps/railway_troopers/main.lua b/maps/railway_troopers/main.lua index ab29052f..f1a9e46c 100644 --- a/maps/railway_troopers/main.lua +++ b/maps/railway_troopers/main.lua @@ -220,12 +220,12 @@ local type_whitelist = { } local function deny_building(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end - if type_whitelist[event.created_entity.type] then + if type_whitelist[event.entity.type] then return end @@ -240,7 +240,7 @@ local function deny_building(event) inventory.insert({ name = entity.name, count = 1 }) end - event.created_entity.surface.create_entity( + event.entity.surface.create_entity( { name = 'flying-text', position = entity.position, diff --git a/maps/scrap_towny_ffa/building.lua b/maps/scrap_towny_ffa/building.lua index be2cb513..ee572256 100644 --- a/maps/scrap_towny_ffa/building.lua +++ b/maps/scrap_towny_ffa/building.lua @@ -207,7 +207,7 @@ end local function prevent_entity_in_restricted_zone(event) local player_index = event.player_index or nil - local entity = event.created_entity + local entity = event.entity if entity == nil or not entity.valid then return end @@ -265,7 +265,7 @@ end local function process_built_entities(event) local player_index = event.player_index - local entity = event.created_entity + local entity = event.entity if entity == nil or not entity.valid then return end diff --git a/maps/scrap_towny_ffa/slots.lua b/maps/scrap_towny_ffa/slots.lua index a6ab6825..1c9e5595 100644 --- a/maps/scrap_towny_ffa/slots.lua +++ b/maps/scrap_towny_ffa/slots.lua @@ -4,7 +4,7 @@ local ScenarioTable = require 'maps.scrap_towny_ffa.table' -- called whenever a player places an item local function on_built_entity(event) local this = ScenarioTable.get_table() - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -64,7 +64,7 @@ end -- called whenever a robot places an item local function on_robot_built_entity(event) local this = ScenarioTable.get_table() - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end diff --git a/maps/scrap_towny_ffa/town_center.lua b/maps/scrap_towny_ffa/town_center.lua index 3d01852c..0bb1208e 100644 --- a/maps/scrap_towny_ffa/town_center.lua +++ b/maps/scrap_towny_ffa/town_center.lua @@ -386,7 +386,7 @@ function Public.enemy_players_nearby(town_center, max_radius) end local function found_town(event) - local entity = event.created_entity + local entity = event.entity -- is a valid entity placed? if entity == nil or not entity.valid then return diff --git a/maps/spaghettorio.lua b/maps/spaghettorio.lua index c57e14be..93877e79 100644 --- a/maps/spaghettorio.lua +++ b/maps/spaghettorio.lua @@ -170,12 +170,12 @@ end local disabled_entities = { 'stone-furnace', 'electric-furnace', 'solar-panel' } local function on_built_entity(event) for _, e in pairs(disabled_entities) do - if e == event.created_entity.name then + if e == event.entity.name then if event.player_index then local player = game.players[event.player_index] - player.insert({ name = event.created_entity.name, count = 1 }) + player.insert({ name = event.entity.name, count = 1 }) end - event.created_entity.destroy() + event.entity.destroy() end end end diff --git a/maps/spiral_troopers.lua b/maps/spiral_troopers.lua index 15f7e20b..8ae1fb20 100644 --- a/maps/spiral_troopers.lua +++ b/maps/spiral_troopers.lua @@ -574,14 +574,14 @@ end --local disabled_entities = {"gun-turret", "laser-turret", "flamethrower-turret"} local function on_built_entity(event) for _, e in pairs(disabled_entities) do - if e == event.created_entity.name then + if e == event.entity.name then local a = { - left_top = { x = event.created_entity.position.x - 31, y = event.created_entity.position.y - 31 }, - right_bottom = { x = event.created_entity.position.x + 32, y = event.created_entity.position.y + 32 } + left_top = { x = event.entity.position.x - 31, y = event.entity.position.y - 31 }, + right_bottom = { x = event.entity.position.x + 32, y = event.entity.position.y + 32 } } - local enemy_count = event.created_entity.surface.count_entities_filtered({ force = 'enemy', area = a, limit = 1 }) + local enemy_count = event.entity.surface.count_entities_filtered({ force = 'enemy', area = a, limit = 1 }) if enemy_count > 0 then - event.created_entity.active = false + event.entity.active = false if event.player_index then local player = game.players[event.player_index] player.print('The turret seems to be malfunctioning near those creatures.', { r = 0.75, g = 0.0, b = 0.0 }) diff --git a/modules/autofill.lua b/modules/autofill.lua index 33fb97b5..09cc5404 100644 --- a/modules/autofill.lua +++ b/modules/autofill.lua @@ -392,7 +392,7 @@ local function on_entity_built(event) return end - local ce = event.created_entity + local ce = event.entity if not (ce and ce.valid) then return end diff --git a/modules/dynamic_player_spawn.lua b/modules/dynamic_player_spawn.lua index 62a980aa..f0bd8ea9 100644 --- a/modules/dynamic_player_spawn.lua +++ b/modules/dynamic_player_spawn.lua @@ -5,11 +5,11 @@ local Event = require 'utils.event' local valid_types = {'boiler', 'furnace', 'generator', 'offshore-pump', 'lab', 'assembling-machine'} local function on_built_entity(event) - if not event.created_entity.valid then + if not event.entity.valid then return end local player = game.players[event.player_index] - local area = {{event.created_entity.position.x - 12, event.created_entity.position.y - 12}, {event.created_entity.position.x + 12, event.created_entity.position.y + 12}} + local area = {{event.entity.position.x - 12, event.entity.position.y - 12}, {event.entity.position.x + 12, event.entity.position.y + 12}} if player.surface.count_entities_filtered({area = area, force = player.force, type = valid_types}) > 12 then player.force.set_spawn_position(player.position, player.surface) end diff --git a/modules/hunger_games.lua b/modules/hunger_games.lua index 3f4d3e57..6c95f4c2 100644 --- a/modules/hunger_games.lua +++ b/modules/hunger_games.lua @@ -505,7 +505,7 @@ end --[[ local function on_built_entity(event) local get_score = Score.get_table().score_table - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end diff --git a/modules/immersive_cargo_wagons/main.lua b/modules/immersive_cargo_wagons/main.lua index 9cc6446d..f6f04b65 100644 --- a/modules/immersive_cargo_wagons/main.lua +++ b/modules/immersive_cargo_wagons/main.lua @@ -57,13 +57,13 @@ local function on_robot_mined_entity(event) end local function on_built_entity(event) - local created_entity = event.created_entity + local created_entity = event.entity Functions.create_wagon(icw, created_entity) Functions.add_wagon_entity_count(icw, created_entity) end local function on_robot_built_entity(event) - local created_entity = event.created_entity + local created_entity = event.entity Functions.create_wagon(icw, created_entity) Functions.add_wagon_entity_count(icw, created_entity) end diff --git a/modules/infinity_chest.lua b/modules/infinity_chest.lua index dd3b8126..d3c6b495 100644 --- a/modules/infinity_chest.lua +++ b/modules/infinity_chest.lua @@ -86,7 +86,7 @@ local function validate_player(player) end local function built_entity(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -124,7 +124,7 @@ local function built_entity(event) end local function built_entity_robot(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end diff --git a/modules/no_solar.lua b/modules/no_solar.lua index ebf3af35..4fdb478d 100644 --- a/modules/no_solar.lua +++ b/modules/no_solar.lua @@ -1,5 +1,5 @@ local function deny_building(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end diff --git a/modules/no_turrets.lua b/modules/no_turrets.lua index 32a5caa4..cfc89cd7 100644 --- a/modules/no_turrets.lua +++ b/modules/no_turrets.lua @@ -16,11 +16,11 @@ local function destroy_turret(entity) end local function on_built_entity(event) - destroy_turret(event.created_entity) + destroy_turret(event.entity) end local function on_robot_built_entity(event) - destroy_turret(event.created_entity) + destroy_turret(event.entity) end local event = require 'utils.event' diff --git a/modules/spaghett_challenge.lua b/modules/spaghett_challenge.lua index acedc39e..e0bc79ab 100644 --- a/modules/spaghett_challenge.lua +++ b/modules/spaghett_challenge.lua @@ -135,7 +135,7 @@ local function spaghett(surface, entity, inventory, player) end local function on_built_entity(event) - spaghett(event.created_entity.surface, event.created_entity, game.players[event.player_index].get_main_inventory(), game.players[event.player_index]) + spaghett(event.entity.surface, event.entity, game.players[event.player_index].get_main_inventory(), game.players[event.player_index]) end local function on_player_rotated_entity(event) @@ -143,7 +143,7 @@ local function on_player_rotated_entity(event) end local function on_robot_built_entity(event) - spaghett(event.robot.surface, event.created_entity, event.robot.get_inventory(defines.inventory.robot_cargo)) + spaghett(event.robot.surface, event.entity, event.robot.get_inventory(defines.inventory.robot_cargo)) end local function on_player_created(event) diff --git a/modules/towny/building.lua b/modules/towny/building.lua index 384c674b..846956d9 100644 --- a/modules/towny/building.lua +++ b/modules/towny/building.lua @@ -108,7 +108,7 @@ local function is_town_market_nearby(entity) end function Public.prevent_isolation(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end @@ -118,7 +118,7 @@ function Public.prevent_isolation(event) if not entity_type_whitelist[entity.type] then return end - local surface = event.created_entity.surface + local surface = event.entity.surface if is_position_isolated(surface, entity.force, entity.position) then error_floaty(surface, entity.position, {'modules_towny.message_error_building'}) @@ -155,7 +155,7 @@ end local square_min_distance_to_spawn = 80 ^ 2 function Public.restrictions(event) - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end diff --git a/modules/towny/town_center.lua b/modules/towny/town_center.lua index aa602b40..56e573e4 100644 --- a/modules/towny/town_center.lua +++ b/modules/towny/town_center.lua @@ -343,7 +343,7 @@ end function Public.found(event) local townytable = Table.get_table() - local entity = event.created_entity + local entity = event.entity if entity.force.index ~= 1 then return end diff --git a/modules/turret_filler.lua b/modules/turret_filler.lua index e297f7bc..337f1c17 100644 --- a/modules/turret_filler.lua +++ b/modules/turret_filler.lua @@ -192,7 +192,7 @@ local function on_built_entity(event) if not turrettable.enabled then return end - local turret = event.created_entity + local turret = event.entity if not turret or not turret.valid then return end @@ -210,7 +210,7 @@ local function on_robot_built_entity(event) if not turrettable.enabled then return end - local turret = event.created_entity + local turret = event.entity if not turret or not turret.valid then return end diff --git a/modules/wave_defense/side_targets.lua b/modules/wave_defense/side_targets.lua index da4958d5..94c35222 100644 --- a/modules/wave_defense/side_targets.lua +++ b/modules/wave_defense/side_targets.lua @@ -76,29 +76,29 @@ local function add_entity(entity) end local function on_built_entity(event) - if not event.created_entity then + if not event.entity then return end - if not event.created_entity.valid then + if not event.entity.valid then return end - if not side_target_types[event.created_entity.type] then + if not side_target_types[event.entity.type] then return end - add_entity(event.created_entity) + add_entity(event.entity) end local function on_robot_built_entity(event) - if not event.created_entity then + if not event.entity then return end - if not event.created_entity.valid then + if not event.entity.valid then return end - if not side_target_types[event.created_entity.type] then + if not side_target_types[event.entity.type] then return end - add_entity(event.created_entity) + add_entity(event.entity) end local event = require 'utils.event' diff --git a/utils/antigrief.lua b/utils/antigrief.lua index cbf01d4f..dff14d53 100644 --- a/utils/antigrief.lua +++ b/utils/antigrief.lua @@ -328,7 +328,7 @@ local function on_built_entity(event) return end - local created_entity = event.created_entity + local created_entity = event.entity if created_entity.type == 'entity-ghost' then local player = game.get_player(event.player_index) diff --git a/utils/gui/config.lua b/utils/gui/config.lua index e153c684..6a1055c5 100644 --- a/utils/gui/config.lua +++ b/utils/gui/config.lua @@ -52,11 +52,11 @@ local function spaghett_deny_building(event) if not spaghett.enabled then return end - local entity = event.created_entity + local entity = event.entity if not entity.valid then return end - if not spaghett_entity_blacklist[event.created_entity.name] then + if not spaghett_entity_blacklist[event.entity.name] then return end @@ -67,7 +67,7 @@ local function spaghett_deny_building(event) inventory.insert({ name = entity.name, count = 1 }) end - event.created_entity.surface.create_entity( + event.entity.surface.create_entity( { name = 'flying-text', position = entity.position, diff --git a/utils/gui/score.lua b/utils/gui/score.lua index a62a9c4f..52e8d642 100644 --- a/utils/gui/score.lua +++ b/utils/gui/score.lua @@ -475,10 +475,10 @@ local function on_player_mined_entity(event) end local function on_built_entity(event) - if not event.created_entity.valid then + if not event.entity.valid then return end - if building_and_mining_blacklist[event.created_entity.type] then + if building_and_mining_blacklist[event.entity.type] then return end local player = game.players[event.player_index]