mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-09-21 17:04:00 +00:00
Small format changes
This commit is contained in:
@@ -75,10 +75,13 @@ function Spectate.start_spectate(player)
|
|||||||
if spectating[player.index] or not player.character then return false end
|
if spectating[player.index] or not player.character then return false end
|
||||||
local character = player.character
|
local character = player.character
|
||||||
local opened = player.opened
|
local opened = player.opened
|
||||||
|
|
||||||
player.set_controller{ type = defines.controllers.spectator }
|
player.set_controller{ type = defines.controllers.spectator }
|
||||||
player.associate_character(character)
|
player.associate_character(character)
|
||||||
spectating[player.index] = character
|
spectating[player.index] = character
|
||||||
|
|
||||||
if opened then player.opened = opened end -- Changing controller closes the opened gui
|
if opened then player.opened = opened end -- Changing controller closes the opened gui
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -87,6 +90,7 @@ end
|
|||||||
function Spectate.stop_spectate(player)
|
function Spectate.stop_spectate(player)
|
||||||
local character = spectating[player.index]
|
local character = spectating[player.index]
|
||||||
spectating[player.index] = nil
|
spectating[player.index] = nil
|
||||||
|
|
||||||
if character and character.valid then
|
if character and character.valid then
|
||||||
local opened = player.opened
|
local opened = player.opened
|
||||||
player.teleport(character.position, character.surface)
|
player.teleport(character.position, character.surface)
|
||||||
@@ -137,8 +141,12 @@ end
|
|||||||
local function update_following(data)
|
local function update_following(data)
|
||||||
local player, target = data.player, data.target
|
local player, target = data.player, data.target
|
||||||
local position = player.position
|
local position = player.position
|
||||||
if data.stop or player.character or not target.valid
|
if
|
||||||
or position.x ~= data.position.x or position.y ~= data.position.y
|
data.stop
|
||||||
|
or player.character
|
||||||
|
or not target.valid
|
||||||
|
or position.x ~= data.position.x
|
||||||
|
or position.y ~= data.position.y
|
||||||
then
|
then
|
||||||
Spectate.stop_follow(player)
|
Spectate.stop_follow(player)
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user