public static bool Deploy(CompReloadable comp) { if (!ModLister.RoyaltyInstalled) { Log.ErrorOnce("Shields are a Royalty-specific game system. If you want to use this code please check ModLister.RoyaltyInstalled before calling it. See rules on the Ludeon forum for more info.", 86573384); return(false); } if (comp == null || !comp.CanBeUsed) { return(false); } Pawn wearer = comp.Wearer; Map map = wearer.Map; int num = GenRadial.NumCellsInRadius(4f); for (int i = 0; i < num; i++) { IntVec3 intVec = wearer.Position + GenRadial.RadialPattern[i]; if (intVec.IsValid && intVec.InBounds(map)) { SpawnEffect(GenSpawn.Spawn(ThingDefOf.BroadshieldProjector, intVec, map)); comp.UsedOnce(); return(true); } } Messages.Message("AbilityNotEnoughFreeSpace".Translate(), wearer, MessageTypeDefOf.RejectInput, historical: false); return(false); }
protected override bool TryCastShot() { if (!ModLister.RoyaltyInstalled) { Log.ErrorOnce("Items with jump capability are a Royalty-specific game system. If you want to use this code please check ModLister.RoyaltyInstalled before calling it. See rules on the Ludeon forum for more info.", 550187797); return(false); } CompReloadable reloadableCompSource = base.ReloadableCompSource; Pawn casterPawn = CasterPawn; if (casterPawn == null || reloadableCompSource == null || !reloadableCompSource.CanBeUsed) { return(false); } IntVec3 cell = currentTarget.Cell; Map map = casterPawn.Map; reloadableCompSource.UsedOnce(); PawnFlyer pawnFlyer = PawnFlyer.MakeFlyer(ThingDefOf.PawnJumper, casterPawn, cell); if (pawnFlyer != null) { GenSpawn.Spawn(pawnFlyer, cell, map); return(true); } return(false); }
public static void Pop(CompReloadable comp) { if (comp != null && comp.CanBeUsed) { ThingWithComps parent = comp.parent; Pawn wearer = comp.Wearer; GenExplosion.DoExplosion(wearer.Position, wearer.Map, parent.GetStatValue(StatDefOf.SmokepopBeltRadius), DamageDefOf.Smoke, null, -1, -1f, null, null, null, null, ThingDefOf.Gas_Smoke, 1f); comp.UsedOnce(); } }