Skip to content

Commit

Permalink
feat: progress on leveled actor sync
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeBryssinck committed Dec 11, 2021
1 parent d4fa374 commit 94d4039
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Code/client/Games/Fallout4/Forms/TESForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ struct TESForm : BaseFormComponent
uint32_t unkC;
};

enum FormFlags
{
DISABLED = 1 << 0xB,
};

static TESForm* GetById(uint32_t aId);

virtual void sub_7();
Expand Down Expand Up @@ -106,6 +111,7 @@ struct TESForm : BaseFormComponent
// TODO: fallout 4 impl
return;
}
bool IsDisabled() const noexcept { return (flags & DISABLED) != 0; }

uintptr_t unk8;
uint32_t flags;
Expand Down
2 changes: 2 additions & 0 deletions Code/client/Games/Skyrim/Forms/TESForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct TESForm : BaseFormComponent

enum FormFlags
{
DISABLED = 1 << 0xB,
IGNORE_FRIENDLY_HITS = 1 << 0x14,
};

Expand Down Expand Up @@ -101,6 +102,7 @@ struct TESForm : BaseFormComponent
else
flags &= IGNORE_FRIENDLY_HITS;
}
bool IsDisabled() const noexcept { return (flags & DISABLED) != 0; }

uintptr_t unk4;
uint32_t flags;
Expand Down
5 changes: 4 additions & 1 deletion Code/client/Services/Generic/CharacterService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ void CharacterService::OnCharacterSpawn(const CharacterSpawnRequest& acMessage)
const auto cNpcId = World::Get().GetModSystem().GetGameId(acMessage.BaseId);
if(cNpcId == 0)
{
spdlog::error("Failed to retrieve NPC, it will not be spawned, possibly missing mod");
spdlog::error("Failed to retrieve NPC, it will not be spawned, possibly missing mod, base: {:X}:{:X}, form: {:X}:{:X}", acMessage.BaseId.BaseId, acMessage.BaseId.ModId, acMessage.FormId.BaseId, acMessage.FormId.ModId);
return;
}

Expand Down Expand Up @@ -337,6 +337,9 @@ void CharacterService::OnCharacterSpawn(const CharacterSpawnRequest& acMessage)
spdlog::error("Actor object {:X} could not be created.", acMessage.ServerId);
return;
}

if (pActor->IsDisabled())
pActor->Enable();

pActor->GetExtension()->SetRemote(true);
pActor->rotation.x = acMessage.Rotation.x;
Expand Down

0 comments on commit 94d4039

Please sign in to comment.