mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-27 00:11:35 +00:00
fix(entity): a quick build without a destroyable gets one, as the client makes it
DoObjectComponentLoad adds a destroyable (componentID -1) to a quick build that has none and marks it smashable. DLU's quick build wrote three empty flags instead. The construction's destroyable now matches live field for field (AG LOT 7804: health 1 / 1.0, armor 1 / 0, faction -1, smashable). 117 LOTs gain it; nothing else changes (LoaderSnapshotTest). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -669,6 +669,17 @@ void Entity::Initialize() {
|
|||||||
if (quickBuildComponentID > 0) {
|
if (quickBuildComponentID > 0) {
|
||||||
auto* const quickBuildComponent = AddComponent<QuickBuildComponent>(quickBuildComponentID);
|
auto* const quickBuildComponent = AddComponent<QuickBuildComponent>(quickBuildComponentID);
|
||||||
|
|
||||||
|
// A quick build without a destroyable gets one (componentID -1) and is smashable, as the client makes it
|
||||||
|
// (DoObjectComponentLoad); live: health 1 / 1.0, armor 1 / 0, faction -1, smashable (AG LOT 7804)
|
||||||
|
if (!HasComponent(eReplicaComponentType::DESTROYABLE)) {
|
||||||
|
auto* const destroyable = AddComponent<DestroyableComponent>(-1);
|
||||||
|
destroyable->SetMaxHealth(1.0f);
|
||||||
|
destroyable->SetHealth(1);
|
||||||
|
destroyable->SetArmor(1);
|
||||||
|
destroyable->SetFaction(-1, true);
|
||||||
|
destroyable->SetIsSmashable(true);
|
||||||
|
}
|
||||||
|
|
||||||
CDRebuildComponentTable* const rebCompTable = CDClientManager::GetTable<CDRebuildComponentTable>();
|
CDRebuildComponentTable* const rebCompTable = CDClientManager::GetTable<CDRebuildComponentTable>();
|
||||||
const std::vector<CDRebuildComponent> rebCompData = rebCompTable->Query([quickBuildComponentID](CDRebuildComponent entry) { return (entry.id == quickBuildComponentID); });
|
const std::vector<CDRebuildComponent> rebCompData = rebCompTable->Query([quickBuildComponentID](CDRebuildComponent entry) { return (entry.id == quickBuildComponentID); });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user