Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Numerics;
namespace Game.Client;
[NetworkName("CPrecipitation")]
public partial class C_Precipitation : C_BaseEntity
public partial class CClient_Precipitation : C_BaseEntity
{
[NetworkTable]
public static readonly new NetworkProp[] Props = [
Expand Down
2 changes: 1 addition & 1 deletion Game.Client/C_NPC_Barney.cs → Game.Client/C_Barney.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Game.Client;

[NetworkName("CNPC_Barney")]
public partial class C_NPC_Barney : C_AI_BaseNPC
public partial class C_Barney : C_AI_BaseNPC
{
[NetworkTable]
public static readonly new NetworkProp[] Props = [
Expand Down
3 changes: 3 additions & 0 deletions Game.Client/C_BaseAnimatingOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace Game.Client;
[NetworkName("CBaseAnimatingOverlay")]
public partial class C_BaseAnimatingOverlay : C_BaseAnimating
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable("DT_OverlayVars")]
public static readonly NetworkProp[] OverlayVarsProps = [
new(nameof(AnimOverlay)) { Encoding = NetEncoding.List, Count = MAX_OVERLAYS, DataTable = "DT_Animationlayer", Proxy = typeof(AnimOverlayProxy) },
Expand Down
16 changes: 14 additions & 2 deletions Game.Client/C_BaseEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ public void SetClassname(ReadOnlySpan<char> classname) {

static readonly char[] GetClassname__outstr = new char[256];
public ReadOnlySpan<char> GetClassname() {
#if GMOD_DLL
if (RealClassName != 0 && Game.Client.GarrysMod.NetworkString.Convert(RealClassName) is string realClassName)
return realClassName;
#endif
if (!string.IsNullOrEmpty(Classname))
return Classname;
#if GMOD_DLL
Expand All @@ -319,8 +323,16 @@ public ReadOnlySpan<char> GetClassname() {
}
}

if (!gotname)
strcpy(GetClassname__outstr, GetType().Name);
if (!gotname) {
string typeName = GetType().Name;
if (!typeName.StartsWith("C_") && !(typeName.Length > 1 && typeName[0] == 'C' && char.IsUpper(typeName[1])))
typeName = "C_" + typeName;
#if WIN32
strcpy(GetClassname__outstr, $"class {typeName}");
#else
strcpy(GetClassname__outstr, $"{typeName.Length}{typeName}");
#endif
}

return GetClassname__outstr.SliceNullTerminatedString();
}
Expand Down
3 changes: 3 additions & 0 deletions Game.Client/C_BaseFlex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ public class EmphasizedPhoneme
[NetworkName("CBaseFlex")]
public partial class C_BaseFlex : C_BaseAnimatingOverlay, IHasLocalToGlobalFlexSettings
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

static readonly ConVar g_CV_PhonemeDelay = new("phonemedelay", "0", FCvar.None, "Phoneme delay to account for sound system latency.");
static readonly ConVar g_CV_PhonemeFilter = new("phonemefilter", "0.08", FCvar.None, "Time duration of box filter to pass over phonemes.");
static readonly ConVar g_CV_FlexRules = new("flex_rules", "1", FCvar.None, "Allow flex animation rules to run.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Game.Client;
[LinkEntityToClass("beam_spotlight")]
[NetworkName("CBeamSpotlight")]
public partial class C_BeamSpotlight : C_BaseEntity
public partial class C_BeamSpotLight : C_BaseEntity
{
[NetworkTable]
public static readonly new NetworkProp[] Props = [
Expand Down
7 changes: 7 additions & 0 deletions Game.Client/C_BoneManipulate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ namespace Game.Client;
[NetworkName("CBoneManipulate")]
public partial class C_BoneManipulate : C_BaseEntity
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [
new(nameof(BonePos)) { Type = FieldType.PositionVector },
new(nameof(BoneAng)) { Type = FieldType.PositionVector },
new(nameof(BoneScale)) { Type = FieldType.PositionVector },
];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
new(nameof(BonePos)) { Bits = 0, Flags = PropFlags.NoScale },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Numerics;
namespace Game.Client;
[NetworkName("CNPC_CombineGunship", Table = "DT_CombineGunship")]
public partial class C_NPC_CombineGunship : C_BaseHelicopter
public partial class C_CombineGunship : C_BaseHelicopter
{
[NetworkTable]
public static readonly new NetworkProp[] Props = [
Expand Down
3 changes: 3 additions & 0 deletions Game.Client/C_FlexManipulate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ namespace Game.Client;
[NetworkName("CFlexManipulate")]
public partial class C_FlexManipulate : C_BaseEntity
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
new(nameof(ExScale)) { Bits = 0, Flags = PropFlags.NoScale },
Expand Down
15 changes: 14 additions & 1 deletion Game.Client/C_PlayerResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ public static class PlayerResourceGlobals
[NetworkName("CPlayerResource", NoBase = true)]
public partial class C_PlayerResource : C_BaseEntity
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [
new(nameof(Name)) { Flags = FieldTypeDescFlags.Private },
new(nameof(Ping)) { Flags = FieldTypeDescFlags.Private },
new(nameof(Score)) { Flags = FieldTypeDescFlags.Private },
new(nameof(Deaths)) { Flags = FieldTypeDescFlags.Private },
new(nameof(Connected)) { Flags = FieldTypeDescFlags.Private },
new(nameof(Team)) { Flags = FieldTypeDescFlags.Private },
new(nameof(Alive)) { Flags = FieldTypeDescFlags.Private },
new(nameof(Health)) { Flags = FieldTypeDescFlags.Private },
new(nameof(Armor)) { Flags = FieldTypeDescFlags.Private },
];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
new(nameof(Ping)) { Bits = 12, Flags = PropFlags.Unsigned },
Expand Down Expand Up @@ -47,7 +60,7 @@ public partial class C_PlayerResource : C_BaseEntity
InlineArrayMaxPlayersPlusOne<int> Armor = new();

const string PLAYER_UNCONNECTED_NAME = "unconnected";
readonly string?[] Name = new string?[Constants.MAX_PLAYERS + 1];
InlineArrayMaxPlayersPlusOne<string?> Name;

public C_PlayerResource() => g_pPlayerResource = this;

Expand Down
8 changes: 4 additions & 4 deletions Game.Client/C_Props.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

namespace Game.Client;
using System.Numerics;
using FIELD_PBM = Source.FIELD<PhysBoxMultiplayer>;
using FIELD_PBM = Source.FIELD<CPhysBoxMultiplayer>;
using FIELD_BPD = Source.FIELD<C_BasePropDoor>;
using FIELD_PPM = Source.FIELD<PhysicsPropMultiplayer>;
using FIELD_PPM = Source.FIELD<CPhysicsPropMultiplayer>;

[NetworkName("CDynamicProp")]
public partial class C_DynamicProp : C_BreakableProp
Expand All @@ -24,7 +24,7 @@ public partial class C_DynamicProp : C_BreakableProp


[NetworkName("CPhysicsPropMultiplayer")]
public partial class PhysicsPropMultiplayer : C_PhysicsProp
public partial class CPhysicsPropMultiplayer : C_PhysicsProp
{
[NetworkTable]
public static readonly new NetworkProp[] Props = [
Expand All @@ -45,7 +45,7 @@ public partial class PhysicsPropMultiplayer : C_PhysicsProp
}

[NetworkName("CPhysBoxMultiplayer")]
public partial class PhysBoxMultiplayer : C_PhysBox
public partial class CPhysBoxMultiplayer : C_PhysBox
{
[NetworkTable]
public static readonly new NetworkProp[] Props = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Numerics;
namespace Game.Client;
[NetworkName("CEnvQuadraticBeam", Table = "DT_QuadraticBeam")]
public partial class C_EnvQuadraticBeam : C_BaseEntity
public partial class C_QuadraticBeam : C_BaseEntity
{
[NetworkTable]
public static readonly new NetworkProp[] Props = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Numerics;
namespace Game.Client;
[NetworkName("CNPC_RollerMine", Table = "DT_RollerMine")]
public partial class C_NPC_RollerMine : C_AI_BaseNPC
public partial class C_RollerMine : C_AI_BaseNPC
{
[NetworkTable]
public static readonly new NetworkProp[] Props = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Numerics;
namespace Game.Client;
[NetworkName("CRagdollProp", Table = "DT_Ragdoll")]
public partial class C_RagdollProp : C_BaseAnimating
public partial class C_ServerRagdoll : C_BaseAnimating
{
const int RAGDOLL_MAX_ELEMENTS = 32;
[NetworkTable]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Game.Client;

[NetworkName("CRagdollPropAttached", Table = "DT_Ragdoll_Attached")]
public partial class C_RagdollPropAttached : C_RagdollProp
public partial class C_ServerRagdollAttached : C_ServerRagdoll
{
[NetworkTable]
public static readonly new NetworkProp[] Props = [
Expand Down
11 changes: 11 additions & 0 deletions Game.Client/C_Team.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ public static bool ArePlayersOnSameTeam(int playerIndex1, int playerIndex2){
[NetworkName("CTeam")]
public partial class C_Team : C_BaseEntity
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [
new(nameof(Teamname)) { Type = FieldType.StringCharacter, Flags = FieldTypeDescFlags.Private },
new(nameof(Score)) { Flags = FieldTypeDescFlags.Private },
new(nameof(RoundsWon)) { Flags = FieldTypeDescFlags.Private },
new(nameof(Deaths)) { Flags = FieldTypeDescFlags.Private },
new(nameof(Ping)) { Flags = FieldTypeDescFlags.Private },
new(nameof(Packetloss)) { Flags = FieldTypeDescFlags.Private },
new(nameof(TeamNum)) { Flags = FieldTypeDescFlags.Private },
];

[NetworkTable(NoBase = true)]
public static readonly new NetworkProp[] Props = [
nameof(TeamNum),
Expand Down
3 changes: 3 additions & 0 deletions Game.Client/GarrysMod/C_GMOD_Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ namespace Game.Client.GarrysMod;
[NetworkName("CGMOD_Player")]
public partial class C_GMOD_Player() : C_HL2MP_Player()
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
nameof(GModPlayerFlags),
Expand Down
3 changes: 3 additions & 0 deletions Game.Client/HL1/C_BaseHL1CombatWeapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ namespace Game.Client.HL1;
[NetworkName("CBaseHL1CombatWeapon")]
public partial class C_BaseHL1CombatWeapon : C_BaseCombatWeapon
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
];
Expand Down
3 changes: 3 additions & 0 deletions Game.Client/HL1/C_BaseHL1MPCombatWeapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ namespace Game.Client.HL1;
[NetworkName("CBaseHL1MPCombatWeapon")]
public partial class C_BaseHL1MPCombatWeapon : C_BaseHL1CombatWeapon
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
];
Expand Down
21 changes: 21 additions & 0 deletions Game.Client/HL2/C_Weapon_Stubs_HL2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace Game.Client.HL2;
[NetworkName("CWeaponCycler")]
public partial class C_WeaponCycler : C_BaseCombatWeapon
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
];
Expand All @@ -20,6 +23,9 @@ public partial class C_WeaponCycler : C_BaseCombatWeapon
[NetworkName("CWeaponAnnabelle")]
public partial class C_WeaponAnnabelle : C_BaseHLCombatWeapon
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
];
Expand All @@ -30,6 +36,9 @@ public partial class C_WeaponAnnabelle : C_BaseHLCombatWeapon
[NetworkName("CWeaponAlyxGun")]
public partial class C_WeaponAlyxGun : C_HLSelectFireMachineGun
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
];
Expand All @@ -40,6 +49,9 @@ public partial class C_WeaponAlyxGun : C_HLSelectFireMachineGun
[NetworkName("CWeaponCitizenPackage")]
public partial class C_WeaponCitizenPackage : C_BaseHLCombatWeapon
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
];
Expand All @@ -50,6 +62,9 @@ public partial class C_WeaponCitizenPackage : C_BaseHLCombatWeapon
[NetworkName("CWeaponCitizenSuitcase")]
public partial class C_WeaponCitizenSuitcase : C_WeaponCitizenPackage
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
];
Expand All @@ -60,6 +75,9 @@ public partial class C_WeaponCitizenSuitcase : C_WeaponCitizenPackage
[NetworkName("CWeaponCubemap")]
public partial class C_WeaponCubemap : C_BaseCombatWeapon
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
];
Expand All @@ -71,6 +89,9 @@ public partial class C_WeaponCubemap : C_BaseCombatWeapon
[NetworkName("CWeaponOldManHarpoon")]
public partial class C_WeaponOldManHarpoon : C_WeaponCitizenPackage
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
];
Expand Down
12 changes: 12 additions & 0 deletions Game.Server/BaseEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ internal static void SendProxy_SimulationTime(SendProp prop, object instance, IF


public virtual int Save(ISave save) { throw new NotImplementedException(); }
// todo: GMod's Restore calls SetMaterialOverride(OverrideMaterialName) and SetClassname(RealClassNameString) again when they are not empty
public virtual int Restore(IRestore save) { throw new NotImplementedException(); }
public virtual bool ShouldSavePhysics() => true;
public virtual void OnSave(IEntitySaveUtils utils) {
Expand Down Expand Up @@ -2744,6 +2745,12 @@ public void CalcAbsoluteVelocity() {

public void SetClassname(ReadOnlySpan<char> classname) {
Classname = new(classname);
#if GMOD_DLL
if ((ObjectCaps() & EntityCapabilities.AcrossTransition) != 0) {
RealClassName = (ushort)Game.Server.GarrysMod.NetworkString.Add(Classname);
strcpy(RealClassNameString, classname);
}
#endif
}

public Edict Edict() => NetworkProp().Edict();
Expand Down Expand Up @@ -2910,6 +2917,10 @@ public virtual ReadOnlySpan<char> GetClassname() {
// DEFINE_THINKFUNC( ShadowCastDistThink ),
DEFINE.FIELD(nameof(EffectEntity), FieldType.EHandle),
// DEFINE_ARRAY( m_nModelIndexOverrides, FIELD_INTEGER, MAX_VISION_MODES ),
#if GMOD_DLL
DEFINE.AUTO_ARRAY(nameof(OverrideMaterialName), FieldType.Character),
DEFINE.AUTO_ARRAY(nameof(RealClassNameString), FieldType.Character),
#endif
]);
public virtual DataMap? GetDataDescMap() => DataDesc;

Expand Down Expand Up @@ -3467,6 +3478,7 @@ public void TraceAttackToTriggers(in TakeDamageInfo info, in Vector3 start, in V
public virtual void SetUseType(int type) { }

InlineArray256<char> OverrideMaterialName;
InlineArray256<char> RealClassNameString;

public virtual void SetMaterialOverride(ReadOnlySpan<char> name) {
if (!name.IsEmpty && name[0] != '\0') {
Expand Down
3 changes: 3 additions & 0 deletions Game.Shared/BaseParticleEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public partial class
BaseParticleEntity : BaseEntity
#endif
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
];
Expand Down
3 changes: 3 additions & 0 deletions Game.Shared/BaseToggle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ namespace Game.Shared;
[NetworkName("CBaseToggle")]
public partial class BaseToggle : BaseEntity
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
new(nameof(FinalDest)) { Bits = 0, Flags = PropFlags.NoScale },
Expand Down
3 changes: 3 additions & 0 deletions Game.Shared/GarrysMod/BaseHL2MPBludgeonWeapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace Game.Shared.GarrysMod;
[NetworkName("CBaseHL2MPBludgeonWeapon")]
public partial class BaseHL2MPBludgeonWeapon : BaseHL2MPCombatWeapon
{
[PredictionTable]
public static readonly new PredictionField[] Prediction = [];

[NetworkTable]
public static readonly new NetworkProp[] Props = [
];
Expand Down
Loading
Loading