mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-29 20:16:38 +09:00
Spell Check and Lua Check
This commit is contained in:
@@ -8,13 +8,13 @@ local Role -- ExpGamingCore.Role@^4.0.0
|
||||
local Sync -- ExpGamingCore.Sync@^4.0.0
|
||||
|
||||
local function get_allowed_afk_time(player)
|
||||
local player = Game.get_player(player)
|
||||
player = Game.get_player(player)
|
||||
local role = Role and Role.get_highest(player) or {index=1,allow_afk_kick=not player.admin}
|
||||
local player_count = #game.connected_players
|
||||
local role_count = Role and Role.meta.count or 1
|
||||
local role_index = role.allow_afk_kick and role.index or false
|
||||
if not base then return false end
|
||||
return (role_count/role_index)*count
|
||||
if not role_index then return false end
|
||||
return (role_count/role_index)*player_count
|
||||
end
|
||||
|
||||
script.on_event(defines.events.on_tick,function(event)
|
||||
|
||||
@@ -17,7 +17,7 @@ script.on_init(function(event)
|
||||
end
|
||||
end):on_event('error',function(self,err)
|
||||
if Sync then
|
||||
Sync.emit_embeded{
|
||||
Sync.emit_embedded{
|
||||
title='Auto Kick Error',
|
||||
color=Color.to_hex(defines.textcolor.bg),
|
||||
description='Auto Kick Error - Closed Thread',
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
--- Adds an inventory search that is proformed on a random player every 15 seconds
|
||||
--- Adds an inventory search that is preformed on a random player every 15 seconds
|
||||
-- @module ExpGamingPlayer.inventorySearch@4.0.0
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
-- @alais ThisModule
|
||||
-- @alias ThisModule
|
||||
|
||||
-- Module Require
|
||||
local Admin = require('ExpGamingAdmin')
|
||||
local Game = require('FactorioStdLib.Game')
|
||||
local Role -- ExpGamingCore.Role@^4.0.0
|
||||
|
||||
-- Local Varibles
|
||||
-- Local Variables
|
||||
-- removed from none admin ranks, no further action
|
||||
local low_items = {
|
||||
'loader',
|
||||
@@ -36,7 +35,7 @@ local high_items = {
|
||||
}
|
||||
|
||||
-- inventories which are searched
|
||||
local inventorys = {
|
||||
local inventories = {
|
||||
defines.inventory.player_main,
|
||||
defines.inventory.player_quickbar,
|
||||
defines.inventory.player_trash
|
||||
@@ -63,7 +62,7 @@ end
|
||||
function ThisModule.search_player(player)
|
||||
for category,items in pairs(_root_tree) do
|
||||
if not Role or category ~= 'low_items' and not Role.allowed(player,'admin-items') then
|
||||
for _,_inventory in pairs(inventorys) do
|
||||
for _,_inventory in pairs(inventories) do
|
||||
local inventory = player.get_inventory(_inventory)
|
||||
if inventory then
|
||||
for _,item in pairs(items) do
|
||||
|
||||
@@ -9,7 +9,7 @@ local Role -- ExpGamingCore.Role@^4.0.0
|
||||
local Group -- ExpGamingCore.Group@^4.0.0
|
||||
|
||||
local function get_player_info(player,frame,add_cam)
|
||||
local player = Game.get_player(player)
|
||||
player = Game.get_player(player)
|
||||
if not player then return {} end
|
||||
local _player = {}
|
||||
_player.index = player.index
|
||||
@@ -26,7 +26,7 @@ local function get_player_info(player,frame,add_cam)
|
||||
_player.roles = roles
|
||||
end
|
||||
if frame then
|
||||
local frame = frame.add{type='frame',direction='vertical',style='image_frame'}
|
||||
frame = frame.add{type='frame',direction='vertical',style='image_frame'}
|
||||
frame.style.width = 200
|
||||
if Role then frame.style.height = 300
|
||||
else frame.style.height = 260 end
|
||||
|
||||
@@ -8,7 +8,7 @@ local Gui = require('ExpGamingCore.Gui')
|
||||
local Admin -- ExpGamingAdmin@^4.0.0
|
||||
local AdminGui -- ExpGamingAdmin.Gui@^4.0.0
|
||||
|
||||
-- Local Varibles
|
||||
-- Local Variables
|
||||
local playerInfo = function(player,frame)
|
||||
frame.add{
|
||||
type='label',
|
||||
@@ -40,12 +40,12 @@ local ThisModule = {
|
||||
local global = global{
|
||||
update=0,
|
||||
delay=10,
|
||||
intervial=54000
|
||||
interval=54000
|
||||
}
|
||||
|
||||
function ThisModule.update(tick)
|
||||
local tick = is_type(tick,'table') and tick.tick or is_type(tick,'number') and tick or game.tick
|
||||
if tick + global.delay > global.update - global.intervial then
|
||||
if tick + global.delay > global.update - global.interval then
|
||||
global.update = tick + global.delay
|
||||
end
|
||||
end
|
||||
@@ -113,7 +113,7 @@ ThisModule.Gui = Gui.left{
|
||||
script.on_event(defines.events.on_tick,function(event)
|
||||
if event.tick > global.update then
|
||||
ThisModule.Gui()
|
||||
global.update = event.tick + global.intervial
|
||||
global.update = event.tick + global.interval
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ local Server = require('ExpGamingCore.Server')
|
||||
local Gui = require('ExpGamingCore.Gui')
|
||||
local Role -- ExpGamingCore.Server@^4.0.0
|
||||
|
||||
-- Local Varibles
|
||||
-- Local Variables
|
||||
local poll_time_out = 90 -- In seconds
|
||||
|
||||
-- Module Define
|
||||
@@ -27,7 +27,7 @@ local global = global{
|
||||
|
||||
-- Function Define
|
||||
local function _poll_data(question,answers)
|
||||
local poll = {
|
||||
local rtn_poll = {
|
||||
uuid=Server.uuid(),
|
||||
question=question,
|
||||
answers=answers or {'None'},
|
||||
@@ -35,7 +35,7 @@ local function _poll_data(question,answers)
|
||||
voted={}
|
||||
}
|
||||
Server.new_thread{
|
||||
data={poll_uuid=poll.uuid},
|
||||
data={poll_uuid=rtn_poll.uuid},
|
||||
timeout=poll_time_out*60
|
||||
}:on_event('timeout',function(self)
|
||||
local uuid = tostring(self.data.poll_uuid)
|
||||
@@ -58,9 +58,9 @@ local function _poll_data(question,answers)
|
||||
game.print({'ExpGamingPlayer-polls.winner',highest[1]},defines.textcolor.info)
|
||||
verbose('Ended Poll: '..poll.question..' ('..uuid..') Highest: '..highest[1])
|
||||
end):open()
|
||||
global.active[tostring(poll.uuid)]=poll
|
||||
verbose('Created Poll: '..question..' ('..poll.uuid..')')
|
||||
return poll.uuid
|
||||
global.active[tostring(rtn_poll.uuid)]=rtn_poll
|
||||
verbose('Created Poll: '..question..' ('..rtn_poll.uuid..')')
|
||||
return rtn_poll.uuid
|
||||
end
|
||||
|
||||
local function draw_poll(frame)
|
||||
@@ -86,18 +86,18 @@ local function draw_poll(frame)
|
||||
end
|
||||
end
|
||||
|
||||
local function _opptions(player,root_frame)
|
||||
local opptions = {'Please Select An Opption'}
|
||||
local function _options(player,root_frame)
|
||||
local options = {'Please Select An option'}
|
||||
local uuid = root_frame.name
|
||||
local poll = global.active[uuid]
|
||||
if not poll then return {'Invalid Poll'} end
|
||||
for _,answer in pairs(poll.answers) do
|
||||
table.insert(opptions,answer)
|
||||
table.insert(options,answer)
|
||||
end
|
||||
return opptions
|
||||
return options
|
||||
end
|
||||
|
||||
local opption_drop_down = Gui.inputs.add_drop_down('opption-drop-down-polls',_opptions,1,function(player,selected,items,element)
|
||||
local option_drop_down = Gui.inputs.add_drop_down('option-drop-down-polls',_options,1,function(player,selected,items,element)
|
||||
local uuid = element.parent.name
|
||||
local poll = global.active[uuid]
|
||||
if not poll then return end
|
||||
@@ -146,17 +146,17 @@ local poll_question_input = Gui.inputs.add_text('poll-question-input',true,'Ques
|
||||
else options.question.caption = text end
|
||||
end)
|
||||
|
||||
local _self_referace_poll_option_input = nil
|
||||
local _self_reference_poll_option_input = nil
|
||||
local poll_option_input = Gui.inputs.add_text('poll-option-input',true,'Enter Option',function(player,text,element)
|
||||
local options = element.parent.parent.parent.options
|
||||
if not options[element.parent.name] then options.add{type='label',name=element.parent.name,caption=text}
|
||||
else options[element.parent.name].caption = text end
|
||||
if options.last.caption == element.parent.name then
|
||||
options.last.caption = tonumber(options.last.caption)+1
|
||||
_self_referace_poll_option_input(element.parent.parent.add{type='flow',name=options.last.caption}).style.minimal_width = 200
|
||||
_self_reference_poll_option_input(element.parent.parent.add{type='flow',name=options.last.caption}).style.minimal_width = 200
|
||||
end
|
||||
end)
|
||||
_self_referace_poll_option_input = poll_option_input
|
||||
_self_reference_poll_option_input = poll_option_input
|
||||
|
||||
local function poll_assembler(frame)
|
||||
frame.clear()
|
||||
@@ -220,7 +220,7 @@ ThisModule.Gui = Gui.popup{
|
||||
flow.add{type='label',caption={'ExpGamingPlayer-polls.time-left',poll_time_out}}
|
||||
flow.add{type='label',caption='Question: '..poll.question}
|
||||
flow.add{type='label',name='answer',caption='Your Answer: None'}
|
||||
opption_drop_down(flow)
|
||||
option_drop_down(flow)
|
||||
end
|
||||
}:add_left{
|
||||
caption='utility/item_editor_icon',
|
||||
@@ -245,11 +245,11 @@ ThisModule.Gui = Gui.popup{
|
||||
caption='Viewing Poll: 1',
|
||||
style='caption_label'
|
||||
}
|
||||
local btn = next:draw(title)
|
||||
btn = next:draw(title)
|
||||
btn.style.width = 20
|
||||
btn.style.height = 20
|
||||
if Role and Role.allowed(frame.player_index,'create-poll') or game.players[frame.player_index].admin then
|
||||
local btn = create_poll:draw(title)
|
||||
btn = create_poll:draw(title)
|
||||
btn.style.width = 20
|
||||
btn.style.height = 20
|
||||
end
|
||||
@@ -269,5 +269,5 @@ ThisModule.Gui = Gui.popup{
|
||||
-- Event Handlers Define
|
||||
|
||||
-- Module Return
|
||||
-- when called it will toogle the left gui for this player
|
||||
-- when called it will toggle the left gui for this player
|
||||
return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end})
|
||||
Reference in New Issue
Block a user