public static Job TrashJob(Pawn pawn, Thing t) { Plant plant = t as Plant; if (plant != null) { Job job = new Job(JobDefOf.Ignite, t); TrashUtility.FinalizeTrashJob(job); return(job); } if (pawn.equipment != null && Rand.Value < 0.699999988079071) { foreach (Verb allEquipmentVerb in pawn.equipment.AllEquipmentVerbs) { if (allEquipmentVerb.verbProps.ai_IsBuildingDestroyer) { Job job2 = new Job(JobDefOf.UseVerbOnThing, t); job2.verbToUse = allEquipmentVerb; TrashUtility.FinalizeTrashJob(job2); return(job2); } } } Job job3 = null; float value = Rand.Value; job3 = ((!(value < 0.34999999403953552) || pawn.natives.IgniteVerb == null || !t.FlammableNow || t.IsBurning() || t is Building_Door) ? new Job(JobDefOf.AttackMelee, t) : new Job(JobDefOf.Ignite, t)); TrashUtility.FinalizeTrashJob(job3); return(job3); }
public static Job TrashJob(Pawn pawn, Thing t, bool allowPunchingInert = false) { Plant plant = t as Plant; if (plant != null) { Job job = new Job(JobDefOf.Ignite, t); TrashUtility.FinalizeTrashJob(job); return(job); } if (pawn.equipment != null && Rand.Value < 0.7f) { foreach (Verb current in pawn.equipment.AllEquipmentVerbs) { if (current.verbProps.ai_IsBuildingDestroyer) { Job job2 = new Job(JobDefOf.UseVerbOnThing, t); job2.verbToUse = current; TrashUtility.FinalizeTrashJob(job2); return(job2); } } } float value = Rand.Value; Job job3; if (value < 0.35f && pawn.natives.IgniteVerb != null && pawn.natives.IgniteVerb.IsStillUsableBy(pawn) && t.FlammableNow && !t.IsBurning() && !(t is Building_Door)) { job3 = new Job(JobDefOf.Ignite, t); } else { Building building = t as Building; bool flag = building != null && building.def.building.isInert; if (flag && !allowPunchingInert) { return(null); } job3 = new Job(JobDefOf.AttackMelee, t); } TrashUtility.FinalizeTrashJob(job3); return(job3); }
public static Job TrashJob(Pawn pawn, Thing t) { Plant plant = t as Plant; Job result; if (plant != null) { Job job = new Job(JobDefOf.Ignite, t); TrashUtility.FinalizeTrashJob(job); result = job; } else { if (pawn.equipment != null && Rand.Value < 0.7f) { foreach (Verb verb in pawn.equipment.AllEquipmentVerbs) { if (verb.verbProps.ai_IsBuildingDestroyer) { Job job2 = new Job(JobDefOf.UseVerbOnThing, t); job2.verbToUse = verb; TrashUtility.FinalizeTrashJob(job2); return(job2); } } } float value = Rand.Value; Job job3; if (value < 0.35f && pawn.natives.IgniteVerb != null && pawn.natives.IgniteVerb.IsStillUsableBy(pawn) && t.FlammableNow && !t.IsBurning() && !(t is Building_Door)) { job3 = new Job(JobDefOf.Ignite, t); } else { job3 = new Job(JobDefOf.AttackMelee, t); } TrashUtility.FinalizeTrashJob(job3); result = job3; } return(result); }