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
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
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
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
ChangeBlockNow(MultiblockActionContext, Type, Boolean)
Declaration
public static Result ChangeBlockNow(MultiblockActionContext context, Type newType, bool notify = true)
Parameters
Returns
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
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
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
Returns
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
Returns
ClearBlockPaint(GameActionPack, MultiblockActionContext)
Declaration
public static void ClearBlockPaint(this GameActionPack pack, MultiblockActionContext context)
Parameters
ClearBlockPaintNow(MultiblockActionContext, Boolean)
Declaration
public static Result ClearBlockPaintNow(MultiblockActionContext context, bool notify = true)
Parameters
Returns
ClearObjectPaint(GameActionPack, MultiblockActionContext, WorldObject, Int32)
Declaration
public static void ClearObjectPaint(this GameActionPack pack, MultiblockActionContext context, WorldObject obj, int channel)
Parameters
ClearObjectPaintNow(MultiblockActionContext, WorldObject, Int32, Boolean)
Declaration
public static Result ClearObjectPaintNow(MultiblockActionContext context, WorldObject obj, int channel, bool notify = true)
Parameters
Returns
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
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
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
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
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
Returns
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
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
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
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
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
HarvestPlantNow(MultiblockActionContext, Inventory, Boolean, Boolean)
Declaration
public static Result HarvestPlantNow(MultiblockActionContext context, Inventory harvestTo, bool reapableOnly = true, bool notify = true)
Parameters
Returns
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
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
Returns
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
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
Returns
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
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
Returns
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
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
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
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
UseToolNow(MultiblockActionContext, Single, Boolean)
Declaration
public static Result UseToolNow(MultiblockActionContext context, float multiplier = 1F, bool notify = true)
Parameters
Returns