Skip to content

Commit

Permalink
TryDropThing cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxDorob committed Dec 2, 2024
1 parent dec17b4 commit 6d99b3d
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -91,7 +90,7 @@ private Thing TryDropThing(Thing thing, Map map, IntVec3 position)
});
}
}
return thing2;
return dropedThing;
}
}
}

0 comments on commit 6d99b3d

Please sign in to comment.