1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

added total coins spent

This commit is contained in:
grilledham 2019-01-21 20:36:32 +00:00
parent e88c72f972
commit 43197de20a

View File

@ -19,6 +19,7 @@ local total_player_rocks_mined = {0}
local total_robot_built_entities = {0} local total_robot_built_entities = {0}
local total_player_built_entities = {0} local total_player_built_entities = {0}
local total_biter_kills = {0} local total_biter_kills = {0}
local total_coins_spent = {0}
local train_kill_causes = { local train_kill_causes = {
['locomotive'] = true, ['locomotive'] = true,
@ -42,7 +43,8 @@ Global.register(
player_console_chats = player_console_chats, player_console_chats = player_console_chats,
total_robot_built_entities = total_robot_built_entities, total_robot_built_entities = total_robot_built_entities,
total_player_built_entities = total_player_built_entities, total_player_built_entities = total_player_built_entities,
total_biter_kills = total_biter_kills total_biter_kills = total_biter_kills,
total_coins_spent = total_coins_spent
}, },
function(tbl) function(tbl)
player_last_position = tbl.player_last_position player_last_position = tbl.player_last_position
@ -59,6 +61,7 @@ Global.register(
total_robot_built_entities = tbl.total_robot_built_entities total_robot_built_entities = tbl.total_robot_built_entities
total_player_built_entities = tbl.total_player_built_entities total_player_built_entities = tbl.total_player_built_entities
total_biter_kills = tbl.total_biter_kills total_biter_kills = tbl.total_biter_kills
total_coins_spent = tbl.total_coins_spent
end end
) )
@ -204,11 +207,16 @@ function Public.get_coin_spent(player_index)
end end
function Public.set_coin_spent(player_index, value) function Public.set_coin_spent(player_index, value)
local old_value = player_coin_spent[player_index]
player_coin_spent[player_index] = value player_coin_spent[player_index] = value
local diff = value - old_value
total_coins_spent[1] = total_coins_spent[1] + diff
end end
function Public.change_coin_spent(player_index, amount) function Public.change_coin_spent(player_index, amount)
player_coin_spent[player_index] = player_coin_spent[player_index] + amount player_coin_spent[player_index] = player_coin_spent[player_index] + amount
total_coins_spent[1] = total_coins_spent[1] + amount
end end
function Public.get_death_count(player_index) function Public.get_death_count(player_index)
@ -256,4 +264,8 @@ function Public.get_total_biter_kills()
return total_biter_kills[1] return total_biter_kills[1]
end end
function Public.get_total_coins_spent()
return total_coins_spent[1]
end
return Public return Public