mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-28 20:05:22 +09:00
Converted Modules To Use Roles
This commit is contained in:
@@ -37,7 +37,7 @@ script.on_event(defines.events.on_player_respawned,function(event)
|
||||
end
|
||||
end)
|
||||
|
||||
-- overided by ExpGamingCore.Ranking if present
|
||||
-- overided by ExpGamingCore.Role if present
|
||||
script.on_event(defines.events.on_pre_player_died,function(event)
|
||||
local player = Game.get_player(event)
|
||||
if player.admin then
|
||||
@@ -54,26 +54,26 @@ end)
|
||||
|
||||
return {
|
||||
on_init= function(self)
|
||||
if loaded_modules['ExpGamingCore.Ranking@^4.0.0'] then
|
||||
local Ranking = require('ExpGamingCore.Ranking@^4.0.0')
|
||||
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then
|
||||
local Role = require('ExpGamingCore.Role@^4.0.0')
|
||||
-- instant respawn
|
||||
script.on_event(defines.events.on_pre_player_died,function(event)
|
||||
local player = Game.get_player(event)
|
||||
if Ranking.get_rank(player):allowed('bonus-respawn') then
|
||||
if Role.allowed(player,'bonus-respawn') then
|
||||
player.ticks_to_respawn = 120
|
||||
-- manually dispatch death event because it is not fired when ticks_to_respawn is set pre death
|
||||
Event.dispatch{
|
||||
script.raise_event(defines.events.on_player_died,{
|
||||
name=defines.events.on_player_died,
|
||||
tick=event.tick,
|
||||
player_index=event.player_index,
|
||||
cause = event.cause
|
||||
}
|
||||
})
|
||||
end
|
||||
end)
|
||||
-- either clears or adds default when rank changed
|
||||
script.on_event(defines.events.rank_change,function(event)
|
||||
script.on_event(defines.events.role_change,function(event)
|
||||
local player = Game.get_player(event)
|
||||
if event.new_rank:allowed('bonus') then
|
||||
if Role.allowed(player,'bonus') then
|
||||
for _,setting in pairs(settings) do player[key] = setting*0.2 end
|
||||
global[player.index]=20
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user