Address review: page layout, five more features, framework changes

Framework:
- Intervals are gone. Update periods are hardcoded on_nth_tick values
  again, since nobody has needed to change them.
- apply is a single loop over the declared fields and logs a warning
  when an override is invalid. receive_update also warns about
  unknown keys.
- Nested tables are addressed as "section.key". Lists of strings can be
  overridden. Features.optional declares a value with no default.
- Features.on_apply rebuilds values derived from the config, such as
  lookup sets. It also runs during on_load.

exp_roles is assumed to be present:
- AFK Kick picks a role (active_role_id) instead of a custom check
  function.
- Chat Auto Reply, Protection, and Nuke Protection no longer take a
  permission as a setting.

New features, each chosen for an edge case:
- Discord Alerts: conditional handlers, and a command map that becomes
  a list.
- Entity Protection: lists turned into sets at load, and bookkeeping
  that must keep running while disabled.
- Nuke Protection: config keyed by defines, flattened to a banned items
  list.
- Popups: one config shared by two control files.
- Spawn Area: nested sections, and settings that only apply when the
  map is created.

Page: now laid out like the role page. It has a search across every
setting, one long list with a sticky sidebar to jump between sections,
and the enabled switch separated at the front of each header with
Reset to defaults on the right. Changed rows are highlighted, and a
bottom bar offers Revert and Apply. Role settings use a role picker and
lists use a tag select.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-09-30 15:28:23 +00:00
1 parent 69e9f172a3
commit 4bc1773c82
23 files changed
+989 -670

No files matched your search

