Show / Hide Table of Contents

Class AtomicActions

Atomic actions are anything that has must be performed in a single transaction. Performing an atomic action builds up the ActionPack, which consists of a set of things to test at first, game actions to run through laws and contracts, and then post-effects that are run if everything in the action pack succeeds, and finally things that are disposed when the pack is finished. All atomic actions should check the early-out failure on the pack before doing anything (not necessary for actions that utilize Eco.Gameplay.GameActions.AtomicActions.PerformMultiblockToolAction(Eco.Gameplay.GameActions.GameActionPack,Eco.Gameplay.GameActions.MultiblockActionContext,System.Func{Eco.Shared.Math.WrappedWorldPosition3i,System.Type,Eco.Core.Utils.Result}) since the check will be performed there).

Inheritance
System.Object
AtomicActions
Namespace: Eco.Gameplay.GameActions
Assembly: Eco.Gameplay.dll
Syntax
public static class AtomicActions : Object

Methods

AddToInventory(GameActionPack, Inventory, Item, Int32, User)

Declaration
public static void AddToInventory(this GameActionPack pack, Inventory inventory, Item item, int amount = 1, User user = null)
Parameters
Type Name Description
GameActionPack pack
Inventory inventory
Item item
System.Int32 amount
User user

BurnCaloriesAndCheckExhaustion(GameActionPack, User, Boolean, Single, Boolean)

Burn calories or fail if not enough available.

Declaration
public static void BurnCaloriesAndCheckExhaustion(this GameActionPack pack, User user, bool canPerformWhenExhausted, float needed, bool allowDepletingLastCalories = true)
Parameters
Type Name Description
GameActionPack pack
User user
System.Boolean canPerformWhenExhausted
System.Single needed
System.Boolean allowDepletingLastCalories

BurnFuel(GameActionPack, FuelSupplyComponent, Single)

Burn fuel or fail if not enough available.

Declaration
public static void BurnFuel(this GameActionPack pack, FuelSupplyComponent fuelComponent, float needed)
Parameters
Type Name Description
GameActionPack pack
FuelSupplyComponent fuelComponent
System.Single needed

ChangeBlock(GameActionPack, MultiblockActionContext, Type)

Uses tool to change type of blocks in the area.

Declaration
public static void ChangeBlock(this GameActionPack pack, MultiblockActionContext context, Type newType)
Parameters
Type Name Description
GameActionPack pack
MultiblockActionContext context
System.Type newType

ChangeBlockNow(MultiblockActionContext, Type, Boolean)

Declaration
public static Result ChangeBlockNow(MultiblockActionContext context, Type newType, bool notify = true)
Parameters
Type Name Description
MultiblockActionContext context
System.Type newType
System.Boolean notify
Returns
Type Description
Result

ClaimOrUnclaimProperties(GameActionPack, Deed, User, IEnumerable<PlotPos>, IEnumerable<PlotPos>, Boolean, Boolean, Boolean, Boolean, IAlias, Nullable<LocString>, Nullable<PropertyType>, Type)

Claim/unclaim combo operation for lists for plot positions in PLOT-SPACE to claim/unclaim. If initialOwner is null, will default to claimer. If actor is null, then delete the things removed.

Declaration
public static GameActionPack ClaimOrUnclaimProperties(this GameActionPack pack, Deed deed, User claimingUser, IEnumerable<PlotPos> attemptClaimList, IEnumerable<PlotPos> attemptUnclaim, bool isAdminCommand, bool notify, bool usePlotCount, bool newSettlement, IAlias initialOwner, Nullable<LocString> deedName, Nullable<PropertyType> propertyType, Type itemUsedToClaim)
Parameters
Type Name Description
GameActionPack pack
Deed deed
User claimingUser
System.Collections.Generic.IEnumerable<PlotPos> attemptClaimList
System.Collections.Generic.IEnumerable<PlotPos> attemptUnclaim
System.Boolean isAdminCommand
System.Boolean notify
System.Boolean usePlotCount
System.Boolean newSettlement
IAlias initialOwner
System.Nullable<LocString> deedName
System.Nullable<PropertyType> propertyType
System.Type itemUsedToClaim
Returns
Type Description
GameActionPack

