mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Surveillance Player Loop (#321)
* Update surveillance.lua * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update surveillance.lua * Update surveillance.lua
This commit is contained in:
@@ -288,6 +288,15 @@ control-type-storage-output=Storage Output
|
||||
[module]
|
||||
main-tooltip=Module GUI
|
||||
|
||||
[surveillance]
|
||||
main-tooltip=Surveillance GUI
|
||||
status-enable=Enable
|
||||
status-disable=Disable
|
||||
func-set=Set
|
||||
type-player=Player
|
||||
type-static=Static
|
||||
type-player-loop=Player loop
|
||||
|
||||
[toolbar]
|
||||
main-caption=Toolbox
|
||||
main-tooltip=Toolbox Settings\nUse the checkboxs to select facourites
|
||||
|
||||
@@ -288,6 +288,15 @@ control-type-storage-output=提取箱
|
||||
[module]
|
||||
main-tooltip=模組介面
|
||||
|
||||
[surveillance]
|
||||
main-tooltip=監控介面
|
||||
status-enable=啟用
|
||||
status-disable=停用
|
||||
func-set=設
|
||||
type-player=用戶
|
||||
type-static=靜態
|
||||
type-player-loop=用戶循環
|
||||
|
||||
[toolbar]
|
||||
main-caption=工具箱
|
||||
main-tooltip=工具箱設定\n選上來設定喜好
|
||||
|
||||
@@ -288,6 +288,15 @@ control-type-storage-output=提取箱
|
||||
[module]
|
||||
main-tooltip=模組介面
|
||||
|
||||
[surveillance]
|
||||
main-tooltip=監控介面
|
||||
status-enable=啟用
|
||||
status-disable=停用
|
||||
func-set=設
|
||||
type-player=用戶
|
||||
type-static=靜態
|
||||
type-player-loop=用戶循環
|
||||
|
||||
[toolbar]
|
||||
main-caption=工具箱
|
||||
main-tooltip=工具箱設定\n選上來設定喜好
|
||||
|
||||
@@ -22,7 +22,7 @@ end)
|
||||
local cctv_status =
|
||||
Gui.element{
|
||||
type = 'drop-down',
|
||||
items = {'Enable', 'Disable'},
|
||||
items = {{'surveillance.status-enable'}, {'surveillance.status-disable'}},
|
||||
selected_index = 2
|
||||
}:style{
|
||||
width = 96
|
||||
@@ -38,7 +38,7 @@ local cctv_type =
|
||||
Gui.element{
|
||||
type = 'drop-down',
|
||||
name = Gui.unique_static_name,
|
||||
items = {'Player', 'Static'},
|
||||
items = {{'surveillance.type-player'}, {'surveillance.type-static'}, {'surveillance.type-player-loop'}},
|
||||
selected_index = 1
|
||||
}:style{
|
||||
width = 96
|
||||
@@ -48,7 +48,7 @@ local cctv_location =
|
||||
Gui.element{
|
||||
type = 'button',
|
||||
name = Gui.unique_static_name,
|
||||
caption = 'set'
|
||||
caption = {'surveillance.func-set'}
|
||||
}:style{
|
||||
width = 48
|
||||
}:on_click(function(player, element, _)
|
||||
@@ -104,8 +104,8 @@ Gui.element(function(_, parent, name, player_list)
|
||||
}
|
||||
|
||||
camera.visible = false
|
||||
camera.style.minimal_width = 400
|
||||
camera.style.minimal_height = 300
|
||||
camera.style.minimal_width = 480
|
||||
camera.style.minimal_height = 290
|
||||
return camera_set
|
||||
end)
|
||||
|
||||
@@ -128,7 +128,7 @@ end)
|
||||
:static_name(Gui.unique_static_name)
|
||||
:add_to_left_flow()
|
||||
|
||||
Gui.left_toolbar_button('entity/radar', 'Surveillance GUI', cctv_container, function(player)
|
||||
Gui.left_toolbar_button('entity/radar', {'surveillance.main-tooltip'}, cctv_container, function(player)
|
||||
return Roles.player_allowed(player, 'gui/surveillance')
|
||||
end)
|
||||
|
||||
@@ -158,7 +158,7 @@ Event.add(defines.events.on_tick, function(_)
|
||||
local current_camera_set = frame.container.scroll[scroll_table_name]
|
||||
local switch_index = current_camera_set.buttons.table[cctv_type.name].selected_index
|
||||
|
||||
if switch_index == 1 then
|
||||
if (switch_index == 1) or (switch_index == 3) then
|
||||
local selected_index = current_camera_set.buttons.table[cctv_player.name].selected_index
|
||||
|
||||
if selected_index ~= 0 then
|
||||
@@ -174,3 +174,26 @@ Event.add(defines.events.on_tick, function(_)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Event.on_nth_tick(600, function(_)
|
||||
for _, player in pairs(game.connected_players) do
|
||||
local frame = Gui.get_left_element(player, cctv_container)
|
||||
|
||||
for i=1, 2 do
|
||||
local current_camera_set = frame.container.scroll['cctv_st_' .. i]
|
||||
|
||||
if current_camera_set.buttons.table[cctv_type.name].selected_index == 3 then
|
||||
local item_n = #current_camera_set.buttons.table[cctv_player.name].items
|
||||
|
||||
if item_n ~= 0 then
|
||||
if current_camera_set.buttons.table[cctv_player.name].selected_index < item_n then
|
||||
current_camera_set.buttons.table[cctv_player.name].selected_index = current_camera_set.buttons.table[cctv_player.name].selected_index + 1
|
||||
|
||||
else
|
||||
current_camera_set.buttons.table[cctv_player.name].selected_index = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user