mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 19:45:22 +09:00
Added Tree Decon
This commit is contained in:
51
Addons/Admin/tree-decon.lua
Normal file
51
Addons/Admin/tree-decon.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
This file can be used with permission but this and the credit below must remain in the file.
|
||||
Contact a member of management on our discord to seek permission to use our code.
|
||||
Any changes that you may make to the code are yours but that does not make the script yours.
|
||||
Discord: https://discord.gg/r6dC2uK
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
|
||||
Event.register(-1,function(event)
|
||||
Server.new_thread{
|
||||
name='tree-decon',
|
||||
data={trees={},chache={},clear=0}
|
||||
}:on_event('tick',function(self)
|
||||
local trees = self.data.trees
|
||||
if self.data.clear ~= 0 and self.data.clear < game.tick then self.data.chache = {} self.data.clear = 0 end
|
||||
if #trees == 0 then return end
|
||||
for i = 0,math.ceil(#trees/10) do
|
||||
local tree = table.remove(trees,1)
|
||||
if tree and tree.valid then tree.destroy() end
|
||||
end
|
||||
end):on_event(defines.events.on_marked_for_deconstruction,function(self,event)
|
||||
local chache = self.data.chache[event.player_index]
|
||||
if not chache then
|
||||
local player = Game.get_player(event)
|
||||
local rank = Ranking.get_rank(player)
|
||||
if rank:allowed('tree-decon') then self.data.chache[event.player_index] = {'tree-decon',false}
|
||||
elseif not rank:allowed('decon') then self.data.chache[event.player_index] = {'no-decon',false} end
|
||||
chache = self.data.chache[event.player_index]
|
||||
end
|
||||
if not event.entity.last_user then
|
||||
if chache[1] == 'tree-decon' then
|
||||
table.insert(self.data.trees,event.entity)
|
||||
self.data.clear = game.tick + 10
|
||||
end
|
||||
else
|
||||
if chache[1] == 'no-decon' then
|
||||
event.entity.cancel_deconstruction('player')
|
||||
if not chache[2] then
|
||||
chache[2] = true
|
||||
local player = Game.get_player(event)
|
||||
player_return({'tree-decon.player-print'},defines.text_color.crit,player)
|
||||
local rank = Ranking.get_group('Admin').lowest
|
||||
Ranking.print(rank,{'tree-decon.rank-print',player.name},defines.text_color.info)
|
||||
self.data.clear = game.tick + 10
|
||||
end
|
||||
end
|
||||
end
|
||||
end):open()
|
||||
end)
|
||||
@@ -21,6 +21,7 @@ require('Admin/player-info')
|
||||
require('Admin/admin') -- used with Guis/admin-gui, but can work without
|
||||
require('Admin/discord')
|
||||
require('Admin/auto-message')
|
||||
require('Admin/tree-decon')
|
||||
|
||||
-- commands dir
|
||||
require('Commands/cheat-mode')
|
||||
|
||||
@@ -141,12 +141,16 @@ ranks['Mod']:edit('allow',false,{
|
||||
['bring']=true
|
||||
})
|
||||
|
||||
ranks['Donator']:edit('allow',false,{
|
||||
['tree-decon']=true
|
||||
})
|
||||
ranks['Member']:edit('allow',false,{
|
||||
['edit-tasklist']=true,
|
||||
['repair']=true
|
||||
})
|
||||
ranks['Regular']:edit('allow',false,{
|
||||
['kill']=true
|
||||
['kill']=true,
|
||||
['decon']=true
|
||||
})
|
||||
ranks['Guest']:edit('allow',false,{
|
||||
['tag']=true,
|
||||
|
||||
3
locale/en/tree-decon.cfg
Normal file
3
locale/en/tree-decon.cfg
Normal file
@@ -0,0 +1,3 @@
|
||||
[tree-decon]
|
||||
player-print=You are not allowed to do this yet, You require the Regular rank, you must play for at least 3 hours
|
||||
rank-print=__1__ tried to deconstruct something.
|
||||
Reference in New Issue
Block a user