예제 #1
0
        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();
        }
예제 #2
0
        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);
        }
예제 #3
0
        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;
                }
            });
        }
예제 #4
0
 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));
 }
예제 #5
0
 private void OnEntitySpawned(VehicleModuleEngine engineModule) =>
 SetInternalDamageMultiplier(engineModule);