From 0c1c15009ef993254bff9896558bb4b5e43938bc Mon Sep 17 00:00:00 2001 From: MewMew <=> Date: Sun, 2 Dec 2018 05:47:58 +0100 Subject: [PATCH] Friendly Fire History --- antigrief.lua | 21 +++++++++++++++++++++ antigrief_admin_panel.lua | 14 +++++++++++++- maps/fish_defender.lua | 18 +++++++++--------- maps/spooky_forest.lua | 5 +++++ maps/spooky_forest_changelog.txt | 3 +++ 5 files changed, 51 insertions(+), 10 deletions(-) diff --git a/antigrief.lua b/antigrief.lua index 638e7956..5ca2683c 100644 --- a/antigrief.lua +++ b/antigrief.lua @@ -115,6 +115,7 @@ local function on_built_entity(event) end end +--Artillery History local function on_player_used_capsule(event) local player = game.players[event.player_index] local position = event.position @@ -130,6 +131,25 @@ local function on_player_used_capsule(event) end end +--Friendly Fire History +local function on_entity_died(event) + if not event.cause then return end + if event.cause.name ~= "player" then return end + if event.cause.force.name ~= event.entity.force.name then return end + local player = event.cause.player + if not global.friendly_fire_history then global.friendly_fire_history = {} end + if #global.friendly_fire_history > 999 then global.friendly_fire_history = {} end + + local str = player.name .. " destroyed " + str = str .. event.entity.name + str = str .. " at X:" + str = str .. math.floor(event.entity.position.x) + str = str .. " Y:" + str = str .. math.floor(event.entity.position.y) + + global.friendly_fire_history[#global.friendly_fire_history + 1] = str +end + local function on_gui_opened(event) if not event.entity then return end if event.entity.name ~= "character-corpse" then return end @@ -149,6 +169,7 @@ local function on_pre_player_mined_item(event) end end +event.add(defines.events.on_entity_died, on_entity_died) event.add(defines.events.on_built_entity, on_built_entity) event.add(defines.events.on_console_command, on_console_command) event.add(defines.events.on_gui_opened, on_gui_opened) diff --git a/antigrief_admin_panel.lua b/antigrief_admin_panel.lua index 9a3063c5..c8623e10 100644 --- a/antigrief_admin_panel.lua +++ b/antigrief_admin_panel.lua @@ -234,7 +234,19 @@ local function create_admin_panel(player) local l = frame.add({type = "label", caption = "----------------------------------------------"}) end - local t = frame.add({type = "table", column_count = 2}) + local t = frame.add({type = "table", column_count = 3}) + + if global.friendly_fire_history then + local tt = t.add({type = "table", column_count = 1}) + local l = tt.add({type = "label", caption = "Friendly Fire History:"}) + l.style.font = "default-listbox" + l.style.font_color = { r=0.98, g=0.66, b=0.22} + local scroll_pane = tt.add({ type = "scroll-pane", direction = "vertical", horizontal_scroll_policy = "never", vertical_scroll_policy = "auto"}) + scroll_pane.style.maximal_height = 160 + for i = #global.friendly_fire_history, 1, -1 do + scroll_pane.add({type = "label", caption = global.friendly_fire_history[i]}) + end + end if global.landfill_history then local tt = t.add({type = "table", column_count = 1}) diff --git a/maps/fish_defender.lua b/maps/fish_defender.lua index 0d9f165f..822d888f 100644 --- a/maps/fish_defender.lua +++ b/maps/fish_defender.lua @@ -385,7 +385,7 @@ local function refresh_market_offers() {price = {}, offer = {type = 'nothing', effect_description = str5}}, {price = {{"coin", 3}}, offer = {type = 'give-item', item = "raw-fish", count = 1}}, {price = {{"coin", 1}}, offer = {type = 'give-item', item = 'raw-wood', count = 8}}, - {price = {{"coin", 9}}, offer = {type = 'give-item', item = 'grenade', count = 1}}, + {price = {{"coin", 8}}, offer = {type = 'give-item', item = 'grenade', count = 1}}, {price = {{"coin", 32}}, offer = {type = 'give-item', item = 'cluster-grenade', count = 1}}, {price = {{"coin", 1}}, offer = {type = 'give-item', item = 'land-mine', count = 1}}, {price = {{"coin", 80}}, offer = {type = 'give-item', item = 'car', count = 1}}, @@ -395,7 +395,7 @@ local function refresh_market_offers() {price = {{"coin", 50}}, offer = {type = 'give-item', item = 'gun-turret', count = 1}}, {price = {{"coin", 350}}, offer = {type = 'give-item', item = 'laser-turret', count = 1}}, {price = {{"coin", 500}}, offer = {type = 'give-item', item = 'artillery-turret', count = 1}}, - {price = {{"coin", 10}}, offer = {type = 'give-item', item = 'artillery-shell', count = 1}}, + {price = {{"coin", 8}}, offer = {type = 'give-item', item = 'artillery-shell', count = 1}}, {price = {{"coin", 25}}, offer = {type = 'give-item', item = 'artillery-targeting-remote', count = 1}}, {price = {{"coin", 1}}, offer = {type = 'give-item', item = 'firearm-magazine', count = 1}}, {price = {{"coin", 4}}, offer = {type = 'give-item', item = 'piercing-rounds-magazine', count = 1}}, @@ -404,7 +404,7 @@ local function refresh_market_offers() {price = {{"coin", 30}}, offer = {type = 'give-item', item = "submachine-gun", count = 1}}, {price = {{"coin", 250}}, offer = {type = 'give-item', item = 'combat-shotgun', count = 1}}, {price = {{"coin", 650}}, offer = {type = 'give-item', item = 'flamethrower', count = 1}}, - {price = {{"coin", 35}}, offer = {type = 'give-item', item = 'flamethrower-ammo', count = 1}}, + {price = {{"coin", 25}}, offer = {type = 'give-item', item = 'flamethrower-ammo', count = 1}}, {price = {{"coin", 125}}, offer = {type = 'give-item', item = 'rocket-launcher', count = 1}}, {price = {{"coin", 2}}, offer = {type = 'give-item', item = 'rocket', count = 1}}, {price = {{"coin", 7}}, offer = {type = 'give-item', item = 'explosive-rocket', count = 1}}, @@ -412,12 +412,12 @@ local function refresh_market_offers() {price = {{"coin", 90}}, offer = {type = 'give-item', item = 'railgun', count = 1}}, {price = {{"coin", 5}}, offer = {type = 'give-item', item = 'railgun-dart', count = 1}}, {price = {{"coin", 40}}, offer = {type = 'give-item', item = 'poison-capsule', count = 1}}, - {price = {{"coin", 8}}, offer = {type = 'give-item', item = 'defender-capsule', count = 1}}, + {price = {{"coin", 4}}, offer = {type = 'give-item', item = 'defender-capsule', count = 1}}, {price = {{"coin", 10}}, offer = {type = 'give-item', item = 'light-armor', count = 1}}, - {price = {{"coin", 150}}, offer = {type = 'give-item', item = 'heavy-armor', count = 1}}, + {price = {{"coin", 125}}, offer = {type = 'give-item', item = 'heavy-armor', count = 1}}, {price = {{"coin", 350}}, offer = {type = 'give-item', item = 'modular-armor', count = 1}}, {price = {{"coin", 1500}}, offer = {type = 'give-item', item = 'power-armor', count = 1}}, - {price = {{"coin", 12500}}, offer = {type = 'give-item', item = 'power-armor-mk2', count = 1}}, + {price = {{"coin", 12000}}, offer = {type = 'give-item', item = 'power-armor-mk2', count = 1}}, {price = {{"coin", 50}}, offer = {type = 'give-item', item = 'solar-panel-equipment', count = 1}}, {price = {{"coin", 2250}}, offer = {type = 'give-item', item = 'fusion-reactor-equipment', count = 1}}, {price = {{"coin", 100}}, offer = {type = 'give-item', item = 'battery-equipment', count = 1}}, @@ -427,7 +427,7 @@ local function refresh_market_offers() {price = {{"coin", 125}}, offer = {type = 'give-item', item = 'night-vision-equipment', count = 1}}, {price = {{"coin", 200}}, offer = {type = 'give-item', item = 'belt-immunity-equipment', count = 1}}, {price = {{"coin", 250}}, offer = {type = 'give-item', item = 'personal-roboport-equipment', count = 1}}, - {price = {{"coin", 30}}, offer = {type = 'give-item', item = 'construction-robot', count = 1}} + {price = {{"coin", 20}}, offer = {type = 'give-item', item = 'construction-robot', count = 1}} } for _, item in pairs(market_items) do @@ -760,8 +760,8 @@ local function on_player_joined_game(event) game.forces.player.set_ammo_damage_modifier("shotgun-shell", 0.5) global.entity_limits = { - ["gun-turret"] = {placed = 1, limit = 1, str = "gun turret", slot_price = 150}, - ["laser-turret"] = {placed = 0, limit = 1, str = "laser turret", slot_price = 350}, + ["gun-turret"] = {placed = 1, limit = 1, str = "gun turret", slot_price = 75}, + ["laser-turret"] = {placed = 0, limit = 1, str = "laser turret", slot_price = 250}, ["artillery-turret"] = {placed = 0, limit = 1, str = "artillery turret", slot_price = 500}, ["flamethrower-turret"] = {placed = 0, limit = 0, str = "flamethrower turret", slot_price = 50000}, ["land-mine"] = {placed = 0, limit = 1, str = "landmine", slot_price = 2} diff --git a/maps/spooky_forest.lua b/maps/spooky_forest.lua index 88001760..372d7643 100644 --- a/maps/spooky_forest.lua +++ b/maps/spooky_forest.lua @@ -420,6 +420,11 @@ local function on_marked_for_deconstruction(event) end end +local function on_research_finished(event) + game.forces.player.recipes["flamethrower-turret"].enabled = false +end + +event.add(defines.events.on_research_finished, on_research_finished) event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction) event.add(defines.events.on_player_mined_entity, on_player_mined_entity) event.add(defines.events.on_entity_died, on_entity_died) diff --git a/maps/spooky_forest_changelog.txt b/maps/spooky_forest_changelog.txt index 56d5e93e..78ba2912 100644 --- a/maps/spooky_forest_changelog.txt +++ b/maps/spooky_forest_changelog.txt @@ -1,3 +1,6 @@ +0.04 +disabled flamethrower turret + 0.03 bigger map reveal on nest findings more ore