mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-16 08:45:27 +00:00
refactor(component): the client's component lifecycle
Components get the client's per-component functions: LoadDataFromTemplate, PrepareConfigData, LoadConfigData, LoadFromSaveData, Startup, Run, OnEnterScope, OnLeaveScope, Preshutdown and Shutdown, called by the entity in the client's order. Update is renamed Run, LoadFromXml LoadFromSaveData and UpdateXml WriteSaveData. Nothing sent changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,7 @@ protected:
|
||||
character->_doQuickXMLDataParse();
|
||||
character->LoadXmlRespawnCheckpoints();
|
||||
|
||||
entity->AddComponent<CharacterComponent>(-1, character.get(), UNASSIGNED_SYSTEM_ADDRESS)->LoadFromXml(entity->GetCharacter()->GetXMLDoc());
|
||||
entity->AddComponent<CharacterComponent>(-1, character.get(), UNASSIGNED_SYSTEM_ADDRESS)->LoadFromSaveData(entity->GetCharacter()->GetXMLDoc());
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
@@ -63,7 +63,7 @@ TEST_F(SavingTest, CharacterComponentTest) {
|
||||
const auto prevTotalTime = characterComponent->GetTotalTimePlayed();
|
||||
character->_doQuickXMLDataParse();
|
||||
entity->AddComponent<CharacterComponent>(-1, character.get(), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
characterComponent->LoadFromXml(entity->GetCharacter()->GetXMLDoc());
|
||||
characterComponent->LoadFromSaveData(entity->GetCharacter()->GetXMLDoc());
|
||||
|
||||
// Check that the buff component is the same as before which means resaving data and loading it back in didn't change anything
|
||||
ASSERT_EQ("32114;69;343;13;163;2;181;2;388;252;146;24451;25;9022;41898;42186;42524;4404;0;0;0;0;0;0;0;0;0;", characterComponent->StatisticsToString());
|
||||
|
||||
Reference in New Issue
Block a user