0 files liked
1 comment
0 videos
0 uploads
0 followers
hey i saw this mod it is promising and the reviews arent grate i havent tried it but i have looked at the code and wanted to help so ill give you some code of the functions that should(hopefully) fix some errors ill put them here
infinity: private void infinity(int h)
{
if (h > 0)
{
Entity[] stopEntities = World.GetNearbyEntities(myPosition, 20f);
foreach (Entity entity in stopEntities)
{
if (!entity.Equals(Game.Player.Character))
{
entity.FreezePosition = true;
}
}
// Freeze bullets within range
foreach (Projectile bullet in World.GetAllProjectiles())
{
if (Vector3.DistanceSquared(bullet.Position, myPosition) < 20f * 20f)
{
bullet.FreezePosition = true;
}
}
}
else
{
Entity[] unfreezeEntities = World.GetNearbyEntities(myPosition, 20f);
foreach (Entity entity in unfreezeEntities)
{
if (!entity.Equals(Game.Player.Character))
{
entity.FreezePosition = false;
}
}
// Unfreeze bullets within range
foreach (Projectile bullet in World.GetAllProjectiles())
{
if (Vector3.DistanceSquared(bullet.Position, myPosition) < 20f * 20f)
{
bullet.FreezePosition = false;
}
}
}
}
this should hopefully also freeze projectiles in the radius
purple: private void purple(int p)
{
Game.Player.Character.FreezePosition = true;
if (p > 0)
{
Entity[] destroy;
Vector3 facing = Game.Player.Character.ForwardVector;
Vector3 purpleAt;
if (p < 120)
{
purpleAt = myPosition + (120 - p) / 10 * facing;
World.DrawLightWithRange(myPosition + (120 - p) / 10 * facing, Color.Purple, 7f, 1000f);
World.DrawLightWithRange(myPosition + (120 - p) / 10 * facing, Color.White, 7f, 300f);
}
else
{
purpleAt = myPosition + (p - 120) * facing;
World.DrawLightWithRange(purpleAt, Color.Purple, 7f, 1000f);
World.DrawLightWithRange(purpleAt, Color.White, 7f, 300f);
}
destroy = World.GetNearbyEntities(purpleAt, 60f);
for (int i = 0; i < destroy.Length; i++)
{
Entity poorThing = destroy[i];
if (poorThing != null && !poorThing.Equals(Game.Player.Character))
{
if (poorThing is Vehicle)
{
Vehicle v = (Vehicle)poorThing;
v.Explode();
if (v != null)
{
v.MarkAsNoLongerNeeded(); // Mark vehicle for later removal
}
}
else
{
poorThing.MarkAsNoLongerNeeded(); // Mark entity for later removal
}
}
}
}
else
{
Game.Player.Character.FreezePosition = false; // Reset freeze state after ability finishes
}
}
and that should fix purple aswell as stop the crashes good luck with the mod ill check in occasionally to see the development(there's comments in the code to help you)