ClaimOrUnclaimPropertiesNow(Deed, User, IEnumerable<PlotPos>, IEnumerable<PlotPos>, Boolean, Boolean, Boolean, Boolean, IAlias, Nullable<LocString>, PropertyType, Type)

Declaration
public static Result ClaimOrUnclaimPropertiesNow(Deed deed, User actor, IEnumerable<PlotPos> plotPosToClaim, IEnumerable<PlotPos> plotPosToUnclaim, bool isAdminCommand = false, bool notify = false, bool usePlotCount = false, bool newSettlement = false, IAlias initialOwner = null, Nullable<LocString> deedName = null, PropertyType propertyType, Type itemUsedToClaim = null)
Parameters
Type Name Description
Deed deed
User actor
System.Collections.Generic.IEnumerable<PlotPos> plotPosToClaim
System.Collections.Generic.IEnumerable<PlotPos> plotPosToUnclaim
System.Boolean isAdminCommand
System.Boolean notify
System.Boolean usePlotCount
System.Boolean newSettlement
IAlias initialOwner
System.Nullable<LocString> deedName
PropertyType propertyType
System.Type itemUsedToClaim
Returns
Type Description
Result

ClaimProperty(GameActionPack, Deed, User, PlotPos, ClaimedOrUnclaimed, Boolean, Boolean, Boolean, Boolean, IAlias, Nullable<LocString>, PropertyType, Type)

Declaration
public static GameActionPack ClaimProperty(this GameActionPack pack, Deed deed, User actor, PlotPos plotPos, ClaimedOrUnclaimed actionType, bool isAdminCommand = false, bool notify = false, bool usePlotCount = false, bool newSettlement = false, IAlias initialOwner = null, Nullable<LocString> deedName = null, PropertyType propertyType, Type itemUsedToClaim = null)
Parameters
Type Name Description
GameActionPack pack
Deed deed
User actor
PlotPos plotPos
ClaimedOrUnclaimed actionType
System.Boolean isAdminCommand
System.Boolean notify
System.Boolean usePlotCount
System.Boolean newSettlement
IAlias initialOwner
System.Nullable<LocString> deedName
PropertyType propertyType
System.Type itemUsedToClaim
Returns
Type Description
GameActionPack

ClaimPropertyNow(Deed, User, PlotPos, ClaimedOrUnclaimed, Boolean, Boolean, Boolean, Boolean, IAlias, Nullable<LocString>, PropertyType)

Declaration
public static Result ClaimPropertyNow(Deed deed, User actor, PlotPos plotPos, ClaimedOrUnclaimed actionType, bool isAdminCommand = false, bool notify = false, bool usePlotCount = false, bool newSettlement = false, IAlias initialOwner = null, Nullable<LocString> deedName = null, PropertyType propertyType)
Parameters
Type Name Description
Deed deed
User actor
PlotPos plotPos
ClaimedOrUnclaimed actionType
System.Boolean isAdminCommand
System.Boolean notify
System.Boolean usePlotCount
System.Boolean newSettlement
IAlias initialOwner
System.Nullable<LocString> deedName
PropertyType propertyType
Returns
Type Description
Result

ClearBlockPaint(GameActionPack, MultiblockActionContext)

Declaration
public static void ClearBlockPaint(this GameActionPack pack, MultiblockActionContext context)
Parameters
Type Name Description
GameActionPack pack
MultiblockActionContext context

ClearBlockPaintNow(MultiblockActionContext, Boolean)

Declaration
public static Result ClearBlockPaintNow(MultiblockActionContext context, bool notify = true)
Parameters
Type Name Description
MultiblockActionContext context
System.Boolean notify
Returns
Type Description
Result

ClearObjectPaint(GameActionPack, MultiblockActionContext, WorldObject, Int32)

Declaration
public static void ClearObjectPaint(this GameActionPack pack, MultiblockActionContext context, WorldObject obj, int channel)
Parameters
Type Name Description
GameActionPack pack
MultiblockActionContext context
WorldObject obj
System.Int32 channel

ClearObjectPaintNow(MultiblockActionContext, WorldObject, Int32, Boolean)

