DIFF

class ConstructionBase

ConstructionBase › ConstructionBasic

Constructors 2

void ~ConstructionBase()

Constants 18

protected static const int MAX_MATERIAL_PILES = 64

safety cap for material pile spawning

static const float REPAIR_MATERIAL_PERCENTAGE = 0.15
static const float DECONSTURCT_MATERIAL_LOSS = 0.2
static const float DEFAULT_DECAY_RATE = -1.0

HP/s change

static const float DEFAULT_DECAY_THRESHOLD = 0.3

Percentage of max health where the decay stops

static const float DEFAULT_DECAY_RATE_COEF = 1.0

Default decay speed coef

Referenced by GetCurrentDecayCoef()
static const float SANDSTORM_DECAY_RATE_COEF = 1.5

Sandstorm decay speed coef

Referenced by GetCurrentDecayCoef()
static const float ITEM_FALL_MARGIN_TOP_DEFAULT = 0.5

top (+Y) margin for unmatched parts, covers collision boxes undershooting the part's support surface

static const float ITEM_FALL_MARGIN_TOP_ROOF = 0.5

top margin for roof/ceiling parts, tune per category as needed

static const float ITEM_FALL_MARGIN_TOP_WALL = 0.5
static const float ITEM_FALL_MARGIN_TOP_WINDOW = 0.5
static const float ITEM_FALL_MARGIN_TOP_DOOR = 0.5
static const float ITEM_FALL_HEIGHT_DIFF_TOLERANCE = 0.3
static const float ITEM_FALL_MARGIN_SIDE_WALL = 0.3

XZ side margin for wall parts, covers entities leaning against the inner/outer wall faces

static const int MAX_ITEM_FALL_DEBUG_WAVES = 8DIAG_DEVELOPER

safety cap for cascade waves in the item falling debug

static const int ITEM_FALL_DEBUG_QUERY_INTERVAL = 3DIAG_DEVELOPER

requery the item fall cascade every N frames, cached shapes are re-aimed in between

static const int ITEM_FALL_DEBUG_STALE_FRAMES = 3DIAG_DEVELOPER

frames without a targeting refresh before the debug shapes of a construction are cleaned up

static const float ITEM_FALL_DEBUG_FRECAM_RAY_DIST = 100.0DIAG_DEVELOPER

raycast distance for the free camera item fall debug part lookup

Members 30

protected bool m_AnyPartBuildableByHands
protected bool m_UpdateUtilityParts
protected ref ArrowManagerBase m_ArrowManagerConstruction
protected Shape m_PlayerInsideTestCylinderDIAG_DEVELOPER
protected int m_ItemFallDebugFrameCounterDIAG_DEVELOPER
protected ConstructionBoxTrigger m_ConstructionBoxTrigger

Deprecated

Methods 114

override void Init()
Referenced by Rebuilding.Init()
protected void SetParent(EntityAI parent)
References m_EntityParent
protected void HandleSyncDataBuild(ConstructionPart part)
protected void HandleSyncDataDismantle(ConstructionPart part)
protected void HandleSyncDataDestroy(ConstructionPart part)
protected bool UpdatePartSyncStateLocal(ConstructionPart part)

Returns 'true' if part state was locally changed

void HandleEntityFalling(string partName)

when supporting part is removed, entities resting on or against it should be made to fall

override bool CanUseHandConstruction()
override void OnHealthLevelChanged(int oldLevel, int newLevel, string zone)
bool ExceptionCheck(string part_name)

Exceptions from 'dependent parts' hierarchy are handled here

void UpdateSpecificPartPhysics(ConstructionPart part)

update SPECIFIC part's physics

void UpdatePhysics()

update ALL parts physics. Sets hide first, then shows the rest. Use only if the update queue system won't cut it.

protected ConstructionPart CreatePartInstanceObject(typename partTypename)
protected typename GetDefaultPartInstanceTypename()

Override on lower implements to create desired part types

References ErrorEx()
bool CanBuildUtilityPart(string partName)

Simplified condition for utility (non-)parts

Referenced by UpdateUtilityParts()
void GetConstructionPartsUnableToBuild(string actionComponentName, out array<ConstructionPart> constructionParts, ItemBase tool, out string realConstructionTarget, bool useTool)
bool HasRequiredPart(string part_name)

checks if construction part has all the required parts built

bool PartHasAnySupportFulfilled(string part_name)

checks if construction part has all the required support

ConstructionPart GetConstructionPartToDismantle(string part_name, ItemBase tool)
bool HasDependentPart(string part_name)

checks if construction part has dependent part (that is already built) because of which it cannot be dismantled

bool SupportRemovalCheck(string part_name)

