New API for assigning unique network ids to objects

This commit is contained in:
Boondorl 2024-02-19 13:35:01 -05:00 committed by Rachael Alexanderson
commit 8d0d130dc9
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0
11 changed files with 233 additions and 1 deletions

View file

@ -101,6 +101,7 @@
#include "fragglescript/t_fs.h"
#include "shadowinlines.h"
#include "model.h"
#include "d_net.h"
// MACROS ------------------------------------------------------------------
@ -179,6 +180,23 @@ IMPLEMENT_POINTERS_START(AActor)
IMPLEMENT_POINTER(boneComponentData)
IMPLEMENT_POINTERS_END
//==========================================================================
//
// Make sure Actors can never have their networking disabled.
//
//==========================================================================
void AActor::EnableNetworking(const bool enable)
{
if (!enable)
{
ThrowAbortException(X_OTHER, "Cannot disable networking on Actors. Consider a Thinker instead.");
return;
}
Super::EnableNetworking(true);
}
//==========================================================================
//
// AActor :: Serialize
@ -4830,6 +4848,7 @@ AActor *AActor::StaticSpawn(FLevelLocals *Level, PClassActor *type, const DVecto
AActor *actor;
actor = static_cast<AActor *>(Level->CreateThinker(type));
actor->EnableNetworking(true);
ConstructActor(actor, pos, SpawningMapThing);
return actor;