Declaration
public static Result ClearObjectPaintNow(MultiblockActionContext context, WorldObject obj, int channel, bool notify = true)
Parameters
Type Name Description
MultiblockActionContext context
WorldObject obj
System.Int32 channel
System.Boolean notify
Returns
Type Description
Result

DeleteBlock(GameActionPack, MultiblockActionContext, Inventory, Item, Boolean, Boolean, Boolean)

Add the deletion of blocks to the passed action pack and use tool, if able.

Declaration
public static void DeleteBlock(this GameActionPack pack, MultiblockActionContext context, Inventory addToInventory = null, Item fallbackGiveItem = null, bool spawnRubble = true, bool deleteWholeStack = false, bool harvestPlantsAbove = false)
Parameters
Type Name Description
GameActionPack pack
MultiblockActionContext context
Inventory addToInventory
Item fallbackGiveItem
System.Boolean spawnRubble
System.Boolean deleteWholeStack
System.Boolean harvestPlantsAbove

DeleteBlock(GameActionPack, MultiblockActionContext, Func<WrappedWorldPosition3i, Boolean>, Inventory, Item, Boolean, Boolean)

Add the deletion of blocks to the passed action pack and use tool, if able.

Declaration
public static void DeleteBlock(this GameActionPack pack, MultiblockActionContext context, Func<WrappedWorldPosition3i, bool> harvestPlantsAbove, Inventory addToInventory = null, Item fallbackGiveItem = null, bool spawnRubble = true, bool deleteWholeStack = false)
Parameters
Type Name Description
GameActionPack pack
MultiblockActionContext context
System.Func<WrappedWorldPosition3i, System.Boolean> harvestPlantsAbove
Inventory addToInventory
Item fallbackGiveItem
System.Boolean spawnRubble
System.Boolean deleteWholeStack

DeleteBlockNow(MultiblockActionContext, Inventory, Item, Boolean, Boolean, Boolean, Boolean)

Declaration
public static Result DeleteBlockNow(MultiblockActionContext context, Inventory addTo = null, Item fallbackItem = null, bool spawnRubble = true, bool wholeStack = false, bool harvestPlantsAbove = false, bool notify = true)
Parameters
Type Name Description
MultiblockActionContext context
Inventory addTo
Item fallbackItem
System.Boolean spawnRubble
System.Boolean wholeStack
System.Boolean harvestPlantsAbove
System.Boolean notify
Returns
Type Description
Result

DestroyPlant(GameActionPack, MultiblockActionContext, DeathType, Inventory, Func<PlantSpecies, Boolean>)

Destroy plants in the area. Will use the tool (i.e. reduce durability, try give XP and burn calories).

Declaration
public static void DestroyPlant(this GameActionPack pack, MultiblockActionContext context, DeathType deathType, Inventory harvestTo = null, Func<PlantSpecies, bool> plantSpeciesChecked = null)
Parameters
Type Name Description
GameActionPack pack
MultiblockActionContext context
DeathType deathType
Inventory harvestTo
System.Func<PlantSpecies, System.Boolean> plantSpeciesChecked

DestroyPlantNow(MultiblockActionContext, DeathType, Inventory, Boolean, Func<PlantSpecies, Boolean>)

Declaration
public static Result DestroyPlantNow(MultiblockActionContext context, DeathType deathType, Inventory harvestTo = null, bool notify = true, Func<PlantSpecies, bool> plantSpeciesChecked = null)
Parameters
Type Name Description
MultiblockActionContext context
DeathType deathType
Inventory harvestTo
System.Boolean notify
System.Func<PlantSpecies, System.Boolean> plantSpeciesChecked
Returns
Type Description
Result

DoNow(Action<GameActionPack>, Boolean)

Helper for calling the 'Now' functions immediately.

Declaration
public static Result DoNow(Action<GameActionPack> func, bool notify = true)
Parameters
Type Name Description
System.Action<GameActionPack> func
System.Boolean notify
Returns
Type Description
Result

DropRubble(GameActionPack, Player, BlockItem, Inventory, Vector3, Single)

Tries to remove block item from the inventory to spawn it as a loose rubble. Burns player's calories if needed.

