public override void PostProcessProjectile(Projectile projectile) { ProjectileSlashingBehaviour slash = projectile.gameObject.AddComponent <ProjectileSlashingBehaviour>(); slash.SlashDamage = 30; slash.SlashRange = 2.5f; slash.SlashDimensions = 30f; slash.InteractMode = SlashDoer.ProjInteractMode.DESTROY; base.PostProcessProjectile(projectile); }
public static void Add() { Gun gun = ETGMod.Databases.Items.NewGun("Cpt Boombeard's Cutlass", "brd"); Game.Items.Rename("outdated_gun_mods:cpt_boombeard's_cutlass", "ski:cpt_boombeard's_cutlass"); gun.gameObject.AddComponent <Beard>(); gun.SetShortDescription("Now with Real Dynamite!"); gun.SetLongDescription("Infamous Captain Boombeard was known for interlacing his beard with explosives to terrify his opponents. Unfortunatly for him this idea was terrible as he managed to burn off his beard." + "\n\nGive a hearty chuckle to alert your crew its time to have some fun! "); gun.SetupSprite(null, "brd_idle_001", 8); gun.SetAnimationFPS(gun.shootAnimation, 10); gun.SetAnimationFPS(gun.reloadAnimation, 8); gun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(481) as Gun, true, false); gun.DefaultModule.ammoCost = 1; gun.DefaultModule.shootStyle = ProjectileModule.ShootStyle.Automatic; gun.DefaultModule.sequenceStyle = ProjectileModule.ProjectileSequenceStyle.Random; gun.gunHandedness = GunHandedness.OneHanded; gun.reloadTime = .1f; gun.DefaultModule.cooldownTime = 1f; gun.DefaultModule.numberOfShotsInClip = 20; gun.SetBaseMaxAmmo(400); gun.quality = PickupObject.ItemQuality.B; gun.encounterTrackable.EncounterGuid = "Summon the megaladon!"; 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 *= 3f; projectile.baseData.range = 1; projectile.baseData.speed *= 1f; projectile.transform.parent = gun.barrelOffset; gun.DefaultModule.ammoType = GameUIAmmoType.AmmoType.CUSTOM; gun.DefaultModule.customAmmoType = "black_revolver_big"; ProjectileSlashingBehaviour slash = projectile.gameObject.AddComponent <ProjectileSlashingBehaviour>(); slash.SlashDamage = 20; slash.SlashRange = 3; slash.SlashDimensions = 90f; slash.InteractMode = SlashDoer.ProjInteractMode.DESTROY; Beard.BuildPrefab(); tk2dSpriteAnimationClip fireClip = gun.sprite.spriteAnimator.GetClipByName("brd_fire"); float[] offsetsX = new float[] { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; float[] offsetsY = new float[] { -0f, -1f, -1f, -1f, -1f }; for (int i = 0; i < offsetsX.Length && i < offsetsY.Length && i < fireClip.frames.Length; i++) { int id = fireClip.frames[i].spriteId; fireClip.frames[i].spriteCollection.spriteDefinitions[id].position0.x += offsetsX[i]; fireClip.frames[i].spriteCollection.spriteDefinitions[id].position0.y += offsetsY[i]; fireClip.frames[i].spriteCollection.spriteDefinitions[id].position1.x += offsetsX[i]; fireClip.frames[i].spriteCollection.spriteDefinitions[id].position1.y += offsetsY[i]; fireClip.frames[i].spriteCollection.spriteDefinitions[id].position2.x += offsetsX[i]; fireClip.frames[i].spriteCollection.spriteDefinitions[id].position2.y += offsetsY[i]; fireClip.frames[i].spriteCollection.spriteDefinitions[id].position3.x += offsetsX[i]; fireClip.frames[i].spriteCollection.spriteDefinitions[id].position3.y += offsetsY[i]; } ETGMod.Databases.Items.Add(gun, null, "ANY"); }