[MOD 0.14] AAI Programmable Structures

Topics and discussion about specific mods
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 716
Joined: Sun Nov 23, 2014 11:57 am
Contact:

[MOD 0.14] AAI Programmable Structures

Post by Earendel »

programmable-structures.png
programmable-structures.png (27.27 KiB) Viewed 76975 times
Title: AAI Programmable Structures
Short Description: Adds scanning and control structures based on other mods installed. Includes a Tile Scanner by default that can the contents of tiles. Can scan and place Zones with AAI Zones mod. Can scan and control vehicles and their data with AAI Programmable Vehicles mod.
Name: aai-programmable-structures
Factorio Version: 0.14
Mod State: Beta
Dependencies: Base, AAI Signals, AAI Zones
Author: Earendel
Downloads: Mod Portal
Licence: See below
unit-scanner.gif
unit-scanner.gif (576.38 KiB) Viewed 76975 times
Long Description
The Programmable Structures mod allows you to automate your base in ways not normally possible in Factorio. The structures are mainly focussed on scanning data from the world, or using that data to make changes to your base or vehicle behavior. Programmable Structures was developed for AAI Programmable Vehicles mod, but can be a very useful addition to any factory.

Structures

Image Tile Scanner
The tile scanner scans a single tile and returns the contents of that tile as signals. It can be used to give your base an awareness of it’s surroundings.
Inputs
  • Distance Signal: The scanner will scan a random tile within the specified distance of itself. Useful for finding resources and enemy bases.
  • X-Tile and Y-Tile: The scanner will scan the tile at the specified XY coordinate.
  • X-Tile and Y-Tile + Distance Signal: The scanner will scan a random tile within the specified distance of the specified XY coordinate.
Outputs
  • The X-Tile and Y-Tile actually scanned. (plus corresponding SubX and SubY Signals)
  • Land Signal or Water Signal depending on whether there is land or water.
  • Enemy Unit Signal, Enemy Turret Signal, or Enemy Spawner Signal if there is an enemy of that type at the location.
  • A resource signal. If there is a minable resource it will return the mineable result (Raw Wood from Trees, etc).
  • The item required to build any structures at the location (roboport, assembly machine, etc).
  • Unit ID Signal (requires AAI Programmable Vehicles) if scanning a tile with a controlled unit.

Image Zone Scanner: (Requires AAI Zones)
The Zone Scanner allows you to get the position of the nth zone tile placed of a certain type. Zones placed with the Zone Planner tool and Zone Controller are part of the same list. If zone tiles are removed from the list all the other tile indexes are updated. As long as there is at least 1 zone tile then there will always be a valid zone at index 1 (and -1).
Inputs
  • Any Zone Signal, e.g: Zone Box Blue 5, or Zone Circle Red -1
  • The count specified in the Zone Signal determines which zone tile is scanned. 1 means the first zone tile of that type that was placed. 5 means the 5th tile that was placed. -1 means the last (most recently) placed tile. If you specify a tile out of range then no tile is returned.
Outputs
  • Count-Of-Type signal. The value is the number of zone tiles of that type that currently exist. Useful for looping through tiles.
  • Zone Signal of the zone type scanned. The count is the zone index scanned. This will usually be the same as the input count unless you used a negative number.
  • The X-Tile and Y-Tile actually scanned. (plus corresponding SubX and SubY Signals)

Image Zone Controller: (Requires AAI Zones)
The Zone Controller allows you to place zone tiles automatically by feeding in X-Tile and Y-Tile coordinate signals and the type of zone you would like to place. It can also be used to clear zones if a position is specified with no zone to add. Some example uses:
Paint a trail under a player as the player runs around. The trail zone tiles are in order, meaning that you could cause something to follow the player’s exact path by following the tiles in order.
Put zones of different types under different types of resources. You can then scan those zones to get the locations of resources more quickly (for mining vehicles or blueprints stamping down mining drills)
Put attack zones near enemy bases.
Add and remove zones near railway crossings so the other things (vehicles) can react to the current zone situation.
Inputs
  • X-Tile and Y-Tile: Clears zones from the target tile (only affects your force).
  • X-Tile and Y-Tile + A Zone Signal (e.g: Zone Box Cyan or Zone Disc Yellow): Creates a Zone Tile of the specified type at the specified XY location.

