protected override bool TryExecuteWorker(IncidentParms parms) { if (!TryFindSettlement(out Faction ally, out Settlement Set)) { return(false); } // Balance List <Thing> rewards = ThingSetMakerDefOf.Reward_StandardByDropPod.root.Generate(new ThingSetMakerParams() { totalMarketValueRange = new FloatRange?(SiteTuning.BanditCampQuestRewardMarketValueRange * SiteTuning.QuestRewardMarketValueThreatPointsFactor.Evaluate(StorytellerUtility.DefaultSiteThreatPointsNow() + 500f)) }); Thing silver = ThingMaker.MakeThing(ThingDefOf.Silver); silver.stackCount = (int)SilverBonusRewardCurve.Evaluate(ally.PlayerGoodwill); int random = new IntRange(Global.DayInTicks * 15, Global.DayInTicks * 25).RandomInRange; Set.GetComponent <WorldComp_JointRaid>().StartComp(random, ally, rewards, silver); string text = def.letterText.Formatted(ally.leader.LabelShort, ally.def.leaderTitle, ally.Name, GenLabel.ThingsLabel(rewards, string.Empty), random.ToStringTicksToPeriod(), GenThing.GetMarketValue(rewards).ToStringMoney(null), silver.stackCount.ToString()).CapitalizeFirst(); GenThing.TryAppendSingleRewardInfo(ref text, rewards); Find.LetterStack.ReceiveLetter(def.letterLabel, text, def.letterDef, Set, ally, null); return(true); }
// Verse.GhostDrawer public static bool HeronDoorGhostHandler(IntVec3 center, Rot4 rot, ThingDef thingDef, Graphic baseGraphic, Color ghostCol, AltitudeLayer drawAltitude) { if (thingDef is DoorExpandedDef def && def.fixedPerspective) { Graphic graphic = GhostUtility.GhostGraphicFor(baseGraphic, thingDef, ghostCol); //Graphic graphic = Traverse.Create(typeof(GhostDrawer)).Method("GhostGraphicFor", new object[] { thingDef.graphic, thingDef, ghostCol }).GetValue<Graphic>(); Vector3 loc = GenThing.TrueCenter(center, rot, thingDef.Size, drawAltitude.AltitudeFor()); for (int i = 0; i < 2; i++) { bool flipped = (i != 0) ? true : false; Building_DoorExpanded.DrawParams(def, loc, rot, out var mesh, out var matrix, mod: 0, flipped: flipped); Graphics.DrawMesh(mesh: mesh, matrix: matrix, material: graphic.MatAt(rot: rot, thing: null), layer: 0); } if (thingDef?.PlaceWorkers?.Count > 0) { for (int i = 0; i < thingDef.PlaceWorkers.Count; i++) { thingDef.PlaceWorkers[index : i] .DrawGhost(def : thingDef, center : center, rot : rot, ghostCol : ghostCol); } } return(false); } return(true); }
public static void DrawDropSpotShadow(ShipBase ship, int ticks, ShipBase_Traveling travelingShip = null) { if (ticks < 0) { ticks = 0; } Vector3 result = GenThing.TrueCenter(ship); if (travelingShip != null) { result = travelingShip.Position.ToVector3ShiftedWithAltitude(AltitudeLayer.Skyfaller); } result += DropShipUtility.drawOffsetFor(ship, ticks, true); result.y = Altitudes.AltitudeFor(AltitudeLayer.Shadows); Color white = Color.white; white.a = Mathf.InverseLerp(200f, 150f, (float)ticks); DropShipUtility.shadowPropertyBlock.SetColor(Shader.PropertyToID("Cutout"), white); Matrix4x4 matrix = default(Matrix4x4); matrix.SetTRS(result, ship.compShip.parent.Rotation.AsQuat, new Vector3(1f, 1f, 1f)); Graphics.DrawMesh(ship.compShip.parent.Graphic.MeshAt(ship.compShip.parent.Rotation), matrix, ship.compShip.dropShadow.MatSingle, 0, null, 0, DropShipUtility.shadowPropertyBlock); }
public static bool DropSingleThing(Thing toDrop, IntVec3 from, Map map, bool makeForbidden = false) { if (toDrop.stackCount == 0) { Log.Warning("To Drop Thing " + toDrop.Label + " had stack count of 0"); return(false); } try { if (!toDrop.Spawned) { GenThing.TryDropAndSetForbidden(toDrop, from, map, ThingPlaceMode.Near, out Thing result, makeForbidden); if (!toDrop.Spawned && !GenPlace.TryPlaceThing(toDrop, from, map, ThingPlaceMode.Near)) { Log.Error("Failed to spawn " + toDrop.Label + " x" + toDrop.stackCount); return(false); } } toDrop.Position = from; } catch (Exception e) { Log.Error( typeof(BuildingUtil).Name + ".DropApparel\n" + e.GetType().Name + " " + e.Message + "\n" + e.StackTrace); } return(toDrop != null && toDrop.Spawned); }
public static void DrawLinesToPotentialThingsToLinkTo(ThingDef myDef, IntVec3 myPos, Rot4 myRot, Map map) { nearDrowingList.Clear(); Vector3 pointingPos = GenThing.TrueCenter(myPos, myRot, myDef.size, myDef.Altitude); foreach (Thing thing in GenRadial.RadialDistinctThingsAround(myPos, map, range, true)) { CompResonancePowerPlant comp = thing.TryGetComp <CompResonancePowerPlant>(); if (comp != null) { nearDrowingList.Add(comp); } } foreach (Thing thing in GenRadial.RadialDistinctThingsAround(myPos + myRot.FacingCell, map, range, true)) { CompResonancePowerPlant comp = thing.TryGetComp <CompResonancePowerPlant>(); if (comp != null) { nearDrowingList.Add(comp); } } foreach (CompResonancePowerPlant comp in nearDrowingList) { if (comp.CanBeActive) { GenDraw.DrawLineBetween(pointingPos, comp.parent.TrueCenter()); } else { GenDraw.DrawLineBetween(pointingPos, comp.parent.TrueCenter(), CompAffectedByFacilities.InactiveFacilityLineMat); } } }
public static bool Patch_Pawn_PreApplyDamage_Prefix( ref Pawn __instance, ref DamageInfo dinfo, out bool absorbed) { if (((DamageInfo) ref dinfo).get_Def() != DamageDefOf.SurgicalCut && ((DamageInfo) ref dinfo).get_Def() != DamageDefOf.ExecutionCut && ((DamageInfo) ref dinfo).get_Def() != DamageDefOf.EMP && ((DamageInfo) ref dinfo).get_Def() != DamageDefOf.Stun && __instance.health != null && ((HediffSet)((Pawn_HealthTracker)__instance.health).hediffSet).HasHediff(MFHediffDefOf.MFBastionHigh, false) && ((HediffSet)((Pawn_HealthTracker)__instance.health).hediffSet).GetFirstHediffOfDef(MFHediffDefOf.MFBastionHigh, false) is ShieldHediff firstHediffOfDef) { if (firstHediffOfDef.broken) { firstHediffOfDef.ResetBrokenCooldown(); } else if (firstHediffOfDef.AbsorbDamage(dinfo)) { if (firstHediffOfDef.broken) { SoundStarter.PlayOneShot((SoundDef)SoundDefOf.EnergyShield_Broken, SoundInfo.op_Implicit(new TargetInfo(((Thing)__instance).get_Position(), ((Thing)__instance).get_Map(), false))); MoteMaker.MakeStaticMote(GenThing.TrueCenter((Thing)__instance), ((Thing)__instance).get_Map(), (ThingDef)ThingDefOf.Mote_ExplosionFlash, 12f); } else { SoundStarter.PlayOneShot((SoundDef)SoundDefOf.EnergyShield_AbsorbDamage, SoundInfo.op_Implicit(new TargetInfo(((Thing)__instance).get_Position(), ((Thing)__instance).get_Map(), false))); MoteMaker.MakeStaticMote(GenThing.TrueCenter((Thing)__instance), ((Thing)__instance).get_Map(), (ThingDef)ThingDefOf.Mote_ExplosionFlash, 6f); } if (!firstHediffOfDef.broken) { firstHediffOfDef.ResetHitCooldown(); } absorbed = true; return(false); } } absorbed = false; return(true); }
public static IntVec3 Offset(IntVec2 size, Rot4 from, Rot4 to) { var alt = AltitudeLayer.Blueprint.AltitudeFor(); return((GenThing.TrueCenter(IntVec3.Zero, from, size, alt) - GenThing.TrueCenter(IntVec3.Zero, to, size, alt)).ToIntVec3()); }
private void HostileDefeated() { // Killed all hostiles - Win outcome if (!GenHostility.AnyHostileActiveThreatTo(((MapParent)parent).Map, Faction.OfPlayer)) { active = false; DropPodUtility.DropThingsNear(DropCellFinder.TradeDropSpot(Find.AnyPlayerHomeMap), Find.AnyPlayerHomeMap, rewards, 110, false, true, true); parent.Faction.TryAffectGoodwillWith(Faction.OfPlayer, +15, false, true); if (!Find.WorldObjects.Settlements.Where(s => s.Faction == enemy && !s.Faction.def.hidden && Find.WorldReachability.CanReach(Find.AnyPlayerHomeMap.Tile, s.Tile)).TryRandomElement(out Settlement enemySet)) { Find.LetterStack.ReceiveLetter("LetterLabelOutpostdefensesuccess".Translate(), TranslatorFormattedStringExtensions.Translate("Outpostdefensesuccess", parent.Faction.leader, parent.Faction.def.leaderTitle, GenLabel.ThingsLabel(rewards, string.Empty)), EndGameDefOf.FE_JointRaid.letterDef, null, parent.Faction, null); active = false; return; } List <Thing> rewardsNew = ThingSetMakerDefOf.Reward_StandardByDropPod.root.Generate(new ThingSetMakerParams() { totalMarketValueRange = new FloatRange?(SiteTuning.BanditCampQuestRewardMarketValueRange * SiteTuning.QuestRewardMarketValueThreatPointsFactor.Evaluate(StorytellerUtility.DefaultSiteThreatPointsNow() + 500f)) }); Thing silver = ThingMaker.MakeThing(ThingDefOf.Silver); silver.stackCount = (int)FE_IncidentWorker_Jointraid.SilverBonusRewardCurve.Evaluate(parent.Faction.PlayerGoodwill); int random = new IntRange(Global.DayInTicks * 15, Global.DayInTicks * 25).RandomInRange; enemySet.GetComponent <WorldComp_JointRaid>().StartComp(random, parent.Faction, rewardsNew, silver); string text = TranslatorFormattedStringExtensions.Translate("OutpostdefensesuccessJointRaid", parent.Faction.leader, parent.Faction.def.leaderTitle, GenLabel.ThingsLabel(rewardsNew, string.Empty), random.ToStringTicksToPeriod(), GenThing.GetMarketValue(rewards).ToStringMoney(null), silver.stackCount.ToString(), GenLabel.ThingsLabel(rewards, string.Empty)).CapitalizeFirst(); GenThing.TryAppendSingleRewardInfo(ref text, rewards); Find.LetterStack.ReceiveLetter(EndGameDefOf.FE_JointRaid.letterLabel, text, EndGameDefOf.FE_JointRaid.letterDef, enemySet, parent.Faction, null); } }
public override string CompInspectStringExtra() { string result; if (this.contents.Any) { string text = GenThing.ThingsToCommaList(this.contents, true, true, 5).CapitalizeFirst(); if (this.contents.Count > 5) { result = "SomeItemStashContents".Translate(new object[] { text }); } else { result = "ItemStashContents".Translate(new object[] { text }); } } else { result = null; } return(result); }
protected override bool TryExecuteWorker(IncidentParms parms) { if (!TryFindFactions(out Faction ally, out Faction enemyFaction) || !TryFindTile(out int tile)) { return(false); } Site site = SiteMaker.MakeSite(SiteCoreDefOf.Nothing, EndGameDefOf.Outpost_defense, tile, ally, true); List <Thing> rewards = ThingSetMakerDefOf.Reward_StandardByDropPod.root.Generate(new ThingSetMakerParams() { totalMarketValueRange = new FloatRange?(SiteTuning.BanditCampQuestRewardMarketValueRange * SiteTuning.QuestRewardMarketValueThreatPointsFactor.Evaluate(StorytellerUtility.DefaultSiteThreatPointsNow() - 500)) }); int randomInRange = SiteTuning.QuestSiteTimeoutDaysRange.RandomInRange * Global.DayInTicks; site.GetComponent <WorldComp_SiteDefense>().StartComp(enemyFaction, rewards); site.GetComponent <TimeoutComp>().StartTimeout(randomInRange); Find.WorldObjects.Add(site); string text = def.letterText.Formatted(ally.leader.LabelShort, ally.def.leaderTitle, ally.Name, GenLabel.ThingsLabel(rewards, string.Empty), randomInRange.ToStringTicksToPeriod(), GenThing.GetMarketValue(rewards).ToStringMoney(null)).CapitalizeFirst(); GenThing.TryAppendSingleRewardInfo(ref text, rewards); Find.LetterStack.ReceiveLetter(def.letterLabel, text, def.letterDef, site, ally, null); return(true); }
public override void Tick() { if (this.destroyTick <= Find.TickManager.TicksGame) { this.Destroy(DestroyMode.Vanish); } this.graphicRotation += this.graphicRotationSpeed; if (!this.DestroyedOrNull()) { Map map = base.Map; IntVec3 position = base.Position; if (Find.TickManager.TicksGame % 10 == 0) { FleckMaker.ThrowSmoke(GenThing.TrueCenter(this) + new Vector3(0f, 0f, 0.1f), map, 1f); } if (Find.TickManager.TicksGame % 300 == 0) { OPBombardment opbombardment = (OPBombardment)GenSpawn.Spawn(DefDatabase <ThingDef> .GetNamed("OPBombardment", true), position, map, WipeMode.Vanish); opbombardment.duration = 120; opbombardment.instigator = this; opbombardment.weaponDef = ThingDefOf.OrbitalTargeterBombardment; opbombardment.StartStrike(); if (!this.DestroyedOrNull()) { this.Destroy(DestroyMode.Vanish); } } } }
private void Payment(List <Thing> payment, bool vassalPay, bool TributePay, string factionList) { if (GenLocalDate.Year(Find.AnyPlayerHomeMap) >= year) { year = GenLocalDate.Year(Find.AnyPlayerHomeMap) + 1; } if (GenLocalDate.DayOfYear(Find.AnyPlayerHomeMap) >= dayOfMonth) { dayOfMonth = ClosestNumberOf15(GenLocalDate.DayOfYear(Find.AnyPlayerHomeMap) + 1); } if (!payment.NullOrEmpty()) { string text = ""; if (vassalPay && TributePay) { text += "FactionVassalSilverRecivedBoth".Translate(GenThing.GetMarketValue(payment).ToStringMoney(), GenLabel.ThingsLabel(payment, string.Empty)); } else if (vassalPay) { text += "FactionVassalSilverRecivedVassals".Translate(GenThing.GetMarketValue(payment).ToStringMoney(), GenLabel.ThingsLabel(payment, string.Empty)); } else if (TributePay) { text += "FactionVassalSilverRecivedTrivutaries".Translate(GenThing.GetMarketValue(payment).ToStringMoney(), GenLabel.ThingsLabel(payment, string.Empty)); } factionList.Remove(factionList.Count() - 1); DropPodUtility.DropThingsNear(DropCellFinder.TradeDropSpot(Find.AnyPlayerHomeMap), Find.AnyPlayerHomeMap, payment, 110, false, true, true); Find.LetterStack.ReceiveLetter("LetterFactionVassalSilverRecived".Translate(), text + factionList, LetterDefOf.PositiveEvent, null); } }
// Token: 0x06000075 RID: 117 RVA: 0x00004B08 File Offset: 0x00002D08 private string GetLetterText(Faction alliedFaction, List <Thing> items, int days, Site site, SitePart sitePart) { string result = GrammarResolverSimpleStringExtensions.Formatted(this.def.letterText, alliedFaction.leader.LabelShort, alliedFaction.def.leaderTitle, alliedFaction.Name, GenLabel.ThingsLabel(items, " - "), days.ToString(), SitePartUtility.GetDescriptionDialogue(site, sitePart), GenThing.GetMarketValue(items).ToStringMoney(null)).CapitalizeFirst(); GenThing.TryAppendSingleRewardInfo(ref result, items); return(result); }
public override void Notify_GeneratedByQuestGen(SitePart part, Slate slate, List <Rule> outExtraDescriptionRules, Dictionary <string, string> outExtraDescriptionConstants) { base.Notify_GeneratedByQuestGen(part, slate, outExtraDescriptionRules, outExtraDescriptionConstants); ThingDef thingDef = slate.Get <ThingDef>("itemStashSingleThing"); IEnumerable <ThingDef> enumerable = slate.Get <IEnumerable <ThingDef> >("itemStashThings"); List <Thing> list; if (thingDef != null) { list = new List <Thing>(); list.Add(ThingMaker.MakeThing(thingDef)); } else if (enumerable != null) { list = new List <Thing>(); foreach (ThingDef item in enumerable) { list.Add(ThingMaker.MakeThing(item)); } } else { float x = slate.Get("points", 0f); ThingSetMakerParams parms = default(ThingSetMakerParams); parms.totalMarketValueRange = new FloatRange(0.7f, 1.3f) * QuestTuning.PointsToRewardMarketValueCurve.Evaluate(x); list = ThingSetMakerDefOf.Reward_ItemsStandard.root.Generate(parms); } part.things = new ThingOwner <Thing>(part, oneStackOnly: false); part.things.TryAddRangeOrTransfer(list, canMergeWithExistingStacks: false); slate.Set("generatedItemStashThings", list); outExtraDescriptionRules.Add(new Rule_String("itemStashContents", GenLabel.ThingsLabel(list))); outExtraDescriptionRules.Add(new Rule_String("itemStashContentsValue", GenThing.GetMarketValue(list).ToStringMoney())); }
public override void DrawGhost(ThingDef def, IntVec3 loc, Rot4 rot, Color ghostCol) { Graphic baseGraphic = GraphicDatabase.Get <Graphic_Single>("Things/Building/Security/ProjectorTower_ProjectorOff", ShaderDatabase.Cutout, new Vector2(3.5f, 3.5f), Color.white); Graphic graphic = GhostUtility.GhostGraphicFor(baseGraphic, def, ghostCol); graphic.DrawFromDef(GenThing.TrueCenter(loc, rot, def.Size, AltitudeLayer.MetaOverlays.AltitudeFor()), rot, def, 0f); }
public override void LordJobTick() { base.LordJobTick(); var alter = spot.GetFirstThing <Building_SkavenAlter>(Map); if (alter == null) { return; } Rand.PushState(alter.thingIDNumber); try { foreach (IntVec3 cell in alter.PeripheralCells) { var pos = GenThing.TrueCenter(cell, alter.Rotation, alter.RotatedSize, alter.def.Altitude); CellRenderer.RenderSpot(pos, Rand.Range(0, 1f)); } } finally { Rand.PopState(); } }
internal static bool TryDrop(this Pawn_ApparelTracker _this, Apparel ap, out Apparel resultingAp, IntVec3 pos, bool forbid = true) { // drop all toolbelt & backpack stuff so that it won't disappear Apparel_Backpack backpack = ap as Apparel_Backpack; Thing dropThing = null; if (backpack?.slotsComp?.slots?.Count >= 1) { foreach (Thing slot in backpack.slotsComp.slots) { GenThing.TryDropAndSetForbidden(slot, pos, ThingPlaceMode.Near, out dropThing, forbid); } } if (!_this.WornApparel.Contains(ap)) { Log.Warning(_this.pawn.LabelCap + " tried to drop apparel he didn't have: " + ap.LabelCap); resultingAp = null; return(false); } _this.WornApparel.Remove(ap); ap.wearer = null; Thing thing = null; bool flag = GenThing.TryDropAndSetForbidden(ap, pos, ThingPlaceMode.Near, out thing, forbid); resultingAp = (thing as Apparel); _this.ApparelChanged(); if (flag && _this.pawn.outfits != null) { _this.pawn.outfits.forcedHandler.SetForced(ap, false); } Combat_Realism.CR_Utility.TryUpdateInventory(_this.pawn); // Apparel was dropped, update inventory return(flag); }
public static void TradeRequests() { Map currentMap = Find.CurrentMap; IncidentWorker_QuestTradeRequest incidentWorker_QuestTradeRequest = (IncidentWorker_QuestTradeRequest)IncidentDefOf.Quest_TradeRequest.Worker; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Randomly-generated trade requests for map " + currentMap.ToString() + ":"); stringBuilder.AppendLine(); for (int i = 0; i < 50; i++) { SettlementBase settlementBase = IncidentWorker_QuestTradeRequest.RandomNearbyTradeableSettlement(currentMap.Tile); if (settlementBase == null) { break; } stringBuilder.AppendLine("Settlement: " + settlementBase.LabelCap); TradeRequestComp component = settlementBase.GetComponent <TradeRequestComp>(); if (incidentWorker_QuestTradeRequest.TryGenerateTradeRequest(component, currentMap)) { stringBuilder.AppendLine("Duration: " + (component.expiration - Find.TickManager.TicksGame).ToStringTicksToDays("F1")); string str = GenLabel.ThingLabel(component.requestThingDef, null, component.requestCount) + " ($" + (component.requestThingDef.BaseMarketValue * (float)component.requestCount).ToString("F0") + ")"; stringBuilder.AppendLine("Request: " + str); string str2 = GenThing.ThingsToCommaList(component.rewards, false, true, -1) + " ($" + (from t in component.rewards select t.MarketValue * (float)t.stackCount).Sum().ToString("F0") + ")"; stringBuilder.AppendLine("Reward: " + str2); } else { stringBuilder.AppendLine("TryGenerateTradeRequest failed."); } stringBuilder.AppendLine(); settlementBase.GetComponent <TradeRequestComp>().Disable(); } Log.Message(stringBuilder.ToString(), false); }
public static bool DropThing(Thing toDrop, IntVec3 from, Map map, bool makeForbidden = true) { try { if (!toDrop.Spawned) { GenThing.TryDropAndSetForbidden(toDrop, from, map, ThingPlaceMode.Near, out Thing t, makeForbidden); if (!toDrop.Spawned) { GenPlace.TryPlaceThing(toDrop, from, map, ThingPlaceMode.Near); } } toDrop.Position = from; return(toDrop.Spawned); } catch (Exception e) { Log.Warning( "ChangeDresser:BuildingUtil.DropApparel\n" + e.GetType().Name + " " + e.Message + "\n" + e.StackTrace); } return(false); }
internal static bool TryDrop(this Pawn_ApparelTracker _this, Apparel ap, out Apparel resultingAp, IntVec3 pos, bool forbid = true) { // drop all toolbelt & backpack stuff so that it won't disappear Apparel_Backpack backpack = ap as Apparel_Backpack; Apparel_Toolbelt toolbelt = ap as Apparel_Toolbelt; Thing dropThing = null; if (backpack?.SlotsComp?.slots?.Count >= 1) { foreach (Thing slot in backpack.SlotsComp.slots) { GenThing.TryDropAndSetForbidden(slot, pos, ap.Map, ThingPlaceMode.Near, out dropThing, forbid); } } if (toolbelt?.slotsComp?.slots?.Count >= 1) { foreach (Thing slot in toolbelt.slotsComp.slots) { GenThing.TryDropAndSetForbidden(slot, pos, ap.Map, ThingPlaceMode.Near, out dropThing, forbid); } for (int i = MapComponent_ToolsForHaul.CachedToolEntries.Count - 1; i >= 0; i--) { var entry = MapComponent_ToolsForHaul.CachedToolEntries[i]; if (entry.pawn == _this.pawn) { MapComponent_ToolsForHaul.CachedToolEntries.RemoveAt(i); } } } if (!_this.WornApparel.Contains(ap)) { Log.Warning(_this.pawn.LabelCap + " tried to drop apparel he didn't have: " + ap.LabelCap); resultingAp = null; return(false); } if (_this.pawn.MapHeld == null) { Log.Warning(_this.pawn.LabelCap + " tried to drop apparel but his MapHeld is null."); resultingAp = null; return(false); } ap.Notify_Stripped(_this.pawn); _this.Remove(ap); Thing thing = null; bool result = GenThing.TryDropAndSetForbidden(ap, pos, _this.pawn.MapHeld, ThingPlaceMode.Near, out thing, forbid); resultingAp = (thing as Apparel); #if CR Combat_Realism.CR_Utility.TryUpdateInventory(_this.pawn); // Apparel was dropped, update inventory #endif return(result); }
public override void PostDraw() { base.PostDraw(); if (ShowNow) { this.Graphic.Draw(GenThing.TrueCenter(this.parent.Position, this.parent.Rotation, this.parent.def.size, this.Props.Altitude), this.parent.Rotation, this.parent); } }
public override void PostDraw() { if (parent.Rotation == Rot4.South) { this.Graphic.Draw(GenThing.TrueCenter(this.parent.Position, this.parent.Rotation, this.parent.def.size, Props.Altitude), this.parent.Rotation, this.parent, 0f); return; } }
public static Vector3 ThrowResult(Thing Caster, Thing thingToPush, int pushDist, out bool collision) { Vector3 vector = GenThing.TrueCenter(thingToPush); Vector3 result = vector; bool flag = false; /* * int num = pushDist; * int num2 = pushDist; * if (vector.x > GenThing.TrueCenter(Caster).x) * { * num2 = -num2; * } * if (vector.z > GenThing.TrueCenter(Caster).z) * { * num = -num; * } * if (vector.x == GenThing.TrueCenter(Caster).x) * { * num2 = 0; * } * if (vector.z == GenThing.TrueCenter(Caster).z) * { * num = 0; * } * * num += Rand.RangeInclusive(-pushDist, pushDist) / (num != 0 ? 3 : 2); * num2 += Rand.RangeInclusive(-pushDist, pushDist) / (num2 != 0 ? 3 : 2); */ // Vector3 vector2 = new Vector3(vector.x + (float)num2, 0f, vector.z + (float)num); Pawn caster = Caster as Pawn; float num = 0f; if ((thingToPush.DrawPos - caster.DrawPos).MagnitudeHorizontalSquared() > 0.001f) { num = (thingToPush.DrawPos - caster.DrawPos).AngleFlat(); } IntVec3 vector2 = GenerateShrapnelLocation(caster.Position, num, pushDist); if (RCellFinder.TryFindRandomCellNearWith(vector2, x => GenSight.LineOfSight(caster.Position, x, Caster.Map) && GenGrid.Standable(x, Caster.Map), Caster.Map, out vector2)) { result = vector2.ToVector3Shifted(); } else { if (thingToPush is Pawn) { flag = true; } } collision = flag; return(result); }
public override string CompInspectStringExtra() { if (contents.Any) { string value = GenThing.ThingsToCommaList(contents, useAnd: true, aggregate: true, 5).CapitalizeFirst(); return("ItemStashContents".Translate(value, GenThing.GetMarketValue(contents).ToStringMoney())); } return(null); }
public override string CompInspectStringExtra() { if (active) { string value = GenThing.ThingsToCommaList(rewards, useAnd: true, aggregate: true, 5).CapitalizeFirst(); return("QuestTargetDestroyInspectString".Translate(requestingFaction.Name, value, GenThing.GetMarketValue(rewards).ToStringMoney()).CapitalizeFirst()); } return(null); }
// Token: 0x0600000B RID: 11 RVA: 0x000024A4 File Offset: 0x000006A4 public override void TickRare() { base.TickRare(); bool shouldSendAlert = this.shouldSendAlert; if (shouldSendAlert) { MoteMaker.ThrowMetaIcon(IntVec3Utility.ToIntVec3(GenThing.TrueCenter(this)), base.Map, ThingDefOf.Mote_IncapIcon); } }
// Token: 0x060000BC RID: 188 RVA: 0x00009754 File Offset: 0x00007954 private void Initialize() { bool spawned = base.Pawn.Spawned; bool flag = spawned && base.Pawn.Map != null; if (flag) { MoteMaker.ThrowLightningGlow(GenThing.TrueCenter(base.Pawn), base.Pawn.Map, 3f); } }
public override void DoEffect(Pawn p) { base.DoEffect(p); var key_stamp = parent.GetComp <CompHoloCryptoStamped>(); if ((key_stamp == null) || (p.MapHeld == null) || (p.apparel == null)) { return; } Apparel locked_app = null; var any_locked = false; { foreach (var app in p.apparel.WornApparel) { var app_stamp = app.GetComp <CompHoloCryptoStamped>(); if (app_stamp != null) { any_locked = true; if (app_stamp.matches(key_stamp)) { locked_app = app; break; } } } } if (locked_app != null) { //locked_app.Notify_Stripped (p); // TODO This was removed. Necessary? p.apparel.Remove(locked_app); Thing dropped = null; GenThing.TryDropAndSetForbidden(locked_app, p.Position, p.MapHeld, ThingPlaceMode.Near, out dropped, false); //this will create a new key somehow. if (dropped != null) { Messages.Message("Unlocked " + locked_app.def.label, p, MessageTypeDefOf.SilentInput); //parent.DeSpawn(); IntVec3 keyPostition = parent.Position; parent.Destroy(); keyPostition.GetFirstThing(p.MapHeld, xxx.holokey).Destroy(); // so I need this line to despawn the new generated key. } else if (PawnUtility.ShouldSendNotificationAbout(p)) { Messages.Message("Couldn't drop " + locked_app.def.label, p, MessageTypeDefOf.NegativeEvent); } } else if (any_locked) { Messages.Message("The key doesn't fit!", p, MessageTypeDefOf.NegativeEvent); } }
public override void PostDraw() { if (drawOnlySouth && parent.Rotation == Rot4.South) { Graphic.Draw(GenThing.TrueCenter(parent.Position, parent.Rotation, parent.def.size, Props.Altitude), parent.Rotation, parent, 0f); } else { Graphic.Draw(GenThing.TrueCenter(parent.Position, parent.Rotation, parent.def.size, Props.Altitude), parent.Rotation, parent, 0f); } }
/// <summary> /// 绘制 /// </summary> public override void PostDraw() { base.PostDraw(); if (Props.gas == null || Props.gas.Count == 0) { return; } for (int i = 0; i < Props.gas.Count; i++) { Props.gas[i].graphicData.Graphic.Draw(GenThing.TrueCenter(parent.Position, parent.Rotation, parent.def.size, Props.gas[i].altitudeLayer.AltitudeFor()), parent.Rotation, parent, 0f); } }