From 86b48ba0983108f2c8dec28eb8e9a5b8a53c4de0 Mon Sep 17 00:00:00 2001 From: Aristeas <94058548+Jnick-24@users.noreply.github.com> Date: Sun, 4 Feb 2024 17:24:22 -0600 Subject: [PATCH] actually I'm dumb --- .../Scripts/OrreryFrameworkDemo/Communication/HeartApi.cs | 1 + .../ProjectileBases/ProjectileDefinitionBase.cs | 2 +- .../Data/Scripts/OrreryFrameworkDemo/ExampleAmmos.cs | 8 +------- .../Data/Scripts/OrreryFrameworkDemo/HeartDefinitions.cs | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/Communication/HeartApi.cs b/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/Communication/HeartApi.cs index bfdc72e9..cf901f12 100644 --- a/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/Communication/HeartApi.cs +++ b/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/Communication/HeartApi.cs @@ -73,6 +73,7 @@ private void RecieveApiMethods(object data) SetApiMethod("RemoveProjectileDefinition", ref removeProjectileDefinition); SetApiMethod("SpawnProjectile", ref spawnProjectile); SetApiMethod("GetProjectileInfo", ref getProjectileInfo); + SetApiMethod("GetProjectileDefinitionId", ref getProjectileDefinitionId); // Weapon Generics SetApiMethod("BlockHasWeapon", ref blockHasWeapon); diff --git a/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/Communication/ProjectileBases/ProjectileDefinitionBase.cs b/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/Communication/ProjectileBases/ProjectileDefinitionBase.cs index a8499df3..824ae10f 100644 --- a/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/Communication/ProjectileBases/ProjectileDefinitionBase.cs +++ b/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/Communication/ProjectileBases/ProjectileDefinitionBase.cs @@ -138,7 +138,7 @@ public struct Guidance [ProtoMember(11)] public float Inaccuracy; } - public class LiveMethods // TODO: Callback on recieved to RegisterMethods() + public class LiveMethods { public void RegisterMethods(string definitionName) { diff --git a/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/ExampleAmmos.cs b/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/ExampleAmmos.cs index 16d2ba1a..30575367 100644 --- a/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/ExampleAmmos.cs +++ b/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/ExampleAmmos.cs @@ -68,21 +68,15 @@ partial class HeartDefinitions }, LiveMethods = new LiveMethods() { - OnSpawn = (a, b) => { - if (id == 0) - id = HeartApi.RegisterProjectileDefinition(ExampleAmmoMissile); - }, OnImpact = (projectileInfo, hitPosition, hitNormal, hitEntity) => { if (hitEntity == null) return; - HeartApi.SpawnProjectilesInCone(id, hitPosition - hitNormal * 50, hitNormal, 10, 0.1f); + HeartApi.SpawnProjectilesInCone(HeartApi.GetProjectileDefinitionId(ExampleAmmoMissile.Name), hitPosition - hitNormal * 50, hitNormal, 10, 0.1f); } } }; - int id = 0; - ProjectileDefinitionBase ExampleAmmoMissile => new ProjectileDefinitionBase() { Name = "ExampleAmmoMissile", diff --git a/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/HeartDefinitions.cs b/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/HeartDefinitions.cs index 15d6db79..41774433 100644 --- a/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/HeartDefinitions.cs +++ b/OrreryFrameworkDemo/Data/Scripts/OrreryFrameworkDemo/HeartDefinitions.cs @@ -5,7 +5,7 @@ partial class HeartDefinitions internal HeartDefinitions() { LoadWeaponDefinitions(Example2BarrelTurretWeapon, ExampleTurretWeapon, ExampleFixedProjWeapon, ExampleFixedBeamWeapon, ExampleFixedMissileWeapon); //todo tell the user that they forgot to add stuff here when they get an error - LoadAmmoDefinitions(ExampleAmmoProjectile, ExampleAmmoBeam); + LoadAmmoDefinitions(ExampleAmmoProjectile, ExampleAmmoMissile, ExampleAmmoBeam); } } }