Image Unit Scanner: (Requires AAI Programmable Vehicles)
Allows you to scan a specific vehicle, unit or player using it’s current ID within the list of alive units of that type. ID signals for units and vehicles are automatically generated based on active mods and can be found in the Signals tab. You can do things like check a unit’s location, speed, inventory items, health, combat status, etc. To scan a player input the Player Signal matching the player’s player_index. If you use the Player Cursor Signal, then the position returned will be the position of something that the player’s cursor is hovering over, or the player’s position if there is nothing at the cursor’s location.
Inputs
  • Vehicle/Unit ID signal (in Signals Tab): The type of vehicle chosen and the count specified determines which vehicle is scanned in order of deployment. Negative values are in reverse order. E.g: Miner 1 means the 1st Miner placed. Chaingunner 5 means the 5th Chaingunner placed. Hauler -1 means the most recently placed Hauler.
  • Player Signal or Player Cursor Signal: The count input defines which player is scanned based on the player’s player_index. In single-player use Player Signal 1. The Cursor version is the same but the position returned is different IF the player cursor is hovering over something selectable (there’s no way to constantly get the cursor position).
Outputs
  • Count-Of-Type: The number of vehicles currently deployed of the specified type. Useful for looping. This value is returned even if there is no vehicle found at the specified index.
  • Vehicle/Unit ID signal: The Type and ID actually scanned. This will usually be the same as the input count unless you used a negative number.
  • Speed Signal
  • Angle Signal (0 and 360 are North, 90 is East, 180 is South, 270 is West)
  • X-Tile and Y-Tile of the vehicle’s position.
  • Sub-X-Tile and Sub-Y-Tile of the vehicle’s position. (100 * the X and Y Tile values).
  • Health Signal (the absolute health)
  • Energy Signal (the internal power buffer)
  • Time Since Moved Signal: Number of ticks since the vehicle changed tile. If this value is high it is probably stuck or idle.
  • Time Since Target Locked: Number of ticks since the vehicle locked onto a target. If this value is low it is probably in combat.
  • Time Since Last Command: Number of ticks since the vehicle was last given a command, either by the Remote Control tool or by a Unit Controller. Can be used to delay subsequent orders.
  • Item signals for any items that are in the vehicles inventory, fuel inventory, or ammo inventory. Can be used to help automate Haulers to collect resources or supply fuel and ammo.
  • Inventory Slot Signal for the number of empty inventory slots.
  • The type of Zone under the vehicle’s tile (if any). Useful for making a waypoint system, train crossing, zone-based roads, etc.

Image Unit Controller: (Requires AAI Programmable Vehicles)
Allows you to set a command to a vehicle/unit.
Inputs
  • Vehicle/Unit ID signal (in Signals Tab): The type of vehicle chosen and the count specified determines which vehicle is scanned in order of deployment. Negative values are in reverse order. E.g: Miner 1 means the 1st Miner placed. Chaingunner 5 means the 5th Chaingunner placed. Hauler -1 means the most recently placed Hauler.
  • Vehicle/Unit ID + Angle Signal: The vehicle rotates to the specified Angle.
  • Vehicle/Unit ID + Angle Signal + Speed: The vehicle rotates to the specified Angle and tries to match the specified speed.
  • Vehicle/Unit ID + (Sub-X-Tile and/or Sub-Y-Tile): The Sub-XY tile offset is converted to an angle and speed. Sub-X-Tile 1 and Sub-Y-Tile 1 means go South East VERY slowly. Sub-X-Tile -1000 and Sub-Y-Tile 500 means go West-South-West quickly. If you can get the Sub-XY positions of two objects you can subtract them to get the Sub-XY difference between them. If you use these values as your command signal it will make the vehicle go directly towards (or away from) the target.
  • Vehicle/Unit ID + (Sub-X-Tile and/or Sub-Y-Tile) + Speed: The Sub-XY offset is used to determine angle, but the Speed Signal overrides the desired speed.
  • Vehicle/Unit ID + (X-Tile and/or Tile): If X or Y is unspecified then 0 is assumed. The vehicle is sent a command to get to the specified XY tile. It uses biter pathfinding to do this (same as the Remote Control tool) so it can be a bit derpy. If you set repeated commands to the same location the subsequent ones will be ignored until a different location is specified.

Image Unit Data Scanner: (Requires AAI Programmable Vehicles)
Unit Data is used for automatic inventory transfer (see Programmable Vehicles for more details). You can also use Unit Data to store information on a unit or vehicle and the Unit Data Scanner allows you to access that information.
Inputs:
  • Vehicle/Unit ID signal (in Signals Tab): The type of vehicle chosen and the count specified determines which vehicle is scanned in order of deployment. Negative values are in reverse order. E.g: Miner 1 means the 1st Miner placed. Chaingunner 5 means the 5th Chaingunner placed. Hauler -1 means the most recently placed Hauler.
