[MOD 0.14] AAI Programmable Vehicles

Topics and discussion about specific mods
Skeleton Man
Inserter
Inserter
Posts: 23
Joined: Fri Jun 02, 2017 1:21 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Skeleton Man »

you can already provide distance and angle signals to a follow unit or player signal to make a custom formation

dgw
Fast Inserter
Fast Inserter
Posts: 197
Joined: Tue Apr 12, 2016 7:06 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by dgw »

I guess it's questionable whether this is a mod issue, but when I removed the AAI mod set from my save (since I wasn't using it this game), Factorio deleted my cars & tanks, including trunk contents (fuel & ammo stockpiles, mostly). I assume this is because AAI replaced the vanilla versions I had built before installing the mods with custom entities (would explain why my tank went from three weapons to one). Not sure if there's anything to be done from the mod side about this (since by the time the mod is deleted, you can't run any migration scripts!), but thought it warranted a mention.

whitecold
Inserter
Inserter
Posts: 46
Joined: Fri May 19, 2017 6:48 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by whitecold »

Something seems wrong with blueprint building. I managed to gather up some virtual objects somehow, and the scanners on my stamped down blueprint don't seem to work.

User avatar
sumdawgy
Inserter
Inserter
Posts: 43
Joined: Wed May 11, 2016 1:01 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by sumdawgy »

sumdawgy wrote: IT worked fine before i got a decider connected to it....hm. :ugeek:
I finally got back into the save.... :oops:
IT WAS the decider...must've been half asleep. I inserted it into the logic flow in an off cycle/tick from the rest of the data. Did it twice...but got lucky with the first one's timing....

thanks guys!

Mobius1
Fast Inserter
Fast Inserter
Posts: 191
Joined: Thu Feb 09, 2017 12:05 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Mobius1 »

Found a bug with Aircraft Mod and AAI PV:
I built an airplane with rocket weapon, placed it down, put "Vehicle Fuel" on it, after it used fully the 2nd unit of fuel, the vehicle just stop completely and didn't want to move again even picking it up and popping it down didn't make it move. The vehicle could turn but not move forward or backwards. Vehicle itself is the Flying Fortress. Tried putting other types of fuel on it and it didn't fill the fuel bar. I installed Electric Vehicles mod, put the electric engine on the plane and then it filled the fuel bar and started to move again.

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 711
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Earendel »

Mobius1 wrote:Found a bug with Aircraft Mod and AAI PV:
I built an airplane with rocket weapon, placed it down, put "Vehicle Fuel" on it, after it used fully the 2nd unit of fuel, the vehicle just stop completely and didn't want to move again even picking it up and popping it down didn't make it move. The vehicle could turn but not move forward or backwards. Vehicle itself is the Flying Fortress. Tried putting other types of fuel on it and it didn't fill the fuel bar. I installed Electric Vehicles mod, put the electric engine on the plane and then it filled the fuel bar and started to move again.
Did you already have the Electric Vehicles mod or did you only install that after the problem started?

Mobius1
Fast Inserter
Fast Inserter
Posts: 191
Joined: Thu Feb 09, 2017 12:05 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Mobius1 »

Earendel wrote:Did you already have the Electric Vehicles mod or did you only install that after the problem started?
After the problem. Also I'm running a shitload of mods:
mods

User avatar
regedit2000
Inserter
Inserter
Posts: 20
Joined: Mon May 23, 2016 4:00 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by regedit2000 »

Earendel wrote:
Mobius1 wrote:Found a bug with Aircraft Mod and AAI PV:
I built an airplane with rocket weapon, placed it down, put "Vehicle Fuel" on it, after it used fully the 2nd unit of fuel, the vehicle just stop completely and didn't want to move again even picking it up and popping it down didn't make it move. The vehicle could turn but not move forward or backwards. Vehicle itself is the Flying Fortress. Tried putting other types of fuel on it and it didn't fill the fuel bar. I installed Electric Vehicles mod, put the electric engine on the plane and then it filled the fuel bar and started to move again.
Did you already have the Electric Vehicles mod or did you only install that after the problem started?
fixed function in control.lua:

Code: Select all

