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 e37c19b5b4
11 changed files with 233 additions and 1 deletions

View file

@ -100,6 +100,7 @@
#include "a_dynlight.h"
#include "fragglescript/t_fs.h"
#include "shadowinlines.h"
#include "d_net.h"
// MACROS ------------------------------------------------------------------
@ -178,6 +179,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
@ -4775,6 +4793,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;