From c2f2bf49e1a165d6372ce9b89ef28d1dda223286 Mon Sep 17 00:00:00 2001 From: Jayefuu Date: Tue, 9 Feb 2021 22:30:33 +0000 Subject: [PATCH] Updated with suggested corrections --- features/player_stats.lua | 6 +++++- map_gen/maps/crash_site/commands.lua | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/features/player_stats.lua b/features/player_stats.lua index 5d9a5002..cbf6bd7d 100644 --- a/features/player_stats.lua +++ b/features/player_stats.lua @@ -171,7 +171,7 @@ end local function player_built_entity(event) local player_index = event.player_index - if player_index and (event.created_entity.is_registered_for_construction() == false)then -- only register it as built once a robot builds it + if event.created_entity.is_registered_for_construction() == false then -- When is_registered_for_construction() is true we only register the entity as built once a robot builds it change_for_global(built_by_players_name, 1) change_for_player(player_index, player_entities_built_name, 1) end @@ -181,6 +181,10 @@ local function robot_built_entity(event) change_for_global(built_by_robots_name, 1) local robot = event.robot + if not robot then + return + end + -- When item gets built, add to the total entities built for the player whose robot built the entity NOT for the player who placed the ghost local robot_owner = robot.logistic_network.cells[1].owner if robot_owner.player then -- nil if the robot owner is a roboport diff --git a/map_gen/maps/crash_site/commands.lua b/map_gen/maps/crash_site/commands.lua index 6fb4c4b7..03142cac 100644 --- a/map_gen/maps/crash_site/commands.lua +++ b/map_gen/maps/crash_site/commands.lua @@ -224,7 +224,7 @@ function Public.control(config) .. 'Players: '..statistics.total_players..'\\n' ) end - Server.to_discord_named_raw(map_promotion_channel, crash_site_role_mention .. ' **'..scenario_display_name[next_scenario]..' has just restarted!!**') + Server.to_discord_named_raw(map_promotion_channel, crash_site_role_mention .. ' **'..config.scenario_name..' has just restarted!!**') Server.set_data('crash_site_data', tostring(end_epoch), statistics) -- Store the table, with end_epoch as the key Popup.all('\nServer restarting!\nInitiated by ' .. data.name .. '\n')