It seems I misunderstood this:
Something that I haven't mentioned is that enemy targeting works fine when you're driving in manual, it does exactly what I expect, which is target and shoot at biters. It's when the vehicle is driven autonomously that the issue crops up.
In order to always have the vehicle centered, I've entered the tank but selected a position it should drive to. This still worked as expected. however, with no players inside the tank, a dummy would be created as passenger (as expected) but not be set as shooter. Thus, there were enemies and the vehicle had loaded guns but couldn't shoot, so it panicked.
Please replace lines 452–470 in file scripts/driving.lua:
-- Do nothing if vehicle already has a passenger (dummy or player/character)
if (passenger and passenger.valid) or (dummy and dummy.valid) then
AD.writeDebug("Already have %s passenger!",
{dummy and dummy.valid and "dummy" or "a"})
-- Create dummy
else
AD.writeDebug("Creating dummy passenger!")
dummy = vehicle.surface.create_entity({
name = AD.dummy_passenger_name,
position = vehicle.position,
force = vehicle.force,
})
if dummy and dummy.valid then
vehicle.set_passenger(dummy)
state.occupants = state.occupants or {}
state.occupants.dummy = dummy
end
end
with the following:
-- Do nothing if vehicle already has a passenger (dummy or player/character)
if (passenger and passenger.valid) then
AD.writeDebug("Already have a passenger!")
-- Use existing dummy as passenger
elseif (dummy and dummy.valid) then
AD.writeDebug("Using existing dummy as passenger!")
passenger = dummy
-- Create dummy
else
AD.writeDebug("Creating dummy passenger!")
dummy = vehicle.surface.create_entity({
name = AD.dummy_passenger_name,
position = vehicle.position,
force = vehicle.force,
})
if dummy and dummy.valid then
vehicle.set_passenger(dummy)
passenger = dummy
state.occupants = state.occupants or {}
state.occupants.dummy = dummy
end
end
Does that fix it for you?