Outputs:
  • Count-Of-Type: The number of vehicles currently deployed of the specified type. Useful for looping. This value is returned even if there is no vehicle found at the specified index.
  • Vehicle/Unit ID signal: The Type and ID actually scanned. This will usually be the same as the input count unless you used a negative number.
  • Any signals stored in the vehicle. Note: This is not affected by vehicle’s inventory or current state.

Image Unit Data Controller: (Requires AAI Programmable Vehicles)
Unit Data is used for automatic inventory transfer (see Programmable Vehicles for more details). The Unit Data Controller allows you to overwrite a vehicle’s Unit Data at any time. If you use this on a vehicle it completely replaces ALL of the vehicle’s existing unit data, so if you want to modify the existing values use the Unit Data Scanner to get the current data, make some changes, then feed that info into the Unit Data Controller. Also be aware that setting signals that are Item Signals will affect the automatic inventory transfer system, but virtual signals will not. If you need to store things like quads or resource zone assignments you are better off using letters, numbers, or zone signals.
Inputs:
  • Vehicle/Unit ID signal (in Signals Tab): The type of vehicle chosen and the count specified determines which vehicle is scanned in order of deployment. Negative values are in reverse order. E.g: Miner 1 means the 1st Miner placed. Chaingunner 5 means the 5th Chaingunner placed. Hauler -1 means the most recently placed Hauler.
  • + Any signals you want to store in the vehicle.
    Note: Vehicle/Unit ID signals and Count-Of-Type signals cannot be saved to unit data.
Image Vehicle Deployer: (Requires AAI Programmable Vehicles)
Any car-type items placed in the deployer are deployed (turned from an item into an actual vehicle) and conveyored out of the building. You can place transport belt under the output conveyor so it can be carried somewhere for fueling, ammo loading, etc. IF you connect the structure to a circuit network then any input signals are saved to the vehicle’s Unit Data (see Programmable Vehicles for more details). This means that you can deploy a Hauler that will only accept a certain type of resource (for dedicated unloading depots), or deploy vehicles with a squad identifier (e.g: “A”).

Coming Soon
Blueprint Controller
Supply a Blueprint, a X-Tile and Y-Tile, and an angle (optional - snaps to nearest of 4 directions). The blueprint is stamped down at the target location.

Notes
For performance reasons only a certain number of programmable structures are processed each tick. This means that as you place down more structures they work more slowly. This is intentional and promotes using fewer structures in more intelligent ways. If you need to you can change this number by editing the max_structs_per_tick = 10 value to something higher.

Licence
Attachments
zone-scan.png
zone-scan.png (5.73 KiB) Viewed 76949 times
zone-control.png
zone-control.png (5.13 KiB) Viewed 76949 times
vehicle-deployer.png
vehicle-deployer.png (2.96 KiB) Viewed 76949 times
unit-scan.png
unit-scan.png (5.73 KiB) Viewed 76949 times
unitdata-scan.png
unitdata-scan.png (5.73 KiB) Viewed 76949 times
unitdata-control.png
unitdata-control.png (5.15 KiB) Viewed 76949 times
unit-control.png
unit-control.png (5.15 KiB) Viewed 76949 times
tile-scan.png
tile-scan.png (5.72 KiB) Viewed 76949 times
Last edited by Earendel on Tue Dec 20, 2016 8:33 pm, edited 2 times in total.
Danielv123
Inserter
Inserter
Posts: 48
Joined: Sun Jan 03, 2016 10:28 am
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by Danielv123 »

Whoa.

Thats some awesome textures, they look gorgeous! Was just chatting on IRC about the creation of such a mod, and then this...
miturion
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Mon Aug 03, 2015 5:46 pm
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by miturion »

I agree, AAI mods are awesome. I just stumbled upon them.
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 716
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by Earendel »

Version 2.1 has been released. Anyone updating to this version that is also running AAI Programmable Vehicles should update that mod to version 0.2.1. The main difference for the Structures mod is that the Vehicle Deployer has changed a bit. It now has a built-in combinator to the bottom-right. The graphic will be there but you will need to remove and replace the entity for the sub-entity to spawn properly.
Kn9z
Manual Inserter
Manual Inserter
Posts: 1
Joined: Mon Jan 16, 2017 7:57 pm
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by Kn9z »

I have experienced this problem!
Attachments
Безымянный.png
Безымянный.png (552.8 KiB) Viewed 74260 times
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 716
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by Earendel »

