Пример #1
0
        private Command_VerbTarget CreateVerbTargetCommand(Thing ownerThing, Verb verb)
        {
            Command_VerbTarget command_VerbTarget = new Command_VerbTarget();

            command_VerbTarget.defaultDesc = ownerThing.LabelCap + ": " + ownerThing.def.description.CapitalizeFirst();
            command_VerbTarget.icon        = ownerThing.def.uiIcon;
            command_VerbTarget.iconAngle   = ownerThing.def.uiIconAngle;
            command_VerbTarget.iconOffset  = ownerThing.def.uiIconOffset;
            command_VerbTarget.tutorTag    = "VerbTarget";
            command_VerbTarget.verb        = verb;
            if (verb.caster.Faction != Faction.OfPlayer)
            {
                command_VerbTarget.Disable("CannotOrderNonControlled".Translate());
            }
            else if (verb.CasterIsPawn)
            {
                if (verb.CasterPawn.story.WorkTagIsDisabled(WorkTags.Violent))
                {
                    command_VerbTarget.Disable("IsIncapableOfViolence".Translate(new object[]
                    {
                        verb.CasterPawn.LabelShort
                    }));
                }
                else if (!verb.CasterPawn.drafter.Drafted)
                {
                    command_VerbTarget.Disable("IsNotDrafted".Translate(new object[]
                    {
                        verb.CasterPawn.LabelShort
                    }));
                }
            }
            return(command_VerbTarget);
        }
Пример #2
0
        // New methods

        public override IEnumerable <Gizmo> GetGizmos()
        {
            if (Faction == Faction.OfPlayer)
            {
                // Ammo gizmos
                if (compAmmo != null)
                {
                    foreach (Command com in compAmmo.CompGetGizmosExtra())
                    {
                        yield return(com);
                    }
                }
                if (mountableComp.IsMounted)
                {      // Fire mode gizmos
                    if (compFireModes != null)
                    {
                        foreach (Command com in compFireModes.GenerateGizmos())
                        {
                            yield return(com);
                        }
                    }

                    // Stop forced attack gizmo
                    Gizmo stop = new Command_Action()
                    {
                        defaultLabel = "CommandStopForceAttack".Translate(),
                        defaultDesc  = "CommandStopForceAttackDesc".Translate(),
                        icon         = ContentFinder <Texture2D> .Get("UI/Commands/Halt", true),
                        action       = new Action(delegate
                        {
                            forcedTarget = TargetInfo.Invalid;
                            SoundDefOf.TickLow.PlayOneShotOnCamera();
                        }),
                        hotKey = KeyBindingDefOf.Misc5
                    };
                    yield return(stop);

                    // Set forced target gizmo
                    if ((mannableComp != null && mannableComp.MannedNow && mannableComp.ManningPawn.Faction == Faction.OfPlayer) ||
                        (mannableComp == null && Faction == Faction.OfPlayer))
                    {
                        Gizmo attack = new Command_VerbTarget()
                        {
                            defaultLabel = "CommandSetForceAttackTarget".Translate(),
                            defaultDesc  = "CommandSetForceAttackTargetDesc".Translate(),
                            icon         = ContentFinder <Texture2D> .Get("UI/Commands/Attack", true),
                            verb         = GunCompEq.PrimaryVerb,
                            hotKey       = KeyBindingDefOf.Misc4
                        };
                        yield return(attack);
                    }
                }
            }

            foreach (Gizmo gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }
        }
Пример #3
0
		public override void MergeWith(Gizmo other)
		{
			base.MergeWith(other);
			Command_VerbTarget command_VerbTarget = other as Command_VerbTarget;
			if (command_VerbTarget == null)
			{
				Log.ErrorOnce("Tried to merge Command_VerbTarget with unexpected type", 73406263);
				return;
			}
			if (groupedVerbs == null)
			{
				groupedVerbs = new List<Verb>();
			}
			groupedVerbs.Add(command_VerbTarget.verb);
			if (command_VerbTarget.groupedVerbs != null)
			{
				groupedVerbs.AddRange(command_VerbTarget.groupedVerbs);
			}
		}