From 5f96759833c092c6295795a0897752b39ed953d2 Mon Sep 17 00:00:00 2001 From: Valansch Date: Fri, 21 Jul 2017 13:05:26 +0200 Subject: [PATCH] Made player distance persistent --- walk_distance.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/walk_distance.lua b/walk_distance.lua index 5fabe042..61769dda 100644 --- a/walk_distance.lua +++ b/walk_distance.lua @@ -29,7 +29,9 @@ end local function init_player_position(event) local player = game.players[event.player_index] global.scenario.variables.player_positions[player.name] = player.position - global.scenario.variables.player_walk_distances[player.name] = 0 + if not global.scenario.variables.player_walk_distances[player.name] then + global.scenario.variables.player_walk_distances[player.name] = 0 + end end Event.register(defines.events.on_tick, on_tick)