mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-29 04:06:39 +09:00
Move files to exp_legacy
This commit is contained in:
24
exp_legacy/module/modules/data/alt-view.lua
Normal file
24
exp_legacy/module/modules/data/alt-view.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
--- 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 visible state of alt mode
|
||||
local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data
|
||||
local UsesAlt = PlayerData.Settings:combine('UsesAlt')
|
||||
UsesAlt:set_default(false)
|
||||
UsesAlt:set_metadata{
|
||||
stringify = function(value) return value and 'Visible' or 'Hidden' end
|
||||
}
|
||||
|
||||
--- 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