1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-07-15 01:04:17 +02:00

Merge pull request #247 from ComfyFactory/changes

Small changes
This commit is contained in:
Gerkiz
2022-04-08 22:40:46 +02:00
committed by GitHub
9 changed files with 962 additions and 762 deletions

View File

@ -32,9 +32,9 @@ require 'utils.gui'
require 'utils.gui.player_list' require 'utils.gui.player_list'
require 'utils.gui.admin' require 'utils.gui.admin'
require 'utils.gui.group' require 'utils.gui.group'
require 'utils.gui.poll'
require 'utils.gui.score' require 'utils.gui.score'
require 'utils.gui.config' require 'utils.gui.config'
require 'utils.gui.poll'
require 'utils.gui.server_select' require 'utils.gui.server_select'
require 'utils.freeplay' require 'utils.freeplay'

View File

@ -74,6 +74,7 @@ local Public = {}
local raise_event = script.raise_event local raise_event = script.raise_event
local floor = math.floor local floor = math.floor
local remove = table.remove local remove = table.remove
RPG.disable_cooldowns_on_spells()
local collapse_kill = { local collapse_kill = {
entities = { entities = {
@ -178,7 +179,6 @@ function Public.reset_map()
RPG.enable_aoe_punch_globally(false) RPG.enable_aoe_punch_globally(false)
RPG.enable_range_buffs(true) RPG.enable_range_buffs(true)
RPG.enable_auto_allocate(true) RPG.enable_auto_allocate(true)
RPG.disable_cooldowns_on_spells()
RPG.enable_explosive_bullets_globally(true) RPG.enable_explosive_bullets_globally(true)
RPG.enable_explosive_bullets(false) RPG.enable_explosive_bullets(false)
RPG_Progression.toggle_module(false) RPG_Progression.toggle_module(false)

View File

@ -1,5 +1,8 @@
local Public = require 'modules.rpg.table' local Public = require 'modules.rpg.table'
local Spells = require 'modules.rpg.spells'
Public.spells = Spells
local Bullets = require 'modules.rpg.explosive_gun_bullets' local Bullets = require 'modules.rpg.explosive_gun_bullets'
Public.explosive_bullet = Bullets Public.explosive_bullet = Bullets
@ -15,9 +18,6 @@ Public.gui = Gui
local Settings = require 'modules.rpg.settings' local Settings = require 'modules.rpg.settings'
Public.settings = Settings Public.settings = Settings
local Spells = require 'modules.rpg.spells'
Public.spells = Spells
local Commands = require 'modules.rpg.commands' local Commands = require 'modules.rpg.commands'
Public.commands = Commands Public.commands = Commands

View File

@ -569,9 +569,16 @@ function Public.cast_spell(player, failed)
} }
player.surface.create_entity({name = 'flying-text', position = p, text = '✔️', color = {255, math.random(0, 100), 0}}) player.surface.create_entity({name = 'flying-text', position = p, text = '✔️', color = {255, math.random(0, 100), 0}})
end end
player.play_sound {path = 'utility/scenario_message', volume_modifier = 0.50} player.play_sound {path = 'utility/scenario_message', volume_modifier = 1}
else else
player.play_sound {path = 'utility/cannot_build', volume_modifier = 0.50} for _ = 1, 3, 1 do
local p = {
(position.x + 0.4) + (b * -1 + math.random(0, b * 20) * 0.1),
position.y + (b * -1 + math.random(0, b * 20) * 0.1)
}
player.surface.create_entity({name = 'flying-text', position = p, text = '', color = {255, math.random(0, 100), 0}})
end
player.play_sound {path = 'utility/cannot_build', volume_modifier = 1}
end end
end end
@ -852,6 +859,7 @@ function Public.rpg_reset_all_players()
rpg_extra.global_pool = 0 rpg_extra.global_pool = 0
end end
-- local Public = require 'modules.rpg.table' Public.gain_xp(game.players['Gerkiz'], 5012, true)
function Public.gain_xp(player, amount, added_to_pool, text) function Public.gain_xp(player, amount, added_to_pool, text)
if not Public.validate_player(player) then if not Public.validate_player(player) then
return return

View File

@ -1009,33 +1009,6 @@ local function on_player_joined_game(event)
Public.update_player_stats(player) Public.update_player_stats(player)
end end
local function create_projectile(surface, name, position, force, target, max_range)
if max_range then
surface.create_entity(
{
name = name,
position = position,
force = force,
source = position,
target = target,
max_range = max_range,
speed = 0.4
}
)
else
surface.create_entity(
{
name = name,
position = position,
force = force,
source = position,
target = target,
speed = 0.4
}
)
end
end
local function get_near_coord_modifier(range) local function get_near_coord_modifier(range)
local coord = {x = (range * -1) + random(0, range * 2), y = (range * -1) + random(0, range * 2)} local coord = {x = (range * -1) + random(0, range * 2), y = (range * -1) + random(0, range * 2)}
for i = 1, 5, 1 do for i = 1, 5, 1 do
@ -1117,7 +1090,7 @@ local function on_player_used_capsule(event)
return return
end end
local conjure_items = Public.get_spells() local conjure_items = Public.spells
local projectile_types = Public.get_projectiles local projectile_types = Public.get_projectiles
local player = game.players[event.player_index] local player = game.players[event.player_index]
@ -1215,100 +1188,21 @@ local function on_player_used_capsule(event)
force = 'player' force = 'player'
end end
if object.entityName == 'suicidal_comfylatron' then local data = {
Public.suicidal_comfylatron(position, surface) self = object,
Public.cast_spell(player) player = player,
Public.remove_mana(player, object.mana_cost) damage_entity = damage_entity,
elseif object.entityName == 'repair_aoe' then position = position,
Public.repair_aoe(player, position) surface = surface,
Public.cast_spell(player) force = force,
Public.remove_mana(player, object.mana_cost) target_pos = target_pos,
elseif object.entityName == 'pointy_explosives' then range = range,
local entities = mana = rpg_t.mana,
player.surface.find_entities_filtered { tame_unit_effects = tame_unit_effects,
force = player.force, explosives = Explosives
type = 'container',
area = {{position.x - 1, position.y - 1}, {position.x + 1, position.y + 1}}
} }
local detonate_chest object.callback(data)
for i = 1, #entities do
local e = entities[i]
detonate_chest = e
end
if detonate_chest and detonate_chest.valid then
local success = Explosives.detonate_chest(detonate_chest)
if success then
Public.remove_mana(player, object.mana_cost)
end
Public.cast_spell(player)
end
elseif object.entityName == 'warp-gate' then
local pos = surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5)
if pos then
player.teleport(pos, surface)
else
pos = game.forces.player.get_spawn_position(surface)
player.teleport(pos, surface)
end
Public.remove_mana(player, 999999)
Public.damage_player_over_time(player, random(8, 16))
player.play_sound {path = 'utility/armor_insert', volume_modifier = 1}
Public.cast_spell(player)
elseif object.capsule then -- spawn in capsules i.e objects that are usable with mouse-click
player.insert({name = object.entityName, count = object.amount})
Public.cast_spell(player)
Public.remove_mana(player, object.mana_cost)
elseif projectile_types[object.entityName] then -- projectiles
for i = 1, object.amount do
local damage_area = {
left_top = {x = position.x - 2, y = position.y - 2},
right_bottom = {x = position.x + 2, y = position.y + 2}
}
create_projectile(surface, projectile_types[object.entityName].name, position, force, target_pos, range)
if object.damage then
for _, e in pairs(surface.find_entities_filtered({area = damage_area})) do
damage_entity(e)
end
end
end
Public.cast_spell(player)
Public.remove_mana(player, object.mana_cost)
else
if object.target then -- rockets and such
surface.create_entity({name = object.entityName, position = position, force = force, target = target_pos, speed = 1})
Public.cast_spell(player)
Public.remove_mana(player, object.mana_cost)
elseif surface.can_place_entity {name = object.entityName, position = position} then
if object.biter then
local e = surface.create_entity({name = object.entityName, position = position, force = force})
tame_unit_effects(player, e)
Public.remove_mana(player, object.mana_cost)
elseif object.aoe then
for x = 1, -1, -1 do
for y = 1, -1, -1 do
local pos = {x = position.x + x, y = position.y + y}
if surface.can_place_entity {name = object.entityName, position = pos} then
if object.mana_cost > rpg_t.mana then
break
end
local e = surface.create_entity({name = object.entityName, position = pos, force = force})
e.direction = player.character.direction
Public.remove_mana(player, object.mana_cost)
end
end
end
else
local e = surface.create_entity({name = object.entityName, position = position, force = force})
e.direction = player.character.direction
Public.remove_mana(player, object.mana_cost)
end
Public.cast_spell(player)
else
Public.cast_spell(player, true)
return
end
end
local msg = player.name .. ' casted ' .. object.entityName .. '. ' local msg = player.name .. ' casted ' .. object.entityName .. '. '
@ -1323,8 +1217,6 @@ local function on_player_used_capsule(event)
Public.gain_xp(player, reward_xp) Public.gain_xp(player, reward_xp)
AntiGrief.insert_into_capsule_history(player, position, msg) AntiGrief.insert_into_capsule_history(player, position, msg)
return
end end
local function on_player_changed_surface(event) local function on_player_changed_surface(event)

View File

@ -1,9 +1,112 @@
local Public = {} local Public = require 'modules.rpg.table'
function Public.conjure_items() local spells = {}
local spells = {} local random = math.random
spells[#spells + 1] = { local function create_projectiles(data)
local self = data.self
local player = data.player
local damage_entity = data.damage_entity
local position = data.position
local surface = data.surface
local force = data.force
local target_pos = data.target_pos
local range = data.range
local function do_projectile(player_surface, name, _position, _force, target, max_range)
player_surface.create_entity(
{
name = name,
position = _position,
force = _force,
source = _position,
target = target,
max_range = max_range,
speed = 0.4
}
)
end
if self.aoe then
for _ = 1, self.amount do
local damage_area = {
left_top = {x = position.x - 2, y = position.y - 2},
right_bottom = {x = position.x + 2, y = position.y + 2}
}
do_projectile(surface, self.entityName, position, force, target_pos, range)
if self.damage then
for _, e in pairs(surface.find_entities_filtered({area = damage_area})) do
damage_entity(e)
end
end
end
else
local damage_area = {
left_top = {x = position.x - 2, y = position.y - 2},
right_bottom = {x = position.x + 2, y = position.y + 2}
}
do_projectile(surface, self.entityName, position, force, target_pos, range)
if self.damage then
for _, e in pairs(surface.find_entities_filtered({area = damage_area})) do
damage_entity(e)
end
end
end
Public.cast_spell(player)
Public.remove_mana(player, self.mana_cost)
end
local function create_entity(data)
local self = data.self
local player = data.player
local mana = data.mana
local position = data.position
local surface = data.surface
local force = data.force
local tame_unit_effects = data.tame_unit_effects
if self.biter then
local e = surface.create_entity({name = self.entityName, position = position, force = force})
tame_unit_effects(player, e)
Public.remove_mana(player, self.mana_cost)
return
end
if self.aoe then
for x = 1, -1, -1 do
for y = 1, -1, -1 do
local pos = {x = position.x + x, y = position.y + y}
if surface.can_place_entity {name = self.entityName, position = pos} then
if self.mana_cost > mana then
break
end
local e = surface.create_entity({name = self.entityName, position = pos, force = force})
e.direction = player.character.direction
Public.remove_mana(player, self.mana_cost)
end
end
end
else
if surface.can_place_entity {name = self.entityName, position = position} then
local e = surface.create_entity({name = self.entityName, position = position, force = force})
e.direction = player.character.direction
Public.remove_mana(player, self.mana_cost)
end
end
Public.cast_spell(player)
Public.remove_mana(player, self.mana_cost)
end
local function insert_onto(data)
local self = data.self
local player = data.player
player.insert({name = self.entityName, count = self.amount})
Public.cast_spell(player)
Public.remove_mana(player, self.mana_cost)
end
spells[#spells + 1] = {
name = {'entity-name.stone-wall'}, name = {'entity-name.stone-wall'},
entityName = 'stone-wall', entityName = 'stone-wall',
level = 1, level = 1,
@ -12,9 +115,12 @@ function Public.conjure_items()
tick = 100, tick = 100,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'recipe/stone-wall' sprite = 'recipe/stone-wall',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.wooden-chest'}, name = {'entity-name.wooden-chest'},
entityName = 'wooden-chest', entityName = 'wooden-chest',
level = 1, level = 1,
@ -23,9 +129,12 @@ function Public.conjure_items()
tick = 100, tick = 100,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'recipe/wooden-chest' sprite = 'recipe/wooden-chest',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.iron-chest'}, name = {'entity-name.iron-chest'},
entityName = 'iron-chest', entityName = 'iron-chest',
level = 10, level = 10,
@ -34,9 +143,12 @@ function Public.conjure_items()
tick = 200, tick = 200,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'recipe/iron-chest' sprite = 'recipe/iron-chest',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.steel-chest'}, name = {'entity-name.steel-chest'},
entityName = 'steel-chest', entityName = 'steel-chest',
level = 30, level = 30,
@ -45,9 +157,12 @@ function Public.conjure_items()
tick = 300, tick = 300,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'recipe/steel-chest' sprite = 'recipe/steel-chest',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.transport-belt'}, name = {'entity-name.transport-belt'},
entityName = 'transport-belt', entityName = 'transport-belt',
level = 1, level = 1,
@ -56,9 +171,12 @@ function Public.conjure_items()
tick = 100, tick = 100,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'recipe/transport-belt' sprite = 'recipe/transport-belt',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.fast-transport-belt'}, name = {'entity-name.fast-transport-belt'},
entityName = 'fast-transport-belt', entityName = 'fast-transport-belt',
level = 10, level = 10,
@ -67,9 +185,12 @@ function Public.conjure_items()
tick = 200, tick = 200,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'recipe/fast-transport-belt' sprite = 'recipe/fast-transport-belt',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.express-transport-belt'}, name = {'entity-name.express-transport-belt'},
entityName = 'express-transport-belt', entityName = 'express-transport-belt',
level = 30, level = 30,
@ -78,9 +199,12 @@ function Public.conjure_items()
tick = 300, tick = 300,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'recipe/express-transport-belt' sprite = 'recipe/express-transport-belt',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.underground-belt'}, name = {'entity-name.underground-belt'},
entityName = 'underground-belt', entityName = 'underground-belt',
level = 1, level = 1,
@ -89,9 +213,12 @@ function Public.conjure_items()
tick = 100, tick = 100,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'recipe/underground-belt' sprite = 'recipe/underground-belt',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.fast-underground-belt'}, name = {'entity-name.fast-underground-belt'},
entityName = 'fast-underground-belt', entityName = 'fast-underground-belt',
level = 10, level = 10,
@ -100,9 +227,12 @@ function Public.conjure_items()
tick = 200, tick = 200,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'recipe/fast-underground-belt' sprite = 'recipe/fast-underground-belt',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.express-underground-belt'}, name = {'entity-name.express-underground-belt'},
entityName = 'express-underground-belt', entityName = 'express-underground-belt',
level = 30, level = 30,
@ -111,9 +241,12 @@ function Public.conjure_items()
tick = 300, tick = 300,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'recipe/express-underground-belt' sprite = 'recipe/express-underground-belt',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.pipe'}, name = {'entity-name.pipe'},
entityName = 'pipe', entityName = 'pipe',
level = 1, level = 1,
@ -122,9 +255,12 @@ function Public.conjure_items()
tick = 100, tick = 100,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'recipe/pipe' sprite = 'recipe/pipe',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.pipe-to-ground'}, name = {'entity-name.pipe-to-ground'},
entityName = 'pipe-to-ground', entityName = 'pipe-to-ground',
level = 1, level = 1,
@ -133,9 +269,12 @@ function Public.conjure_items()
tick = 100, tick = 100,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'recipe/pipe-to-ground' sprite = 'recipe/pipe-to-ground',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.tree'}, name = {'entity-name.tree'},
entityName = 'tree-05', entityName = 'tree-05',
level = 30, level = 30,
@ -144,9 +283,12 @@ function Public.conjure_items()
tick = 350, tick = 350,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'entity/tree-05' sprite = 'entity/tree-05',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.sand-rock-big'}, name = {'entity-name.sand-rock-big'},
entityName = 'sand-rock-big', entityName = 'sand-rock-big',
level = 60, level = 60,
@ -155,9 +297,12 @@ function Public.conjure_items()
tick = 350, tick = 350,
aoe = true, aoe = true,
enabled = true, enabled = true,
sprite = 'entity/sand-rock-big' sprite = 'entity/sand-rock-big',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.small-biter'}, name = {'entity-name.small-biter'},
entityName = 'small-biter', entityName = 'small-biter',
level = 30, level = 30,
@ -166,9 +311,12 @@ function Public.conjure_items()
mana_cost = 55, mana_cost = 55,
tick = 200, tick = 200,
enabled = true, enabled = true,
sprite = 'entity/small-biter' sprite = 'entity/small-biter',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.small-spitter'}, name = {'entity-name.small-spitter'},
entityName = 'small-spitter', entityName = 'small-spitter',
level = 30, level = 30,
@ -177,9 +325,12 @@ function Public.conjure_items()
mana_cost = 55, mana_cost = 55,
tick = 200, tick = 200,
enabled = true, enabled = true,
sprite = 'entity/small-spitter' sprite = 'entity/small-spitter',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.medium-biter'}, name = {'entity-name.medium-biter'},
entityName = 'medium-biter', entityName = 'medium-biter',
level = 60, level = 60,
@ -188,9 +339,12 @@ function Public.conjure_items()
mana_cost = 100, mana_cost = 100,
tick = 300, tick = 300,
enabled = true, enabled = true,
sprite = 'entity/medium-biter' sprite = 'entity/medium-biter',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.medium-spitter'}, name = {'entity-name.medium-spitter'},
entityName = 'medium-spitter', entityName = 'medium-spitter',
level = 60, level = 60,
@ -199,9 +353,12 @@ function Public.conjure_items()
mana_cost = 100, mana_cost = 100,
tick = 300, tick = 300,
enabled = true, enabled = true,
sprite = 'entity/medium-spitter' sprite = 'entity/medium-spitter',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.biter-spawner'}, name = {'entity-name.biter-spawner'},
entityName = 'biter-spawner', entityName = 'biter-spawner',
level = 100, level = 100,
@ -210,9 +367,12 @@ function Public.conjure_items()
mana_cost = 800, mana_cost = 800,
tick = 1420, tick = 1420,
enabled = false, enabled = false,
sprite = 'entity/biter-spawner' sprite = 'entity/biter-spawner',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'entity-name.spitter-spawner'}, name = {'entity-name.spitter-spawner'},
entityName = 'spitter-spawner', entityName = 'spitter-spawner',
level = 100, level = 100,
@ -221,10 +381,13 @@ function Public.conjure_items()
mana_cost = 800, mana_cost = 800,
tick = 1420, tick = 1420,
enabled = false, enabled = false,
sprite = 'entity/spitter-spawner' sprite = 'entity/spitter-spawner',
} callback = function(data)
create_entity(data)
end
}
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'item-name.shotgun-shell'}, name = {'item-name.shotgun-shell'},
entityName = 'shotgun-shell', entityName = 'shotgun-shell',
target = true, target = true,
@ -236,9 +399,12 @@ function Public.conjure_items()
mana_cost = 40, mana_cost = 40,
tick = 150, tick = 150,
enabled = true, enabled = true,
sprite = 'recipe/shotgun-shell' sprite = 'recipe/shotgun-shell',
} callback = function(data)
spells[#spells + 1] = { create_projectiles(data)
end
}
spells[#spells + 1] = {
name = {'item-name.grenade'}, name = {'item-name.grenade'},
entityName = 'grenade', entityName = 'grenade',
target = true, target = true,
@ -250,9 +416,12 @@ function Public.conjure_items()
mana_cost = 100, mana_cost = 100,
tick = 150, tick = 150,
enabled = true, enabled = true,
sprite = 'recipe/grenade' sprite = 'recipe/grenade',
} callback = function(data)
spells[#spells + 1] = { create_projectiles(data)
end
}
spells[#spells + 1] = {
name = {'item-name.cluster-grenade'}, name = {'item-name.cluster-grenade'},
entityName = 'cluster-grenade', entityName = 'cluster-grenade',
target = true, target = true,
@ -264,9 +433,12 @@ function Public.conjure_items()
mana_cost = 225, mana_cost = 225,
tick = 200, tick = 200,
enabled = true, enabled = true,
sprite = 'recipe/cluster-grenade' sprite = 'recipe/cluster-grenade',
} callback = function(data)
spells[#spells + 1] = { create_projectiles(data)
end
}
spells[#spells + 1] = {
name = {'item-name.cannon-shell'}, name = {'item-name.cannon-shell'},
entityName = 'cannon-shell', entityName = 'cannon-shell',
target = true, target = true,
@ -278,9 +450,12 @@ function Public.conjure_items()
mana_cost = 125, mana_cost = 125,
tick = 150, tick = 150,
enabled = true, enabled = true,
sprite = 'recipe/cannon-shell' sprite = 'recipe/cannon-shell',
} callback = function(data)
spells[#spells + 1] = { create_projectiles(data)
end
}
spells[#spells + 1] = {
name = {'item-name.explosive-cannon-shell'}, name = {'item-name.explosive-cannon-shell'},
entityName = 'explosive-cannon-shell', entityName = 'explosive-cannon-shell',
target = true, target = true,
@ -292,9 +467,12 @@ function Public.conjure_items()
mana_cost = 250, mana_cost = 250,
tick = 200, tick = 200,
enabled = true, enabled = true,
sprite = 'recipe/explosive-cannon-shell' sprite = 'recipe/explosive-cannon-shell',
} callback = function(data)
spells[#spells + 1] = { create_projectiles(data)
end
}
spells[#spells + 1] = {
name = {'item-name.uranium-cannon-shell'}, name = {'item-name.uranium-cannon-shell'},
entityName = 'uranium-cannon-shell', entityName = 'uranium-cannon-shell',
target = true, target = true,
@ -306,9 +484,12 @@ function Public.conjure_items()
mana_cost = 400, mana_cost = 400,
tick = 200, tick = 200,
enabled = true, enabled = true,
sprite = 'recipe/uranium-cannon-shell' sprite = 'recipe/uranium-cannon-shell',
} callback = function(data)
spells[#spells + 1] = { create_projectiles(data)
end
}
spells[#spells + 1] = {
name = {'item-name.rocket'}, name = {'item-name.rocket'},
entityName = 'rocket', entityName = 'rocket',
range = 240, range = 240,
@ -321,9 +502,12 @@ function Public.conjure_items()
mana_cost = 60, mana_cost = 60,
tick = 320, tick = 320,
enabled = true, enabled = true,
sprite = 'recipe/rocket' sprite = 'recipe/rocket',
} callback = function(data)
spells[#spells + 1] = { create_projectiles(data)
end
}
spells[#spells + 1] = {
name = {'spells.pointy_explosives'}, name = {'spells.pointy_explosives'},
entityName = 'pointy_explosives', entityName = 'pointy_explosives',
target = true, target = true,
@ -336,9 +520,35 @@ function Public.conjure_items()
mana_cost = 100, mana_cost = 100,
tick = 100, tick = 100,
enabled = true, enabled = true,
sprite = 'recipe/explosives' sprite = 'recipe/explosives',
callback = function(data)
local self = data.self
local player = data.player
local Explosives = data.explosives
local position = data.position
local entities =
player.surface.find_entities_filtered {
force = player.force,
type = 'container',
area = {{position.x - 1, position.y - 1}, {position.x + 1, position.y + 1}}
} }
spells[#spells + 1] = {
local detonate_chest
for i = 1, #entities do
local e = entities[i]
detonate_chest = e
end
if detonate_chest and detonate_chest.valid then
local success = Explosives.detonate_chest(detonate_chest)
if success then
Public.remove_mana(player, self.mana_cost)
end
Public.cast_spell(player)
end
end
}
spells[#spells + 1] = {
name = {'spells.repair_aoe'}, name = {'spells.repair_aoe'},
entityName = 'repair_aoe', entityName = 'repair_aoe',
target = true, target = true,
@ -351,9 +561,18 @@ function Public.conjure_items()
mana_cost = 150, mana_cost = 150,
tick = 100, tick = 100,
enabled = true, enabled = true,
sprite = 'recipe/repair-pack' sprite = 'recipe/repair-pack',
} callback = function(data)
spells[#spells + 1] = { local self = data.self
local player = data.player
local position = data.position
Public.repair_aoe(player, position)
Public.cast_spell(player)
Public.remove_mana(player, self.mana_cost)
end
}
spells[#spells + 1] = {
name = {'spells.acid_stream'}, name = {'spells.acid_stream'},
entityName = 'acid-stream-spitter-big', entityName = 'acid-stream-spitter-big',
target = true, target = true,
@ -366,9 +585,12 @@ function Public.conjure_items()
mana_cost = 70, mana_cost = 70,
tick = 100, tick = 100,
enabled = true, enabled = true,
sprite = 'virtual-signal/signal-S' sprite = 'virtual-signal/signal-S',
} callback = function(data)
spells[#spells + 1] = { create_projectiles(data)
end
}
spells[#spells + 1] = {
name = {'spells.tank'}, name = {'spells.tank'},
entityName = 'tank', entityName = 'tank',
amount = 1, amount = 1,
@ -379,9 +601,12 @@ function Public.conjure_items()
mana_cost = 10000, -- they who know, will know mana_cost = 10000, -- they who know, will know
tick = 320, tick = 320,
enabled = false, enabled = false,
sprite = 'entity/tank' sprite = 'entity/tank',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'spells.spidertron'}, name = {'spells.spidertron'},
entityName = 'spidertron', entityName = 'spidertron',
amount = 1, amount = 1,
@ -392,9 +617,12 @@ function Public.conjure_items()
mana_cost = 19500, -- they who know, will know mana_cost = 19500, -- they who know, will know
tick = 320, tick = 320,
enabled = false, enabled = false,
sprite = 'entity/spidertron' sprite = 'entity/spidertron',
} callback = function(data)
spells[#spells + 1] = { create_entity(data)
end
}
spells[#spells + 1] = {
name = {'spells.raw_fish'}, name = {'spells.raw_fish'},
entityName = 'raw-fish', entityName = 'raw-fish',
target = false, target = false,
@ -408,9 +636,12 @@ function Public.conjure_items()
mana_cost = 140, mana_cost = 140,
tick = 320, tick = 320,
enabled = true, enabled = true,
sprite = 'item/raw-fish' sprite = 'item/raw-fish',
} callback = function(data)
spells[#spells + 1] = { insert_onto(data)
end
}
spells[#spells + 1] = {
name = {'spells.dynamites'}, name = {'spells.dynamites'},
entityName = 'explosives', entityName = 'explosives',
target = false, target = false,
@ -424,9 +655,12 @@ function Public.conjure_items()
mana_cost = 140, mana_cost = 140,
tick = 320, tick = 320,
enabled = true, enabled = true,
sprite = 'item/explosives' sprite = 'item/explosives',
} callback = function(data)
spells[#spells + 1] = { insert_onto(data)
end
}
spells[#spells + 1] = {
name = {'spells.comfylatron'}, name = {'spells.comfylatron'},
entityName = 'suicidal_comfylatron', entityName = 'suicidal_comfylatron',
target = false, target = false,
@ -439,9 +673,19 @@ function Public.conjure_items()
mana_cost = 150, mana_cost = 150,
tick = 320, tick = 320,
enabled = true, enabled = true,
sprite = 'entity/compilatron' sprite = 'entity/compilatron',
} callback = function(data)
spells[#spells + 1] = { local self = data.self
local player = data.player
local position = data.position
local surface = data.surface
Public.suicidal_comfylatron(position, surface)
Public.cast_spell(player)
Public.remove_mana(player, self.mana_cost)
end
}
spells[#spells + 1] = {
name = {'spells.distractor'}, name = {'spells.distractor'},
entityName = 'distractor-capsule', entityName = 'distractor-capsule',
target = true, target = true,
@ -454,9 +698,12 @@ function Public.conjure_items()
mana_cost = 220, mana_cost = 220,
tick = 320, tick = 320,
enabled = true, enabled = true,
sprite = 'recipe/distractor-capsule' sprite = 'recipe/distractor-capsule',
} callback = function(data)
spells[#spells + 1] = { create_projectiles(data)
end
}
spells[#spells + 1] = {
name = {'spells.warp'}, name = {'spells.warp'},
entityName = 'warp-gate', entityName = 'warp-gate',
target = true, target = true,
@ -466,10 +713,24 @@ function Public.conjure_items()
mana_cost = 340, mana_cost = 340,
tick = 2000, tick = 2000,
enabled = true, enabled = true,
sprite = 'virtual-signal/signal-W' sprite = 'virtual-signal/signal-W',
} callback = function(data)
return spells local player = data.player
end local surface = data.surface
local pos = surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5)
if pos then
player.teleport(pos, surface)
else
pos = game.forces.player.get_spawn_position(surface)
player.teleport(pos, surface)
end
Public.remove_mana(player, 999999)
Public.damage_player_over_time(player, random(8, 16))
player.play_sound {path = 'utility/armor_insert', volume_modifier = 1}
Public.cast_spell(player)
end
}
Public.projectile_types = { Public.projectile_types = {
['explosives'] = {name = 'grenade', count = 0.5, max_range = 32, tick_speed = 1}, ['explosives'] = {name = 'grenade', count = 0.5, max_range = 32, tick_speed = 1},
@ -510,4 +771,132 @@ Public.projectile_types = {
['cliff-explosives'] = {name = 'cliff-explosives', count = 1, max_range = 48, tick_speed = 2} ['cliff-explosives'] = {name = 'cliff-explosives', count = 1, max_range = 48, tick_speed = 2}
} }
Public.get_projectiles = Public.projectile_types
Public.spells = spells
--- Retrieves the spells table or a given spell.
---@param key string
function Public.get_spells(key)
if game then
return error('Calling Public.get_spells() after on_init() or on_load() has run is a desync risk.', 2)
end
if Public.spells[key] then
return Public.spells[key]
else
return Public.spells
end
end
--- Disables a spell.
---@param key string/number
-- Table would look like:
-- Public.disable_spell({1, 2, 3, 4, 5, 6, 7, 8})
function Public.disable_spell(key)
if game then
return error('Calling Public.disable_spell() after on_init() or on_load() has run is a desync risk.', 2)
end
if type(key) == 'table' then
for _, k in pairs(key) do
Public.spells[k].enabled = false
end
elseif Public.spells[key] then
Public.spells[key].enabled = false
end
end
--- Clears the spell table.
function Public.clear_spell_table()
if game then
return error('Calling Public.clear_spell_table() after on_init() or on_load() has run is a desync risk.', 2)
end
Public.spells = {}
end
--- Adds a spell to the rpg_spells
---@param tbl table
function Public.set_new_spell(tbl)
if game then
return error('Calling Public.set_new_spell() after on_init() or on_load() has run is a desync risk.', 2)
end
if tbl then
if not tbl.name then
return error('A spell requires a name. string', 2)
end
if not tbl.entityName then
return error('A spell requires an object to create. string', 2)
end
if not tbl.target then
return error('A spell requires position. boolean', 2)
end
if not tbl.amount then
return error('A spell requires an amount of creation. <integer>', 2)
end
if not tbl.range then
return error('A spell requires a range. <integer>', 2)
end
if not tbl.damage then
return error('A spell requires damage. <damage-area=true/false>', 2)
end
if not tbl.force then
return error('A spell requires a force. string', 2)
end
if not tbl.level then
return error('A spell requires a level. <integer>', 2)
end
if not tbl.type then
return error('A spell requires a type. <item/entity/special>', 2)
end
if not tbl.mana_cost then
return error('A spell requires mana_cost. <integer>', 2)
end
if not tbl.tick then
return error('A spell requires tick. <integer>', 2)
end
if not tbl.enabled then
return error('A spell requires enabled. boolean', 2)
end
Public.spells[#Public.spells + 1] = tbl
end
end
--- This rebuilds all spells. Make sure to make changes on_init if you don't
-- want all spells enabled.
function Public.rebuild_spells()
local new_spells = {}
local spell_names = {}
for i = 1, #spells do
if spells[i].enabled then
new_spells[#new_spells + 1] = spells[i]
spell_names[#spell_names + 1] = spells[i].name
end
end
return new_spells, spell_names
end
--- This will disable the cooldown of all spells.
function Public.disable_cooldowns_on_spells()
if game then
return error('Calling Public.disable_cooldowns_on_spells() after on_init() or on_load() has run is a desync risk.', 2)
end
local new_spells = {}
for i = 1, #spells do
if spells[i].enabled then
spells[i].tick = 0
new_spells[#new_spells + 1] = spells[i]
end
end
Public.spells = new_spells
return new_spells
end
return Public return Public

View File

@ -1,13 +1,11 @@
-- one table to rule them all! -- one table to rule them all!
local Global = require 'utils.global' local Global = require 'utils.global'
local Spells = require 'modules.rpg.spells'
local Event = require 'utils.event' local Event = require 'utils.event'
local Gui = require 'utils.gui' local Gui = require 'utils.gui'
local this = { local this = {
rpg_extra = {}, rpg_extra = {},
rpg_t = {}, rpg_t = {}
rpg_spells = Spells.conjure_items()
} }
--! Gui Frames --! Gui Frames
@ -151,7 +149,7 @@ function Public.reset_table()
end end
--- Gets value from table --- Gets value from table
---@param key <string> ---@param key string
function Public.get(key) function Public.get(key)
if key then if key then
return this[key] return this[key]
@ -161,8 +159,8 @@ function Public.get(key)
end end
--- Gets value from player rpg_t table --- Gets value from player rpg_t table
---@param key <string> ---@param key string
---@param value <string> ---@param value string
function Public.get_value_from_player(key, value) function Public.get_value_from_player(key, value)
if key and value then if key and value then
if (this.rpg_t[key] and this.rpg_t[key][value]) then if (this.rpg_t[key] and this.rpg_t[key][value]) then
@ -180,9 +178,9 @@ function Public.get_value_from_player(key, value)
end end
--- Sets value to player rpg_t table --- Sets value to player rpg_t table
---@param key <string> ---@param key string
---@param value <string> ---@param value string
---@param setter <string> ---@param setter string
function Public.set_value_to_player(key, value, setter) function Public.set_value_to_player(key, value, setter)
if key and value then if key and value then
if (this.rpg_t[key] and this.rpg_t[key][value]) then if (this.rpg_t[key] and this.rpg_t[key][value]) then
@ -194,8 +192,8 @@ function Public.set_value_to_player(key, value, setter)
end end
--- Sets a new table to rpg_t table --- Sets a new table to rpg_t table
---@param key <string> ---@param key string
---@param tbl <string> ---@param tbl string
function Public.set_new_player_tbl(key, tbl) function Public.set_new_player_tbl(key, tbl)
if key and tbl then if key and tbl then
if type(tbl) ~= 'table' then if type(tbl) ~= 'table' then
@ -208,7 +206,7 @@ function Public.set_new_player_tbl(key, tbl)
end end
--- Removes a player from rpg_t table --- Removes a player from rpg_t table
---@param key <LuaPlayerIndex> ---@param index number
function Public.remove_player(index) function Public.remove_player(index)
if index then if index then
if this.rpg_t[index] then if this.rpg_t[index] then
@ -218,7 +216,7 @@ function Public.remove_player(index)
end end
--- Sets value to table --- Sets value to table
---@param key <string> ---@param key string
function Public.set(key) function Public.set(key)
if key then if key then
return this[key] return this[key]
@ -250,7 +248,7 @@ function Public.toggle_debug_aoe_punch()
end end
--- Debug only - when you need to troubleshoot. --- Debug only - when you need to troubleshoot.
---@param str <string> ---@param str string
function Public.debug_log(str) function Public.debug_log(str)
if not this.rpg_extra.debug then if not this.rpg_extra.debug then
return return
@ -259,7 +257,7 @@ function Public.debug_log(str)
end end
--- Sets surface name for rpg_v2 to use --- Sets surface name for rpg_v2 to use
---@param name <string> ---@param name string
function Public.set_surface_name(name) function Public.set_surface_name(name)
if name then if name then
this.rpg_extra.surface_name = name this.rpg_extra.surface_name = name
@ -272,7 +270,7 @@ end
--- Enables the bars that shows above the player character. --- Enables the bars that shows above the player character.
--- If you disable mana but enable <enable_health_and_mana_bars> then only health will be shown --- If you disable mana but enable <enable_health_and_mana_bars> then only health will be shown
---@param value <boolean> ---@param value boolean
function Public.enable_health_and_mana_bars(value) function Public.enable_health_and_mana_bars(value)
this.rpg_extra.enable_health_and_mana_bars = value or false this.rpg_extra.enable_health_and_mana_bars = value or false
@ -280,7 +278,7 @@ function Public.enable_health_and_mana_bars(value)
end end
--- Enables the mana feature that allows players to spawn entities. --- Enables the mana feature that allows players to spawn entities.
---@param value <boolean> ---@param value boolean
function Public.enable_mana(value) function Public.enable_mana(value)
this.rpg_extra.enable_mana = value or false this.rpg_extra.enable_mana = value or false
@ -289,7 +287,7 @@ end
--- This should only be enabled if wave_defense is enabled. --- This should only be enabled if wave_defense is enabled.
--- It boosts the amount of xp the players get after x amount of waves. --- It boosts the amount of xp the players get after x amount of waves.
---@param value <boolean> ---@param value boolean
function Public.enable_wave_defense(value) function Public.enable_wave_defense(value)
this.rpg_extra.enable_wave_defense = value or false this.rpg_extra.enable_wave_defense = value or false
@ -297,7 +295,7 @@ function Public.enable_wave_defense(value)
end end
--- Enables/disabled flame boots. --- Enables/disabled flame boots.
---@param value <boolean> ---@param value boolean
function Public.enable_flame_boots(value) function Public.enable_flame_boots(value)
this.rpg_extra.enable_flame_boots = value or false this.rpg_extra.enable_flame_boots = value or false
@ -305,7 +303,7 @@ function Public.enable_flame_boots(value)
end end
--- Enables/disabled explosive bullets globally. --- Enables/disabled explosive bullets globally.
---@param value <boolean> ---@param value boolean
function Public.enable_explosive_bullets_globally(value) function Public.enable_explosive_bullets_globally(value)
this.rpg_extra.enable_explosive_bullets_globally = value or false this.rpg_extra.enable_explosive_bullets_globally = value or false
@ -323,7 +321,7 @@ function Public.get_explosive_bullets()
end end
--- Enables/disabled explosive bullets. --- Enables/disabled explosive bullets.
---@param value <boolean> ---@param value boolean
function Public.enable_explosive_bullets(value) function Public.enable_explosive_bullets(value)
this.rpg_extra.enable_explosive_bullets = value or false this.rpg_extra.enable_explosive_bullets = value or false
@ -336,7 +334,7 @@ function Public.get_range_buffs()
end end
--- Enables/disabled range buffs. --- Enables/disabled range buffs.
---@param value <boolean> ---@param value boolean
function Public.enable_range_buffs(value) function Public.enable_range_buffs(value)
this.rpg_extra.enable_range_buffs = value or false this.rpg_extra.enable_range_buffs = value or false
@ -344,7 +342,7 @@ function Public.enable_range_buffs(value)
end end
--- Enables/disabled personal tax. --- Enables/disabled personal tax.
---@param value <boolean> ---@param value boolean
function Public.personal_tax_rate(value) function Public.personal_tax_rate(value)
this.rpg_extra.personal_tax_rate = value or false this.rpg_extra.personal_tax_rate = value or false
@ -352,7 +350,7 @@ function Public.personal_tax_rate(value)
end end
--- Enables/disabled stone-path-tile creation on mined. --- Enables/disabled stone-path-tile creation on mined.
---@param value <boolean> ---@param value boolean
function Public.enable_stone_path(value) function Public.enable_stone_path(value)
this.rpg_extra.enable_stone_path = value or false this.rpg_extra.enable_stone_path = value or false
@ -360,7 +358,7 @@ function Public.enable_stone_path(value)
end end
--- Enables/disabled auto-allocations of skill-points. --- Enables/disabled auto-allocations of skill-points.
---@param value <boolean> ---@param value boolean
function Public.enable_auto_allocate(value) function Public.enable_auto_allocate(value)
this.rpg_extra.enable_auto_allocate = value or false this.rpg_extra.enable_auto_allocate = value or false
@ -368,7 +366,7 @@ function Public.enable_auto_allocate(value)
end end
--- Enables/disabled aoe_punch. --- Enables/disabled aoe_punch.
---@param value <boolean> ---@param value boolean
function Public.enable_aoe_punch(value) function Public.enable_aoe_punch(value)
this.rpg_extra.enable_aoe_punch = value or false this.rpg_extra.enable_aoe_punch = value or false
@ -376,127 +374,13 @@ function Public.enable_aoe_punch(value)
end end
--- Enables/disabled aoe_punch. --- Enables/disabled aoe_punch.
---@param value <boolean> ---@param value boolean
function Public.enable_aoe_punch_globally(value) function Public.enable_aoe_punch_globally(value)
this.rpg_extra.enable_aoe_punch_globally = value or false this.rpg_extra.enable_aoe_punch_globally = value or false
return this.rpg_extra.enable_aoe_punch_globally return this.rpg_extra.enable_aoe_punch_globally
end end
--- Retrieves the spells table or a given spell.
---@param key <string>
function Public.get_spells(key)
if this.rpg_spells[key] then
return this.rpg_spells[key]
else
return this.rpg_spells
end
end
--- Disables a spell.
---@param key <string/table>
-- Table would look like:
-- Public.disable_spell({1, 2, 3, 4, 5, 6, 7, 8})
function Public.disable_spell(key)
if type(key) == 'table' then
for _, k in pairs(key) do
this.rpg_spells[k].enabled = false
end
elseif this.rpg_spells[key] then
this.rpg_spells[key].enabled = false
end
end
--- Clears the spell table.
function Public.clear_spell_table()
this.rpg_spells = {}
end
--- Adds a spell to the rpg_spells
---@param tbl <table>
function Public.set_new_spell(tbl)
if tbl then
if not tbl.name then
return error('A spell requires a name. <string>', 2)
end
if not tbl.entityName then
return error('A spell requires an object to create. <string>', 2)
end
if not tbl.target then
return error('A spell requires position. <boolean>', 2)
end
if not tbl.amount then
return error('A spell requires an amount of creation. <integer>', 2)
end
if not tbl.range then
return error('A spell requires a range. <integer>', 2)
end
if not tbl.damage then
return error('A spell requires damage. <damage-area=true/false>', 2)
end
if not tbl.force then
return error('A spell requires a force. <string>', 2)
end
if not tbl.level then
return error('A spell requires a level. <integer>', 2)
end
if not tbl.type then
return error('A spell requires a type. <item/entity/special>', 2)
end
if not tbl.mana_cost then
return error('A spell requires mana_cost. <integer>', 2)
end
if not tbl.tick then
return error('A spell requires tick. <integer>', 2)
end
if not tbl.enabled then
return error('A spell requires enabled. <boolean>', 2)
end
this.rpg_spells[#this.rpg_spells + 1] = tbl
end
end
--- This rebuilds all spells. Make sure to make changes on_init if you don't
-- want all spells enabled.
function Public.rebuild_spells(rebuild)
local spells = this.rpg_spells
local new_spells = {}
local spell_names = {}
for i = 1, #spells do
if spells[i].enabled then
new_spells[#new_spells + 1] = spells[i]
spell_names[#spell_names + 1] = spells[i].name
end
end
if rebuild then
this.rpg_spells = new_spells
end
return new_spells, spell_names
end
--- This will disable the cooldown of all spells.
function Public.disable_cooldowns_on_spells()
local spells = this.rpg_spells
local new_spells = {}
for i = 1, #spells do
if spells[i].enabled then
spells[i].tick = 0
new_spells[#new_spells + 1] = spells[i]
end
end
this.rpg_spells = new_spells
return new_spells
end
function Public.tweaked_crafting_items(tbl) function Public.tweaked_crafting_items(tbl)
if not tbl then if not tbl then
return return
@ -511,7 +395,6 @@ function Public.tweaked_crafting_items(tbl)
return this.tweaked_crafting_items return this.tweaked_crafting_items
end end
Public.get_projectiles = Spells.projectile_types
Public.settings_frame_name = settings_frame_name Public.settings_frame_name = settings_frame_name
Public.save_button_name = save_button_name Public.save_button_name = save_button_name
Public.discard_button_name = discard_button_name Public.discard_button_name = discard_button_name

View File

@ -20,7 +20,8 @@ local on_pre_hidden_handlers = {}
local data = {} local data = {}
local element_map = {} local element_map = {}
local settings = { local settings = {
mod_gui_top_frame = false mod_gui_top_frame = false,
disabled_tabs = {}
} }
Public.token = Public.token =
@ -318,6 +319,27 @@ function Public.get_disable_clear_invalid_data()
return settings.disable_clear_invalid_data return settings.disable_clear_invalid_data
end end
-- Disable a gui.
---@param frame_name string
---@param state boolean?
function Public.set_disabled_tab(frame_name, state)
if not frame_name then
return
end
settings.disabled_tabs[frame_name] = state or false
end
-- Fetches if a gui is disabled.
---@param frame_name string
function Public.get_disabled_tab(frame_name)
if not frame_name then
return
end
return settings.disabled_tabs[frame_name]
end
-- Fetches the main frame name -- Fetches the main frame name
function Public.get_main_frame(player) function Public.get_main_frame(player)
if not player then if not player then
@ -535,6 +557,7 @@ local function draw_main_frame(player)
local tabbed_pane = inside_frame.add({type = 'tabbed-pane', name = 'tabbed_pane'}) local tabbed_pane = inside_frame.add({type = 'tabbed-pane', name = 'tabbed_pane'})
for name, func in pairs(tabs) do for name, func in pairs(tabs) do
if not settings.disabled_tabs[name] then
if func.only_server_sided then if func.only_server_sided then
local secs = Server.get_current_time() local secs = Server.get_current_time()
if secs then if secs then
@ -566,6 +589,7 @@ local function draw_main_frame(player)
tabbed_pane.add_tab(tab, name_frame) tabbed_pane.add_tab(tab, name_frame)
end end
end end
end
for _, child in pairs(tabbed_pane.children) do for _, child in pairs(tabbed_pane.children) do
child.style.padding = 8 child.style.padding = 8

View File

@ -1 +1,5 @@
local Gui = require 'utils.gui'
Gui.set_disabled_tab('Scoreboard', true)
Gui.set_disabled_tab('Groups', true)
return require 'maps.pirates.main' return require 'maps.pirates.main'