Trying to get the ModularCar from BaseVehicleModule seems im having issues.
Get ModularCar from BaseVehicleModule?
I would assume just cast to it.
X as ModularCar
X as ModularCar
This works.... butdoes not stop damage to the modules.
object OnEntityTakeDamage(ModularCar Chasse, HitInfo hitinfo)
{
if (Chasse == null) return null;
if (Chasse.GetComponent<rustCar>() != null)
{
Puts("i see this ModularCar");
return false;
}
return null;
}This is not finding the mono but is finding the modularcar.
object OnEntityTakeDamage(BaseVehicleModule Chasse, HitInfo hitinfo)
{
if (Chasse.Vehicle == null) return null;
ModularCar car = Chasse.Vehicle as ModularCar;
if (car != null)
{
rustCar carMono = car.GetComponent<rustCar>();
if (carMono != null)
Puts("i see this 2");
}
return null;
} vehicleModule.Vehicle as ModularCarI do this in various of my plugins. Vehicle Decay Protection is probably the most relevant here since I'm also blocking damage there.
https://umod.org/plugins/vehicle-decay-protection
Not sure what rustCar is, but guessing it's a custom MonoBehavior. If it's not finding it, guessing it's not on the car?