/// <summary> /// Overrideable OnEnter method from the original state. Always call base.OnEnter. Initialize values at runtime here. /// To perform the death behavior specified in OnImpactServer, destroyOnImpact must be set to true. /// This method already does that so long as base.OnEnter is invoked. /// </summary> public override void OnEnter() { VanillaDeathState originalState = new VanillaDeathState(); initialExplosionEffect = originalState.initialExplosionEffect; deathExplosionEffect = originalState.deathExplosionEffect; initialSoundString = originalState.initialSoundString; deathSoundString = originalState.deathSoundString; deathEffectRadius = originalState.deathEffectRadius; forceAmount = originalState.forceAmount; hardCutoffDuration = maxFallDuration = bodyPreservationDuration = deathDuration = 12f; destroyOnImpact = true; SpawnInteractable &= !Machines.instance.IsActiveAndEnabled(); base.OnEnter(); }
////// Hooks ////// private void DeathState_OnImpactServer(On.EntityStates.Drone.DeathState.orig_OnImpactServer orig, EntityStates.Drone.DeathState self, Vector3 contactPoint) { orig(self, contactPoint); if (self.characterBody && BodyCatalog.GetBodyPrefab(self.characterBody.bodyIndex) == bulwarkDroneBodyPrefab) { var broken = DirectorCore.instance.TrySpawnObject( new DirectorSpawnRequest(bulwarkDroneSpawnCard, new DirectorPlacementRule { placementMode = DirectorPlacementRule.PlacementMode.Direct, position = contactPoint }, this.rng)); if (broken) { var purch = broken.GetComponent <PurchaseInteraction>(); if (purch && purch.costType == CostTypeIndex.Money) { purch.Networkcost = Run.instance.GetDifficultyScaledCost(purch.cost); } } } }
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member private void DeathState_OnImpactServer(On.EntityStates.Drone.DeathState.orig_OnImpactServer orig, DeathState self, Vector3 contactPoint) { if (!IsActiveAndEnabled()) { orig(self, contactPoint); } }