Skip to content

Commit ef42b7c

Browse files
authored
Merge pull request #149 from marchc1/sdk-entities
Sdk entities
2 parents 8285619 + 4591953 commit ef42b7c

4 files changed

Lines changed: 36 additions & 1 deletion

File tree

‎Game.Server/BaseEntity.cs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,6 +1890,9 @@ public void EntityText(int text_offset, ReadOnlySpan<char> text, float duration,
18901890
DebugOverlay.EntityTextAtPosition(origin, text_offset, text, duration, r, g, b, a);
18911891
}
18921892

1893+
public virtual void DrawDebugGeometryOverlays() {
1894+
// todo
1895+
}
18931896
public virtual int DrawDebugTextOverlays() {
18941897
int offset = 1;
18951898
if ((DebugOverlays & DebugOverlayBits.Text) != 0) {

‎Game.Server/HL2/HL2_Player.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ bool TestHitboxes(Ray ray, uint fContentsMask, Trace tr) {
432432
throw new NotImplementedException();
433433
}
434434

435-
void DrawDebugGeometryOverlays() { }
435+
public override void DrawDebugGeometryOverlays() { }
436436

437437
public void ExitLadder() { }
438438

‎Game.Server/PathTrack.cs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
using Source;
44
using Source.Common;
5+
using Source.Common.Engine;
56
using Source.Common.Mathematics;
67

78
using System.Numerics;
@@ -182,6 +183,21 @@ public void TogglePath() {
182183
return path;
183184
}
184185

186+
public static PathTrack? Instance(Edict ent) {
187+
BaseEntity? entity = BaseEntity.Instance(ent);
188+
if (FClassnameIs(entity, "path_track"))
189+
return (PathTrack?)entity;
190+
return null;
191+
}
192+
193+
public override void DrawDebugGeometryOverlays() {
194+
if ((DebugOverlays & (DebugOverlayBits.BBox | DebugOverlayBits.AbsBox)) != 0)
195+
if (Next.IsValid())
196+
DebugOverlay.Line(GetAbsOrigin(), Next.Get()!.GetAbsOrigin(), 255, 100, 100, true, 0.0f);
197+
198+
base.DrawDebugGeometryOverlays();
199+
}
200+
185201
void Project(PathTrack? start, PathTrack? end, ref Vector3 origin, float dist) {
186202
if (start != null && end != null) {
187203
Vector3 dir = end.GetLocalOrigin() - start.GetLocalOrigin();

‎Game.Server/Triggers.cs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,22 @@ public void Enable() {
219219
}
220220
}
221221

222+
public override int DrawDebugTextOverlays() {
223+
int text_offset = base.DrawDebugTextOverlays();
224+
225+
if ((DebugOverlays & DebugOverlayBits.Text) != 0) {
226+
Span<char> tempstr = stackalloc char[255];
227+
if (IsSolidFlagSet(SolidFlags.Trigger))
228+
strcpy(tempstr, "State: Enabled");
229+
else
230+
strcpy(tempstr, "State: Disabled");
231+
EntityText(text_offset, tempstr, 0);
232+
text_offset++;
233+
}
234+
235+
return text_offset;
236+
}
237+
222238
//------------------------------------------------------------------------------
223239
// Purpose :
224240
//------------------------------------------------------------------------------

0 commit comments

Comments
 (0)