mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-28 20:05:22 +09:00
Added spectate commands
This commit is contained in:
@@ -20,6 +20,14 @@ end)
|
||||
|
||||
----- Public Functions -----
|
||||
|
||||
--- Test if a player is in spectator mode
|
||||
-- @tparam LuaPlayer player The player to test the controller type of
|
||||
-- @treturn boolean True if the player is in spectator mode
|
||||
function Public.is_spectating(player)
|
||||
assert(player and player.valid, 'Invalid player given to follower')
|
||||
return player.controller_type == defines.controllers.spectator
|
||||
end
|
||||
|
||||
--- Puts a player into spectator while maintaining an association to their character
|
||||
-- @tparam LuaPlayer player The player that will be placed into spectator
|
||||
-- @treturn boolean Returns false if the player was already in spectator
|
||||
@@ -47,6 +55,14 @@ function Public.stop_spectate(player)
|
||||
end
|
||||
end
|
||||
|
||||
--- Test if a player is in follow mode
|
||||
-- @tparam LuaPlayer player The player to test the follow mode of
|
||||
-- @treturn boolean True if the player is in follow mode
|
||||
function Public.is_following(player)
|
||||
assert(player and player.valid, 'Invalid player given to follower')
|
||||
return following[player.index] ~= nil
|
||||
end
|
||||
|
||||
--- Puts a player into spectator and follows an entity as it moves
|
||||
-- @tparam LuaPlayer player The player that will follow the entity
|
||||
-- @tparam ?LuaPlayer|LuaEntity entity The player or entity that will be followed
|
||||
|
||||
Reference in New Issue
Block a user