private void RW_DoPrimaries() { SkillDef[] primaries = new SkillDef[1]; SteppedSkillDef skill = ScriptableObject.CreateInstance <SteppedSkillDef>(); skill.activationState = new SerializableEntityStateType(typeof(Heatwave)); skill.activationStateMachineName = "Weapon"; skill.baseMaxStock = 1; skill.baseRechargeInterval = 0f; skill.beginSkillCooldownOnSkillEnd = true; skill.canceledFromSprinting = false; skill.fullRestockOnAssign = true; skill.interruptPriority = InterruptPriority.Any; skill.isBullets = true; skill.isCombatSkill = true; skill.mustKeyPress = false; skill.noSprint = true; skill.rechargeStock = 1; skill.requiredStock = 1; skill.shootDelay = 0.5f; skill.stockToConsume = 1; skill.stepCount = 2; skill.icon = this.RW_assetBundle.LoadAsset <Sprite>("Assets/__EXPORT/wisp1_v1.png"); skill.skillDescriptionToken = "WISP_SURVIVOR_PRIMARY_1_DESC"; skill.skillName = "Primry1"; skill.skillNameToken = "WISP_SURVIVOR_PRIMARY_1_NAME"; primaries[0] = skill; AssignVariants(this.RW_skillFamilies[0], primaries); }
private static SteppedSkillDef spoofFireBoltSkillDef(SteppedSkillDef firefireboltskill) { LanguageAPI.Add("ARTI_PRIMARY_FASTBOLTS_NAME", "Fast Flame Bolts"); //TODO string damage = $"<style=cIsDamage> {2.2f * Utils.Cfg_DamageMulti * 100}%</style>"; string descriptionText = $"Fire Flame Bolts for {damage} each. Shoots <style=cIsUtility>more bolts</style> with <style=cIsUtility>higher attack speed</style>"; LanguageAPI.Add("ARTI_PRIMARY_FASTBOLTS_DESCRIPTION", descriptionText); SteppedSkillDef mySkillDef = ScriptableObject.CreateInstance <SteppedSkillDef>(); mySkillDef.activationState = new SerializableEntityStateType(typeof(FireFastBolt)); mySkillDef.activationStateMachineName = firefireboltskill.activationStateMachineName; mySkillDef.baseMaxStock = firefireboltskill.baseMaxStock; mySkillDef.baseRechargeInterval = firefireboltskill.baseRechargeInterval; mySkillDef.beginSkillCooldownOnSkillEnd = firefireboltskill.beginSkillCooldownOnSkillEnd; mySkillDef.canceledFromSprinting = firefireboltskill.canceledFromSprinting; mySkillDef.fullRestockOnAssign = firefireboltskill.fullRestockOnAssign; mySkillDef.interruptPriority = firefireboltskill.interruptPriority; mySkillDef.isBullets = firefireboltskill.isBullets; mySkillDef.isCombatSkill = firefireboltskill.isCombatSkill; mySkillDef.mustKeyPress = firefireboltskill.mustKeyPress; mySkillDef.noSprint = firefireboltskill.noSprint; mySkillDef.rechargeStock = firefireboltskill.rechargeStock; mySkillDef.requiredStock = firefireboltskill.requiredStock; mySkillDef.shootDelay = firefireboltskill.shootDelay; mySkillDef.stockToConsume = firefireboltskill.stockToConsume; mySkillDef.icon = Utils.FastBoltIcon; mySkillDef.skillDescriptionToken = "ARTI_PRIMARY_FASTBOLTS_DESCRIPTION"; mySkillDef.skillName = "ARTI_PRIMARY_FASTBOLTS_NAME"; mySkillDef.skillNameToken = "ARTI_PRIMARY_FASTBOLTS_NAME"; mySkillDef.resetStepsOnIdle = firefireboltskill.resetStepsOnIdle; mySkillDef.stepCount = firefireboltskill.stepCount; return(mySkillDef); }
private void CreatePrimary() { //Register our melee attack. LoadoutAPI.AddSkill(typeof(HenryMeleeAttack)); SteppedSkillDef primarySkillDef = ScriptableObject.CreateInstance <SteppedSkillDef>(); primarySkillDef.activationState = new SerializableEntityStateType(typeof(HenryMeleeAttack)); primarySkillDef.activationStateMachineName = "Weapon"; primarySkillDef.baseMaxStock = 1; primarySkillDef.baseRechargeInterval = 0f; primarySkillDef.beginSkillCooldownOnSkillEnd = true; primarySkillDef.canceledFromSprinting = false; primarySkillDef.fullRestockOnAssign = true; primarySkillDef.interruptPriority = InterruptPriority.Any; primarySkillDef.isBullets = false; primarySkillDef.isCombatSkill = true; primarySkillDef.mustKeyPress = false; primarySkillDef.noSprint = false; primarySkillDef.rechargeStock = 1; primarySkillDef.requiredStock = 1; primarySkillDef.shootDelay = 0.1f; primarySkillDef.stockToConsume = 0; primarySkillDef.skillDescriptionToken = "HENRY_PRIMARY_DESCRIPTION"; primarySkillDef.skillName = "HENRY_PRIMARY_NAME"; primarySkillDef.skillNameToken = "HENRY_PRIMARY_NAME"; primarySkillDef.icon = Assets.mainAssetBundle.LoadAsset <Sprite>("texPrimaryIcon"); primarySkillDef.keywordTokens = new string[] { "KEYWORD_AGILE", }; LanguageAPI.Add(primarySkillDef.skillNameToken, "Sword Slash"); LanguageAPI.Add(primarySkillDef.skillDescriptionToken, "<style=cIsUtility>Agile</style>. Swing your sword of Epic Awesomeness, dealing X% damage to enemies!!"); LoadoutAPI.AddSkillDef(primarySkillDef); SkillFamily primarySkillFamily = skillLocator.primary.skillFamily; primarySkillFamily.variants[0] = new SkillFamily.Variant { skillDef = primarySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(primarySkillDef.skillNameToken, false, null) }; }
public void AddNewFireboltSkill() { GameObject mageCharacterBody = Resources.Load <GameObject>("prefabs/characterbodies/MageBody"); SkillLocator skillLocator = mageCharacterBody.GetComponent <SkillLocator>(); SkillFamily skillFamily = skillLocator.primary.skillFamily; SteppedSkillDef mySkillDef = spoofFireBoltSkillDef(skillFamily.variants[0].skillDef as SteppedSkillDef); LoadoutAPI.AddSkillDef(mySkillDef); LoadoutAPI.AddSkill(typeof(FireFastBolt)); Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); skillFamily.variants[skillFamily.variants.Length - 1] = new SkillFamily.Variant { skillDef = mySkillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node(mySkillDef.skillNameToken, false, null) }; }
private void RegisterCommandoSkills() { //Nab the skillocator and skillfamilies SkillLocator commandoSkillLocator = commandoRef.GetComponent <SkillLocator>(); SkillFamily commandoSkillFamilyPrimary = commandoSkillLocator.primary.skillFamily; SkillFamily commandoSkillFamilyUtility = commandoSkillLocator.utility.skillFamily; //Combat Shotgun SteppedSkillDef skillDefCombatshotgun = ScriptableObject.CreateInstance <SteppedSkillDef>(); skillDefCombatshotgun.activationState = new SerializableEntityStateType(typeof(CombatShotgunEntity)); skillDefCombatshotgun.activationStateMachineName = "Weapon"; skillDefCombatshotgun.beginSkillCooldownOnSkillEnd = true; skillDefCombatshotgun.fullRestockOnAssign = true; skillDefCombatshotgun.interruptPriority = InterruptPriority.Any; skillDefCombatshotgun.isCombatSkill = true; skillDefCombatshotgun.mustKeyPress = false; skillDefCombatshotgun.canceledFromSprinting = false; skillDefCombatshotgun.cancelSprintingOnActivation = true; skillDefCombatshotgun.forceSprintDuringState = false; skillDefCombatshotgun.stockToConsume = 0; skillDefCombatshotgun.icon = Resources.Sprites.shotgunIconS; skillDefCombatshotgun.skillDescriptionToken = "COMMANDO_PRIMARY_COMBATSHOTGUN_DESC"; skillDefCombatshotgun.skillName = "CombatShotgun"; skillDefCombatshotgun.skillNameToken = "COMMANDO_PRIMARY_COMBATSHOTGUN_NAME"; defList.Add(skillDefCombatshotgun); Array.Resize(ref commandoSkillFamilyPrimary.variants, commandoSkillFamilyPrimary.variants.Length + 1); commandoSkillFamilyPrimary.variants[commandoSkillFamilyPrimary.variants.Length - 1] = new SkillFamily.Variant { skillDef = skillDefCombatshotgun, unlockableDef = UnlocksRegistering.commandoShotgunUnlockDef, viewableNode = new ViewablesCatalog.Node(skillDefCombatshotgun.skillNameToken, false, null) }; ContentAddition.AddEntityState <CombatShotgunEntity>(out _); //Dash SkillDef skillDefDash = ScriptableObject.CreateInstance <SkillDef>(); skillDefDash.activationState = new SerializableEntityStateType(typeof(CommandoDashEntity)); skillDefDash.activationStateMachineName = "Body"; skillDefDash.baseMaxStock = 2; skillDefDash.baseRechargeInterval = 8f; skillDefDash.beginSkillCooldownOnSkillEnd = true; skillDefDash.fullRestockOnAssign = false; skillDefDash.interruptPriority = InterruptPriority.PrioritySkill; skillDefDash.isCombatSkill = false; skillDefDash.mustKeyPress = true; skillDefDash.canceledFromSprinting = false; skillDefDash.cancelSprintingOnActivation = false; skillDefDash.forceSprintDuringState = false; skillDefDash.stockToConsume = 1; skillDefDash.requiredStock = 1; skillDefDash.rechargeStock = 1; skillDefDash.icon = Resources.Sprites.dashIconS; skillDefDash.skillDescriptionToken = "COMMANDO_UTILITY_DASH_DESC"; skillDefDash.skillName = "Dash"; skillDefDash.skillNameToken = "COMMANDO_UTILITY_DASH_NAME"; skillDefDash.keywordTokens = new string[] { "KEYWORD_PREPARE" }; defList.Add(skillDefDash); Array.Resize(ref commandoSkillFamilyUtility.variants, commandoSkillFamilyUtility.variants.Length + 1); commandoSkillFamilyUtility.variants[commandoSkillFamilyUtility.variants.Length - 1] = new SkillFamily.Variant { skillDef = skillDefDash, unlockableDef = UnlocksRegistering.commandoDashUnlockDef, viewableNode = new ViewablesCatalog.Node(skillDefDash.skillNameToken, false, null) }; ContentAddition.AddEntityState <CommandoDashEntity>(out _); }
public override void SetupAttributes() { base.SetupAttributes(); //load custom assets projectilePrefab = TinkersSatchelPlugin.resources.LoadAsset <GameObject>("Assets/TinkersSatchel/Prefabs/Misc/EngiFlakProjectile.prefab"); projectileGhost = TinkersSatchelPlugin.resources.LoadAsset <GameObject>("Assets/TinkersSatchel/Prefabs/Misc/EngiFlakGhost.prefab"); subProjectilePrefab = TinkersSatchelPlugin.resources.LoadAsset <GameObject>("Assets/TinkersSatchel/Prefabs/Misc/EngiFlakSubProjectile.prefab"); subProjectileGhost = TinkersSatchelPlugin.resources.LoadAsset <GameObject>("Assets/TinkersSatchel/Prefabs/Misc/EngiFlakSubGhost.prefab"); skillDef = ScriptableObject.CreateInstance <SteppedSkillDef>(); skillDef.activationStateMachineName = "Weapon"; skillDef.skillNameToken = "TKSAT_ENGI_PRIMARY_FLAK_NAME"; skillDef.skillDescriptionToken = "TKSAT_ENGI_PRIMARY_FLAK_DESCRIPTION"; skillDef.interruptPriority = InterruptPriority.Any; skillDef.icon = TinkersSatchelPlugin.resources.LoadAsset <Sprite>("Assets/TinkersSatchel/Textures/SkillIcons/EngiPrimaryFlak.png"); skillDef.baseRechargeInterval = 0; skillDef.baseMaxStock = 1; skillDef.rechargeStock = 1; skillDef.requiredStock = 1; skillDef.stockToConsume = 1; skillDef.resetCooldownTimerOnUse = true; skillDef.fullRestockOnAssign = true; skillDef.dontAllowPastMaxStocks = false; skillDef.beginSkillCooldownOnSkillEnd = true; skillDef.cancelSprintingOnActivation = true; skillDef.forceSprintDuringState = false; skillDef.canceledFromSprinting = false; skillDef.isCombatSkill = true; skillDef.mustKeyPress = false; skillDef.stepCount = 2; skillDef.stepGraceDuration = 0.1f; //load vanilla assets var mainMtl = Addressables.LoadAssetAsync <Material>("RoR2/Base/Engi/matEngiTurret.mat") .WaitForCompletion(); var tracerMtl = Addressables.LoadAssetAsync <Material>("RoR2/Base/Common/VFX/matTracerBrightTransparent.mat") .WaitForCompletion(); var muzzleEffectPrefab = Addressables.LoadAssetAsync <GameObject>("RoR2/Base/Common/VFX/MuzzleflashSmokeRing.prefab") .WaitForCompletion(); var explosionEffectPrefab = Addressables.LoadAssetAsync <GameObject>("RoR2/Base/Engi/EngiGrenadeExplosion.prefab") .WaitForCompletion(); var shrapnelHitEffectPrefab = Addressables.LoadAssetAsync <GameObject>("RoR2/Base/Commando/HitsparkCommando.prefab") .WaitForCompletion(); targetSkillFamily = Addressables.LoadAssetAsync <SkillFamily>("RoR2/Base/Engi/EngiBodyPrimaryFamily.asset") .WaitForCompletion(); //modify projectilePrefab.GetComponent <ProjectileSimple>().lifetimeExpiredEffect = explosionEffectPrefab; projectilePrefab.GetComponent <ProjectileOverlapAttack>().impactEffect = shrapnelHitEffectPrefab; subProjectilePrefab.GetComponent <ProjectileOverlapAttack>().impactEffect = shrapnelHitEffectPrefab; projectileGhost.GetComponent <MeshRenderer>().material = mainMtl; subProjectileGhost.transform.Find("SpikeModel").GetComponent <MeshRenderer>().material = mainMtl; subProjectileGhost.transform.Find("Trail").GetComponent <TrailRenderer>().material = tracerMtl; FireContinuous.projectilePrefab = projectilePrefab; FireContinuous.effectPrefab = muzzleEffectPrefab; //R2API catalog reg skillDef.activationState = ContentAddition.AddEntityState <FireContinuous>(out bool entStateDidSucceed); ContentAddition.AddProjectile(projectilePrefab); ContentAddition.AddProjectile(subProjectilePrefab); if (!entStateDidSucceed) { TinkersSatchelPlugin._logger.LogError("EntityState setup failed on EngiPrimaryFlak! Skill will not appear nor function."); } else if (!ContentAddition.AddSkillDef(skillDef)) { TinkersSatchelPlugin._logger.LogError("SkillDef setup failed on EngiPrimaryFlak! Skill will not appear nor function."); } else { setupSucceeded = true; } }