private void OnEntityKill(VehicleModuleEngine module) { var engineStorage = GetEngineStorage(module); if (engineStorage == null) { return; } if (!IsLocked(engineStorage)) { return; } // Kill the inventory to remove all items. engineStorage.inventory.Kill(); }
private object OnVehicleModuleMove(VehicleModuleEngine module) { var engineStorage = GetEngineStorage(module); if (engineStorage == null) { return(null); } if (!IsLocked(engineStorage)) { return(null); } // Return true to force the module to be moved even though it probably has items. // The items will be removed in the OnEntityKill hook. return(true); }
private void SetInternalDamageMultiplier(VehicleModuleEngine engineModule) { NextTick(() => { if (engineModule == null) { return; } var engineStorage = engineModule.GetContainer() as EngineStorage; if (engineStorage == null) { return; } if (!MultiplierChangeWasBlocked(engineStorage, _pluginConfig.DurabilityLossMultiplier)) { engineStorage.internalDamageMultiplier = _pluginConfig.DurabilityLossMultiplier; } }); }
private void OnEntitySpawned(VehicleModuleEngine module) { // Delaying is necessary since the storage container is created immediately after this hook is called. NextTick(() => MaybeUpdateEngineModule(module, dropExistingParts: false)); }
private void OnEntitySpawned(VehicleModuleEngine engineModule) => SetInternalDamageMultiplier(engineModule);