From 6d99b3d8315a26f622c4df4f5bf21349a2e94847 Mon Sep 17 00:00:00 2001 From: MaxDorob Date: Tue, 3 Dec 2024 00:41:51 +0600 Subject: [PATCH] TryDropThing cleanup --- .../Comps/CompCIWSImpactHandler_Skyfaller.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Source/CombatExtended/CombatExtended/Comps/CompCIWSImpactHandler_Skyfaller.cs b/Source/CombatExtended/CombatExtended/Comps/CompCIWSImpactHandler_Skyfaller.cs index 41269ea422..18a6d66f1b 100644 --- a/Source/CombatExtended/CombatExtended/Comps/CompCIWSImpactHandler_Skyfaller.cs +++ b/Source/CombatExtended/CombatExtended/Comps/CompCIWSImpactHandler_Skyfaller.cs @@ -59,29 +59,28 @@ protected override void OnDestroying(DamageInfo dinfo) } base.OnDestroying(dinfo); } - private Thing TryDropThing(Thing thing, Map map, IntVec3 position) + private Thing TryDropThing(Thing thingToDrop, Map map, IntVec3 position) { var contents = (parent as IActiveDropPod)?.Contents; Rot4 rot = (contents?.setRotation != null) ? contents.setRotation.Value : Rot4.North; if (contents?.moveItemsAsideBeforeSpawning ?? false) { - GenSpawn.CheckMoveItemsAside(parent.Position, rot, thing.def, map); + GenSpawn.CheckMoveItemsAside(parent.Position, rot, thingToDrop.def, map); } - Thing thing2; + Thing dropedThing; if (contents?.spawnWipeMode == null) { - GenPlace.TryPlaceThing(thing, position, map, ThingPlaceMode.Near, out thing2, null, null, rot); + GenPlace.TryPlaceThing(thingToDrop, position, map, ThingPlaceMode.Near, out dropedThing, null, null, rot); } else if (contents?.setRotation != null) { - thing2 = GenSpawn.Spawn(thing, position, map, contents.setRotation.Value, contents.spawnWipeMode.Value, false, false); + dropedThing = GenSpawn.Spawn(thingToDrop, position, map, contents.setRotation.Value, contents.spawnWipeMode.Value, false, false); } else { - thing2 = GenSpawn.Spawn(thing, position, map, contents.spawnWipeMode.Value); + dropedThing = GenSpawn.Spawn(thingToDrop, position, map, contents.spawnWipeMode.Value); } - Pawn pawn = thing2 as Pawn; - if (pawn != null) + if (dropedThing is Pawn pawn) { if (pawn.RaceProps.Humanlike) { @@ -91,7 +90,7 @@ private Thing TryDropThing(Thing thing, Map map, IntVec3 position) }); } } - return thing2; + return dropedThing; } } }