Latest version causes an issue for the "Vehicles" plugin on Codefling

I use the Vehicles plugin on Codefling (https://codefling.com/plugins/vehicles) to let players spawn in vehicles. On the mini, and probably the other choppers, the latest version of minicopter options causes the heli to fly briefly, then it shuts off and hits the ground like it's run out of fuel. I have the Vehicles plugin so the vehicles do not need fuel.

Are you sure this is caused by the latest version of the plugin? Have you tried reverting to the previous version to verify? Asking because the latest version only changed the search light.

Yes, I reverted to the previous version and the helis behaved as normal when I did. I haven't had any time to do any real troubleshooting beyond that and won't for at least several days.

I took a look at the latest update and found once minor nuance that could have contributed here, but ultimately it would have just surfaced an incompatibility in more cases rather than created the incompatibility entirely.

If you don't want this plugin to alter fuel consumption in any case, then you can set the fuel per second option to -1 to disable that which will prevent any incompatibility. If you do want to alter/reduce fuel consumption via this plugin for minicopters in general, while player-spawned vehicles require no fuel, that needs to be handled by the plugin that spawned or manages the vehicle. There are multiple technical ways to make a vehicle require no fuel, and some of those ways won't conflict with this plugin. If the author of the other plugin wants to use the way that will have a conflict, they can use the hooks provided by this plugin to achieve compatibility.

Merged post

I took a closer look at the Vehicles plugin documentation and I don't see any explicit option to make a vehicle not require fuel, I only see options to set the fuel required per second (like in MCO). Last I checked, setting fuel per second to 0 still requires the fuel tank to have 1 fuel placed in it to work, so it's not clear to me whether the player is expected to do that or if the plugin is somehow doing it for them.

I also noticed an option in the Vehicles plugin config to lock the fuel container. Presumably, if that option is set, and the fuel per second is 0, the plugin must be automatically adding 1 fuel to the tank. Some other plugins used to work this way, such as the Spawn Heli plugin, which now uses another more reliable approach.

Can you confirm, that you have the option enabled to lock the minicopter fuel container? If so, I can add a check into MCO that prevents the plugin from altering the fuel consumption of a vehicle with a locked fuel container. That should alleviate the conflict without any work from the other developer (bsdinis tends to go dark for periods of time).

Merged post

I've gone ahead and pushed an update to minimize conflicts in the case of locked fuel containers.

I've also messaged bsdinis about this issue. He indicated that he will look into this issue tomorrow.

Sorry I didn't respond earlier. It's been a busy several days. Yes, the heli fuel tanks are locked. I will test the latest version.

My players are reporting this same issue today.  Said it happend approx 4 times today.  I dont ahve any other plugins that interact with the heli besides this one EXCEPT for vehicle deployed locks.  No mods to fuel usage however.  I am running latest version of both plugins.

{
"Fuel per Second": 0.25,
"Lift Fraction": 0.25,
"Pitch Torque Scale": 400.0,
"Yaw Torque Scale": 400.0,
"Roll Torque Scale": 200.0,
"Storage Containers": 1,
"Large Storage Containers": 0,
"Restore Defaults": true,
"Reload Storage": false,
"Drop Storage Loot On Death": true,
"Large Storage Lockable": true,
"Large Storage Size (Max 48)": 48,
"Seconds to pause flyhack when dismount from heli.": 1,
"Add auto turret to heli": false,
"Auto turret uses battery": false,
"Auto turret targets players": true,
"Auto turret targets NPCs": false,
"Auto turret targets animals": false,
"Mini Turret Range (Default 30)": 30.0,
"Light: Add Searchlight to heli": true,
"Light: Add Nightitme Tail Light": true
}

Rockefeller

My players are reporting this same issue today.  Said it happend approx 4 times today.

Can you confirm, you are seeing this exact symptom? "causes the heli to fly briefly, then it shuts off and hits the ground like it's run out of fuel" If so, can you also confirm the helis have fuel in them? Once the helis shut off, can they be restarted?

Yes my players reported the exact same issue.  I was not able to reproduce however.  They stated the heli had fuel, but suddenly become unresponsed and went down.  They work around they found was to remove fuel and reinsert and heli would be operational again.  Howerver it happened again a few times more throughout the night.

Merged post

They also stated hte fuel gauge would show empty even tho there was fuel in it.  Again, remove fuel, reinsert, then back to normal.

Merged post

Also just an FYI the mini was purchased at the Outpost vendor, not spawned in.

Also, maybe worth noting, I jsut checked their mini and they dont have a lock on it.  I have a lock on my mini and have not had this problem yet.

That's interesting. I've looked extensively through the Rust code regarding this, and I don't see any way this plugin could be causing that behavior, as the fuelPerSec property adjusted by this plugin has no relationship to how the game locates the fuel item or displays fuel status.

As for what could be happening, re-inserting the fuel item resets the vehicle's nextFuelCheckTime, forcing re-evaluation of whether the vehicle has fuel. If the vehicle is considered out of fuel, and the nextFuelCheckTime is set to the distance future, the heli wouldn't be usable until somebody re-inserts fuel. However, this scenario isn't possible without plugins because the game sets nextFuelCheckTime to at most 2 seconds in the future each time it checks fuel. Some plugins do set nextFuelCheckTime as a means of either providing unlimited fuel (after setting cachedHasFuel to true) or to optimize performance by checking fuel less often. I recommend you search the code of all your plugins for keywords such as nextFuelCheckTime, cachedHasFuel, OnFuelCheck, OnFuelAmountCheck, OnFuelItemCheck, CanUseFuel to narrow it down.

Thanks for looking into it!

Now that I think about it the only plugin that I have that has the ability to effect fuel usage is Skill Trees.  I looked through the data files for the players in question and none of those players have those particular Skill Trees that effect mini fuel usages learned.

That being said looking into the SkillTree.cs and parsing for the above keywords the only one that hit was nextFuelCheckTime

void ModifyHeliFuelRate(PlayerHelicopter mini, float value)
{
if (mini.fuelPerSec < 0.5f) return;
var fuelSystem = mini.GetFuelSystem() as EntityFuelSystem;
if (fuelSystem == null || fuelSystem.nextFuelCheckTime == float.MaxValue || fuelSystem.GetFuelContainer().HasFlag(BaseEntity.Flags.Locked)) return;
if (tracked_helis.ContainsKey(mini.net.ID.Value)) return;
tracked_helis.Add(mini.net.ID.Value, mini);
var fuel_rate = default_heli_fuel_rate - (default_heli_fuel_rate * value);
mini.fuelPerSec = fuel_rate;
}

void ModifyBoatFuelRate(MotorRowboat boat, BasePlayer player, float value)
{
if (boat is RHIB)
{
if (boat.fuelPerSec < 0.25f) return;

var fuelSystem = boat.GetFuelSystem() as EntityFuelSystem;
if (fuelSystem == null || fuelSystem.nextFuelCheckTime == float.MaxValue || fuelSystem.GetFuelContainer().HasFlag(BaseEntity.Flags.Locked)) return;

if (tracked_rhibs.ContainsKey(boat.net.ID.Value)) return;
tracked_rhibs.Add(boat.net.ID.Value, boat);
var fuel_rate = default_rhib_fuel_rate - (default_rhib_fuel_rate * value);
boat.fuelPerSec = fuel_rate;
}
else
{
if (boat.fuelPerSec < 0.1f) return;

var fuelSystem = boat.GetFuelSystem() as EntityFuelSystem;
if (fuelSystem == null || fuelSystem.nextFuelCheckTime == float.MaxValue || fuelSystem.GetFuelContainer().HasFlag(BaseEntity.Flags.Locked)) return;

if (tracked_rowboats.ContainsKey(boat.net.ID.Value)) return;
tracked_rowboats.Add(boat.net.ID.Value, boat);
var fuel_rate = default_rowboat_fuel_rate - (default_rowboat_fuel_rate * value);
boat.fuelPerSec = fuel_rate;
}

Skill Tree is only reading nextFuelCheckTime, not updating it, so it can't cause this problem. The reason Skill Tree does this is to avoid messing with helicopters that are supposed to have unlimited fuel.

I don't have any further ideas on what would be causing the issue.

Right on well I appriciate you looking into it.  Until I can recreate the problem myself Im gonna choke it up to players being dumb