コード例 #1
0
        public override void SetDefaults()
        {
            item.width  = 32;
            item.height = 32;

            item.useStyle     = ItemUseStyleID.HoldingOut;
            item.useTurn      = true;
            item.UseSound     = SoundID.Item6;
            item.useTime      = 10;
            item.useAnimation = 10;

            item.noUseGraphic = true;             //hmm yes let me remove the held item layer instead

            damage = GunHelper.DamageFromParts(parts);
            GunHelper.SetDefaults(item);
        }
コード例 #2
0
        public override void ModifyTooltips(List <TooltipLine> tooltips)
        {
            foreach (TooltipLine line in tooltips)
            {
                if (line.Name == "ItemName" && line.mod == "Terraria")
                {
                    line.text = GunHelper.GetToolName(parts) + " " + itemType;
                }
            }

            string effectsText = "";

            foreach (KeyValuePair <string, int> pair in effects)
            {
                EffectType effectType = GunHelper.GetEffectType(pair.Key);
                if (effectsText != "")
                {
                    effectsText += "\n";
                }

                effectsText += $"{effectType.name}";
                if (effectType.showLevel)
                {
                    effectsText += $" Level {pair.Value}";
                }
                if (Main.keyState.PressingShift())
                {
                    effectsText += $": {effectType.desc}";
                }
            }
            tooltips.Add(new TooltipLine(mod, "TerrariaConstruct:EffectsLine", effectsText));
            if (!Main.keyState.PressingShift() && effects.Count > 0)
            {
                tooltips.Add(new TooltipLine(mod, "TerrariaConstruct:ShiftMessageLine", "Press Shift to see descriptions!"));
            }

            if (GunHelper.CheckForBrokenParts(parts))
            {
                tooltips.Add(new TooltipLine(mod, "TerrariaConstruct:BrokenPartsLine", "This tool has broken parts! Did you disable a mod since you last played?"));
            }

            tooltips.Add(new TooltipLine(mod, "h", "Damage = " + GunHelper.DamageFromParts(parts)));
        }