mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-01 13:08:05 +02:00
minor changes
This commit is contained in:
parent
407750a9aa
commit
a7724f9f49
123
antigrief.lua
123
antigrief.lua
@ -79,12 +79,17 @@ local function on_player_ammo_inventory_changed(event)
|
|||||||
playtime = player.online_time + tracker[player.name]
|
playtime = player.online_time + tracker[player.name]
|
||||||
end
|
end
|
||||||
if playtime < 1296000 then
|
if playtime < 1296000 then
|
||||||
local nukes = player.remove_item({name="atomic-bomb", count=1000})
|
local nukes = player.remove_item({name = 'atomic-bomb', count = 1000})
|
||||||
if nukes > 0 then
|
if nukes > 0 then
|
||||||
player.surface.spill_item_stack(player.position, {name = "atomic-bomb", count = nukes}, false)
|
player.surface.spill_item_stack(player.position, {name = 'atomic-bomb', count = nukes}, false)
|
||||||
player.print("You have not grown accustomed to this technology yet.", {r=0.22, g=0.99, b=0.99})
|
player.print('You have not grown accustomed to this technology yet.', {r = 0.22, g = 0.99, b = 0.99})
|
||||||
Server.to_discord_bold(table.concat{'[Nuke] ' .. player.name .. ' tried to equip nukes but was not trusted.'})
|
Server.to_discord_bold(
|
||||||
game.print('[Nuke] ' .. player.name .. ' tried to equip nukes but was not trusted.', {r=0.22, g=0.99, b=0.99})
|
table.concat {'[Nuke] ' .. player.name .. ' tried to equip nukes but was not trusted.'}
|
||||||
|
)
|
||||||
|
game.print(
|
||||||
|
'[Nuke] ' .. player.name .. ' tried to equip nukes but was not trusted.',
|
||||||
|
{r = 0.22, g = 0.99, b = 0.99}
|
||||||
|
)
|
||||||
player.character.health = 0
|
player.character.health = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -118,15 +123,18 @@ local function on_player_built_tile(event)
|
|||||||
player.print("You have not grown accustomed to this technology yet.", { r=0.22, g=0.99, b=0.99})
|
player.print("You have not grown accustomed to this technology yet.", { r=0.22, g=0.99, b=0.99})
|
||||||
end
|
end
|
||||||
end]]
|
end]]
|
||||||
|
|
||||||
--landfill history--
|
--landfill history--
|
||||||
if not global.landfill_history then global.landfill_history = {} end
|
if not global.landfill_history then
|
||||||
if #global.landfill_history > 999 then global.landfill_history = {} end
|
global.landfill_history = {}
|
||||||
|
end
|
||||||
|
if #global.landfill_history > 999 then
|
||||||
|
global.landfill_history = {}
|
||||||
|
end
|
||||||
local t = math.abs(math.floor((game.tick) / 3600))
|
local t = math.abs(math.floor((game.tick) / 3600))
|
||||||
local str = "[" .. t .. "] "
|
local str = '[' .. t .. '] '
|
||||||
str = str .. player.name .. " at X:"
|
str = str .. player.name .. ' at X:'
|
||||||
str = str .. placed_tiles[1].position.x
|
str = str .. placed_tiles[1].position.x
|
||||||
str = str .. " Y:"
|
str = str .. ' Y:'
|
||||||
str = str .. placed_tiles[1].position.y
|
str = str .. placed_tiles[1].position.y
|
||||||
table.insert(global.landfill_history, str)
|
table.insert(global.landfill_history, str)
|
||||||
end
|
end
|
||||||
@ -167,29 +175,35 @@ local function on_player_used_capsule(event)
|
|||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
local position = event.position
|
local position = event.position
|
||||||
local used_item = event.item
|
local used_item = event.item
|
||||||
if used_item.name ~= "artillery-targeting-remote" then return end
|
if used_item.name ~= 'artillery-targeting-remote' then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local playtime = player.online_time
|
local playtime = player.online_time
|
||||||
if tracker[player.name] then
|
if tracker[player.name] then
|
||||||
playtime = player.online_time + tracker[player.name]
|
playtime = player.online_time + tracker[player.name]
|
||||||
end
|
end
|
||||||
if playtime < 1296000 and player.admin == false and trusted[player.name] == false then
|
if playtime < 1296000 and player.admin == false and trusted[player.name] == false then
|
||||||
player.print("You have not grown accustomed to this technology yet.", { r=0.22, g=0.99, b=0.99})
|
player.print('You have not grown accustomed to this technology yet.', {r = 0.22, g = 0.99, b = 0.99})
|
||||||
local area = {{position.x - 1, position.y - 1},{position.x + 1, position.y + 1}}
|
local area = {{position.x - 1, position.y - 1}, {position.x + 1, position.y + 1}}
|
||||||
local entities = player.surface.find_entities_filtered({area = area, name = "artillery-flare"})
|
local entities = player.surface.find_entities_filtered({area = area, name = 'artillery-flare'})
|
||||||
for _, e in pairs(entities) do
|
for _, e in pairs(entities) do
|
||||||
e.destroy()
|
e.destroy()
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not global.artillery_history then global.artillery_history = {} end
|
if not global.artillery_history then
|
||||||
if #global.artillery_history > 999 then global.artillery_history = {} end
|
global.artillery_history = {}
|
||||||
|
end
|
||||||
|
if #global.artillery_history > 999 then
|
||||||
|
global.artillery_history = {}
|
||||||
|
end
|
||||||
local t = math.abs(math.floor((game.tick) / 3600))
|
local t = math.abs(math.floor((game.tick) / 3600))
|
||||||
local str = "[" .. t .. "] "
|
local str = '[' .. t .. '] '
|
||||||
str = str .. player.name .. " at X:"
|
str = str .. player.name .. ' at X:'
|
||||||
str = str .. math.floor(position.x)
|
str = str .. math.floor(position.x)
|
||||||
str = str .. " Y:"
|
str = str .. ' Y:'
|
||||||
str = str .. math.floor(position.y)
|
str = str .. math.floor(position.y)
|
||||||
table.insert(global.artillery_history, str)
|
table.insert(global.artillery_history, str)
|
||||||
end
|
end
|
||||||
@ -208,22 +222,36 @@ local blacklisted_types = {
|
|||||||
|
|
||||||
--Friendly Fire History
|
--Friendly Fire History
|
||||||
local function on_entity_died(event)
|
local function on_entity_died(event)
|
||||||
if not event.cause then return end
|
if not event.cause then
|
||||||
if event.cause.name ~= "character" then return end
|
return
|
||||||
if event.cause.force.name ~= event.entity.force.name then return end
|
end
|
||||||
if blacklisted_types[event.entity.type] then return end
|
if event.cause.name ~= 'character' then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if event.cause.force.name ~= event.entity.force.name then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if blacklisted_types[event.entity.type] then
|
||||||
|
return
|
||||||
|
end
|
||||||
local player = event.cause.player
|
local player = event.cause.player
|
||||||
if not global.friendly_fire_history then global.friendly_fire_history = {} end
|
if not global.friendly_fire_history then
|
||||||
if #global.friendly_fire_history > 999 then global.friendly_fire_history = {} end
|
global.friendly_fire_history = {}
|
||||||
if not player then return end
|
end
|
||||||
|
if #global.friendly_fire_history > 999 then
|
||||||
|
global.friendly_fire_history = {}
|
||||||
|
end
|
||||||
|
if not player then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local t = math.abs(math.floor((game.tick) / 3600))
|
local t = math.abs(math.floor((game.tick) / 3600))
|
||||||
local str = "[" .. t .. "] "
|
local str = '[' .. t .. '] '
|
||||||
str = str .. player.name .. " destroyed "
|
str = str .. player.name .. ' destroyed '
|
||||||
str = str .. event.entity.name
|
str = str .. event.entity.name
|
||||||
str = str .. " at X:"
|
str = str .. ' at X:'
|
||||||
str = str .. math.floor(event.entity.position.x)
|
str = str .. math.floor(event.entity.position.x)
|
||||||
str = str .. " Y:"
|
str = str .. ' Y:'
|
||||||
str = str .. math.floor(event.entity.position.y)
|
str = str .. math.floor(event.entity.position.y)
|
||||||
|
|
||||||
global.friendly_fire_history[#global.friendly_fire_history + 1] = str
|
global.friendly_fire_history[#global.friendly_fire_history + 1] = str
|
||||||
@ -231,22 +259,34 @@ end
|
|||||||
|
|
||||||
--Mining Thieves History
|
--Mining Thieves History
|
||||||
local function on_player_mined_entity(event)
|
local function on_player_mined_entity(event)
|
||||||
if not event.entity.last_user then return end
|
if not event.entity.last_user then
|
||||||
|
return
|
||||||
|
end
|
||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
if event.entity.last_user.name == player.name then return end
|
if event.entity.last_user.name == player.name then
|
||||||
if event.entity.force.name ~= player.force.name then return end
|
return
|
||||||
if blacklisted_types[event.entity.type] then return end
|
end
|
||||||
|
if event.entity.force.name ~= player.force.name then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if blacklisted_types[event.entity.type] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if not global.mining_history then global.mining_history = {} end
|
if not global.mining_history then
|
||||||
if #global.mining_history > 999 then global.mining_history = {} end
|
global.mining_history = {}
|
||||||
|
end
|
||||||
|
if #global.mining_history > 999 then
|
||||||
|
global.mining_history = {}
|
||||||
|
end
|
||||||
|
|
||||||
local t = math.abs(math.floor((game.tick) / 3600))
|
local t = math.abs(math.floor((game.tick) / 3600))
|
||||||
local str = "[" .. t .. "] "
|
local str = '[' .. t .. '] '
|
||||||
str = str .. player.name .. " mined "
|
str = str .. player.name .. ' mined '
|
||||||
str = str .. event.entity.name
|
str = str .. event.entity.name
|
||||||
str = str .. " at X:"
|
str = str .. ' at X:'
|
||||||
str = str .. math.floor(event.entity.position.x)
|
str = str .. math.floor(event.entity.position.x)
|
||||||
str = str .. " Y:"
|
str = str .. ' Y:'
|
||||||
str = str .. math.floor(event.entity.position.y)
|
str = str .. math.floor(event.entity.position.y)
|
||||||
|
|
||||||
global.mining_history[#global.mining_history + 1] = str
|
global.mining_history[#global.mining_history + 1] = str
|
||||||
@ -305,7 +345,6 @@ end
|
|||||||
|
|
||||||
event.add(defines.events.on_player_mined_entity, on_player_mined_entity)
|
event.add(defines.events.on_player_mined_entity, on_player_mined_entity)
|
||||||
event.add(defines.events.on_entity_died, on_entity_died)
|
event.add(defines.events.on_entity_died, on_entity_died)
|
||||||
event.add(defines.events.on_entity_died, on_entity_died_do_actual_usefull_logging)
|
|
||||||
event.add(defines.events.on_built_entity, on_built_entity)
|
event.add(defines.events.on_built_entity, on_built_entity)
|
||||||
event.add(defines.events.on_gui_opened, on_gui_opened)
|
event.add(defines.events.on_gui_opened, on_gui_opened)
|
||||||
event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)
|
event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)
|
||||||
|
@ -72,6 +72,13 @@ function Public.get_score(player)
|
|||||||
return score_list[player.index]
|
return score_list[player.index]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Public.reset_score()
|
||||||
|
global.custom_highscore = {
|
||||||
|
description = 'Won rounds:',
|
||||||
|
score_list = {}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
local function on_init()
|
local function on_init()
|
||||||
global.custom_highscore = {
|
global.custom_highscore = {
|
||||||
description = "Won rounds:",
|
description = "Won rounds:",
|
||||||
|
@ -228,12 +228,26 @@ local function set_next_wave()
|
|||||||
end
|
end
|
||||||
if wave_defense_table.wave_number % 25 == 0 then
|
if wave_defense_table.wave_number % 25 == 0 then
|
||||||
wave_defense_table.boss_wave = true
|
wave_defense_table.boss_wave = true
|
||||||
|
wave_defense_table.boss_wave_warning = true
|
||||||
|
game.print('Boss Wave: ' .. wave_defense_table.wave_number, {r = 0.8, g = 0.1, b = 0.1})
|
||||||
threat_gain = threat_gain * 2
|
threat_gain = threat_gain * 2
|
||||||
|
else
|
||||||
|
if wave_defense_table.boss_wave_warning then
|
||||||
|
wave_defense_table.boss_wave_warning = false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
wave_defense_table.threat = wave_defense_table.threat + math_floor(threat_gain)
|
wave_defense_table.threat = wave_defense_table.threat + math_floor(threat_gain)
|
||||||
wave_defense_table.last_wave = wave_defense_table.next_wave
|
wave_defense_table.last_wave = wave_defense_table.next_wave
|
||||||
wave_defense_table.next_wave = game.tick + wave_defense_table.wave_interval
|
wave_defense_table.next_wave = game.tick + wave_defense_table.wave_interval
|
||||||
|
if wave_defense_table.clear_corpses then
|
||||||
|
local surface = game.surfaces[wave_defense_table.surface_index]
|
||||||
|
for _, entity in pairs(surface.find_entities_filtered {type = 'corpse'}) do
|
||||||
|
if math_random(1, 2) == 1 then
|
||||||
|
entity.destroy()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function reform_group(group)
|
local function reform_group(group)
|
||||||
|
@ -13,6 +13,7 @@ Global.register(
|
|||||||
|
|
||||||
function Public.reset_wave_defense()
|
function Public.reset_wave_defense()
|
||||||
wave_defense.boss_wave = false
|
wave_defense.boss_wave = false
|
||||||
|
wave_defense.boss_wave_warning = false
|
||||||
wave_defense.side_target_count = 0
|
wave_defense.side_target_count = 0
|
||||||
wave_defense.active_biters = {}
|
wave_defense.active_biters = {}
|
||||||
wave_defense.active_biter_count = 0
|
wave_defense.active_biter_count = 0
|
||||||
@ -48,6 +49,7 @@ function Public.reset_wave_defense()
|
|||||||
wave_defense.worm_building_chance = 3
|
wave_defense.worm_building_chance = 3
|
||||||
wave_defense.worm_building_density = 16
|
wave_defense.worm_building_density = 16
|
||||||
wave_defense.worm_raffle = {}
|
wave_defense.worm_raffle = {}
|
||||||
|
wave_defense.clear_corpses = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function Public.get_table()
|
function Public.get_table()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user