Example #1
0
 public DeployShieldGizmo(Pawn pawn, IList <IShield> shields)
 {
     action = delegate
     {
         if (shields.Count > 1)
         {
             Find.WindowStack.Add(ShowSelectShield(pawn, shields));
         }
         else if (shields.Any())
         {
             ShieldDeploymentUtility.DeployShield(pawn, shields.First());
         }
     };
 }
Example #2
0
 private FloatMenu ShowSelectShield(Pawn pawn, IList <IShield> shields)
 {
     return(new FloatMenu(
                shields.Select(shield =>
     {
         return new FloatMenuOption(
             shield.Label,
             delegate
         {
             ShieldDeploymentUtility.DeployShield(pawn, shield);
         });
     }).ToList()
                ));
 }
Example #3
0
 static void NotifyShieldRemoved(ThingOwner __instance, Thing item)
 {
     switch (__instance?.Owner)
     {
     case Pawn_InventoryTracker inventory:
         var pawn = inventory.pawn;
         if (pawn.Spawned)
         {
             ShieldDeploymentUtility.DeployedShields(pawn)
             .Where(shield => ShieldDeploymentUtility.ItemProvidesShield(item, shield))
             .Do(shield => ShieldDeploymentUtility.UndeployShield(pawn, shield));
         }
         break;
     }
 }