Repository navigation
Expand file tree
/
Copy pathNadeSystem.Models.cs
More file actions
81 lines (64 loc) · 3.28 KB
/
Copy pathNadeSystem.Models.cs
File metadata and controls
81 lines (64 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;
using System.Text.Json.Serialization;
namespace NadeSystem;
// ═══════════════════════════════════════════════════════════════
// Data model
// Reads converted NadeLauncher JSON: <mapname>_<grenadeType>.json
// Each file is a JSON array of GrenadeData entries.
// ═══════════════════════════════════════════════════════════════
public class Vec3
{
[JsonPropertyName("x")] public float X { get; set; }
[JsonPropertyName("y")] public float Y { get; set; }
[JsonPropertyName("z")] public float Z { get; set; }
}
public class GrenadeData
{
[JsonPropertyName("id")]
public string Id { get; set; } = "";
[JsonPropertyName("mapName")]
public string MapName { get; set; } = "";
// "flash" | "smoke" | "he" | "molotov"
[JsonPropertyName("grenadeType")]
public string GrenadeType { get; set; } = "";
// Where the projectile spawns (recorded release point)
[JsonPropertyName("projectilePosition")]
public Vec3 ProjectilePosition { get; set; } = new();
// Recorded velocity vector
[JsonPropertyName("projectileVelocity")]
public Vec3 ProjectileVelocity { get; set; } = new();
// Landing position
[JsonPropertyName("landingPosition")]
public Vec3 LandingPosition { get; set; } = new();
// Tags
[JsonPropertyName("description")]
public string Description { get; set; } = "";
[JsonIgnore] public string TeamTag { get; set; } = "";
// ── Computed zone properties (not serialized) ────────────
// Zone center = XY projection of projectilePosition onto the ground (Z kept as-is)
[JsonIgnore] public float ZoneX => ProjectilePosition.X;
[JsonIgnore] public float ZoneY => ProjectilePosition.Y;
[JsonIgnore] public float ZoneZ => ProjectilePosition.Z;
// Smoke = 150, Other nades = 100 (radius)
[JsonIgnore]
public float ZoneRadius => string.Equals(GrenadeType, "smoke",
StringComparison.OrdinalIgnoreCase) ? 150f : 100f;
}
// ═══════════════════════════════════════════════════════════════
// Cooldown record
// ═══════════════════════════════════════════════════════════════
public class CooldownEntry
{
public string GrenadeId { get; set; } = "";
public float ExpiresAt { get; set; }
}
// ═══════════════════════════════════════════════════════════════
// Per-round throw counter
// ═══════════════════════════════════════════════════════════════
public class RoundCounter
{
public int Flash { get; set; }
public int Smoke { get; set; }
public int HE { get; set; }
public int Molotov { get; set; }
}