mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-19 21:10:19 +02:00
minor changes to fishy and mtn
This commit is contained in:
parent
cda53a6bdd
commit
647d52859c
@ -1,5 +1,5 @@
|
||||
--antigrief things made by mewmew
|
||||
--modified by gerkiz--
|
||||
--rewritten by gerkiz--
|
||||
--as an admin, write either /trust or /untrust and the players name in the chat to grant/revoke immunity from protection
|
||||
|
||||
local Event = require 'utils.event'
|
||||
@ -26,7 +26,7 @@ local this = {
|
||||
players_warned = {},
|
||||
log_tree_harvest = false,
|
||||
do_not_check_trusted = true,
|
||||
protect_entities = false,
|
||||
protect_entities = true,
|
||||
enable_autokick = true,
|
||||
enable_autoban = false
|
||||
}
|
||||
@ -53,10 +53,50 @@ local ammo_names = {
|
||||
['rocket'] = true
|
||||
}
|
||||
|
||||
local not_protected = {
|
||||
['wall'] = true,
|
||||
['container'] = true,
|
||||
['logistic-container'] = true
|
||||
local protected = {
|
||||
['reactor'] = true,
|
||||
['roboport'] = true,
|
||||
['rocket-silo'] = true,
|
||||
['solar-panel'] = true,
|
||||
['generator'] = true,
|
||||
['splitter'] = true,
|
||||
['transport-belt'] = true,
|
||||
['underground-belt'] = true,
|
||||
['assembling-machine'] = true,
|
||||
['storage-tank'] = true,
|
||||
['pump'] = true,
|
||||
['mining-drill'] = true,
|
||||
['market'] = true,
|
||||
['accumulator'] = true,
|
||||
['ammo-turret'] = true,
|
||||
['artillery-turret'] = true,
|
||||
['artillery-wagon'] = true,
|
||||
['beacon'] = true,
|
||||
['boiler'] = true,
|
||||
['burner-generator'] = true,
|
||||
['car'] = true,
|
||||
['cargo-wagon'] = true,
|
||||
['constant-combinator'] = true,
|
||||
['straight-rail'] = true,
|
||||
['curved-rail'] = true,
|
||||
['decider-combinator'] = true,
|
||||
['electric-pole'] = true,
|
||||
['electric-turret'] = true,
|
||||
['fluid-turret'] = true,
|
||||
['fluid-wagon'] = true,
|
||||
['furnace'] = true,
|
||||
['gate'] = true,
|
||||
['heat-interface'] = true,
|
||||
['heat-pipe'] = true,
|
||||
['inserter'] = true,
|
||||
['lab'] = true,
|
||||
['lamp'] = true,
|
||||
['loader'] = true,
|
||||
['locomotive'] = true,
|
||||
['logistic-robot'] = true,
|
||||
['offshore-pump'] = true,
|
||||
['pipe-to-ground'] = true,
|
||||
['pipe'] = true
|
||||
}
|
||||
|
||||
Global.register(
|
||||
@ -637,11 +677,11 @@ local function protect_entities(event)
|
||||
local entity = event.entity
|
||||
|
||||
local function is_protected(e)
|
||||
if not_protected[e.type] then
|
||||
return false
|
||||
if protected[e.type] then
|
||||
return true
|
||||
end
|
||||
|
||||
return true
|
||||
return false
|
||||
end
|
||||
|
||||
if is_protected(entity) then
|
||||
@ -649,21 +689,29 @@ local function protect_entities(event)
|
||||
end
|
||||
end
|
||||
|
||||
--- Protect entities from the player force
|
||||
---@param event
|
||||
local function on_entity_damaged(event)
|
||||
if not this.protect_entities then
|
||||
return
|
||||
end
|
||||
|
||||
local entity = event.entity
|
||||
|
||||
if not entity or not entity.valid then
|
||||
return
|
||||
end
|
||||
|
||||
if event.force.index ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
if entity.force.index ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
if this.protect_entities then
|
||||
protect_entities(event)
|
||||
end
|
||||
end
|
||||
|
||||
--- Enabling this will protect all entities except for those in the not_protected table.
|
||||
---@param boolean true/false
|
||||
|
@ -478,10 +478,10 @@ local function player_list_show(player, frame, sort_by)
|
||||
tooltip = 'This player is an admin of this server.'
|
||||
elseif play_table[player_list[i].name] then
|
||||
trusted = '[color=#008000][T][/color]'
|
||||
tooltip = 'This player trusted.'
|
||||
tooltip = 'This player is trusted.'
|
||||
else
|
||||
trusted = '[color=#ffff00][U][/color]'
|
||||
tooltip = 'This player not trusted.'
|
||||
tooltip = 'This player is not trusted.'
|
||||
end
|
||||
|
||||
-- Name
|
||||
|
@ -1040,10 +1040,6 @@ local function on_player_joined_game(event)
|
||||
return
|
||||
end
|
||||
|
||||
if player.gui.left['fish_defense_game_lost'] then
|
||||
player.gui.left['fish_defense_game_lost'].destroy()
|
||||
end
|
||||
|
||||
if player.online_time == 0 then
|
||||
for item, amount in pairs(starting_items) do
|
||||
player.insert({name = item, count = amount})
|
||||
@ -1058,7 +1054,7 @@ local function on_player_joined_game(event)
|
||||
local pos = surface.find_non_colliding_position('character', spawn, 3, 0.5)
|
||||
|
||||
if not pos and player.online_time < 2 then
|
||||
player.teleport(game.forces['player'].get_spawn_position(surface), surface)
|
||||
player.teleport(spawn, surface)
|
||||
elseif player.online_time < 2 or player.surface.index ~= this.active_surface_index then
|
||||
player.teleport(pos, surface)
|
||||
end
|
||||
@ -1434,6 +1430,8 @@ function Public.reset_game()
|
||||
|
||||
global.chunk_queue = {}
|
||||
|
||||
Terrain.fish_eye(surface, {x = -2150, y = -300})
|
||||
|
||||
game.map_settings.enemy_expansion.enabled = false
|
||||
game.map_settings.enemy_evolution.destroy_factor = 0
|
||||
game.map_settings.enemy_evolution.time_factor = 0
|
||||
@ -1533,17 +1531,4 @@ Event.add(defines.events.on_robot_mined_entity, on_robot_mined_entity)
|
||||
Event.add(defines.events.on_tick, on_tick)
|
||||
Event.on_init(on_init)
|
||||
|
||||
local gmeta = getmetatable(_ENV)
|
||||
if not gmeta then
|
||||
gmeta = {}
|
||||
setmetatable(_ENV, gmeta)
|
||||
end
|
||||
gmeta.__newindex = function(_, n, v)
|
||||
log('Desync warning: attempt to write to undeclared var ' .. n)
|
||||
global[n] = v
|
||||
end
|
||||
gmeta.__index = function(_, n)
|
||||
return global[n]
|
||||
end
|
||||
|
||||
return Public
|
||||
|
@ -330,6 +330,7 @@ local function process_chunk_queue()
|
||||
if chunks <= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
for k, left_top in pairs(global.chunk_queue) do
|
||||
process_chunk(left_top)
|
||||
global.chunk_queue[k] = nil
|
||||
@ -480,8 +481,6 @@ function Public.generate_spawn_area(this, surface)
|
||||
|
||||
render_market_hp()
|
||||
|
||||
Public.fish_eye(surface, {x = -2150, y = -300})
|
||||
|
||||
local r = 16
|
||||
for _, entity in pairs(
|
||||
surface.find_entities_filtered(
|
||||
@ -544,6 +543,7 @@ end
|
||||
|
||||
function Public.fish_eye(surface, position)
|
||||
surface.request_to_generate_chunks(position, 2)
|
||||
surface.force_generate_chunk_requests()
|
||||
for x = -48, 48, 1 do
|
||||
for y = -48, 48, 1 do
|
||||
local p = {x = position.x + x, y = position.y + y}
|
||||
|
@ -434,10 +434,10 @@ function Public.create_wagon_room(icw, wagon)
|
||||
local multiple_chests = ICW.get('multiple_chests')
|
||||
local wagon_areas = ICW.get('wagon_areas')
|
||||
local cargo_wagon = wagon_areas['cargo-wagon']
|
||||
local position1 = {cargo_wagon.left_top.x + 7, cargo_wagon.left_top.y + 1}
|
||||
local position2 = {cargo_wagon.right_bottom.x - 8, cargo_wagon.left_top.y + 1}
|
||||
local position3 = {cargo_wagon.left_top.x + 7, cargo_wagon.right_bottom.y - 2}
|
||||
local position4 = {cargo_wagon.right_bottom.x - 8, cargo_wagon.right_bottom.y - 2}
|
||||
local position1 = {cargo_wagon.left_top.x + 4, cargo_wagon.left_top.y + 1}
|
||||
local position2 = {cargo_wagon.right_bottom.x - 5, cargo_wagon.left_top.y + 1}
|
||||
local position3 = {cargo_wagon.left_top.x + 4, cargo_wagon.right_bottom.y - 2}
|
||||
local position4 = {cargo_wagon.right_bottom.x - 5, cargo_wagon.right_bottom.y - 2}
|
||||
|
||||
if multiple_chests then
|
||||
local e1 =
|
||||
|
@ -51,12 +51,11 @@ function Public.get(key)
|
||||
end
|
||||
|
||||
function Public.set_wagon_area(tbl)
|
||||
local arg = tbl
|
||||
if not arg then
|
||||
if not tbl then
|
||||
return
|
||||
end
|
||||
|
||||
this.wagon_areas = arg
|
||||
this.wagon_areas = tbl
|
||||
end
|
||||
|
||||
return Public
|
||||
|
@ -244,8 +244,14 @@ function Public.reset_map()
|
||||
Entities.set_scores()
|
||||
AntiGrief.log_tree_harvest(true)
|
||||
AntiGrief.whitelist_types('tree', true)
|
||||
AntiGrief.protect_entities(true)
|
||||
get_score.score_table = {}
|
||||
--AntiGrief.protect_entities(true)
|
||||
|
||||
local players = game.connected_players
|
||||
for i = 1, #players do
|
||||
local player = players[i]
|
||||
Score.init_player_table(player)
|
||||
end
|
||||
|
||||
Difficulty.reset_difficulty_poll({difficulty_poll_closing_timeout = game.tick + 36000})
|
||||
Diff.gui_width = 20
|
||||
|
||||
@ -259,7 +265,7 @@ function Public.reset_map()
|
||||
Collapse.set_direction('north')
|
||||
Collapse.start_now(false)
|
||||
|
||||
local x_value = rng(15, 25)
|
||||
--[[ local x_value = rng(15, 25)
|
||||
local y_value = rng(50, 60)
|
||||
|
||||
local data = {
|
||||
@ -268,9 +274,7 @@ function Public.reset_map()
|
||||
['fluid-wagon'] = {left_top = {x = -x_value, y = 0}, right_bottom = {x = x_value, y = y_value}},
|
||||
['locomotive'] = {left_top = {x = -x_value, y = 0}, right_bottom = {x = x_value, y = y_value}}
|
||||
}
|
||||
|
||||
ICT.set_wagon_area(data)
|
||||
|
||||
ICT.set_wagon_area(data) ]]
|
||||
this.locomotive_health = 10000
|
||||
this.locomotive_max_health = 10000
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user