//This block of code allows us to change the reload sounds.
        protected override void Update()
        {
            if (gun.CurrentOwner)
            {
                if (!gun.PreventNormalFireAudio)
                {
                    this.gun.PreventNormalFireAudio = true;
                }
                if (!gun.IsReloading && !HasReloaded)
                {
                    this.HasReloaded = true;
                }
            }

            UnchangeableRangeController ranger = this.gun.projectile.gameObject.AddComponent <UnchangeableRangeController>();

            ranger.Update();
        }
        public static void Add()
        {
            // Get yourself a new gun "base" first.
            // Let's just call it "Basic Gun", and use "jpxfrd" for all sprites and as "codename" All sprites must begin with the same word as the codename. For example, your firing sprite would be named "jpxfrd_fire_001".
            Gun gun = ETGMod.Databases.Items.NewGun("GunLance", "GnLnc");

            // "kp:basic_gun determines how you spawn in your gun through the console. You can change this command to whatever you want, as long as it follows the "name:itemname" template.
            Game.Items.Rename("outdated_gun_mods:gunlance", "ski:gunlance");
            gun.gameObject.AddComponent <GunLance>();
            //These two lines determines the description of your gun, ".SetShortDescription" being the description that appears when you pick up the gun and ".SetLongDescription" being the description in the Ammonomicon entry.
            gun.SetShortDescription("This is my BOOM STICK!");
            gun.SetLongDescription("\nA lance made from Dragun peices that has been retrofitted with a large cannon barrel and a cylinder." +
                                   " As The curse of Kaliber spread through the gungeon many weapons of old were retroactively upgraded to fill her insatiable desire for firearms.\n\n" +
                                   "Hold charge to change 3 different fire types!\n" +
                                   "No charge = swipe. \n" +
                                   "First Charge = shelling. \n" +
                                   "Second Charge = wyvernstake." +
                                   "\n\n\n - Knife_to_a_Gunfight");;


            gun.SetupSprite(null, "GnLnc_idle_001", 8);
            gun.SetAnimationFPS(gun.chargeAnimation, 5);

            gun.SetAnimationFPS(gun.shootAnimation, 45);
            gun.SetAnimationFPS(gun.reloadAnimation, 16);

            gun.AddProjectileModuleFrom(PickupObjectDatabase.GetByEncounterName("Hegemony Rifle") as Gun, true, false);
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).wrapMode  = tk2dSpriteAnimationClip.WrapMode.LoopSection;
            gun.GetComponent <tk2dSpriteAnimator>().GetClipByName(gun.chargeAnimation).loopStart = 10;



            gun.DefaultModule.ammoCost      = 1;
            gun.DefaultModule.angleVariance = 0;
            gun.gunClass      = GunClass.SILLY;
            gun.gunHandedness = GunHandedness.TwoHanded;

            gun.DefaultModule.shootStyle    = ProjectileModule.ShootStyle.Charged;
            gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Random;

            gun.reloadTime = 2f;
            gun.DefaultModule.numberOfShotsInClip = 4;
            gun.DefaultModule.cooldownTime        = .5f;



            gun.SetBaseMaxAmmo(300);
            gun.quality = PickupObject.ItemQuality.B;
            gun.encounterTrackable.EncounterGuid = "Here Comes the BOOOOOOM!";

            //swipe
            Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(gun.DefaultModule.projectiles[0]);

            gun.barrelOffset.transform.localPosition = new Vector3(1.5f, .5f, 0f);
            gun.DefaultModule.ammoType       = GameUIAmmoType.AmmoType.CUSTOM;
            gun.DefaultModule.customAmmoType = "sail";


            projectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile);
            gun.DefaultModule.projectiles[0] = projectile;
            projectile.baseData.damage       = 8f;
            projectile.baseData.speed        = 3f;
            projectile.baseData.range        = 3f;
            projectile.baseData.force        = 5;
            projectile.name = "slash";
            projectile.tag  = "slash";



            //shelling
            Projectile projectile2 = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(370) as Gun).DefaultModule.chargeProjectiles[1].Projectile);

            projectile2.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile2.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile2);
            gun.DefaultModule.projectiles[0] = projectile2;
            projectile2.baseData.damage      = 14f;
            projectile2.baseData.speed       = 50f;
            projectile2.baseData.range       = 10f;
            projectile2.DefaultTintColor     = UnityEngine.Color.gray;
            projectile2.name = "shelling";



            //wyvernstake
            Projectile projectile3 = UnityEngine.Object.Instantiate <Projectile>((PickupObjectDatabase.GetById(370) as Gun).DefaultModule.chargeProjectiles[1].Projectile);

            projectile3.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile3.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile3);
            gun.DefaultModule.projectiles[0]      = projectile3;
            projectile3.baseData.damage           = 20f;
            projectile3.baseData.speed            = 70f;
            projectile3.baseData.range            = 80f;
            projectile3.AdditionalScaleMultiplier = 3f;
            projectile3.HasDefaultTint            = true;
            projectile3.DefaultTintColor          = UnityEngine.Color.grey;
            projectile3.AppliesKnockbackToPlayer  = true;
            projectile3.PlayerKnockbackForce      = 6;
            projectile3.name = "stake";
            UnchangeableRangeController ranger3 = projectile3.gameObject.AddComponent <UnchangeableRangeController>();

            ranger3.Awake();
            Gun swipeFlash = (Gun)PickupObjectDatabase.GetByEncounterName("Silencer");

            gun.muzzleFlashEffects.type = VFXPoolType.None;

            Gun shellingFlash = (Gun)PickupObjectDatabase.GetByEncounterName("Heck Blaster");


            ProjectileModule.ChargeProjectile item = new ProjectileModule.ChargeProjectile
            {
                Projectile = projectile,
                ChargeTime = 0f,
                AmmoCost   = 0,
            };
            ProjectileModule.ChargeProjectile item2 = new ProjectileModule.ChargeProjectile
            {
                Projectile = projectile2,
                ChargeTime = .2f,
            };
            ProjectileModule.ChargeProjectile item3 = new ProjectileModule.ChargeProjectile
            {
                Projectile = projectile3,
                ChargeTime = 2f,
            };
            gun.DefaultModule.chargeProjectiles = new List <ProjectileModule.ChargeProjectile>
            {
                item,
                item2,
                item3,
            };
            projectile.transform.parent = gun.barrelOffset;
            ETGMod.Databases.Items.Add(gun, null, "ANY");
        }
Пример #3
0
        public static void Add()
        {
            // Get yourself a new gun "base" first.
            // Let's just call it "Basic Gun", and use "jpxfrd" for all sprites and as "codename" All sprites must begin with the same word as the codename. For example, your firing sprite would be named "jpxfrd_fire_001".
            Gun gun = ETGMod.Databases.Items.NewGun("Catalyzer", "Cat");

            // "kp:basic_gun determines how you spawn in your gun through the console. You can change this command to whatever you want, as long as it follows the "name:itemname" template.
            Game.Items.Rename("outdated_gun_mods:catalyzer", "ski:catalyzer");
            gun.gameObject.AddComponent <Catalyzer>();
            //These two lines determines the description of your gun, ".SetShortDescription" being the description that appears when you pick up the gun and ".SetLongDescription" being the description in the Ammonomicon entry.
            gun.SetShortDescription("Activation Energy Required");

            gun.SetLongDescription("This Gun's bullets are made of chemicals on the brink of a reaction.\n\n" +
                                   "They are brimming with terrifying potential. The charge shot of the gun holds enough potential to catalyze the reaction but any damage will do.");
            // This is required, unless you want to use the sprites of the base gun.
            // That, by default, is the pea shooter.
            // SetupSprite sets up the default gun sprite for the ammonomicon and the "gun get" popup.
            // WARNING: Add a copy of your default sprite to Ammonomicon Encounter Icon Collection!
            // That means, "sprites/Ammonomicon Encounter Icon Collection/defaultsprite.png" in your mod .zip. You can see an example of this with inside the mod folder.
            gun.SetupSprite(null, "Cat_idle_001", 8);
            // ETGMod automatically checks which animations are available.
            // The numbers next to "shootAnimation" determine the animation fps. You can also tweak the animation fps of the reload animation and idle animation using this method.
            gun.SetAnimationFPS(gun.shootAnimation, 2);
            // Every modded gun has base projectile it works with that is borrowed from other guns in the game.
            // The gun names are the names from the JSON dump! While most are the same, some guns named completely different things. If you need help finding gun names, ask a modder on the Gungeon discord.
            gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(181) as Gun, true, false);

            // Here we just take the default projectile module and change its settings how we want it to be.
            gun.DefaultModule.ammoCost      = 1;
            gun.DefaultModule.angleVariance = 0;
            gun.gunClass      = GunClass.SILLY;
            gun.gunHandedness = GunHandedness.OneHanded;

            gun.DefaultModule.shootStyle    = ProjectileModule.ShootStyle.Charged;
            gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Random;
            gun.reloadTime = .5f;

            gun.DefaultModule.cooldownTime        = .001f;
            gun.DefaultModule.numberOfShotsInClip = 3;
            gun.SetBaseMaxAmmo(900);

            gun.quality = PickupObject.ItemQuality.C;
            //gun.encounterTrackable.EncounterGuid = "One Herring Twitch! And Kableewy!";



            Projectile projectile = UnityEngine.Object.Instantiate <Projectile>(gun.DefaultModule.projectiles[0]);

            projectile.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile);
            gun.DefaultModule.projectiles[0] = projectile;
            projectile.baseData.damage       = 0f;
            projectile.baseData.speed       *= 1f;
            projectile.baseData.range        = 1003f;
            projectile.HasDefaultTint        = true;
            projectile.DefaultTintColor      = UnityEngine.Color.cyan;
            projectile.transform.parent      = gun.barrelOffset;
            UnchangeableRangeController ranger = projectile.gameObject.AddComponent <UnchangeableRangeController>();



            Projectile projectile2 = UnityEngine.Object.Instantiate <Projectile>(gun.DefaultModule.projectiles[0]);

            projectile2.gameObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(projectile2.gameObject);
            UnityEngine.Object.DontDestroyOnLoad(projectile2);
            gun.DefaultModule.projectiles[0]      = projectile2;
            projectile2.baseData.damage           = 5f;
            projectile2.baseData.speed           *= 1f;
            projectile2.baseData.range            = 1004f;
            projectile.HasDefaultTint             = true;
            projectile.DefaultTintColor           = UnityEngine.Color.cyan;
            projectile2.AdditionalScaleMultiplier = 2f;
            projectile2.transform.parent          = gun.barrelOffset;
            UnchangeableRangeController ranger2 = projectile2.gameObject.AddComponent <UnchangeableRangeController>();


            ProjectileModule.ChargeProjectile item = new ProjectileModule.ChargeProjectile
            {
                Projectile = projectile,
                ChargeTime = 0f
            };
            ProjectileModule.ChargeProjectile item2 = new ProjectileModule.ChargeProjectile
            {
                Projectile = projectile2,
                ChargeTime = .75f
            };
            gun.DefaultModule.chargeProjectiles = new List <ProjectileModule.ChargeProjectile>
            {
                item,
                item2
            };


            ETGMod.Databases.Items.Add(gun, null, "ANY");
        }