mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 19:45:22 +09:00
Change to role.assign
This commit is contained in:
@@ -195,7 +195,6 @@ Manager.global=setmetatable({__defaults={},__global={
|
||||
for key,value in pairs(Global) do rawset(Global,key,nil) end
|
||||
for key,value in pairs(rawget(rawget(tbl,'__defaults'),tostring(module_name))) do rawset(Global,key,deepcopy(value)) end
|
||||
end
|
||||
if game then game.write_file('global/'..game.tick,serpent.line(_G.global)) end
|
||||
return setmetatable(Global,{
|
||||
__call=function(tbl,default) return Manager.global(default,tbl) end,
|
||||
__index=function(tbl,key) return rawget(Manager.global(),key) or moduleIndex[key] and Manager.global(key) end,
|
||||
|
||||
@@ -120,7 +120,7 @@ end
|
||||
function Role.assign(player,role,by_player,batch)
|
||||
local player = Game.get_player(player)
|
||||
if not player then error('Invalid player #1 given to Role.assign.',2) return end
|
||||
if not role then return end
|
||||
verbose('Assigning Roles: '..serpent.line(role)..' to: '..player.name)
|
||||
-- this loops over a table of role if given; will return if ipairs returns, else will asume it was ment to be a role and error
|
||||
if is_type(role,'table') and not role.name then
|
||||
local ctn = 0
|
||||
@@ -146,6 +146,7 @@ end
|
||||
function Role.unassign(player,role,by_player,batch)
|
||||
local player = Game.get_player(player)
|
||||
if not player then error('Invalid player #1 given to Role.unassign.',2) return end
|
||||
verbose('Assigning Roles: '..serpent.line(role)..' to: '..player.name)
|
||||
-- this loops over a table of role if given; will return if ipairs returns, else will asume it was ment to be a role and error
|
||||
if is_type(role,'table') and not role.name then
|
||||
local ctn = 0
|
||||
|
||||
@@ -45,7 +45,7 @@ global = _global{
|
||||
function ThisModule.remove_warp_point(name)
|
||||
local warp = global.warps[name]
|
||||
if not warp then return end
|
||||
local surface = warp.surface
|
||||
local surface = game.surfaces[warp.surface]
|
||||
local offset = warp.position
|
||||
local tiles = {}
|
||||
local tiles = {}
|
||||
@@ -102,7 +102,7 @@ function ThisModule.make_warp_point(position,surface,force,name)
|
||||
text='Warp: '..name,
|
||||
icon={type='item',name=warp_item}
|
||||
})
|
||||
global.warps[name] = {tag=tag,surface=surface,position=tag.position,old_tile=old_tile}
|
||||
global.warps[name] = {tag=tag,surface=surface.index,position=tag.position,old_tile=old_tile}
|
||||
local _temp = {Spawn=global.warps.Spawn}
|
||||
global.warps.Spawn = nil
|
||||
for name,data in pairs(table.keysort(global.warps)) do _temp[name] = data end
|
||||
@@ -133,7 +133,7 @@ local go_to_warp = Gui.inputs{
|
||||
if player.vehicle then player.vehicle.set_driver(nil) end
|
||||
if player.vehicle then player.vehicle.set_passenger(nil) end
|
||||
if player.vehicle then return end
|
||||
player.teleport(warp.surface.find_non_colliding_position('player',warp.position,32,1),warp.surface)
|
||||
player.teleport(game.surfaces[warp.surface].find_non_colliding_position('player',warp.position,32,1),game.surfaces[warp.surface])
|
||||
if not Role and not player.admin or Role and not Role.allowed(player,'always-warp') then
|
||||
event.element.parent.parent.parent.parent.style.visible = false
|
||||
global.cooldowns[event.player_index] = warp_limit
|
||||
@@ -161,7 +161,7 @@ ThisModule.Gui = Gui.left{
|
||||
}
|
||||
for name,warp in pairs(global.warps) do
|
||||
if not warp.tag or not warp.tag.valid then
|
||||
player.force.add_chart_tag(warp.surface,{
|
||||
player.force.add_chart_tag(game.surfaces[warp.surface],{
|
||||
position=warp.position,
|
||||
text='Warp: '..name,
|
||||
icon={type='item',name=warp_item}
|
||||
|
||||
Reference in New Issue
Block a user