mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 19:45:22 +09:00
Added Alt View
This commit is contained in:
21
modules/data/alt-view.lua
Normal file
21
modules/data/alt-view.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
--- Stores if you use alt mode or not and auto applies it
|
||||
-- @data Alt-View
|
||||
|
||||
local Event = require 'utils.event' ---@dep utils.event
|
||||
|
||||
--- Stores the join message that the player have
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local UsesAlt = PlayerData.Settings:combine('UsesAlt')
|
||||
UsesAlt:set_default(false)
|
||||
|
||||
--- When your data loads apply alt view if you have it enabled
|
||||
UsesAlt:on_load(function(player_name, uses_alt)
|
||||
local player = game.players[player_name]
|
||||
player.game_view_settings.show_entity_info = uses_alt or false
|
||||
end)
|
||||
|
||||
--- When alt view is toggled update this
|
||||
Event.add(defines.events.on_player_toggled_alt_mode, function(event)
|
||||
local player = game.players[event.player_index]
|
||||
UsesAlt:set(player, player.game_view_settings.show_entity_info)
|
||||
end)
|
||||
Reference in New Issue
Block a user