From cbe82d4edbfb5e7e528bf7c4891ba76145df84be Mon Sep 17 00:00:00 2001 From: Matthew Heguy Date: Wed, 13 Feb 2019 00:18:17 -0500 Subject: [PATCH 1/3] Change digit to string to prevent error --- map_gen/maps/diggy/feature/experience.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/map_gen/maps/diggy/feature/experience.lua b/map_gen/maps/diggy/feature/experience.lua index 40cc7ad0..eeb1f2e0 100644 --- a/map_gen/maps/diggy/feature/experience.lua +++ b/map_gen/maps/diggy/feature/experience.lua @@ -242,7 +242,7 @@ end local function on_rocket_launched(event) local force = event.rocket.force local exp = add_experience_percentage(force, config.XP['rocket_launch']) - local text = format('Rocket launched! +%d XP', exp) + local text = format('Rocket launched! +%s XP', exp) for _, p in pairs(game.connected_players) do local player_index = p.index print_player_floating_text_position(player_index, text, gain_xp_color, -1, -0.5) From 17cc882b04620ebf877f63e0ec0b2326863ae4d5 Mon Sep 17 00:00:00 2001 From: Matthew Heguy Date: Wed, 13 Feb 2019 01:10:16 -0500 Subject: [PATCH 2/3] Change digits to strings to prevent future errors --- features/force_control.lua | 2 +- features/retailer.lua | 4 ++-- map_gen/maps/diggy/feature/experience.lua | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/features/force_control.lua b/features/force_control.lua index 8fdc652d..c351bacb 100644 --- a/features/force_control.lua +++ b/features/force_control.lua @@ -322,7 +322,7 @@ function ForceControl.get_formatted_force_data(lua_force_or_name) end return format( - 'Current experience: %d Total experience: %d Current level: %d Next level at: %d Percentage to level up: %d%%', + 'Current experience: %s Total experience: %s Current level: %d Next level at: %s Percentage to level up: %d%%', force_config.current_experience, force_config.total_experience, force_config.current_level, diff --git a/features/retailer.lua b/features/retailer.lua index e23e363b..ebf73144 100644 --- a/features/retailer.lua +++ b/features/retailer.lua @@ -298,11 +298,11 @@ local function redraw_market_items(data) if disabled then insert(tooltip, '\n\n' .. (item.disabled_reason or 'Not available')) elseif is_missing_coins then - insert(tooltip, '\n\n' .. format('Missing %d coins to buy %d', missing_coins, stack_count)) + insert(tooltip, '\n\n' .. format('Missing %s coins to buy %s', missing_coins, stack_count)) end if has_player_limit then - insert(tooltip, '\n\n' .. format('You have bought this item %d out of %d times', item.player_limit - player_limit, item.player_limit)) + insert(tooltip, '\n\n' .. format('You have bought this item %s out of %s times', item.player_limit - player_limit, item.player_limit)) end local button = grid.add({type = 'flow'}).add({ diff --git a/map_gen/maps/diggy/feature/experience.lua b/map_gen/maps/diggy/feature/experience.lua index eeb1f2e0..a2b83c6a 100644 --- a/map_gen/maps/diggy/feature/experience.lua +++ b/map_gen/maps/diggy/feature/experience.lua @@ -195,7 +195,7 @@ local function on_player_mined_entity(event) return end - print_player_floating_text_position(player_index, format('+%d XP', exp), gain_xp_color,0, -0.5) + print_player_floating_text_position(player_index, format('+%s XP', exp), gain_xp_color,0, -0.5) add_experience(force, exp) end @@ -212,7 +212,7 @@ local function on_research_finished(event) award_xp = award_xp + reward end local exp = award_xp * research.research_unit_count - local text = format('Research completed! +%d XP', exp) + local text = format('Research completed! +s XP', exp) for _, p in pairs(game.connected_players) do local player_index = p.index print_player_floating_text_position(player_index, text, gain_xp_color, -1, -0.5) @@ -281,7 +281,7 @@ local function on_entity_died(event) end if exp > 0 then - Game.print_floating_text(entity.surface, floating_text_position, format('+%d XP', exp), gain_xp_color) + Game.print_floating_text(entity.surface, floating_text_position, format('+%s XP', exp), gain_xp_color) add_experience(force, exp) end @@ -302,8 +302,8 @@ end local function on_player_respawned(event) local player = get_player_by_index(event.player_index) local exp = remove_experience_percentage(player.force, config.XP['death-penalty'], 50) - local text = format('-%d XP', exp) - game.print(format('%s drained %d experience.', player.name, exp), lose_xp_color) + local text = format('-%s XP', exp) + game.print(format('%s drained %s experience.', player.name, exp), lose_xp_color) for _, p in pairs(game.connected_players) do print_player_floating_text_position(p.index, text, lose_xp_color, -1, -0.5) end From dd93821f515cf745a60069b5d4f5d2d7d561d486 Mon Sep 17 00:00:00 2001 From: Lynn Date: Wed, 13 Feb 2019 12:18:40 -0500 Subject: [PATCH 3/3] Update map_gen/maps/diggy/feature/experience.lua Co-Authored-By: plague006 --- map_gen/maps/diggy/feature/experience.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/map_gen/maps/diggy/feature/experience.lua b/map_gen/maps/diggy/feature/experience.lua index a2b83c6a..7a59c7d5 100644 --- a/map_gen/maps/diggy/feature/experience.lua +++ b/map_gen/maps/diggy/feature/experience.lua @@ -212,7 +212,7 @@ local function on_research_finished(event) award_xp = award_xp + reward end local exp = award_xp * research.research_unit_count - local text = format('Research completed! +s XP', exp) + local text = format('Research completed! +%s XP', exp) for _, p in pairs(game.connected_players) do local player_index = p.index print_player_floating_text_position(player_index, text, gain_xp_color, -1, -0.5)