mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-14 10:13:13 +02:00
Merge pull request #752 from plague006/digits
Change digit to string to prevent error (and desyncs)
This commit is contained in:
commit
7dfd6e92c9
@ -322,7 +322,7 @@ function ForceControl.get_formatted_force_data(lua_force_or_name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
return format(
|
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.current_experience,
|
||||||
force_config.total_experience,
|
force_config.total_experience,
|
||||||
force_config.current_level,
|
force_config.current_level,
|
||||||
|
@ -298,11 +298,11 @@ local function redraw_market_items(data)
|
|||||||
if disabled then
|
if disabled then
|
||||||
insert(tooltip, '\n\n' .. (item.disabled_reason or 'Not available'))
|
insert(tooltip, '\n\n' .. (item.disabled_reason or 'Not available'))
|
||||||
elseif is_missing_coins then
|
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
|
end
|
||||||
|
|
||||||
if has_player_limit then
|
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
|
end
|
||||||
|
|
||||||
local button = grid.add({type = 'flow'}).add({
|
local button = grid.add({type = 'flow'}).add({
|
||||||
|
@ -195,7 +195,7 @@ local function on_player_mined_entity(event)
|
|||||||
return
|
return
|
||||||
end
|
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)
|
add_experience(force, exp)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ local function on_research_finished(event)
|
|||||||
award_xp = award_xp + reward
|
award_xp = award_xp + reward
|
||||||
end
|
end
|
||||||
local exp = award_xp * research.research_unit_count
|
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
|
for _, p in pairs(game.connected_players) do
|
||||||
local player_index = p.index
|
local player_index = p.index
|
||||||
print_player_floating_text_position(player_index, text, gain_xp_color, -1, -0.5)
|
print_player_floating_text_position(player_index, text, gain_xp_color, -1, -0.5)
|
||||||
@ -242,7 +242,7 @@ end
|
|||||||
local function on_rocket_launched(event)
|
local function on_rocket_launched(event)
|
||||||
local force = event.rocket.force
|
local force = event.rocket.force
|
||||||
local exp = add_experience_percentage(force, config.XP['rocket_launch'])
|
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
|
for _, p in pairs(game.connected_players) do
|
||||||
local player_index = p.index
|
local player_index = p.index
|
||||||
print_player_floating_text_position(player_index, text, gain_xp_color, -1, -0.5)
|
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
|
end
|
||||||
|
|
||||||
if exp > 0 then
|
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)
|
add_experience(force, exp)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -302,8 +302,8 @@ end
|
|||||||
local function on_player_respawned(event)
|
local function on_player_respawned(event)
|
||||||
local player = get_player_by_index(event.player_index)
|
local player = get_player_by_index(event.player_index)
|
||||||
local exp = remove_experience_percentage(player.force, config.XP['death-penalty'], 50)
|
local exp = remove_experience_percentage(player.force, config.XP['death-penalty'], 50)
|
||||||
local text = format('-%d XP', exp)
|
local text = format('-%s XP', exp)
|
||||||
game.print(format('%s drained %d experience.', player.name, exp), lose_xp_color)
|
game.print(format('%s drained %s experience.', player.name, exp), lose_xp_color)
|
||||||
for _, p in pairs(game.connected_players) do
|
for _, p in pairs(game.connected_players) do
|
||||||
print_player_floating_text_position(p.index, text, lose_xp_color, -1, -0.5)
|
print_player_floating_text_position(p.index, text, lose_xp_color, -1, -0.5)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user