コード例 #1
0
        public override bool GroupsWith(Gizmo other)
        {
            if (!base.GroupsWith(other))
            {
                return(false);
            }
            Command_Reloadable command_Reloadable = other as Command_Reloadable;

            if (command_Reloadable == null)
            {
                return(false);
            }
            return(comp.parent.def == command_Reloadable.comp.parent.def);
        }
コード例 #2
0
        private Command_Reloadable CreateVerbTargetCommand(Thing gear, Verb verb)
        {
            Command_Reloadable command_Reloadable = new Command_Reloadable(this);

            command_Reloadable.defaultDesc  = gear.def.description;
            command_Reloadable.hotKey       = Props.hotKey;
            command_Reloadable.defaultLabel = verb.verbProps.label;
            command_Reloadable.verb         = verb;
            if (verb.verbProps.defaultProjectile != null && verb.verbProps.commandIcon == null)
            {
                command_Reloadable.icon          = verb.verbProps.defaultProjectile.uiIcon;
                command_Reloadable.iconAngle     = verb.verbProps.defaultProjectile.uiIconAngle;
                command_Reloadable.iconOffset    = verb.verbProps.defaultProjectile.uiIconOffset;
                command_Reloadable.overrideColor = verb.verbProps.defaultProjectile.graphicData.color;
            }
            else
            {
                command_Reloadable.icon             = ((verb.UIIcon != BaseContent.BadTex) ? verb.UIIcon : gear.def.uiIcon);
                command_Reloadable.iconAngle        = gear.def.uiIconAngle;
                command_Reloadable.iconOffset       = gear.def.uiIconOffset;
                command_Reloadable.defaultIconColor = gear.DrawColor;
            }
            if (!Wearer.IsColonistPlayerControlled)
            {
                command_Reloadable.Disable();
            }
            else if (verb.verbProps.violent && Wearer.WorkTagIsDisabled(WorkTags.Violent))
            {
                command_Reloadable.Disable("IsIncapableOfViolenceLower".Translate(Wearer.LabelShort, Wearer).CapitalizeFirst() + ".");
            }
            else if (!CanBeUsed)
            {
                command_Reloadable.Disable(DisabledReason(MinAmmoNeeded(allowForcedReload: false), MaxAmmoNeeded(allowForcedReload: false)));
            }
            return(command_Reloadable);
        }