public override void SetupAttributes() { base.SetupAttributes(); bouncyPhysmat = Addressables.LoadAssetAsync <PhysicMaterial>("RoR2/Base/Common/physmatBouncy.physicMaterial") .WaitForCompletion(); var tspp = new GameObject("TkSatTempSetupPrefabPrefab"); var tsp = tspp.InstantiateClone("TkSatTempSetupPrefab", false); GameObject.Destroy(tspp); tsp.AddComponent <EffectComponent>(); var dstroy = tsp.AddComponent <DestroyOnTimer>(); dstroy.duration = 1f; tsp.AddComponent <RandomPinballSFXOnEnable>(); var vfx = tsp.AddComponent <VFXAttributes>(); vfx.vfxPriority = VFXAttributes.VFXPriority.Medium; vfx.vfxIntensity = VFXAttributes.VFXIntensity.Medium; tsp.AddComponent <NetworkIdentity>(); effectPrefab = tsp.InstantiateClone("TkSatPinballSFXHandler"); GameObject.Destroy(tsp); ContentAddition.AddEffect(effectPrefab); var achiNameToken = $"ACHIEVEMENT_TKSAT_{name.ToUpper(System.Globalization.CultureInfo.InvariantCulture)}_NAME"; var achiDescToken = $"ACHIEVEMENT_TKSAT_{name.ToUpper(System.Globalization.CultureInfo.InvariantCulture)}_DESCRIPTION"; unlockable = ScriptableObject.CreateInstance <UnlockableDef>(); unlockable.cachedName = $"TkSat_{name}Unlockable"; unlockable.sortScore = 200; unlockable.achievementIcon = TinkersSatchelPlugin.resources.LoadAsset <Sprite>("Assets/TinkersSatchel/Textures/UnlockIcons/pinballIcon.png"); ContentAddition.AddUnlockableDef(unlockable); LanguageAPI.Add(achiNameToken, "Woe, Explosions Be Upon Ye"); LanguageAPI.Add(achiDescToken, "Item Set: Damage-on-kill. Have 3 or more (of 6) at once."); itemDef.unlockableDef = unlockable; }
public override void SetupAttributes() { base.SetupAttributes(); //load custom assets var muzzleEffectPrefab = TinkersSatchelPlugin.resources.LoadAsset <GameObject>("Assets/TinkersSatchel/Prefabs/Misc/EngiChaffFlareEffect.prefab"); skillDef = TinkersSatchelPlugin.resources.LoadAsset <SkillDef>("Assets/TinkersSatchel/SkillDefs/EngiSecondaryChaff.asset"); //load vanilla assets targetSkillFamily = Addressables.LoadAssetAsync <SkillFamily>("RoR2/Base/Engi/EngiBodySecondaryFamily.asset") .WaitForCompletion(); var tracerMtl = Addressables.LoadAssetAsync <Material>("RoR2/Base/Firework/matFireworkSparkle.mat") .WaitForCompletion(); //modify muzzleEffectPrefab.GetComponent <ParticleSystemRenderer>().material = tracerMtl; Fire.effectPrefab = muzzleEffectPrefab; //R2API catalog reg ContentAddition.AddEffect(muzzleEffectPrefab); skillDef.activationState = ContentAddition.AddEntityState <Fire>(out bool entStateDidSucceed); if (!entStateDidSucceed) { TinkersSatchelPlugin._logger.LogError("EntityState setup failed on EngiSecondaryChaff! Skill will not appear nor function."); } else if (!ContentAddition.AddSkillDef(skillDef)) { TinkersSatchelPlugin._logger.LogError("SkillDef setup failed on EngiSecondaryChaff! Skill will not appear nor function."); } else { setupSucceeded = true; } }
public override void SetupAttributes() { base.SetupAttributes(); //load custom assets skillDef = TinkersSatchelPlugin.resources.LoadAsset <SkillDef>("Assets/TinkersSatchel/SkillDefs/CommandoSpecialPlasmaGrenade.asset"); scepterSkillDef = TinkersSatchelPlugin.resources.LoadAsset <SkillDef>("Assets/TinkersSatchel/SkillDefs/CIScepter/CommandoSpecialPlasmaGrenadeScep.asset"); projectilePrefab = TinkersSatchelPlugin.resources.LoadAsset <GameObject>("Assets/TinkersSatchel/Prefabs/Misc/CommandoPlasmaGrenadeProjectile.prefab"); var ghostPrefab = TinkersSatchelPlugin.resources.LoadAsset <GameObject>("Assets/TinkersSatchel/Prefabs/Misc/CommandoPlasmaGrenadeGhost.prefab"); scepterProjectilePrefab = TinkersSatchelPlugin.resources.LoadAsset <GameObject>("Assets/TinkersSatchel/Prefabs/Misc/CommandoPlasmaGrenadeProjectileScep.prefab"); var scepterGhostPrefab = TinkersSatchelPlugin.resources.LoadAsset <GameObject>("Assets/TinkersSatchel/Prefabs/Misc/CommandoPlasmaGrenadeGhostScep.prefab"); //load vanilla assets targetSkillFamily = Addressables.LoadAssetAsync <SkillFamily>("RoR2/Base/Commando/CommandoBodySpecialFamily.asset") .WaitForCompletion(); var detParticleMaterial = Addressables.LoadAssetAsync <Material>("RoR2/Base/Wisp/matWispFire.mat") .WaitForCompletion(); var fuseParticleMaterial = Addressables.LoadAssetAsync <Material>("RoR2/Base/ClayBoss/matClayBossLightshaft.mat") .WaitForCompletion(); var explosionPrefab = Addressables.LoadAssetAsync <GameObject>("RoR2/Base/LemurianBruiser/OmniExplosionVFXLemurianBruiserFireballImpact.prefab") .WaitForCompletion(); //modify var pRen = ghostPrefab.transform.Find("RadialGlow").gameObject.GetComponent <ParticleSystemRenderer>(); pRen.material = detParticleMaterial; var expl = projectilePrefab.GetComponent <ProjectileExplosion>(); expl.explosionEffect = explosionPrefab; var pRen2 = projectilePrefab.transform.Find("FuseVFX").gameObject.GetComponent <ParticleSystemRenderer>(); pRen2.material = fuseParticleMaterial; var scepterExplosionPrefabTmp = explosionPrefab.InstantiateClone("TkSatTempSetupPrefab", false); scepterExplosionPrefabTmp.transform.localScale *= 2f; var scepterExplosionPrefab = scepterExplosionPrefabTmp.InstantiateClone("TkSatPlasmaGrenadeScepterExplosion", false); pRen = scepterGhostPrefab.transform.Find("RadialGlow").gameObject.GetComponent <ParticleSystemRenderer>(); pRen.material = detParticleMaterial; expl = scepterProjectilePrefab.GetComponent <ProjectileExplosion>(); expl.explosionEffect = scepterExplosionPrefab; pRen2 = scepterProjectilePrefab.transform.Find("FuseVFX").gameObject.GetComponent <ParticleSystemRenderer>(); pRen2.material = fuseParticleMaterial; //R2API catalog reg var astate = ContentAddition.AddEntityState <Fire>(out bool entStateDidSucceed); skillDef.activationState = astate; scepterSkillDef.activationState = astate; if (!entStateDidSucceed) { TinkersSatchelPlugin._logger.LogError("EntityState setup failed on CommandoSpecialPlasmaGrenade! Skill will not appear nor function."); } else if (!ContentAddition.AddSkillDef(skillDef)) { TinkersSatchelPlugin._logger.LogError("SkillDef setup failed on CommandoSpecialPlasmaGrenade! Skill will not appear nor function."); } else { setupSucceeded = true; } ContentAddition.AddEffect(scepterExplosionPrefab); ContentAddition.AddProjectile(projectilePrefab); ContentAddition.AddProjectile(scepterProjectilePrefab); if (Compat_ClassicItems.enabled) { if (!ContentAddition.AddSkillDef(scepterSkillDef)) { scepSetupSucceeded = false; } else { scepSetupSucceeded = Compat_ClassicItems.RegisterScepterSkill(scepterSkillDef, "CommandoBody", SkillSlot.Special, skillDef); } if (!scepSetupSucceeded) { TinkersSatchelPlugin._logger.LogError("ClassicItems Scepter support failed for CommandoSpecialPlasmaGrenade! Ancient Scepter will not work on this skill."); } } }