public void ModifyVolley(ProjectileVolleyData volleyToModify) { int count = volleyToModify.projectiles.Count; for (int i = 0; i < count; i++) { ProjectileModule projectileModule = volleyToModify.projectiles[i]; projectileModule.angleFromAim += 180; } }
public void ModifyVolley(ProjectileVolleyData volleyToModify) { int count = volleyToModify.projectiles.Count; for (int i = 0; i < count; i++) { ProjectileModule projectileModule = volleyToModify.projectiles[i]; projectileModule.ammoCost *= 2; } }
private void HandleTableVolley(TableTechChaosEffectIdentifier identifier, FlippableCover table) { if (identifier == TableTechChaosEffectIdentifier.TABLE_VOLLEY) { IntVector2 intVector2FromDirection = DungeonData.GetIntVector2FromDirection(table.DirectionFlipped); ProjectileVolleyData sourceVolley = this.Volley; float d = 1f; if (this.m_owner && this.m_owner.PlayerHasActiveSynergy("#HIDDEN_TECH_SUPER_CHAOS")) { sourceVolley = this.VolleyOverride; d = 2f; } VolleyUtility.FireVolley(sourceVolley, table.sprite.WorldCenter + intVector2FromDirection.ToVector2() * d, intVector2FromDirection.ToVector2(), this.m_owner, false); } }
public void ModifyVolley(ProjectileVolleyData volleyToModify) { //Make any changes to the volley you want in here. int capper = 0; List <ProjectileModule> newModules = new List <ProjectileModule> { }; int count = volleyToModify.projectiles.Count; do { ProjectileModule projectileModule = volleyToModify.projectiles[0]; ProjectileModule projectileModule2 = ProjectileModule.CreateClone(projectileModule, false); projectileModule2.angleFromAim = projectileModule.angleFromAim; //Modify your new module here, adjusting stats like angle from aim volleyToModify.projectiles.Add(projectileModule2); }while (UnityEngine.Random.value <= .5f && capper < 25); }
public static void Init() { string itemName = "Confetti Bullets"; string resourceName = "CakeMod/Resources/CakeBullets"; GameObject obj = new GameObject(itemName); var item = obj.AddComponent <CakeBullets>(); ItemBuilder.AddSpriteToObject(itemName, resourceName, obj); string shortDesc = "Confetti, Don't Confretti"; string longDesc = "Shards of pure magic embed themselves in your enemies.\n\n" + "They shine in an odd manner, looking like glitter.\n" + "The confetti is painted on."; Gun gun = PickupObjectDatabase.GetById(28) as Gun; //e if (gun != null) { ProjectileVolleyData volley = gun.DefaultModule.finalVolley; if (volley != null && volley.projectiles != null) { foreach (ProjectileModule mod in volley.projectiles) { if (mod != null && mod.projectiles != null) { foreach (Projectile proj in mod.projectiles) { if (proj != null && proj.GetComponent <ShaderProjModifier>() != null) { shaderProjMod = proj.GetComponent <ShaderProjModifier>(); } } } } } } ItemBuilder.SetupItem(item, shortDesc, longDesc, "cak"); ItemBuilder.AddPassiveStatModifier(item, PlayerStats.StatType.Damage, 0.4f, StatModifier.ModifyMethod.ADDITIVE); item.quality = PickupObject.ItemQuality.A; }
public void ModifyVolley(ProjectileVolleyData volleyToModify) { int count = volleyToModify.projectiles.Count; for (int i = 0; i < count; i++) { ProjectileModule projectileModule = volleyToModify.projectiles[i]; for (int j = 0; j < 2; j++) { int sourceIndex = i; if (projectileModule.CloneSourceIndex >= 0) { sourceIndex = projectileModule.CloneSourceIndex; } ProjectileModule projectileModule2 = ProjectileModule.CreateClone(projectileModule, false, sourceIndex); projectileModule2.angleVariance *= 1.2f; projectileModule2.ignoredForReloadPurposes = true; projectileModule2.ammoCost = 0; volleyToModify.projectiles.Add(projectileModule2); } } }
public void ModifyVolley(ProjectileVolleyData volleyToModify) { int count = volleyToModify.projectiles.Count; for (int i = 0; i < count; i++) { ProjectileModule projectileModule = volleyToModify.projectiles[i]; float num = 3f * 10f * -1f / 2f; int angleIterator = 0; for (int j = 0; j < 3; j++) { int sourceIndex = i; if (projectileModule.CloneSourceIndex >= 0) { sourceIndex = projectileModule.CloneSourceIndex; } ProjectileModule projectileModule2 = ProjectileModule.CreateClone(projectileModule, false, sourceIndex); float angleFromAim = num + 10f * (float)j; projectileModule2.angleFromAim = angleFromAim; projectileModule2.ignoredForReloadPurposes = true; projectileModule2.ammoCost = 0; if (angleIterator == 0) { projectileModule2.angleFromAim += 90; angleIterator++; } else if (angleIterator == 1) { projectileModule2.angleFromAim += 180; angleIterator++; } else if (angleIterator == 2) { projectileModule2.angleFromAim -= 90; angleIterator++; } volleyToModify.projectiles.Add(projectileModule2); } } }
public void ModifyVolley(ProjectileVolleyData volleyToModify) { float randoAngle = UnityEngine.Random.Range(1, 360); int count = volleyToModify.projectiles.Count; for (int i = 0; i < count; i++) { ProjectileModule projectileModule = volleyToModify.projectiles[i]; int sourceIndex = i; if (projectileModule.CloneSourceIndex >= 0) { sourceIndex = projectileModule.CloneSourceIndex; } ProjectileModule projectileModule2 = ProjectileModule.CreateClone(projectileModule, false, sourceIndex); projectileModule2.angleFromAim = randoAngle; projectileModule2.ignoredForReloadPurposes = true; projectileModule2.ammoCost = 0; if (Owner && Owner.PlayerHasActiveSynergy("Heads, Shoulders, Knees, and Toes")) { for (int r = 0; r < projectileModule.projectiles.Count; r++) { Projectile startProj = projectileModule.projectiles[r]; if (startProj) { Projectile clonedProj = FakePrefab.Clone(startProj.gameObject).GetComponent <Projectile>(); if (clonedProj) { clonedProj.baseData.damage *= 2; projectileModule2.projectiles[r] = clonedProj; } } } } volleyToModify.projectiles.Add(projectileModule2); } }
public void TransformToTargetGunSpecial(Gun targetGun) { int clipShotsRemaining = this.gun.ClipShotsRemaining; if (((VFXPool)m_currentlyPlayingChargeVFX_info.GetValue(this.gun)) != null) { ((VFXPool)m_currentlyPlayingChargeVFX_info.GetValue(this.gun)).DestroyAll(); m_currentlyPlayingChargeVFX_info.SetValue(this.gun, null); } ProjectileVolleyData volley = this.gun.Volley; this.gun.RawSourceVolley = targetGun.RawSourceVolley; this.gun.singleModule = targetGun.singleModule; this.gun.modifiedVolley = null; if (targetGun.sprite) { this.gun.DefaultSpriteID = targetGun.sprite.spriteId; this.gun.GetSprite().SetSprite(targetGun.sprite.Collection, this.gun.DefaultSpriteID); if (base.spriteAnimator && targetGun.spriteAnimator) { base.spriteAnimator.Library = targetGun.spriteAnimator.Library; } tk2dSpriteDefinition.AttachPoint[] attachPoints = this.gun.GetSprite().Collection.GetAttachPoints(this.gun.DefaultSpriteID); tk2dSpriteDefinition.AttachPoint attachPoint; if (attachPoints != null) { attachPoint = Array.Find(attachPoints, (tk2dSpriteDefinition.AttachPoint a) => a.name == "PrimaryHand"); } else { attachPoint = null; } tk2dSpriteDefinition.AttachPoint attachPoint2 = attachPoint; if (attachPoint2 != null) { m_defaultLocalPosition_info.SetValue(this.gun, -attachPoint2.position); } } if (targetGun.GetBaseMaxAmmo() != this.gun.GetBaseMaxAmmo() && targetGun.GetBaseMaxAmmo() > 0) { int num = (!this.gun.InfiniteAmmo) ? this.gun.AdjustedMaxAmmo : this.gun.GetBaseMaxAmmo(); this.gun.SetBaseMaxAmmo(targetGun.GetBaseMaxAmmo()); if (this.gun.AdjustedMaxAmmo > 0 && num > 0 && this.gun.ammo > 0 && !this.gun.InfiniteAmmo) { this.gun.ammo = Mathf.FloorToInt((float)this.gun.ammo / (float)num * (float)this.gun.AdjustedMaxAmmo); this.gun.ammo = Mathf.Min(this.gun.ammo, this.gun.AdjustedMaxAmmo); } else { this.gun.ammo = Mathf.Min(this.gun.ammo, this.gun.GetBaseMaxAmmo()); } } this.gun.gunSwitchGroup = targetGun.gunSwitchGroup; this.gun.isAudioLoop = targetGun.isAudioLoop; this.gun.gunClass = targetGun.gunClass; if (!string.IsNullOrEmpty(this.gun.gunSwitchGroup)) { AkSoundEngine.SetSwitch("WPN_Guns", this.gun.gunSwitchGroup, base.gameObject); } this.gun.currentGunDamageTypeModifiers = targetGun.currentGunDamageTypeModifiers; this.gun.carryPixelOffset = targetGun.carryPixelOffset; this.gun.carryPixelUpOffset = targetGun.carryPixelUpOffset; this.gun.carryPixelDownOffset = targetGun.carryPixelDownOffset; this.gun.leftFacingPixelOffset = targetGun.leftFacingPixelOffset; this.gun.UsesPerCharacterCarryPixelOffsets = targetGun.UsesPerCharacterCarryPixelOffsets; this.gun.PerCharacterPixelOffsets = targetGun.PerCharacterPixelOffsets; this.gun.gunPosition = targetGun.gunPosition; this.gun.forceFlat = targetGun.forceFlat; if (targetGun.GainsRateOfFireAsContinueAttack != this.gun.GainsRateOfFireAsContinueAttack) { this.gun.GainsRateOfFireAsContinueAttack = targetGun.GainsRateOfFireAsContinueAttack; this.gun.RateOfFireMultiplierAdditionPerSecond = targetGun.RateOfFireMultiplierAdditionPerSecond; } if (this.gun.barrelOffset && targetGun.barrelOffset) { this.gun.barrelOffset.localPosition = targetGun.barrelOffset.localPosition; m_originalBarrelOffsetPosition_info.SetValue(this.gun, targetGun.barrelOffset.localPosition); } if (this.gun.muzzleOffset && targetGun.muzzleOffset) { this.gun.muzzleOffset.localPosition = targetGun.muzzleOffset.localPosition; m_originalMuzzleOffsetPosition_info.SetValue(this.gun, targetGun.muzzleOffset.localPosition); } if (this.gun.chargeOffset && targetGun.chargeOffset) { this.gun.chargeOffset.localPosition = targetGun.chargeOffset.localPosition; m_originalChargeOffsetPosition_info.SetValue(this.gun, targetGun.chargeOffset.localPosition); } this.gun.reloadTime = targetGun.reloadTime; this.gun.blankDuringReload = targetGun.blankDuringReload; this.gun.blankReloadRadius = targetGun.blankReloadRadius; this.gun.reflectDuringReload = targetGun.reflectDuringReload; this.gun.blankKnockbackPower = targetGun.blankKnockbackPower; this.gun.blankDamageToEnemies = targetGun.blankDamageToEnemies; this.gun.blankDamageScalingOnEmptyClip = targetGun.blankDamageScalingOnEmptyClip; this.gun.doesScreenShake = targetGun.doesScreenShake; this.gun.gunScreenShake = targetGun.gunScreenShake; this.gun.directionlessScreenShake = targetGun.directionlessScreenShake; this.gun.AppliesHoming = targetGun.AppliesHoming; this.gun.AppliedHomingAngularVelocity = targetGun.AppliedHomingAngularVelocity; this.gun.AppliedHomingDetectRadius = targetGun.AppliedHomingDetectRadius; this.gun.GoopReloadsFree = targetGun.GoopReloadsFree; this.gun.gunHandedness = targetGun.gunHandedness; m_cachedGunHandedness_info.SetValue(this.gun, null); this.gun.shootAnimation = targetGun.shootAnimation; this.gun.usesContinuousFireAnimation = targetGun.usesContinuousFireAnimation; this.gun.reloadAnimation = targetGun.reloadAnimation; this.gun.emptyReloadAnimation = targetGun.emptyReloadAnimation; this.gun.idleAnimation = targetGun.idleAnimation; this.gun.chargeAnimation = targetGun.chargeAnimation; this.gun.dischargeAnimation = targetGun.dischargeAnimation; this.gun.emptyAnimation = targetGun.emptyAnimation; this.gun.introAnimation = targetGun.introAnimation; this.gun.finalShootAnimation = targetGun.finalShootAnimation; this.gun.enemyPreFireAnimation = targetGun.enemyPreFireAnimation; this.gun.dodgeAnimation = targetGun.dodgeAnimation; this.gun.muzzleFlashEffects = targetGun.muzzleFlashEffects; this.gun.usesContinuousMuzzleFlash = targetGun.usesContinuousMuzzleFlash; this.gun.finalMuzzleFlashEffects = targetGun.finalMuzzleFlashEffects; this.gun.reloadEffects = targetGun.reloadEffects; this.gun.emptyReloadEffects = targetGun.emptyReloadEffects; this.gun.activeReloadSuccessEffects = targetGun.activeReloadSuccessEffects; this.gun.activeReloadFailedEffects = targetGun.activeReloadFailedEffects; this.gun.shellCasing = targetGun.shellCasing; this.gun.shellsToLaunchOnFire = targetGun.shellsToLaunchOnFire; this.gun.shellCasingOnFireFrameDelay = targetGun.shellCasingOnFireFrameDelay; this.gun.shellsToLaunchOnReload = targetGun.shellsToLaunchOnReload; this.gun.reloadShellLaunchFrame = targetGun.reloadShellLaunchFrame; this.gun.clipObject = targetGun.clipObject; this.gun.clipsToLaunchOnReload = targetGun.clipsToLaunchOnReload; this.gun.reloadClipLaunchFrame = targetGun.reloadClipLaunchFrame; this.gun.IsTrickGun = targetGun.IsTrickGun; this.gun.TrickGunAlternatesHandedness = targetGun.TrickGunAlternatesHandedness; this.gun.alternateVolley = targetGun.alternateVolley; this.gun.alternateShootAnimation = targetGun.alternateShootAnimation; this.gun.alternateReloadAnimation = targetGun.alternateReloadAnimation; this.gun.alternateIdleAnimation = targetGun.alternateIdleAnimation; this.gun.alternateSwitchGroup = targetGun.alternateSwitchGroup; this.gun.rampBullets = targetGun.rampBullets; this.gun.rampStartHeight = targetGun.rampStartHeight; this.gun.rampTime = targetGun.rampTime; this.gun.usesDirectionalAnimator = targetGun.usesDirectionalAnimator; this.gun.usesDirectionalIdleAnimations = targetGun.usesDirectionalIdleAnimations; Component[] targetGunComponents = targetGun.GetComponents <Component>(); Component[] thisGunComponents = this.GetComponents <Component>(); foreach (Component targetGunComponent in targetGunComponents) { if (this.gun.GetComponent(targetGunComponent.GetType()) == null) { Component comp = this.gun.gameObject.AddComponent(targetGunComponent.GetType()); comp.SetFields(targetGunComponent, includeProperties: true, includeFields: true); } } foreach (Component thisGunComponent in thisGunComponents) { if (thisGunComponent != this && targetGun.GetComponent(thisGunComponent.GetType()) == null) { Destroy(thisGunComponent); } } if (base.aiAnimator) { Destroy(base.aiAnimator); base.aiAnimator = null; } if (targetGun.aiAnimator) { AIAnimator aianimator = base.gameObject.AddComponent <AIAnimator>(); AIAnimator aiAnimator = targetGun.aiAnimator; aianimator.facingType = aiAnimator.facingType; aianimator.DirectionParent = aiAnimator.DirectionParent; aianimator.faceSouthWhenStopped = aiAnimator.faceSouthWhenStopped; aianimator.faceTargetWhenStopped = aiAnimator.faceTargetWhenStopped; aianimator.directionalType = aiAnimator.directionalType; aianimator.RotationQuantizeTo = aiAnimator.RotationQuantizeTo; aianimator.RotationOffset = aiAnimator.RotationOffset; aianimator.ForceKillVfxOnPreDeath = aiAnimator.ForceKillVfxOnPreDeath; aianimator.SuppressAnimatorFallback = aiAnimator.SuppressAnimatorFallback; aianimator.IsBodySprite = aiAnimator.IsBodySprite; aianimator.IdleAnimation = aiAnimator.IdleAnimation; aianimator.MoveAnimation = aiAnimator.MoveAnimation; aianimator.FlightAnimation = aiAnimator.FlightAnimation; aianimator.HitAnimation = aiAnimator.HitAnimation; aianimator.OtherAnimations = aiAnimator.OtherAnimations; aianimator.OtherVFX = aiAnimator.OtherVFX; aianimator.OtherScreenShake = aiAnimator.OtherScreenShake; aianimator.IdleFidgetAnimations = aiAnimator.IdleFidgetAnimations; base.aiAnimator = aianimator; } MultiTemporaryOrbitalSynergyProcessor component = targetGun.GetComponent <MultiTemporaryOrbitalSynergyProcessor>(); MultiTemporaryOrbitalSynergyProcessor component2 = base.GetComponent <MultiTemporaryOrbitalSynergyProcessor>(); if (!component && component2) { Destroy(component2); } else if (component && !component2) { MultiTemporaryOrbitalSynergyProcessor multiTemporaryOrbitalSynergyProcessor = base.gameObject.AddComponent <MultiTemporaryOrbitalSynergyProcessor>(); multiTemporaryOrbitalSynergyProcessor.RequiredSynergy = component.RequiredSynergy; multiTemporaryOrbitalSynergyProcessor.OrbitalPrefab = component.OrbitalPrefab; } if (this.gun.RawSourceVolley != null) { for (int i = 0; i < this.gun.RawSourceVolley.projectiles.Count; i++) { this.gun.RawSourceVolley.projectiles[i].ResetRuntimeData(); } } else { this.gun.singleModule.ResetRuntimeData(); } if (volley != null) { this.gun.RawSourceVolley = DuctTapeItem.TransferDuctTapeModules(volley, this.gun.RawSourceVolley, this.gun); } if (this.gun.CurrentOwner is PlayerController) { PlayerController playerController = this.gun.CurrentOwner as PlayerController; if (playerController.stats != null) { playerController.stats.RecalculateStats(playerController, false, false); } } if (base.gameObject.activeSelf) { base.StartCoroutine((IEnumerator)HandleFrameDelayedTransformation_info.Invoke(this.gun, new object[0])); } this.gun.DidTransformGunThisFrame = true; }
public virtual void PostProcessVolley(ProjectileVolleyData volley) { }
public static void Init() { Gun shotgun = ETGMod.Databases.Items.NewGun("HotShot Shotgun", (PickupObjectDatabase.GetById(51) as Gun), "hotshot_shotgun"); Game.Items.Rename("outdated_gun_mods:hotshot_shotgun", "ex:hotshot_shotgun"); shotgun.SetShortDescription("You aren't supposed to have this..."); shotgun.SetLongDescription("The gun used by Hot Shot Shotgun Kin."); // GunExt.SetupSprite(shotgun, null, "bootleg_shotgun_idle_001", 18); shotgun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(51).name, true, false); // shotgun.barrelOffset.localPosition -= new Vector3(0.3f, 0.2f, 0); shotgun.barrelOffset.localPosition = (PickupObjectDatabase.GetById(51) as Gun).barrelOffset.localPosition; if ((PickupObjectDatabase.GetById(51) as Gun).muzzleOffset && shotgun.muzzleOffset) { shotgun.muzzleOffset.transform.localPosition = (PickupObjectDatabase.GetById(51) as Gun).muzzleOffset.localPosition; } shotgun.reloadTime = 1.8f; shotgun.gunClass = GunClass.SHOTGUN; shotgun.ammo = 150; shotgun.SetBaseMaxAmmo(150); shotgun.quality = PickupObject.ItemQuality.EXCLUDED; shotgun.gunSwitchGroup = "Shotgun"; shotgun.encounterTrackable.EncounterGuid = "dc52f8e79c7c4a679238643a5bcb49c3"; ETGMod.Databases.Items.Add(shotgun); HotShotShotGunID = shotgun.PickupObjectId; Projectile ShotgunProjectileComponent = EnemyDatabase.GetOrLoadByGuid("128db2f0781141bcb505d8f00f9e4d47").gameObject.GetComponent <AIBulletBank>().Bullets[0].BulletObject.GetComponent <Projectile>(); // ExpandUtility.DuplicateComponent(ShotgunProjectileComponent, shotgun.DefaultModule.projectiles[0]); shotgun.DefaultModule.projectiles[0] = ShotgunProjectileComponent; ProjectileVolleyData shotGunVollyData = ScriptableObject.CreateInstance <ProjectileVolleyData>(); shotGunVollyData.projectiles = new List <ProjectileModule>() { shotgun.DefaultModule, new ProjectileModule(), new ProjectileModule(), new ProjectileModule(), new ProjectileModule(), new ProjectileModule(), }; shotGunVollyData.UsesBeamRotationLimiter = false; shotGunVollyData.BeamRotationDegreesPerSecond = 30; shotGunVollyData.ModulesAreTiers = false; shotGunVollyData.UsesShotgunStyleVelocityRandomizer = true; shotGunVollyData.DecreaseFinalSpeedPercentMin = -15; shotGunVollyData.IncreaseFinalSpeedPercentMax = 15; JsonUtility.FromJsonOverwrite(JsonUtility.ToJson(shotgun.DefaultModule), shotGunVollyData.projectiles[1]); JsonUtility.FromJsonOverwrite(JsonUtility.ToJson(shotgun.DefaultModule), shotGunVollyData.projectiles[2]); JsonUtility.FromJsonOverwrite(JsonUtility.ToJson(shotgun.DefaultModule), shotGunVollyData.projectiles[3]); JsonUtility.FromJsonOverwrite(JsonUtility.ToJson(shotgun.DefaultModule), shotGunVollyData.projectiles[4]); JsonUtility.FromJsonOverwrite(JsonUtility.ToJson(shotgun.DefaultModule), shotGunVollyData.projectiles[5]); shotGunVollyData.projectiles[1].ammoType = GameUIAmmoType.AmmoType.SMALL_BULLET; shotGunVollyData.projectiles[2].ammoType = GameUIAmmoType.AmmoType.SMALL_BULLET; shotGunVollyData.projectiles[3].ammoType = GameUIAmmoType.AmmoType.SMALL_BULLET; shotGunVollyData.projectiles[4].ammoType = GameUIAmmoType.AmmoType.SMALL_BULLET; shotGunVollyData.projectiles[5].ammoType = GameUIAmmoType.AmmoType.SMALL_BULLET; shotgun.Volley = shotGunVollyData; // ShotgunProjectileComponent.gameObject.transform.localPosition = shotgun.barrelOffset.localPosition; HotShot_ShotGun = shotgun; }
public override void PostProcessVolley(ProjectileVolleyData volley) { base.PostProcessVolley(volley); }
public static void Init(AssetBundle expandSharedAssets1) { Gun pistol = ETGMod.Databases.Items.NewGun("Bootleg Pistol", "bootleg_pistol"); Game.Items.Rename("outdated_gun_mods:bootleg_pistol", "ex:bootleg_pistol"); pistol.SetShortDescription("Of questionable quality..."); pistol.SetLongDescription("It's a counterfeit gun.\n\nDue to low quality standards, this weapon may be prone to exploding under certain circumstances..."); GunExt.SetupSprite(pistol, null, "bootleg_pistol_idle_001", 18); pistol.AddProjectileModuleFrom("Magnum", true, false); pistol.barrelOffset.localPosition -= new Vector3(0.3f, 0.2f, 0); pistol.DefaultModule.ammoCost = 1; pistol.PreventOutlines = true; pistol.reloadTime = 1; pistol.gunClass = GunClass.PISTOL; pistol.ammo = 140; pistol.SetBaseMaxAmmo(140); pistol.quality = ItemQuality.D; if (!ExpandSettings.EnableEXItems) { pistol.quality = ItemQuality.EXCLUDED; } pistol.UsesCustomCost = true; pistol.CustomCost = 10; pistol.encounterTrackable.EncounterGuid = "baad9dd6d005458daf02933f6a1ba926"; pistol.gameObject.AddComponent <ExpandRemoveGunOnAmmoDepletion>(); pistol.gameObject.AddComponent <ExpandMaybeLoseAmmoOnDamage>(); ETGMod.Databases.Items.Add(pistol); BootlegPistolID = pistol.PickupObjectId; PistolProjectile = expandSharedAssets1.LoadAsset <GameObject>("EXBootlegPistolProjectile"); tk2dSprite PistolProjectileSprite = SpriteSerializer.AddSpriteToObject(PistolProjectile.transform.Find("Sprite").gameObject, ExpandPrefabs.EXGunCollection, "bootleg_pistol_projectile_001"); SpeculativeRigidbody pistolProjectileRigidBody = PistolProjectile.AddComponent <SpeculativeRigidbody>(); ExpandUtility.DuplicateRigidBody(pistolProjectileRigidBody, pistol.DefaultModule.projectiles[0].specRigidbody); Projectile PistolProjectileComponent = PistolProjectile.AddComponent <Projectile>(); ExpandUtility.DuplicateComponent(PistolProjectileComponent, pistol.DefaultModule.projectiles[0]); pistol.DefaultModule.projectiles[0] = PistolProjectileComponent; PistolProjectile.gameObject.transform.localPosition = pistol.barrelOffset.localPosition; Gun machinepistol = ETGMod.Databases.Items.NewGun("Bootleg Machine Pistol", "bootleg_machinepistol"); Game.Items.Rename("outdated_gun_mods:bootleg_machine_pistol", "ex:bootleg_machine_pistol"); machinepistol.SetShortDescription("Of questionable quality..."); machinepistol.SetLongDescription("It's a counterfeit machine gun.\n\nDue to low quality standards, this weapon may be prone to exploding under certain circumstances..."); GunExt.SetupSprite(machinepistol, null, "bootleg_machinepistol_idle_001", 30); machinepistol.AddProjectileModuleFrom(PickupObjectDatabase.GetById(43).name, true, false); machinepistol.barrelOffset.localPosition -= new Vector3(0.3f, 0.2f, 0); machinepistol.PreventOutlines = true; machinepistol.reloadTime = 1.2f; machinepistol.gunClass = GunClass.FULLAUTO; machinepistol.ammo = 600; machinepistol.SetBaseMaxAmmo(600); machinepistol.quality = ItemQuality.D; if (!ExpandSettings.EnableEXItems) { machinepistol.quality = ItemQuality.EXCLUDED; } machinepistol.gunSwitchGroup = "Uzi"; machinepistol.UsesCustomCost = true; machinepistol.CustomCost = 15; machinepistol.encounterTrackable.EncounterGuid = "e56adda5081347e5b9e0cf2556689b0e"; machinepistol.gameObject.AddComponent <ExpandRemoveGunOnAmmoDepletion>(); machinepistol.gameObject.AddComponent <ExpandMaybeLoseAmmoOnDamage>(); ETGMod.Databases.Items.Add(machinepistol); BootlegMachinePistolID = machinepistol.PickupObjectId; MachinePistolProjectile = expandSharedAssets1.LoadAsset <GameObject>("EXBootlegMachinePistolProjectile"); tk2dSprite MachinePistolProjectileSprite = SpriteSerializer.AddSpriteToObject(MachinePistolProjectile.transform.Find("Sprite").gameObject, ExpandPrefabs.EXGunCollection, "bootleg_pistol_projectile_001"); SpeculativeRigidbody machinePistolProjectileRigidBody = MachinePistolProjectile.AddComponent <SpeculativeRigidbody>(); ExpandUtility.DuplicateRigidBody(machinePistolProjectileRigidBody, machinepistol.DefaultModule.projectiles[0].specRigidbody); Projectile MachinePistolProjectileComponent = MachinePistolProjectile.AddComponent <Projectile>(); ExpandUtility.DuplicateComponent(MachinePistolProjectileComponent, machinepistol.DefaultModule.projectiles[0]); machinepistol.DefaultModule.projectiles[0] = MachinePistolProjectileComponent; MachinePistolProjectile.gameObject.transform.localPosition = machinepistol.barrelOffset.localPosition; Gun shotgun = ETGMod.Databases.Items.NewGun("Bootleg Shotgun", "bootleg_shotgun"); Game.Items.Rename("outdated_gun_mods:bootleg_shotgun", "ex:bootleg_shotgun"); shotgun.SetShortDescription("Of questionable quality..."); shotgun.SetLongDescription("It's a counterfeit shotgun.\n\nDue to low quality standards, this weapon may be prone to exploding under certain circumstances..."); GunExt.SetupSprite(shotgun, null, "bootleg_shotgun_idle_001", 18); shotgun.AddProjectileModuleFrom(PickupObjectDatabase.GetById(51).name, true, false); shotgun.barrelOffset.localPosition -= new Vector3(0.3f, 0.2f, 0); shotgun.PreventOutlines = true; shotgun.reloadTime = 1.8f; shotgun.gunClass = GunClass.SHOTGUN; shotgun.ammo = 150; shotgun.SetBaseMaxAmmo(150); shotgun.quality = ItemQuality.D; if (!ExpandSettings.EnableEXItems) { shotgun.quality = ItemQuality.EXCLUDED; } shotgun.gunSwitchGroup = "Shotgun"; shotgun.UsesCustomCost = true; shotgun.CustomCost = 18; shotgun.encounterTrackable.EncounterGuid = "fa0575b4cf0140ddb6b0ed6d962bff47"; shotgun.gameObject.AddComponent <ExpandRemoveGunOnAmmoDepletion>(); shotgun.gameObject.AddComponent <ExpandMaybeLoseAmmoOnDamage>(); ETGMod.Databases.Items.Add(shotgun); BootlegShotgunID = shotgun.PickupObjectId; ShotgunProjectile = expandSharedAssets1.LoadAsset <GameObject>("EXBootlegShotgunProjectile"); tk2dSprite ShotgunProjectileSprite = SpriteSerializer.AddSpriteToObject(ShotgunProjectile.transform.Find("Sprite").gameObject, ExpandPrefabs.EXGunCollection, "bootleg_pistol_projectile_001"); SpeculativeRigidbody ShotgunProjectileRigidBody = ShotgunProjectile.AddComponent <SpeculativeRigidbody>(); ExpandUtility.DuplicateRigidBody(ShotgunProjectileRigidBody, shotgun.DefaultModule.projectiles[0].specRigidbody); Projectile ShotgunProjectileComponent = ShotgunProjectile.AddComponent <Projectile>(); ExpandUtility.DuplicateComponent(ShotgunProjectileComponent, shotgun.DefaultModule.projectiles[0]); shotgun.DefaultModule.projectiles[0] = ShotgunProjectileComponent; ProjectileVolleyData shotgunVollyData = new ProjectileVolleyData() { projectiles = new List <ProjectileModule>() { shotgun.DefaultModule, new ProjectileModule(), new ProjectileModule(), new ProjectileModule(), new ProjectileModule(), new ProjectileModule(), }, UsesBeamRotationLimiter = false, BeamRotationDegreesPerSecond = 30, ModulesAreTiers = false, UsesShotgunStyleVelocityRandomizer = true, DecreaseFinalSpeedPercentMin = -15, IncreaseFinalSpeedPercentMax = 15 }; JsonUtility.FromJsonOverwrite(JsonUtility.ToJson(shotgun.DefaultModule), shotgunVollyData.projectiles[1]); JsonUtility.FromJsonOverwrite(JsonUtility.ToJson(shotgun.DefaultModule), shotgunVollyData.projectiles[2]); JsonUtility.FromJsonOverwrite(JsonUtility.ToJson(shotgun.DefaultModule), shotgunVollyData.projectiles[3]); JsonUtility.FromJsonOverwrite(JsonUtility.ToJson(shotgun.DefaultModule), shotgunVollyData.projectiles[4]); JsonUtility.FromJsonOverwrite(JsonUtility.ToJson(shotgun.DefaultModule), shotgunVollyData.projectiles[5]); shotgunVollyData.projectiles[1].ammoType = GameUIAmmoType.AmmoType.SMALL_BULLET; shotgunVollyData.projectiles[2].ammoType = GameUIAmmoType.AmmoType.SMALL_BULLET; shotgunVollyData.projectiles[3].ammoType = GameUIAmmoType.AmmoType.SMALL_BULLET; shotgunVollyData.projectiles[4].ammoType = GameUIAmmoType.AmmoType.SMALL_BULLET; shotgunVollyData.projectiles[5].ammoType = GameUIAmmoType.AmmoType.SMALL_BULLET; shotgun.Volley = shotgunVollyData; ShotgunProjectileComponent.gameObject.transform.localPosition = shotgun.barrelOffset.localPosition; BootlegPistol = pistol; BootlegMachinePistol = machinepistol; BootlegShotgun = shotgun; }