Skip to content

Instantly share code, notes, and snippets.

@fowlmouth
Last active July 28, 2026 23:12
Show Gist options
  • Select an option

  • Save fowlmouth/58a917b0d1a10978ff5796d9aa85a2bc to your computer and use it in GitHub Desktop.

Select an option

Save fowlmouth/58a917b0d1a10978ff5796d9aa85a2bc to your computer and use it in GitHub Desktop.
InfantryServer computer firing angle fix

in CR zones most of the computer vehicles have angles (start=0, length=0) which is being interpreted by the zone server as pointing north and able to move 0 degrees

In Infantry zones anything that can turn is 0,360. Only ammo crates, helmets etc are set to 0,0

Will fixing it so that 0,0 behaves like 0,360 cause things like walls to turn to face enemies? Or does turning only happen if there is a projectile that fires?

Proposed Fix

diff --git a/dotnetcore/ZoneServer/Game/Objects/Vehicle.Computer.cs b/dotnetcore/ZoneServer/Game/Objects/Vehicle.Computer.cs
index 4dc72e5..19c0e15 100644
--- a/dotnetcore/ZoneServer/Game/Objects/Vehicle.Computer.cs
+++ b/dotnetcore/ZoneServer/Game/Objects/Vehicle.Computer.cs
@@ -289,8 +289,8 @@ namespace InfServer.Game
                 if ((short)pAngle < _type.AngleStart)
                     return false;
 
