private void MakeGlower() { if (!LoadedModManager.GetMod <SWSaberMod>().GetSettings <SWSaberSettings>().LightsabersGlowEffect) { return; } SaberGlow sb = null; var ownerParentHolder = parent.holdingOwner.Owner.ParentHolder as Pawn; ownerParentHolder?.AllComps.Add(sb = new SaberGlow { parent = ownerParentHolder, props = new CompProperties_Glower { compClass = typeof(SaberGlow), glowRadius = 5f, glowColor = ColorIntUtility.AsColorInt( parent.TryGetComp <CompSlotLoadable.CompSlotLoadable>()?.Slots .FirstOrDefault(x => ((SlotLoadableDef)x.def).doesChangeColor)?.SlotOccupant ?.TryGetComp <CompSlottedBonus>()?.Props.color ?? ColorLibrary.Violet), overlightRadius = 5f } }); sb?.PostSpawnSetup(false); }
public void MakeGlower() { SaberGlow sb; Pawn p = this.parent.holdingOwner.Owner.ParentHolder as Pawn; p.AllComps.Add(sb = new SaberGlow() { parent = p, props = new CompProperties_Glower() { compClass = typeof(SaberGlow), glowRadius = 5f, glowColor = ColorIntUtility.AsColorInt(this.parent.TryGetComp <CompSlotLoadable.CompSlotLoadable>()?.Slots.FirstOrDefault(x => (x.def as SlotLoadableDef).doesChangeColor == true)?.SlotOccupant?.TryGetComp <CompSlottedBonus>()?.Props.color ?? ColorLibrary.Violet), overlightRadius = 5f } }); sb.PostSpawnSetup(false); }