+20 -4
View File
@@ -4,8 +4,16 @@ Kicks players when all players on the server are afk
local Async = require("modules/exp_util/async")
local Features = require("modules/exp_scenario/features")
local Roles = require("modules/exp_roles")
local Storage = require("modules/exp_util/storage")
local config = require("modules/exp_scenario/config/afk_kick")
local config = Features.config("afk_kick", {
admin_as_active = true, --- @setting admin_as_active When true admins will be treated as active regardless of afk time
trust_as_active = true, --- @setting trust_as_active When true trusted players (by playtime) will be treated as active regardless of afk time
active_role_id = Features.optional("number"), --- @setting active_role_id Players with this role or higher are treated as active regardless of afk time
afk_minutes = 10, --- @setting afk_minutes The time in minutes that must pass for a player to be considered afk
kick_minutes = 30, --- @setting kick_minutes The time in minutes that must pass without any active players for all players to be kicked
trust_minutes = 600, --- @setting trust_minutes The time in minutes that a player must be online for to count as trusted
})
local ticks_per_minute = 3600
@@ -22,13 +30,21 @@ local afk_kick_player_async =
game.kick_player(player, "AFK while no active players on the server")
end)
--- Check if a player has a role which counts as active regardless of afk time
--- @param player LuaPlayer
--- @return boolean
local function is_active_role(player)
local role = config.active_role_id and Roles.get_role(config.active_role_id)
return role ~= nil and not Roles.get_player_highest_role(player):is_lower_than(role)
end
--- Check if there is an active player
local function has_active_player()
for _, player in ipairs(game.connected_players) do
if player.afk_time < config.afk_minutes * ticks_per_minute
or config.admin_as_active and player.admin
or config.trust_as_active and player.online_time > config.trust_minutes * ticks_per_minute
or config.custom_active_check and config.custom_active_check(player) then
or is_active_role(player) then
script_data.last_active = game.tick
return true
end
@@ -80,8 +96,8 @@ return Features.guard(config, {
events = {
[e.on_player_joined_game] = on_player_joined_game,
},
intervals = {
update_seconds = check_afk_players,
on_nth_tick = {
[60 * 60 * 30] = check_afk_players,
},
has_active_player = has_active_player,
})
@@ -21,7 +21,7 @@ local function on_console_chat(event)
-- Check if the player can chat commands
local commands_allowed = true
if config.command_admin_only and not player.admin then commands_allowed = false end
if config.command_permission and not Roles.player_has_permission(player, config.command_permission) then commands_allowed = false end
if not Roles.player_has_permission(player, "exp_scenario.chat.commands") then commands_allowed = false end
-- Check if a key word appears in the message
for key_word, reply in pairs(config.messages) do
+5 -4
View File
@@ -3,7 +3,8 @@ Creates flying text entities when a player sends a message in chat
]]
local FlyingText = require("modules/exp_util/flying_text")
local config = require("modules.exp_legacy.config.popup_messages")
local Features = require("modules/exp_scenario/features")
local config = require("modules/exp_scenario/config/popups")
local lower = string.lower
local find = string.find
@@ -41,8 +42,8 @@ end
local e = defines.events
return {
return Features.guard(config, {
events = {
[e.on_console_chat] = on_console_chat,
}
}
},
})
@@ -4,7 +4,8 @@ also shows player health when a player is attacked
]]
local FlyingText = require("modules/exp_util/flying_text")
local config = require("modules.exp_legacy.config.popup_messages")
local Features = require("modules/exp_scenario/features")
local config = require("modules/exp_scenario/config/popups")
local random = math.random
local floor = math.floor
@@ -44,8 +45,8 @@ end
local e = defines.events
return {
return Features.guard(config, {
events = {
[e.on_entity_damaged] = on_entity_damaged,
},
}
})
@@ -14,7 +14,6 @@ local config = Features.config("death_markers", {
map_icon = nil, --- @setting map_icon the icon that the map marker shows; nil means no icon; format as a SingleID
show_light_at_corpse = true, --- @setting show_light_at_corpse if a light should be rendered at the corpse
show_line_to_corpse = true, --- @setting show_line_to_corpse if a line should be rendered from you to your corpse
check_map_tags_seconds = 300, --- @setting check_map_tags_seconds seconds between checks for missing map markers
})
local map_tag_time_format = ExpUtil.format_time_factory{ format = "short", hours = true, minutes = true }
@@ -149,8 +148,8 @@ end
local e = defines.events
return Features.guard(config, {
intervals = {
check_map_tags_seconds = check_map_tags,
on_nth_tick = {
[60 * 60 * 5] = check_map_tags,
},
events = {
[e.on_player_died] = on_player_died,
+164 -142
View File
@@ -4,7 +4,43 @@ Sends alert messages to our discord server when certain events are triggered
local ExpUtil = require("modules/exp_util")
local Colors = require("modules/exp_util/include/color")
local config = require("modules.exp_legacy.config.discord_alerts")
local Features = require("modules/exp_scenario/features")
local EntityProtection = require("modules/exp_scenario/control/protection")
local Jail = require("modules/exp_scenario/control/jail")
local config = Features.config("discord_alerts", {
show_playtime = true, --- @setting show_playtime Add the playtime of players to alerts
entity_protection = true, --- @setting entity_protection Alert when a player repeatedly removes protected entities
player_bans = true, --- @setting player_bans Alert when a player is banned or unbanned
player_mutes = true, --- @setting player_mutes Alert when a player is muted or unmuted
player_kicks = true, --- @setting player_kicks Alert when a player is kicked
player_promotes = false, --- @setting player_promotes Alert when a player is promoted or demoted
player_jail = true, --- @setting player_jail Alert when a player is jailed or unjailed
logged_commands = { --- @setting logged_commands Alert when a player uses one of these commands
"config", "purge", "c", "command", "silent-command", "measured-command", "banlist", "permissions", "editor", "cheat",
},
})
--- Set of the logged commands, rebuilt when the config changes
local logged_commands = {} --- @type table<string, true>
Features.on_apply(config, function()
logged_commands = {}
for _, command in ipairs(config.logged_commands) do
logged_commands[command] = true
end
end)
--- Wrap an event handler so it only runs while the alert is enabled
--- @param setting string
--- @param handler fun(event: table)
--- @return fun(event: table)
local function when(setting, handler)
return function(event)
if config[setting] then
return handler(event)
end
end
end
local format_string = string.format
local write_json = ExpUtil.write_json
@@ -80,172 +116,158 @@ local function emit_event(opts)
end
--- Repeated protected entity mining
if config.entity_protection then
local EntityProtection = require("modules/exp_scenario/control/protection")
events[EntityProtection.on_repeat_violation] = function(event)
local player_name = get_player_name(event)
emit_event{
title = "Entity Protection",
description = "A player removed protected entities",
color = Colors.yellow,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
{ name = "Entity", inline = true, value = event.entity.name },
{ name = "Location", value = format_string("X %.1f Y %.1f", event.entity.position.x, event.entity.position.y) },
},
}
end
end
events[EntityProtection.on_repeat_violation] = when("entity_protection", function(event)
local player_name = get_player_name(event)
emit_event{
title = "Entity Protection",
description = "A player removed protected entities",
color = Colors.yellow,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
{ name = "Entity", inline = true, value = event.entity.name },
{ name = "Location", value = format_string("X %.1f Y %.1f", event.entity.position.x, event.entity.position.y) },
},
}
end)
--- When a player is jailed or unjailed
if config.player_jail then
local Jail = require("modules/exp_scenario/control/jail")
events[Jail.on_player_jailed] = function(event)
local player_name, by_player_name = get_player_name(event)
events[Jail.on_player_jailed] = when("player_jail", function(event)
local player_name, by_player_name = get_player_name(event)
emit_event{
title = "Jail",
description = "A player has been jailed",
color = Colors.yellow,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
{ name = "By", inline = true, value = append_playtime(by_player_name) },
{ name = "Reason", value = event.reason },
},
}
end)
events[Jail.on_player_unjailed] = when("player_jail", function(event)
local player_name, by_player_name = get_player_name(event)
emit_event{
title = "Unjail",
description = "A player has been unjailed",
color = Colors.green,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
{ name = "By", inline = true, value = append_playtime(by_player_name) },
},
}
end)
--- Ban and unban
--- @param event EventData.on_player_banned
events[e.on_player_banned] = when("player_bans", function(event)
if event.by_player then
local by_player = game.players[event.by_player]
emit_event{
title = "Jail",
description = "A player has been jailed",
color = Colors.yellow,
title = "Banned",
description = "A player has been banned",
color = Colors.red,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
{ name = "By", inline = true, value = append_playtime(by_player_name) },
{ name = "Player", inline = true, value = append_playtime(event.player_name) },
{ name = "By", inline = true, value = append_playtime(by_player.name) },
{ name = "Reason", value = event.reason },
},
}
end
events[Jail.on_player_unjailed] = function(event)
local player_name, by_player_name = get_player_name(event)
end)
--- @param event EventData.on_player_unbanned
events[e.on_player_unbanned] = when("player_bans", function(event)
if event.by_player then
local by_player = game.players[event.by_player]
emit_event{
title = "Unjail",
description = "A player has been unjailed",
title = "Un-Banned",
description = "A player has been un-banned",
color = Colors.green,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
{ name = "By", inline = true, value = append_playtime(by_player_name) },
{ name = "Player", inline = true, value = append_playtime(event.player_name) },
{ name = "By", inline = true, value = append_playtime(by_player.name) },
{ name = "Reason", value = event.reason },
},
}
end
end
--- Ban and unban
if config.player_bans then
--- @param event EventData.on_player_banned
events[e.on_player_banned] = function(event)
if event.by_player then
local by_player = game.players[event.by_player]
emit_event{
title = "Banned",
description = "A player has been banned",
color = Colors.red,
fields = {
{ name = "Player", inline = true, value = append_playtime(event.player_name) },
{ name = "By", inline = true, value = append_playtime(by_player.name) },
{ name = "Reason", value = event.reason },
},
}
end
end
--- @param event EventData.on_player_unbanned
events[e.on_player_unbanned] = function(event)
if event.by_player then
local by_player = game.players[event.by_player]
emit_event{
title = "Un-Banned",
description = "A player has been un-banned",
color = Colors.green,
fields = {
{ name = "Player", inline = true, value = append_playtime(event.player_name) },
{ name = "By", inline = true, value = append_playtime(by_player.name) },
{ name = "Reason", value = event.reason },
},
}
end
end
end
end)
--- Mute and unmute
if config.player_mutes then
--- @param event EventData.on_player_muted
events[e.on_player_muted] = function(event)
local player_name = get_player_name(event)
emit_event{
title = "Muted",
description = "A player has been muted",
color = Colors.yellow,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
},
}
end
--- @param event EventData.on_player_unmuted
events[e.on_player_unmuted] = function(event)
local player_name = get_player_name(event)
emit_event{
title = "Un-Muted",
description = "A player has been un-muted",
color = Colors.green,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
},
}
end
end
--- @param event EventData.on_player_muted
events[e.on_player_muted] = when("player_mutes", function(event)
local player_name = get_player_name(event)
emit_event{
title = "Muted",
description = "A player has been muted",
color = Colors.yellow,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
},
}
end)
--- @param event EventData.on_player_unmuted
events[e.on_player_unmuted] = when("player_mutes", function(event)
local player_name = get_player_name(event)
emit_event{
title = "Un-Muted",
description = "A player has been un-muted",
color = Colors.green,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
},
}
end)
--- Kick
if config.player_kicks then
--- @param event EventData.on_player_kicked
events[e.on_player_kicked] = function(event)
if event.by_player then
local player_name = get_player_name(event)
local by_player = game.players[event.by_player]
emit_event{
title = "Kick",
description = "A player has been kicked",
color = Colors.orange,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
{ name = "By", inline = true, value = append_playtime(by_player.name) },
{ name = "Reason", value = event.reason },
},
}
end
--- @param event EventData.on_player_kicked
events[e.on_player_kicked] = when("player_kicks", function(event)
if event.by_player then
local player_name = get_player_name(event)
local by_player = game.players[event.by_player]
emit_event{
title = "Kick",
description = "A player has been kicked",
color = Colors.orange,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
{ name = "By", inline = true, value = append_playtime(by_player.name) },
{ name = "Reason", value = event.reason },
},
}
end
end
end)
--- Promote and demote
if config.player_promotes then
--- @param event EventData.on_player_promoted
events[e.on_player_promoted] = function(event)
local player_name = get_player_name(event)
emit_event{
title = "Promote",
description = "A player has been promoted",
color = Colors.green,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
},
}
end
--- @param event EventData.on_player_demoted
events[e.on_player_demoted] = function(event)
local player_name = get_player_name(event)
emit_event{
title = "Demote",
description = "A player has been demoted",
color = Colors.yellow,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
},
}
end
end
--- @param event EventData.on_player_promoted
events[e.on_player_promoted] = when("player_promotes", function(event)
local player_name = get_player_name(event)
emit_event{
title = "Promote",
description = "A player has been promoted",
color = Colors.green,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
},
}
end)
--- @param event EventData.on_player_demoted
events[e.on_player_demoted] = when("player_promotes", function(event)
local player_name = get_player_name(event)
emit_event{
title = "Demote",
description = "A player has been demoted",
color = Colors.yellow,
fields = {
{ name = "Player", inline = true, value = append_playtime(player_name) },
},
}
end)
--- @param event EventData.on_console_command
events[e.on_console_command] = function(event)
if event.player_index then
local player_name = get_player_name(event)
if config[event.command] then
if logged_commands[event.command] then
emit_event{
title = event.command:gsub("^%l", string.upper),
description = "/" .. event.command .. " was used",
@@ -259,6 +281,6 @@ events[e.on_console_command] = function(event)
end
end
return {
return Features.guard(config, {
events = events,
}
})
+33 -16
View File
@@ -3,16 +3,37 @@ Disable new players from having certain items in their inventory, most commonly
]]
local ExpUtil = require("modules/exp_util")
local Features = require("modules/exp_scenario/features")
local Roles = require("modules/exp_roles")
local config = require("modules.exp_legacy.config.nukeprotect")
local config = Features.config("nuke_protection", {
ignore_admins = true, --- @setting ignore_admins Admins can hold banned items
banned_items = { "atomic-bomb" }, --- @setting banned_items Items which are removed from the inventory of players without the bypass permission
})
--- Set of the banned items, rebuilt when the config changes
local banned_items = {} --- @type table<string, true>
Features.on_apply(config, function()
banned_items = {}
for _, item_name in ipairs(config.banned_items) do
banned_items[item_name] = true
end
end)
--- The inventories which are checked and the events which trigger the check
local inventories = {
[defines.events.on_player_ammo_inventory_changed] = defines.inventory.character_ammo,
[defines.events.on_player_armor_inventory_changed] = defines.inventory.character_armor,
[defines.events.on_player_gun_inventory_changed] = defines.inventory.character_guns,
[defines.events.on_player_main_inventory_changed] = defines.inventory.character_main,
}
--- Check all items in the given inventory
--- @param player LuaPlayer
--- @param type defines.inventory
--- @param banned_items string[]
local function check_items(player, type, banned_items)
local function check_items(player, type)
-- If the player has perms to be ignored, then they should be
if config.ignore_permission and Roles.player_has_permission(player, config.ignore_permission) then return end
if Roles.player_has_permission(player, "exp_scenario.bypass.nuke_protection") then return end
if config.ignore_admins and player.admin then return end
local items = {} --- @type LuaItemStack[]
@@ -37,20 +58,16 @@ end
--- Add event handlers for the different inventories
local events = {}
for index, inventory in ipairs(config.inventories) do
if next(inventory.items) then
local assert_msg = "invalid event, no player index, index: " .. index
--- @param event { player_index: number }
events[inventory.event] = function(event)
local player_index = assert(event.player_index, assert_msg)
local player = assert(game.get_player(player_index))
if player and player.valid then
check_items(player, inventory.inventory, inventory.items)
end
for event_id, inventory in pairs(inventories) do
--- @param event { player_index: number }
events[event_id] = function(event)
local player = assert(game.get_player(event.player_index))
if player.valid then
check_items(player, inventory)
end
end
end
return {
return Features.guard(config, {
events = events,
}
})
+35 -11
View File
@@ -3,8 +3,22 @@ Protects entities and areas from being mined by players other than the one who p
]]
local Storage = require("modules/exp_util/storage")
local Features = require("modules/exp_scenario/features")
local Roles = require("modules/exp_roles")
local config = require("modules.exp_legacy.config.protection")
local config = Features.config("protection", {
ignore_admins = true, --- @setting ignore_admins If admins are ignored by the protection filter
repeat_count = 5, --- @setting repeat_count Number of protected entities that must be removed within repeat_minutes in order to trigger repeated removal protection
repeat_minutes = 20, --- @setting repeat_minutes The length of time, in minutes, that protected removals will be remembered for
always_protected_names = {}, --- @setting always_protected_names Names of entities which are always protected
always_protected_types = { --- @setting always_protected_types Types of entities which are always protected
"boiler", "generator", "offshore-pump", "reactor", "heat-exchanger", "heat-pipe", "fusion-reactor", "fusion-generator", "power-switch", "rocket-silo",
},
always_trigger_repeat_names = {}, --- @setting always_trigger_repeat_names Names of entities which always trigger repeated removal protection
always_trigger_repeat_types = { --- @setting always_trigger_repeat_types Types of entities which always trigger repeated removal protection
"reactor", "fusion-reactor", "rocket-silo",
},
})
local format_string = string.format
local floor = math.floor
@@ -19,10 +33,10 @@ local Protection = {
on_repeat_violation = script.generate_event_name(),
--- Names of entities which are always protected
--- @type string[]
protected_entity_names = config.always_protected_names,
protected_entity_names = {},
--- Types of entities which are always protected
--- @type string[]
protected_entity_types = config.always_protected_types,
protected_entity_types = {},
--- @package
events = {},
--- @package
@@ -46,10 +60,18 @@ local function to_set(values)
return set
end
local always_protected_names = to_set(config.always_protected_names)
local always_protected_types = to_set(config.always_protected_types)
local always_trigger_repeat_names = to_set(config.always_trigger_repeat_names)
local always_trigger_repeat_types = to_set(config.always_trigger_repeat_types)
local always_protected_names = {} --- @type table<string, true>
local always_protected_types = {} --- @type table<string, true>
local always_trigger_repeat_names = {} --- @type table<string, true>
local always_trigger_repeat_types = {} --- @type table<string, true>
Features.on_apply(config, function()
Protection.protected_entity_names = config.always_protected_names
Protection.protected_entity_types = config.always_protected_types
always_protected_names = to_set(config.always_protected_names)
always_protected_types = to_set(config.always_protected_types)
always_trigger_repeat_names = to_set(config.always_trigger_repeat_names)
always_trigger_repeat_types = to_set(config.always_trigger_repeat_types)
end)
local protected_entities = {} --- @type table<uint, table<string, LuaEntity>> Keyed by surface index then entity key
local protected_areas = {} --- @type table<uint, table<string, BoundingBox>> Keyed by surface index then area key
@@ -168,7 +190,7 @@ end
local function is_ignored(player, entity)
if config.ignore_admins and player.admin then return true end
if entity.last_user == nil or entity.last_user.index == player.index then return true end
if config.ignore_permission and Roles.player_has_permission(player, config.ignore_permission) then return true end
if Roles.player_has_permission(player, "exp_scenario.bypass.entity_protection") then return true end
return false
end
@@ -199,8 +221,10 @@ end
local function on_pre_player_mined_item(event)
local entity = event.entity
local player = game.players[event.player_index]
-- Protected entities are still forgotten while disabled, only the violations stop
if
not is_ignored(player, entity)
config.enabled
and not is_ignored(player, entity)
and (Protection.is_entity_protected(entity) or Protection.is_position_protected(entity.surface, entity.position))
then
raise_violation(event, player)
@@ -217,7 +241,7 @@ end
--- Forget protected removals older than the repeat lifetime
local function clear_old_repeats()
local old = game.tick - config.repeat_lifetime
local old = game.tick - config.repeat_minutes * 3600
for player_name, player_repeats in pairs(repeats) do
if player_repeats.last <= old then
repeats[player_name] = nil
@@ -232,6 +256,6 @@ Protection.events[e.on_space_platform_pre_mined] = on_entity_removed
Protection.events[e.on_robot_pre_mined] = on_entity_removed
Protection.events[e.on_entity_died] = on_entity_removed
Protection.events[e.script_raised_destroy] = on_entity_removed
Protection.on_nth_tick[config.refresh_rate] = clear_old_repeats
Protection.on_nth_tick[3600 * 5] = clear_old_repeats
return Protection
+21 -24
View File
@@ -2,7 +2,8 @@
Adds a custom spawn area with chests and afk turrets
]]
local config = require("modules.exp_legacy.config.spawn_area")
local Features = require("modules/exp_scenario/features")
local config = require("modules/exp_scenario/config/spawn_area")
--- Apply an offset to a LuaPosition
--- @param position MapPosition.struct
@@ -251,30 +252,26 @@ end
local on_nth_tick = {}
if config.turrets.enabled then
--- Refill the ammo in the spawn turrets
on_nth_tick[config.turrets.refill_time] = function()
if game.tick < 10 then return end
update_turrets()
end
--- Refill the ammo in the spawn turrets
on_nth_tick[60 * 60 * 5] = function()
if game.tick < 10 or not config.turrets.enabled then return end
update_turrets()
end
if config.resource_refill_nearby.enabled then
---
on_nth_tick[config.resource_refill_nearby.refill_time] = function()
if game.tick < 10 then return end
--- Refill the resources near spawn
on_nth_tick[60 * 60 * 10] = function()
if game.tick < 10 or not config.resource_refill_nearby.enabled then return end
local force = game.forces.player
local surface = assert(game.get_surface("nauvis"))
local entities = surface.find_entities_filtered{
position = force.get_spawn_position(surface),
radius = config.resource_refill_nearby.range,
name = config.resource_refill_nearby.resources_name
}
local force = game.forces.player
local surface = assert(game.get_surface("nauvis"))
local entities = surface.find_entities_filtered{
position = force.get_spawn_position(surface),
radius = config.resource_refill_nearby.range,
name = config.resource_refill_nearby.resources_name
}
for _, ore in ipairs(entities) do
ore.amount = ore.amount + math.random(config.resource_refill_nearby.amount[1], config.resource_refill_nearby.amount[2])
end
for _, ore in ipairs(entities) do
ore.amount = ore.amount + math.random(config.resource_refill_nearby.amount[1], config.resource_refill_nearby.amount[2])
end
end
@@ -302,9 +299,9 @@ end
local e = defines.events
return {
return Features.guard(config, {
on_nth_tick = on_nth_tick,
events = {
[e.on_player_created] = on_player_created,
}
}
},
})