Kn9z wrote:I have experienced this problem!
Thanks. The problem is fixed in aai-programmable-vehicles_0.2.2
jymres
Manual Inserter
Manual Inserter
Posts: 3
Joined: Thu Jan 19, 2017 5:36 pm
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by jymres »

Not sure which forum this should be in, but this one seems to contain the majority of what appears to be missing, I have structures 0.2.2, vehicles 0.2.2, signals 0.1.3, zones 0.1.5, hauler 0.1.1 and miner 0.1.6. All seems to be great although it appears I am missing the following list of items even after reaching max research:

Unit Scanner: (Requires AAI Programmable Vehicles)
Unit Controller: (Requires AAI Programmable Vehicles)
Unit Data Scanner: (Requires AAI Programmable Vehicles)
Vehicle Deployer: (Requires AAI Programmable Vehicles)
Vehicle Depot

Now not sure if this is due to a conflict with other mods or maybe 1 zip or the other isn't loading correctly. I am going to subfolder everything except AAI mods to see if it's a conflict and try to pinpoint which one. but if you read this post and know the issue, please let me know.

Will update/add if I find the issue.

(EDIT) -
OK after removing all mods except everything that is AAI-**** it appears that AAI Programmable Vehicles isn't loading when I open Factorio, any suggestions?

backdated to AAI Programmable Vehicles 0.2.1 and this mod doesn't appear to be loading either.
I am only getting structures - Tile Scanner, Zone Scanner & Zone Controller. (Hauler, Miner & Zones appear to be loading and working)

Factorio 0.14.21.25327 - File path - C:\Program Files\Factorio\bin\x64 (If this helps)
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by Nexela »

You are missing some dependencies


in the mod selection screen, select the AAI program vehicles mod, Any dependency in red without a ? mark in front of it is required.

Here is the list of required dependcies:

"base >= 0.14.21",
"data-raw-prototypes >= 0.1.1",
"aai-programmable-structures >= 0.2.1",
"aai-zones >= 0.1.3",
"detached-gun-sounds >= 0.1.1",
"off-grid-effects >= 0.1.1",
"aai-signals >= 0.1.2",
"aai-vehicles-miner >= 0.1.3",
"aai-vehicles-hauler >= 0.1.1",
jymres
Manual Inserter
Manual Inserter
Posts: 3
Joined: Thu Jan 19, 2017 5:36 pm
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by jymres »

Nexela wrote:You are missing some dependencies


in the mod selection screen, select the AAI program vehicles mod, Any dependency in red without a ? mark in front of it is required.

Here is the list of required dependcies:

"base >= 0.14.21",
"data-raw-prototypes >= 0.1.1",
"aai-programmable-structures >= 0.2.1",
"aai-zones >= 0.1.3",
"detached-gun-sounds >= 0.1.1",
"off-grid-effects >= 0.1.1",
"aai-signals >= 0.1.2",
"aai-vehicles-miner >= 0.1.3",
"aai-vehicles-hauler >= 0.1.1",
This was exactly the issue, appreciate the help, I only started Factorio like a a week or 2 ago and so far it's amazing and the mods make it even more fun.

Now to figure out how to make it all work.. xD
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 716
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by Earendel »

jymres wrote:Now to figure out how to make it all work.. xD
I'm glad it's working for you now. Good luck :D
kulg
Burner Inserter
Burner Inserter
Posts: 8
Joined: Fri Feb 03, 2017 10:00 pm
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by kulg »

Bug report. Playing with bob's mods and I followed the top instructions to a T but keep getting the same error. Error while running event on_tick (ID 0)
__aai-programmable-structures__/control.lua:899: attempt to index field 'aai-programmable-vehicles' (a nil value) (screenshot of error provided.)

I tried removing the power until everything had been placed then providing power to the whole set up at once but that only delayed the error. it seems to happen whenever I connect to constant combinator with that signal to the tile scanner that it messes everything up.
Attachments
Capture.PNG
Capture.PNG (64.62 KiB) Viewed 72893 times
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 716
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by Earendel »

kulg wrote:Bug report. Playing with bob's mods and I followed the top instructions to a T but keep getting the same error. Error while running event on_tick (ID 0)
__aai-programmable-structures__/control.lua:899: attempt to index field 'aai-programmable-vehicles' (a nil value) (screenshot of error provided.)

