Something like this in a package:
function PlayerData::onAdd(%this, %obj) {
parent::onAdd(%this, %obj);
if (%this.isTrain) {
PrimeTrainPhysics(%obj,
%this.enableEngine,
%this.drag,
%this.enginePower,
%this.engineMax,
%this.brakes,
%this.startSound,
%this.runSound,
%this.stopSound,
%this.idleSound,
%this.hornSound
);
}
}