Files
DarkflameServer/dGame/dUtilities/PropertyBuilders.h
Aaron Kimbrell ebf3a05704 feat(property): best friends of the owner can build on the property
property_bff_build (off by default, as live): while the owner is in build
mode, their best friends can join it and place, move and pick up models,
build brick by brick and edit behaviors, each from their own inventory.
Only the owner starts build mode; a best friend still in it when the owner
leaves keeps building until they leave it.

The client lets only the property's owner edit, so each player now gets
their own DownloadPropertyData, with their own id as the owner while they
can build, sent again whenever that changes. SetBuildModeConfirmed and
GetModelsOnProperty go to each player instead of everyone. The first
builder makes the property private and pauses the models; the last one
restores them. Saving no longer needs the owner in the world.

A model taken off the property goes to whoever placed it; if they aren't
here it stays placed. Privacy and the property's name stay owner only
(neither was checked before).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 22:31:20 -05:00

45 lines
1.7 KiB
C++

#ifndef __PROPERTYBUILDERS__H__
#define __PROPERTYBUILDERS__H__
#include <cstdint>
#include "dCommonVars.h"
/**
* Who builds on a property (docs/PropertyBuilding.md): the owner, and with property_bff_build the owner's best friends
* while the owner is building. The rules here have no game state (unit tested); PropertyManagementComponent applies
* them.
*/
namespace PropertyBuilders {
// worldconfig.ini's property_bff_build
bool BestFriendsBuild();
// Where a player stands on the property
struct Player {
LWOOBJID id{};
bool isBestFriend{}; // of the owner
bool isBuilding{}; // in build mode on the property
};
/**
* Whether a player can build: the owner always. A best friend of the owner (with property_bff_build) while the owner
* is building, and after the owner stopped until they leave build mode themselves.
*/
bool CanBuild(const Player& player, LWOOBJID owner, bool ownerBuilding, bool bestFriendsBuild);
// Who placed a model, from its properties_contents.placed_by (0, NULL in the database: the owner)
LWOOBJID Placer(LWOOBJID placedBy, LWOOBJID owner);
enum class eModelReturn {
PICKER, // the player taking it off placed it: into their inventory
PLACER, // someone else placed it and is in this world: into the placer's inventory
PLACER_AWAY, // someone else placed it and isn't in this world: it stays on the property
NOT_THEIRS, // someone else placed it and the picker wants to take it apart: it stays on the property
};
// Where a model taken off the property goes (DeleteModelFromClient's reason, see BrickByBrick::eDeleteReason)
eModelReturn PlanModelReturn(LWOOBJID picker, LWOOBJID placer, bool placerHere, int32_t deleteReason);
}
#endif //!__PROPERTYBUILDERS__H__