mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Most bugs caught
This commit is contained in:
@@ -54,7 +54,7 @@ script.on_init(function(event)
|
||||
local data = self.data
|
||||
if not data.high_role or not data.low_role
|
||||
or not data.low then self.reopen = false return end
|
||||
-- idk but this stoped working for no appent reason so i added more checks for nil values
|
||||
-- idk but this stoped working for no appent reason so i added more checks for nil values
|
||||
if Role and Role.get_highest(player).index <= Role.get(data.low_role).index or player.admin then return end
|
||||
for _,message in pairs(data.low) do
|
||||
player_return({'ExpGamingBot-autoMessage.message',message},nil,player)
|
||||
|
||||
@@ -147,7 +147,7 @@ function commands.get_commands(player)
|
||||
if not player then return error('Invalid player',2) end
|
||||
for name,data in pairs(data) do
|
||||
if #middleware > 0 then for _,callback in pairs(middleware) do
|
||||
local success, err = pcall(callback,player_name,command.name,command)
|
||||
local success, err = pcall(callback,player,name,data)
|
||||
if not success then error(err)
|
||||
elseif err then table.insert(commands,data) end
|
||||
end elseif data.default_admin_only == true and player.admin then table.insert(commands,data) end
|
||||
|
||||
@@ -27,6 +27,7 @@ Gui.data = setmetatable({},{
|
||||
})
|
||||
|
||||
local events = {}
|
||||
local order_config = require(module_path..'/order_config')
|
||||
|
||||
Gui.center = require(module_path..'/src/center',{Gui=Gui})
|
||||
table.merge(events,Gui.center._events)
|
||||
@@ -36,9 +37,9 @@ Gui.inputs = require(module_path..'/src/inputs',{Gui=Gui})
|
||||
table.merge(events,Gui.inputs._events)
|
||||
Gui.inputs._events = nil
|
||||
|
||||
Gui.left = require(module_path..'/src/left',{Gui=Gui})
|
||||
Gui.left = require(module_path..'/src/left',{Gui=Gui,order_config=order_config})
|
||||
Gui.popup = require(module_path..'/src/popup',{Gui=Gui})
|
||||
Gui.toolbar = require(module_path..'/src/toolbar',{Gui=Gui})
|
||||
Gui.toolbar = require(module_path..'/src/toolbar',{Gui=Gui,order_config=order_config})
|
||||
|
||||
for event,callback in pairs(events) do script.on_event(event,callback) end
|
||||
|
||||
|
||||
12
modules/ExpGamingCore/Gui/order_config.lua
Normal file
12
modules/ExpGamingCore/Gui/order_config.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
'readme',
|
||||
'science',
|
||||
'rockets',
|
||||
'player-list',
|
||||
'tasklist',
|
||||
'warp-list',
|
||||
'polls',
|
||||
'announcements',
|
||||
'admin-commands',
|
||||
'game-settings'
|
||||
}
|
||||
@@ -13,10 +13,21 @@ local Color = require('FactorioStdLib.Color')
|
||||
local Role -- this is optional and is hanndled by it being present, it is loaded on init
|
||||
local mod_gui = require("mod-gui")
|
||||
local Gui = Gui -- this is to force gui to remain in the ENV
|
||||
local order_config = order_config
|
||||
|
||||
local left = {}
|
||||
left._prototype = {}
|
||||
|
||||
left.hide = Gui.inputs{
|
||||
name='gui-left-hide',
|
||||
type='button',
|
||||
caption='<'
|
||||
}:on_event('click',function(event)
|
||||
for _,child in pairs(event.element.parent.children) do
|
||||
if child.name ~= 'popups' then child.style.visible = false end
|
||||
end
|
||||
end)
|
||||
|
||||
-- used for debugging
|
||||
function left.override_open(state)
|
||||
global.over_ride_left_can_open = state
|
||||
@@ -63,9 +74,7 @@ function left.update(frame,players)
|
||||
data={player=player,frames=thread.data.frames}
|
||||
}:on_event('resolve',function(thread)
|
||||
for name,left in pairs(thread.data.frames) do
|
||||
if left then
|
||||
left:first_open(thread.data.player)
|
||||
end
|
||||
if left then left:first_open(thread.data.player) end
|
||||
end
|
||||
end):queue()
|
||||
end):open()
|
||||
@@ -119,20 +128,26 @@ end
|
||||
-- @usage left:open(player)
|
||||
-- @tparam luaPlayer player the player to open the gui for
|
||||
function left._prototype:open(player)
|
||||
local player = Game.get_player(event)
|
||||
local player = Game.get_player(player)
|
||||
if not player then error('Invalid Player') end
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if not left_flow[_left.name] then self:first_open(player) end
|
||||
left_flow[_left.name].style.visible = true
|
||||
if not left_flow[self.name] then self:first_open(player) end
|
||||
left_flow[self.name].style.visible = true
|
||||
left_flow['gui-left-hide'].style.visible = true
|
||||
end
|
||||
|
||||
--- Used to force the gui closed for the player
|
||||
-- @usage left:open(player)
|
||||
-- @tparam luaPlayer player the player to close the gui for
|
||||
function left._prototype:close(player)
|
||||
local player = Game.get_player(event)
|
||||
local player = Game.get_player(player)
|
||||
if not player then error('Invalid Player') end
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if not left_flow[_left.name] then self:first_open(player) end
|
||||
left_flow[_left.name].style.visible = false
|
||||
if not left_flow[self.name] then self:first_open(player) end
|
||||
left_flow[self.name].style.visible = false
|
||||
local count = 0
|
||||
for _,child in pairs(left_flow.children) do if child.style.visible then count = count+1 end if count > 1 then break end end
|
||||
if count == 1 then left_flow['gui-left-hide'].style.visible = false end
|
||||
end
|
||||
|
||||
--- When the gui is first made or is updated this function is called, used by the script
|
||||
@@ -149,9 +164,9 @@ function left._prototype:first_open(player)
|
||||
else
|
||||
frame = left_flow.add{type='frame',name=self.name,style=mod_gui.frame_style,caption=self.caption,direction='vertical'}
|
||||
frame.style.visible = false
|
||||
if is_type(self.open_on_join,'boolean') then frame.style.visible = self.open_on_join end
|
||||
if is_type(self.open_on_join,'boolean') then frame.style.visible = self.open_on_join left_flow['gui-left-hide'].style.visible = true end
|
||||
end
|
||||
if is_type(self.draw,'function') then self.draw(frame) else frame.style.visible = false error('No Callback On '.._left.name) end
|
||||
if is_type(self.draw,'function') then self.draw(frame) else frame.style.visible = false error('No Callback On '..self.name) end
|
||||
return frame
|
||||
end
|
||||
|
||||
@@ -162,29 +177,33 @@ end
|
||||
function left._prototype:toggle(player)
|
||||
local player = Game.get_player(player)
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if not left_flow[_left.name] then _left:first_open(player) end
|
||||
local left = left_flow[_left.name]
|
||||
if not left_flow[self.name] then self:first_open(player) end
|
||||
local left = left_flow[self.name]
|
||||
local open = false
|
||||
if is_type(_left.can_open,'function') then
|
||||
local success, err = pcall(_left.can_open,player)
|
||||
if is_type(self.can_open,'function') then
|
||||
local success, err = pcall(self.can_open,player)
|
||||
if not success then error(err)
|
||||
elseif err == true then open = true
|
||||
elseif global.over_ride_left_can_open then
|
||||
if is_type(Role,'table') then
|
||||
if Role.allowed(player,_left.name) then open = true
|
||||
if Role.allowed(player,self.name) then open = true
|
||||
else open = {'ExpGamingCore_Gui.unauthorized'} end
|
||||
else open = true end
|
||||
else open = err end
|
||||
else
|
||||
if is_type(Role,'table') then
|
||||
if Role.allowed(player,_left.name) then open = true
|
||||
if Role.allowed(player,self.name) then open = true
|
||||
else open = {'ExpGamingCore_Gui.unauthorized'} end
|
||||
else open = true end
|
||||
end
|
||||
if open == true and left.style.visible ~= true then
|
||||
left.style.visible = true
|
||||
left_flow['gui-left-hide'].style.visible = true
|
||||
else
|
||||
left.style.visible = false
|
||||
local count = 0
|
||||
for _,child in pairs(left_flow.children) do if child.style.visible then count = count+1 end if count > 1 then break end end
|
||||
if count == 1 then left_flow['gui-left-hide'].style.visible = false end
|
||||
end
|
||||
if open == false then player_return({'ExpGamingCore_Gui.cant-open-no-reason'},defines.textcolor.crit,player) player.play_sound{path='utility/cannot_build'}
|
||||
elseif open ~= true then player_return({'ExpGamingCore_Gui.cant-open',open},defines.textcolor.crit,player) player.play_sound{path='utility/cannot_build'} end
|
||||
@@ -195,8 +214,17 @@ left.on_player_joined_game = function(event)
|
||||
-- draws the left guis when a player first joins, fake_event is just because i am lazy
|
||||
local player = Game.get_player(event)
|
||||
local frames = Gui.data.left or {}
|
||||
left.hide(mod_gui.get_frame_flow(player)).style.maximal_width=15
|
||||
local done = {}
|
||||
for _,name in pairs(order_config) do
|
||||
local left = Gui.data.left[name]
|
||||
if left then
|
||||
done[name] = true
|
||||
left:first_open(player)
|
||||
end
|
||||
end
|
||||
for name,left in pairs(frames) do
|
||||
left:first_open(player)
|
||||
if not done[name] then left:first_open(player) end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@ function popup.load()
|
||||
tooltip='Close This Popup'
|
||||
}:on_event('click',function(event)
|
||||
local frame = event.element.parent
|
||||
if frame and frame.valid then frame.destroy() end
|
||||
local parent = frame.parent
|
||||
if frame and frame.valid then frame.destroy() if #parent.children == 0 then parent.style.visible = false end end
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -45,7 +46,9 @@ end
|
||||
-- this is used by the script to find the popup flow
|
||||
function popup.flow(player)
|
||||
local player = Game.get_player(player)
|
||||
local flow = mod_gui.get_frame_flow(player).popups or mod_gui.get_frame_flow(player).add{name='popups',type='flow',direction='vertical'}
|
||||
if not player then error('Invalid Player',2) end
|
||||
local flow = mod_gui.get_frame_flow(player).popups
|
||||
if not flow then flow = mod_gui.get_frame_flow(player).add{name='popups',type='flow',direction='vertical'} flow.style.visible=false end
|
||||
return flow
|
||||
end
|
||||
|
||||
@@ -59,10 +62,11 @@ function popup.open(style,data,players)
|
||||
local players = players or game.connected_players
|
||||
local data = data or {}
|
||||
if not _popup then return end
|
||||
if _popup.left then Gui.left.close(_popup.left.name) end
|
||||
if not Server or not Server._thread then
|
||||
for _,player in pairs(players) do
|
||||
if _popup.left then _popup.left:close(player) end
|
||||
local flow = popup.flow(player)
|
||||
flow.style.visible=true
|
||||
local _frame = flow.add{
|
||||
type='frame',
|
||||
direction='horizontal',
|
||||
@@ -86,7 +90,9 @@ function popup.open(style,data,players)
|
||||
}:on_event('tick',function(thread)
|
||||
if #thread.data.players == 0 then thread:close() return end
|
||||
local player = table.remove(thread.data.players,1)
|
||||
if _popup.left then _popup.left:close(player) end
|
||||
local flow = popup.flow(player)
|
||||
flow.style.visible=true
|
||||
local _frame = flow.add{
|
||||
type='frame',
|
||||
direction='horizontal',
|
||||
|
||||
@@ -161,7 +161,7 @@ local send_popup = Gui.inputs{
|
||||
}:on_event('click',function(event)
|
||||
local player = Game.get_player(event)
|
||||
local message = event.element.parent['test-popup-text'].text
|
||||
Gui.popup.open('test-popup',{player=player.name,message=message})
|
||||
Gui.popup.open('test-popup',{message=message,player=player.name})
|
||||
end)
|
||||
Gui.popup{
|
||||
name='test-popup',
|
||||
|
||||
@@ -11,9 +11,28 @@ local Game = require('FactorioStdLib.Game')
|
||||
local Role -- this is optional and is hanndled by it being present, it is loaded on init
|
||||
local mod_gui = require("mod-gui")
|
||||
local Gui = Gui -- this is to force gui to remain in the ENV
|
||||
local order_config = order_config
|
||||
|
||||
local toolbar = {}
|
||||
|
||||
toolbar.hide = Gui.inputs{
|
||||
name='gui-toolbar-hide',
|
||||
type='button',
|
||||
caption='<'
|
||||
}:on_event('click',function(event)
|
||||
if event.element.caption == '<' then
|
||||
event.element.caption = '>'
|
||||
for _,child in pairs(event.element.parent.children) do
|
||||
if child.name ~= event.element.name then child.style.visible = false end
|
||||
end
|
||||
else
|
||||
event.element.caption = '<'
|
||||
for _,child in pairs(event.element.parent.children) do
|
||||
if child.name ~= event.element.name then child.style.visible = true end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
--- Add a button to the toolbar, ranks need to be allowed to use these buttons if ranks is preset
|
||||
-- @usage toolbar.add('foo','Foo','Test',function() game.print('test') end)
|
||||
-- @tparam string name the name of the button
|
||||
@@ -38,12 +57,27 @@ function toolbar.draw(player)
|
||||
local toolbar_frame = mod_gui.get_button_flow(player)
|
||||
toolbar_frame.clear()
|
||||
if not Gui.data.toolbar then return end
|
||||
toolbar.hide(toolbar_frame).style.maximal_width = 15
|
||||
local done = {}
|
||||
for _,name in pairs(order_config) do
|
||||
local button = Gui.data.toolbar[name]
|
||||
if button then
|
||||
done[name] = true
|
||||
if is_type(Role,'table') then
|
||||
if Role.allowed(player,name) then
|
||||
button(toolbar_frame)
|
||||
end
|
||||
else button(toolbar_frame) end
|
||||
end
|
||||
end
|
||||
for name,button in pairs(Gui.data.toolbar) do
|
||||
if is_type(Role,'table') then
|
||||
if Role.allowed(player,name) then
|
||||
button(toolbar_frame)
|
||||
end
|
||||
else button(toolbar_frame) end
|
||||
if not done[name] then
|
||||
if is_type(Role,'table') then
|
||||
if Role.allowed(player,name) then
|
||||
button(toolbar_frame)
|
||||
end
|
||||
else button(toolbar_frame) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ local Role = {
|
||||
rawset(tbl,key,Role.define(value))
|
||||
end
|
||||
}),
|
||||
on_init=function()
|
||||
on_init=function(self)
|
||||
if loaded_modules['ExpGamingCore.Server@^4.0.0'] then require('ExpGamingCore.Server@^4.0.0').add_module_to_interface('Role','ExpGamingCore.Role') end
|
||||
if loaded_modules['ExpGamingCore.Command@^4.0.0'] then require(module_path..'/src/commands',{Role=Role}) end
|
||||
if loaded_modules['ExpGamingCore.Command@^4.0.0'] then require(module_path..'/src/commands',{self=self}) end
|
||||
end,
|
||||
on_post=function(self)
|
||||
-- loads the roles in config
|
||||
@@ -399,8 +399,8 @@ function Role._prototype:add_player(player,by_player,batch)
|
||||
by_player_index=by_player.index,
|
||||
old_highest=highest.name,
|
||||
role_name=self.name,
|
||||
batch=batch[2] or {self.name},
|
||||
batch_index=batch[1] or 1,
|
||||
batch=batch and batch[2] or {self.name},
|
||||
batch_index=batch and batch[1] or 1,
|
||||
effect='assign'
|
||||
})
|
||||
end
|
||||
@@ -430,8 +430,8 @@ function Role._prototype:remove_player(player,by_player,batch)
|
||||
by_player_index=by_player.index,
|
||||
old_highest=highest.name,
|
||||
role_name=self.name,
|
||||
batch=batch[2] or {self.name},
|
||||
batch_index=batch[1] or 1,
|
||||
batch=batch and batch[2] or {self.name},
|
||||
batch_index=batch and batch[1] or 1,
|
||||
effect='unassign'
|
||||
})
|
||||
end
|
||||
@@ -441,7 +441,7 @@ script.on_event(role_change_event_id,function(event)
|
||||
-- varible init
|
||||
local player = Game.get_player(event)
|
||||
local by_player = Game.get_player(event.by_player_index) or SERVER
|
||||
local role = Role.get(event.role_name)
|
||||
local role = Role.get(event.role_name)
|
||||
local highest = Role.get_highest(player) or {__faild=true,tag='',name='None'}
|
||||
-- gets the falgs the player currently has
|
||||
for flag,callback in pairs(Role.flags) do if is_type(callback,'function') then callback(player,Role.has_flag(player,flag)) end end
|
||||
@@ -458,8 +458,9 @@ script.on_event(role_change_event_id,function(event)
|
||||
if player.online_time > 60 then
|
||||
-- send a message to other players
|
||||
if event.batch_index == 1 then
|
||||
local name = table.concat(event.batch,', ')
|
||||
if event.effect == 'assign' then game.print{'ExpGamingCore-Role.default-print',{'ExpGamingCore-Role.assign',player.name,name,by_player.name}}
|
||||
local names = {}
|
||||
for _,name in pairs(event.batch) do local role = Role.get(name) if role then table.insert(names,role.name) end end
|
||||
if event.effect == 'assign' then game.print{'ExpGamingCore-Role.default-print',{'ExpGamingCore-Role.assign',player.name,table.concat(names,', '),by_player.name}}
|
||||
else game.print{'ExpGamingCore-Role.default-print',{'ExpGamingCore-Role.unassign',player.name,name,by_player.name}} end
|
||||
end
|
||||
-- log change to file
|
||||
@@ -482,6 +483,7 @@ end)
|
||||
|
||||
script.on_event(defines.events.on_player_joined_game,function(event)
|
||||
local player = Game.get_player(event)
|
||||
log(serpent.line(event))
|
||||
local highest = Role.get_highest(player) or Role.meta.default
|
||||
Group.assign(player,highest.group)
|
||||
player.tag=highest.tag
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local Role = Role
|
||||
local Role = self
|
||||
|
||||
commands.add_validation('player-rank',function(value,event)
|
||||
local player,err = commands.validate['player'](value)
|
||||
|
||||
@@ -407,7 +407,7 @@ function Server._thread:check_timeout()
|
||||
if is_type(self.timeout,'number') and game.tick >= (self.opened+self.timeout) then
|
||||
if is_type(self._timeout,'function') then
|
||||
-- we do not care if the time out has caused an error as it is in most cases an error in its own right
|
||||
Manager.sandbox(self._timeout,thread._env,self)
|
||||
Manager.sandbox(self._timeout,self._env,self)
|
||||
end
|
||||
_return = true
|
||||
-- closes the thread to provent any further event calls
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
[ExpGamingCore_Server]
|
||||
interface-description=Runs the given input from the script
|
||||
@@ -23,7 +23,7 @@ Server.add_module_to_interface('Server','ExpGamingCore.Server')
|
||||
--- Runs the given input from the script
|
||||
-- @command interface
|
||||
-- @param code The code that will be ran
|
||||
commands.add_command('interface',{'ExpGamingCore_Server.interface-description'}, {
|
||||
commands.add_command('interface','Runs the given input from the script', {
|
||||
['code']={true,'string-inf'}
|
||||
}, function(event,args)
|
||||
local callback = args.code
|
||||
|
||||
@@ -99,4 +99,4 @@ script.on_event(defines.events.on_gui_click,function(event)
|
||||
end
|
||||
end)
|
||||
|
||||
script.on_event(defines.events.on_player_joined_game,Sync.info_gui)
|
||||
script.on_event(defines.events.on_player_joined_game,function(event) Sync.info_gui(event) end)
|
||||
@@ -36,7 +36,9 @@ end
|
||||
-- Adds a caption to the info gui that shows the rank given to the player
|
||||
if Sync.add_to_gui then
|
||||
Sync.add_to_gui(function(player,frame)
|
||||
return 'You have been assigned the rank \''..Role.get_highest(player).name..'\''
|
||||
local names = {}
|
||||
for _,role in pairs(Role.get(player)) do table.insert(names,role.name) end
|
||||
return 'You have been assigned the roles: '..table.concat(names,', ')
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ local module_verbose = false
|
||||
local ThisModule = {
|
||||
on_init=function(self)
|
||||
if loaded_modules['ExpGamingPlayer.playerInfo'] then playerInfo = require('ExpGamingPlayer.playerInfo') end
|
||||
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then getPlayers = require(module_path..'/src/ranking') end
|
||||
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then getPlayers = require(module_path..'/src/ranking',{self=self}) end
|
||||
if loaded_modules['ExpGamingAdmin.AdminLib@^4.0.0'] then Admin = require('ExpGamingAdmin.AdminLib@^4.0.0') end
|
||||
end
|
||||
}
|
||||
@@ -134,7 +134,6 @@ end)
|
||||
|
||||
script.on_event(defines.events.on_player_joined_game,ThisModule.update)
|
||||
script.on_event(defines.events.on_player_left_game,ThisModule.update)
|
||||
script.on_event(defines.events.rank_change,ThisModule.update)
|
||||
|
||||
ThisModule.force_update = function() return ThisModule.Gui() end
|
||||
-- when called it will queue an update to the player list
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
local Role = require('ExpGamingCore.Role@^4.0.0')
|
||||
|
||||
script.on_event(defines.events.on_role_change,self.update)
|
||||
|
||||
return function()
|
||||
local rtn = {}
|
||||
for _,role_name in pairs(Role.order) do
|
||||
|
||||
@@ -17,7 +17,7 @@ local ThisModule = {}
|
||||
|
||||
-- Function Define
|
||||
local function _roles(player)
|
||||
local roles = {'Select Rank'}
|
||||
local roles = {'Select Role'}
|
||||
local _role = Role.get_highest(player)
|
||||
for index,role_name in pairs(Role.order) do
|
||||
if index >= _role.index then
|
||||
@@ -29,7 +29,7 @@ end
|
||||
|
||||
local role_drop_down = Gui.inputs.add_drop_down('rank-drop-down-annoncements',_roles,1,function(player,selected,items,element)
|
||||
element.parent.role.caption = selected
|
||||
if selected == 'Select Rank' then element.parent['send-annoncement'].style.visible = false
|
||||
if selected == 'Select Role' then element.parent['send-annoncement'].style.visible = false
|
||||
else element.parent['send-annoncement'].style.visible = true end
|
||||
end)
|
||||
|
||||
@@ -45,12 +45,8 @@ local send_popup = Gui.inputs{
|
||||
local role_name = _role.name..'s'; if rank_name == Role.meta.default.name..'s' then rank_name = 'Everyone' end
|
||||
local sent_to = {'announcements.sent-to',rank_name}
|
||||
local message = event.element.parent.parent.message.text
|
||||
for index,_role_name in pairs(Role.order) do
|
||||
if index <= _role.index then
|
||||
Gui.popup.open('announcements',{sent_by=sent_by,sent_to=sent_to,message=message},Role.get(_role_name):get_players(true))
|
||||
event.element.parent.parent.message.text = ''
|
||||
end
|
||||
end
|
||||
Gui.popup.open('announcements',{sent_by=sent_by,sent_to=sent_to,message=message},_role:get_players(true))
|
||||
event.element.parent.parent.message.text = ''
|
||||
end)
|
||||
|
||||
ThisModule.Gui = Gui.popup{
|
||||
@@ -98,7 +94,7 @@ ThisModule.Gui = Gui.popup{
|
||||
btn.style.width = 25
|
||||
flow.add{
|
||||
type='label',
|
||||
name='rank',
|
||||
name='role',
|
||||
caption=''
|
||||
}.style.visible = false
|
||||
end
|
||||
|
||||
@@ -69,7 +69,7 @@ script.on_event(defines.events.on_player_changed_position, function(event)
|
||||
end end
|
||||
local chance = paths[tile_name][1]/(count-adjacency_boost)
|
||||
if math.random() < chance then
|
||||
down_grade(surface,pos)
|
||||
ThisModule.down_grade(surface,pos)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user