Declaration
public static void DropRubble(this GameActionPack pack, Player player, BlockItem blockItem, Inventory inventory, Vector3 position, float caloriesNeeded)
Parameters
Type Name Description
GameActionPack pack
Player player
BlockItem blockItem
Inventory inventory
System.Numerics.Vector3 position
System.Single caloriesNeeded

DropRubbleNow(Player, BlockItem, Inventory, Vector3, Single, Boolean)

Declaration
public static Result DropRubbleNow(Player player, BlockItem blockItem, Inventory inventory, Vector3 position, float calories, bool notify = true)
Parameters
Type Name Description
Player player
BlockItem blockItem
Inventory inventory
System.Numerics.Vector3 position
System.Single calories
System.Boolean notify
Returns
Type Description
Result

ExplodePositions(GameActionPack, Player, IEnumerable<Vector3i>, WorldObject, Action<IEnumerable<Vector3i>>, Single)

Efficiently explodes area.

Declaration
public static bool ExplodePositions(this GameActionPack pack, Player player, IEnumerable<Vector3i> positions, WorldObject obj, Action<IEnumerable<Vector3i>> validPositionsAction, float pollutionTons)
Parameters
Type Name Description
GameActionPack pack
Player player
System.Collections.Generic.IEnumerable<Vector3i> positions
WorldObject obj
System.Action<System.Collections.Generic.IEnumerable<Vector3i>> validPositionsAction
System.Single pollutionTons
Returns
Type Description
System.Boolean

ExplodePositionsNow(Player, IEnumerable<Vector3i>, WorldObject, Action<IEnumerable<Vector3i>>, Single, Boolean)

Declaration
public static Result ExplodePositionsNow(Player player, IEnumerable<Vector3i> positions, WorldObject obj, Action<IEnumerable<Vector3i>> validPositionsAction, float pollutionTons = 0F, bool notify = true)
Parameters
Type Name Description
Player player
System.Collections.Generic.IEnumerable<Vector3i> positions
WorldObject obj
System.Action<System.Collections.Generic.IEnumerable<Vector3i>> validPositionsAction
System.Single pollutionTons
System.Boolean notify
Returns
Type Description
Result

HarvestPlant(GameActionPack, MultiblockActionContext, Inventory, Boolean)

Harvest a PlantEntity into provided inventory.

Declaration
public static void HarvestPlant(this GameActionPack pack, MultiblockActionContext context, Inventory harvestTo, bool reapableOnly = true)
Parameters
Type Name Description
GameActionPack pack
MultiblockActionContext context
Inventory harvestTo
System.Boolean reapableOnly

HarvestPlantNow(MultiblockActionContext, Inventory, Boolean, Boolean)

Declaration
public static Result HarvestPlantNow(MultiblockActionContext context, Inventory harvestTo, bool reapableOnly = true, bool notify = true)
Parameters
Type Name Description
MultiblockActionContext context
Inventory harvestTo
System.Boolean reapableOnly
System.Boolean notify
Returns
Type Description
Result

PaintBlock(GameActionPack, MultiblockActionContext, ByteColor, Byte, List<ItemStack>)

Declaration
public static void PaintBlock(this GameActionPack pack, MultiblockActionContext context, ByteColor byteColor, byte coat, List<ItemStack> bucketStacks)
Parameters
Type Name Description
GameActionPack pack
MultiblockActionContext context
ByteColor byteColor
System.Byte coat
System.Collections.Generic.List<ItemStack> bucketStacks

PaintBlockNow(MultiblockActionContext, ByteColor, Byte, List<ItemStack>, Boolean)

Declaration
public static Result PaintBlockNow(MultiblockActionContext context, ByteColor color, byte coat, List<ItemStack> buckets, bool notify = true)
Parameters
Type Name Description
MultiblockActionContext context
ByteColor color
System.Byte coat
System.Collections.Generic.List<ItemStack> buckets
System.Boolean notify
Returns
Type Description
Result

PaintObject(GameActionPack, MultiblockActionContext, WorldObject, ByteColor, Byte, Int32, List<ItemStack>)

Declaration
public static void PaintObject(this GameActionPack pack, MultiblockActionContext context, WorldObject obj, ByteColor color, byte coat, int channel, List<ItemStack> bucketStacks)
Parameters
Type Name Description
GameActionPack pack
MultiblockActionContext context
WorldObject obj
ByteColor color
System.Byte coat
System.Int32 channel
System.Collections.Generic.List<ItemStack> bucketStacks

PaintObjectNow(MultiblockActionContext, WorldObject, ByteColor, Byte, Int32, List<ItemStack>, Boolean)

Declaration
public static Result PaintObjectNow(MultiblockActionContext context, WorldObject obj, ByteColor color, byte coat, int channel, List<ItemStack> buckets, bool notify = true)
Parameters
Type Name Description
MultiblockActionContext context
WorldObject obj
ByteColor color
System.Byte coat
System.Int32 channel
System.Collections.Generic.List<ItemStack> buckets
System.Boolean notify
Returns
Type Description
Result

PickupRubbles(GameActionPack, Player, Inventory, IEnumerable<RubbleObject>, Type, INetObject, Boolean)

Declaration
public static bool PickupRubbles(this GameActionPack pack, Player player, Inventory inventory, IEnumerable<RubbleObject> rubbles, Type itemType, INetObject tool = null, bool notificate = true)
Parameters
Type Name Description
GameActionPack pack
Player player
Inventory inventory
System.Collections.Generic.IEnumerable<RubbleObject> rubbles
System.Type itemType
INetObject tool
System.Boolean notificate
Returns
Type Description
System.Boolean

PickupRubblesNow(Player, Inventory, IEnumerable<RubbleObject>, Type, INetObject, Boolean)

Declaration
public static Result PickupRubblesNow(Player player, Inventory inventory, IEnumerable<RubbleObject> rubble, Type itemType, INetObject tool = null, bool notify = true)
Parameters
Type Name Description
Player player
Inventory inventory
System.Collections.Generic.IEnumerable<RubbleObject> rubble
System.Type itemType
INetObject tool
System.Boolean notify
Returns
Type Description
Result

PlaceBlock(GameActionPack, MultiblockActionContext, Type, Type, Boolean, Inventory, Type)

Uses tool to place blocks of provided type on the target area.

Declaration
public static void PlaceBlock(this GameActionPack pack, MultiblockActionContext context, Type blockType, Type targetBlockType = null, bool createBlockAction = false, Inventory removeFromInv = null, Type itemToRemove = null)
Parameters
Type Name Description
GameActionPack pack
MultiblockActionContext context
System.Type blockType
System.Type targetBlockType
System.Boolean createBlockAction
Inventory removeFromInv
System.Type itemToRemove

PlaceBlockNow(MultiblockActionContext, Type, Type, Boolean, Inventory, Type, Boolean)

Declaration
public static Result PlaceBlockNow(MultiblockActionContext context, Type blockType, Type targetBlockType = null, bool createBlockAction = false, Inventory removeFrom = null, Type removeItem = null, bool notify = true)
Parameters
Type Name Description
MultiblockActionContext context
System.Type blockType
System.Type targetBlockType
System.Boolean createBlockAction
Inventory removeFrom
System.Type removeItem
System.Boolean notify
Returns
Type Description
Result

RemoveFromInventory(GameActionPack, User, Inventory, Type)

See if we can remove an item, and queue it for post if so.

Declaration
public static void RemoveFromInventory(this GameActionPack pack, User user, Inventory inventory, Type itemType)
Parameters
Type Name Description
GameActionPack pack
User user
Inventory inventory
System.Type itemType

UseTool(GameActionPack, MultiblockActionContext, Single)

Consume energy, use durability and gain XP if related params are provided.

Declaration
public static void UseTool(this GameActionPack pack, MultiblockActionContext context, float multiplier = 1F)
Parameters
Type Name Description
GameActionPack pack
MultiblockActionContext context
System.Single multiplier

UseToolNow(MultiblockActionContext, Single, Boolean)

Declaration
public static Result UseToolNow(MultiblockActionContext context, float multiplier = 1F, bool notify = true)
Parameters
Type Name Description
MultiblockActionContext context
System.Single multiplier
System.Boolean notify
Returns
Type Description
Result
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