Class MultiblockContextHelpers
Inheritance
Namespace: Eco.Gameplay.GameActions
Assembly: Eco.Gameplay.dll
Syntax
public static class MultiblockContextHelpers : Object
Methods
CreateMultiblockContext(ToolItem, Player, Boolean, Vector3i, IEnumerable<Type>, Func<GameAction>)
Builds a MultiblockActionContext based on the player's data.
Declaration
public static MultiblockActionContext CreateMultiblockContext(this ToolItem tool, Player player, bool applyXPSkill, Vector3i position, IEnumerable<Type> blockTypesInArea = null, Func<GameAction> gameActionConstructor = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ToolItem | tool | |
| Player | player | |
| System.Boolean | applyXPSkill | If FALSE, this sets the ExperienceSkill to NULL which results in no AddExperience() post effect being added to the action. |
| Vector3i | position | |
| System.Collections.Generic.IEnumerable<System.Type> | blockTypesInArea | |
| System.Func<GameAction> | gameActionConstructor |
Returns
| Type | Description |
|---|---|
| MultiblockActionContext |
Remarks
Returned MultiblockActionContext doesn't have to contain multiple blocks. It contains all blocks specified in area.
CreateMultiblockContext(ToolItem, Player, Boolean, IEnumerable<Vector3i>, IEnumerable<Type>, Func<GameAction>)
Builds a MultiblockActionContext based on the player's data.
Declaration
public static MultiblockActionContext CreateMultiblockContext(this ToolItem tool, Player player, bool applyXPSkill, IEnumerable<Vector3i> area = null, IEnumerable<Type> blockTypesInArea = null, Func<GameAction> gameActionConstructor = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ToolItem | tool | |
| Player | player | |
| System.Boolean | applyXPSkill | If FALSE, this sets the ExperienceSkill to NULL which results in no AddExperience() post effect being added to the action. |
| System.Collections.Generic.IEnumerable<Vector3i> | area | Positions of blocks to be included in this context. |
| System.Collections.Generic.IEnumerable<System.Type> | blockTypesInArea | |
| System.Func<GameAction> | gameActionConstructor |
Returns
| Type | Description |
|---|---|
| MultiblockActionContext |
Remarks
Returned MultiblockActionContext doesn't have to contain multiple blocks. It contains all blocks specified in area.
TryCreateMultiblockContext(ToolItem, out MultiblockActionContext, InteractionTarget, Player, Boolean, IEnumerable<Type>, Func<GameAction>, IEnumerable<String>, IEnumerable<String>, String[])
Builds a context that's ready to be used by the AtomicActions, including all necessary info for the action to be performed with the appropriate target block(s), and handle XP, durability, and calories consumption.
Declaration
public static bool TryCreateMultiblockContext(this ToolItem tool, out MultiblockActionContext context, InteractionTarget target, Player player, bool applyXPSkill = true, IEnumerable<Type> blockTypesInArea = null, Func<GameAction> gameActionConstructor = null, IEnumerable<string> mustHaveTags = null, IEnumerable<string> mustNotHaveTags = null, params string[] tagsTargetable)
Parameters
| Type | Name | Description |
|---|---|---|
| ToolItem | tool | |
| MultiblockActionContext | context | |
| InteractionTarget | target | |
| Player | player | |
| System.Boolean | applyXPSkill | |
| System.Collections.Generic.IEnumerable<System.Type> | blockTypesInArea | |
| System.Func<GameAction> | gameActionConstructor | |
| System.Collections.Generic.IEnumerable<System.String> | mustHaveTags | |
| System.Collections.Generic.IEnumerable<System.String> | mustNotHaveTags | |
| System.String[] | tagsTargetable |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if at least one block valid for this tool was found and context was successfully created. |
TryCreateMultiblockContext(ToolItem, out MultiblockActionContext, InteractionTarget, Player, IEnumerable<Tag>, Boolean, IEnumerable<Type>, Func<GameAction>, IEnumerable<Tag>, IEnumerable<Tag>)
Builds a context that's ready to be used by the AtomicActions, including all necessary info for the action to be performed with the appropriate target block(s), and handle XP, durability, and calories consumption.
Declaration
public static bool TryCreateMultiblockContext(this ToolItem tool, out MultiblockActionContext context, InteractionTarget target, Player player, IEnumerable<Tag> tagsTargetable, bool applyXPSkill = true, IEnumerable<Type> blockTypesInArea = null, Func<GameAction> gameActionConstructor = null, IEnumerable<Tag> mustHaveTags = null, IEnumerable<Tag> mustNotHaveTags = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ToolItem | tool | |
| MultiblockActionContext | context | |
| InteractionTarget | target | |
| Player | player | |
| System.Collections.Generic.IEnumerable<Tag> | tagsTargetable | Only blocks that have any of these tags can be affected by this interaction. |
| System.Boolean | applyXPSkill | |
| System.Collections.Generic.IEnumerable<System.Type> | blockTypesInArea | |
| System.Func<GameAction> | gameActionConstructor | |
| System.Collections.Generic.IEnumerable<Tag> | mustHaveTags | Only blocks that have all of these tags can be affected by this interaction. |
| System.Collections.Generic.IEnumerable<Tag> | mustNotHaveTags | Only blocks that don't have any of these tags can be affected by this interaction. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if at least one block valid for this tool was found and context was successfully created. |