-            if (_type.AngleLength < 360)
-                if ((short)pAngle > _type.AngleLength)
+            if (_type.AngleLength > 0 && _type.AngleLength < 360)
+                if ((short)pAngle > _type.AngleLength + _type.AngleStart)
                     return false;
 
             //Check if player is within turrets vision
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Assets;
namespace TurretInspector
{
internal static class Program
{
private static readonly string[] Directions =
{
"Up", "Up-Right", "Right", "Down-Right",
"Down", "Down-Left", "Left", "Up-Left", "Up"
};
private static int Main(string[] args)
{
if (args.Length == 0 || IsHelp(args[0]))
{
PrintUsage();
return args.Length == 0 ? 1 : 0;
}
string path = args[0];
string? filter = args.Length > 1 ? args[1] : null;
if (!File.Exists(path))
{
Console.Error.WriteLine($"File not found: {path}");
return 2;
}
List<VehInfo> vehicles;
try
{
vehicles = VehInfo.Load(path);
}
catch (Exception ex)
{
Console.Error.WriteLine($"Failed to parse vehicle file '{path}': {ex.Message}");
return 3;
}
IEnumerable<VehInfo.Computer> query = vehicles.OfType<VehInfo.Computer>();
if (!string.IsNullOrEmpty(filter))
{
string f = filter;
query = query.Where(v =>
v.Name.Contains(f, StringComparison.OrdinalIgnoreCase) ||
v.Id.ToString() == f);
}
var turrets = query.OrderBy(v => v.Id).ToList();
Console.WriteLine($"Turret aiming report: {Path.GetFileName(path)}");
Console.WriteLine($"Angle convention (matches server isValidTarget): 0=Up, 90=Right, 180=Down, 270=Left (clockwise).");
Console.WriteLine($"{turrets.Count} computer/turret vehicle(s)." + (filter != null ? $" Filter: '{filter}'" : ""));
Console.WriteLine();
if (turrets.Count == 0)
return 0;
Console.WriteLine(
$"{"ID",-6} {"Name",-26} {"Start",-6} {"Length",-6} {"Aim arc (start -> start+length)",-28} {"Note"}");
Console.WriteLine(new string('-', 116));
foreach (var turret in turrets)
PrintTurret(turret);
return 0;
}
private static void PrintTurret(VehInfo.Computer t)
{
int start = t.AngleStart;
int span = t.AngleLength;
int end = start + span;
string arc;
string note;
if (span <= 0)
{
arc = $"{start}° {DescribeAngle(start)} only (zero-width)";
note = span == 0
? "!! Length=0: cannot track - matches the aim bug"
: "!! Negative length";
}
else if (span >= 360)
{
arc = "Full circle (0° -> 360°)";
note = "Full 360° coverage";
}
else
{
arc = $"{start}° {DescribeAngle(start)} -> {end}° {DescribeAngle(end)} ({span}° span)";
note = "";
}
string name = t.Name.Length > 26 ? t.Name[..26] : t.Name;
Console.WriteLine(
$"{t.Id,-6} {name,-26} {t.AngleStart + "°",-6} {t.AngleLength + "°",-6} {arc,-28} {note}");
}
private static string DescribeAngle(int degrees)
{
int d = ((degrees % 360) + 360) % 360;
int idx = (int)Math.Round(d / 45.0);
return Directions[idx];
}
private static bool IsHelp(string arg)
=> arg == "-h" || arg == "--help" || arg == "/?" || arg == "help";
private static void PrintUsage()
{
Console.WriteLine("TurretInspector - inspects computer/turret aiming limits in a vehicle file.");
Console.WriteLine();
Console.WriteLine("Usage:");
Console.WriteLine(" dotnet run --project dotnetcore/TurretInspector -- <vehiclesFile> [filter]");
Console.WriteLine();
Console.WriteLine("Arguments:");
Console.WriteLine(" vehiclesFile Path to a vehicle data file (the CSV parsed by Assets.VehInfo).");
Console.WriteLine(" filter Optional name substring or vehicle ID to narrow the report.");
Console.WriteLine();
Console.WriteLine("Example:");
Console.WriteLine(" dotnet run --project dotnetcore/TurretInspector -- vehicles.cs turret");
}
}
}
Turret aiming report: advrpg.veh
Angle convention (matches server isValidTarget): 0=Up, 90=Right, 180=Down, 270=Left (clockwise).
63 computer/turret vehicle(s).
ID Name Start Length Aim arc (start -> start+length) Note
--------------------------------------------------------------------------------------------------------------------
400 Auto Turret - MG 0° 360° Full circle (0° -> 360°) Full 360° coverage
401 Auto Turret - Rocket AT 0° 360° Full circle (0° -> 360°) Full 360° coverage
402 Sentry 0° 360° Full circle (0° -> 360°) Full 360° coverage
403 Hive Spider Hole 0° 360° Full circle (0° -> 360°) Full 360° coverage
404 Hive Spider Adult 0° 360° Full circle (0° -> 360°) Full 360° coverage
405 Class V Rockslide 0° 360° Full circle (0° -> 360°) Full 360° coverage
406 MeteorShower 0° 360° Full circle (0° -> 360°) Full 360° coverage
407 Wall - Tier1 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
408 Class V Quake 0° 360° Full circle (0° -> 360°) Full 360° coverage
409 Field Converter - Light 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
410 Field Converter - Heavy 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
411 Hive Spider Hole 0° 360° Full circle (0° -> 360°) Full 360° coverage
412 Auto Turret - Flak 0° 360° Full circle (0° -> 360°) Full 360° coverage
413 Auto Turret - AT 0° 360° Full circle (0° -> 360°) Full 360° coverage
414 Pirate Raider Class 2 0° 360° Full circle (0° -> 360°) Full 360° coverage
415 Pirate Commander Class 2 0° 360° Full circle (0° -> 360°) Full 360° coverage
416 Pirate Heavy Class 2 0° 360° Full circle (0° -> 360°) Full 360° coverage
417 Pirate Infiltrator Class 2 0° 360° Full circle (0° -> 360°) Full 360° coverage
418 Pirate Flakker Class 1 0° 360° Full circle (0° -> 360°) Full 360° coverage
419 Pirate Elite Class 2 0° 360° Full circle (0° -> 360°) Full 360° coverage
420 FCU - Light Duty 0° 360° Full circle (0° -> 360°) Full 360° coverage
421 Class V Eruption 0° 360° Full circle (0° -> 360°) Full 360° coverage
422 Meteor 0° 360° Full circle (0° -> 360°) Full 360° coverage
423 Pirate Lieutenant 0° 360° Full circle (0° -> 360°) Full 360° coverage
424 Hustlin Harry 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
425 Class IV Quake 0° 360° Full circle (0° -> 360°) Full 360° coverage
426 Class I Aftershock 0° 360° Full circle (0° -> 360°) Full 360° coverage
427 None 0° 360° Full circle (0° -> 360°) Full 360° coverage
428 FCU - Medium Duty 0° 360° Full circle (0° -> 360°) Full 360° coverage
429 Doctor Duke 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
431 Alien Chief 0° 360° Full circle (0° -> 360°) Full 360° coverage
432 Alien Warrior 0° 360° Full circle (0° -> 360°) Full 360° coverage
433 Alien Brute 0° 360° Full circle (0° -> 360°) Full 360° coverage
434 Alien Arachnomorph 0° 360° Full circle (0° -> 360°) Full 360° coverage
435 Alien Electromorph 0° 360° Full circle (0° -> 360°) Full 360° coverage
436 Wall - Tier3 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
437 Pirate Commander Class 1 0° 360° Full circle (0° -> 360°) Full 360° coverage
438 WTF Pirate 0° 360° Full circle (0° -> 360°) Full 360° coverage
439 Pirate Heavy Class 1 0° 360° Full circle (0° -> 360°) Full 360° coverage
440 Pirate Elite Class 1 0° 360° Full circle (0° -> 360°) Full 360° coverage
441 Pirate Raider Class 1 0° 360° Full circle (0° -> 360°) Full 360° coverage
442 Pirate Raider Class 3 0° 360° Full circle (0° -> 360°) Full 360° coverage
443 Pirate Commander Class 3 0° 360° Full circle (0° -> 360°) Full 360° coverage
444 Pirate Heavy Class 3 0° 360° Full circle (0° -> 360°) Full 360° coverage
445 Pirate Infiltrator Class 3 0° 360° Full circle (0° -> 360°) Full 360° coverage
446 Pirate Flakker Class 2 0° 360° Full circle (0° -> 360°) Full 360° coverage
447 Pirate Elite Class 3 0° 360° Full circle (0° -> 360°) Full 360° coverage
448 FCU - Heavy Duty 0° 360° Full circle (0° -> 360°) Full 360° coverage
458 Ammo MatterTransceiver 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
459 Helmet Trader Tier 1 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
461 Alien Brute 0° 360° Full circle (0° -> 360°) Full 360° coverage
700 Auto Turret - Plasma 0° 360° Full circle (0° -> 360°) Full 360° coverage
801 Wall - Tier2 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
802 Wall - Tier4 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
803 Wall - Tier5 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
820 Pirate Infiltrator Class 1 0° 360° Full circle (0° -> 360°) Full 360° coverage
823 Auto Turret - Maser 0° 360° Full circle (0° -> 360°) Full 360° coverage
825 Auto Turret - Rocket AP 0° 360° Full circle (0° -> 360°) Full 360° coverage
832 Vehicle Factory 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
838 Base Teleport Point 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
839 Personal Vehicle Vendor 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
842 Public Field Converter 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
843 WTF Roaming 0° 360° Full circle (0° -> 360°) Full 360° coverage
Turret aiming report: Rogue.veh
Angle convention (matches server isValidTarget): 0=Up, 90=Right, 180=Down, 270=Left (clockwise).
17 computer/turret vehicle(s).
ID Name Start Length Aim arc (start -> start+length) Note
--------------------------------------------------------------------------------------------------------------------
400 Refinery 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
401 Null Death Orb 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
402 MeteorShower 0° 360° Full circle (0° -> 360°) Full 360° coverage
403 PirateStation 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
404 Trading Outpost 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
405 Null Kill Station 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
407 Repair Dock 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
408 Micro Repair Dock 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
409 Solar Mold 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
410 GunSat 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
411 BeamSat 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
412 Micro Refinery 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
413 Rogue Trader Outpost 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
414 Mold Spore 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
425 Manufactory - Missile 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
426 Manufactory - Munitions 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
427 Manufactory - Defense 0° 0° 0° Up only (zero-width) !! Length=0: cannot track - matches the aim bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment