ChisellingDeck
A class in Root.Township, Alta.Carpentry.
The carpentry bench: holds a timber block whose size grows as wood is docked into it, spawns the matching block prefab and syncs which block is current. Server drives it; saves the block's carving.
- Listed in Crafting and making
- Inherits or implements
NetworkEntityBehaviour,ISavableFull<ChisellingDeckSaveData>,ISavable<ChisellingDeckSaveData>,ISavableSave<ChisellingDeckSaveData>,ISavableSaveBase,ISavableFull - Derived types
ChisellingDeckSaveData - Nested types
BuilderLevel - Documented in Farming, woodcutting and carpentry
Constructors
| Member | What it is |
|---|---|
ChisellingDeck() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
TimberBlockEvent blockModified | Event raised when the current block is carved. |
TimberBlockEvent changedBlock | Event raised when the current block is replaced or removed. |
9 private and internal fields
| Member | What it is |
|---|---|
private NetworkPrefab[] blockMap | Block prefab for each size, built from levels. |
private TimberBlockSpawner blockPositioner | Backing field for BlockPositioner. |
private ColliderGroup colliderGroup | The deck's colliders, set to ignore the block on it. |
private int currentSize | Backing field for CurrentSize. |
private BuilderDock docker | Builder dock that takes timber in and spawns refuse. |
private ChisellingDeck.BuilderLevel[] levels | Size to block prefab pairs. |
private ChiselBlockSize maxSize | Largest block size the deck can hold. |
private MethodSync updateBlock | Method sync for the block message. |
private int wedgesPerBlock | Backing field for WedgesPerBlock. |
Properties
| Member | What it is |
|---|---|
TimberBlockSpawner BlockPositioner { get; } | Spawner that gives the spot each block size sits at. |
TimberBlock CurrentBlock { get; private set; } | The timber block on the bench, or null when empty. |
int CurrentRequiredSize { get; } | Current size plus one if the dock is currently holding wood, capped at the max. |
int CurrentSize { get; set; } | Block size as a number (0 means empty). Setting it on the server despawns the old block and spawns one of the new size. |
ChiselDefinition Guide { get; private set; } | The chisel guide (recipe) currently set on the bench. Private setter. |
bool HasSpace { get; } | True while the block is below its maximum size. |
bool IsBlockNotModified { get; } | True if there's no block or it hasn't been carved yet. |
int MaxSize { get; } | Largest block size allowed, as a number. |
int WedgesPerBlock { get; } | How many wedges one size step of block is worth, used when shrinking a block into refuse. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Creates the sync for the current block. |
override void InitializeAsServer(SpawnData spawnData) | Server: makes sure the block spawner has room straight away. |
override void OnConnected(Player player) | Sends the current block to a joining player. |
void Resize(ChiselBlockSize toSize) | Server: shrinks the block down to a size, dropping wedges as refuse. A carved block is cleared entirely and refunds part of its wood. |
bool SetupBlockMap() | Editor: fills the size-to-prefab map from the levels list if it's empty. True if it changed. |
7 private and internal methods
| Member | What it is |
|---|---|
private void BlockDone(TimberBlock block) | When the block is finished, empties the deck and repositions the dock. |
private void BlockModified(TimberBlock block) | Passes a block's Modified event on to blockModified. |
private void Alta.Chunks.ISavableFull.LoadSetup() | After loading, lets the current block finish its own setup. |
private void NetworkUpdateBlock(IPlayer player, Stream stream) | Block message: the server sends the current block's ID; clients wait for it to spawn and set it up. |
private void SetCollisionIgnore(List<Collider> colliders, bool isIgnoring) | Makes the deck's colliders ignore (or stop ignoring) the given colliders. |
private void SetupBlock() | Parents the block to the spawn point for its size, hooks its Modified event and ignores collisions with it. |
private void UpdateBlock() | Server: destroys the current block and spawns a new one for currentSize, then tells clients. |
Used in
Members of other types that take, return or hold a ChisellingDeck: