Ejemplo n.º 1
0
        public static void Add()
        {
            Gun gun = ETGMod.Databases.Items.NewGun("Sticky Launcher", "sticky_launcher");

            Game.Items.Rename("outdated_gun_mods:sticky_launcher", "cel:sticky_launcher");
            gun.SetShortDescription("KA-BLOOIE!");
            gun.SetLongDescription("Shoots sticky bombs that detonate on reloading.\n\nA weather sticky bomb launcher with the words \"Mann Co. Property\" written on the side.");
            gun.SetupSprite(null, "sticky_launcher_idle_001", 8);
            gun.SetAnimationFPS(gun.shootAnimation, 16);
            gun.SetAnimationFPS(gun.reloadAnimation, 2);
            gun.AddProjectileModuleFrom("38_special", true, false);
            gun.gameObject.AddComponent <StickyLauncher>();
            gun.DefaultModule.ammoType      = GameUIAmmoType.AmmoType.MEDIUM_BULLET;
            gun.DefaultModule.ammoCost      = 1;
            gun.DefaultModule.shootStyle    = ProjectileModule.ShootStyle.SemiAutomatic;
            gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Random;
            gun.reloadTime = 1.2f;
            gun.DefaultModule.angleVariance       = 4f;
            gun.DefaultModule.cooldownTime        = .45f;
            gun.DefaultModule.numberOfShotsInClip = 8;
            Gun gun2 = PickupObjectDatabase.GetById(56) as Gun;

            gun.muzzleFlashEffects = gun2.muzzleFlashEffects;
            gun.SetBaseMaxAmmo(320);
            gun.quality = PickupObject.ItemQuality.C;
            gun.encounterTrackable.EncounterGuid = "What makes me a good demoman? If I were a bad demoman, I wouldn't be sittin' here discussin' it with you, now would I?! LET'S DO IT! Not one of you's gonna survive this! One crossed wire, one wayward pinch of potassium chlorate, one errant twitch, and KA-BLOOIE! nd I got a manky eye. I'm a black Scottish cyclops. They got more fecking sea monsters in the great Lochett Ness than they got the likes of me. So! T'all you fine dandies, so proud, so cocksure, prancin' about with your heads full of eyeballs... come and get me, I say! I'll be waitin' on you with a whiff of the old brimstone! I'm a Grimm bloody fable with an unhappy bloody end! Oh, they're going to have to glue you back together...IN HELL!";
            gun.sprite.IsPerpendicular           = true;
            gun.gunClass = GunClass.PISTOL;
            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.transform.parent      = gun.barrelOffset;
            projectile.baseData.damage      *= 0;
            projectile.SetProjectileSpriteRight("sticky_bomb", 11, 11);
            StickyProjectile sticky = projectile.gameObject.AddComponent <StickyProjectile>();

            sticky.explosionData = GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultSmallExplosionData;
            sticky.explosionData.damageToPlayer = 0;
            sticky.explosionData.damage         = 7.5f;
            sticky.destroyOnGunChanged          = true;
            sticky.shouldExplodeOnReload        = true;
            ETGMod.Databases.Items.Add(gun, null, "ANY");
        }
Ejemplo n.º 2
0
 private Projectile ReplacementProj(Gun sourceGun, Projectile sourceProj)
 {
     if (sourceGun.InfiniteAmmo || sourceGun.HasShootStyle(ProjectileModule.ShootStyle.Beam) || sourceGun.PickupObjectId == 504 || sourceGun.PickupObjectId == 251 || sourceGun.PickupObjectId == 695)
     {
         return(sourceProj);
     }
     else
     {
         float num = 1f / sourceGun.DefaultModule.cooldownTime;
         if (sourceGun.Volley != null)
         {
             float num2 = 0f;
             for (int i = 0; i < sourceGun.Volley.projectiles.Count; i++)
             {
                 ProjectileModule projectileModule = sourceGun.Volley.projectiles[i];
                 num2 += projectileModule.GetEstimatedShotsPerSecond(sourceGun.reloadTime);
             }
             if (num2 > 0f)
             {
                 num = num2;
             }
         }
         float chanceToProc = .5f;
         float num3         = Mathf.Clamp01(chanceToProc / num);
         num3 = Mathf.Max(0.0001f, num3);
         ETGModConsole.Log(num3.ToString());
         if (UnityEngine.Random.value > num3)
         {
             return(sourceProj);
         }
         Projectile newProj = SpearProj;
         newProj.baseData.range *= 10;
         StickyProjectile sticky = newProj.gameObject.AddComponent <StickyProjectile>();
         newProj.Owner           = Owner;
         newProj.Shooter         = Owner.specRigidbody;
         newProj.baseData.damage = sourceProj.baseData.damage * 2;
         newProj.baseData.speed  = sourceProj.baseData.speed * 1.5f;
         return(newProj);
     }
 }