From 6dba36754a824d745414b5c2b44cbfdd6642123d Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sat, 14 Apr 2018 22:35:49 +0100 Subject: [PATCH] Change to homes --- Addons/Commands/home.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Addons/Commands/home.lua b/Addons/Commands/home.lua index 4ea2d3a7..3f079d23 100644 --- a/Addons/Commands/home.lua +++ b/Addons/Commands/home.lua @@ -16,22 +16,22 @@ end commands.add_command('set-home', 'Set Your Home Possition', {}, function(event,args) local player = Game.get_player(event) - if not homes()[player.index] then homes()[player.index] = {player.force.get_spawn_position(player.surface),player.force.get_spawn_position(player.surface)} end - homes()[player.index][1] = player.position + if not _homes()[player.index] then _homes()[player.index] = {player.force.get_spawn_position(player.surface),player.force.get_spawn_position(player.surface)} end + _homes()[player.index][1] = player.position player_return('Home set at: ('..math.floor(player.position.x)..','..math.floor(player.position.y)..')') end) commands.add_command('home', 'Goto you home possition', {}, function(event,args) local player = Game.get_player(event) - if not homes()[player.index] then homes()[player.index] = {player.force.get_spawn_position(player.surface),player.force.get_spawn_position(player.surface)} end - homes()[player.index][2] = player.position - player.teleport(player.surface.find_non_colliding_position('player',homes()[player.index][1],32,1),player.surface) + if not _homes()[player.index] then _homes()[player.index] = {player.force.get_spawn_position(player.surface),player.force.get_spawn_position(player.surface)} end + _homes()[player.index][2] = player.position + player.teleport(player.surface.find_non_colliding_position('player',_homes()[player.index][1],32,1),player.surface) end) commands.add_command('return', 'Goto where you were before using /home', {}, function(event,args) local player = Game.get_player(event) - if not homes()[player.index] then homes()[player.index] = {player.force.get_spawn_position(player.surface),player.force.get_spawn_position(player.surface)} end + if not _homes()[player.index] then _homes()[player.index] = {player.force.get_spawn_position(player.surface),player.force.get_spawn_position(player.surface)} end local _temp = player.position - player.teleport(player.surface.find_non_colliding_position('player',homes()[player.index][2],32,1),player.surface) - homes()[player.index][2] = _temp + player.teleport(player.surface.find_non_colliding_position('player',_homes()[player.index][2],32,1),player.surface) + _homes()[player.index][2] = _temp end) \ No newline at end of file