diff --git a/maps/scrap_towny_ffa/building.lua b/maps/scrap_towny_ffa/building.lua index 8797baea..52ffc7c0 100644 --- a/maps/scrap_towny_ffa/building.lua +++ b/maps/scrap_towny_ffa/building.lua @@ -214,7 +214,7 @@ local function prevent_landfill_in_restricted_zone(event) return fail end -local function prevent_entities_near_towns(event) +local function process_built_entities(event) local player_index = event.player_index or nil local entity = event.created_entity if entity == nil or not entity.valid then @@ -241,10 +241,12 @@ local function prevent_entities_near_towns(event) end end end + if Public.near_another_town(force_name, position, surface, 32) == true then if neutral_whitelist[name] then entity.force = game.forces['neutral'] else + -- Prevent entities from being built near towns entity.destroy() if player_index ~= nil then local player = game.players[player_index] @@ -257,6 +259,10 @@ local function prevent_entities_near_towns(event) return end end + + if force_name == 'player' or force_name == 'rogue' then + entity.force = game.forces['neutral'] + end end local function prevent_tiles_near_towns(event) @@ -310,7 +316,7 @@ local function on_built_entity(event) if prevent_entity_in_restricted_zone(event) then return end - if prevent_entities_near_towns(event) then + if process_built_entities(event) then return end end @@ -319,7 +325,7 @@ local function on_robot_built_entity(event) if prevent_entity_in_restricted_zone(event) then return end - if prevent_entities_near_towns(event) then + if process_built_entities(event) then return end end diff --git a/maps/scrap_towny_ffa/scrap_towny_ffa_layout.lua b/maps/scrap_towny_ffa/scrap_towny_ffa_layout.lua index 46b9323b..1a1f5fb3 100644 --- a/maps/scrap_towny_ffa/scrap_towny_ffa_layout.lua +++ b/maps/scrap_towny_ffa/scrap_towny_ffa_layout.lua @@ -57,66 +57,60 @@ local scrap_containers_index = table.size(scrap_containers) -- loot chances and amounts for scrap containers local container_loot_chance = { - {name = 'advanced-circuit', chance = 5}, - {name = 'artillery-shell', chance = 1}, - {name = 'cannon-shell', chance = 2}, - {name = 'cliff-explosives', chance = 5}, + {name = 'advanced-circuit', chance = 15}, + --{name = "artillery-shell", chance = 1}, + {name = 'battery', chance = 15}, + {name = 'cannon-shell', chance = 4}, --{name = "cluster-grenade", chance = 2}, - {name = 'coin', chance = 1}, {name = 'construction-robot', chance = 1}, {name = 'copper-cable', chance = 250}, - {name = 'copper-plate', chance = 500}, + {name = 'copper-plate', chance = 250}, {name = 'crude-oil-barrel', chance = 30}, {name = 'defender-capsule', chance = 5}, {name = 'destroyer-capsule', chance = 1}, {name = 'distractor-capsule', chance = 2}, {name = 'electric-engine-unit', chance = 2}, - {name = 'electronic-circuit', chance = 200}, + {name = 'electronic-circuit', chance = 150}, {name = 'empty-barrel', chance = 10}, - {name = 'engine-unit', chance = 7}, + {name = 'engine-unit', chance = 5}, {name = 'explosive-cannon-shell', chance = 2}, --{name = "explosive-rocket", chance = 3}, - {name = 'explosive-uranium-cannon-shell', chance = 1}, + --{name = "explosive-uranium-cannon-shell", chance = 1}, {name = 'explosives', chance = 5}, - {name = 'green-wire', chance = 10}, {name = 'grenade', chance = 10}, - {name = 'heat-pipe', chance = 1}, - {name = 'heavy-oil-barrel', chance = 15}, + {name = 'heavy-oil-barrel', chance = 20}, {name = 'iron-gear-wheel', chance = 500}, - {name = 'iron-plate', chance = 750}, + {name = 'iron-plate', chance = 500}, {name = 'iron-stick', chance = 50}, {name = 'land-mine', chance = 3}, - {name = 'light-oil-barrel', chance = 15}, + {name = 'light-oil-barrel', chance = 20}, {name = 'logistic-robot', chance = 1}, {name = 'low-density-structure', chance = 1}, {name = 'lubricant-barrel', chance = 20}, - {name = 'nuclear-fuel', chance = 1}, - {name = 'petroleum-gas-barrel', chance = 15}, + {name = "nuclear-fuel", chance = 1}, + {name = 'petroleum-gas-barrel', chance = 30}, {name = 'pipe', chance = 100}, {name = 'pipe-to-ground', chance = 10}, {name = 'plastic-bar', chance = 5}, {name = 'processing-unit', chance = 2}, - {name = 'red-wire', chance = 10}, - --{name = "rocket", chance = 3}, {name = "battery", chance = 20}, - {name = 'rocket-control-unit', chance = 1}, - {name = 'rocket-fuel', chance = 3}, + --{name = "rocket", chance = 3}, + --{name = "rocket-control-unit", chance = 1}, + --{name = "rocket-fuel", chance = 3}, {name = 'solid-fuel', chance = 100}, {name = 'steel-plate', chance = 150}, {name = 'sulfuric-acid-barrel', chance = 15}, - {name = 'uranium-cannon-shell', chance = 1}, - {name = 'uranium-fuel-cell', chance = 1}, - {name = 'used-up-uranium-fuel-cell', chance = 1}, + --{name = "uranium-cannon-shell", chance = 1}, + {name = "uranium-fuel-cell", chance = 1}, + --{name = "used-up-uranium-fuel-cell", chance = 1}, {name = 'water-barrel', chance = 10} } local container_loot_amounts = { - ['advanced-circuit'] = 2, - ['artillery-shell'] = 0.3, + ['advanced-circuit'] = 6, + --["artillery-shell"] = 0.3, ['battery'] = 2, - ['cannon-shell'] = 2, - ['cliff-explosives'] = 2, + ['cannon-shell'] = 4, --["cluster-grenade"] = 0.3, - ['coin'] = 2, ['construction-robot'] = 0.3, ['copper-cable'] = 24, ['copper-plate'] = 16, @@ -130,37 +124,37 @@ local container_loot_amounts = { ['engine-unit'] = 2, ['explosive-cannon-shell'] = 2, --["explosive-rocket"] = 2, - ['explosive-uranium-cannon-shell'] = 2, + --["explosive-uranium-cannon-shell"] = 2, ['explosives'] = 4, ['green-wire'] = 8, - ['grenade'] = 2, + ['grenade'] = 6, ['heat-pipe'] = 1, ['heavy-oil-barrel'] = 3, ['iron-gear-wheel'] = 8, ['iron-plate'] = 16, ['iron-stick'] = 16, - ['land-mine'] = 1, + ['land-mine'] = 6, ['light-oil-barrel'] = 3, ['logistic-robot'] = 0.3, ['low-density-structure'] = 0.3, ['lubricant-barrel'] = 3, - ['nuclear-fuel'] = 0.1, + ["nuclear-fuel"] = 0.1, ['petroleum-gas-barrel'] = 3, ['pipe'] = 8, ['pipe-to-ground'] = 1, ['plastic-bar'] = 4, - ['processing-unit'] = 1, + ['processing-unit'] = 2, ['red-wire'] = 8, --["rocket"] = 2, - ['rocket-control-unit'] = 0.3, - ['rocket-fuel'] = 0.3, + --["rocket-control-unit"] = 0.3, + --["rocket-fuel"] = 0.3, ['solid-fuel'] = 4, ['steel-plate'] = 4, ['sulfuric-acid-barrel'] = 3, - ['uranium-cannon-shell'] = 2, - ['uranium-fuel-cell'] = 0.3, - ['used-up-uranium-fuel-cell'] = 1, - ['water-barrel'] = 3 + --["uranium-cannon-shell"] = 2, + ["uranium-fuel-cell"] = 0.3, + --["used-up-uranium-fuel-cell"] = 1, + ['water-barrel'] = 3, } local scrap_raffle = {} diff --git a/maps/scrap_towny_ffa/team.lua b/maps/scrap_towny_ffa/team.lua index f3e4eb05..65013f76 100644 --- a/maps/scrap_towny_ffa/team.lua +++ b/maps/scrap_towny_ffa/team.lua @@ -47,33 +47,20 @@ local storage_types = { ['logistic-container'] = true, ['storage-tank'] = true } --- hand craftable + local player_force_disabled_recipes = { 'lab', 'automation-science-pack', - 'steel-furnace', - 'electric-furnace', - 'stone-wall', 'stone-brick', 'radar' } local all_force_enabled_recipes = { 'submachine-gun', - 'assembling-machine-1', 'small-lamp', 'shotgun', 'shotgun-shell', 'underground-belt', 'splitter', - 'steel-plate', - 'car', - 'tank', - 'engine-unit', - 'constant-combinator', - 'green-wire', - 'red-wire', - 'arithmetic-combinator', - 'decider-combinator' } local function min_slots(slots) @@ -1130,11 +1117,8 @@ end local function on_console_chat(event) local player = game.players[event.player_index] if string_match(string_lower(event.message), '%[armor%=') then - if string_match(event.message, player.name) then - return - end player.clear_console() - game.print('>> ' .. player.name .. ' is trying to gain an unfair advantage!') + game.print('Viewing player armor is disabled') end end diff --git a/maps/scrap_towny_ffa/town_center.lua b/maps/scrap_towny_ffa/town_center.lua index d016345f..503c2697 100644 --- a/maps/scrap_towny_ffa/town_center.lua +++ b/maps/scrap_towny_ffa/town_center.lua @@ -417,7 +417,9 @@ local function add_pvp_shield_scaled(position, force, surface) PvPShield.add_shield(surface, force, position, size, lifetime_ticks, 60 * 60) update_pvp_shields_display() force.print("Based on the highest tech on map, your town deploys a PvP shield of " - .. size .. " tiles for " .. string.format("%.0f", lifetime_ticks/60/60) .. " minutes") + .. string.format("%.0f", size) .. " tiles" + .. " for " .. string.format("%.0f", lifetime_ticks/60/60) .. " minutes." + .. " Enemy players will not be able to enter the shielded area.") end local function found_town(event) diff --git a/maps/scrap_towny_ffa/wreckage_yields_scrap.lua b/maps/scrap_towny_ffa/wreckage_yields_scrap.lua index 8bdbef62..c3566a83 100644 --- a/maps/scrap_towny_ffa/wreckage_yields_scrap.lua +++ b/maps/scrap_towny_ffa/wreckage_yields_scrap.lua @@ -13,7 +13,7 @@ local entity_loot_chance = { --{name = "cluster-grenade", chance = 2}, {name = 'construction-robot', chance = 1}, {name = 'copper-cable', chance = 250}, - {name = 'copper-plate', chance = 500}, + {name = 'copper-plate', chance = 250}, {name = 'crude-oil-barrel', chance = 30}, {name = 'defender-capsule', chance = 5}, {name = 'destroyer-capsule', chance = 1}, @@ -26,25 +26,22 @@ local entity_loot_chance = { --{name = "explosive-rocket", chance = 3}, --{name = "explosive-uranium-cannon-shell", chance = 1}, {name = 'explosives', chance = 5}, - {name = 'green-wire', chance = 10}, {name = 'grenade', chance = 10}, - {name = 'heat-pipe', chance = 1}, - {name = 'heavy-oil-barrel', chance = 15}, + {name = 'heavy-oil-barrel', chance = 20}, {name = 'iron-gear-wheel', chance = 500}, - {name = 'iron-plate', chance = 750}, + {name = 'iron-plate', chance = 500}, {name = 'iron-stick', chance = 50}, {name = 'land-mine', chance = 3}, - {name = 'light-oil-barrel', chance = 15}, + {name = 'light-oil-barrel', chance = 20}, {name = 'logistic-robot', chance = 1}, {name = 'low-density-structure', chance = 1}, {name = 'lubricant-barrel', chance = 20}, - --{name = "nuclear-fuel", chance = 1}, - {name = 'petroleum-gas-barrel', chance = 15}, + {name = "nuclear-fuel", chance = 1}, + {name = 'petroleum-gas-barrel', chance = 30}, {name = 'pipe', chance = 100}, {name = 'pipe-to-ground', chance = 10}, {name = 'plastic-bar', chance = 5}, {name = 'processing-unit', chance = 2}, - {name = 'red-wire', chance = 10}, --{name = "rocket", chance = 3}, --{name = "rocket-control-unit", chance = 1}, --{name = "rocket-fuel", chance = 3}, @@ -52,11 +49,11 @@ local entity_loot_chance = { {name = 'steel-plate', chance = 150}, {name = 'sulfuric-acid-barrel', chance = 15}, --{name = "uranium-cannon-shell", chance = 1}, - --{name = "uranium-fuel-cell", chance = 1}, + {name = "uranium-fuel-cell", chance = 1}, --{name = "used-up-uranium-fuel-cell", chance = 1}, {name = 'water-barrel', chance = 10}, - {name = 'tank', chance = 2}, - {name = 'car', chance = 3} + {name = 'tank', chance = 15}, + {name = 'car', chance = 30} } -- positive numbers can scale, 0 is disabled, and negative numbers are fixed absolute values @@ -93,7 +90,7 @@ local entity_loot_amounts = { ['logistic-robot'] = 0.3, ['low-density-structure'] = 0.3, ['lubricant-barrel'] = 3, - --["nuclear-fuel"] = 0.1, + ["nuclear-fuel"] = 0.1, ['petroleum-gas-barrel'] = 3, ['pipe'] = 8, ['pipe-to-ground'] = 1, @@ -107,7 +104,7 @@ local entity_loot_amounts = { ['steel-plate'] = 4, ['sulfuric-acid-barrel'] = 3, --["uranium-cannon-shell"] = 2, - --["uranium-fuel-cell"] = 0.3, + ["uranium-fuel-cell"] = 0.3, --["used-up-uranium-fuel-cell"] = 1, ['water-barrel'] = 3, ['tank'] = -1, diff --git a/modules/custom_death_messages.lua b/modules/custom_death_messages.lua index a682797f..f14b422b 100644 --- a/modules/custom_death_messages.lua +++ b/modules/custom_death_messages.lua @@ -59,7 +59,7 @@ local function on_player_died(event) if cause.type == 'car' then local driver = cause.get_driver() - if driver.player then + if driver and driver.player then game.print(player.name .. tag .. ' was killed by ' .. driver.player.name .. ' ' .. player.tag .. '.', message_color) return end