Skip to content

Commit

Permalink
actually I'm dumb
Browse files Browse the repository at this point in the history
  • Loading branch information
ari-steas committed Feb 4, 2024
1 parent ce5df9f commit 86b48ba
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit 86b48ba

Please sign in to comment.