forked from MagicBane/Server
Serialize static buildings' asset block as live servers did
Live LOADSTRUCTURE records send static props and their furniture with objectid_d and objectid_e zero and unknown_bool_b false; furniture also has 0/0 health (4,506 of 4,506 live child props). The server sent its own ID, the owner, the flag set and health for every building. Static buildings now write the live values; player buildings keep the old block. Still different from live, not touched here: top-level static health (live 0 for most props), the int_c icon on some props, and the object type word. Value changes (wire only): static buildings send no own ID, owner or flag; static furniture sends 0/0 health. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7b5a857802
commit
d160c36709
1 file changed
+29
-10
@@ -350,19 +350,38 @@ public class Building extends AbstractWorldObject {
|
||||
|
||||
writer.put((byte) 0); // 0
|
||||
writer.putFloat(3); // 3
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(building.getObjectUUID());
|
||||
|
||||
if (building.ownerIsNPC)
|
||||
writer.putInt(GameObjectType.NPC.ordinal());
|
||||
else
|
||||
writer.putInt(GameObjectType.PlayerCharacter.ordinal());
|
||||
// Live static props and their furniture: no own ID, no owner, flag clear, and no health on furniture.
|
||||
if (building.isStaticWorldObject()) {
|
||||
|
||||
writer.putInt(building.ownerUUID);
|
||||
for (int i = 0; i < 4; i++)
|
||||
writer.putInt(0);
|
||||
|
||||
writer.put((byte) 1); // End Datablock
|
||||
writer.putFloat(building.health.get());
|
||||
writer.putFloat(building.healthMax);
|
||||
writer.put((byte) 0);
|
||||
|
||||
if (building.parentBuildingID != 0) {
|
||||
writer.putFloat(0);
|
||||
writer.putFloat(0);
|
||||
} else {
|
||||
writer.putFloat(building.health.get());
|
||||
writer.putFloat(building.healthMax);
|
||||
}
|
||||
|
||||
} else {
|
||||
writer.putInt(GameObjectType.Building.ordinal());
|
||||
writer.putInt(building.getObjectUUID());
|
||||
|
||||
if (building.ownerIsNPC)
|
||||
writer.putInt(GameObjectType.NPC.ordinal());
|
||||
else
|
||||
writer.putInt(GameObjectType.PlayerCharacter.ordinal());
|
||||
|
||||
writer.putInt(building.ownerUUID);
|
||||
|
||||
writer.put((byte) 1); // End Datablock
|
||||
writer.putFloat(building.health.get());
|
||||
writer.putFloat(building.healthMax);
|
||||
}
|
||||
|
||||
if (building.blueprintUUID == 0)
|
||||
writer.putInt(0);
|
||||
|
||||
Reference in new issue
Block a user