Page MenuHomeFeedback Tracker

Can't remove car battery from BaseRadio (Field Transceiver)
Closed, ResolvedPublic

Description

Currently in 1.25 you cannot remove a car battery once it's placed inside a BaseRadio (Field Transceiver).

I found the issue and solution, just needs a tweaked inventory check -

VehicleBattery.c (which CarBattery inherits from) has some code which prevents the car battery from being interacted with once placed in a BaseRadio attachment slot:

	override bool CanPutIntoHands(EntityAI player)
	{
		if (!super.CanPutIntoHands(parent))
		{
			return false;
		}
		
		if (HasEnergyManager())
		{
			ItemBase poweredDevice = ItemBase.Cast(GetCompEM().GetPluggedDevice());
			if (poweredDevice && poweredDevice.IsInherited(MetalWire)) // This should also check "|| IsInherited(BaseRadio)
			{
				return true;
			}
			else if (poweredDevice)
			{
				return false;
			}
		}

		return true;
	}

	override bool CanPutInCargo(EntityAI parent)
	{
		if (!super.CanPutInCargo(parent))
		{
			return false;
		}
		
		ItemBase poweredDevice = ItemBase.Cast(GetCompEM().GetPluggedDevice());

		return !(poweredDevice && poweredDevice.IsInherited(MetalWire)); // also needs BaseRadio check
	}

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 11 x64
Category
Inventory
Steps To Reproduce

Put any car battery in a Field Transceiver, and you can't take it out.

Additional Information

Base Radio works fine otherwise.. Easy bug to fix, not a big deal, but it does mean that if you place an empty battery into a base radio or the battery drains flat you need to find a whole new base radio and discard the old one.

Event Timeline

Geez closed this task as Resolved.Jul 23 2024, 10:20 AM
Geez claimed this task.
Geez added a subscriber: Geez.

Resolved for 1.26