public override void UsedThisTick() { base.UsedThisTick(); lastUsedTick = Find.TickManager.TicksGame; if (effecter == null) { EffecterDef effecterDef = DefDatabase <EffecterDef> .GetNamedSilentFail("Drill"); if (effecterDef == null) { return; } effecter = effecterDef.Spawn(); } else { effecter.EffectTick(this, this); } if (Find.TickManager.TicksGame % FilthRate == 0) { FilthMaker.MakeFilth(this.RandomAdjacentCell8Way(), MapHeld, FilthDef); } if (lastStartedTick + TicksUntilDamage < Find.TickManager.TicksGame) { lastStartedTick = Find.TickManager.TicksGame; Vein.TakeDamage(new DamageInfo(DamageDefOf.Crush, DamageRate)); } }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnAggroMentalState(TargetIndex.A); this.FailOnDespawnedNullOrForbidden(TargetIndex.A); this.FailOn(delegate { return(!Deliveree.OnBaseMechanoidPlatform()); }); Need_Maintenance need = Deliveree.needs.TryGetNeed <Need_Maintenance>() as Need_Maintenance; Toil reserveParts = null; reserveParts = ReserveParts(TargetIndex.B, need).FailOnDespawnedNullOrForbidden(TargetIndex.B); yield return(reserveParts); yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.B)); yield return(PickupParts(TargetIndex.B, need).FailOnDestroyedOrNull(TargetIndex.B)); yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserveParts, TargetIndex.B, TargetIndex.None, true, null)); PathEndMode interactionCell = (this.Deliveree != this.pawn) ? PathEndMode.InteractionCell : PathEndMode.OnCell; yield return(Toils_Goto.GotoThing(TargetIndex.A, interactionCell)); int duration = (int)(1f / this.pawn.GetStatValue(WTH_DefOf.WTH_HackingMaintenanceSpeed, true) * 600f); EffecterDef effect = DefDatabase <EffecterDef> .AllDefs.FirstOrDefault((EffecterDef ed) => ed.defName == "Repair"); yield return(Toils_General.Wait(duration, TargetIndex.None).FailOnCannotTouch(TargetIndex.A, interactionCell).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f).WithEffect(effect, TargetIndex.A)); yield return(FinalizeMaintenance(this.Deliveree, need, reserveParts)); }
public override void Tick() { base.Tick(); ticksLeft--; if (ticksLeft <= 0) { this.Destroy(); } if (Spawned) { if (effecter == null) { EffecterDef progressBar = EffecterDefOf.ProgressBar; effecter = progressBar.Spawn(); } else { LocalTargetInfo target = this; if (this.Spawned) { effecter.EffectTick(this, TargetInfo.Invalid); } MoteProgressBar mote = ((SubEffecter_ProgressBar)effecter.children[0]).mote; if (mote != null) { float result = 1f - (float)(PawnGhost.ticksToDestroy - this.ticksLeft) / (float)PawnGhost.ticksToDestroy; mote.progress = Mathf.Clamp01(result); mote.offsetZ = -0.5f; } } } }
public static void DoEffecter(EffecterDef effecterDef, IntVec3 position, Map map) { Effecter effecter = effecterDef.Spawn(); effecter.Trigger(new TargetInfo(position, map, false), new TargetInfo(position, map, false)); effecter.Cleanup(); }
public static Toil WithEffect(this Toil toil, Func <EffecterDef> effecterDefGetter, Func <LocalTargetInfo> effectTargetGetter) { Effecter effecter = null; toil.AddPreTickAction(delegate { if (effecter == null) { EffecterDef effecterDef = effecterDefGetter(); if (effecterDef != null) { effecter = effecterDef.Spawn(); } } else { effecter.EffectTick(toil.actor, effectTargetGetter().ToTargetInfo(toil.actor.Map)); } }); toil.AddFinishAction(delegate { if (effecter != null) { effecter.Cleanup(); effecter = null; } }); return(toil); }
public EffecterDef Effect(MaterialKind kind) { EffecterDef res = null; switch (kind) { case MaterialKind.None: res = fallback; break; case MaterialKind.Fabric: res = fabric; break; case MaterialKind.Flesh: res = flesh; break; case MaterialKind.Metal: res = metal; break; case MaterialKind.Soil: res = soil; break; case MaterialKind.Stone: res = stone; break; case MaterialKind.Wood: res = wood; break; } if (res == null) { res = fallback; } return(res); }
private static RecipeDef CreateMiningRecipe(ThingDefCountClass defCount, EffecterDef effecter) { RecipeDef r = new RecipeDef(); r.defName = "Recipe_AutoMachineTool_Mine_" + defCount.thingDef.defName; r.label = "PRF.AutoMachineTool.AutoMiner.MineOre".Translate(defCount.thingDef.label); r.jobString = "PRF.AutoMachineTool.AutoMiner.MineOre".Translate(defCount.thingDef.label); r.workAmount = Mathf.Max(10000f, StatDefOf.MarketValue.Worker.GetValue(StatRequest.For(defCount.thingDef, null)) * defCount.count * 1000); r.workSpeedStat = StatDefOf.WorkToMake; r.efficiencyStat = StatDefOf.WorkToMake; r.workSkill = SkillDefOf.Mining; r.workSkillLearnFactor = 0; r.products = new List <ThingDefCountClass>().Append(defCount); r.defaultIngredientFilter = new ThingFilter(); r.effectWorking = effecter; // ChunkStone が Recipe の WorkAmount 経由で価値を設定されてしまうため、BaseMarketValue に0を設定して、計算されないようにする。 // <see cref="StatWorker_MarketValue.CalculatedBaseMarketValue(BuildableDef, ThingDef)"/> if (!defCount.thingDef.statBases.StatListContains(StatDefOf.MarketValue) && defCount.count == 1) { defCount.thingDef.BaseMarketValue = 0; } return(r); }
public override void CompPostTick(ref float severityAdjustment) { base.CompPostTick(ref severityAdjustment); if (Find.TickManager.TicksGame % 60 == 0) { //if (!werewolfFlagged && Pawn?.GetComp<CompWerewolf>() is CompWerewolf compWW && compWW.CurrentWerewolfForm != null) //{ // werewolfFlagged = true; // baseRageDuration = null; // rageRemaining = -999; //} if (Pawn.Spawned) { if (effecter == null) { EffecterDef progressBar = EffecterDefOf.ProgressBar; effecter = progressBar.Spawn(); } else { LocalTargetInfo target = Pawn; if (Pawn.Spawned) { effecter.EffectTick(Pawn, TargetInfo.Invalid); } MoteProgressBar mote = ((SubEffecter_ProgressBar)effecter.children[0]).mote; if (mote != null) { float result = 1f - (float)(this.BaseRageDuration() - this.RageRemaining) / (float)this.BaseRageDuration(); mote.progress = Mathf.Clamp01(result); mote.offsetZ = -1.0f; } } } if (RageRemaining < 0 || !Pawn.Spawned || (Pawn.GetComp <CompWerewolf>() is CompWerewolf ww && !ww.IsTransformed)) { this.effecter.Cleanup(); //Log.Message("Rage ended"); severityAdjustment = -999.99f; if (Pawn?.mindState?.mentalStateHandler?.CurState is MentalState_WerewolfFury fury) { fury.RecoverFromState(); } if (Pawn?.GetComp <CompWerewolf>() is CompWerewolf compWerewolf) { if (compWerewolf.CurrentWerewolfForm != null) { compWerewolf.TransformBack(); } } return; } RageRemaining--; } }
public EffecterComp(EffecterDef def) : base(def) { this.def = def; for (int i = 0; i < def.children.Count; i++) { this.children.Add(def.children[i].Spawn(this)); } }
public WorldEffecter(EffecterDef def) { this.def = def; for (int i = 0; i < def.children.Count; i++) { this.children.Add(def.children[i].Spawn()); } }
protected override IEnumerable <Toil> MakeNewToils() { Toil to = new Toil() { initAction = delegate { ticksLeft = Rand.Range(300, 900); int num = 0; IntVec3 c; while (true) { c = pawn.Position + GenAdj.AdjacentCellsAndInside[Rand.Range(0, 9)]; num++; if (num > 12) { break; } if (c.InBounds(pawn.Map) && c.Standable(pawn.Map)) { goto IL_A1; } } c = pawn.Position; IL_A1: pawn.CurJob.targetA = c; pawn.Drawer.rotator.FaceCell(c); pawn.pather.StopDead(); }, tickAction = delegate { int curTicks = ticksLeft; if (curTicks % 150 == 149) { FilthMaker.MakeFilth(pawn.CurJob.targetA.Cell, pawn.Map, ThingDefOf.FilthBlood, pawn.LabelIndefinite(), 1); if (pawn.BloodNeed() is Need_Blood n && n.CurBloodPoints > 0) { n.AdjustBlood(-1); } } ticksLeft--; if (curTicks - 1 <= 0) { ReadyForNextToil(); TaleRecorder.RecordTale(TaleDefOf.Vomited, new object[] { pawn }); } } }; to.defaultCompleteMode = ToilCompleteMode.Never; to.WithEffect(EffecterDef.Named("ROMV_BloodVomit"), TargetIndex.A); to.PlaySustainerOrSound(() => SoundDef.Named("Vomit")); yield return(to); }
public EffecterDefWidget(EffecterDef def) { this.EffecterDef = def; this.positionRadius = new FloatInputWidget <EffecterDef>( this.EffecterDef, "Position Radius", (d) => d.positionRadius, (d, f) => d.positionRadius = f); this.offsetTowardsTarget = new MinMaxInputWidget <EffecterDef, float>("Offset Towards Target", new FloatInputWidget <EffecterDef>(this.EffecterDef, "Min", (d) => d.offsetTowardsTarget.min, (d, f) => d.offsetTowardsTarget.min = f), new FloatInputWidget <EffecterDef>(this.EffecterDef, "Max", (d) => d.offsetTowardsTarget.max, (d, f) => d.offsetTowardsTarget.max = f)); }
public void Setup(Thing launcher, Vector3 origin, Vector3 destination, Verb verb = null, Thing hitThing = null, Effecter effecter = null, EffecterDef effecterDef = null) { //SetColor(launcher); this.launcher = launcher; this.verb = verb; this.a = origin; this.b = destination; this.hitThing = hitThing ?? null; this.effecter = effecter ?? null; this.effecterDef = effecterDef ?? null; Map map = verb?.Caster?.Map ?? launcher.Map; Vector3 dir = (destination - origin).normalized; dir.y = 0; Vector3 a = origin;// += dir * (defWeapon == null ? 0.9f : defWeapon.barrelLength); if (verb != null) { if (verb.Muzzle(out float barrelLength, out float barrelOffset, out float bulletOffset, out FleckDef flareDef, out float flareSize, out FleckDef smokeDef, out float smokeSize)) { a = origin -= dir * (barrelOffset * (verb.EquipmentSource.def.graphicData.drawSize.magnitude / 4)); a.y += 0.0367346928f; if (flareDef != null) { IAdvancedVerb properties = verb.verbProps as IAdvancedVerb; Rand.PushState(); AdeptusFleckMaker.Static(a, map, flareDef, flareSize, properties?.MuzzleFlareColor, properties != null && properties.MuzzleFlareRotates ? (float?)Rand.Range(0, 350) : null, projDef.lifetime); Rand.PopState(); } if (smokeDef != null) { AdeptusFleckMaker.ThrowSmoke(a, smokeSize, map, smokeDef); } } FleckMaker.Static(a, launcher.Map, FleckDefOf.ShotFlash, verb.verbProps.muzzleFlashScale); } if (effecter == null) { TriggerEffect(effecterDef, b, hitThing); } ProjectileVFX ext = this.projDef.GetModExtensionFast <ProjectileVFX>(); if (ext != null && destination.InBounds(launcher.Map)) { Vector3 pos = destination; ThingDef explosionMoteDef = ext.ExplosionMoteDef ?? projDef.projectile.damageDef.explosionCellMote ?? null; SoundDef sound = projDef.projectile.damageDef.soundExplosion; Color? color = ext.useGraphicColor ? projDef.graphic.color : (ext.useGraphicColorTwo ? projDef.graphic.colorTwo : projDef.projectile.damageDef.explosionColorCenter); float scale = ext.scaleWithProjectile ? projDef.graphic.drawSize.magnitude : 1f; ext.ImpactEffects(pos, map, explosionMoteDef, ext.ExplosionMoteSize * scale, color, sound, ext.ImpactMoteDef, ext.ImpactMoteSize * scale, ext.ImpactGlowMoteDef, ext.ImpactGlowMoteSize * scale, hitThing, null, (int)((projDef.lifetime - ticks) * 1.1f)); // ext.ImpactEffects(destination, launcher.Map, ext.ExplosionMoteDef ?? this.projDef.projectile.damageDef.explosionCellMote, ext.ExplosionMoteSize, this.projDef.projectile.damageDef.explosionColorCenter, this.projDef.projectile.damageDef.soundExplosion, ext.ImpactMoteDef, ext.ImpactMoteSize, ext.ImpactGlowMoteDef, ext.ImpactGlowMoteSize, hitThing); } }
public void ResolveReferences() { if (effecter == null) { effecter = DefDatabase <EffecterDef> .GetNamed("OG_Effecter_EMP"); } if (soundSustainer == null) { soundSustainer = DefDatabase <SoundDef> .GetNamed("EmpDisabled"); } }
/// <summary> /// Start or maintain the laser drill effecter. /// </summary> public void StartOrMaintainLaserDrillEffecter() { if (this.laserDrillEffecter == null) { this.laserDrillEffecter = new Effecter(EffecterDef.Named("LaserDrill")); } else { this.laserDrillEffecter.EffectTick(new TargetInfo(this.targetPosition, this.Map), new TargetInfo(this.Position, this.Map)); } }
void TriggerEffect(EffecterDef effect, Vector3 position) { if (effect == null) { return; } var targetInfo = new TargetInfo(IntVec3.FromVector3(position), Map, false); Effecter effecter = effect.Spawn(); effecter.offset = position - targetInfo.CenterVector3; effecter.Trigger(targetInfo, targetInfo); effecter.Cleanup(); }
void TriggerEffect(EffecterDef effect, IntVec3 dest) { if (effect == null) { return; } var targetInfo = new TargetInfo(dest, Map, false); Effecter effecter = effect.Spawn(); effecter.Trigger(targetInfo, targetInfo); effecter.Cleanup(); }
// Token: 0x06003BF5 RID: 15349 RVA: 0x001C4174 File Offset: 0x001C2574 public static Toil NPCWithProgressBar(this Toil toil, TargetIndex ind, Func <float> progressGetter, bool interpolateBetweenActorAndTarget = false, float offsetZ = -0.5f) { Effecter effecter = null; toil.AddPreTickAction(delegate { /* * if (toil.actor.Faction != Faction.OfPlayer) * { * return; * } */ if (effecter == null) { EffecterDef progressBar = EffecterDefOf.ProgressBar; effecter = progressBar.Spawn(); } else { LocalTargetInfo target = toil.actor.CurJob.GetTarget(ind); if (!target.IsValid || (target.HasThing && !target.Thing.Spawned)) { effecter.EffectTick(toil.actor, TargetInfo.Invalid); } else if (interpolateBetweenActorAndTarget) { effecter.EffectTick(toil.actor.CurJob.GetTarget(ind).ToTargetInfo(toil.actor.Map), toil.actor); } else { effecter.EffectTick(toil.actor.CurJob.GetTarget(ind).ToTargetInfo(toil.actor.Map), TargetInfo.Invalid); } MoteProgressBar mote = ((SubEffecter_ProgressBar)effecter.children[0]).mote; if (mote != null) { mote.progress = Mathf.Clamp01(progressGetter()); mote.offsetZ = offsetZ; } } }); toil.AddFinishAction(delegate { if (effecter != null) { effecter.Cleanup(); effecter = null; } }); return(toil); }
public void Setup(Thing launcher, Vector3 origin, Vector3 destination, Thing hitThing = null, Effecter effecter = null, EffecterDef effecterDef = null) { //SetColor(launcher); this.launcher = launcher; this.a = origin; this.b = destination; this.hitThing = hitThing ?? null; this.effecter = effecter ?? null; this.effecterDef = effecterDef ?? null; if (effecter == null) { TriggerEffect(effecterDef, b, hitThing); } }
public void TriggerEffect(EffecterDef effect, Vector3 position, Thing hitThing = null) { if (effect == null) { return; } var targetInfo = hitThing ?? new TargetInfo(IntVec3.FromVector3(position), launcher.Map, false); effecter = effect.Spawn(); effecter.offset = (position - targetInfo.CenterVector3); effecter.ticksLeft = this.projDef.effecterLifetime; effecter.Trigger(targetInfo, null); // effecter.Cleanup(); }
static void Prefix(Projectile __instance, Thing hitThing, Vector3 ___origin) { Map map = __instance.Map; if (map == null) { return; } GunPropDef prop = GunplaySetup.GunProp(__instance.EquipmentDef); if (prop == null) { return; } MaterialKind kind = MaterialKind.None; if (hitThing != null) { kind = MaterialKindGetter.Get(hitThing); } if (kind == MaterialKind.None) { TerrainDef terrainDef = map.terrainGrid.TerrainAt(CellIndicesUtility.CellToIndex(__instance.Position, map.Size.x)); kind = MaterialKindGetter.Get(terrainDef); } if (Gunplay.settings.enableSounds) { SoundDef sound = prop.projectileImpactSound == null ? null : prop.projectileImpactSound.Effect(kind); if (sound != null) { sound.PlayOneShot(new TargetInfo(__instance.Position, map, false)); } } if (Gunplay.settings.enableEffects) { EffecterDef effecterDef = prop.projectileImpactEffect == null ? null : prop.projectileImpactEffect.Effect(kind); if (effecterDef != null) { Effecter effecter = new Effecter(effecterDef); effecter.Trigger(__instance, new TargetInfo(___origin.ToIntVec3(), __instance.Map)); effecter.Cleanup(); } } }
private void AddOrMaintain(EffecterDef def) { for (int i = 0; i < pairs.Count; i++) { if (pairs[i].def == def) { pairs[i].Maintain(); return; } } LiveEffecter liveEffecter = FullPool <LiveEffecter> .Get(); liveEffecter.def = def; liveEffecter.Maintain(); pairs.Add(liveEffecter); }
public static Toil AddIngestionEffects(Toil toil, Pawn chewer, TargetIndex ingestibleInd, TargetIndex eatSurfaceInd) { toil.WithEffect(delegate() { LocalTargetInfo target = toil.actor.CurJob.GetTarget(ingestibleInd); if (!target.HasThing) { return(null); } EffecterDef result = target.Thing.def.ingestible.ingestEffect; if (chewer.RaceProps.intelligence < Intelligence.ToolUser && target.Thing.def.ingestible.ingestEffectEat != null) { result = target.Thing.def.ingestible.ingestEffectEat; } return(result); }, delegate() { if (!toil.actor.CurJob.GetTarget(ingestibleInd).HasThing) { return(null); } Thing thing = toil.actor.CurJob.GetTarget(ingestibleInd).Thing; if (chewer != toil.actor) { return(chewer); } if (eatSurfaceInd != TargetIndex.None && toil.actor.CurJob.GetTarget(eatSurfaceInd).IsValid) { return(toil.actor.CurJob.GetTarget(eatSurfaceInd)); } return(thing); }); toil.PlaySustainerOrSound(delegate() { if (!chewer.RaceProps.Humanlike) { return(null); } LocalTargetInfo target = toil.actor.CurJob.GetTarget(ingestibleInd); if (!target.HasThing) { return(null); } return(target.Thing.def.ingestible.ingestSound); }); return(toil); }
/* Look for mineable resources and add them to the Mine */ public static void Setup() { // localized title-case capitalization class CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture; TextInfo textInfo = cultureInfo.TextInfo; // usage: textInfo.ToTitleCase(string) List <RecipeDef> RecipeDefs = DefDatabase <RecipeDef> .AllDefsListForReading; List <ThingDef> ThingDefs = DefDatabase <ThingDef> .AllDefsListForReading; // scan all the things for (int someThing = 0; someThing < ThingDefs.Count; someThing++) { // select things with deep commonality if (ThingDefs[someThing].deepCommonality > 0) { // Create recipe RecipeDef recipe = new RecipeDef(); recipe.defName = "Excavate".Translate(ThingDefs[someThing].defName); Log.Message("LogMessageFoundResource".Translate(ThingDefs[someThing].label) + "LogMessageAddedRecipe".Translate(recipe.defName)); recipe.label = "Mine".Translate(ThingDefs[someThing].label, " "); recipe.description = "Mine".Translate(ThingDefs[someThing].label, "."); recipe.jobString = "Mining".Translate(ThingDefs[someThing].label); recipe.effectWorking = EffecterDef.Named("Smith"); recipe.efficiencyStat = StatDefOf.MiningSpeed; recipe.workAmount = 332 * ThingDefs[someThing].GetStatValueAbstract(StatDefOf.MarketValue, null); recipe.workSkill = SkillDefOf.Mining; recipe.workSkillLearnFactor = 0.25f; recipe.products.Add(new ThingCountClass(ThingDefs[someThing], 1)); recipe.fixedIngredientFilter = new ThingFilter(); recipe.defaultIngredientFilter = new ThingFilter(); // add bill to mineshaft recipe.recipeUsers = new List <ThingDef>(); recipe.recipeUsers.Add(ThingDef.Named("Mineshaft")); RecipeDefs.Add(recipe); } // has deepCommonality } // loop through things } // Setup
public void TriggerEffect(EffecterDef effect, Vector3 position, Thing hitThing = null) { if (effect == null) { return; } var targetInfo = hitThing != null ? new TargetInfo(hitThing) : new TargetInfo(IntVec3.FromVector3(position), Map, false); if (hitThing != null) { effecter = effect.Spawn(hitThing, hitThing.Map); } else { effecter = effect.Spawn(); } effecter.Trigger(targetInfo, null); // effecter.Cleanup(); }
public void StartRefreshing(Pawn pawn, LocalTargetInfo targetInfo) { //if (pawn.ThingID != this.PodOwnerId) if (this.PodOwner != pawn) { return; } this.SaveNeeds(pawn.needs.AllNeeds); pawn.DeSpawn(DestroyMode.Vanish); if (this.TryAcceptThing(pawn)) { this.CurrentTicksLeft = this.CurrentMaxTicks = this.TotalTicksPerAction; this.JobState = PS_Conditioning_JobState.Refreshing; EffecterDef progressBar = EffecterDefOf.ProgressBar; ProgressBarEffector = progressBar.Spawn(); ProgressBarEffector.EffectTick(targetInfo.ToTargetInfo(this.Map), TargetInfo.Invalid); } }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedNullOrForbidden(TargetIndex.A); this.FailOn(() => RogueAI.goingRogue == false); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch)); int duration = (int)(3000 + (1f / this.pawn.GetStatValue(WTH_DefOf.WTH_HackingMaintenanceSpeed, true)) * 500f); EffecterDef effect = DefDatabase <EffecterDef> .AllDefs.FirstOrDefault((EffecterDef ed) => ed.defName == "Repair"); yield return(Toils_General.Wait(duration, TargetIndex.None).FailOnCannotTouch(TargetIndex.A, PathEndMode.ClosestTouch).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f).WithEffect(effect, TargetIndex.A)); Toil finalizeHacking = new Toil() { defaultCompleteMode = ToilCompleteMode.Instant, initAction = new Action(delegate { Messages.Message("WTH_Message_HackedRogueAI".Translate(this.pawn.Name.ToStringShort), new RimWorld.Planet.GlobalTargetInfo(this.pawn.Position, this.Map), MessageTypeDefOf.PositiveEvent); RogueAI.StopGoingRogue(); }) }; yield return(finalizeHacking); }
public static Toil AddIngestionEffects(Toil toil, Pawn chewer, TargetIndex ingestibleInd, TargetIndex eatSurfaceInd) { toil.WithEffect(delegate { LocalTargetInfo target2 = toil.actor.CurJob.GetTarget(ingestibleInd); if (!target2.HasThing) { return(null); } EffecterDef result = target2.Thing.GetIngestibleProperties().ingestEffect; if ((int)chewer.RaceProps.intelligence < 1 && target2.Thing.GetIngestibleProperties().ingestEffectEat != null) { result = target2.Thing.GetIngestibleProperties().ingestEffectEat; } return(result); }, delegate { if (!toil.actor.CurJob.GetTarget(ingestibleInd).HasThing) { return(null); } Thing thing = toil.actor.CurJob.GetTarget(ingestibleInd).Thing; if (chewer != toil.actor) { return(chewer); } return((eatSurfaceInd != 0 && toil.actor.CurJob.GetTarget(eatSurfaceInd).IsValid) ? toil.actor.CurJob.GetTarget(eatSurfaceInd) : ((LocalTargetInfo)thing)); }); toil.PlaySustainerOrSound(delegate { if (!chewer.RaceProps.Humanlike) { return(null); } LocalTargetInfo target = toil.actor.CurJob.GetTarget(ingestibleInd); return((!target.HasThing) ? null : target.Thing.GetIngestibleProperties().ingestSound); }); return(toil); }
public void StartFixingBotched(Pawn pawn) { //if (pawn.ThingID != this.PodOwnerId) if (PodOwner != null && PodOwner != pawn) { return; } SaveNeeds(pawn.needs.AllNeeds); pawn.DeSpawn(DestroyMode.Vanish); if (TryAcceptThing(pawn)) { CurrentTicksLeft = CurrentMaxTicks = TicksPerDay; JobState = PS_Conditioning_JobState.FixingBotch; EffecterDef progressBar = EffecterDefOf.ProgressBar; ProgressBarEffector = progressBar.Spawn(); var target = new TargetInfo(this); ProgressBarEffector.EffectTick(target, TargetInfo.Invalid); } }
public void StartDeconditioning(Pawn pawn, PS_Conditioning_Data conData) { //if (pawn.ThingID != this.PodOwnerId) if (this.PodOwner != pawn) { return; } this.SaveNeeds(pawn.needs.AllNeeds); pawn.DeSpawn(DestroyMode.Vanish); if (this.TryAcceptThing(pawn)) { this.CurrentMaxTicks = this.TicksPerDay; this.CurrentTicksLeft = CurrentMaxTicks; this.JobState = PS_Conditioning_JobState.Deconditioning; this.ConditioningData = conData; EffecterDef progressBar = EffecterDefOf.ProgressBar; ProgressBarEffector = progressBar.Spawn(); var target = new TargetInfo(this); ProgressBarEffector.EffectTick(target, TargetInfo.Invalid); } }