1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-09-16 09:06:21 +02:00

planet prison fixes

This commit is contained in:
Gerkiz
2021-04-04 13:50:24 +02:00
parent 80736a24d5
commit eef1c3f57a
2 changed files with 18 additions and 19 deletions

View File

@@ -20,7 +20,7 @@ local Color = require 'utils.color_presets'
local this = {
remove_offline_players = {
players = {},
time = 18000,
time = 216000, -- 1h
enabled = true
}
}
@@ -1325,7 +1325,9 @@ local function mined_wreckage(e)
end
local cand = candidates[CommonFunctions.rand_range(1, count)]
e.buffer.insert(cand)
if e.buffer and cand then
e.buffer.insert(cand)
end
end
local function on_player_mined_entity(e)
@@ -1335,7 +1337,7 @@ local function on_player_mined_entity(e)
end
mined_wreckage(e)
ClaimsFunctions.on_player_mined_entity(ent)
-- ClaimsFunctions.on_player_mined_entity(ent)
end
local function on_player_died(e)
@@ -1578,7 +1580,7 @@ local function on_entity_died(e)
hostile_death(e)
character_death(e)
ClaimsFunctions.on_entity_died(e.entity)
-- ClaimsFunctions.on_entity_died(e.entity)
if valid_ents[e.entity.name] then
e.entity.destroy()
@@ -1617,7 +1619,7 @@ local function on_built_entity(e)
return
end
ClaimsFunctions.on_built_entity(ent)
-- ClaimsFunctions.on_built_entity(ent)
merchant_exploit_check(ent)
end
@@ -1786,17 +1788,4 @@ Event.add(defines.events.on_tick, on_tick)
Event.add(defines.events.on_tick, on_tick_reset)
Event.add(defines.events.on_rocket_launched, on_rocket_launched)
setmetatable(
_G,
{
__newindex = function(_, n, v)
log('Desync warning: attempt to write to undeclared var ' .. n)
global[n] = v
end,
__index = function(_, n)
return global[n]
end
}
)
return Public

View File

@@ -45,7 +45,9 @@ local function claim_new_claim(ent)
this._claims_info[ent.force.name].collections = {}
end
insert(this._claims_info[ent.force.name].collections, point)
if this._claims_info[ent.force.name].collections then
this._claims_info[ent.force.name].collections[#this._claims_info[ent.force.name].collections + 1] = point
end
end
local function claim_on_build_entity(ent)
@@ -53,6 +55,10 @@ local function claim_on_build_entity(ent)
local force = ent.force.name
local data = this._claims_info[force]
if not max_dist then
return
end
if data == nil then
claim_new_claim(ent)
return
@@ -89,6 +95,10 @@ local function claim_on_build_entity(ent)
end
local function claims_in_markers(name)
if not this._claim_markers then
return false
end
for _, marker in pairs(this._claim_markers) do
if name == marker then
return true