local function consume_fuel_or_equipment (unit)

    if unit.vehicle.grid and unit.vehicle.grid.available_in_batteries > 10000 then
        --Added by Undarl; basic battery fueling logic courtesy of Sirenfal
        ---Modified by the Nexela
		local player = game.players[1]
		player.print("consume_fuel_or_equipment")
        unit.vehicle.burner.currently_burning = high_fuel_item
        local energy_deficit = game.item_prototypes[high_fuel_item].fuel_value - unit.vehicle.burner.remaining_burning_fuel
        local batteries = table.filter(unit.vehicle.grid.equipment, function(v) return v.type == "battery-equipment" end)
		if batteries then player.print("batteries is present(" .. #batteries .. ") energy = " .. unit.vehicle.grid.available_in_batteries) end
        local num_batteries = #batteries
        while num_batteries > 0 and energy_deficit > 0 do
			
            local battery = batteries[num_batteries]
            local energy_used = math.min(battery.energy, energy_deficit)
			player.print("energy_deficit(" .. energy_deficit .. ") energy battery = " .. battery.energy)
			player.print("energy_used(" .. energy_used .. ")")
            battery.energy = battery.energy - energy_used
            unit.vehicle.burner.remaining_burning_fuel = unit.vehicle.burner.remaining_burning_fuel + energy_used
            energy_deficit = energy_deficit - energy_used
            num_batteries = num_batteries - 1
        end
    else
        for _, inv_num in pairs(inv_nums) do
            local inventory = unit.vehicle.get_inventory(inv_num)
            if inventory then
                local contents = inventory.get_contents()
                local fuel_item = get_fuel.item(contents)
                if fuel_item then
                    if inv_num ~= defines.inventory.fuel then
                      if contents[fuel_item.name] > 1 then
                        -- move fuel to fuel inventory
                        unit.vehicle.burner.currently_burning = fuel_item.name
                        unit.vehicle.burner.remaining_burning_fuel = unit.vehicle.burner.remaining_burning_fuel + fuel_item.fuel_value
                        local fuel_inv = unit.vehicle.get_inventory(defines.inventory.fuel)
                        local inserted = fuel_inv.insert{name = fuel_item.name, count = contents[fuel_item.name] -1}
                        if inserted > 0 then
                          inventory.remove({name = fuel_item.name, count = inserted})
                        end
                      else
                        unit.vehicle.burner.currently_burning = fuel_item.name
                        unit.vehicle.burner.remaining_burning_fuel = unit.vehicle.burner.remaining_burning_fuel + fuel_item.fuel_value
                        inventory.remove({name=fuel_item.name, count=1})
                      end
                    else
                      -- burning from correct slot
                      unit.vehicle.burner.currently_burning = fuel_item.name
                      unit.vehicle.burner.remaining_burning_fuel = unit.vehicle.burner.remaining_burning_fuel + fuel_item.fuel_value
                      inventory.remove({name=fuel_item.name, count=1})
                      return true
                    end
                end
            end
        end
    end

end

whitecold
Inserter
Inserter
Posts: 46
Joined: Fri May 19, 2017 6:48 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by whitecold »

My game currently crashes a few moments in this savegame. No entry in the log is detectable, unfortunately. I strongly suspect it is AAI, as some tanks are getting orders right then, but I have no idea how to debug it.
Edit: It does seem to happen when one tank paths into some walls
Attachments
buggedSavegame.zip
(14.06 MiB) Downloaded 104 times

Sworn
Fast Inserter
Fast Inserter
Posts: 167
Joined: Sun Apr 03, 2016 8:10 pm
Contact:

Idle Signal.

Post by Sworn »

Would be possible to add one more signal to the unit scanner reads. An IsIdle signal? so you don't have to "guess" base on the last command or with some math on the X and Y if the last command was done.

Something like a signal that appears as 1 [or total idle time] since the last command was completed (when the unit has stopped all actions like [not shotting, not moving, not mining, or whatever]).

Berkys32
Fast Inserter
Fast Inserter
Posts: 113
Joined: Mon Mar 07, 2016 9:17 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Berkys32 »

How to setup vehicle color? I see colored vehicles on your screens, but cant get it too.

And is there any signal to cancel current order? I wanted to send Speed 0 but than realized its not signal at all, than I tried signal X and Y of that vehicle, but instead of just stop its "moving" on place...

And is there any Discord channel for AAI?

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 711
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Earendel »

regedit2000 wrote: fixed function in control.lua:
Thanks, added.
Sworn wrote:Would be possible to add one more signal to the unit scanner reads. An IsIdle signal? so you don't have to "guess" base on the last command or with some math on the X and Y if the last command was done.

Something like a signal that appears as 1 [or total idle time] since the last command was completed (when the unit has stopped all actions like [not shotting, not moving, not mining, or whatever]).
There is time since last moved and time since last targeted enemy. It's not aware of things like mining or other things that special vehicles do.
Berkys32 wrote:How to setup vehicle color? I see colored vehicles on your screens, but cant get it too.

And is there any signal to cancel current order? I wanted to send Speed 0 but than realized its not signal at all, than I tried signal X and Y of that vehicle, but instead of just stop its "moving" on place...

And is there any Discord channel for AAI?
The API limitation means that the vehicle color can only be changed by a player getting in, there's not much I can do about that.

A speed of 1 or -1 is so slow that it will never actually move (due to pixel snapping) so that's effectively stopped.

There's no discord channel, but I am discord.

Sworn
Fast Inserter
Fast Inserter
Posts: 167
Joined: Sun Apr 03, 2016 8:10 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Sworn »

Earendel wrote:
regedit2000 wrote:
Sworn wrote:Would be possible to add one more signal to the unit scanner reads. An IsIdle signal? so you don't have to "guess" base on the last command or with some math on the X and Y if the last command was done.

Something like a signal that appears as 1 [or total idle time] since the last command was completed (when the unit has stopped all actions like [not shotting, not moving, not mining, or whatever]).
There is time since last moved and time since last targeted enemy. It's not aware of things like mining or other things that special vehicles do.
Could you explain how the [Time since moved tile] is updated? I was making some test with it and build the following setup:

GO: define if an hauler is idle.

Test: At first I tried with the speed signal [speed signal = 0], but some times the vehicle stop during turns [maybe for path finding].
So i tried to combine the [speed] signal with the [Time since moved tile] signal. That seems to work but some times it gave me a false idle hauler.

Setup: First decider output A = 1 when the speed = 0, second decider output A = 1 when [Time since moved tile] > 400. Final the last decider output I = 1 when A = 2.

But sometimes the [Time since moved tile] has pass the 400 before reseting during the path and once it hits more then 1k.

I'm currently using the [Time since moved tile] greater then 1k, but it depends on how the signal is updated.
Last edited by Sworn on Sun Jul 02, 2017 9:20 pm, edited 1 time in total.

Berkys32
Fast Inserter
Fast Inserter
Posts: 113
Joined: Mon Mar 07, 2016 9:17 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Berkys32 »

Signal "Time since moved tile" > 500 seems quite enough for me, even in case it got stuck bcs of tree...

Im not sure what do you mean by "move to tile" signal. You mean go to x/y pos?

Sworn
Fast Inserter
Fast Inserter
Posts: 167
Joined: Sun Apr 03, 2016 8:10 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Sworn »

Berkys32 wrote:Signal "Time since moved tile" > 500 seems quite enough for me, even in case it got stuck bcs of tree...

Im not sure what do you mean by "move to tile" signal. You mean go to x/y pos?

ops, was supposed to be "Time since moved tile", forgot the name of the signal, thanks i'll correct it.

User avatar
Earendel
Factorio Staff
Factorio Staff
Posts: 711
Joined: Sun Nov 23, 2014 11:57 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Earendel »

The movement timer gets reset if the XY tile changes. Subtile changes don't reset it, it has to actually move from 1 square to another on the grid that you see with F5. If a vehicle is slow the timer can get higher. If a vehicle gets nudged by damage it usually won't reset the timer but can if it was on the edge.

Sworn
Fast Inserter
Fast Inserter
Posts: 167
Joined: Sun Apr 03, 2016 8:10 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Sworn »

Got it. thanks that explain why some times it goes really high and some times reset before 10.

buggy123
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Sat May 13, 2017 11:53 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by buggy123 »

Would it be possible to add a setting to toggle the 1-weapon-per-vehicle mechanic? It's possible to disable it by deleting a few bits in entity-update and entity-update-external but its kind of annoying doing it after every update.

Skeleton Man
Inserter
Inserter
Posts: 23
Joined: Fri Jun 02, 2017 1:21 pm
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by Skeleton Man »

how feasable is it to allow vehicles with a color signal or something similar to take on that color on their exterior, similar to how when a player of a particular color is controlling them?

it would be nice to visually organize them

whitecold
Inserter
Inserter
Posts: 46
Joined: Fri May 19, 2017 6:48 am
Contact:

Re: [MOD 0.14] AAI Programmable Vehicles

Post by whitecold »

buggy123 wrote:Would it be possible to add a setting to toggle the 1-weapon-per-vehicle mechanic? It's possible to disable it by deleting a few bits in entity-update and entity-update-external but its kind of annoying doing it after every update.
Which bits exactly have to be deleted? I broke the mod trying to accomplish that.

Post Reply

Return to “Mods”