1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

rotten_apples: Military tech list to dictionary + Autoformat

This commit is contained in:
plague006 2019-02-03 00:48:39 -05:00
parent 65d538374f
commit 0cf4433034

View File

@ -5,20 +5,18 @@
-- 2018-11-30 -- 2018-11-30
local b = require 'map_gen.shared.builders' local b = require 'map_gen.shared.builders'
local math = require "utils.math" local math = require 'utils.math'
local table = require 'utils.table' local table = require 'utils.table'
local Event = require 'utils.event' local Event = require 'utils.event'
local RS = require 'map_gen.shared.redmew_surface' local RS = require 'map_gen.shared.redmew_surface'
local MGSP = require 'resources.map_gen_settings' local MGSP = require 'resources.map_gen_settings'
local degrees = math.rad local degrees = math.rad
local array_contains = table.array_contains
-- change these to change the pattern. -- change these to change the pattern.
local seed1 = 20000 local seed1 = 20000
local seed2 = seed1 * 2 local seed2 = seed1 * 2
RS.set_map_gen_settings( RS.set_map_gen_settings(
{ {
MGSP.ore_oil_none, MGSP.ore_oil_none,
@ -28,138 +26,138 @@ RS.set_map_gen_settings(
) )
local military_techs = { local military_techs = {
'artillery', ['artillery'] = true,
'artillery-shell-range-1', ['artillery-shell-range-1'] = true,
'artillery-shell-speed-1', ['artillery-shell-speed-1'] = true,
'atomic-bomb', ['atomic-bomb'] = true,
'bullet-damage-1', ['bullet-damage-1'] = true,
'bullet-damage-2', ['bullet-damage-2'] = true,
'bullet-damage-3', ['bullet-damage-3'] = true,
'bullet-damage-4', ['bullet-damage-4'] = true,
'bullet-damage-5', ['bullet-damage-5'] = true,
'bullet-damage-6', ['bullet-damage-6'] = true,
'bullet-damage-7', ['bullet-damage-7'] = true,
'bullet-speed-1', ['bullet-speed-1'] = true,
'bullet-speed-2', ['bullet-speed-2'] = true,
'bullet-speed-3', ['bullet-speed-3'] = true,
'bullet-speed-4', ['bullet-speed-4'] = true,
'bullet-speed-5', ['bullet-speed-5'] = true,
'bullet-speed-6', ['bullet-speed-6'] = true,
'cannon-shell-damage-1', ['cannon-shell-damage-1'] = true,
'cannon-shell-damage-2', ['cannon-shell-damage-2'] = true,
'cannon-shell-damage-3', ['cannon-shell-damage-3'] = true,
'cannon-shell-damage-4', ['cannon-shell-damage-4'] = true,
'cannon-shell-damage-5', ['cannon-shell-damage-5'] = true,
'cannon-shell-damage-6', ['cannon-shell-damage-6'] = true,
'cannon-shell-speed-1', ['cannon-shell-speed-1'] = true,
'cannon-shell-speed-2', ['cannon-shell-speed-2'] = true,
'cannon-shell-speed-3', ['cannon-shell-speed-3'] = true,
'cannon-shell-speed-4', ['cannon-shell-speed-4'] = true,
'cannon-shell-speed-5', ['cannon-shell-speed-5'] = true,
'combat-robot-damage-1', ['combat-robot-damage-1'] = true,
'combat-robot-damage-2', ['combat-robot-damage-2'] = true,
'combat-robot-damage-3', ['combat-robot-damage-3'] = true,
'combat-robot-damage-4', ['combat-robot-damage-4'] = true,
'combat-robot-damage-5', ['combat-robot-damage-5'] = true,
'combat-robot-damage-6', ['combat-robot-damage-6'] = true,
'combat-robotics', ['combat-robotics'] = true,
'combat-robotics-2', ['combat-robotics-2'] = true,
'combat-robotics-3', ['combat-robotics-3'] = true,
'discharge-defense-equipment', ['discharge-defense-equipment'] = true,
'energy-shield-equipment', ['energy-shield-equipment'] = true,
'energy-shield-mk2-equipment', ['energy-shield-mk2-equipment'] = true,
'exoskeleton-equipment', ['exoskeleton-equipment'] = true,
'explosive-rocketry', ['explosive-rocketry'] = true,
'flamethrower', ['flamethrower'] = true,
'flamethrower-damage-1', ['flamethrower-damage-1'] = true,
'flamethrower-damage-2', ['flamethrower-damage-2'] = true,
'flamethrower-damage-3', ['flamethrower-damage-3'] = true,
'flamethrower-damage-4', ['flamethrower-damage-4'] = true,
'flamethrower-damage-5', ['flamethrower-damage-5'] = true,
'flamethrower-damage-6', ['flamethrower-damage-6'] = true,
'flamethrower-damage-7', ['flamethrower-damage-7'] = true,
'flammables', ['flammables'] = true,
'follower-robot-count-1', ['follower-robot-count-1'] = true,
'follower-robot-count-2', ['follower-robot-count-2'] = true,
'follower-robot-count-3', ['follower-robot-count-3'] = true,
'follower-robot-count-4', ['follower-robot-count-4'] = true,
'follower-robot-count-5', ['follower-robot-count-5'] = true,
'follower-robot-count-6', ['follower-robot-count-6'] = true,
'follower-robot-count-7', ['follower-robot-count-7'] = true,
'grenade-damage-1', ['grenade-damage-1'] = true,
'grenade-damage-2', ['grenade-damage-2'] = true,
'grenade-damage-3', ['grenade-damage-3'] = true,
'grenade-damage-4', ['grenade-damage-4'] = true,
'grenade-damage-5', ['grenade-damage-5'] = true,
'grenade-damage-6', ['grenade-damage-6'] = true,
'grenade-damage-7', ['grenade-damage-7'] = true,
'gun-turret-damage-1', ['gun-turret-damage-1'] = true,
'gun-turret-damage-2', ['gun-turret-damage-2'] = true,
'gun-turret-damage-3', ['gun-turret-damage-3'] = true,
'gun-turret-damage-4', ['gun-turret-damage-4'] = true,
'gun-turret-damage-5', ['gun-turret-damage-5'] = true,
'gun-turret-damage-6', ['gun-turret-damage-6'] = true,
'gun-turret-damage-7', ['gun-turret-damage-7'] = true,
'heavy-armor', ['heavy-armor'] = true,
'land-mine', ['land-mine'] = true,
'laser', ['laser'] = true,
'laser-turret-damage-1', ['laser-turret-damage-1'] = true,
'laser-turret-damage-2', ['laser-turret-damage-2'] = true,
'laser-turret-damage-3', ['laser-turret-damage-3'] = true,
'laser-turret-damage-4', ['laser-turret-damage-4'] = true,
'laser-turret-damage-5', ['laser-turret-damage-5'] = true,
'laser-turret-damage-6', ['laser-turret-damage-6'] = true,
'laser-turret-damage-7', ['laser-turret-damage-7'] = true,
'laser-turret-damage-8', ['laser-turret-damage-8'] = true,
'laser-turret-speed-1', ['laser-turret-speed-1'] = true,
'laser-turret-speed-2', ['laser-turret-speed-2'] = true,
'laser-turret-speed-3', ['laser-turret-speed-3'] = true,
'laser-turret-speed-4', ['laser-turret-speed-4'] = true,
'laser-turret-speed-5', ['laser-turret-speed-5'] = true,
'laser-turret-speed-6', ['laser-turret-speed-6'] = true,
'laser-turret-speed-7', ['laser-turret-speed-7'] = true,
'laser-turrets', ['laser-turrets'] = true,
'military', ['military'] = true,
'military-2', ['military-2'] = true,
'military-3', ['military-3'] = true,
'military-4', ['military-4'] = true,
'modular-armor', ['modular-armor'] = true,
'night-vision-equipment', ['night-vision-equipment'] = true,
'personal-laser-defense-equipment', ['personal-laser-defense-equipment'] = true,
'power-armor', ['power-armor'] = true,
'power-armor-2', ['power-armor-2'] = true,
'rocket-damage-1', ['rocket-damage-1'] = true,
'rocket-damage-2', ['rocket-damage-2'] = true,
'rocket-damage-3', ['rocket-damage-3'] = true,
'rocket-damage-4', ['rocket-damage-4'] = true,
'rocket-damage-5', ['rocket-damage-5'] = true,
'rocket-damage-6', ['rocket-damage-6'] = true,
'rocket-damage-7', ['rocket-damage-7'] = true,
'rocket-speed-1', ['rocket-speed-1'] = true,
'rocket-speed-2', ['rocket-speed-2'] = true,
'rocket-speed-3', ['rocket-speed-3'] = true,
'rocket-speed-4', ['rocket-speed-4'] = true,
'rocket-speed-5', ['rocket-speed-5'] = true,
'rocket-speed-6', ['rocket-speed-6'] = true,
'rocket-speed-7', ['rocket-speed-7'] = true,
'rocketry', ['rocketry'] = true,
'shotgun-shell-damage-1', ['shotgun-shell-damage-1'] = true,
'shotgun-shell-damage-2', ['shotgun-shell-damage-2'] = true,
'shotgun-shell-damage-3', ['shotgun-shell-damage-3'] = true,
'shotgun-shell-damage-4', ['shotgun-shell-damage-4'] = true,
'shotgun-shell-damage-5', ['shotgun-shell-damage-5'] = true,
'shotgun-shell-damage-6', ['shotgun-shell-damage-6'] = true,
'shotgun-shell-damage-7', ['shotgun-shell-damage-7'] = true,
'shotgun-shell-speed-1', ['shotgun-shell-speed-1'] = true,
'shotgun-shell-speed-2', ['shotgun-shell-speed-2'] = true,
'shotgun-shell-speed-3', ['shotgun-shell-speed-3'] = true,
'shotgun-shell-speed-4', ['shotgun-shell-speed-4'] = true,
'shotgun-shell-speed-5', ['shotgun-shell-speed-5'] = true,
'shotgun-shell-speed-6', ['shotgun-shell-speed-6'] = true,
'stone-walls', ['stone-walls'] = true,
'tanks', ['tanks'] = true,
'turrets', ['turrets'] = true,
'uranium-ammo' ['uranium-ammo'] = true
} }
local player_ammo_research_modifiers = { local player_ammo_research_modifiers = {
@ -177,13 +175,13 @@ local player_ammo_research_modifiers = {
['melee'] = 0.025, ['melee'] = 0.025,
['rocket'] = 0.08, ['rocket'] = 0.08,
['shotgun-shell'] = 0.00, ['shotgun-shell'] = 0.00,
['laser-turret'] = 0.12, ['laser-turret'] = 0.12
} }
local function modify_damage(force, mult) local function modify_damage(force, mult)
for type, mod in pairs(player_ammo_research_modifiers) do for type, mod in pairs(player_ammo_research_modifiers) do
local current_m = force.get_ammo_damage_modifier(type) local current_m = force.get_ammo_damage_modifier(type)
if (current_m + (mod * mult))<=-0.9 then if (current_m + (mod * mult)) <= -0.9 then
force.set_ammo_damage_modifier(type, -0.9) force.set_ammo_damage_modifier(type, -0.9)
else else
force.set_ammo_damage_modifier(type, current_m + (mod * mult)) force.set_ammo_damage_modifier(type, current_m + (mod * mult))
@ -195,7 +193,7 @@ local function research_finished(event)
local research = event.research local research = event.research
local force = research.force local force = research.force
if array_contains(military_techs, research.name) then if military_techs[research.name] then
--increase player damage --increase player damage
modify_damage(force, 1) modify_damage(force, 1)
game.print('Military research complete.... you feel stronger') game.print('Military research complete.... you feel stronger')
@ -204,6 +202,7 @@ local function research_finished(event)
modify_damage(force, -1.5) modify_damage(force, -1.5)
game.print('Research complete. A feeling of weakness spreads.') game.print('Research complete. A feeling of weakness spreads.')
end end
if string.find(research.name, 'follower%-robot%-count') then if string.find(research.name, 'follower%-robot%-count') then
force.maximum_following_robot_count = force.maximum_following_robot_count + 10 force.maximum_following_robot_count = force.maximum_following_robot_count + 10
game.print('Your Plague of robots disperses........') game.print('Your Plague of robots disperses........')
@ -219,9 +218,9 @@ local function value(base, mult, pow)
end end
end end
local apple = b.translate(b.circle(20),0,-90) local apple = b.translate(b.circle(20), 0, -90)
local tree = b.picture(require 'map_gen.data.presets.tree') local tree = b.picture(require 'map_gen.data.presets.tree')
tree = b.scale(tree,0.6,0.6) tree = b.scale(tree, 0.6, 0.6)
local ores = { local ores = {
{resource_type = 'iron-ore', value = value(90, 0.25, 1.15)}, {resource_type = 'iron-ore', value = value(90, 0.25, 1.15)},
@ -287,47 +286,52 @@ local stone_circle = b.apply_entities(apple, {stone, worms})
local oil_circle = b.apply_entities(apple, {oil, worms}) local oil_circle = b.apply_entities(apple, {oil, worms})
local uranium_circle = b.apply_entities(apple, {uranium, worms}) local uranium_circle = b.apply_entities(apple, {uranium, worms})
local start_ores =
local start_ores = b.any{ b.any {
b.rotate(iron_circle,degrees(-25)), b.rotate(iron_circle, degrees(-25)),
b.rotate(copper_circle,degrees(25)), b.rotate(copper_circle, degrees(25)),
b.rotate(stone_circle,degrees(-75)), b.rotate(stone_circle, degrees(-75)),
b.rotate(coal_circle,degrees(75)), b.rotate(coal_circle, degrees(75)),
tree tree
} }
local ore_group_1 = b.any{ local ore_group_1 =
b.rotate(iron_circle,degrees(-25)), b.any {
b.rotate(oil_circle,degrees(-75)), b.rotate(iron_circle, degrees(-25)),
b.rotate(coal_circle,degrees(75)), b.rotate(oil_circle, degrees(-75)),
b.rotate(coal_circle, degrees(75)),
tree tree
} }
local ore_group_2 = b.any{ local ore_group_2 =
b.rotate(iron_circle,degrees(-25)), b.any {
b.rotate(copper_circle,degrees(25)), b.rotate(iron_circle, degrees(-25)),
b.rotate(stone_circle,degrees(-75)), b.rotate(copper_circle, degrees(25)),
b.rotate(uranium_circle,degrees(75)), b.rotate(stone_circle, degrees(-75)),
b.rotate(uranium_circle, degrees(75)),
tree tree
} }
local ore_group_3 = b.any{ local ore_group_3 =
b.rotate(stone_circle,degrees(-75)), b.any {
b.rotate(iron_circle,degrees(75)), b.rotate(stone_circle, degrees(-75)),
b.rotate(iron_circle, degrees(75)),
tree tree
} }
local ore_group_4 = b.any{ local ore_group_4 =
b.rotate(iron_circle,degrees(-75)), b.any {
b.rotate(copper_circle,degrees(25)), b.rotate(iron_circle, degrees(-75)),
b.rotate(copper_circle, degrees(25)),
tree tree
} }
local ore_group_5 = b.any{ local ore_group_5 =
b.rotate(iron_circle,degrees(-25)), b.any {
b.rotate(copper_circle,degrees(25)), b.rotate(iron_circle, degrees(-25)),
b.rotate(stone_circle,degrees(-75)), b.rotate(copper_circle, degrees(25)),
b.rotate(coal_circle,degrees(75)), b.rotate(stone_circle, degrees(-75)),
b.rotate(coal_circle, degrees(75)),
tree tree
} }
@ -387,5 +391,5 @@ local sea = b.change_tile(apple, false, 'water')
sea = b.fish(sea, 0.005) sea = b.fish(sea, 0.005)
map = b.if_else(map, sea) map = b.if_else(map, sea)
map = b.translate(map,0,50) map = b.translate(map, 0, 50)
return map return map