Checks if all supports would hold on part removal. Returns 'false' if some would fail

bool PartSupportsOtherParts(string part_name)

Returns 'true' if the part is load-bearing for other built parts (explicit requirement dependencies; Rebuilding adds the support system and requirement variants), such parts skip their own item falling

array<string> GetRequiredParts(string part_name, string main_part_name)
ConstructionPart GetConstructionPartToDestroy(string part_name)
protected void ShowConstructionPart(string part_name)

Animates AnimationSource. Use on server only, AUTO-SYNCED

protected void HideConstructionPart(string part_name)

Animates AnimationSource. Use on server only, AUTO-SYNCED

bool HasMaterials(string part_name, bool repairing = false)
References HasMaterialsEx()
protected bool HasMaterialWithQuantityAttached(string slot_name, float quantity)
Referenced by HasMaterialsEx()
protected void MoveMaterialAttachmentToGround(notnull EntityAI parent, Man player, notnull ItemBase attachment, notnull InventoryLocation invloc, string partName)

The method does not care about the amount of materials that should be returned based on the cached quantity in the ConstructionMaterialData struct. If we start using this method for e.g. drop of materials that are not attached and locked to the construction parent then we need to change the method to handle the quantity accordingly

bool IgnoreHouseCollisions()

Whether House entities are skipped in the part collision check. Rebuildable buildings are static, so a part may legitimately overlap a House placed touching the rebuilt one (map authoring decision).

Referenced by IsCollidingEx()
vector GetCollisionBoxSize(vector min_max[2])
References Math.AbsFloat(), and Vector()
protected void GetCollisionBoxData(string part_name, out vector min_max[2])
Referenced by IsColliding(), and IsCollidingEx()
protected bool GetItemFallDetectionBoxData(string partName, out vector minMax[2])

Outputs item fall detection box minMax from the part's collision box, in MODELSPACE coordinates, inflated by the part category margins so entities resting on or leaning against the part are covered

vector GetItemFallBoxMargins(string partName)

XZ side/bottom/top margins of the item fall detection box, matched by part name category (case-insensitive substring)

vector GetBoxCenter(vector min_max[2])
References Vector()
void GetTriggerExtents(vector min_max[2], out vector extents[2])
protected void DrawDebugCollisionBox(vector min_max[2], int color)DIAG_DEVELOPER
Referenced by IsCollidingEx()
protected void DestroyDebugCollisionBox()DIAG_DEVELOPER
protected void DrawDebugInsideTestBox(vector min, vector max, int color, vector rotAngles = "0 0 0")DIAG_DEVELOPER
protected void DestroyDebugInsideTestBoxes()DIAG_DEVELOPER
void UpdateItemFallDebugVisuals(string partName)DIAG_DEVELOPER

draws the item fall detection boxes of the cascade triggered by a part and highlights the entities that would be made to fall

void UpdateItemFallDebugCascade(string partName)DIAG_DEVELOPER

debug helper: requeries the full item fall cascade of a part and reconciles the cached shapes and panel data, existing shapes are kept and re-aimed so they do not flicker, new ones are created and stale ones dropped

bool DrawItemFallDebugPartBox(string partName, int wave, array<Shape> debugBoxes)DIAG_DEVELOPER

debug helper: creates this part's fall box (wave colored) into the given shape list, returns 'true' when a box was created

void UpdateItemFallDebugPartBoxMatrix(Shape box)DIAG_DEVELOPER

debug helper: re-aims a cached part box at the current parent transform

int GetItemFallDebugWaveColor(int wave)DIAG_DEVELOPER

color of the fall box and affected entity highlight for a cascade wave

int GetItemFallDebugDroppedCount(BaseBuildingBase bbb)DIAG_DEVELOPER

debug helper: how many items are dropped when a falling base building deconstructs (attachments + cargo, plus the construction kit if foldable)

void ItemFallDebugEnqueueBbbParts(BaseBuildingBase bbb, array<ConstructionBase> queueConstructions, array<string> queueParts)DIAG_DEVELOPER

debug helper: queues the built parts of a deconstructing base building for the next cascade wave

protected void DrawDebugAffectedEntity(Object obj, int wave)DIAG_DEVELOPER

highlights an entity that would be affected by the item falling cascade, wave colored

int GetItemFallDebugLastTick()DIAG_DEVELOPER

last diag tick in which the debugged part was still targeted, used by the ConstructionDebug sweep

void ClearItemFallDebugShapes()DIAG_DEVELOPER

debug helper: destroys all cached debug shapes and clears the parallel shape data lists

void BuildPartServer(notnull Man player, string part_name, int action_id)
void DismantlePartServer(notnull Man player, string part_name, int action_id)
void DestroyCollisionTrigger()