diff --git a/1.4/Assemblies/MorePersonaTraits.dll b/1.4/Assemblies/MorePersonaTraits.dll index 4869b30..0e2521f 100644 Binary files a/1.4/Assemblies/MorePersonaTraits.dll and b/1.4/Assemblies/MorePersonaTraits.dll differ diff --git a/Source/DebugActions/DebugActions.cs b/Source/DebugActions/DebugActions.cs index c9704de..81de571 100644 --- a/Source/DebugActions/DebugActions.cs +++ b/Source/DebugActions/DebugActions.cs @@ -56,6 +56,31 @@ private static void AddTrait( weapon.TryGetComp().RegainBond(); } } + + [DebugAction("PersonaWeapons", "[MPT] Remove Weapon Trait", true, actionType = DebugActionType.ToolMap, allowedGameStates = AllowedGameStates.PlayingOnMap)] + private static void RemoveWeaponTrait() + { + List list = new List(); + var weapon = (ThingWithComps)Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).First(t => t is ThingWithComps comps && comps.TryGetComp() != null); + + foreach (var trait in weapon.TryGetComp().TraitsListForReading) + { + list.Add(new DebugMenuOption(trait.defName, DebugMenuOptionMode.Action, + delegate { RemoveTrait(weapon, trait); })); + } + + Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); + } + + private static void RemoveTrait( + ThingWithComps weapon, + WeaponTraitDef weaponTraitDef) + { + weapon.TryGetComp().TempUnbond(); + weapon.TryGetComp().TraitsListForReading.Remove(weaponTraitDef); + if (weapon.TryGetComp().TraitsListForReading.NullOrEmpty()) weapon.TryGetComp().InitializeTraits(); + weapon.TryGetComp().RegainBond(); + } [DebugAction("PersonaWeapons", "[MPT] Reroll Weapon Traits", true, actionType = DebugActionType.ToolMap, allowedGameStates = AllowedGameStates.PlayingOnMap)] private static void RerollTraits()