private static void SelfConsume(Verb_ShootOneUse __instance) { if (SimpleSidearms.SingleshotAutoSwitch == true) { if (__instance.caster is Pawn) { Pawn pawn = (__instance.caster as Pawn); if (pawn.inventory.innerContainer.Any((Thing x) => x.def.defName.Equals(__instance.ownerEquipment.def.defName))) { Thing replacement = pawn.inventory.innerContainer.First((Thing x) => x.def.defName.Equals(__instance.ownerEquipment.def.defName)); WeaponAssingment.weaponSwapSpecific(pawn, replacement, false, MiscUtils.shouldDrop(DroppingModeEnum.UsedUp), false); } else if (pawn.inventory.innerContainer.Any((Thing x) => x.def.IsRangedWeapon)) { WeaponAssingment.tryRangedWeaponSwap(pawn, MiscUtils.shouldDrop(DroppingModeEnum.UsedUp), pawn.IsColonistPlayerControlled); } else if (pawn.inventory.innerContainer.Any((Thing x) => x.def.IsMeleeWeapon)) { WeaponAssingment.tryMeleeWeaponSwap(pawn, MiscUtils.shouldDrop(DroppingModeEnum.UsedUp), true, pawn.IsColonistPlayerControlled); } } } }
private void iconClickAction(int buttonID) { if (interactedWeapon != null) { Thing toSwapTo; if (interactedRanged) { if (buttonID == 0) { toSwapTo = interactedWeapon; if (GoldfishModule.GetGoldfishForPawn(parent) != null && toSwapTo.def.defName.Equals(GoldfishModule.GetGoldfishForPawn(parent).primary)) { PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SidearmsPrimary, KnowledgeAmount.Total); } WeaponAssingment.weaponSwapSpecific(parent, toSwapTo, true, MiscUtils.shouldDrop(DroppingModeEnum.UserForced), false); SwapControlsHandler handler = SwapControlsHandler.GetHandlerForPawn(parent); if (handler.autoLockOnManualSwap) { handler.currentWeaponLocked = true; } PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SidearmsInInventory, KnowledgeAmount.SpecificInteraction); PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SimpleSidearmsBasic, KnowledgeAmount.SmallInteraction); } else if (buttonID == 1) { WeaponAssingment.dropSidearm(parent, interactedWeapon); PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SidearmsInInventory, KnowledgeAmount.SpecificInteraction); PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SimpleSidearmsBasic, KnowledgeAmount.SmallInteraction); } } else { if (buttonID == 0) { toSwapTo = interactedWeapon; if (GoldfishModule.GetGoldfishForPawn(parent) != null && toSwapTo.def.defName.Equals(GoldfishModule.GetGoldfishForPawn(parent).primary)) { PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SidearmsPrimary, KnowledgeAmount.Total); } WeaponAssingment.weaponSwapSpecific(parent, toSwapTo, true, MiscUtils.shouldDrop(DroppingModeEnum.UserForced), false); PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SidearmsInInventory, KnowledgeAmount.SpecificInteraction); PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SimpleSidearmsBasic, KnowledgeAmount.SmallInteraction); } else if (buttonID == 1) { WeaponAssingment.dropSidearm(parent, interactedWeapon); PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SidearmsInInventory, KnowledgeAmount.SpecificInteraction); PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SimpleSidearmsBasic, KnowledgeAmount.SmallInteraction); } } } else if (interactedWeaponMemory != null) { if (interactedRanged) { if (buttonID == 0) { } else if (buttonID == 1) { WeaponAssingment.forgetSidearmMemory(parent, interactedWeaponMemory); PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SidearmsMissing, KnowledgeAmount.SpecificInteraction); PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SimpleSidearmsBasic, KnowledgeAmount.SmallInteraction); } } else { if (buttonID == 0) { } else if (buttonID == 1) { WeaponAssingment.forgetSidearmMemory(parent, interactedWeaponMemory); PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SidearmsMissing, KnowledgeAmount.SpecificInteraction); PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SimpleSidearmsBasic, KnowledgeAmount.SmallInteraction); } } } else if (interactedUnarmed == true) { if (buttonID == 0) { WeaponAssingment.weaponSwapSpecific(parent, null, true, MiscUtils.shouldDrop(DroppingModeEnum.UserForced), false); PlayerKnowledgeDatabase.KnowledgeDemonstrated(SidearmsDefOf.Concept_SimpleSidearmsBasic, KnowledgeAmount.SmallInteraction); } } }
private void iconClickAction(int buttonID) { if (interactedWeapon != null) { Thing toSwapTo; if (interactedRanged) { if (buttonID == 0) { toSwapTo = interactedWeapon; WeaponAssingment.weaponSwapSpecific(parent, toSwapTo, true, MiscUtils.shouldDrop(DroppingModeEnum.UserForced), false); SwapControlsHandler handler = SwapControlsHandler.GetHandlerForPawn(parent); if (handler.autoLockOnManualSwap) { handler.currentWeaponLocked = true; } } else if (buttonID == 1) { WeaponAssingment.dropSidearm(parent, interactedWeapon); } } else { if (buttonID == 0) { toSwapTo = interactedWeapon; WeaponAssingment.weaponSwapSpecific(parent, toSwapTo, true, MiscUtils.shouldDrop(DroppingModeEnum.UserForced), false); } else if (buttonID == 1) { WeaponAssingment.dropSidearm(parent, interactedWeapon); } } } else if (interactedWeaponMemory != null) { if (interactedRanged) { if (buttonID == 0) { } else if (buttonID == 1) { WeaponAssingment.forgetSidearmMemory(parent, interactedWeaponMemory); } } else { if (buttonID == 0) { } else if (buttonID == 1) { WeaponAssingment.forgetSidearmMemory(parent, interactedWeaponMemory); } } } else if (interactedUnarmed == true) { if (buttonID == 0) { WeaponAssingment.weaponSwapSpecific(parent, null, true, MiscUtils.shouldDrop(DroppingModeEnum.UserForced), false); } } }