1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-30 23:17:53 +02:00

mountain fortress and admin panel fixes

This commit is contained in:
Gerkiz 2021-05-09 17:11:18 +02:00
parent 0ccbe23c71
commit 45638522a7
3 changed files with 14 additions and 18 deletions

View File

@ -24,14 +24,15 @@ local this = {
capsule_history = {},
friendly_fire_history = {},
mining_history = {},
whitelist_mining_history = {},
corpse_history = {},
message_history = {},
cancel_crafting_history = {},
whitelist_types = {},
permission_group_editing = {},
players_warned = {},
damage_history = {},
punish_cancel_craft = false,
log_tree_harvest = false,
do_not_check_trusted = true,
enable_autokick = false,
enable_autoban = false,
@ -481,11 +482,11 @@ local function on_player_mined_entity(event)
end
if this.whitelist_types[entity.type] then
if not this.mining_history then
this.mining_history = {}
if not this.whitelist_mining_history then
this.whitelist_mining_history = {}
end
if #this.mining_history > 1000 then
this.mining_history = {}
if #this.whitelist_mining_history > 1000 then
this.whitelist_mining_history = {}
end
local t = math.abs(math.floor((game.tick) / 60))
t = FancyTime.short_fancy_time(t)
@ -498,7 +499,7 @@ local function on_player_mined_entity(event)
str = str .. math.floor(entity.position.y)
str = str .. ' '
str = str .. 'surface:' .. entity.surface.index
increment(this.mining_history, str)
increment(this.whitelist_mining_history, str)
return
end
@ -858,20 +859,12 @@ function Public.reset_tables()
this.capsule_history = {}
this.friendly_fire_history = {}
this.mining_history = {}
this.whitelist_mining_history = {}
this.corpse_history = {}
this.message_history = {}
this.cancel_crafting_history = {}
end
--- Enable this to log when trees are destroyed
---@param value <boolean>
function Public.log_tree_harvest(value)
if value then
this.log_tree_harvest = value
end
return this.log_tree_harvest
end
--- Add entity type to the whitelist so it gets logged.
---@param key <string>
---@param value <string>

View File

@ -242,6 +242,7 @@ local function draw_events(data)
['Message History'] = antigrief.message_history,
['Friendly Fire History'] = antigrief.friendly_fire_history,
['Mining History'] = antigrief.mining_history,
['Mining Override History'] = antigrief.whitelist_mining_history,
['Landfill History'] = antigrief.landfill_history,
['Corpse Looting History'] = antigrief.corpse_history,
['Cancel Crafting History'] = antigrief.cancel_crafting_history
@ -283,7 +284,7 @@ local function draw_events(data)
end
if history == 'Message History' then
tooltip = nil
tooltip = ''
end
frame.datalog.add(
@ -493,6 +494,9 @@ local function create_admin_panel(data)
if antigrief.mining_history then
table.insert(histories, 'Mining History')
end
if antigrief.whitelist_mining_history then
table.insert(histories, 'Mining Override History')
end
if antigrief.landfill_history then
table.insert(histories, 'Landfill History')
end

View File

@ -188,7 +188,6 @@ function Public.reset_map()
Balance.init_enemy_weapon_damage()
AntiGrief.log_tree_harvest(true)
AntiGrief.whitelist_types('tree', true)
AntiGrief.enable_capsule_warning(false)
AntiGrief.enable_capsule_cursor_warning(false)