diff --git a/Upgrade.lua b/Upgrade.lua index 8469353..ca8c4d1 100755 --- a/Upgrade.lua +++ b/Upgrade.lua @@ -191,10 +191,10 @@ function upgrade.attempt(natives) game.surfaces[1].print("Rampant - Version 0.16.9") global.version = constants.VERSION_44 end - if (global.version < constants.VERSION_46) then + if (global.version < constants.VERSION_47) then - game.surfaces[1].print("Rampant - Version 0.16.11") - global.version = constants.VERSION_46 + game.surfaces[1].print("Rampant - Version 0.16.12") + global.version = constants.VERSION_47 end return starting ~= global.version, natives diff --git a/changelog.txt b/changelog.txt index e055651..1a0c649 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,12 @@ +--------------------------------------------------------------------------------------------------- +Version: 0.16.12 +Date: 1. 28. 2018 + Bugfixes: + - Fixed an error where item could be nil (https://forums.factorio.com/viewtopic.php?f=94&t=31445&start=240#p339033) + Improvements: + - Added support for bobs and NE artifacts + - Added options to include Bobs or NE as factions + --------------------------------------------------------------------------------------------------- Version: 0.16.11 Date: 1. 27. 2018 diff --git a/control.lua b/control.lua index 4bb35c0..2a09f7a 100755 --- a/control.lua +++ b/control.lua @@ -258,8 +258,7 @@ local function onModSettingsChange(event) upgrade.compareTable(natives, "aiNocturnalMode", settings.global["rampant-permanentNocturnal"].value) upgrade.compareTable(natives, "aiPointsScaler", settings.global["rampant-aiPointsScaler"].value) - upgrade.compareTable(natives, "newEnemies", settings.startup["rampant-newEnemies"].value) - + upgrade.compareTable(natives, "newEnemies", settings.startup["rampant-newEnemies"].value) upgrade.compareTable(natives, "enemySeed", settings.startup["rampant-enemySeed"].value) -- RE-ENABLE WHEN COMPLETE @@ -470,7 +469,7 @@ end local function onSurfaceTileChange(event) local surfaceIndex = event.surface_index or (event.robot and event.robot.surface.index) - if (event.item.name == "landfill") and (surfaceIndex == 1) then + if event.item and (event.item.name == "landfill") and (surfaceIndex == 1) then local surface = game.surfaces[1] local chunks = {} local tiles = event.tiles diff --git a/data-final-fixes.lua b/data-final-fixes.lua index f8f5f3e..fadd01d 100755 --- a/data-final-fixes.lua +++ b/data-final-fixes.lua @@ -17,12 +17,12 @@ if settings.startup["rampant-newEnemies"].value then -- require("prototypes/Wasp") require("prototypes/Laser") - for k, unitSpawner in pairs(data.raw["unit-spawner"]) do + for _, unitSpawner in pairs(data.raw["unit-spawner"]) do if (unitSpawner.name ~= "biter-spawner") then unitSpawner.autoplace = nil end end - for k, unitSpawner in pairs(data.raw["turret"]) do + for _, unitSpawner in pairs(data.raw["turret"]) do if (unitSpawner.name ~= "small-worm-turret") then unitSpawner.autoplace = nil end diff --git a/data-updates.lua b/data-updates.lua index 5994f3d..d99f2e7 100755 --- a/data-updates.lua +++ b/data-updates.lua @@ -3,14 +3,6 @@ local bobsUpdates = require("prototypes/utils/UpdatesBobs") local NEUpdates = require("prototypes/utils/UpdatesNE") local constants = require("libs/Constants") -local function bobsDetected() - return settings.startup["bobmods-enemies-aliensdropartifacts"] ~= nil -end - -local function NEDetected() - return settings.startup["NE_Difficulty"] ~= nil -end - if settings.startup["rampant-removeBloodParticles"].value then local explosions = data.raw["explosion"] @@ -21,11 +13,11 @@ end if settings.startup["rampant-useDumbProjectiles"].value then vanillaUpdates.useDumbProjectiles() - if bobsDetected() then + if settings.startup["bobmods-enemies-enableartifacts"].value then require("prototypes/utils/AttackBobs") bobsUpdates.useDumbProjectiles() end - if NEDetected() then + if settings.startup["NE_Difficulty"].value then require("prototypes/utils/AttackNE") NEUpdates.useDumbProjectiles() if settings.startup["rampant-useNEUnitLaunchers"].value then diff --git a/info.json b/info.json index eacf75c..57d5c34 100755 --- a/info.json +++ b/info.json @@ -1,7 +1,7 @@ { "name" : "Rampant", "factorio_version" : "0.16", - "version" : "0.16.11", + "version" : "0.16.12", "title" : "Rampant", "author" : "Veden", "homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445", diff --git a/libs/BaseUtils.lua b/libs/BaseUtils.lua index 6eb1ce9..3c9202c 100755 --- a/libs/BaseUtils.lua +++ b/libs/BaseUtils.lua @@ -5,12 +5,17 @@ local baseUtils = {} local mathUtils = require("MathUtils") local constants = require("Constants") local chunkPropertyUtils = require("ChunkPropertyUtils") +local neUnits = require("NEBaseUtils") +local bobsUnits = require("BobsBaseUtils") -- constants local TIER_SET_10 = constants.TIER_SET_10 local TIER_SET_5 = constants.TIER_SET_5 +local ENABLED_BOBS_UNITS = constants.ENABLED_BOBS_UNITS +local ENABLED_NE_UNITS = constants.ENABLED_NE_UNITS + local NEUTRAL_WORM_TIERS = constants.NEUTRAL_WORM_TIERS local NEUTRAL_WORM_VARIATIONS = constants.NEUTRAL_WORM_VARIATIONS local NEUTRAL_NEST_TIERS = constants.NEUTRAL_NEST_TIERS @@ -105,6 +110,9 @@ local SENTINEL_IMPASSABLE_CHUNK = constants.SENTINEL_IMPASSABLE_CHUNK local euclideanDistancePoints = mathUtils.euclideanDistancePoints local roundToFloor = mathUtils.roundToFloor +local processNEUnitClass = neUnits.processNEUnitClass +local processBobsUnitClass = bobsUnits.processBobsUnitClass + local gaussianRandomRange = mathUtils.gaussianRandomRange local gaussianRandomRangeRG = mathUtils.gaussianRandomRangeRG @@ -405,6 +413,14 @@ function baseUtils.rebuildNativeTables(natives, surface, rg) gaussianRandomRangeRG(evo, evo * 0.2, evo * 0.5, evo * 1.5, rg), natives.evolutionTableAlignment) end + + if ENABLED_NE_UNITS then + processNEUnitClass(natives, surface) + end + + if ENABLED_BOBS_UNITS then + processBobsUnitClass(natives, surface) + end processUnitClass(NEUTRAL_NEST_VARIATIONS, NEUTRAL_NEST_TIERS, diff --git a/libs/BobsBaseUtils.lua b/libs/BobsBaseUtils.lua new file mode 100755 index 0000000..5df0791 --- /dev/null +++ b/libs/BobsBaseUtils.lua @@ -0,0 +1,123 @@ +local bobs = {} + +-- imports + +local constants = require("Constants") + +-- imported constants + +local EVOLUTION_INCREMENTS = constants.EVOLUTION_INCREMENTS +local BASE_ALIGNMENT_BOBS = constants.BASE_ALIGNMENT_BOBS +local ENABLED_NE_UNITS = constants.ENABLED_NE_UNITS + +-- imported functions + +local mFloor = math.floor + +-- module code + +local function fileEntity(baseAlignment, entity, evolutionTable, evo) + local evoRequirement = mFloor((evo or entity.prototype.build_base_evolution_requirement)/EVOLUTION_INCREMENTS) * EVOLUTION_INCREMENTS + local eTable = evolutionTable[baseAlignment] + if not eTable then + eTable = {} + evolutionTable[baseAlignment] = eTable + end + local aTable = eTable[evoRequirement] + if not aTable then + aTable = {} + eTable[evoRequirement] = aTable + end + aTable[#aTable+1] = entity.name +end + +function bobs.processBobsUnitClass(natives, surface) + local position = { x = 0, y = 0 } + + local entity = surface.create_entity({ + name = "bob-biter-spawner", + position = position + }) + fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableUnitSpawner, 0.0) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-spitter-spawner", + position = position + }) + fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableUnitSpawner, 0.0) + entity.destroy() + + entity = surface.create_entity({ + name = "small-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "medium-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "big-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-big-explosive-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-big-fire-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-big-poison-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-big-piercing-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-big-electric-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-giant-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-behemoth-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_BOBS, entity, natives.evolutionTableWorm) + entity.destroy() + +end + +return bobs diff --git a/libs/ChunkUtils.lua b/libs/ChunkUtils.lua index c0aad69..cbbdcb2 100755 --- a/libs/ChunkUtils.lua +++ b/libs/ChunkUtils.lua @@ -32,7 +32,6 @@ local CHUNK_IMPASSABLE = constants.CHUNK_IMPASSABLE local CHUNK_TICK = constants.CHUNK_TICK -local BASE_SEARCH_RADIUS = constants.BASE_SEARCH_RADIUS local BASE_ALIGNMENT_DEADZONE = constants.BASE_ALIGNMENT_DEADZONE local PATH_RATING = constants.PATH_RATING diff --git a/libs/Constants.lua b/libs/Constants.lua index 3df5a6c..1699b73 100755 --- a/libs/Constants.lua +++ b/libs/Constants.lua @@ -19,7 +19,7 @@ constants.VERSION_33 = 33 constants.VERSION_38 = 38 constants.VERSION_41 = 41 constants.VERSION_44 = 44 -constants.VERSION_46 = 46 +constants.VERSION_47 = 47 -- misc @@ -135,6 +135,8 @@ constants.BASE_ALIGNMENT_ENERGY_THIEF = 17 constants.BASE_ALIGNMENT_ELECTRIC = 18 constants.BASE_ALIGNMENT_WASP = 19 constants.BASE_ALIGNMENT_DEADZONE = 20 +constants.BASE_ALIGNMENT_NE = 21 +constants.BASE_ALIGNMENT_BOBS = 22 -- constants.BASE_ALIGNMENT_BURROW = 3 constants.BASE_PROCESS_INTERVAL = constants.TICKS_A_SECOND * 5 @@ -184,6 +186,21 @@ constants.BASE_ALIGNMENT_EVOLUTION_BASELINE = { [constants.BASE_ALIGNMENT_NUCLEAR] = 0.7 } +constants.ENABLED_NE_UNITS = settings.startup["rampant-enableBobsUnits"].value +constants.ENABLED_BOBS_UNITS = settings.startup["rampant-enableNEUnits"].value + +if settings.startup["bobmods-enemies-enableartifacts"].value and constants.ENABLED_BOBS_UNITS then + -- local t = constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_NEUTRAL] + -- t[#t+1] = constants.BASE_ALIGNMENT_BOBS + constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_BOBS] = 0.1 +end + +if settings.startup["NE_Difficulty"].value and constants.ENABLED_NE_UNITS then + -- local t = constants.BASE_ALIGNMENT_PATHS[constants.BASE_ALIGNMENT_NEUTRAL] + -- t[#t+1] = constants.BASE_ALIGNMENT_NE + constants.BASE_ALIGNMENT_EVOLUTION_BASELINE[constants.BASE_ALIGNMENT_NE] = 0.1 +end + -- ai retreat constants.NO_RETREAT_BASE_PERCENT = 0.10 diff --git a/libs/NEBaseUtils.lua b/libs/NEBaseUtils.lua new file mode 100755 index 0000000..8c526c6 --- /dev/null +++ b/libs/NEBaseUtils.lua @@ -0,0 +1,139 @@ +local ne = {} + +-- imports + +local constants = require("Constants") + +-- imported constants + +local EVOLUTION_INCREMENTS = constants.EVOLUTION_INCREMENTS +local BASE_ALIGNMENT_NE = constants.BASE_ALIGNMENT_NE +local ENABLED_BOBS_UNITS = constants.ENABLED_BOBS_UNITS + +-- imported functions + +local mFloor = math.floor + +-- module code + +local function fileEntity(baseAlignment, entity, evolutionTable, evo) + local evoRequirement = mFloor((evo or entity.prototype.build_base_evolution_requirement)/EVOLUTION_INCREMENTS) * EVOLUTION_INCREMENTS + local eTable = evolutionTable[baseAlignment] + if not eTable then + eTable = {} + evolutionTable[baseAlignment] = eTable + end + local aTable = eTable[evoRequirement] + if not aTable then + aTable = {} + eTable[evoRequirement] = aTable + end + aTable[#aTable+1] = entity.name +end + +function ne.processNEUnitClass(natives, surface) + local position = { x = 0, y = 0 } + + local entity = surface.create_entity({ + name = "biter-spawner", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, 0.0) + entity.destroy() + + entity = surface.create_entity({ + name = "spitter-spawner", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, 0.0) + entity.destroy() + + if ENABLED_BOBS_UNITS then + entity = surface.create_entity({ + name = "bob-biter-spawner", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, 0.0) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-spitter-spawner", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableUnitSpawner, 0.0) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-big-fire-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-big-poison-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-big-piercing-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-big-electric-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-giant-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-behemoth-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "bob-big-explosive-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) + entity.destroy() + + end + + entity = surface.create_entity({ + name = "small-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "medium-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) + entity.destroy() + + entity = surface.create_entity({ + name = "big-worm-turret", + position = position + }) + fileEntity(BASE_ALIGNMENT_NE, entity, natives.evolutionTableWorm) + entity.destroy() +end + +return ne diff --git a/locale/en/locale.cfg b/locale/en/locale.cfg index 0558f59..2d86bcc 100755 --- a/locale/en/locale.cfg +++ b/locale/en/locale.cfg @@ -9036,6 +9036,8 @@ rampant-newEnemyWormVariations=Worm Variations rampant-newEnemyWormTiers=Worm Tiers rampant-newEnemyUnitVariations=Unit Variations rampant-newEnemyUnitTiers=Unit Tiers +rampant-enableBobsUnits=Enable Bobs as a faction +rampant-enableNEUnits=Enable NE as a faction [mod-setting-description] rampant-useDumbProjectiles=Turns off homing projectiles for worms and spitters @@ -9070,4 +9072,6 @@ rampant-newEnemyNestTiers=This number corresponds to number of tiers. The higher rampant-newEnemyWormVariations=This number corresponds to the number of variations per tier. The higher the number the smoother the enemy power curve. Min 1, Max 20 rampant-newEnemyWormTiers=This number corresponds to number of tiers. The higher the number the smoother the enemy power curve. rampant-newEnemyUnitVariations=This number corresponds to the number of variations per tier. The higher the number the smoother the enemy power curve. Min 1, Max 20 -rampant-newEnemyUnitTiers=This number corresponds to number of tiers. The higher the number the smoother the enemy power curve. \ No newline at end of file +rampant-newEnemyUnitTiers=This number corresponds to number of tiers. The higher the number the smoother the enemy power curve. +rampant-enableBobsUnits=Adds bobs spawners, units, and worms to the base upgrade and placement list +rampant-enableNEUnits=Adds NE spawners, units, and worms to the base upgrade and placement list \ No newline at end of file diff --git a/prototypes/Acid.lua b/prototypes/Acid.lua index 8a3a880..2a4528e 100755 --- a/prototypes/Acid.lua +++ b/prototypes/Acid.lua @@ -21,12 +21,21 @@ local ACID_WORM_VARIATIONS = constants.ACID_WORM_VARIATIONS local buildUnitSpawner = swarmUtils.buildUnitSpawner local buildWorm = swarmUtils.buildWorm + local createAttackBall = acidBall.createAttackBall local createStreamAttack = biterUtils.createStreamAttack local createMeleeAttack = biterUtils.createMeleeAttack local softSmoke = "the-soft-smoke-rampant" +local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable +local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable +local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable + +local biterLoot = makeUnitAlienLootTable("green") +local spawnerLoot = makeSpawnerAlienLootTable("green") +local wormLoot = makeWormAlienLootTable("green") + -- acid biters buildUnitSpawner( { @@ -54,6 +63,7 @@ buildUnitSpawner( [9] = 1.3, [10] = 1.4 }, + loot = biterLoot, tint1 = {r=0, g=0.85, b=0.13, a=0.65}, tint2 = {r=0, g=0.85, b=0.13, a=0.65} }, @@ -61,6 +71,7 @@ buildUnitSpawner( unitSpawner = { name = "acid-biter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, scales = { @@ -561,6 +572,7 @@ buildUnitSpawner( unit = { name = "acid-spitter", + loot = biterLoot, attributes = { explosion = "blood-explosion-small" }, @@ -591,6 +603,7 @@ buildUnitSpawner( unitSpawner = { name = "acid-spitter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, @@ -1113,7 +1126,7 @@ buildUnitSpawner( [10] = 65 } }, - + { type = "resistance", name = "acid", @@ -1179,6 +1192,7 @@ buildWorm( { name = "acid-worm", + loot = wormLoot, attributes = {}, attack = { softSmokeName = softSmoke diff --git a/prototypes/Electric.lua b/prototypes/Electric.lua index 82e5f81..4190c78 100755 --- a/prototypes/Electric.lua +++ b/prototypes/Electric.lua @@ -24,6 +24,16 @@ local buildWorm = swarmUtils.buildWorm local createElectricAttack = biterUtils.createElectricAttack local makeBeam = beamUtils.makeBeam +local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable +local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable +local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable + +local biterLoot = makeUnitAlienLootTable("blue") +local spawnerLoot = makeSpawnerAlienLootTable("blue") +local wormLoot = makeWormAlienLootTable("blue") + + + -- electric biters buildUnitSpawner( { @@ -33,6 +43,7 @@ buildUnitSpawner( attributes = { explosion = "blood-explosion-small" }, + loot = biterLoot, attack = { damageType = "electric" }, @@ -59,6 +70,7 @@ buildUnitSpawner( unitSpawner = { name = "electric-biter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, scales = { @@ -607,6 +619,7 @@ buildWorm( { name = "electric-worm", + loot = wormLoot, attributes = {}, attack = { damageType = "electric" diff --git a/prototypes/Fast.lua b/prototypes/Fast.lua index 74a7bdb..560cf99 100755 --- a/prototypes/Fast.lua +++ b/prototypes/Fast.lua @@ -27,6 +27,16 @@ local createMeleeAttack = biterUtils.createMeleeAttack local softSmoke = "the-soft-smoke-rampant" +local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable +local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable +local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable + +local biterLoot = makeUnitAlienLootTable("purple") +local spawnerLoot = makeSpawnerAlienLootTable("purple") +local wormLoot = makeWormAlienLootTable("purple") + + + -- fast biters buildUnitSpawner( { @@ -39,6 +49,7 @@ buildUnitSpawner( attack = {}, resistances = {}, + loot = biterLoot, type = "biter", scales = { [1] = 0.5, @@ -59,6 +70,7 @@ buildUnitSpawner( unitSpawner = { name = "fast-biter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, scales = { @@ -525,6 +537,7 @@ buildUnitSpawner( unit = { name = "fast-spitter", + loot = biterLoot, attributes = { explosion = "blood-explosion-small" }, @@ -555,6 +568,7 @@ buildUnitSpawner( unitSpawner = { name = "fast-spitter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, @@ -1038,6 +1052,7 @@ buildWorm( { name = "fast-worm", + loot = wormLoot, attributes = {}, attack = { softSmokeName = softSmoke diff --git a/prototypes/Fire.lua b/prototypes/Fire.lua index e61724c..723e96f 100755 --- a/prototypes/Fire.lua +++ b/prototypes/Fire.lua @@ -27,12 +27,23 @@ local createMeleeAttack = biterUtils.createMeleeAttack local softSmoke = "the-soft-smoke-rampant" +local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable +local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable +local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable + +local biterLoot = makeUnitAlienLootTable("red") +local spawnerLoot = makeSpawnerAlienLootTable("red") +local wormLoot = makeWormAlienLootTable("red") + + + -- fire biters buildUnitSpawner( { unit = { name = "fire-biter", + loot = biterLoot, attributes = { explosion = "blood-explosion-small" }, @@ -61,6 +72,7 @@ buildUnitSpawner( unitSpawner = { name = "fire-biter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, scales = { @@ -591,6 +603,7 @@ buildUnitSpawner( attributes = { explosion = "blood-explosion-small" }, + loot = biterLoot, attack = { damageType = "acid", softSmokeName = softSmoke @@ -619,6 +632,7 @@ buildUnitSpawner( unitSpawner = { name = "fire-spitter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, @@ -1196,6 +1210,7 @@ buildWorm( name = "fire-worm", attributes = {}, + loot = wormLoot, attack = { damageType = "acid", softSmokeName = softSmoke diff --git a/prototypes/Inferno.lua b/prototypes/Inferno.lua index 30f6049..c899304 100755 --- a/prototypes/Inferno.lua +++ b/prototypes/Inferno.lua @@ -30,12 +30,23 @@ local smokeGlow = "the-glow-smoke-rampant" local smokeWithoutGlow = "the-without-glow-smoke-rampant" local smokeFuel = "the-adding-fuel-rampant" +local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable +local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable +local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable + +local biterLoot = makeUnitAlienLootTable("orange") +local spawnerLoot = makeSpawnerAlienLootTable("orange") +local wormLoot = makeWormAlienLootTable("orange") + + + -- inferno spitters buildUnitSpawner( { unit = { name = "inferno-spitter", + loot = biterLoot, attributes = { explosion = "blood-explosion-small" }, @@ -86,6 +97,7 @@ buildUnitSpawner( unitSpawner = { name = "inferno-spitter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, @@ -697,6 +709,7 @@ buildWorm( { name = "inferno-worm", + loot = wormLoot, attributes = {}, attack = { damageType = "acid", diff --git a/prototypes/Laser.lua b/prototypes/Laser.lua index 730e168..bfa5f95 100755 --- a/prototypes/Laser.lua +++ b/prototypes/Laser.lua @@ -27,6 +27,15 @@ local createMeleeAttack = biterUtils.createMeleeAttack local softSmoke = "the-soft-smoke-rampant" +local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable +local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable +local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable + +local biterLoot = makeUnitAlienLootTable("blue") +local spawnerLoot = makeSpawnerAlienLootTable("blue") +local wormLoot = makeWormAlienLootTable("blue") + + -- laser biters buildUnitSpawner( { @@ -40,6 +49,7 @@ buildUnitSpawner( attack = {}, resistances = {}, + loot = biterLoot, type = "biter", scales = { [1] = 0.5, @@ -60,6 +70,7 @@ buildUnitSpawner( unitSpawner = { name = "laser-biter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, scales = { @@ -562,6 +573,7 @@ buildUnitSpawner( unit = { name = "laser-spitter", + loot = biterLoot, attributes = { damageType = "laser", explosion = "blood-explosion-small" @@ -593,6 +605,7 @@ buildUnitSpawner( unitSpawner = { name = "laser-spitter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, @@ -1112,6 +1125,7 @@ buildWorm( { name = "laser-worm", + loot = wormLoot, attributes = {}, attack = { damageType = "laser", diff --git a/prototypes/Neutral.lua b/prototypes/Neutral.lua index f15c592..d88bfa4 100755 --- a/prototypes/Neutral.lua +++ b/prototypes/Neutral.lua @@ -27,12 +27,21 @@ local createMeleeAttack = biterUtils.createMeleeAttack local softSmoke = "the-soft-smoke-rampant" +local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable +local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable +local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable + +local biterLoot = makeUnitAlienLootTable(nil) +local spawnerLoot = makeSpawnerAlienLootTable(nil) +local wormLoot = makeWormAlienLootTable(nil) + -- neutral biters buildUnitSpawner( { unit = { name = "neutral-biter", + loot = biterLoot, attributes = { explosion = "blood-explosion-small" }, @@ -59,6 +68,7 @@ buildUnitSpawner( unitSpawner = { name = "neutral-biter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, scales = { @@ -503,6 +513,7 @@ buildUnitSpawner( unit = { name = "neutral-spitter", + loot = biterLoot, attributes = { explosion = "blood-explosion-small" }, @@ -533,6 +544,7 @@ buildUnitSpawner( unitSpawner = { name = "neutral-spitter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, @@ -995,6 +1007,7 @@ buildWorm( { name = "neutral-worm", + loot = wormLoot, attributes = {}, attack = { softSmokeName = softSmoke diff --git a/prototypes/Nuclear.lua b/prototypes/Nuclear.lua index 778072b..1588b79 100755 --- a/prototypes/Nuclear.lua +++ b/prototypes/Nuclear.lua @@ -29,12 +29,21 @@ local createSuicideAttack = biterUtils.createSuicideAttack local softSmoke = "the-soft-smoke-rampant" +local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable +local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable +local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable + +local biterLoot = makeUnitAlienLootTable("yellow") +local spawnerLoot = makeSpawnerAlienLootTable("yellow") +local wormLoot = makeWormAlienLootTable("yellow") + -- nuclear biters buildUnitSpawner( { unit = { name = "nuclear-biter", + loot = biterLoot, attributes = { explosion = "blood-explosion-small" }, @@ -64,6 +73,7 @@ buildUnitSpawner( unitSpawner = { name = "nuclear-biter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, scales = { @@ -558,6 +568,7 @@ buildWorm( { name = "nuclear-worm", + loot = wormLoot, attributes = {}, attack = { stickerAnimation = { diff --git a/prototypes/Physical.lua b/prototypes/Physical.lua index 5ac0b9a..71f1584 100755 --- a/prototypes/Physical.lua +++ b/prototypes/Physical.lua @@ -27,12 +27,23 @@ local createMeleeAttack = biterUtils.createMeleeAttack local softSmoke = "the-soft-smoke-rampant" +local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable +local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable +local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable + +local biterLoot = makeUnitAlienLootTable("red") +local spawnerLoot = makeSpawnerAlienLootTable("red") +local wormLoot = makeWormAlienLootTable("red") + + + -- physical biters buildUnitSpawner( { unit = { name = "physical-biter", + loot = biterLoot, attributes = { explosion = "blood-explosion-small" }, @@ -61,6 +72,7 @@ buildUnitSpawner( unitSpawner = { name = "physical-biter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, scales = { @@ -503,6 +515,7 @@ buildWorm( { name = "physical-worm", + loot = wormLoot, attributes = { }, attack = { diff --git a/prototypes/Suicide.lua b/prototypes/Suicide.lua index 7f43ee3..2756735 100755 --- a/prototypes/Suicide.lua +++ b/prototypes/Suicide.lua @@ -29,12 +29,24 @@ local createSuicideAttack = biterUtils.createSuicideAttack local softSmoke = "the-soft-smoke-rampant" + +local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable +local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable +local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable + +local biterLoot = makeUnitAlienLootTable("yellow") +local spawnerLoot = makeSpawnerAlienLootTable("yellow") +local wormLoot = makeWormAlienLootTable("yellow") + + + -- suicide biters buildUnitSpawner( { unit = { name = "suicide-biter", + loot = biterLoot, attributes = { explosion = "blood-explosion-small" }, @@ -63,6 +75,7 @@ buildUnitSpawner( unitSpawner = { name = "suicide-biter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, scales = { @@ -584,6 +597,7 @@ buildWorm( { name = "suicide-worm", + loot = wormLoot, attributes = {}, attack = { stickerAnimation = { diff --git a/prototypes/SwarmUtils.lua b/prototypes/SwarmUtils.lua index 3b56b5f..cc1d400 100755 --- a/prototypes/SwarmUtils.lua +++ b/prototypes/SwarmUtils.lua @@ -297,6 +297,10 @@ local function buildUnits(template, attackGenerator, upgradeTable, variations, t if unit.attackName then unit.attack.name = unit.attackName .. "-v" .. i .. "-t" .. t end + + if unit.loot then + unit.attributes.loot = { unit.loot[t] } + end local entity if (unit.type == "spitter") then @@ -342,6 +346,10 @@ function swarmUtils.buildUnitSpawner(templates, upgradeTable, attackGenerator, v generateApperance(unitSpawner, t) upgradeEntity(unitSpawner, upgradeTable.unitSpawner, t) + if unitSpawner.loot then + unitSpawner.attributes.loot = { unitSpawner.loot[t] } + end + if unitSpawner.autoplace then unitSpawner.attributes["autoplace"] = unitSpawner.autoplace[t] end @@ -369,6 +377,10 @@ function swarmUtils.buildWorm(template, upgradeTable, attackGenerator, variation if worm.attackName then worm.attack.name = worm.attackName .. "-v" .. i .. "-t" .. t end + + if worm.loot then + worm.attributes.loot = { worm.loot[t] } + end if worm.autoplace then worm.attributes["autoplace"] = worm.autoplace[t] diff --git a/prototypes/Troll.lua b/prototypes/Troll.lua index bfe8633..27b4278 100755 --- a/prototypes/Troll.lua +++ b/prototypes/Troll.lua @@ -27,12 +27,22 @@ local createMeleeAttack = biterUtils.createMeleeAttack local softSmoke = "the-soft-smoke-rampant" + +local makeUnitAlienLootTable = biterUtils.makeUnitAlienLootTable +local makeSpawnerAlienLootTable = biterUtils.makeSpawnerAlienLootTable +local makeWormAlienLootTable = biterUtils.makeWormAlienLootTable + +local biterLoot = makeUnitAlienLootTable("green") +local spawnerLoot = makeSpawnerAlienLootTable("green") +local wormLoot = makeWormAlienLootTable("green") + -- troll biters buildUnitSpawner( { unit = { name = "troll-biter", + loot = biterLoot, attributes = { explosion = "blood-explosion-small" }, @@ -59,6 +69,7 @@ buildUnitSpawner( unitSpawner = { name = "troll-biter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, scales = { @@ -533,6 +544,7 @@ buildUnitSpawner( unit = { name = "troll-spitter", + loot = biterLoot, attributes = { explosion = "blood-explosion-small" }, @@ -563,6 +575,7 @@ buildUnitSpawner( unitSpawner = { name = "troll-spitter-nest", + loot = spawnerLoot, attributes = {}, resistances = {}, @@ -1056,6 +1069,7 @@ buildWorm( { name = "troll-worm", + loot = wormLoot, attributes = {}, attack = { softSmokeName = softSmoke diff --git a/prototypes/utils/BiterUtils.lua b/prototypes/utils/BiterUtils.lua index 0833bb2..1450ee6 100755 --- a/prototypes/utils/BiterUtils.lua +++ b/prototypes/utils/BiterUtils.lua @@ -123,6 +123,7 @@ function biterFunctions.makeBiter(name, biterAttributes, biterAttack, biterResis attack_parameters = biterAttack, vision_distance = biterAttributes.vision or 30, movement_speed = biterAttributes.movement, + loot = biterAttributes.loot, spawning_time_modifier = biterAttributes.spawningTimeModifer or 0, distance_per_frame = biterAttributes.distancePerFrame or 0.1, pollution_to_join_attack = biterAttributes.pollutionToAttack or 200, @@ -160,6 +161,7 @@ function biterFunctions.makeSpitter(name, biterAttributes, biterAttack, biterRes sticker_box = {{-0.6 * biterAttributes.scale, -0.8 * biterAttributes.scale}, {0.6 * biterAttributes.scale, 0}}, attack_parameters = biterAttack, + loot = biterAttributes.loot, vision_distance = biterAttributes.vision or 30, movement_speed = biterAttributes.movement, spawning_time_modifier = biterAttributes.spawningTimeModifer or 0, @@ -190,6 +192,7 @@ function biterFunctions.makeUnitSpawner(name, biterAttributes, biterResistances, max_health = biterAttributes.health, order="b-b-g", subgroup="enemies", + loot = biterAttributes.loot, resistances = resistances, working_sound = { sound = @@ -261,6 +264,7 @@ function biterFunctions.makeWorm(name, attributes, attack, wormResistances) order="b-b-e", subgroup="enemies", max_health = attributes.health, + loot = attributes.loot, resistances = resistances, healing_per_tick = attributes.healing or 0.01, collision_box = {{-1.1 * attributes.scale, -1.0 * attributes.scale}, {1.1 * attributes.scale, 1.0 * attributes.scale}}, @@ -452,6 +456,128 @@ function biterFunctions.createSuicideAttack(attributes) return o end +function biterFunctions.makeWormAlienLootTable(name) + local biterLoot + local artifacts = settings.startup["bobmods-enemies-enableartifacts"].value or settings.startup["NE_Alien_Artifacts"].value + local newArtifacts = settings.startup["bobmods-enemies-enablenewartifacts"].value + + if newArtifacts and name then + biterLoot = { + [1] = { item = "alien-artifact-" .. name, count_min = 1, count_max = 1, probability = 0.5 }, + [2] = { item = "alien-artifact-" .. name, count_min = 1, count_max = 2, probability = 0.5 }, + [3] = { item = "alien-artifact-" .. name, count_min = 1, count_max = 3, probability = 0.5 }, + [4] = { item = "alien-artifact-" .. name, count_min = 2, count_max = 3, probability = 0.5 }, + [5] = { item = "alien-artifact-" .. name, count_min = 2, count_max = 3, probability = 0.5 }, + [6] = { item = "alien-artifact-" .. name, count_min = 2, count_max = 3, probability = 0.5 }, + [7] = { item = "alien-artifact-" .. name, count_min = 2, count_max = 4, probability = 0.75 }, + [8] = { item = "alien-artifact-" .. name, count_min = 2, count_max = 4, probability = 0.75 }, + [9] = { item = "alien-artifact-" .. name, count_min = 2, count_max = 4, probability = 0.75 }, + [10] = { item = "alien-artifact-" .. name, count_min = 2, count_max = 4, probability = 0.75 } + } + elseif artifacts then + biterLoot = { + [1] = { item = "alien-artifact", count_min = 1, count_max = 1, probability = 0.5 }, + [2] = { item = "alien-artifact", count_min = 1, count_max = 2, probability = 0.5 }, + [3] = { item = "alien-artifact", count_min = 1, count_max = 3, probability = 0.5 }, + [4] = { item = "alien-artifact", count_min = 2, count_max = 3, probability = 0.5 }, + [5] = { item = "alien-artifact", count_min = 2, count_max = 3, probability = 0.5 }, + [6] = { item = "alien-artifact", count_min = 2, count_max = 3, probability = 0.5 }, + [7] = { item = "alien-artifact", count_min = 2, count_max = 4, probability = 0.75 }, + [8] = { item = "alien-artifact", count_min = 2, count_max = 4, probability = 0.75 }, + [9] = { item = "alien-artifact", count_min = 2, count_max = 4, probability = 0.75 }, + [10] = { item = "alien-artifact", count_min = 3, count_max = 4, probability = 0.75 } + } + end + + return biterLoot +end + +function biterFunctions.makeSpawnerAlienLootTable(name) + local biterLoot + local artifacts = settings.startup["bobmods-enemies-enableartifacts"].value or settings.startup["NE_Alien_Artifacts"].value + local newArtifacts = settings.startup["bobmods-enemies-enablenewartifacts"].value + + if newArtifacts and name then + biterLoot = { + [1] = { item = "alien-artifact-" .. name, count_min = 1, count_max = 1, probability = 0.5 }, + [2] = { item = "alien-artifact-" .. name, count_min = 1, count_max = 2, probability = 0.5 }, + [3] = { item = "alien-artifact-" .. name, count_min = 1, count_max = 3, probability = 0.5 }, + [4] = { item = "alien-artifact-" .. name, count_min = 2, count_max = 4, probability = 0.5 }, + [5] = { item = "alien-artifact-" .. name, count_min = 2, count_max = 5, probability = 0.5 }, + [6] = { item = "alien-artifact-" .. name, count_min = 2, count_max = 5, probability = 0.5 }, + [7] = { item = "alien-artifact-" .. name, count_min = 2, count_max = 6, probability = 0.75 }, + [8] = { item = "alien-artifact-" .. name, count_min = 2, count_max = 6, probability = 0.75 }, + [9] = { item = "alien-artifact-" .. name, count_min = 3, count_max = 7, probability = 0.75 }, + [10] = { item = "alien-artifact-" .. name, count_min = 3, count_max = 7, probability = 0.75 } + } + elseif artifacts then + biterLoot = { + [1] = { item = "alien-artifact", count_min = 1, count_max = 1, probability = 0.5 }, + [2] = { item = "alien-artifact", count_min = 1, count_max = 2, probability = 0.5 }, + [3] = { item = "alien-artifact", count_min = 1, count_max = 3, probability = 0.5 }, + [4] = { item = "alien-artifact", count_min = 2, count_max = 4, probability = 0.5 }, + [5] = { item = "alien-artifact", count_min = 2, count_max = 5, probability = 0.5 }, + [6] = { item = "alien-artifact", count_min = 1, count_max = 3, probability = 0.5 }, + [7] = { item = "alien-artifact", count_min = 2, count_max = 5, probability = 0.75 }, + [8] = { item = "alien-artifact", count_min = 3, count_max = 6, probability = 0.75 }, + [9] = { item = "alien-artifact", count_min = 3, count_max = 6, probability = 0.75 }, + [10] = { item = "alien-artifact", count_min = 3, count_max = 7, probability = 0.75 } + } + end + + return biterLoot +end + +function biterFunctions.makeUnitAlienLootTable(name) + local biterLoot + local artifacts = settings.startup["bobmods-enemies-enableartifacts"].value or settings.startup["NE_Alien_Artifacts"].value + local smallArtifacts = settings.startup["bobmods-enemies-enablesmallartifacts"].value or settings.startup["NE_Alien_Artifacts"].value + local newArtifacts = settings.startup["bobmods-enemies-enablenewartifacts"].value + + if smallArtifacts and newArtifacts and name then + biterLoot = { + [1] = { item = "small-alien-artifact-" .. name, count_min = 1, count_max = 1, probability = 0.25 }, + [2] = { item = "small-alien-artifact-" .. name, count_min = 1, count_max = 2, probability = 0.25 }, + [3] = { item = "small-alien-artifact-" .. name, count_min = 1, count_max = 3, probability = 0.25 }, + [4] = { item = "small-alien-artifact-" .. name, count_min = 2, count_max = 4, probability = 0.5 }, + [5] = { item = "small-alien-artifact-" .. name, count_min = 2, count_max = 5, probability = 0.5 }, + [6] = { item = "small-alien-artifact-" .. name, count_min = 2, count_max = 5, probability = 0.5 }, + [7] = { item = "small-alien-artifact-" .. name, count_min = 2, count_max = 6, probability = 0.75 }, + [8] = { item = "small-alien-artifact-" .. name, count_min = 2, count_max = 6, probability = 0.75 }, + [9] = { item = "small-alien-artifact-" .. name, count_min = 3, count_max = 7, probability = 0.75 }, + [10] = { item = "small-alien-artifact-" .. name, count_min = 3, count_max = 7, probability = 0.75 } + } + elseif smallArtifacts then + biterLoot = { + [1] = { item = "small-alien-artifact", count_min = 1, count_max = 1, probability = 0.25 }, + [2] = { item = "small-alien-artifact", count_min = 1, count_max = 2, probability = 0.25 }, + [3] = { item = "small-alien-artifact", count_min = 1, count_max = 3, probability = 0.25 }, + [4] = { item = "small-alien-artifact", count_min = 2, count_max = 4, probability = 0.5 }, + [5] = { item = "small-alien-artifact", count_min = 2, count_max = 5, probability = 0.5 }, + [6] = { item = "small-alien-artifact", count_min = 2, count_max = 5, probability = 0.5 }, + [7] = { item = "small-alien-artifact", count_min = 2, count_max = 6, probability = 0.75 }, + [8] = { item = "small-alien-artifact", count_min = 2, count_max = 6, probability = 0.75 }, + [9] = { item = "small-alien-artifact", count_min = 3, count_max = 7, probability = 0.75 }, + [10] = { item = "small-alien-artifact", count_min = 3, count_max = 7, probability = 0.75 } + } + elseif artifacts then + biterLoot = { + [1] = nil, + [2] = nil, + [3] = nil, + [4] = nil, + [5] = nil, + [6] = { item = "alien-artifact", count_min = 1, count_max = 3, probability = 0.5 }, + [7] = { item = "alien-artifact", count_min = 2, count_max = 5, probability = 0.75 }, + [8] = { item = "alien-artifact", count_min = 3, count_max = 6, probability = 0.75 }, + [9] = { item = "alien-artifact", count_min = 3, count_max = 6, probability = 0.75 }, + [10] = { item = "alien-artifact", count_min = 3, count_max = 7, probability = 0.75 } + } + end + + return biterLoot +end + function biterFunctions.findRunScale(entity) return entity.run_animation.layers[1].scale end diff --git a/settings.lua b/settings.lua index a6eb60a..f0bcb2c 100755 --- a/settings.lua +++ b/settings.lua @@ -316,6 +316,24 @@ data:extend({ default_value = 1, order = "d[modifier]-b[wave]", per_user = false + }, + + { + type = "bool-setting", + name = "rampant-enableBobsUnits", + setting_type = "startup", + default_value = true, + order = "b[modifier]-c[trigger]", + per_user = false + }, + + { + type = "bool-setting", + name = "rampant-enableNEUnits", + setting_type = "startup", + default_value = true, + order = "b[modifier]-d[trigger]", + per_user = false } -- { diff --git a/tests.lua b/tests.lua index b8ef6df..693c609 100755 --- a/tests.lua +++ b/tests.lua @@ -274,21 +274,21 @@ function tests.showBaseGrid() local n = {} for k,v in pairs(global.natives.bases) do - n[v] = k % 5 + n[v] = k % 4 end local chunks = global.map.chunkToBase for chunk,base in pairs(chunks) do local pick = n[base] local color = "concrete" - if (pick == 1) then + if base.alignment == constants.BASE_ALIGNMENT_NE then color = "hazard-concrete-left" + elseif (pick == 1) then + color = "water" elseif (pick == 2) then color = "deepwater" elseif (pick == 3) then color = "water-green" - elseif (pick == 4) then - color = "water" end chunkUtils.colorChunk(chunk.x, chunk.y, color, game.surfaces[1]) end