├── changelog.txt ├── control.lua ├── data.lua ├── data ├── entities │ ├── deploy_machine │ │ ├── circuit_deploy_machine.lua │ │ ├── deploy_machine.lua │ │ └── iron_deploy_machine.lua │ └── entities.lua ├── map_preset.lua ├── tf_util │ ├── empty-sound.ogg │ ├── empty-sprite.png │ ├── prototype_util.lua │ ├── tf_fire_util.lua │ └── tf_util.lua ├── units │ ├── blaster_bot │ │ └── blaster_bot.lua │ ├── laser_bot │ │ └── laser_bot.lua │ ├── plasma_bot │ │ ├── plasma_bot.lua │ │ ├── plasma_bot_projectile.png │ │ └── plasma_bot_splash.png │ ├── rocket_guy │ │ ├── rocket_guy.lua │ │ ├── rocket_guy_icon.png │ │ └── rocket_guy_rocket.png │ ├── scout_car │ │ └── scout_car.lua │ ├── shell_tank │ │ ├── shell_tank.lua │ │ ├── shell_tank_creation_parameters.lua │ │ ├── shell_tank_projectile.png │ │ └── shell_tank_projectile_shadow.png │ ├── smg_guy │ │ └── smg_guy.lua │ ├── tazer_bot │ │ ├── tazer_bot.lua │ │ └── tazer_bot_sticker.png │ └── units.lua └── variety_explosions.lua ├── info.json ├── license.txt ├── locale └── en │ ├── preset.cfg │ └── total-automization.cfg ├── readme.md ├── script ├── debug.lua ├── killcam.lua ├── script_util.lua └── unit_deployment.lua ├── shared.lua └── thumbnail.png /changelog.txt: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------------------------- 2 | Version: 0.2.5 3 | Date: 2021-07-25 4 | Changes: 5 | - Update for new unit control version 6 | - Tweaked some collision boxes 7 | --------------------------------------------------------------------------------------------------- 8 | Version: 0.2.4 9 | Date: 2020-06-14 10 | Changes: 11 | - Fix error raising events. 12 | --------------------------------------------------------------------------------------------------- 13 | Version: 0.2.3 14 | Date: 2020-06-12 15 | Changes: 16 | - Fix error due to GUI style changes. 17 | --------------------------------------------------------------------------------------------------- 18 | Version: 0.2.2 19 | Date: 2020-03-13 20 | Changes: 21 | - Fix missing some build event registrations 22 | --------------------------------------------------------------------------------------------------- 23 | Version: 0.2.1 24 | Date: 2020-02-24 25 | Changes: 26 | - Fixes for latest 0.18 version. 27 | --------------------------------------------------------------------------------------------------- 28 | Version: 0.2.0 29 | Date: 2020-01-22 30 | Changes: 31 | - 0.18 update. 32 | --------------------------------------------------------------------------------------------------- 33 | Version: 0.1.7 34 | Date: 2019-07-11 35 | Changes: 36 | - Fixed compatibility with Industrial revolution. 37 | --------------------------------------------------------------------------------------------------- 38 | Version: 0.1.5 39 | Date: 2019-03-23 40 | Changes: 41 | - Buffed all units health by about 80%. 42 | - Disabled base game worms/spitters acid on ground damage effect, as it was severely over-powered. 43 | - Some units attack in a slightly different way, E.G rocket guys rockets will track the target, SMG guy will hit instantly. 44 | - Added damage upgrade technologies. 45 | - Generally balanced the units and damage. They mostly do more damage now. 46 | -------------------------------------------------------------------------------- /control.lua: -------------------------------------------------------------------------------- 1 | names = require("shared") 2 | local handler = require("event_handler") 3 | 4 | --handler.add_lib(require("script/unit_deployment")) 5 | --handler.add_lib(require("script/killcam")) 6 | -------------------------------------------------------------------------------- /data.lua: -------------------------------------------------------------------------------- 1 | util = require "data/tf_util/tf_util" 2 | names = require("shared") 3 | require "data/units/units" 4 | require "data/entities/entities" 5 | require "data/variety_explosions" 6 | 7 | data.raw.character.character.collision_mask = util.ground_unit_collision_mask() 8 | 9 | -- The base game acid splashes are OP. 10 | -- Just turn off the damage and sticker on ground effect. 11 | 12 | for k, fire in pairs (data.raw.fire) do 13 | if fire.name:find("acid%-splash%-fire") then 14 | fire.on_damage_tick_effect = nil 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /data/entities/deploy_machine/circuit_deploy_machine.lua: -------------------------------------------------------------------------------- 1 | local machine = util.copy(data.raw["assembling-machine"]["centrifuge"]) 2 | local name = names.deployers.circuit_unit 3 | machine.name = name 4 | machine.localised_name = {name} 5 | local scale = 2 6 | util.recursive_hack_make_hr(machine) 7 | util.recursive_hack_scale(machine, scale) 8 | machine.collision_box = {{-2.7, -2.7},{2.7, 2.7}} 9 | machine.selection_box = {{-2.9, -2.9},{2.9, 2.9}} 10 | machine.crafting_categories = {name} 11 | machine.crafting_speed = (1) 12 | machine.ingredient_count = 100 13 | machine.module_specification = 14 | { 15 | module_slots = 2 16 | } 17 | machine.animation = machine.idle_animation 18 | machine.idle_animation = nil 19 | machine.minable = {result = name, mining_time = 1} 20 | machine.flags = {"placeable-neutral", "player-creation", "no-automated-item-removal"} 21 | machine.fluid_boxes = 22 | { 23 | { 24 | production_type = "output", 25 | pipe_picture = nil, 26 | pipe_covers = nil, 27 | base_area = 1, 28 | base_level = 1, 29 | pipe_connections = {{ type="output", position = {0, -3} }}, 30 | }, 31 | off_when_no_fluid_recipe = false 32 | } 33 | machine.scale_entity_info_icon = true 34 | machine.always_draw_idle_animation = false 35 | machine.working_visualisations = nil 36 | machine.is_deployer = true 37 | machine.energy_usage = "400kW" 38 | machine.energy_source = 39 | { 40 | type = "electric", 41 | usage_priority = "secondary-input", 42 | emissions_per_second_per_watt = 1 / 180000 43 | } 44 | 45 | local item = { 46 | type = "item", 47 | name = name, 48 | icon = machine.icon, 49 | icon_size = machine.icon_size, 50 | flags = {}, 51 | subgroup = "circuit-units", 52 | order = "aa"..name, 53 | place_result = name, 54 | stack_size = 50 55 | } 56 | 57 | local category = { 58 | type = "recipe-category", 59 | name = name 60 | } 61 | 62 | local subgroup = 63 | { 64 | type = "item-subgroup", 65 | name = "circuit-units", 66 | group = "combat", 67 | order = "z" 68 | } 69 | 70 | local recipe = { 71 | type = "recipe", 72 | name = name, 73 | localised_name = {name}, 74 | enabled = false, 75 | ingredients = 76 | { 77 | {"electronic-circuit", 50}, 78 | {"copper-cable", 50}, 79 | {"copper-plate", 50} 80 | }, 81 | energy_required = 100, 82 | result = name 83 | } 84 | 85 | local technology_name = names.technologies.circuit_units 86 | 87 | local technology_1 = { 88 | type = "technology", 89 | name = technology_name, 90 | localised_name = {technology_name}, 91 | localised_description = "", 92 | icon_size = machine.icon_size, 93 | icon = machine.icon, 94 | effects = 95 | { 96 | { 97 | type = "unlock-recipe", 98 | recipe = name 99 | }, 100 | { 101 | type = "unlock-recipe", 102 | recipe = names.units.blaster_bot 103 | } 104 | }, 105 | unit = 106 | { 107 | count = 250, 108 | ingredients = { 109 | {"automation-science-pack", 1}, 110 | --{"logistic-science-pack", 1}, 111 | }, 112 | time = 30 113 | }, 114 | prerequisites = {"automation"}, 115 | order = "z-a" 116 | } 117 | 118 | local technology_2 = { 119 | type = "technology", 120 | name = technology_name.."-2", 121 | localised_name = technology_name.." 2", 122 | localised_description = "", 123 | icon_size = machine.icon_size, 124 | icon = machine.icon, 125 | effects = 126 | { 127 | { 128 | type = "unlock-recipe", 129 | recipe = names.units.tazer_bot 130 | }, 131 | { 132 | type = "unlock-recipe", 133 | recipe = names.units.laser_bot 134 | } 135 | }, 136 | unit = 137 | { 138 | count = 250, 139 | ingredients = { 140 | {"automation-science-pack", 1}, 141 | {"logistic-science-pack", 1}, 142 | --{"military-science-pack", 1}, 143 | }, 144 | time = 30 145 | }, 146 | prerequisites = {technology_name}, 147 | order = "z-b", 148 | upgrade = true 149 | } 150 | 151 | local technology_3 = { 152 | type = "technology", 153 | name = technology_name.."-3", 154 | localised_name = technology_name.." 3", 155 | localised_description = "", 156 | icon_size = machine.icon_size, 157 | icon = machine.icon, 158 | effects = 159 | { 160 | { 161 | type = "unlock-recipe", 162 | recipe = names.units.plasma_bot 163 | } 164 | }, 165 | unit = 166 | { 167 | count = 500, 168 | ingredients = { 169 | {"automation-science-pack", 1}, 170 | {"logistic-science-pack", 1}, 171 | {"military-science-pack", 1}, 172 | --{"chemical-science-pack", 1}, 173 | }, 174 | time = 30 175 | }, 176 | prerequisites = {technology_name.."-2"}, 177 | order = "z-c", 178 | upgrade = true 179 | } 180 | 181 | 182 | local damage_technology_name = names.technologies.circuit_units_damage 183 | 184 | local damage_icon = 185 | { 186 | icon = "__base__/graphics/technology/physical-projectile-damage-2.png", 187 | icon_size = 128, 188 | scale = 0.8 * (32 / 128) 189 | } 190 | 191 | local damage_technology_icon = 192 | { 193 | { 194 | icon = machine.icon, 195 | icon_size = machine.icon_size 196 | }, 197 | damage_icon 198 | } 199 | 200 | 201 | local circuit_unit_damage_1 = 202 | { 203 | type = "technology", 204 | name = damage_technology_name.."-1", 205 | localised_name = {damage_technology_name}, 206 | localised_description = "", 207 | icons = damage_technology_icon, 208 | effects = 209 | { 210 | { 211 | type = "ammo-damage", 212 | ammo_category = "circuit-units", 213 | modifier = 0.2 214 | } 215 | }, 216 | unit = 217 | { 218 | count = 250, 219 | ingredients = { 220 | {"automation-science-pack", 1}, 221 | {"logistic-science-pack", 1}, 222 | --{"military-science-pack", 1}, 223 | }, 224 | time = 30 225 | }, 226 | prerequisites = {technology_name}, 227 | order = "y-d", 228 | upgrade = false 229 | } 230 | 231 | local circuit_unit_damage_2 = 232 | { 233 | type = "technology", 234 | name = damage_technology_name.."-2", 235 | localised_name = {damage_technology_name}, 236 | localised_description = "", 237 | icons = damage_technology_icon, 238 | effects = 239 | { 240 | { 241 | type = "ammo-damage", 242 | ammo_category = "circuit-units", 243 | modifier = 0.2 244 | } 245 | }, 246 | unit = 247 | { 248 | count = 250, 249 | ingredients = { 250 | {"automation-science-pack", 1}, 251 | {"logistic-science-pack", 1}, 252 | {"military-science-pack", 1}, 253 | }, 254 | time = 30 255 | }, 256 | prerequisites = {circuit_unit_damage_1.name}, 257 | order = "y-e", 258 | upgrade = true 259 | } 260 | 261 | local circuit_unit_damage_3 = 262 | { 263 | type = "technology", 264 | name = damage_technology_name.."-3", 265 | localised_name = {damage_technology_name}, 266 | localised_description = "", 267 | icons = damage_technology_icon, 268 | effects = 269 | { 270 | { 271 | type = "ammo-damage", 272 | ammo_category = "circuit-units", 273 | modifier = 0.2 274 | } 275 | }, 276 | unit = 277 | { 278 | count = 250, 279 | ingredients = { 280 | {"automation-science-pack", 1}, 281 | {"logistic-science-pack", 1}, 282 | {"military-science-pack", 1}, 283 | }, 284 | time = 30 285 | }, 286 | prerequisites = {circuit_unit_damage_2.name}, 287 | order = "y-f", 288 | upgrade = true 289 | } 290 | 291 | local circuit_unit_damage_4 = 292 | { 293 | type = "technology", 294 | name = damage_technology_name.."-4", 295 | localised_name = {damage_technology_name}, 296 | localised_description = "", 297 | icons = damage_technology_icon, 298 | effects = 299 | { 300 | { 301 | type = "ammo-damage", 302 | ammo_category = "circuit-units", 303 | modifier = 0.2 304 | } 305 | }, 306 | unit = 307 | { 308 | count = 250, 309 | ingredients = { 310 | {"automation-science-pack", 1}, 311 | {"logistic-science-pack", 1}, 312 | {"military-science-pack", 1}, 313 | {"chemical-science-pack", 1}, 314 | }, 315 | time = 30 316 | }, 317 | prerequisites = {circuit_unit_damage_3.name}, 318 | order = "y-g", 319 | upgrade = true 320 | } 321 | 322 | local circuit_unit_damage_5 = 323 | { 324 | type = "technology", 325 | name = damage_technology_name.."-5", 326 | localised_name = {damage_technology_name}, 327 | localised_description = "", 328 | icons = damage_technology_icon, 329 | effects = 330 | { 331 | { 332 | type = "ammo-damage", 333 | ammo_category = "circuit-units", 334 | modifier = 0.2 335 | } 336 | }, 337 | unit = 338 | { 339 | count = 250, 340 | ingredients = { 341 | {"automation-science-pack", 1}, 342 | {"logistic-science-pack", 1}, 343 | {"military-science-pack", 1}, 344 | {"chemical-science-pack", 1}, 345 | {"utility-science-pack", 1}, 346 | }, 347 | time = 30 348 | }, 349 | prerequisites = {circuit_unit_damage_4.name}, 350 | order = "y-h", 351 | upgrade = true 352 | } 353 | 354 | local circuit_unit_damage_6 = 355 | { 356 | type = "technology", 357 | name = damage_technology_name.."-6", 358 | localised_name = {damage_technology_name}, 359 | localised_description = "", 360 | icons = damage_technology_icon, 361 | effects = 362 | { 363 | { 364 | type = "ammo-damage", 365 | ammo_category = "circuit-units", 366 | modifier = 0.2 367 | } 368 | }, 369 | unit = 370 | { 371 | count_formula = "2^(L-5)*250", 372 | ingredients = { 373 | {"automation-science-pack", 1}, 374 | {"logistic-science-pack", 1}, 375 | {"military-science-pack", 1}, 376 | {"chemical-science-pack", 1}, 377 | {"utility-science-pack", 1}, 378 | }, 379 | time = 30 380 | }, 381 | max_level = "infinite", 382 | upgrade = true, 383 | prerequisites = {circuit_unit_damage_5.name}, 384 | order = "y-h", 385 | upgrade = true 386 | } 387 | 388 | data:extend 389 | { 390 | machine, 391 | item, 392 | category, 393 | subgroup, 394 | recipe, 395 | technology_1, 396 | technology_2, 397 | technology_3, 398 | circuit_unit_damage_1, 399 | circuit_unit_damage_2, 400 | circuit_unit_damage_3, 401 | circuit_unit_damage_4, 402 | circuit_unit_damage_5, 403 | circuit_unit_damage_6 404 | } -------------------------------------------------------------------------------- /data/entities/deploy_machine/deploy_machine.lua: -------------------------------------------------------------------------------- 1 | local require = function(str) return require("data/entities/deploy_machine/"..str) end 2 | 3 | require("iron_deploy_machine") 4 | require("circuit_deploy_machine") 5 | -------------------------------------------------------------------------------- /data/entities/deploy_machine/iron_deploy_machine.lua: -------------------------------------------------------------------------------- 1 | local machine = util.copy(data.raw["assembling-machine"]["assembling-machine-3"]) 2 | local name = names.deployers.iron_unit 3 | machine.name = name 4 | machine.localised_name = {name} 5 | local scale = 2 6 | util.recursive_hack_make_hr(machine) 7 | util.recursive_hack_scale(machine, scale) 8 | machine.collision_box = {{-2.7, -2.7},{2.7, 2.7}} 9 | machine.selection_box = {{-2.9, -2.9},{2.9, 2.9}} 10 | machine.crafting_categories = {name} 11 | machine.crafting_speed = (1) 12 | machine.ingredient_count = nil 13 | machine.allowed_effects = {"consumption", "speed", "pollution"} 14 | machine.module_specification = 15 | { 16 | module_slots = 2 17 | } 18 | machine.minable = {result = name, mining_time = 1} 19 | machine.flags = {"placeable-neutral", "player-creation", "no-automated-item-removal"} 20 | machine.fluid_boxes = 21 | { 22 | { 23 | production_type = "output", 24 | pipe_picture = nil, 25 | pipe_covers = nil, 26 | base_area = 1, 27 | base_level = 1, 28 | pipe_connections = {{ type="output", position = {0, -3} }}, 29 | }, 30 | off_when_no_fluid_recipe = false 31 | } 32 | machine.scale_entity_info_icon = true 33 | machine.energy_usage = "400kW" 34 | machine.energy_source = 35 | { 36 | type = "electric", 37 | usage_priority = "secondary-input", 38 | emissions_per_second_per_watt = 1 / 180000 39 | } 40 | machine.is_deployer = true 41 | 42 | local item = { 43 | type = "item", 44 | name = name, 45 | icon = machine.icon, 46 | icon_size = machine.icon_size, 47 | flags = {}, 48 | subgroup = "iron-units", 49 | order = "aa"..name, 50 | place_result = name, 51 | stack_size = 50 52 | } 53 | 54 | local category = { 55 | type = "recipe-category", 56 | name = name 57 | } 58 | 59 | local subgroup = 60 | { 61 | type = "item-subgroup", 62 | name = "iron-units", 63 | group = "combat", 64 | order = "y" 65 | } 66 | 67 | local recipe = { 68 | type = "recipe", 69 | name = name, 70 | localised_name = {name}, 71 | enabled = false, 72 | ingredients = 73 | { 74 | {"iron-plate", 50}, 75 | {"iron-gear-wheel", 80}, 76 | {"iron-stick", 50}, 77 | }, 78 | energy_required = 100, 79 | result = name 80 | } 81 | 82 | local technology_name = names.technologies.iron_units 83 | 84 | local technology_1 = { 85 | type = "technology", 86 | name = technology_name, 87 | localised_name = {technology_name}, 88 | localised_description = "", 89 | icon_size = machine.icon_size, 90 | icon = machine.icon, 91 | effects = 92 | { 93 | { 94 | type = "unlock-recipe", 95 | recipe = name 96 | }, 97 | { 98 | type = "unlock-recipe", 99 | recipe = names.units.smg_guy 100 | } 101 | }, 102 | unit = 103 | { 104 | count = 250, 105 | ingredients = { 106 | {"automation-science-pack", 1}, 107 | --{"logistic-science-pack", 1}, 108 | }, 109 | time = 30 110 | }, 111 | prerequisites = {"automation"}, 112 | order = "y-a" 113 | } 114 | 115 | local technology_2 = { 116 | type = "technology", 117 | name = technology_name.."-2", 118 | localised_name = {technology_name}, 119 | localised_description = "", 120 | icon_size = machine.icon_size, 121 | icon = machine.icon, 122 | effects = 123 | { 124 | { 125 | type = "unlock-recipe", 126 | recipe = names.units.rocket_guy 127 | }, 128 | { 129 | type = "unlock-recipe", 130 | recipe = names.units.scout_car 131 | } 132 | }, 133 | unit = 134 | { 135 | count = 250, 136 | ingredients = { 137 | {"automation-science-pack", 1}, 138 | {"logistic-science-pack", 1}, 139 | --{"military-science-pack", 1}, 140 | }, 141 | time = 30 142 | }, 143 | prerequisites = {technology_name}, 144 | order = "y-b", 145 | upgrade = true 146 | } 147 | 148 | local technology_3 = { 149 | type = "technology", 150 | name = technology_name.."-3", 151 | localised_name = {technology_name}, 152 | localised_description = "", 153 | icon_size = machine.icon_size, 154 | icon = machine.icon, 155 | effects = 156 | { 157 | { 158 | type = "unlock-recipe", 159 | recipe = names.units.shell_tank 160 | } 161 | }, 162 | unit = 163 | { 164 | count = 500, 165 | ingredients = { 166 | {"automation-science-pack", 1}, 167 | {"logistic-science-pack", 1}, 168 | {"military-science-pack", 1}, 169 | --{"chemical-science-pack", 1}, 170 | }, 171 | time = 30 172 | }, 173 | prerequisites = {technology_name.."-2"}, 174 | order = "y-c", 175 | upgrade = true 176 | } 177 | 178 | local damage_icon = 179 | { 180 | icon = "__base__/graphics/technology/physical-projectile-damage-2.png", 181 | icon_size = 128, 182 | scale = 0.8 * (32 / 128) 183 | } 184 | 185 | local damage_technology_name = names.technologies.iron_units_damage 186 | local damage_technology_icon = 187 | { 188 | { 189 | icon = machine.icon, 190 | icon_size = machine.icon_size, 191 | }, 192 | damage_icon 193 | } 194 | 195 | local iron_unit_damage_1 = 196 | { 197 | type = "technology", 198 | name = damage_technology_name.."-1", 199 | localised_name = {damage_technology_name}, 200 | localised_description = "", 201 | icons = damage_technology_icon, 202 | effects = 203 | { 204 | { 205 | type = "ammo-damage", 206 | ammo_category = "iron-units", 207 | modifier = 0.2 208 | } 209 | }, 210 | unit = 211 | { 212 | count = 250, 213 | ingredients = { 214 | {"automation-science-pack", 1}, 215 | {"logistic-science-pack", 1}, 216 | --{"military-science-pack", 1}, 217 | }, 218 | time = 30 219 | }, 220 | prerequisites = {technology_name}, 221 | order = "y-d", 222 | upgrade = false 223 | } 224 | 225 | local iron_unit_damage_2 = 226 | { 227 | type = "technology", 228 | name = damage_technology_name.."-2", 229 | localised_name = {damage_technology_name}, 230 | localised_description = "", 231 | icons = damage_technology_icon, 232 | effects = 233 | { 234 | { 235 | type = "ammo-damage", 236 | ammo_category = "iron-units", 237 | modifier = 0.2 238 | } 239 | }, 240 | unit = 241 | { 242 | count = 250, 243 | ingredients = { 244 | {"automation-science-pack", 1}, 245 | {"logistic-science-pack", 1}, 246 | {"military-science-pack", 1}, 247 | }, 248 | time = 30 249 | }, 250 | prerequisites = {iron_unit_damage_1.name}, 251 | order = "y-e", 252 | upgrade = true 253 | } 254 | 255 | local iron_unit_damage_3 = 256 | { 257 | type = "technology", 258 | name = damage_technology_name.."-3", 259 | localised_name = {damage_technology_name}, 260 | localised_description = "", 261 | icons = damage_technology_icon, 262 | effects = 263 | { 264 | { 265 | type = "ammo-damage", 266 | ammo_category = "iron-units", 267 | modifier = 0.2 268 | } 269 | }, 270 | unit = 271 | { 272 | count = 250, 273 | ingredients = { 274 | {"automation-science-pack", 1}, 275 | {"logistic-science-pack", 1}, 276 | {"military-science-pack", 1}, 277 | }, 278 | time = 30 279 | }, 280 | prerequisites = {iron_unit_damage_2.name}, 281 | order = "y-f", 282 | upgrade = true 283 | } 284 | 285 | local iron_unit_damage_4 = 286 | { 287 | type = "technology", 288 | name = damage_technology_name.."-4", 289 | localised_name = {damage_technology_name}, 290 | localised_description = "", 291 | icons = damage_technology_icon, 292 | effects = 293 | { 294 | { 295 | type = "ammo-damage", 296 | ammo_category = "iron-units", 297 | modifier = 0.2 298 | } 299 | }, 300 | unit = 301 | { 302 | count = 250, 303 | ingredients = { 304 | {"automation-science-pack", 1}, 305 | {"logistic-science-pack", 1}, 306 | {"military-science-pack", 1}, 307 | {"chemical-science-pack", 1}, 308 | }, 309 | time = 30 310 | }, 311 | prerequisites = {iron_unit_damage_3.name}, 312 | order = "y-g", 313 | upgrade = true 314 | } 315 | 316 | local iron_unit_damage_5 = 317 | { 318 | type = "technology", 319 | name = damage_technology_name.."-5", 320 | localised_name = {damage_technology_name}, 321 | localised_description = "", 322 | icons = damage_technology_icon, 323 | effects = 324 | { 325 | { 326 | type = "ammo-damage", 327 | ammo_category = "iron-units", 328 | modifier = 0.2 329 | } 330 | }, 331 | unit = 332 | { 333 | count = 250, 334 | ingredients = { 335 | {"automation-science-pack", 1}, 336 | {"logistic-science-pack", 1}, 337 | {"military-science-pack", 1}, 338 | {"chemical-science-pack", 1}, 339 | {"utility-science-pack", 1}, 340 | }, 341 | time = 30 342 | }, 343 | prerequisites = {iron_unit_damage_4.name}, 344 | order = "y-h", 345 | upgrade = true 346 | } 347 | 348 | local iron_unit_damage_6 = 349 | { 350 | type = "technology", 351 | name = damage_technology_name.."-6", 352 | localised_name = {damage_technology_name}, 353 | localised_description = "", 354 | icons = damage_technology_icon, 355 | effects = 356 | { 357 | { 358 | type = "ammo-damage", 359 | ammo_category = "iron-units", 360 | modifier = 0.2 361 | } 362 | }, 363 | unit = 364 | { 365 | count_formula = "2^(L-5)*250", 366 | ingredients = { 367 | {"automation-science-pack", 1}, 368 | {"logistic-science-pack", 1}, 369 | {"military-science-pack", 1}, 370 | {"chemical-science-pack", 1}, 371 | {"utility-science-pack", 1}, 372 | }, 373 | time = 30 374 | }, 375 | max_level = "infinite", 376 | upgrade = true, 377 | prerequisites = {iron_unit_damage_5.name}, 378 | order = "y-h", 379 | upgrade = true 380 | } 381 | 382 | data:extend 383 | { 384 | machine, 385 | item, 386 | category, 387 | subgroup, 388 | recipe, 389 | technology_1, 390 | technology_2, 391 | technology_3, 392 | iron_unit_damage_1, 393 | iron_unit_damage_2, 394 | iron_unit_damage_3, 395 | iron_unit_damage_4, 396 | iron_unit_damage_5, 397 | iron_unit_damage_6 398 | } -------------------------------------------------------------------------------- /data/entities/entities.lua: -------------------------------------------------------------------------------- 1 | local require = function(name) return require("data/entities/"..name) end 2 | 3 | require("deploy_machine/deploy_machine") -------------------------------------------------------------------------------- /data/map_preset.lua: -------------------------------------------------------------------------------- 1 | data.raw["map-gen-presets"].default["pvp-ribbonworld"] = 2 | { 3 | order = "aa", 4 | basic_settings = 5 | { 6 | autoplace_controls = 7 | { 8 | coal = 9 | { 10 | frequency = 3, 11 | size = 0.5, 12 | richness = 2 13 | }, 14 | ["copper-ore"] = 15 | { 16 | frequency = 3, 17 | size = 0.5, 18 | richness = 2 19 | }, 20 | ["crude-oil"] = 21 | { 22 | frequency = 3, 23 | size = 0.5, 24 | richness = 2 25 | }, 26 | ["uranium-ore"] = 27 | { 28 | frequency = 3, 29 | size = 0.5, 30 | richness = 2 31 | }, 32 | ["iron-ore"] = 33 | { 34 | frequency = 3, 35 | size = 0.5, 36 | richness = 2 37 | }, 38 | stone = 39 | { 40 | frequency = 3, 41 | size = 0.5, 42 | richness = 2 43 | }, 44 | trees = 45 | { 46 | frequency = 5, 47 | richness = 1, 48 | size = 0.1 49 | }, 50 | }, 51 | terrain_segmentation = 2, 52 | water = 1.4, 53 | starting_area = 2, 54 | height = 16 * 32 55 | } 56 | } 57 | 58 | data.raw["map-gen-presets"].default["pvp-arena"] = 59 | { 60 | order = "ab", 61 | basic_settings = 62 | { 63 | autoplace_controls = 64 | { 65 | coal = 66 | { 67 | frequency = 3, 68 | size = 0.5, 69 | richness = 2 70 | }, 71 | ["copper-ore"] = 72 | { 73 | frequency = 3, 74 | size = 0.5, 75 | richness = 2 76 | }, 77 | ["crude-oil"] = 78 | { 79 | frequency = 3, 80 | size = 0.5, 81 | richness = 2 82 | }, 83 | ["uranium-ore"] = 84 | { 85 | frequency = 3, 86 | size = 0.5, 87 | richness = 2 88 | }, 89 | ["iron-ore"] = 90 | { 91 | frequency = 3, 92 | size = 0.5, 93 | richness = 2 94 | }, 95 | stone = 96 | { 97 | frequency = 3, 98 | size = 0.5, 99 | richness = 2 100 | }, 101 | trees = 102 | { 103 | frequency = 5, 104 | richness = 1, 105 | size = 0.1 106 | }, 107 | }, 108 | terrain_segmentation = 2, 109 | water = 1.4, 110 | starting_area = 1.2, 111 | width = 32 * 48, 112 | height = 32 * 48 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /data/tf_util/empty-sound.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klonan/Total_Automization/aa61e009449416e1b2da1c9ae06eebcfc2367a30/data/tf_util/empty-sound.ogg -------------------------------------------------------------------------------- /data/tf_util/empty-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klonan/Total_Automization/aa61e009449416e1b2da1c9ae06eebcfc2367a30/data/tf_util/empty-sprite.png -------------------------------------------------------------------------------- /data/tf_util/prototype_util.lua: -------------------------------------------------------------------------------- 1 | local rename_recipe = function(old, new) 2 | local recipes = data.raw.recipe 3 | for k, recipe in pairs (recipes) do 4 | if recipe.normal then 5 | for k, v in pairs(recipe.normal) do 6 | recipe[k] = v 7 | end 8 | recipe.normal = nil 9 | recipe.expensive = nil 10 | end 11 | for k, ingredient in pairs (recipe.ingredients) do 12 | if ingredient.name and ingredient.name == old then 13 | ingredient.name = new 14 | end 15 | if ingredient[1] and ingredient[1] == old then 16 | ingredient[1] = new 17 | end 18 | end 19 | if recipe.result and recipe.result == old then 20 | recipe.result = new 21 | end 22 | for k, product in pairs (recipe.products or {}) do 23 | if product.name and product.name == old then 24 | product.name = new 25 | end 26 | if product[1] and product[1] == old then 27 | product[1] = new 28 | end 29 | end 30 | -- Will have to handle technologies.. so lets do it only when nescessary 31 | --if recipe.name == old then 32 | -- recipe.name = new 33 | -- recipe.localised_name = new 34 | -- recipes[new] = recipe 35 | -- recipes[old] = nil 36 | --end 37 | end 38 | end 39 | 40 | local rename_item = function(old, new) 41 | local items = data.raw.item 42 | for k, item in pairs (items) do 43 | if item.place_result and item.place_result == old then 44 | item.place_result = new 45 | end 46 | if item.name == old then 47 | item.name = new 48 | item.localised_name = new 49 | items[new] = item 50 | items[old] = nil 51 | rename_recipe(old, new) 52 | end 53 | end 54 | end 55 | 56 | local rename_recipe = function(old, new) 57 | local recipes = data.raw.recipe 58 | for k, recipe in pairs (recipes) do 59 | if recipe.normal then 60 | for k, v in pairs(recipe.normal) do 61 | recipe[k] = v 62 | end 63 | recipe.normal = nil 64 | recipe.expensive = nil 65 | end 66 | for k, ingredient in pairs (recipe.ingredients) do 67 | if ingredient.name and ingredient.name == old then 68 | ingredient.name = new 69 | end 70 | if ingredient[1] and ingredient[1] == old then 71 | ingredient[1] = new 72 | end 73 | end 74 | if recipe.result and recipe.result == old then 75 | recipe.result = new 76 | end 77 | for k, product in pairs (recipe.products or {}) do 78 | if product.name and product.name == old then 79 | product.name = new 80 | end 81 | if product[1] and product[1] == old then 82 | product[1] = new 83 | end 84 | end 85 | -- Will have to handle technologies.. so lets do it only when nescessary 86 | --if recipe.name == old then 87 | -- recipe.name = new 88 | -- recipe.localised_name = new 89 | -- recipes[new] = recipe 90 | -- recipes[old] = nil 91 | --end 92 | end 93 | end 94 | 95 | 96 | local remove_from_recipe = function(recipe, name) 97 | --log(name) 98 | if recipe.normal then 99 | --Screw this half-assed system 100 | for k, v in pairs (recipe.normal) do 101 | recipe[k] = v 102 | end 103 | recipe.normal = nil 104 | recipe.expensive = nil 105 | end 106 | 107 | local result = recipe.result 108 | if result == name then 109 | return 110 | 111 | end 112 | local ingredients = recipe.ingredients 113 | if ingredients then 114 | for i = #ingredients, 1, -1 do 115 | if (ingredients[i].name or ingredients[i][1]) == name then 116 | table.remove(ingredients, i) 117 | end 118 | end 119 | if #ingredients == 0 then 120 | return 121 | end 122 | end 123 | 124 | local products = recipe.products 125 | if products then 126 | for i = #products, 1, -1 do 127 | if (products[i].name or products[i][1]) == name then 128 | table.remove(products, i) 129 | end 130 | end 131 | if #products == 0 then 132 | return 133 | end 134 | end 135 | 136 | if recipe.main_product and recipe.main_product == name then 137 | recipe.main_product = nil 138 | end 139 | 140 | return recipe 141 | end 142 | 143 | local remove_technology = function(name) 144 | local technologies = data.raw.technology 145 | for k, tech in pairs (technologies) do 146 | local req = tech.prerequisites 147 | if req then 148 | for i = #req, 1, -1 do 149 | if req[i] == name then 150 | table.remove(req, i) 151 | end 152 | end 153 | if #req == 0 then 154 | tech.prerequisites = nil 155 | end 156 | end 157 | end 158 | technologies[name] = nil 159 | end 160 | 161 | local remove_item_from_technologies = function(name) 162 | local technologies = data.raw.technology 163 | for k, tech in pairs (technologies) do 164 | local packs = tech.unit.ingredients 165 | for i = #packs, 1, -1 do 166 | if (packs[i].name or packs[i][1]) == name then 167 | table.remove(packs, i) 168 | end 169 | end 170 | if #packs == 0 then 171 | remove_technology(tech.name) 172 | end 173 | end 174 | end 175 | 176 | local remove_recipe_from_technologies = function(name) 177 | --log("Removing recipe from technologies: "..name) 178 | local technologies = data.raw.technology 179 | for k, technology in pairs (technologies) do 180 | local effects = technology.effects 181 | if effects then 182 | --log(technology.name.." = "..#effects) 183 | for i = #effects, 1, -1 do 184 | --log((effects[i].recipe or "nil").. " == "..name) 185 | if (effects[i].recipe == name) then 186 | --log("Removed from: "..k) 187 | table.remove(effects, i) 188 | end 189 | end 190 | if #effects == 0 then 191 | remove_technology(technology.name) 192 | end 193 | end 194 | end 195 | end 196 | 197 | local remove_item_from_recipes = function(name) 198 | if type(name) ~= "string" then error("I EXPECT A STRING") end 199 | --log("Removing item from recipes: "..name) 200 | local recipes = data.raw.recipe 201 | for k, recipe in pairs (recipes) do 202 | local result = remove_from_recipe(recipe, name) 203 | if not result then 204 | remove_recipe_from_technologies(recipe.name) 205 | recipes[k] = nil 206 | end 207 | end 208 | end 209 | 210 | local remove_from_items = function(name) 211 | if type(name) ~= "string" then error("I EXPECT A STRING") end 212 | local items = data.raw.item 213 | for k, item in pairs (items) do 214 | if item.place_result == name then 215 | remove_item_from_recipes(item.name) 216 | items[k] = nil 217 | return 218 | end 219 | if item.rocket_launch_product == name then 220 | item.rocket_launch_product = nil 221 | end 222 | if item.rocket_launch_products then 223 | util.remove_from_list(item.rocket_launch_products, name) 224 | end 225 | end 226 | local items = data.raw["item-with-entity-data"] 227 | for k, item in pairs (items) do 228 | if item.place_result == name then 229 | remove_item_from_recipes(item.name) 230 | items[k] = nil 231 | return 232 | end 233 | if item.rocket_launch_product == name then 234 | item.rocket_launch_product = nil 235 | end 236 | if item.rocket_launch_products then 237 | util.remove_from_list(item.rocket_launch_products, name) 238 | end 239 | end 240 | end 241 | 242 | local find_mention 243 | find_mention = function(table, name) 244 | for k, v in pairs (table) do 245 | if type(v) == "table" then 246 | find_mention(v, name) 247 | elseif k == name or ((type(v) == "string") and (v == name)) then 248 | return true 249 | end 250 | end 251 | end 252 | 253 | local remove_from_achievements = function(name) 254 | for type_name, type in pairs (data.raw) do 255 | if string.find(type_name, "achievement") then 256 | for k, achievement in pairs (type) do 257 | if find_mention(achievement, name) then 258 | type[k] = nil 259 | end 260 | end 261 | end 262 | end 263 | end 264 | 265 | local remove_entity_prototype = function(ent) 266 | if not ent then return end 267 | --So, if we actually delete the prototype, we get some error about traversing old prototypes for migrations or some BS... so we just nuke all items and hide them 268 | --log(ent.name) 269 | remove_from_items(ent.name) 270 | remove_from_achievements(ent.name) 271 | ent.minable = nil 272 | ent.order = "Z-DELETED" 273 | ent.autoplace = nil 274 | end 275 | 276 | local remove_from_minable = function(name) 277 | for k, type in pairs (data.raw) do 278 | for j, v in pairs (type) do 279 | if v.minable and v.minable.result == name then 280 | v.minable = nil 281 | end 282 | end 283 | end 284 | end 285 | 286 | local remove_item_prototype = function(item) 287 | if not item then log("Well item to remove was nil anyway so great job") return end 288 | remove_item_from_recipes(item.name) 289 | remove_item_from_technologies(item.name) 290 | remove_from_minable(item.name) 291 | data.raw.item[item.name] = nil 292 | item = nil 293 | end 294 | 295 | remove_technology_effect_type = function(dict) 296 | for k, tech in pairs (data.raw.technology) do 297 | local effects = tech.effects 298 | if effects then 299 | for i = #effects, 1, -1 do 300 | if dict[effects[i].type] then 301 | table.remove(effects, i) 302 | end 303 | end 304 | if #effects == 0 then 305 | remove_technology(tech.name) 306 | end 307 | end 308 | end 309 | end 310 | 311 | local lib = {} 312 | lib.rename_item = rename_item 313 | lib.rename_recipe = rename_recipe 314 | lib.remove_from_achievements = remove_from_achievements 315 | lib.remove_from_items = remove_from_items 316 | lib.remove_item_from_recipes = remove_item_from_recipes 317 | lib.remove_item_from_technologies = remove_item_from_technologies 318 | lib.remove_recipe_from_technologies = remove_recipe_from_technologies 319 | lib.remove_entity_prototype = remove_entity_prototype 320 | lib.remove_item_prototype = remove_item_prototype 321 | lib.remove_technology_effect_type = remove_technology_effect_type 322 | lib.remove_technology = remove_technology 323 | 324 | return lib 325 | -------------------------------------------------------------------------------- /data/tf_util/tf_fire_util.lua: -------------------------------------------------------------------------------- 1 | --Copy paste from base game 2 | local fire_util = {} 3 | 4 | fire_util.create_fire_pictures = function(opts) 5 | local opts = opts or {} 6 | local fire_blend_mode = opts.blend_mode or "additive" 7 | local fire_animation_speed = opts.animation_speed or 0.5 8 | local fire_scale = opts.scale or 1 9 | local fire_tint = opts.tint or {r=1,g=1,b=1,a=1} 10 | local fire_flags = opts.flags or { "compressed" } 11 | return 12 | { 13 | { 14 | filename = "__base__/graphics/entity/fire-flame/fire-flame-13.png", 15 | line_length = 8, 16 | width = 60, 17 | height = 118, 18 | frame_count = 25, 19 | axially_symmetrical = false, 20 | direction_count = 1, 21 | blend_mode = fire_blend_mode, 22 | animation_speed = fire_animation_speed, 23 | scale = fire_scale, 24 | tint = fire_tint, 25 | flags = fire_flags, 26 | shift = { -0.0390625, -0.90625 } 27 | }, 28 | { 29 | filename = "__base__/graphics/entity/fire-flame/fire-flame-12.png", 30 | line_length = 8, 31 | width = 63, 32 | height = 116, 33 | frame_count = 25, 34 | axially_symmetrical = false, 35 | direction_count = 1, 36 | blend_mode = fire_blend_mode, 37 | animation_speed = fire_animation_speed, 38 | scale = fire_scale, 39 | tint = fire_tint, 40 | flags = fire_flags, 41 | shift = { -0.015625, -0.914065 } 42 | }, 43 | { 44 | filename = "__base__/graphics/entity/fire-flame/fire-flame-11.png", 45 | line_length = 8, 46 | width = 61, 47 | height = 122, 48 | frame_count = 25, 49 | axially_symmetrical = false, 50 | direction_count = 1, 51 | blend_mode = fire_blend_mode, 52 | animation_speed = fire_animation_speed, 53 | scale = fire_scale, 54 | tint = fire_tint, 55 | flags = fire_flags, 56 | shift = { -0.0078125, -0.90625 } 57 | }, 58 | { 59 | filename = "__base__/graphics/entity/fire-flame/fire-flame-10.png", 60 | line_length = 8, 61 | width = 65, 62 | height = 108, 63 | frame_count = 25, 64 | axially_symmetrical = false, 65 | direction_count = 1, 66 | blend_mode = fire_blend_mode, 67 | animation_speed = fire_animation_speed, 68 | scale = fire_scale, 69 | tint = fire_tint, 70 | flags = fire_flags, 71 | shift = { -0.0625, -0.64844 } 72 | }, 73 | { 74 | filename = "__base__/graphics/entity/fire-flame/fire-flame-09.png", 75 | line_length = 8, 76 | width = 64, 77 | height = 101, 78 | frame_count = 25, 79 | axially_symmetrical = false, 80 | direction_count = 1, 81 | blend_mode = fire_blend_mode, 82 | animation_speed = fire_animation_speed, 83 | scale = fire_scale, 84 | tint = fire_tint, 85 | flags = fire_flags, 86 | shift = { -0.03125, -0.695315 } 87 | }, 88 | { 89 | filename = "__base__/graphics/entity/fire-flame/fire-flame-08.png", 90 | line_length = 8, 91 | width = 50, 92 | height = 98, 93 | frame_count = 32, 94 | axially_symmetrical = false, 95 | direction_count = 1, 96 | blend_mode = fire_blend_mode, 97 | animation_speed = fire_animation_speed, 98 | scale = fire_scale, 99 | tint = fire_tint, 100 | flags = fire_flags, 101 | shift = { -0.0546875, -0.77344 } 102 | }, 103 | { 104 | filename = "__base__/graphics/entity/fire-flame/fire-flame-07.png", 105 | line_length = 8, 106 | width = 54, 107 | height = 84, 108 | frame_count = 32, 109 | axially_symmetrical = false, 110 | direction_count = 1, 111 | blend_mode = fire_blend_mode, 112 | animation_speed = fire_animation_speed, 113 | scale = fire_scale, 114 | tint = fire_tint, 115 | flags = fire_flags, 116 | shift = { 0.015625, -0.640625 } 117 | }, 118 | { 119 | filename = "__base__/graphics/entity/fire-flame/fire-flame-06.png", 120 | line_length = 8, 121 | width = 65, 122 | height = 92, 123 | frame_count = 32, 124 | axially_symmetrical = false, 125 | direction_count = 1, 126 | blend_mode = fire_blend_mode, 127 | animation_speed = fire_animation_speed, 128 | scale = fire_scale, 129 | tint = fire_tint, 130 | flags = fire_flags, 131 | shift = { 0, -0.83594 } 132 | }, 133 | { 134 | filename = "__base__/graphics/entity/fire-flame/fire-flame-05.png", 135 | line_length = 8, 136 | width = 59, 137 | height = 103, 138 | frame_count = 32, 139 | axially_symmetrical = false, 140 | direction_count = 1, 141 | blend_mode = fire_blend_mode, 142 | animation_speed = fire_animation_speed, 143 | scale = fire_scale, 144 | tint = fire_tint, 145 | flags = fire_flags, 146 | shift = { 0.03125, -0.882815 } 147 | }, 148 | { 149 | filename = "__base__/graphics/entity/fire-flame/fire-flame-04.png", 150 | line_length = 8, 151 | width = 67, 152 | height = 130, 153 | frame_count = 32, 154 | axially_symmetrical = false, 155 | direction_count = 1, 156 | blend_mode = fire_blend_mode, 157 | animation_speed = fire_animation_speed, 158 | scale = fire_scale, 159 | tint = fire_tint, 160 | flags = fire_flags, 161 | shift = { 0.015625, -1.109375 } 162 | }, 163 | { 164 | filename = "__base__/graphics/entity/fire-flame/fire-flame-03.png", 165 | line_length = 8, 166 | width = 74, 167 | height = 117, 168 | frame_count = 32, 169 | axially_symmetrical = false, 170 | direction_count = 1, 171 | blend_mode = fire_blend_mode, 172 | animation_speed = fire_animation_speed, 173 | scale = fire_scale, 174 | tint = fire_tint, 175 | flags = fire_flags, 176 | shift = { 0.046875, -0.984375 } 177 | }, 178 | { 179 | filename = "__base__/graphics/entity/fire-flame/fire-flame-02.png", 180 | line_length = 8, 181 | width = 74, 182 | height = 114, 183 | frame_count = 32, 184 | axially_symmetrical = false, 185 | direction_count = 1, 186 | blend_mode = fire_blend_mode, 187 | animation_speed = fire_animation_speed, 188 | scale = fire_scale, 189 | tint = fire_tint, 190 | flags = fire_flags, 191 | shift = { 0.0078125, -0.96875 } 192 | }, 193 | { 194 | filename = "__base__/graphics/entity/fire-flame/fire-flame-01.png", 195 | line_length = 8, 196 | width = 66, 197 | height = 119, 198 | frame_count = 32, 199 | axially_symmetrical = false, 200 | direction_count = 1, 201 | blend_mode = fire_blend_mode, 202 | animation_speed = fire_animation_speed, 203 | scale = fire_scale, 204 | tint = fire_tint, 205 | flags = fire_flags, 206 | shift = { -0.0703125, -1.039065 } 207 | }, 208 | } 209 | end 210 | 211 | return fire_util -------------------------------------------------------------------------------- /data/tf_util/tf_util.lua: -------------------------------------------------------------------------------- 1 | local util = require("util") 2 | 3 | local is_sprite_def = function(array) 4 | return array.width and array.height and (array.filename or array.stripes or array.filenames) 5 | end 6 | 7 | util.is_sprite_def = is_sprite_def 8 | 9 | local recursive_hack_scale 10 | recursive_hack_scale = function(array, scale) 11 | for k, v in pairs (array) do 12 | if type(v) == "table" then 13 | if is_sprite_def(v) then 14 | v.scale = (v.scale or 1) * scale 15 | if v.shift then 16 | v.shift[1], v.shift[2] = v.shift[1] * scale, v.shift[2] * scale 17 | end 18 | end 19 | if v.source_offset then 20 | v.source_offset[1] = v.source_offset[1] * scale 21 | v.source_offset[2] = v.source_offset[2] * scale 22 | end 23 | if v.projectile_center then 24 | v.projectile_center[1] = v.projectile_center[1] * scale 25 | v.projectile_center[2] = v.projectile_center[2] * scale 26 | end 27 | if v.projectile_creation_distance then 28 | v.projectile_creation_distance = v.projectile_creation_distance * scale 29 | end 30 | recursive_hack_scale(v, scale) 31 | end 32 | end 33 | end 34 | util.recursive_hack_scale = recursive_hack_scale 35 | 36 | local recursive_hack_animation_speed 37 | recursive_hack_animation_speed = function(array, scale) 38 | for k, v in pairs (array) do 39 | if type(v) == "table" then 40 | if is_sprite_def(v) then 41 | v.animation_speed = v.animation_speed * scale 42 | end 43 | recursive_hack_animation_speed(v, scale) 44 | end 45 | end 46 | end 47 | util.recursive_hack_animation_speed = recursive_hack_animation_speed 48 | 49 | local recursive_hack_tint 50 | recursive_hack_tint = function(array, tint) 51 | for k, v in pairs (array) do 52 | if type(v) == "table" then 53 | if is_sprite_def(v) then 54 | v.tint = tint 55 | end 56 | recursive_hack_tint(v, tint) 57 | end 58 | end 59 | end 60 | util.recursive_hack_tint = recursive_hack_tint 61 | 62 | local recursive_hack_make_hr 63 | recursive_hack_make_hr = function(prototype) 64 | for k, v in pairs (prototype) do 65 | if type(v) == "table" then 66 | if is_sprite_def(v) and v.hr_version then 67 | prototype[k] = v.hr_version 68 | --v.scale = v.scale * 0.5 69 | v.hr_version = nil 70 | end 71 | recursive_hack_make_hr(v) 72 | end 73 | end 74 | end 75 | util.recursive_hack_make_hr = recursive_hack_make_hr 76 | 77 | util.scale_box = function(box, scale) 78 | box[1][1] = box[1][1] * scale 79 | box[1][2] = box[1][2] * scale 80 | box[2][1] = box[2][1] * scale 81 | box[2][2] = box[2][2] * scale 82 | return box 83 | end 84 | 85 | util.scale_boxes = function(prototype, scale) 86 | for k, v in pairs {"collision_box", "selection_box"} do 87 | local box = prototype[v] 88 | if box then 89 | local width = (box[2][1] - box[1][1]) * (scale / 2) 90 | local height = (box[2][2] - box[1][2]) * (scale / 2) 91 | local x = (box[1][1] + box[2][1]) / 2 92 | local y = (box[1][2] + box[2][2]) / 2 93 | box[1][1], box[2][1] = x - width, x + width 94 | box[1][2], box[2][2] = y - height, y + height 95 | end 96 | end 97 | end 98 | 99 | util.remove_flag = function(prototype, flag) 100 | if not prototype.flags then return end 101 | for k, v in pairs (prototype.flags) do 102 | if v == flag then 103 | table.remove(prototype.flags, k) 104 | break 105 | end 106 | end 107 | end 108 | 109 | util.add_flag = function(prototype, flag) 110 | if not prototype.flags then return end 111 | table.insert(prototype.flags, flag) 112 | end 113 | 114 | util.base_player = function() 115 | 116 | local player = util.table.deepcopy(data.raw.player.player or error("Wat man cmon why")) 117 | player.ticks_to_keep_gun = (600) 118 | player.ticks_to_keep_aiming_direction = (100) 119 | player.ticks_to_stay_in_combat = (600) 120 | util.remove_flag(player, "not-flammable") 121 | return player 122 | end 123 | 124 | util.path = function(str) 125 | return "__Total_Automization__/" .. str 126 | end 127 | 128 | util.empty_sound = function() 129 | return 130 | { 131 | filename = util.path("data/tf_util/empty-sound.ogg"), 132 | volume = 0 133 | } 134 | end 135 | 136 | util.empty_sprite = function() 137 | return 138 | { 139 | filename = util.path("data/tf_util/empty-sprite.png"), 140 | height = 1, 141 | width = 1, 142 | frame_count = 1 143 | } 144 | end 145 | 146 | util.damage_type = function(name) 147 | if not data.raw["damage-type"][name] then 148 | data:extend{{type = "damage-type", name = name, localised_name = {name}}} 149 | end 150 | return name 151 | end 152 | 153 | util.ammo_category = function(name) 154 | if not data.raw["ammo-category"][name] then 155 | data:extend{{type = "ammo-category", name = name, localised_name = {name}}} 156 | end 157 | return name 158 | end 159 | 160 | util.base_gun = function(name) 161 | return 162 | { 163 | name = name, 164 | localised_name = {name}, 165 | type = "gun", 166 | stack_size = 10, 167 | flags = {} 168 | } 169 | end 170 | 171 | util.base_ammo = function(name) 172 | return 173 | { 174 | name = name, 175 | localised_name = {name}, 176 | type = "ammo", 177 | stack_size = 10, 178 | magazine_size = 1, 179 | flags = {} 180 | } 181 | end 182 | 183 | local base_speed = 0.25 184 | util.speed = function(multiplier) 185 | return multiplier * (base_speed) 186 | end 187 | 188 | util.remove_from_list = function(list, name) 189 | local remove = table.remove 190 | for i = #list, 1, -1 do 191 | if list[i] == name then 192 | remove(list, i) 193 | end 194 | end 195 | end 196 | 197 | local recursive_hack_something 198 | recursive_hack_something = function(prototype, key, value) 199 | for k, v in pairs (prototype) do 200 | if type(v) == "table" then 201 | recursive_hack_something(v, key, value) 202 | end 203 | end 204 | prototype[key] = value 205 | end 206 | util.recursive_hack_something = recursive_hack_something 207 | 208 | local recursive_hack_blend_mode 209 | recursive_hack_blend_mode = function(prototype, value) 210 | for k, v in pairs (prototype) do 211 | if type(v) == "table" then 212 | if util.is_sprite_def(v) then 213 | v.blend_mode = value 214 | end 215 | recursive_hack_blend_mode(v, value) 216 | end 217 | end 218 | end 219 | 220 | util.copy = util.table.deepcopy 221 | 222 | util.prototype = require("data/tf_util/prototype_util") 223 | 224 | util.flying_unit_collision_mask = function() 225 | return {"not-colliding-with-itself", "layer-15"} 226 | end 227 | 228 | util.ground_unit_collision_mask = function() 229 | return {"not-colliding-with-itself", "player-layer", "train-layer"} 230 | end 231 | 232 | util.projectile_collision_mask = function() 233 | return {"layer-15", "player-layer", "train-layer"} 234 | end 235 | 236 | util.unit_flags = function() 237 | return {"player-creation", "placeable-off-grid"} 238 | end 239 | 240 | util.shift_box = function(box, shift) 241 | local left_top = box[1] 242 | local right_bottom = box[2] 243 | left_top[1] = left_top[1] + shift[1] 244 | left_top[2] = left_top[2] + shift[2] 245 | right_bottom[1] = right_bottom[1] + shift[1] 246 | right_bottom[2] = right_bottom[2] + shift[2] 247 | return box 248 | end 249 | 250 | 251 | util.shift_layer = function(layer, shift) 252 | layer.shift = layer.shift or {0,0} 253 | layer.shift[1] = layer.shift[1] + shift[1] 254 | layer.shift[2] = layer.shift[2] + shift[2] 255 | return layer 256 | end 257 | 258 | return util 259 | -------------------------------------------------------------------------------- /data/units/blaster_bot/blaster_bot.lua: -------------------------------------------------------------------------------- 1 | local path = util.path("data/units/smg_guy") 2 | local name = names.units.blaster_bot 3 | 4 | 5 | local base = util.copy(data.raw["combat-robot"]["defender"]) 6 | util.recursive_hack_make_hr(base) 7 | util.recursive_hack_scale(base, 1.5) 8 | table.insert(base.idle.layers, base.shadow_idle) 9 | table.insert(base.in_motion.layers, base.shadow_in_motion) 10 | 11 | local sprite_shift = {0, 0} 12 | for k, layer in pairs (base.idle.layers) do 13 | util.shift_layer(layer, sprite_shift) 14 | end 15 | for k, layer in pairs (base.in_motion.layers) do 16 | util.shift_layer(layer, sprite_shift) 17 | end 18 | 19 | local shadow_shift = {2, 4} 20 | util.shift_layer(base.shadow_in_motion, shadow_shift) 21 | base.shadow_in_motion.scale = (base.shadow_in_motion.scale or 1) * 0.8 22 | util.shift_layer(base.shadow_idle, shadow_shift) 23 | base.shadow_idle.scale = (base.shadow_idle.scale or 1) * 0.8 24 | 25 | local attack_range = 14 26 | local bot = 27 | { 28 | type = "unit", 29 | name = name, 30 | localised_name = {name}, 31 | icon = base.icon, 32 | icon_size = base.icon_size, 33 | flags = util.unit_flags(), 34 | map_color = {b = 0.5, g = 1}, 35 | enemy_map_color = {r = 1}, 36 | max_health = 85, 37 | radar_range = 1, 38 | order="c-a", 39 | subgroup = "circuit-units", 40 | resistances = nil, 41 | healing_per_tick = 0, 42 | collision_box = {{-0.5, -0.5}, {0.5, 0.5}}, 43 | collision_mask = util.flying_unit_collision_mask(), 44 | render_layer = "air-object", 45 | max_pursue_distance = 64, 46 | min_persue_time = 60 * 15, 47 | selection_box = {{-0.5, -0.5}, {0.5, 0.5}}, 48 | sticker_box = {{-0.3, -0.3}, {0.3, 0.3}}, 49 | distraction_cooldown = 15, 50 | move_while_shooting = true, 51 | can_open_gates = false, 52 | ai_settings = 53 | { 54 | do_separation = true 55 | }, 56 | minable = {result = name, mining_time = 2}, 57 | attack_parameters = 58 | { 59 | type = "projectile", 60 | ammo_category = "bullet", 61 | cooldown = 45, 62 | cooldown_deviation = 0.5, 63 | range = attack_range, 64 | min_attack_distance = attack_range - 2, 65 | projectile_creation_distance = 1, 66 | --lead_target_for_projectile_speed = 0.8, 67 | projectile_center = {0, 1.2}, 68 | sound = 69 | { 70 | { 71 | filename = "__base__/sound/fight/laser-1.ogg", 72 | volume = 0.5 73 | }, 74 | { 75 | filename = "__base__/sound/fight/laser-2.ogg", 76 | volume = 0.5 77 | }, 78 | { 79 | filename = "__base__/sound/fight/laser-3.ogg", 80 | volume = 0.5 81 | } 82 | }, 83 | ammo_type = 84 | { 85 | category = util.ammo_category("circuit-units"), 86 | target_type = "direction", 87 | action = 88 | { 89 | type = "direct", 90 | action_delivery = 91 | { 92 | { 93 | type = "projectile", 94 | projectile = name.." Projectile", 95 | starting_speed = 0.4, 96 | --direction_deviation = 0.05, 97 | --range_deviation = 0.05, 98 | max_range = attack_range + 4 99 | } 100 | } 101 | } 102 | }, 103 | animation = base.idle 104 | }, 105 | vision_distance = 40, 106 | has_belt_immunity = true, 107 | movement_speed = 0.15, 108 | distance_per_frame = 0.15, 109 | pollution_to_join_attack = 1000, 110 | --corpse = name.." Corpse", 111 | dying_explosion = "explosion", 112 | working_sound = { 113 | sound = 114 | { 115 | { filename = "__base__/sound/flying-robot-1.ogg", volume = 0 } 116 | }, 117 | max_sounds_per_type = 3, 118 | probability = (1 / (3 * 60)) -- average pause between the sound is 3 seconds 119 | }, 120 | run_animation = base.in_motion 121 | } 122 | 123 | local projectile = util.copy(data.raw.projectile["laser"]) 124 | projectile.name = name.." Projectile" 125 | projectile.collision_box = nil 126 | projectile.direction_only = false 127 | projectile.acceleration = 0 128 | projectile.action = 129 | { 130 | type = "direct", 131 | action_delivery = 132 | { 133 | type = "instant", 134 | target_effects = 135 | { 136 | { 137 | type = "damage", 138 | damage = {amount = 8 , type = util.damage_type("laser")} 139 | } 140 | } 141 | } 142 | } 143 | projectile.animation = util.empty_sprite() 144 | projectile.final_action = nil 145 | projectile.smoke = 146 | { 147 | { 148 | name = name.." smoke", 149 | frequency = 2, 150 | position = {0, 0}, 151 | slow_down_factor = 1 152 | }, 153 | { 154 | name = name.." smoke", 155 | frequency = 2, 156 | position = {0, 0.05}, 157 | slow_down_factor = 1 158 | }, 159 | { 160 | name = name.." smoke", 161 | frequency = 2, 162 | position = {0, 0.15}, 163 | slow_down_factor = 1 164 | }, 165 | { 166 | name = name.." smoke", 167 | frequency = 2, 168 | position = {0, 0.25}, 169 | slow_down_factor = 1 170 | }, 171 | { 172 | name = name.." smoke", 173 | frequency = 2, 174 | position = {0, 0.35}, 175 | slow_down_factor = 1 176 | } 177 | } 178 | 179 | local blaster_smoke = { 180 | type = "trivial-smoke", 181 | name = name.." smoke", 182 | flags = {"not-on-map"}, 183 | animation = 184 | { 185 | filename = "__base__/graphics/entity/flamethrower-fire-stream/flamethrower-explosion.png", 186 | priority = "extra-high", 187 | width = 64, 188 | height = 64, 189 | frame_count = 32, 190 | line_length = 8, 191 | scale = 0.1, 192 | animation_speed = 32 / 100, 193 | blend_mode = "additive", 194 | tint = {b = 1, g = 1} 195 | }, 196 | movement_slow_down_factor = 0.95, 197 | duration = 12, 198 | fade_away_duration = 12, 199 | affected_by_wind = false, 200 | show_when_smoke_off = true 201 | } 202 | 203 | 204 | local item = { 205 | type = "item", 206 | name = name, 207 | localised_name = {name}, 208 | icon = bot.icon, 209 | icon_size = bot.icon_size, 210 | flags = {}, 211 | subgroup = "circuit-units", 212 | order = "b-"..name, 213 | stack_size = 10, 214 | place_result = name 215 | } 216 | 217 | local recipe = { 218 | type = "recipe", 219 | name = name, 220 | localised_name = {name}, 221 | category = names.deployers.circuit_unit, 222 | enabled = false, 223 | ingredients = 224 | { 225 | {"electronic-circuit", 8}, 226 | {"copper-cable", 15}, 227 | {"copper-plate", 5} 228 | }, 229 | energy_required = 20, 230 | result = name 231 | } 232 | 233 | data:extend 234 | { 235 | bot, 236 | projectile, 237 | blaster_smoke, 238 | item, 239 | recipe 240 | } -------------------------------------------------------------------------------- /data/units/laser_bot/laser_bot.lua: -------------------------------------------------------------------------------- 1 | local path = util.path("data/units/smg_guy") 2 | local name = names.units.laser_bot 3 | 4 | local base = util.copy(data.raw["combat-robot"]["destroyer"]) 5 | util.recursive_hack_make_hr(base) 6 | util.recursive_hack_scale(base, 2) 7 | table.insert(base.idle.layers, base.shadow_idle) 8 | table.insert(base.in_motion.layers, base.shadow_in_motion) 9 | 10 | local sprite_shift = {0, 0} 11 | for k, layer in pairs (base.idle.layers) do 12 | util.shift_layer(layer, sprite_shift) 13 | end 14 | for k, layer in pairs (base.in_motion.layers) do 15 | util.shift_layer(layer, sprite_shift) 16 | end 17 | local shadow_shift = {2, 3} 18 | util.shift_layer(base.shadow_in_motion, shadow_shift) 19 | base.shadow_in_motion.scale = (base.shadow_in_motion.scale or 1) * 0.8 20 | util.shift_layer(base.shadow_idle, shadow_shift) 21 | base.shadow_idle.scale = (base.shadow_idle.scale or 1) * 0.8 22 | 23 | local attack_range = 18 24 | local bot = 25 | { 26 | type = "unit", 27 | name = name, 28 | localised_name = {name}, 29 | icon = base.icon, 30 | icon_size = base.icon_size, 31 | flags = util.unit_flags(), 32 | map_color = {b = 0.5, g = 1}, 33 | enemy_map_color = {r = 1}, 34 | max_health = 160, 35 | radar_range = 2, 36 | order= "c-c", 37 | subgroup = "circuit-units", 38 | resistances = nil, 39 | healing_per_tick = 0, 40 | collision_mask = util.flying_unit_collision_mask(), 41 | render_layer = "air-object", 42 | max_pursue_distance = 64, 43 | min_persue_time = (60 * 15), 44 | selection_box = {{-0.8, -0.8}, {0.8, 0.8}}, 45 | collision_box = {{-0.8, -0.8}, {0.8, 0.8}}, 46 | sticker_box = {{-0.8, -0.8}, {0.8, 0.8}}, 47 | distraction_cooldown = (15), 48 | move_while_shooting = true, 49 | can_open_gates = false, 50 | ai_settings = 51 | { 52 | do_separation = true 53 | }, 54 | minable = {result = name, mining_time = 2}, 55 | 56 | attack_parameters = 57 | { 58 | type = "beam", 59 | cooldown = (100), 60 | cooldown_deviation = 0.15, 61 | range = attack_range, 62 | min_attack_distance = attack_range - 3, 63 | --projectile_center = {-0.09375, -0.2}, 64 | projectile_creation_distance = 1.4, 65 | source_direction_count = 8, 66 | --source_offset = {0, -0.1}, 67 | ammo_type = 68 | { 69 | category = util.ammo_category("circuit-units"), 70 | energy_consumption = "800kJ", 71 | action = 72 | { 73 | type = "direct", 74 | action_delivery = 75 | { 76 | type = "beam", 77 | beam = name.." Beam", 78 | max_length = attack_range + 3, 79 | duration = (40), 80 | --source_offset = {0.15, -0.5}, 81 | } 82 | } 83 | }, 84 | animation = base.idle 85 | }, 86 | vision_distance = 40, 87 | has_belt_immunity = true, 88 | movement_speed = 0.15, 89 | distance_per_frame = 0.15, 90 | pollution_to_join_attack = 1000, 91 | destroy_when_commands_fail = false, 92 | --corpse = name.." Corpse", 93 | dying_explosion = "explosion", 94 | working_sound = { 95 | sound = 96 | { 97 | { filename = "__base__/sound/flying-robot-1.ogg", volume = 0 } 98 | }, 99 | max_sounds_per_type = 3, 100 | probability = (1 / (3 * 60)) -- average pause between the sound is 3 seconds 101 | }, 102 | run_animation = base.in_motion 103 | } 104 | 105 | local beam = util.copy(data.raw.beam["laser-beam"]) 106 | beam.name = name.." Beam" 107 | beam.damage_interval = (20) 108 | beam.action = 109 | { 110 | type = "direct", 111 | action_delivery = 112 | { 113 | type = "instant", 114 | target_effects = 115 | { 116 | { 117 | type = "damage", 118 | damage = { amount = 12, type = util.damage_type("laser")} 119 | } 120 | } 121 | } 122 | } 123 | 124 | local item = { 125 | type = "item", 126 | name = name, 127 | localised_name = {name}, 128 | icon = bot.icon, 129 | icon_size = bot.icon_size, 130 | flags = {}, 131 | subgroup = "circuit-units", 132 | order = "d-"..name, 133 | stack_size = 10, 134 | place_result = name 135 | } 136 | 137 | local recipe = { 138 | type = "recipe", 139 | name = name, 140 | localised_name = {name}, 141 | category = names.deployers.circuit_unit, 142 | enabled = false, 143 | ingredients = 144 | { 145 | {"advanced-circuit", 8}, 146 | {"copper-plate", 20}, 147 | {"copper-cable", 20} 148 | }, 149 | energy_required = 35, 150 | result = name 151 | } 152 | 153 | data:extend{bot, beam, item, recipe} -------------------------------------------------------------------------------- /data/units/plasma_bot/plasma_bot.lua: -------------------------------------------------------------------------------- 1 | local path = util.path("data/units/plasma_bot/") 2 | local name = names.units.plasma_bot 3 | 4 | local base = util.copy(data.raw["logistic-robot"]["logistic-robot"]) 5 | --for k, layer in pairs (base.animations[1].idle_with_gun.layers) do 6 | -- layer.frame_count = 1 7 | --end 8 | --table.insert(base.idle.layers, base.shadow_idle) 9 | --table.insert(base.in_motion.layers, base.shadow_in_motion)} 10 | util.recursive_hack_make_hr(base) 11 | util.recursive_hack_scale(base, 3) 12 | local idle_mask = util.copy(base.idle_with_cargo) 13 | idle_mask.apply_runtime_tint = true 14 | local in_motion_mask = util.copy(base.in_motion) 15 | in_motion_mask.apply_runtime_tint = true 16 | 17 | local shadow_shift = {2, 4} 18 | util.shift_layer(base.shadow_idle_with_cargo, shadow_shift) 19 | base.shadow_idle_with_cargo.scale = (base.shadow_idle_with_cargo.scale or 1) * 0.8 20 | util.shift_layer(base.shadow_in_motion, shadow_shift) 21 | base.shadow_in_motion.scale = (base.shadow_in_motion.scale or 1) * 0.8 22 | 23 | local attack_range = 32 24 | local bot = 25 | { 26 | type = "unit", 27 | name = name, 28 | localised_name = {name}, 29 | icon = base.icon, 30 | icon_size = base.icon_size, 31 | flags = util.unit_flags(), 32 | map_color = {b = 0.5, g = 1}, 33 | enemy_map_color = {r = 1}, 34 | max_health = 320, 35 | radar_range = 3, 36 | order="c-d", 37 | subgroup = "circuit-units", 38 | resistances = nil, 39 | healing_per_tick = 0, 40 | collision_mask = util.flying_unit_collision_mask(), 41 | render_layer = "air-object", 42 | max_pursue_distance = 64, 43 | min_persue_time = 60 * 15, 44 | selection_box = {{-1.5, -1.5}, {1.5, 1.5}}, 45 | collision_box = {{-1.5, -1.5}, {1.5, 1.5}}, 46 | sticker_box = {{-1.5, -1.5}, {1.5, 1.5}}, 47 | distraction_cooldown = 15, 48 | move_while_shooting = true, 49 | can_open_gates = false, 50 | ai_settings = 51 | { 52 | do_separation = true 53 | }, 54 | attack_parameters = 55 | { 56 | type = "projectile", 57 | projectile_center = {0, 2}, 58 | cooldown = 150, 59 | cooldown_deviation = 0.2, 60 | --lead_target_for_projectile_speed = 0.5,--tricky... 61 | range = attack_range, 62 | min_attack_distance = attack_range - 4, 63 | projectile_creation_distance = 0.5, 64 | sound = 65 | { 66 | { 67 | filename = "__base__/sound/fight/laser-1.ogg", 68 | volume = 0.5 69 | }, 70 | { 71 | filename = "__base__/sound/fight/laser-2.ogg", 72 | volume = 0.5 73 | }, 74 | { 75 | filename = "__base__/sound/fight/laser-3.ogg", 76 | volume = 0.5 77 | } 78 | }, 79 | ammo_type = 80 | { 81 | category = util.ammo_category("circuit-units"), 82 | target_type = "entity", 83 | action = 84 | { 85 | type = "direct", 86 | action_delivery = 87 | { 88 | { 89 | type = "projectile", 90 | projectile = name.." Projectile", 91 | starting_speed = 0.5, 92 | direction_deviation = 0.05, 93 | range_deviation = 0.05, 94 | max_range = attack_range + 4 95 | } 96 | } 97 | } 98 | }, 99 | animation = {layers = {base.idle_with_cargo, base.shadow_idle_with_cargo, idle_mask}} 100 | }, 101 | vision_distance = 40, 102 | has_belt_immunity = true, 103 | movement_speed = 0.15, 104 | distance_per_frame = 0.15, 105 | pollution_to_join_attack = 1000, 106 | 107 | minable = {result = name, mining_time = 2}, 108 | --corpse = name.." Corpse", 109 | dying_explosion = "explosion", 110 | working_sound = { 111 | sound = 112 | { 113 | { filename = "__base__/sound/flying-robot-1.ogg", volume = 0 } 114 | }, 115 | max_sounds_per_type = 3, 116 | probability = (1 / (3 * 60)) -- average pause between the sound is 3 seconds 117 | }, 118 | run_animation = {layers = {base.in_motion, base.shadow_in_motion, in_motion_mask}} 119 | } 120 | 121 | local projectile = util.copy(data.raw.projectile["shotgun-pellet"]) 122 | projectile.name = name.." Projectile" 123 | projectile.force_condition = "not-same" 124 | projectile.collision_box = nil --{{-0.25, -0.25}, {0.25, 0.25}} 125 | projectile.direction_only = false 126 | projectile.height = 2 127 | projectile.max_speed = 0.75 128 | projectile.hit_at_collision_position = true 129 | projectile.hit_collision_mask = util.projectile_collision_mask() 130 | projectile.action = 131 | { 132 | { 133 | type = "direct", 134 | action_delivery = 135 | { 136 | type = "instant", 137 | target_effects = 138 | { 139 | { 140 | type = "create-particle", 141 | particle_name = name.." Small Projectile", 142 | initial_height = projectile.height, 143 | --speed_from_center = 1 144 | repeat_count = 100, 145 | --entity_name = "explosion-remnants-particle", 146 | --initial_height = 0.5, 147 | speed_from_center = 0.4, 148 | speed_from_center_deviation = 0.2, 149 | initial_vertical_speed = -0.2, 150 | initial_vertical_speed_deviation = 0.05, 151 | offset_deviation = {{-0.2, -0.2}, {0.2, 0.2}} 152 | }, 153 | { 154 | type = "create-trivial-smoke", 155 | smoke_name = name.." smoke", 156 | offset_deviation = {{-0.1, -0.1}, {0.1, 0.1}}, 157 | repeat_count = 4, 158 | offsets = 159 | { 160 | {0, -projectile.height} 161 | } 162 | } 163 | } 164 | } 165 | }, 166 | { 167 | type = "area", 168 | target_entities = true, 169 | trigger_from_target = false, 170 | repeat_count = 1, 171 | radius = 4, 172 | force = "not-same", 173 | ignore_collision_condition = true, 174 | action_delivery = 175 | { 176 | type = "instant", 177 | target_effects = 178 | { 179 | { 180 | type = "damage", 181 | damage = {amount = 20 , type = util.damage_type("electric")} 182 | } 183 | } 184 | } 185 | } 186 | } 187 | projectile.final_action = nil 188 | projectile.animation = util.empty_sprite() 189 | old = { 190 | filename = path.."plasma_bot_projectile.png", 191 | line_length = 5, 192 | frame_count = 33, 193 | width = 16, 194 | height = 18, 195 | animation_speed = 3, 196 | scale = 2, 197 | blend_mode = "additive-soft" 198 | 199 | } 200 | projectile.acceleration = 0 201 | 202 | 203 | 204 | projectile.smoke = 205 | { 206 | { 207 | name = name.." big smoke", 208 | deviation = {0.1, 0.1}, 209 | frequency = 2, 210 | position = {-0.05, 2/6}, 211 | slow_down_factor = 1, 212 | --starting_frame = 1, 213 | --starting_frame_deviation = 0, 214 | --starting_frame_speed = 0, 215 | --starting_frame_speed_deviation = 0 216 | }, 217 | { 218 | name = name.." big smoke", 219 | deviation = {0.2, 0.2}, 220 | frequency = 2, 221 | position = {-0.1, 3/6}, 222 | slow_down_factor = 1, 223 | --starting_frame = 1, 224 | --starting_frame_deviation = 0, 225 | --starting_frame_speed = 0, 226 | --starting_frame_speed_deviation = 0 227 | }, 228 | } 229 | 230 | local projectile_smoke = { 231 | type = "trivial-smoke", 232 | name = name.." big smoke", 233 | flags = {"not-on-map"}, 234 | animation = 235 | { 236 | filename = "__base__/graphics/entity/flamethrower-fire-stream/flamethrower-explosion.png", 237 | priority = "extra-high", 238 | width = 64, 239 | height = 64, 240 | frame_count = 32, 241 | line_length = 8, 242 | scale = 0.8, 243 | animation_speed = 32 / 100, 244 | blend_mode = "additive", 245 | tint = {g = 1, b = 1} 246 | }, 247 | movement_slow_down_factor = 0.95, 248 | duration = 16, 249 | fade_away_duration = 8, 250 | show_when_smoke_off = true 251 | } 252 | 253 | 254 | 255 | 256 | local small_projectile = util.copy(data.raw["optimized-particle"]["explosion-remnants-particle"]) 257 | small_projectile.name = name.." Small Projectile" 258 | --small_projectile.collision_box = {{-0.15, -0.15}, {0.15, 0.15}} 259 | small_projectile.collision_box = nil 260 | small_projectile.direction_only = true 261 | small_projectile.height = 0 262 | small_projectile.max_speed = 1 263 | small_projectile.acceleration = -0.02 264 | small_projectile.action = nil 265 | small_projectile.final_action = nil 266 | small_projectile.pictures = util.empty_sprite() 267 | small_projectile.shadows = util.empty_sprite() 268 | 269 | small_projectile.regular_trigger_effect = 270 | { 271 | { 272 | type = "create-trivial-smoke", 273 | smoke_name = name.." smoke", 274 | offset_deviation = {{-0.1, -0.1}, {0.1, 0.1}}, 275 | speed_from_center = 0.02 276 | }, 277 | { 278 | type = "create-trivial-smoke", 279 | smoke_name = name.." smoke", 280 | offset_deviation = {{-0.1, -0.1}, {0.1, 0.1}}, 281 | speed_from_center = 0.02 282 | }, 283 | { 284 | type = "create-trivial-smoke", 285 | smoke_name = name.." smoke", 286 | offset_deviation = {{-0.1, -0.1}, {0.1, 0.1}}, 287 | speed_from_center = 0.02 288 | }, 289 | { 290 | type = "create-trivial-smoke", 291 | smoke_name = name.." smoke", 292 | offset_deviation = {{-0.1, -0.1}, {0.1, 0.1}}, 293 | speed_from_center = 0.02 294 | } 295 | } 296 | small_projectile.regular_trigger_effect_frequency = 2 297 | small_projectile.ended_in_water_trigger_effect = nil 298 | small_projectile.movement_modifier_when_on_ground = 1 299 | --util.recursive_hack_scale(small_projectile, 0.3) 300 | 301 | 302 | 303 | small_projectile.smoke = 304 | { 305 | { 306 | name = name.." smoke", 307 | deviation = {0.1, 0.1}, 308 | frequency = 2, 309 | --position = {-0.05, 2/6}, 310 | position = {0,0}, 311 | slow_down_factor = 1, 312 | --starting_frame = 1, 313 | --starting_frame_deviation = 0, 314 | --starting_frame_speed = 0, 315 | --starting_frame_speed_deviation = 0 316 | }, 317 | { 318 | name = name.." smoke", 319 | deviation = {0.2, 0.2}, 320 | frequency = 2, 321 | --position = {-0.1, 3/6}, 322 | position = {0,0}, 323 | slow_down_factor = 1, 324 | --starting_frame = 1, 325 | --starting_frame_deviation = 0, 326 | --starting_frame_speed = 0, 327 | --starting_frame_speed_deviation = 0 328 | }, 329 | } 330 | 331 | local small_projectile_smoke = { 332 | type = "trivial-smoke", 333 | name = name.." smoke", 334 | flags = {"not-on-map"}, 335 | animation = 336 | { 337 | filename = "__base__/graphics/entity/flamethrower-fire-stream/flamethrower-explosion.png", 338 | priority = "extra-high", 339 | width = 64, 340 | height = 64, 341 | frame_count = 32, 342 | line_length = 8, 343 | scale = 0.1, 344 | animation_speed = 32 / 100, 345 | blend_mode = "additive", 346 | tint = {g = 1, b = 1} 347 | }, 348 | movement_slow_down_factor = 0, 349 | duration = 32, 350 | fade_away_duration = 12, 351 | affected_by_wind = false, 352 | show_when_smoke_off = true, 353 | start_scale = 1, 354 | end_scale = 0 355 | } 356 | 357 | local animation = util.copy(small_projectile.animation) 358 | local make_animation = function(scale) 359 | local data = util.copy(animation) 360 | data.scale = (data.scale or 1) * scale 361 | return data 362 | end 363 | local shadow = util.copy(small_projectile.shadow) 364 | local make_shadow = function(scale) 365 | local data = util.copy(animation) 366 | data.scale = (data.scale or 1) * scale 367 | return data 368 | end 369 | 370 | --small_projectile.animation = 371 | --{ 372 | -- make_animation(0.8), 373 | -- make_animation(0.85), 374 | -- make_animation(0.9), 375 | -- make_animation(0.95), 376 | -- make_animation(1.0), 377 | -- make_animation(1.05), 378 | -- make_animation(1.10), 379 | -- make_animation(1.15), 380 | -- make_animation(1.2) 381 | --} 382 | --small_projectile.shadow = 383 | --{ 384 | -- make_shadow(0.8), 385 | -- make_shadow(0.85), 386 | -- make_shadow(0.9), 387 | -- make_shadow(0.95), 388 | -- make_shadow(1.0), 389 | -- make_shadow(1.05), 390 | -- make_shadow(1.10), 391 | -- make_shadow(1.15), 392 | -- make_shadow(1.2) 393 | --} 394 | -- 395 | 396 | local splash = 397 | { 398 | type = "explosion", 399 | name = name.." Splash", 400 | height = 1, 401 | flags = {"not-on-map"}, 402 | animations = 403 | { 404 | { 405 | filename = path.."plasma_bot_splash.png", 406 | priority = "extra-high", 407 | width = 92, 408 | height = 66, 409 | frame_count = 10, 410 | line_length = 5, 411 | shift = {-0.437, 0.5}, 412 | animation_speed = (0.35), 413 | blend_mode = "additive-soft", 414 | run_mode = "backward", 415 | scale = 1.5 416 | } 417 | } 418 | } 419 | 420 | local animation = 421 | { 422 | filename = path.."plasma_bot_splash.png", 423 | priority = "extra-high", 424 | width = 92, 425 | height = 66, 426 | frame_count = 10, 427 | line_length = 5, 428 | shift = {-0.437, 0.5}, 429 | animation_speed = (0.25), 430 | blend_mode = "additive-soft", 431 | run_mode = "backward", 432 | scale = 1 433 | } 434 | local make_animation = function(scale, speed) 435 | local data = util.copy(animation) 436 | data.scale = (data.scale or 1) * scale 437 | data.animation_speed = (data.animation_speed or 1) * speed 438 | return data 439 | end 440 | 441 | local small_splash = 442 | { 443 | type = "explosion", 444 | name = name.." Small Splash", 445 | height = 1, 446 | flags = {"not-on-map"}, 447 | animations = 448 | { 449 | make_animation(1, 0.75), 450 | make_animation(0.9, 0.8), 451 | make_animation(0.8, 0.85), 452 | make_animation(0.7, 0.9), 453 | make_animation(0.6, 0.95), 454 | make_animation(0.5, 1), 455 | } 456 | } 457 | 458 | local item = { 459 | type = "item", 460 | name = name, 461 | localised_name = {name}, 462 | icon = bot.icon, 463 | icon_size = bot.icon_size, 464 | flags = {}, 465 | subgroup = "circuit-units", 466 | order = "e-"..name, 467 | stack_size = 10, 468 | place_result = name 469 | } 470 | 471 | local recipe = { 472 | type = "recipe", 473 | name = name, 474 | localised_name = {name}, 475 | category = names.deployers.circuit_unit, 476 | enabled = false, 477 | ingredients = 478 | { 479 | {"processing-unit", 2}, 480 | {"battery", 20}, 481 | {"copper-cable", 20}, 482 | {"copper-plate", 10} 483 | }, 484 | energy_required = 75, 485 | result = name 486 | } 487 | 488 | data:extend 489 | { 490 | bot, 491 | projectile, 492 | projectile_smoke, 493 | splash, 494 | item, 495 | recipe, 496 | small_projectile, 497 | small_splash, 498 | small_projectile_smoke 499 | } -------------------------------------------------------------------------------- /data/units/plasma_bot/plasma_bot_projectile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klonan/Total_Automization/aa61e009449416e1b2da1c9ae06eebcfc2367a30/data/units/plasma_bot/plasma_bot_projectile.png -------------------------------------------------------------------------------- /data/units/plasma_bot/plasma_bot_splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klonan/Total_Automization/aa61e009449416e1b2da1c9ae06eebcfc2367a30/data/units/plasma_bot/plasma_bot_splash.png -------------------------------------------------------------------------------- /data/units/rocket_guy/rocket_guy.lua: -------------------------------------------------------------------------------- 1 | local path = util.path("data/units/rocket_guy/") 2 | local name = names.units.rocket_guy 3 | 4 | local base = util.copy(data.raw.character.character) 5 | --for k, layer in pairs (base.animations[1].idle_with_gun.layers) do 6 | -- layer.frame_count = 1 7 | --end 8 | local attack_range = 18 9 | local bot = 10 | { 11 | type = "unit", 12 | name = name, 13 | localised_name = {name}, 14 | icon = path.."rocket_guy_icon.png", 15 | icon_size = 107, 16 | flags = util.unit_flags(), 17 | map_color = {b = 0.5, g = 1}, 18 | enemy_map_color = {r = 1}, 19 | max_health = 240, 20 | radar_range = 2, 21 | order="i-b", 22 | subgroup = "iron-units", 23 | resistances = nil, 24 | healing_per_tick = 0, 25 | collision_mask = util.ground_unit_collision_mask(), 26 | max_pursue_distance = 64, 27 | min_persue_time = (60 * 15), 28 | collision_box = {{-0.75, -0.75}, {0.75, 0.75}}, 29 | selection_box = {{-0.75, -0.75}, {0.75, 0.75}}, 30 | sticker_box = {{-0.3, -1.5}, {0.3, 0.2}}, 31 | distraction_cooldown = (15), 32 | move_while_shooting = false, 33 | can_open_gates = true, 34 | resistances = nil, 35 | old_resistances = 36 | { 37 | { 38 | type = "acid", 39 | decrease = 8, 40 | percent = 60 41 | } 42 | }, 43 | ai_settings = 44 | { 45 | do_separation = true 46 | }, 47 | minable = {result = name, mining_time = 2}, 48 | attack_parameters = 49 | { 50 | type = "projectile", 51 | ammo_category = util.ammo_category(name), 52 | warmup = 15, 53 | cooldown = (105), 54 | cooldown_deviation = 0.25, 55 | --lead_target_for_projectile_speed = 0.5, 56 | range = attack_range, 57 | min_attack_distance = attack_range - 3, 58 | projectile_creation_distance = 0.5, 59 | sound = { 60 | variations = { 61 | { 62 | filename = "__base__/sound/fight/rocket-launcher.ogg", 63 | volume = 1 64 | }, 65 | }, 66 | aggregation = 67 | { 68 | max_count = 2, 69 | remove = true, 70 | count_already_playing = true 71 | } 72 | }, 73 | ammo_type = 74 | { 75 | category = util.ammo_category("iron-units"), 76 | target_type = "entity", 77 | action = 78 | { 79 | type = "direct", 80 | action_delivery = 81 | { 82 | { 83 | type = "projectile", 84 | projectile = name.." Projectile", 85 | starting_speed = 1/3, 86 | --direction_deviation = 0.1, 87 | range_deviation = 0.1, 88 | max_range = attack_range + 3, 89 | }, 90 | { 91 | type = "instant", 92 | source_effects = 93 | { 94 | { 95 | type = "create-explosion", 96 | entity_name = "explosion-gunshot" 97 | } 98 | } 99 | } 100 | } 101 | } 102 | }, 103 | animation = base.animations[2].idle_with_gun 104 | }, 105 | vision_distance = 40, 106 | has_belt_immunity = false, 107 | affected_by_tiles = true, 108 | movement_speed = 0.15, 109 | distance_per_frame = 0.15, 110 | pollution_to_join_attack = 1000, 111 | destroy_when_commands_fail = false, 112 | --corpse = name.." Corpse", 113 | dying_explosion = "explosion", 114 | no_working_sound = { 115 | sound = 116 | { 117 | { filename = "__base__/sound/flying-robot-1.ogg", volume = 0 } 118 | }, 119 | max_sounds_per_type = 3, 120 | probability = (1 / (3 * 60)) -- average pause between the sound is 3 seconds 121 | }, 122 | run_animation = base.animations[2].running 123 | } 124 | 125 | util.recursive_hack_make_hr(bot) 126 | util.recursive_hack_scale(bot, 1.25) 127 | 128 | 129 | local projectile = util.copy(data.raw.projectile.rocket) 130 | projectile.name = name.." Projectile" 131 | projectile.acceleration = 0 132 | projectile.turning_speed_increases_exponentially_with_projectile_speed = false 133 | projectile.max_speed = 0.5 134 | projectile.collision_box = nil-- {{-0.1, -0.25}, {0.1, 0.25}} 135 | projectile.force_condition = "not-same" 136 | projectile.direction_only = false 137 | projectile.hit_at_collision_position = true 138 | projectile.hit_collision_mask = nil --util.projectile_collision_mask() 139 | projectile.action = 140 | { 141 | type = "direct", 142 | action_delivery = 143 | { 144 | type = "instant", 145 | target_effects = 146 | { 147 | { 148 | type = "nested-result", 149 | action = 150 | { 151 | { 152 | type = "area", 153 | target_entities = false, 154 | trigger_from_target = true, 155 | repeat_count = math.pi * 2 * 3, 156 | radius = 2, 157 | action_delivery = 158 | { 159 | type = "instant", 160 | target_effects = 161 | { 162 | { 163 | type = "create-entity", 164 | entity_name = name.." Explosion" 165 | } 166 | } 167 | } 168 | }, 169 | { 170 | type = "area", 171 | radius = 2, 172 | force = "not-same", 173 | ignore_collision_condition = true, 174 | action_delivery = 175 | { 176 | type = "instant", 177 | target_effects = 178 | { 179 | { 180 | type = "damage", 181 | damage = {amount = 8, type = util.damage_type("explosion")} 182 | } 183 | } 184 | } 185 | }, 186 | { 187 | type = "direct", 188 | action_delivery = 189 | { 190 | { 191 | type = "instant", 192 | target_effects = 193 | { 194 | { 195 | type = "damage", 196 | damage = {amount = 20 , type = util.damage_type("explosion")} 197 | }, 198 | { 199 | type = "create-entity", 200 | offset_deviation = {{-0.5, -0.5},{0.5, 0.5}}, 201 | offsets = {{0,0}}, 202 | entity_name = "explosion-hit" 203 | } 204 | } 205 | } 206 | } 207 | } 208 | } 209 | } 210 | } 211 | } 212 | } 213 | projectile.animation = 214 | { 215 | filename = util.path("data/units/rocket_guy/rocket_guy_rocket.png"), 216 | frame_count = 13, 217 | line_length = 1, 218 | width = 32, 219 | height = 62, 220 | shift = {0, 0}, 221 | priority = "high", 222 | scale = 0.4 223 | } 224 | projectile.shadow = 225 | { 226 | filename = util.path("data/units/rocket_guy/rocket_guy_rocket.png"), 227 | frame_count = 13, 228 | line_length = 1, 229 | width = 32, 230 | height = 62, 231 | shift = {0, 0}, 232 | priority = "high", 233 | scale = 0.4, 234 | draw_as_shadow = true 235 | } 236 | 237 | projectile.smoke = 238 | { 239 | { 240 | name = "rocket-guy-smoke", 241 | deviation = {0.1, 0.1}, 242 | frequency = 2, 243 | position = {-0.05, 2/6}, 244 | slow_down_factor = 1, 245 | --starting_frame = 1, 246 | --starting_frame_deviation = 0, 247 | --starting_frame_speed = 0, 248 | --starting_frame_speed_deviation = 0 249 | }, 250 | { 251 | name = "rocket-guy-smoke", 252 | deviation = {0.2, 0.2}, 253 | frequency = 2, 254 | position = {-0.1, 3/6}, 255 | slow_down_factor = 1, 256 | --starting_frame = 1, 257 | --starting_frame_deviation = 0, 258 | --starting_frame_speed = 0, 259 | --starting_frame_speed_deviation = 0 260 | }, 261 | { 262 | name = "smoke-fast", 263 | deviation = {0.1, 0.1}, 264 | frequency = 1, 265 | position = {-0.05, 4/6}, 266 | slow_down_factor = 1, 267 | --starting_frame = 1, 268 | --starting_frame_deviation = 0, 269 | --starting_frame_speed = 0, 270 | --starting_frame_speed_deviation = 0 271 | }, 272 | } 273 | 274 | local rocket_smoke = { 275 | type = "trivial-smoke", 276 | name = "rocket-guy-smoke", 277 | flags = {"not-on-map"}, 278 | animation = 279 | { 280 | filename = "__base__/graphics/entity/flamethrower-fire-stream/flamethrower-explosion.png", 281 | priority = "extra-high", 282 | width = 64, 283 | height = 64, 284 | frame_count = 32, 285 | line_length = 8, 286 | scale = 0.25, 287 | animation_speed = 32 / 100, 288 | blend_mode = "additive" 289 | }, 290 | movement_slow_down_factor = 0.95, 291 | duration = 8, 292 | fade_away_duration = 3, 293 | show_when_smoke_off = true 294 | } 295 | 296 | local explosion = util.copy(data.raw.explosion.explosion) 297 | explosion.name = name.." Explosion" 298 | 299 | local sprites = explosion.animations 300 | local new_animations = {} 301 | local add_sprites = function(scale, speed) 302 | for k, sprite in pairs (sprites) do 303 | local new = util.copy(sprite) 304 | new.animation_speed = (new.animation_speed or 1) * speed 305 | new.scale = (new.scale or 1) * scale 306 | new.blend_mode = "additive" 307 | table.insert(new_animations, new) 308 | end 309 | end 310 | 311 | add_sprites(1, 0.5) 312 | add_sprites(0.95, 0.6) 313 | add_sprites(0.9, 0.7) 314 | add_sprites(0.85, 0.8) 315 | add_sprites(0.8, 0.9) 316 | add_sprites(0.75, 1) 317 | add_sprites(0.6, 1.1) 318 | add_sprites(0.5, 1.2) 319 | 320 | explosion.animations = new_animations 321 | util.recursive_hack_make_hr(new_animations) 322 | explosion.light = nil 323 | explosion.smoke = nil 324 | explosion.smoke_count = 0 325 | 326 | local item = { 327 | type = "item", 328 | name = name, 329 | localised_name = {name}, 330 | icon = bot.icon, 331 | icon_size = bot.icon_size, 332 | flags = {}, 333 | subgroup = "iron-units", 334 | order = "d-"..name, 335 | stack_size = 10, 336 | place_result = name 337 | } 338 | 339 | local recipe = { 340 | type = "recipe", 341 | name = name, 342 | localised_name = {name}, 343 | category = names.deployers.iron_unit, 344 | enabled = false, 345 | ingredients = 346 | { 347 | {"steel-plate", 15}, 348 | {"iron-gear-wheel", 10}, 349 | {"explosives", 15} 350 | }, 351 | energy_required = 25, 352 | result = name 353 | } 354 | 355 | data:extend 356 | { 357 | bot, 358 | projectile, 359 | item, 360 | recipe, 361 | explosion, 362 | rocket_smoke 363 | } -------------------------------------------------------------------------------- /data/units/rocket_guy/rocket_guy_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klonan/Total_Automization/aa61e009449416e1b2da1c9ae06eebcfc2367a30/data/units/rocket_guy/rocket_guy_icon.png -------------------------------------------------------------------------------- /data/units/rocket_guy/rocket_guy_rocket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klonan/Total_Automization/aa61e009449416e1b2da1c9ae06eebcfc2367a30/data/units/rocket_guy/rocket_guy_rocket.png -------------------------------------------------------------------------------- /data/units/scout_car/scout_car.lua: -------------------------------------------------------------------------------- 1 | local name = names.units.scout_car 2 | 3 | local sprite_base = util.copy(data.raw.car.car) 4 | local turret_base = util.copy(data.raw.car.tank.turret_animation) 5 | 6 | util.recursive_hack_make_hr(sprite_base) 7 | 8 | for k, layer in pairs (sprite_base.animation.layers) do 9 | layer.frame_count = 1 10 | layer.max_advance = nil 11 | layer.line_length = nil 12 | if layer.stripes then 13 | for k, strip in pairs (layer.stripes) do 14 | strip.width_in_frames = 1 15 | end 16 | if layer.apply_runtime_tint or layer.draw_as_shadow then 17 | local new_stripes = {} 18 | for k, stripe in pairs (layer.stripes) do 19 | if k % 2 ~= 0 then 20 | table.insert(new_stripes, stripe) 21 | end 22 | end 23 | layer.stripes = new_stripes 24 | --error(serpent.block(layer)) 25 | end 26 | end 27 | end 28 | 29 | util.recursive_hack_make_hr(turret_base) 30 | util.recursive_hack_scale(turret_base, 0.66) 31 | 32 | local turret_shift = {0.18, 0} 33 | 34 | for k, layer in pairs (turret_base.layers) do 35 | layer.shift = layer.shift or {0,0} 36 | layer.shift[1] = layer.shift[1] + turret_shift[1] 37 | layer.shift[2] = layer.shift[2] + turret_shift[2] 38 | table.insert(sprite_base.animation.layers, layer) 39 | end 40 | local path = util.path("data/units/scout_car/") 41 | 42 | local attack_range = 21 43 | local unit = 44 | { 45 | type = "unit", 46 | name = name, 47 | localised_name = {name}, 48 | icon = sprite_base.icon, 49 | icon_size = sprite_base.icon_size, 50 | flags = util.unit_flags(), 51 | map_color = {b = 0.5, g = 1}, 52 | enemy_map_color = {r = 1}, 53 | max_health = 315, 54 | radar_range = 2, 55 | order="i-c", 56 | subgroup = "iron-units", 57 | resistances = nil, 58 | healing_per_tick = 0, 59 | collision_box = {{-1.2, -1.2}, {1.2, 1.2}}, 60 | selection_box = {{-1.2, -1.2}, {1.2, 1.2}}, 61 | collision_mask = util.ground_unit_collision_mask(), 62 | max_pursue_distance = 64, 63 | min_persue_time = (60 * 15), 64 | --sticker_box = {{-0.2, -0.2}, {0.2, 0.2}}, 65 | distraction_cooldown = (30), 66 | move_while_shooting = false, 67 | can_open_gates = true, 68 | resistances = nil, 69 | old_resistances = 70 | { 71 | { 72 | type = "acid", 73 | decrease = 8, 74 | percent = 60 75 | } 76 | }, 77 | ai_settings = 78 | { 79 | do_separation = true 80 | }, 81 | minable = {result = name, mining_time = 2}, 82 | attack_parameters = 83 | { 84 | type = "projectile", 85 | ammo_category = "bullet", 86 | warmup = 10, 87 | cooldown = 100, 88 | cooldown_deviation = 0.1, 89 | range = attack_range, 90 | lead_target_for_projectile_speed = 1, 91 | min_attack_distance = attack_range - 3, 92 | projectile_creation_distance = 1.5, 93 | sound = 94 | { 95 | variations = 96 | { 97 | { 98 | filename = "__base__/sound/fight/heavy-gunshot-1.ogg", 99 | volume = 0.45 100 | }, 101 | { 102 | filename = "__base__/sound/fight/heavy-gunshot-2.ogg", 103 | volume = 0.45 104 | }, 105 | { 106 | filename = "__base__/sound/fight/heavy-gunshot-3.ogg", 107 | volume = 0.45 108 | }, 109 | { 110 | filename = "__base__/sound/fight/heavy-gunshot-4.ogg", 111 | volume = 0.45 112 | } 113 | }, 114 | aggregation = 115 | { 116 | max_count = 2, 117 | remove = true, 118 | count_already_playing = true 119 | } 120 | }, 121 | ammo_type = 122 | { 123 | category = util.ammo_category("iron-units"), 124 | target_type = "direction", 125 | action = 126 | { 127 | { 128 | type = "direct", 129 | repeat_count = 1, 130 | action_delivery = 131 | { 132 | { 133 | type = "projectile", 134 | projectile = name.." Projectile", 135 | starting_speed = 0.6, 136 | starting_speed_deviation = 0.05, 137 | direction_deviation = 0.1, 138 | --range_deviation = 0.05, 139 | --starting_frame_deviation = 5, 140 | max_range = attack_range + 3 141 | }, 142 | { 143 | type = "instant", 144 | source_effects = 145 | { 146 | { 147 | type = "create-explosion", 148 | entity_name = "explosion-gunshot" 149 | } 150 | } 151 | } 152 | } 153 | } 154 | } 155 | }, 156 | animation = sprite_base.animation 157 | }, 158 | vision_distance = 40, 159 | has_belt_immunity = true, 160 | movement_speed = 0.35, 161 | distance_per_frame = 0.15, 162 | pollution_to_join_attack = 1000, 163 | destroy_when_commands_fail = false, 164 | --corpse = name.." Corpse", 165 | dying_explosion = "explosion", 166 | vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 }, 167 | working_sound = 168 | { 169 | sound = 170 | { 171 | filename = "__base__/sound/car-engine.ogg", 172 | volume = 0.6 173 | } 174 | }, 175 | run_animation = sprite_base.animation 176 | } 177 | 178 | local projectile = util.copy(data.raw.projectile["shotgun-pellet"]) 179 | projectile.name = name.." Projectile" 180 | projectile.collision_box = {{-0.2, -0.2},{0.2, 0.2}} 181 | projectile.force_condition = "not-same" 182 | projectile.height = 1 183 | projectile.hit_at_collision_position = true 184 | projectile.hit_collision_mask = util.projectile_collision_mask() 185 | projectile.action = 186 | { 187 | type = "direct", 188 | action_delivery = 189 | { 190 | type = "instant", 191 | target_effects = 192 | { 193 | { 194 | type = "create-entity", 195 | entity_name = name.." Explosion" 196 | }, 197 | { 198 | type = "damage", 199 | damage = {amount = 10 , type = util.damage_type("physical")} 200 | } 201 | } 202 | } 203 | } 204 | projectile.animation.height = 1 205 | projectile.animation.width = 1 206 | projectile.acceleration = 0 207 | projectile.final_action = nil 208 | projectile.animation.blend_mode = "additive" 209 | util.recursive_hack_scale(projectile, 1.5) 210 | 211 | 212 | local make_smoke_source = function(position) 213 | return 214 | { 215 | name = name.."-smoke", 216 | deviation = {0.1, 0.1}, 217 | frequency = 1, 218 | position = position, 219 | slow_down_factor = 1, 220 | --starting_frame = 1, 221 | --starting_frame_deviation = 0, 222 | --starting_frame_speed = 0, 223 | --starting_frame_speed_deviation = 0 224 | } 225 | end 226 | projectile.smoke = {} 227 | 228 | for k = 0.1, 0.6, 0.1 do 229 | table.insert( projectile.smoke, 230 | { 231 | name = name.."-smoke", 232 | deviation = {0.05, 0.05}, 233 | frequency = 2, 234 | position = {-0.2, -k}, 235 | slow_down_factor = 1, 236 | --starting_frame = 1, 237 | --starting_frame_deviation = 0, 238 | --starting_frame_speed = 0, 239 | --starting_frame_speed_deviation = 0 240 | }) 241 | table.insert( projectile.smoke, 242 | { 243 | name = name.."-smoke", 244 | deviation = {0.05, 0.05}, 245 | frequency = 2, 246 | position = {0.2, -k}, 247 | slow_down_factor = 1, 248 | --starting_frame = 1, 249 | --starting_frame_deviation = 0, 250 | --starting_frame_speed = 0, 251 | --starting_frame_speed_deviation = 0 252 | }) 253 | end 254 | 255 | 256 | fast ={ 257 | name = "smoke-fast", 258 | deviation = {0.05, 0.05}, 259 | frequency = 2, 260 | position = {-0.05, 4/6}, 261 | slow_down_factor = 1, 262 | --starting_frame = 1, 263 | --starting_frame_deviation = 0, 264 | --starting_frame_speed = 0, 265 | --starting_frame_speed_deviation = 0 266 | } 267 | local smoke = { 268 | type = "trivial-smoke", 269 | name = name.."-smoke", 270 | flags = {"not-on-map"}, 271 | animation = 272 | { 273 | filename = "__base__/graphics/entity/flamethrower-fire-stream/flamethrower-explosion.png", 274 | priority = "extra-high", 275 | width = 64, 276 | height = 64, 277 | frame_count = 8, 278 | line_length = 8, 279 | scale = 0.15, 280 | animation_speed = 1, 281 | blend_mode = "additive" 282 | }, 283 | movement_slow_down_factor = 0.95, 284 | duration = 8, 285 | fade_away_duration = 8, 286 | show_when_smoke_off = true 287 | } 288 | 289 | local explosion = util.copy(data.raw.explosion.explosion) 290 | util.recursive_hack_scale(explosion, 0.5) 291 | explosion.name = name.." Explosion" 292 | 293 | 294 | local item = { 295 | type = "item", 296 | name = name, 297 | localised_name = {name}, 298 | icon = unit.icon, 299 | icon_size = unit.icon_size, 300 | flags = {}, 301 | subgroup = "iron-units", 302 | order = "c-"..name, 303 | stack_size = 10, 304 | place_result = name 305 | } 306 | 307 | local recipe = { 308 | type = "recipe", 309 | name = name, 310 | localised_name = {name}, 311 | category = names.deployers.iron_unit, 312 | enabled = false, 313 | ingredients = 314 | { 315 | {"engine-unit", 8}, 316 | {"iron-gear-wheel", 5}, 317 | {"solid-fuel", 15} 318 | }, 319 | energy_required = 20, 320 | result = name 321 | } 322 | 323 | 324 | data:extend{unit, projectile, item, recipe, explosion, smoke} 325 | -------------------------------------------------------------------------------- /data/units/shell_tank/shell_tank.lua: -------------------------------------------------------------------------------- 1 | local name = names.units.shell_tank 2 | 3 | local sprite_base = util.copy(data.raw.car.tank) 4 | local path = util.path("data/units/shell_tank/") 5 | util.recursive_hack_make_hr(sprite_base) 6 | util.recursive_hack_scale(sprite_base, 1.5) 7 | for k, layer in pairs (sprite_base.animation.layers) do 8 | layer.frame_count = 1 9 | layer.max_advance = nil 10 | layer.line_length = nil 11 | if layer.stripes then 12 | for k, strip in pairs (layer.stripes) do 13 | strip.width_in_frames = 1 14 | end 15 | if layer.apply_runtime_tint or layer.draw_as_shadow then 16 | local new_stripes = {} 17 | for k, stripe in pairs (layer.stripes) do 18 | if k % 2 ~= 0 then 19 | table.insert(new_stripes, stripe) 20 | end 21 | end 22 | layer.stripes = new_stripes 23 | --error(serpent.block(layer)) 24 | end 25 | end 26 | end 27 | local cannon_pictures = util.copy(data.raw["artillery-turret"]["artillery-turret"]) 28 | util.recursive_hack_make_hr(cannon_pictures) 29 | 30 | for k, layer in pairs (cannon_pictures.cannon_base_pictures.layers) do 31 | local stripes = {} 32 | for k, path in pairs (layer.filenames) do 33 | table.insert(stripes, { 34 | filename = path, 35 | height_in_frames = 4, 36 | width_in_frames = 1 37 | }) 38 | end 39 | layer.stripes = stripes 40 | layer.filenames = nil 41 | layer.frame_count = 1 42 | if layer.draw_as_shadow then 43 | else 44 | layer.shift = {layer.shift.x or 0, (layer.shift.y or 0) - 2.5} 45 | end 46 | end 47 | 48 | 49 | for k, layer in pairs (cannon_pictures.cannon_barrel_pictures.layers) do 50 | local stripes = {} 51 | for k, path in pairs (layer.filenames) do 52 | table.insert(stripes, { 53 | filename = path, 54 | height_in_frames = 4, 55 | width_in_frames = 1 56 | }) 57 | end 58 | layer.stripes = stripes 59 | layer.filenames = nil 60 | layer.frame_count = 1 61 | if layer.draw_as_shadow then 62 | else 63 | layer.shift = {layer.shift.x or 0, (layer.shift.y or 0) - 3} 64 | end 65 | end 66 | 67 | 68 | for k, layer in pairs (cannon_pictures.cannon_barrel_pictures.layers) do 69 | table.insert(sprite_base.animation.layers, layer) 70 | end 71 | for k, layer in pairs (cannon_pictures.cannon_base_pictures.layers) do 72 | table.insert(sprite_base.animation.layers, layer) 73 | end 74 | 75 | local shifts = require(path.."shell_tank_creation_parameters") 76 | for k, shift in pairs (shifts) do 77 | shift[2][2] = shift[2][2] - 1.3 78 | end 79 | local attack_range = 36 80 | local unit = 81 | { 82 | type = "unit", 83 | name = name, 84 | localised_name = {name}, 85 | icon = sprite_base.icon, 86 | icon_size = sprite_base.icon_size, 87 | flags = util.unit_flags(), 88 | map_color = {b = 0.5, g = 1}, 89 | enemy_map_color = {r = 1}, 90 | max_health = 525, 91 | radar_range = 3, 92 | order="i-d", 93 | subgroup = "iron-units", 94 | healing_per_tick = 0, 95 | minable = {result = name, mining_time = 2}, 96 | collision_box = {{-2, -2}, {2, 2}}, 97 | selection_box = {{-2, -2}, {2, 2}}, 98 | collision_mask = util.ground_unit_collision_mask(), 99 | max_pursue_distance = 64, 100 | resistances = nil, 101 | old_resistances = 102 | { 103 | { 104 | type = "acid", 105 | decrease = 10, 106 | percent = 80 107 | } 108 | }, 109 | min_persue_time = (60 * 15), 110 | --sticker_box = {{-0.2, -0.2}, {0.2, 0.2}}, 111 | distraction_cooldown = (15), 112 | move_while_shooting = false, 113 | can_open_gates = true, 114 | ai_settings = 115 | { 116 | do_separation = true 117 | }, 118 | attack_parameters = 119 | { 120 | type = "projectile", 121 | warmup = 30, 122 | cooldown = 145, 123 | cooldown_deviation = 0.1, 124 | range = attack_range, 125 | min_attack_distance = attack_range - 8, 126 | lead_target_for_projectile_speed = 1, 127 | --projectile_creation_distance = 1.5, 128 | --projectile_center = {0, -1.5}, 129 | projectile_creation_distance = 1.6, 130 | projectile_center = {-0.15625, -1.2}, 131 | --range = 7 * 32, 132 | --min_range = 1 * 32, 133 | projectile_creation_parameters = shifts, 134 | sound = 135 | { 136 | { 137 | filename = "__base__/sound/fight/tank-cannon.ogg", 138 | volume = 1.0 139 | } 140 | }, 141 | ammo_type = 142 | { 143 | category = util.ammo_category("iron-units"), 144 | target_type = "direction", 145 | action = 146 | { 147 | { 148 | type = "direct", 149 | action_delivery = 150 | { 151 | type = "stream", 152 | stream = name.." Stream", 153 | source_offset = {0, -5}, 154 | source_effects = 155 | { 156 | type = "create-explosion", 157 | entity_name = "artillery-cannon-muzzle-flash" 158 | } 159 | } 160 | } 161 | } 162 | }, 163 | animation = sprite_base.animation 164 | }, 165 | vision_distance = 40, 166 | has_belt_immunity = true, 167 | movement_speed = 0.12, 168 | distance_per_frame = 0.15, 169 | pollution_to_join_attack = 1000, 170 | --corpse = name.." Corpse", 171 | dying_explosion = "explosion", 172 | vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 }, 173 | working_sound = 174 | { 175 | sound = sprite_base.working_sound.sound 176 | }, 177 | run_animation = sprite_base.animation 178 | } 179 | 180 | 181 | local particle_gfx = util.copy(data.raw.projectile["cannon-projectile"]) 182 | 183 | 184 | local animation = 185 | { 186 | filename = path.."shell_tank_projectile.png", 187 | line_length = 4, 188 | width = 46, 189 | height = 82, 190 | frame_count = 16, 191 | priority = "high", 192 | scale = 0.3, 193 | animation_speed = 1, 194 | blend_mode = "additive" 195 | } 196 | 197 | local shadow = 198 | { 199 | filename = path.."shell_tank_projectile_shadow.png", 200 | line_length = 4, 201 | width = 94, 202 | height = 170, 203 | frame_count = 16, 204 | priority = "high", 205 | shift = {-0.09, 0.395}, 206 | draw_as_shadow = true, 207 | scale = 0.3, 208 | animation_speed = 1, 209 | } 210 | 211 | local stream = util.copy(data.raw.stream["flamethrower-fire-stream"]) 212 | stream.name = name.." Stream" 213 | stream.oriented_particle = true 214 | stream.action = 215 | { 216 | { 217 | type = "direct", 218 | action_delivery = 219 | { 220 | type = "instant", 221 | target_effects = 222 | { 223 | { 224 | type = "create-entity", 225 | entity_name = name.." Explosion" 226 | } 227 | } 228 | } 229 | }, 230 | { 231 | type = "area", 232 | target_entities = false, 233 | trigger_from_target = true, 234 | repeat_count = 60, 235 | radius = 5, 236 | action_delivery = 237 | { 238 | type = "instant", 239 | target_effects = 240 | { 241 | { 242 | type = "create-entity", 243 | entity_name = name.." Explosion" 244 | } 245 | } 246 | } 247 | }, 248 | { 249 | type = "area", 250 | target_entities = false, 251 | trigger_from_target = true, 252 | repeat_count = 60, 253 | radius = 3, 254 | action_delivery = 255 | { 256 | type = "instant", 257 | target_effects = 258 | { 259 | { 260 | type = "create-entity", 261 | entity_name = name.." Explosion" 262 | } 263 | } 264 | } 265 | }, 266 | { 267 | type = "area", 268 | force = "not-same", 269 | ignore_collision_condition = true, 270 | radius = 5, 271 | action_delivery = 272 | { 273 | type = "instant", 274 | target_effects = 275 | { 276 | { 277 | type = "damage", 278 | damage = {amount = 15 , type = util.damage_type("explosion")} 279 | } 280 | } 281 | } 282 | }, 283 | { 284 | type = "area", 285 | force = "not-same", 286 | ignore_collision_condition = true, 287 | radius = 3, 288 | action_delivery = 289 | { 290 | type = "instant", 291 | target_effects = 292 | { 293 | { 294 | type = "damage", 295 | damage = {amount = 15 , type = util.damage_type("explosion")} 296 | } 297 | } 298 | } 299 | } 300 | } 301 | 302 | stream.particle = animation 303 | stream.shadow = shadow 304 | --stream.shadow.draw_as_shadow = true 305 | stream.particle.scale = 0.7 306 | stream.particle_buffer_size = 1 307 | stream.particle_spawn_interval = (100) 308 | stream.particle_spawn_timeout = (0) 309 | stream.particle_vertical_acceleration = (1.981 / 90) 310 | stream.particle_horizontal_speed = 1 311 | stream.particle_horizontal_speed_deviation = 0.2 312 | stream.particle_start_alpha = 1 313 | stream.particle_end_alpha = 1 314 | stream.particle_start_scale = 0.7 315 | stream.particle_loop_frame_count = 16 316 | stream.particle_fade_out_threshold = 1 317 | stream.particle_loop_exit_threshold = 1 318 | stream.spine_animation = nil 319 | stream.smoke_sources = 320 | { 321 | { 322 | name = "soft-fire-smoke", 323 | frequency = 2, --0.25, 324 | position = {0.0, 0}, -- -0.8}, 325 | starting_frame_deviation = 60 326 | } 327 | } 328 | stream.progress_to_create_smoke = 0 329 | stream.target_position_deviation = 3 330 | 331 | local explosion = util.copy(data.raw.explosion.explosion) 332 | explosion.name = name.." Explosion" 333 | 334 | local sprites = explosion.animations 335 | local new_animations = {} 336 | local add_sprites = function(scale, speed) 337 | for k, sprite in pairs (sprites) do 338 | local new = util.copy(sprite) 339 | new.animation_speed = (new.animation_speed or 1) * speed 340 | new.scale = (new.scale or 1) * scale 341 | new.blend_mode = "additive" 342 | table.insert(new_animations, new) 343 | end 344 | end 345 | 346 | add_sprites(1, 0.5) 347 | add_sprites(0.95, 0.6) 348 | add_sprites(0.9, 0.7) 349 | add_sprites(0.85, 0.8) 350 | add_sprites(0.8, 0.9) 351 | add_sprites(0.75, 1) 352 | add_sprites(0.6, 1.1) 353 | add_sprites(0.5, 1.2) 354 | 355 | explosion.animations = new_animations 356 | util.recursive_hack_make_hr(new_animations) 357 | explosion.light = nil 358 | explosion.smoke = nil 359 | explosion.smoke_count = 0 360 | 361 | 362 | 363 | local item = { 364 | type = "item", 365 | name = name, 366 | localised_name = {name}, 367 | icon = unit.icon, 368 | icon_size = unit.icon_size, 369 | flags = {}, 370 | subgroup = "iron-units", 371 | order = "e-"..name, 372 | stack_size = 10, 373 | place_result = name 374 | } 375 | 376 | local recipe = { 377 | type = "recipe", 378 | name = name, 379 | localised_name = {name}, 380 | category = names.deployers.iron_unit, 381 | enabled = false, 382 | ingredients = 383 | { 384 | {"engine-unit", 10}, 385 | {"steel-plate", 20}, 386 | {"explosives", 20}, 387 | {"rocket-fuel", 5} 388 | }, 389 | energy_required = 45, 390 | result = name 391 | } 392 | 393 | 394 | data:extend{unit, item, recipe, stream, explosion} 395 | -------------------------------------------------------------------------------- /data/units/shell_tank/shell_tank_creation_parameters.lua: -------------------------------------------------------------------------------- 1 | return { 2 | {0.0,util.by_pixel(-0.0,-145.0)}, 3 | {0.004,util.by_pixel(3.5,-144.5)}, 4 | {0.008,util.by_pixel(6.5,-144.5)}, 5 | {0.012,util.by_pixel(9.5,-144.5)}, 6 | {0.016,util.by_pixel(12.5,-144.5)}, 7 | {0.019,util.by_pixel(15.5,-144.0)}, 8 | {0.023,util.by_pixel(18.5,-144.0)}, 9 | {0.027,util.by_pixel(21.5,-143.5)}, 10 | {0.031,util.by_pixel(24.5,-143.0)}, 11 | {0.034,util.by_pixel(27.5,-142.5)}, 12 | {0.038,util.by_pixel(30.5,-142.0)}, 13 | {0.042,util.by_pixel(33.5,-141.5)}, 14 | {0.046,util.by_pixel(36.5,-141.0)}, 15 | {0.049,util.by_pixel(39.5,-140.0)}, 16 | {0.053,util.by_pixel(42.5,-139.5)}, 17 | {0.057,util.by_pixel(45.5,-138.5)}, 18 | {0.06,util.by_pixel(48.0,-138.0)}, 19 | {0.064,util.by_pixel(51.0,-137.0)}, 20 | {0.067,util.by_pixel(53.5,-136.0)}, 21 | {0.071,util.by_pixel(56.5,-135.0)}, 22 | {0.074,util.by_pixel(59.0,-134.0)}, 23 | {0.078,util.by_pixel(62.0,-133.0)}, 24 | {0.081,util.by_pixel(64.5,-132.0)}, 25 | {0.085,util.by_pixel(67.0,-131.0)}, 26 | {0.088,util.by_pixel(69.5,-129.5)}, 27 | {0.091,util.by_pixel(72.5,-128.5)}, 28 | {0.095,util.by_pixel(75.0,-127.0)}, 29 | {0.098,util.by_pixel(77.0,-126.0)}, 30 | {0.101,util.by_pixel(79.5,-124.5)}, 31 | {0.104,util.by_pixel(82.0,-123.0)}, 32 | {0.108,util.by_pixel(84.0,-121.5)}, 33 | {0.111,util.by_pixel(86.5,-120.0)}, 34 | {0.114,util.by_pixel(88.5,-118.5)}, 35 | {0.117,util.by_pixel(91.0,-117.0)}, 36 | {0.12,util.by_pixel(93.0,-115.5)}, 37 | {0.123,util.by_pixel(95.0,-114.0)}, 38 | {0.126,util.by_pixel(97.0,-112.0)}, 39 | {0.129,util.by_pixel(99.0,-110.5)}, 40 | {0.132,util.by_pixel(100.5,-108.5)}, 41 | {0.135,util.by_pixel(102.5,-107.0)}, 42 | {0.138,util.by_pixel(104.0,-105.0)}, 43 | {0.141,util.by_pixel(106.0,-103.5)}, 44 | {0.144,util.by_pixel(107.5,-101.5)}, 45 | {0.146,util.by_pixel(109.0,-99.5)}, 46 | {0.149,util.by_pixel(110.5,-97.5)}, 47 | {0.152,util.by_pixel(112.0,-95.5)}, 48 | {0.155,util.by_pixel(113.0,-94.0)}, 49 | {0.157,util.by_pixel(114.5,-92.0)}, 50 | {0.16,util.by_pixel(115.5,-90.0)}, 51 | {0.163,util.by_pixel(117.0,-88.0)}, 52 | {0.165,util.by_pixel(118.0,-85.5)}, 53 | {0.168,util.by_pixel(119.0,-83.5)}, 54 | {0.171,util.by_pixel(120.0,-81.5)}, 55 | {0.173,util.by_pixel(120.5,-79.5)}, 56 | {0.176,util.by_pixel(121.5,-77.5)}, 57 | {0.179,util.by_pixel(122.0,-75.5)}, 58 | {0.181,util.by_pixel(122.5,-73.0)}, 59 | {0.184,util.by_pixel(123.5,-71.0)}, 60 | {0.186,util.by_pixel(124.0,-69.0)}, 61 | {0.189,util.by_pixel(124.0,-66.5)}, 62 | {0.191,util.by_pixel(124.5,-64.5)}, 63 | {0.194,util.by_pixel(124.5,-62.5)}, 64 | {0.196,util.by_pixel(125.0,-60.0)}, 65 | {0.199,util.by_pixel(125.0,-58.0)}, 66 | {0.201,util.by_pixel(125.0,-56.0)}, 67 | {0.204,util.by_pixel(125.0,-53.5)}, 68 | {0.206,util.by_pixel(125.0,-51.5)}, 69 | {0.209,util.by_pixel(124.5,-49.5)}, 70 | {0.211,util.by_pixel(124.5,-47.0)}, 71 | {0.214,util.by_pixel(124.0,-45.0)}, 72 | {0.216,util.by_pixel(123.5,-43.0)}, 73 | {0.219,util.by_pixel(123.0,-40.5)}, 74 | {0.222,util.by_pixel(122.5,-38.5)}, 75 | {0.224,util.by_pixel(122.0,-36.5)}, 76 | {0.227,util.by_pixel(121.0,-34.5)}, 77 | {0.229,util.by_pixel(120.5,-32.0)}, 78 | {0.232,util.by_pixel(119.5,-30.0)}, 79 | {0.234,util.by_pixel(118.5,-28.0)}, 80 | {0.237,util.by_pixel(117.5,-26.0)}, 81 | {0.24,util.by_pixel(116.5,-24.0)}, 82 | {0.242,util.by_pixel(115.5,-22.0)}, 83 | {0.245,util.by_pixel(114.0,-20.0)}, 84 | {0.248,util.by_pixel(113.0,-18.0)}, 85 | {0.25,util.by_pixel(111.5,-16.0)}, 86 | {0.253,util.by_pixel(110.0,-14.0)}, 87 | {0.256,util.by_pixel(108.5,-12.0)}, 88 | {0.259,util.by_pixel(107.0,-10.5)}, 89 | {0.262,util.by_pixel(105.5,-8.5)}, 90 | {0.265,util.by_pixel(103.5,-6.5)}, 91 | {0.268,util.by_pixel(102.0,-5.0)}, 92 | {0.271,util.by_pixel(100.0,-3.0)}, 93 | {0.274,util.by_pixel(98.0,-1.5)}, 94 | {0.277,util.by_pixel(96.5,0.0)}, 95 | {0.28,util.by_pixel(94.5,1.5)}, 96 | {0.284,util.by_pixel(92.5,3.0)}, 97 | {0.287,util.by_pixel(90.0,4.5)}, 98 | {0.291,util.by_pixel(88.0,6.0)}, 99 | {0.294,util.by_pixel(86.0,7.5)}, 100 | {0.298,util.by_pixel(83.5,9.0)}, 101 | {0.302,util.by_pixel(81.0,10.5)}, 102 | {0.306,util.by_pixel(79.0,12.0)}, 103 | {0.31,util.by_pixel(76.5,13.5)}, 104 | {0.314,util.by_pixel(74.0,14.5)}, 105 | {0.318,util.by_pixel(71.5,16.0)}, 106 | {0.323,util.by_pixel(69.0,17.0)}, 107 | {0.327,util.by_pixel(66.5,18.5)}, 108 | {0.332,util.by_pixel(64.0,19.5)}, 109 | {0.337,util.by_pixel(61.0,20.5)}, 110 | {0.342,util.by_pixel(58.5,21.5)}, 111 | {0.348,util.by_pixel(55.5,22.5)}, 112 | {0.353,util.by_pixel(53.0,23.5)}, 113 | {0.359,util.by_pixel(50.0,24.5)}, 114 | {0.365,util.by_pixel(47.5,25.5)}, 115 | {0.372,util.by_pixel(44.5,26.0)}, 116 | {0.379,util.by_pixel(41.5,27.0)}, 117 | {0.386,util.by_pixel(38.5,27.5)}, 118 | {0.393,util.by_pixel(35.5,28.0)}, 119 | {0.4,util.by_pixel(32.5,29.0)}, 120 | {0.408,util.by_pixel(29.5,29.5)}, 121 | {0.416,util.by_pixel(26.5,30.0)}, 122 | {0.425,util.by_pixel(23.5,30.5)}, 123 | {0.434,util.by_pixel(20.5,30.5)}, 124 | {0.443,util.by_pixel(17.5,31.0)}, 125 | {0.452,util.by_pixel(14.5,31.5)}, 126 | {0.462,util.by_pixel(11.5,31.5)}, 127 | {0.471,util.by_pixel(8.5,31.5)}, 128 | {0.481,util.by_pixel(5.5,32.0)}, 129 | {0.491,util.by_pixel(2.5,32.0)}, 130 | {0.501,util.by_pixel(-0.0,32.0)}, 131 | {0.511,util.by_pixel(-3.5,32.0)}, 132 | {0.521,util.by_pixel(-6.5,32.0)}, 133 | {0.531,util.by_pixel(-9.5,31.5)}, 134 | {0.541,util.by_pixel(-12.5,31.5)}, 135 | {0.55,util.by_pixel(-15.5,31.0)}, 136 | {0.559,util.by_pixel(-18.5,31.0)}, 137 | {0.568,util.by_pixel(-21.5,30.5)}, 138 | {0.577,util.by_pixel(-24.5,30.0)}, 139 | {0.586,util.by_pixel(-27.5,29.5)}, 140 | {0.594,util.by_pixel(-30.5,29.0)}, 141 | {0.602,util.by_pixel(-33.5,28.5)}, 142 | {0.609,util.by_pixel(-36.5,28.0)}, 143 | {0.616,util.by_pixel(-39.5,27.5)}, 144 | {0.623,util.by_pixel(-42.5,26.5)}, 145 | {0.63,util.by_pixel(-45.5,26.0)}, 146 | {0.636,util.by_pixel(-48.0,25.0)}, 147 | {0.642,util.by_pixel(-51.0,24.0)}, 148 | {0.648,util.by_pixel(-53.5,23.5)}, 149 | {0.654,util.by_pixel(-56.5,22.5)}, 150 | {0.659,util.by_pixel(-59.0,21.5)}, 151 | {0.664,util.by_pixel(-62.0,20.0)}, 152 | {0.669,util.by_pixel(-64.5,19.0)}, 153 | {0.674,util.by_pixel(-67.0,18.0)}, 154 | {0.678,util.by_pixel(-70.0,17.0)}, 155 | {0.683,util.by_pixel(-72.5,15.5)}, 156 | {0.687,util.by_pixel(-75.0,14.5)}, 157 | {0.691,util.by_pixel(-77.0,13.0)}, 158 | {0.695,util.by_pixel(-79.5,11.5)}, 159 | {0.699,util.by_pixel(-82.0,10.0)}, 160 | {0.703,util.by_pixel(-84.0,8.5)}, 161 | {0.707,util.by_pixel(-86.5,7.0)}, 162 | {0.71,util.by_pixel(-88.5,5.5)}, 163 | {0.714,util.by_pixel(-91.0,4.0)}, 164 | {0.717,util.by_pixel(-93.0,2.5)}, 165 | {0.72,util.by_pixel(-95.0,1.0)}, 166 | {0.724,util.by_pixel(-97.0,0.0)}, 167 | {0.727,util.by_pixel(-99.0,-2.0)}, 168 | {0.73,util.by_pixel(-100.5,-3.5)}, 169 | {0.733,util.by_pixel(-102.5,-5.5)}, 170 | {0.736,util.by_pixel(-104.0,-7.0)}, 171 | {0.739,util.by_pixel(-106.0,-9.0)}, 172 | {0.742,util.by_pixel(-107.5,-11.0)}, 173 | {0.745,util.by_pixel(-109.0,-13.0)}, 174 | {0.747,util.by_pixel(-110.5,-14.5)}, 175 | {0.75,util.by_pixel(-112.0,-16.5)}, 176 | {0.753,util.by_pixel(-113.0,-18.5)}, 177 | {0.756,util.by_pixel(-114.5,-20.5)}, 178 | {0.758,util.by_pixel(-115.5,-22.5)}, 179 | {0.761,util.by_pixel(-117.0,-24.5)}, 180 | {0.764,util.by_pixel(-118.0,-26.5)}, 181 | {0.766,util.by_pixel(-119.0,-28.5)}, 182 | {0.769,util.by_pixel(-120.0,-31.0)}, 183 | {0.771,util.by_pixel(-120.5,-33.0)}, 184 | {0.774,util.by_pixel(-121.5,-35.0)}, 185 | {0.777,util.by_pixel(-122.0,-37.0)}, 186 | {0.779,util.by_pixel(-122.5,-39.0)}, 187 | {0.782,util.by_pixel(-123.5,-41.5)}, 188 | {0.784,util.by_pixel(-124.0,-43.5)}, 189 | {0.787,util.by_pixel(-124.0,-45.5)}, 190 | {0.789,util.by_pixel(-124.5,-48.0)}, 191 | {0.792,util.by_pixel(-124.5,-50.0)}, 192 | {0.794,util.by_pixel(-125.0,-52.0)}, 193 | {0.797,util.by_pixel(-125.0,-54.5)}, 194 | {0.799,util.by_pixel(-125.0,-56.5)}, 195 | {0.802,util.by_pixel(-125.0,-58.5)}, 196 | {0.804,util.by_pixel(-125.0,-61.0)}, 197 | {0.807,util.by_pixel(-124.5,-63.0)}, 198 | {0.809,util.by_pixel(-124.5,-65.0)}, 199 | {0.812,util.by_pixel(-124.0,-67.5)}, 200 | {0.814,util.by_pixel(-123.5,-69.5)}, 201 | {0.817,util.by_pixel(-123.0,-71.5)}, 202 | {0.82,util.by_pixel(-122.5,-74.0)}, 203 | {0.822,util.by_pixel(-122.0,-76.0)}, 204 | {0.825,util.by_pixel(-121.0,-78.0)}, 205 | {0.827,util.by_pixel(-120.5,-80.0)}, 206 | {0.83,util.by_pixel(-119.5,-82.0)}, 207 | {0.833,util.by_pixel(-118.5,-84.5)}, 208 | {0.835,util.by_pixel(-117.5,-86.5)}, 209 | {0.838,util.by_pixel(-116.5,-88.5)}, 210 | {0.841,util.by_pixel(-115.5,-90.5)}, 211 | {0.843,util.by_pixel(-114.0,-92.5)}, 212 | {0.846,util.by_pixel(-113.0,-94.5)}, 213 | {0.849,util.by_pixel(-111.5,-96.5)}, 214 | {0.852,util.by_pixel(-110.0,-98.5)}, 215 | {0.854,util.by_pixel(-108.5,-100.0)}, 216 | {0.857,util.by_pixel(-107.0,-102.0)}, 217 | {0.86,util.by_pixel(-105.5,-104.0)}, 218 | {0.863,util.by_pixel(-103.5,-105.5)}, 219 | {0.866,util.by_pixel(-102.0,-107.5)}, 220 | {0.869,util.by_pixel(-100.0,-109.0)}, 221 | {0.872,util.by_pixel(-98.0,-111.0)}, 222 | {0.875,util.by_pixel(-96.5,-112.5)}, 223 | {0.878,util.by_pixel(-94.5,-114.5)}, 224 | {0.881,util.by_pixel(-92.5,-116.0)}, 225 | {0.884,util.by_pixel(-90.0,-117.5)}, 226 | {0.887,util.by_pixel(-88.0,-119.0)}, 227 | {0.89,util.by_pixel(-86.0,-120.5)}, 228 | {0.893,util.by_pixel(-83.5,-122.0)}, 229 | {0.896,util.by_pixel(-81.0,-123.5)}, 230 | {0.9,util.by_pixel(-79.0,-125.0)}, 231 | {0.903,util.by_pixel(-76.5,-126.0)}, 232 | {0.906,util.by_pixel(-74.0,-127.5)}, 233 | {0.91,util.by_pixel(-71.5,-129.0)}, 234 | {0.913,util.by_pixel(-69.0,-130.0)}, 235 | {0.916,util.by_pixel(-66.5,-131.0)}, 236 | {0.92,util.by_pixel(-63.5,-132.5)}, 237 | {0.923,util.by_pixel(-61.0,-133.5)}, 238 | {0.927,util.by_pixel(-58.5,-134.5)}, 239 | {0.93,util.by_pixel(-55.5,-135.5)}, 240 | {0.934,util.by_pixel(-53.0,-136.5)}, 241 | {0.937,util.by_pixel(-50.0,-137.5)}, 242 | {0.941,util.by_pixel(-47.0,-138.0)}, 243 | {0.944,util.by_pixel(-44.5,-139.0)}, 244 | {0.948,util.by_pixel(-41.5,-139.5)}, 245 | {0.952,util.by_pixel(-38.5,-140.5)}, 246 | {0.955,util.by_pixel(-35.5,-141.0)}, 247 | {0.959,util.by_pixel(-32.5,-141.5)}, 248 | {0.963,util.by_pixel(-29.5,-142.0)}, 249 | {0.967,util.by_pixel(-26.5,-142.5)}, 250 | {0.97,util.by_pixel(-23.5,-143.0)}, 251 | {0.974,util.by_pixel(-20.5,-143.5)}, 252 | {0.978,util.by_pixel(-17.5,-144.0)}, 253 | {0.982,util.by_pixel(-14.5,-144.0)}, 254 | {0.985,util.by_pixel(-11.5,-144.5)}, 255 | {0.989,util.by_pixel(-8.5,-144.5)}, 256 | {0.993,util.by_pixel(-5.5,-144.5)}, 257 | {0.997,util.by_pixel(-2.5,-145.0)} 258 | } -------------------------------------------------------------------------------- /data/units/shell_tank/shell_tank_projectile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klonan/Total_Automization/aa61e009449416e1b2da1c9ae06eebcfc2367a30/data/units/shell_tank/shell_tank_projectile.png -------------------------------------------------------------------------------- /data/units/shell_tank/shell_tank_projectile_shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klonan/Total_Automization/aa61e009449416e1b2da1c9ae06eebcfc2367a30/data/units/shell_tank/shell_tank_projectile_shadow.png -------------------------------------------------------------------------------- /data/units/smg_guy/smg_guy.lua: -------------------------------------------------------------------------------- 1 | local path = util.path("data/units/smg_guy/") 2 | local name = names.units.smg_guy 3 | 4 | local base = util.copy(data.raw.character.character) 5 | --for k, layer in pairs (base.animations[1].idle_with_gun.layers) do 6 | -- layer.frame_count = 1 7 | --end 8 | local attack_range = 16 9 | local bot = 10 | { 11 | type = "unit", 12 | name = name, 13 | localised_name = {name}, 14 | icon = base.icon, 15 | icon_size = base.icon_size, 16 | icons = base.icons, 17 | flags = util.unit_flags(), 18 | map_color = {b = 0.5, g = 1}, 19 | enemy_map_color = {r = 1}, 20 | max_health = 150, 21 | radar_range = 1, 22 | order="i-a", 23 | subgroup = "iron-units", 24 | can_open_gates = true, 25 | healing_per_tick = 0, 26 | minable = {result = name, mining_time = 2}, 27 | collision_box = {{-0.5, -0.5}, {0.5, 0.5}}, 28 | collision_mask = util.ground_unit_collision_mask(), 29 | max_pursue_distance = 64, 30 | resistances = nil, 31 | old_resistances = { 32 | { 33 | type = "acid", 34 | decrease = 5, 35 | percent = 50 36 | } 37 | }, 38 | min_persue_time = 60 * 15, 39 | selection_box = {{-0.5, -0.5}, {0.5, 0.5}}, 40 | sticker_box = {{-0.3, -1}, {0.2, 0.3}}, 41 | distraction_cooldown = (15), 42 | move_while_shooting = false, 43 | can_open_gates = true, 44 | ai_settings = 45 | { 46 | do_separation = true 47 | }, 48 | attack_parameters = 49 | { 50 | type = "projectile", 51 | ammo_category = "bullet", 52 | warmup = 10, 53 | cooldown = 10, 54 | cooldown_deviation = 0.25, 55 | range = attack_range, 56 | min_attack_distance = attack_range - 2, 57 | projectile_creation_distance = 0.5, 58 | --lead_target_for_projectile_speed = 1, 59 | sound = 60 | { 61 | variations = 62 | { 63 | { 64 | filename = "__base__/sound/fight/light-gunshot-1.ogg" 65 | }, 66 | { 67 | filename = "__base__/sound/fight/light-gunshot-2.ogg" 68 | }, 69 | { 70 | filename = "__base__/sound/fight/light-gunshot-3.ogg" 71 | } 72 | }, 73 | aggregation = 74 | { 75 | max_count = 2, 76 | remove = true, 77 | count_already_playing = true 78 | } 79 | }, 80 | ammo_type = 81 | { 82 | category = util.ammo_category("iron-units"), 83 | target_type = "entity", 84 | action = 85 | { 86 | type = "direct", 87 | action_delivery = 88 | { 89 | --{ 90 | --type = "projectile", 91 | --projectile = name.." Projectile", 92 | --starting_speed = 1, 93 | --starting_speed_deviation = 0.05, 94 | --direction_deviation = 0.1, 95 | --range_deviation = 0.1, 96 | --max_range = attack_range + 2, 97 | --}, 98 | { 99 | type = "instant", 100 | source_effects = 101 | { 102 | { 103 | type = "create-explosion", 104 | entity_name = "explosion-gunshot" 105 | } 106 | }, 107 | target_effects = 108 | { 109 | { 110 | type = "damage", 111 | damage = {amount = 5 , type = util.damage_type("physical")} 112 | }, 113 | { 114 | type = "create-entity", 115 | offset_deviation = {{-0.5, -0.5},{0.5, 0.5}}, 116 | offsets = {{0,0}}, 117 | entity_name = "explosion-hit" 118 | } 119 | } 120 | } 121 | } 122 | } 123 | }, 124 | animation = base.animations[1].idle_with_gun 125 | }, 126 | vision_distance = 40, 127 | has_belt_immunity = false, 128 | affected_by_tiles = true, 129 | movement_speed = 0.15, 130 | distance_per_frame = 0.15, 131 | pollution_to_join_attack = 1000, 132 | --corpse = name.." Corpse", 133 | dying_explosion = "explosion", 134 | run_animation = base.animations[1].running 135 | } 136 | 137 | local projectile = util.copy(data.raw.projectile["shotgun-pellet"]) 138 | projectile.name = name.." Projectile" 139 | projectile.force_condition = "not-same" 140 | projectile.hit_at_collision_position = true 141 | projectile.hit_collision_mask = util.projectile_collision_mask() 142 | projectile.action = 143 | { 144 | type = "direct", 145 | action_delivery = 146 | { 147 | type = "instant", 148 | target_effects = 149 | { 150 | { 151 | type = "damage", 152 | damage = {amount = 2.5 , type = util.damage_type(name)} 153 | }, 154 | { 155 | type = "create-entity", 156 | entity_name = "explosion-hit" 157 | } 158 | } 159 | } 160 | } 161 | projectile.final_action = nil 162 | 163 | local item = { 164 | type = "item", 165 | name = name, 166 | localised_name = {name}, 167 | icon = bot.icon, 168 | icon_size = bot.icon_size, 169 | flags = {}, 170 | subgroup = "iron-units", 171 | order = "b-"..name, 172 | stack_size = 10, 173 | place_result = name 174 | } 175 | 176 | local recipe = { 177 | type = "recipe", 178 | name = name, 179 | localised_name = {name}, 180 | category = names.deployers.iron_unit, 181 | enabled = false, 182 | ingredients = 183 | { 184 | {"iron-plate", 15}, 185 | {"iron-gear-wheel", 10}, 186 | {"iron-stick", 10} 187 | }, 188 | energy_required = 15, 189 | result = name 190 | } 191 | 192 | data:extend 193 | { 194 | bot, 195 | --projectile, 196 | item, 197 | recipe 198 | } -------------------------------------------------------------------------------- /data/units/tazer_bot/tazer_bot.lua: -------------------------------------------------------------------------------- 1 | local path = util.path("data/units/tazer_bot/") 2 | local name = names.units.tazer_bot 3 | 4 | local base = util.copy(data.raw["combat-robot"]["distractor"]) 5 | --for k, layer in pairs (base.animations[1].idle_with_gun.layers) do 6 | -- layer.frame_count = 1 7 | --end 8 | util.recursive_hack_make_hr(base) 9 | util.recursive_hack_scale(base, 2) 10 | table.insert(base.idle.layers, base.shadow_idle) 11 | table.insert(base.in_motion.layers, base.shadow_in_motion) 12 | 13 | local sprite_shift = {0, 0} 14 | for k, layer in pairs (base.idle.layers) do 15 | util.shift_layer(layer, sprite_shift) 16 | end 17 | for k, layer in pairs (base.in_motion.layers) do 18 | util.shift_layer(layer, sprite_shift) 19 | end 20 | local shadow_shift = {2, 4} 21 | util.shift_layer(base.shadow_in_motion, shadow_shift) 22 | base.shadow_in_motion.scale = (base.shadow_in_motion.scale or 1) * 0.8 23 | util.shift_layer(base.shadow_idle, shadow_shift) 24 | base.shadow_idle.scale = (base.shadow_idle.scale or 1) * 0.8 25 | 26 | local attack_range = 14 27 | local bot = 28 | { 29 | type = "unit", 30 | name = name, 31 | localised_name = {name}, 32 | icon = "__base__/graphics/icons/distractor.png", 33 | icon_size = 64, 34 | flags = util.unit_flags(), 35 | map_color = {b = 0.5, g = 1}, 36 | enemy_map_color = {r = 1}, 37 | max_health = 220, 38 | radar_range = 2, 39 | order="b-b-b", 40 | subgroup = "circuit-units", 41 | resistances = nil, 42 | healing_per_tick = 0, 43 | collision_mask = util.flying_unit_collision_mask(), 44 | render_layer = "air-object", 45 | max_pursue_distance = 64, 46 | min_persue_time = 60 * 15, 47 | selection_box = {{-0.8, -0.8}, {0.8, 0.8}}, 48 | collision_box = {{-0.8, -0.8}, {0.8, 0.8}}, 49 | sticker_box = {{-0.8, -0.8}, {0.8, 0.8}}, 50 | distraction_cooldown = (15), 51 | move_while_shooting = true, 52 | can_open_gates = false, 53 | minable = {result = name, mining_time = 2}, 54 | ai_settings = 55 | { 56 | do_separation = true 57 | }, 58 | attack_parameters = 59 | { 60 | type = "beam", 61 | warmup = 30, 62 | cooldown = (40), 63 | cooldown_deviation = 0.2, 64 | range = attack_range, 65 | min_attack_distance = attack_range - 3, 66 | ammo_type = 67 | { 68 | category = util.ammo_category("circuit-units"), 69 | action = 70 | { 71 | force = "not-same", 72 | type = "direct", 73 | action_delivery = 74 | { 75 | type = "beam", 76 | beam = name.." Beam", 77 | add_to_shooter = false, 78 | max_length = attack_range + 3, 79 | duration = (45), 80 | source_offset = {0, 0.5}, 81 | } 82 | } 83 | }, 84 | animation = base.idle 85 | }, 86 | vision_distance = 40, 87 | has_belt_immunity = true, 88 | movement_speed = 0.15, 89 | distance_per_frame = 0.15, 90 | pollution_to_join_attack = 1000, 91 | destroy_when_commands_fail = false, 92 | dying_explosion = "explosion", 93 | working_sound = { 94 | sound = 95 | { 96 | { filename = "__base__/sound/flying-robot-1.ogg", volume = 0.6 }, 97 | { filename = "__base__/sound/flying-robot-2.ogg", volume = 0.6 }, 98 | { filename = "__base__/sound/flying-robot-3.ogg", volume = 0.6 }, 99 | { filename = "__base__/sound/flying-robot-4.ogg", volume = 0.6 }, 100 | { filename = "__base__/sound/flying-robot-5.ogg", volume = 0.6 } 101 | }, 102 | max_sounds_per_type = 3, 103 | probability = (1 / (3 * 60)) -- average pause between the sound is 3 seconds 104 | }, 105 | run_animation = base.in_motion 106 | } 107 | 108 | local beam = util.copy(data.raw.beam["electric-beam"]) 109 | 110 | beam.name = name.." Beam" 111 | beam.localised_name = name.." Beam" 112 | beam.damage_interval = (45) 113 | --beam.random_target_offset = true 114 | beam.action = 115 | { 116 | type = "direct", 117 | action_delivery = 118 | { 119 | type = "instant", 120 | target_effects = 121 | { 122 | { 123 | type = "nested-result", 124 | action = 125 | { 126 | type = "area", 127 | radius = 2.5, 128 | force = "not-same", 129 | trigger_from_target = true, 130 | action_delivery = 131 | { 132 | type = "beam", 133 | beam = name.." Small Beam", 134 | add_to_shooter = false, 135 | max_length = 30, 136 | duration = (45), 137 | source_offset = {0, 0.5}, 138 | } 139 | } 140 | }, 141 | { 142 | type = "damage", 143 | damage = { amount = 15, type = util.damage_type("electric")} 144 | }, 145 | { 146 | type = "create-sticker", 147 | sticker = name.." Sticker" 148 | }, 149 | } 150 | } 151 | } 152 | 153 | 154 | local small_beam = util.copy(beam) 155 | 156 | small_beam.name = name.." Small Beam" 157 | small_beam.localised_name = name.." Small Beam" 158 | small_beam.damage_interval = (45) 159 | small_beam.random_target_offset = true 160 | small_beam.action = 161 | { 162 | type = "direct", 163 | action_delivery = 164 | { 165 | type = "instant", 166 | target_effects = 167 | { 168 | { 169 | type = "damage", 170 | damage = { amount = 10, type = util.damage_type("electric")} 171 | }, 172 | { 173 | type = "create-sticker", 174 | sticker = name.." Sticker" 175 | } 176 | } 177 | } 178 | } 179 | 180 | local sticker = util.copy(data.raw.sticker["fire-sticker"]) 181 | sticker.name = name.." Sticker" 182 | 183 | sticker.duration_in_ticks = (2 * 60) 184 | sticker.target_movement_modifier = 0.66 185 | sticker.damage_per_tick = {type = "electric", amount = 0}--(0.25)} 186 | sticker.spread_fire_entity = nil 187 | sticker.fire_spread_cooldown = 0 188 | sticker.fire_spread_radius = 0 189 | sticker.animation = 190 | { 191 | filename = path.."tazer_bot_sticker.png", 192 | width = 37, 193 | height = 35, 194 | frame_count = 16, 195 | animation_speed = (1) 196 | } 197 | sticker.stickers_per_square_meter = 8 198 | 199 | local item = { 200 | type = "item", 201 | name = name, 202 | localised_name = {name}, 203 | icon = bot.icon, 204 | icon_size = bot.icon_size, 205 | flags = {}, 206 | subgroup = "circuit-units", 207 | order = "c-"..name, 208 | stack_size = 10, 209 | place_result = name 210 | } 211 | 212 | local recipe = { 213 | type = "recipe", 214 | name = name, 215 | localised_name = {name}, 216 | category = names.deployers.circuit_unit, 217 | enabled = false, 218 | ingredients = 219 | { 220 | {"battery", 10}, 221 | {"electronic-circuit", 10}, 222 | {"copper-cable", 20} 223 | }, 224 | energy_required = 25, 225 | result = name 226 | } 227 | 228 | data:extend{ 229 | bot, 230 | beam, 231 | sticker, 232 | item, 233 | recipe, 234 | small_beam 235 | } -------------------------------------------------------------------------------- /data/units/tazer_bot/tazer_bot_sticker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klonan/Total_Automization/aa61e009449416e1b2da1c9ae06eebcfc2367a30/data/units/tazer_bot/tazer_bot_sticker.png -------------------------------------------------------------------------------- /data/units/units.lua: -------------------------------------------------------------------------------- 1 | local require = function(name) return require("data/units/"..name) end 2 | 3 | require("smg_guy/smg_guy") 4 | require("rocket_guy/rocket_guy") 5 | require("scout_car/scout_car") 6 | require("shell_tank/shell_tank") 7 | 8 | require("blaster_bot/blaster_bot") 9 | require("tazer_bot/tazer_bot") 10 | require("laser_bot/laser_bot") 11 | require("plasma_bot/plasma_bot") 12 | -------------------------------------------------------------------------------- /data/variety_explosions.lua: -------------------------------------------------------------------------------- 1 | local util = require("util") 2 | 3 | local variety = function(explosion) 4 | 5 | if not explosion then return end 6 | local sprite = explosion.animations[1] 7 | if not sprite then return end 8 | 9 | local new = {} 10 | 11 | for scale = 0.7, 1.3, 0.1 do 12 | for speed = 0.7, 1.3, 0.1 do 13 | local fresh = util.copy(sprite) 14 | fresh.scale = (fresh.scale or 1) * scale 15 | fresh.animation_speed = (fresh.animation_speed or 1) * scale 16 | table.insert(new, fresh) 17 | end 18 | end 19 | 20 | explosion.animations = new 21 | end 22 | 23 | variety(data.raw.explosion["explosion-hit"]) 24 | variety(data.raw.explosion["explosion-gunshot"]) 25 | -------------------------------------------------------------------------------- /info.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Total_Automization", 3 | "version": "0.2.5", 4 | "title": "Total Automization", 5 | "author": "Klonan", 6 | "contact": "", 7 | "homepage": "", 8 | "description": "Add RTS units and deployment mechanics.", 9 | "dependencies": ["base >= 1.1.36", "Unit_Control >= 0.3.0"], 10 | "factorio_version": "1.1" 11 | } -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | 6 | Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 7 | 8 | This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 9 | 10 | 0. Additional Definitions. 11 | 12 | As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License. 13 | 14 | “The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. 15 | 16 | An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. 17 | 18 | A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”. 19 | 20 | The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. 21 | 22 | The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 23 | 24 | 1. Exception to Section 3 of the GNU GPL. 25 | 26 | You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 27 | 28 | 2. Conveying Modified Versions. 29 | 30 | If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: 31 | 32 | a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or 33 | b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 34 | 35 | 3. Object Code Incorporating Material from Library Header Files. 36 | 37 | The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: 38 | 39 | a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. 40 | b) Accompany the object code with a copy of the GNU GPL and this license document. 41 | 42 | 4. Combined Works. 43 | 44 | You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: 45 | 46 | a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. 47 | b) Accompany the Combined Work with a copy of the GNU GPL and this license document. 48 | c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. 49 | d) Do one of the following: 50 | 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 51 | 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. 52 | e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 53 | 54 | 5. Combined Libraries. 55 | 56 | You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: 57 | 58 | a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. 59 | b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 60 | 61 | 6. Revised Versions of the GNU Lesser General Public License. 62 | 63 | The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. 64 | 65 | Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. 66 | 67 | If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. -------------------------------------------------------------------------------- /locale/en/preset.cfg: -------------------------------------------------------------------------------- 1 | [map-gen-preset-name] 2 | pvp-ribbonworld=PvP Ribbonworld [1v1] 3 | pvp-arena=PvP Arena [2-4 teams] 4 | [map-gen-preset-description] 5 | pvp-ribbonworld=Ribbon world tuned for PvP scenario. Has limited height. 6 | pvp-arena=Tuned for PvP scenario. Has limited height and width, best with 2 or 4 teams. 7 | -------------------------------------------------------------------------------- /locale/en/total-automization.cfg: -------------------------------------------------------------------------------- 1 | shoo=Shoo! 2 | 3 | blaster-bot=Blaster bot 4 | tazer-bot=Tazer bot 5 | laser-bot=Laser bot 6 | plasma-bot=Plasma bot 7 | 8 | smg-guy=SMG guy 9 | rocket-guy=Rocket guy 10 | scout-car=Scout car 11 | shell-tank=Shell tank 12 | 13 | iron-units=Iron units 14 | iron-units-damage=Iron units damage 15 | circuit-units=Circuit units 16 | circuit-units-damage=Circuit units damage 17 | 18 | iron-unit-deployer=Iron unit deployer 19 | circuit-unit-deployer=Circuit unit deployer 20 | 21 | [modifier-description] 22 | iron-units-damage-bonus=Iron units damage: __1__ 23 | circuit-units-damage-bonus=Circuit units damage: __1__ 24 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ## Total Automization 2 | 3 | ![](thumbnail.png) 4 | 5 | -------------------------------------- 6 | 7 | This mod adds units you can control in classic RTS fashion. 8 | They are crafted and deployed from special _Deploy machines_, and you can control them with a special selection tool. 9 | -------------------------------------------------------------------------------- /script/debug.lua: -------------------------------------------------------------------------------- 1 | local names = names 2 | local get_position = function(n) 3 | local root = n^0.5 4 | local nearest_root = math.floor(root+0.5) 5 | local upper_root = math.ceil(root) 6 | local root_difference = math.abs(nearest_root^2 - n) 7 | if nearest_root == upper_root then 8 | x = upper_root - root_difference 9 | y = nearest_root 10 | else 11 | x = upper_root 12 | y = root_difference 13 | end 14 | --game.print(x.." - "..y) 15 | return {x, y} 16 | end 17 | 18 | local on_player_created = function(event) 19 | --if true then return end 20 | local player = game.players[event.player_index] 21 | player.force = "player" 22 | --player.insert(names.entities.buy_chest) 23 | --player.insert(names.entities.sell_chest) 24 | --if true then return end 25 | --player.surface.create_entity{name = "small-biter", position = {-10, 10}} 26 | --player.surface.create_entity{name = "small-biter", position = {-10, 10}} 27 | --player.surface.create_entity{name = "small-biter", position = {-10, 10}} 28 | --player.surface.create_entity{name = "small-biter", position = {-10, 10}} 29 | if player.character then player.character.destroy() end 30 | 31 | --if true then return {} end 32 | local team1 = { 33 | --scout_car = 20, 34 | --beetle = 80, 35 | --plasma_bot = 1, 36 | tazer_bot = 20, 37 | laser_bot = 20, 38 | blaster_bot = 30, 39 | --shell_tank = 500, 40 | plasma_bot = 10, 41 | --acid_worm = 20, 42 | --piercing_biter = 50 43 | --scatter_spitter = 20 44 | --smg_guy = 30, 45 | --rocket_guy = 1000 46 | } 47 | local pos = {x = -40, y = 0} 48 | for name, count in pairs (team1) do 49 | for x = 1, count do 50 | local vec = get_position(math.random(400)) 51 | player.surface.create_entity{name = names.units[name], position = {pos.x + vec[1], pos.y + vec[2]}, force = "player"} 52 | end 53 | end 54 | 55 | 56 | --if true then return end 57 | 58 | team2 = { 59 | --beetle = 200, 60 | --plasma_bot = 10, 61 | --blaster_bot = 30, 62 | --laser_bot = 20, 63 | --tazer_bot = 100, 64 | smg_guy = 30, 65 | scout_car = 20, 66 | rocket_guy = 20, 67 | shell_tank = 10 68 | --scatter_spitter = 100, 69 | --piercing_biter = 30, 70 | --rocket_guy = 30, 71 | --laser_bot = 20 72 | --acid_worm = 50 73 | } 74 | local pos = {x = 20, y = 0} 75 | for name, count in pairs (team2) do 76 | for x = 1, count do 77 | local vec = get_position(math.random(400)) 78 | player.surface.create_entity{name = names.units[name], position = {pos.x + vec[1], pos.y + vec[2]}, force = "enemy"} 79 | end 80 | end 81 | 82 | end 83 | 84 | local events = 85 | { 86 | [defines.events.on_player_created] = on_player_created 87 | } 88 | 89 | local debug = {} 90 | 91 | debug.get_events = function() return events end 92 | 93 | debug.on_init = function() 94 | for k, surface in pairs (game.surfaces) do 95 | surface.always_day = true 96 | end 97 | debug.on_event = handler(events) 98 | end 99 | 100 | debug.on_load = function() 101 | debug.on_event = handler(events) 102 | end 103 | 104 | return debug 105 | -------------------------------------------------------------------------------- /script/killcam.lua: -------------------------------------------------------------------------------- 1 | local data = 2 | { 3 | killcams = {} 4 | } 5 | 6 | local make_killcam = function(player, cause) 7 | local scale = player.display_scale 8 | local gui = player.gui.center 9 | gui.clear() 10 | local name = cause.name 11 | if cause.type == "player" and cause.player then 12 | name = cause.player.name 13 | else 14 | name = game.entity_prototypes[name].localised_name 15 | end 16 | 17 | local outer = gui.add{type = "frame", style = "inside_deep_frame"} 18 | outer.style.width = player.display_resolution.width / scale 19 | outer.style.height = player.display_resolution.height / scale 20 | outer.style.horizontal_align = "center" 21 | outer.style.vertical_align = "center" 22 | 23 | 24 | local frame = outer.add{type = "frame", caption = {"", "You were killed by ", name}} 25 | frame.style.horizontally_stretchable = false 26 | frame.style.vertically_stretchable = false 27 | local camera = frame.add{type = "camera", position = cause.position, zoom = 1} 28 | camera.style.width = math.floor(player.display_resolution.width * 0.8) / scale 29 | camera.style.height = math.floor(player.display_resolution.height * 0.8) / scale 30 | local cams = data.killcams 31 | cams[player.index] = {gui = camera, cause = cause, frame = outer} 32 | end 33 | 34 | local on_player_died = function(event) 35 | local cause = event.cause 36 | if not cause then return end 37 | local player = game.players[event.player_index] 38 | make_killcam(player, cause) 39 | end 40 | 41 | local on_tick = function(event) 42 | local cams = data.killcams 43 | for k, cam in pairs (cams) do 44 | local player = game.players[k] 45 | if not player.ticks_to_respawn then 46 | cam.frame.destroy() 47 | cams[k] = nil 48 | elseif cam.cause.valid then 49 | cam.gui.position = cam.cause.position 50 | end 51 | end 52 | end 53 | 54 | local killcam = {} 55 | 56 | killcam.events = 57 | { 58 | [defines.events.on_player_died] = on_player_died, 59 | [defines.events.on_tick] = on_tick 60 | } 61 | 62 | killcam.on_init = function() 63 | global.killcam = data 64 | end 65 | 66 | killcam.on_load = function() 67 | data = global.killcam or data 68 | end 69 | 70 | return killcam 71 | -------------------------------------------------------------------------------- /script/script_util.lua: -------------------------------------------------------------------------------- 1 | local util = require("util") 2 | 3 | local deregister_gui_internal 4 | deregister_gui_internal = function(gui_element, data) 5 | data[gui_element.index] = nil 6 | for k, child in pairs (gui_element.children) do 7 | deregister_gui_internal(child, data) 8 | end 9 | end 10 | 11 | util.deregister_gui = function(gui_element, data) 12 | local player_data = data[gui_element.player_index] 13 | if not player_data then return end 14 | deregister_gui_internal(gui_element, player_data) 15 | end 16 | 17 | util.register_gui = function(data, gui_element, param) 18 | local player_data = data[gui_element.player_index] 19 | if not player_data then 20 | data[gui_element.player_index] = {} 21 | player_data = data[gui_element.player_index] 22 | end 23 | player_data[gui_element.index] = param 24 | end 25 | 26 | util.gui_action_handler = function(event, data, functions) 27 | error("don't actually use me") 28 | if not data then error("Gui action handler data is nil") end 29 | if not functions then error("Gui action handler functions is nil") end 30 | local element = event.element 31 | if not (element and element.valid) then return end 32 | local player_data = data[event.player_index] 33 | if not player_data then return end 34 | local action = player_data[element.index] 35 | if action then 36 | functions[action.type](event, action) 37 | return true 38 | end 39 | end 40 | 41 | util.center = function(area) 42 | return {x = (area.left_top.x + area.right_bottom.x) / 2, y = (area.left_top.y + area.right_bottom.y) / 2} 43 | end 44 | 45 | util.distance = function(p1, p2) 46 | return (((p1.x - p2.x) ^ 2) + ((p1.y - p2.y) ^ 2)) ^ 0.5 47 | end 48 | 49 | util.radius = function(area) 50 | return util.distance(area.right_bottom, area.left_top) / 2 51 | end 52 | 53 | util.clear_item = function(entity, item_name) 54 | if not (entity and entity.valid and item_name) then return end 55 | entity.remove_item{name = item_name, count = entity.get_item_count(item_name)} 56 | end 57 | 58 | util.copy = util.table.deepcopy 59 | 60 | util.first_key = function(map) 61 | local k, v = next(map) 62 | return k 63 | end 64 | 65 | util.first_value = function(map) 66 | local k, v = next(map) 67 | return v 68 | end 69 | 70 | util.angle = function(position_1, position_2) 71 | local d_x = (position_2[1] or position_2.x) - (position_1[1] or position_1.x) 72 | local d_y = (position_2[2] or position_2.y) - (position_1[2] or position_1.y) 73 | return math.atan2(d_y, d_x) 74 | end 75 | 76 | return util 77 | -------------------------------------------------------------------------------- /script/unit_deployment.lua: -------------------------------------------------------------------------------- 1 | 2 | 3 | local script_data = 4 | { 5 | machines = {}, 6 | tick_check = {} 7 | } 8 | 9 | local names = names.deployers 10 | local units = names.units 11 | 12 | local deployer_map 13 | 14 | local get_deployer_map = function() 15 | if deployer_map then 16 | return deployer_map 17 | end 18 | deployer_map = {} 19 | for name, prototype in pairs (game.item_prototypes["select-units"].entity_filters) do 20 | if prototype.crafting_speed then 21 | deployer_map[name] = true 22 | end 23 | end 24 | return deployer_map 25 | end 26 | 27 | local unit_spawned_event 28 | 29 | local direction_enum = { 30 | [defines.direction.north] = {0, -1}, 31 | [defines.direction.south] = {0, 1}, 32 | [defines.direction.east] = {1, 0}, 33 | [defines.direction.west] = {-1, 0} 34 | } 35 | 36 | local deploy_unit = function(source, prototype, count) 37 | if not (source and source.valid) then return end 38 | local direction = source.direction 39 | local offset = direction_enum[direction] 40 | local name = prototype.name 41 | local deploy_bounding_box = prototype.collision_box 42 | local bounding_box = source.bounding_box 43 | local offset_x = offset[1] * ((bounding_box.right_bottom.x - bounding_box.left_top.x) / 2) + ((deploy_bounding_box.right_bottom.x - deploy_bounding_box.left_top.x) / 2) 44 | local offset_y = offset[2] * ((bounding_box.right_bottom.y - bounding_box.left_top.y) / 2) + ((deploy_bounding_box.right_bottom.y - deploy_bounding_box.left_top.y) / 2) 45 | local position = {source.position.x + offset_x, source.position.y + offset_y} 46 | local surface = source.surface 47 | local force = source.force 48 | local deployed = 0 49 | local can_place_entity = surface.can_place_entity 50 | local find_non_colliding_position = surface.find_non_colliding_position 51 | local create_entity = surface.create_entity 52 | for k = 1, count do 53 | if not surface.valid then break end 54 | if not source.valid then break end 55 | local deploy_position = can_place_entity{name = name, position = position, direction = direction, force = force, build_check_type = defines.build_check_type.manual} and position or find_non_colliding_position(name, position, 0, 1) 56 | local unit = create_entity{name = name, position = deploy_position, force = force, direction = direction, raise_built = true} 57 | if unit and unit.valid then 58 | script.raise_event(unit_spawned_event, {entity = unit, spawner = source}) 59 | end 60 | deployed = deployed + 1 61 | end 62 | return deployed 63 | end 64 | 65 | local no_recipe_check_again = 300 66 | local check_deployer = function(entity) 67 | if not (entity and entity.valid) then return end 68 | --game.print("Checking entity: "..entity.name) 69 | local recipe = entity.get_recipe() 70 | if not recipe then 71 | --No recipe, so lets check this guy again in some ticks 72 | local check_tick = game.tick + no_recipe_check_again 73 | script_data.tick_check[check_tick] = script_data.tick_check[check_tick] or {} 74 | script_data.tick_check[check_tick][entity.unit_number] = entity 75 | return 76 | end 77 | local progress = entity.crafting_progress 78 | local speed = entity.crafting_speed --How much energy per second 79 | local remaining_ticks = 1 + math.ceil(((recipe.energy * (1 - progress)) / speed) * 60) 80 | local check_tick = game.tick + remaining_ticks 81 | script_data.tick_check[check_tick] = script_data.tick_check[check_tick] or {} 82 | script_data.tick_check[check_tick][entity.unit_number] = entity 83 | 84 | local inventory = entity.get_inventory(defines.inventory.assembling_machine_output) 85 | local contents = inventory.get_contents() 86 | local entities = game.entity_prototypes 87 | for name, count in pairs (contents) do 88 | --Simplified way for now, maybe map item to entity later... 89 | local prototype = entities[name] 90 | if prototype then 91 | deployed_count = deploy_unit(entity, prototype, count) 92 | if deployed_count > 0 and entity.valid then 93 | entity.remove_item{name = name, count = deployed_count} 94 | end 95 | end 96 | end 97 | 98 | end 99 | 100 | local on_built_entity = function(event) 101 | local entity = event.created_entity or event.entity or event.destination 102 | if not (entity and entity.valid) then return end 103 | if not (get_deployer_map()[entity.name]) then return end 104 | script_data.machines[entity.unit_number] = entity 105 | check_deployer(entity) 106 | end 107 | 108 | local on_tick = function(event) 109 | local entities = script_data.tick_check[event.tick] 110 | if not entities then return end 111 | for unit_number, entity in pairs (entities) do 112 | if entity.valid then 113 | check_deployer(entity) 114 | else 115 | entities[unit_number] = nil 116 | end 117 | end 118 | script_data.tick_check[event.tick] = nil 119 | end 120 | 121 | local unit_deployment = {} 122 | 123 | unit_deployment.events = 124 | { 125 | [defines.events.on_built_entity] = on_built_entity, 126 | [defines.events.on_robot_built_entity] = on_built_entity, 127 | [defines.events.script_raised_built] = on_built_entity, 128 | [defines.events.script_raised_revive] = on_built_entity, 129 | [defines.events.on_entity_cloned] = on_built_entity, 130 | [defines.events.on_tick] = on_tick 131 | } 132 | 133 | unit_deployment.on_init = function() 134 | global.unit_deployment = global.unit_deployment or script_data 135 | end 136 | 137 | unit_deployment.on_load = function() 138 | script_data = global.unit_deployment 139 | local control_events = remote.call("unit_control", "get_events") 140 | unit_spawned_event = control_events.on_unit_spawned 141 | end 142 | 143 | return unit_deployment -------------------------------------------------------------------------------- /shared.lua: -------------------------------------------------------------------------------- 1 | --Shared data interface between data and script, notably prototype names. 2 | 3 | local data = {} 4 | 5 | data.hotkeys = 6 | { 7 | shoo = "shoo" 8 | } 9 | 10 | data.units = 11 | { 12 | tazer_bot = "tazer-bot", 13 | blaster_bot = "blaster-bot", 14 | laser_bot = "laser-bot", 15 | plasma_bot = "plasma-bot", 16 | smg_guy = "smg-guy", 17 | rocket_guy = "rocket-guy", 18 | scout_car = "scout-car", 19 | shell_tank = "shell-tank", 20 | } 21 | 22 | data.technologies = 23 | { 24 | iron_units = "iron-units", 25 | iron_units_damage = "iron-units-damage", 26 | circuit_units = "circuit-units", 27 | circuit_units_damage = "circuit-units-damage", 28 | } 29 | 30 | data.deployers = 31 | { 32 | iron_unit = "iron-unit-deployer", 33 | circuit_unit = "circuit-unit-deployer" 34 | } 35 | 36 | return data 37 | -------------------------------------------------------------------------------- /thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Klonan/Total_Automization/aa61e009449416e1b2da1c9ae06eebcfc2367a30/thumbnail.png --------------------------------------------------------------------------------