I tried removing the power until everything had been placed then providing power to the whole set up at once but that only delayed the error. it seems to happen whenever I connect to constant combinator with that signal to the tile scanner that it messes everything up.
Do you have AAI Programmable Vechiles installed too or is it just AAI Programmable Structures?
Shadus
Burner Inserter
Burner Inserter
Posts: 7
Joined: Mon Mar 06, 2017 8:24 am
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by Shadus »

Unit Scanner (and potentially the other structures as well, I haven't tested) cannot be repaired. I get "This cannot be mined." when attempted to use a repair pack on it.
Mobius1
Fast Inserter
Fast Inserter
Posts: 191
Joined: Thu Feb 09, 2017 12:05 am
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by Mobius1 »

Hello Earendel

I tried to manipulate the Ion Cannon to strike on biters' structures but so far no luck, can't make it target a zone location seems that I'm supplying the wrong signal or maybe its not supported.

Is this a thing that you can solve or should I contact the dev of Ion Cannon mod?

Thanks in advance for this awesome RTS/Factorio mod.
DJTomKid
Manual Inserter
Manual Inserter
Posts: 1
Joined: Tue Mar 21, 2017 10:46 pm
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by DJTomKid »

Hello Earendel,

is it possible that the tile scanner does not detect RSO-Mod?

EDIT: Found the solution...I build the tile scanner in a Factorissimo building and the coordinates were messed up.
Assassain33
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Aug 05, 2016 6:54 am
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by Assassain33 »

Earendel wrote:
kulg wrote:Bug report. Playing with bob's mods and I followed the top instructions to a T but keep getting the same error. Error while running event on_tick (ID 0)
__aai-programmable-structures__/control.lua:899: attempt to index field 'aai-programmable-vehicles' (a nil value) (screenshot of error provided.)

I tried removing the power until everything had been placed then providing power to the whole set up at once but that only delayed the error. it seems to happen whenever I connect to constant combinator with that signal to the tile scanner that it messes everything up.
Do you have AAI Programmable Vechiles installed too or is it just AAI Programmable Structures?
Had the same issue, most likely cause is that the dependencies were missed. Just check the Mods tab. If it's red, then it's missing dependencies most likely.
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 716
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by Earendel »

Assassain33 wrote:
Earendel wrote:
kulg wrote:Bug report. Playing with bob's mods and I followed the top instructions to a T but keep getting the same error. Error while running event on_tick (ID 0)
__aai-programmable-structures__/control.lua:899: attempt to index field 'aai-programmable-vehicles' (a nil value) (screenshot of error provided.)

I tried removing the power until everything had been placed then providing power to the whole set up at once but that only delayed the error. it seems to happen whenever I connect to constant combinator with that signal to the tile scanner that it messes everything up.
Do you have AAI Programmable Vechiles installed too or is it just AAI Programmable Structures?
Had the same issue, most likely cause is that the dependencies were missed. Just check the Mods tab. If it's red, then it's missing dependencies most likely.
Did the error mention aai-programmable-vehicles again? Because I thought I'd fixed the previous issue so presumably that means that either I didn't fix it or something similar is cropping up somewhere else.

Oh also, scanners scan their own surface. If it's in a Factorissimo it will only be able to scan in that building.
kh204745
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Mar 17, 2017 5:30 am
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by kh204745 »

Noticed all the other AAI mods got updated to 0.15. When can we expect this one to be updated? Programmable vehicles seem to have this as a dependency so I'm not sure how that one updated before this one. That must mean this one is already done and just didn't get uploaded?

EDIT: Thanks for updating so quickly :)
User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 716
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by Earendel »

kh204745 wrote:Noticed all the other AAI mods got updated to 0.15. When can we expect this one to be updated? Programmable vehicles seem to have this as a dependency so I'm not sure how that one updated before this one. That must mean this one is already done and just didn't get uploaded?

EDIT: Thanks for updating so quickly :)
I did upload it but the mod portal was being very unreliable at the time. It looked like it had finished but apparently something went wrong.
kh204745
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Mar 17, 2017 5:30 am
Contact:

Re: [MOD 0.14] AAI Programmable Structures

Post by kh204745 »

Earendel wrote:
kh204745 wrote:Noticed all the other AAI mods got updated to 0.15. When can we expect this one to be updated? Programmable vehicles seem to have this as a dependency so I'm not sure how that one updated before this one. That must mean this one is already done and just didn't get uploaded?

EDIT: Thanks for updating so quickly :)
I did upload it but the mod portal was being very unreliable at the time. It looked like it had finished but apparently something went wrong.
Yeah, I can only imagine how many people were trying to upload updated mods all at the same time. Almost every time i refreshed the page, more and more mods were there.
Post Reply

Return to “Mods”