private void InitVerb(Verb verb, VerbProperties properties, IVerbOwner owner, Tool tool, ManeuverDef maneuver, string id) { verb.loadID = id; verb.verbProps = properties; verb.tool = tool; verb.maneuver = maneuver; CompEquippable compEquippable = this.directOwner as CompEquippable; Pawn pawn = this.directOwner as Pawn; HediffComp_VerbGiver hediffComp_VerbGiver = this.directOwner as HediffComp_VerbGiver; if (compEquippable != null) { verb.ownerEquipment = compEquippable.parent; } else if (pawn != null) { verb.caster = pawn; } else if (hediffComp_VerbGiver != null) { verb.ownerHediffComp = hediffComp_VerbGiver; verb.caster = hediffComp_VerbGiver.Pawn; } if (verb.tool != null) { if (verb.ownerEquipment != null) { verb.implementOwnerType = ImplementOwnerTypeDefOf.Weapon; } else if (verb.ownerHediffComp != null) { verb.implementOwnerType = ImplementOwnerTypeDefOf.Hediff; } else { verb.implementOwnerType = ImplementOwnerTypeDefOf.Bodypart; } } }
public IEnumerable <Command> GetVerbsCommands(KeyCode hotKey = KeyCode.None) { CompEquippable ce = this.directOwner as CompEquippable; if (ce != null) { Thing ownerThing = ce.parent; List <Verb> verbs = this.AllVerbs; for (int i = 0; i < verbs.Count; i++) { Verb verb = verbs[i]; if (verb.verbProps.hasStandardCommand) { yield return((Command)this.CreateVerbTargetCommand(ownerThing, verb)); /*Error: Unable to find new state assignment for yield return*/; } } CompEquippable equippable = this.directOwner as CompEquippable; if (this.directOwner.Tools.NullOrEmpty()) { yield break; } if (equippable == null) { yield break; } if (!equippable.parent.def.IsMeleeWeapon) { yield break; } yield return((Command)this.CreateVerbTargetCommand(ownerThing, (from v in verbs where v.verbProps.MeleeRange select v).FirstOrDefault())); /*Error: Unable to find new state assignment for yield return*/; } }
public IEnumerable <Command> GetVerbsCommands(KeyCode hotKey = KeyCode.None) { CompEquippable ce = this.directOwner as CompEquippable; if (ce != null) { Thing ownerThing = ce.parent; List <Verb> verbs = this.AllVerbs; for (int i = 0; i < verbs.Count; i++) { Verb verb = verbs[i]; if (verb.verbProps.hasStandardCommand) { yield return(this.CreateVerbTargetCommand(ownerThing, verb)); } } if (!this.directOwner.Tools.NullOrEmpty <Tool>() && ce != null && ce.parent.def.IsMeleeWeapon) { yield return(this.CreateVerbTargetCommand(ownerThing, (from v in verbs where v.verbProps.IsMeleeAttack select v).FirstOrDefault <Verb>())); } } }
public IEnumerable <Command> GetVerbsCommands(KeyCode hotKey = KeyCode.None) { CompEquippable ce = directOwner as CompEquippable; if (ce == null) { yield break; } Thing ownerThing = ce.parent; List <Verb> verbs = AllVerbs; for (int i = 0; i < verbs.Count; i++) { Verb verb = verbs[i]; if (verb.verbProps.hasStandardCommand) { yield return(CreateVerbTargetCommand(ownerThing, verb)); } } if (!directOwner.Tools.NullOrEmpty() && ce != null && ce.parent.def.IsMeleeWeapon) { yield return(CreateVerbTargetCommand(ownerThing, verbs.Where((Verb v) => v.verbProps.IsMeleeAttack).FirstOrDefault())); } }