Show / Hide Table of Contents

Class WorldObjectItem

An item that has a singular corresponding world object it drops when placed.

Inheritance
System.Object
ItemLinkable
ItemRepresentation
Item
DurabilityItem
WorldObjectItem
ModuleItem
RampItem
WorldObjectItem<T>
ClaimStakeItemBase
Implements
IItem
ILinkableParameterized<LinkConfig>
ILinkable
IHasIcon
System.ComponentModel.INotifyPropertyChanged
IPlaceableItem
IController
IViewController
IHasUniversalID
Inherited Members
DurabilityItem.GetQualityGroup()
DurabilityItem.CanStack(Item)
DurabilityItem.RepresentsItem(Item)
DurabilityItem.RepresentativeHash()
DurabilityItem.Clone()
DurabilityItem.Merge(Item, Int32, Int32, Boolean)
DurabilityItem.OriginalMaxDurability
DurabilityItem.Decays
DurabilityItem.DurabilityPercent
DurabilityItem.PercentBrokenFromOriginal
DurabilityItem.DisplayDurability
DurabilityItem.Broken
DurabilityItem.StackingHash
DurabilityItem.BrokenDescription
DurabilityItem.DefaultMinRequiredDurabilityInTradeOffers
DurabilityItem.PropertyChanged
Item.ItemsInitialized
Item.RepresentsItemType(Type)
Item.OnLinkClicked(TooltipOrigin, TooltipClickContext, User)
Item.ClearMaxStackSizeCache()
Item.GetMaxStackSize(Type)
Item.Destroy(Int32)
Item.ToString()
Item.UnsubscribeUnique()
Item.OnUsed(Player, ItemStack)
Item.OnLeftClicked(Player, ItemStack)
Item.OnSelected(Player)
Item.OnDeselected(Player)
Item.Get(IRepresentsItem)
Item.Get(Int32)
Item.Get<T>()
Item.Get(Type)
Item.Get(String)
Item.ShowName(Type, Single)
Item.ShowName(Type, Int32)
Item.ShowName<T>(Int32)
Item.NameAndNum(Type, Int32)
Item.GetSkillbookForSkillType(Type)
Item.CreatingItem(Type)
Item.GetCreatedObj(Type)
Item.TypeIsUnique(Type)
Item.GetNonUniqueOrClone(Int32)
Item.GetNonUniqueOrClone(Type)
Item.NameAndNum(Type, Single)
Item.GetItemByString(User, String)
Item.GetID(Item)
Item.GetID(Type)
Item.HasID(Type)
Item.GetID<T>()
Item.GetType(Int32)
Item.GetType(String)
Item.Create<T>(Int32)
Item.Create(Type, Int32)
Item.Create<T>()
Item.Create(Type)
Item.IconName
Item.IconComment
Item.TypeID
Item.Type
Item.DisplayName
Item.Name
Item.IsUnique
Item.Fuel
Item.IsFuel
Item.WeightWithoutModifiers
Item.Weight
Item.HasWeight
Item.IsCarried
Item.IgnoreAuth
Item.Yield
Item.HasYield
Item.HasCrop
Item.CanBeCurrency
Item.MakesRoads
Item.Compostable
Item.ResourcePile
Item.CanAirInteraction
Item.Category
Item.Hidden
Item.Group
Item.MaxStackSize
Item.IsWasteProduct
Item.GetDescription
Item.HandOrigin
Item.CanBeHeld
Item.IsTool
Item.CustomHighlight
Item.AllItemsIncludingHidden
Item.AllItemsExceptHidden
Item.RandomItem
ItemRepresentation.RepresentsItemType(Item)
ItemLinkable.ShowName(Single)
ItemLinkable.ShowName(Int32)
ItemLinkable.UILinkAndNumber(Single)
ItemLinkable.UILinkAndNumber(Int32)
ItemLinkable.UILinkAndNumber(Int32, String)
ItemLinkable.UILinkAndNumberAndTier(Int32, Int32)
ItemLinkable.UILinkAndNumberAndTierPrepend(Int32, Int32, String)
ItemLinkable.UILinkAndNumberNoText(Int32)
ItemLinkable.UILinkContent()
ItemLinkable.UILinkContent(Boolean)
ItemLinkable.NameAndNum(Int32)
ItemLinkable.UILinkAndStyledNumber(Int32)
ItemLinkable.UILinkContent(LocString)
ItemLinkable.UILinkNoNumber(Int32)
ItemLinkable.UILinkContent(LinkConfig)
ItemLinkable.ItemIconUILink(LocString)
ItemLinkable.DisplayNamePlural
ItemLinkable.MarkedUpName
ItemLinkable.ControllerID
Namespace: Eco.Gameplay.Items
Assembly: Eco.Gameplay.dll
Syntax
[WorldSpaceItem]
[ItemGroup("World Object")]
public abstract class WorldObjectItem : DurabilityItem, IItem, ILinkableParameterized<LinkConfig>, ILinkable, IHasIcon, INotifyPropertyChanged, IPlaceableItem, IController, IViewController, IHasUniversalID

Constructors

WorldObjectItem()

Declaration
protected WorldObjectItem()

Fields

AllowWaterPlacement

Declaration
public static readonly Type[] AllowWaterPlacement
Field Value
Type Description
System.Type[]

Properties

Blockers

Declaration
public virtual Type[] Blockers { get; }
Property Value
Type Description
System.Type[]

Durability

Declaration
public float Durability { get; set; }
Property Value
Type Description
System.Single

GetOccupancyContext

Default occupancy config set to SideAttached

Declaration
protected virtual OccupancyContext GetOccupancyContext { get; }
Property Value
Type Description
OccupancyContext

HomeValue

Declaration
public virtual HomeFurnishingValue HomeValue { get; }
Property Value
Type Description
HomeFurnishingValue

IsStackable

Declaration
public override bool IsStackable { get; }
Property Value
Type Description
System.Boolean
Overrides
DurabilityItem.IsStackable

OccupancyContext

Declaration
public OccupancyContext OccupancyContext { get; }
Property Value
Type Description
OccupancyContext

ShouldCreate

If true, the system will automatically create the world object item when placed. If false, then the item must manually do it in 'PlacingObject'

Declaration
public virtual bool ShouldCreate { get; }
Property Value
Type Description
System.Boolean

ShowLocationsInWorld

If true, the tooltip of the item won't show the "ExistingObjects" section

Declaration
public virtual bool ShowLocationsInWorld { get; }
Property Value
Type Description
System.Boolean

WorldObjectType

Declaration
public abstract Type WorldObjectType { get; }
Property Value
Type Description
System.Type

Methods

CanMove(Player, Vector3i, Quaternion, INetObject)

This will check whether this item can be moved by the specified player to the specified position or not.

Declaration
protected virtual Task<bool> CanMove(Player player, Vector3i pos, Quaternion rotation, INetObject woNetObject)
Parameters
Type Name Description
Player player
Vector3i pos
Quaternion rotation
INetObject woNetObject
Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

CanPlaceObject(Player, Vector3, Quaternion)

Override this function if you want to have async processing for Place Object action (like asking a citizen for confirmation).

Declaration
public virtual Task<bool> CanPlaceObject(Player player, Vector3 pos, Quaternion rotation)
Parameters
Type Name Description
Player player
System.Numerics.Vector3 pos
Quaternion rotation
Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

GetAllObjectsTooltip(Player)

Generates tooltip displaying list of all world objects created from this item type in the world

Declaration
public TooltipSection GetAllObjectsTooltip(Player player)
Parameters
Type Name Description
Player player
Returns
Type Description
TooltipSection

GetBlockTypesForDirection(Vector3i)

Declaration
public virtual Type[] GetBlockTypesForDirection(Vector3i direction)
Parameters
Type Name Description
Vector3i direction
Returns
Type Description
System.Type[]

GetCreatingItemTemplateFromType(Type)

Declaration
public static WorldObjectItem GetCreatingItemTemplateFromType(Type type)
Parameters
Type Name Description
System.Type type
Returns
Type Description
WorldObjectItem

GetDurability()

Declaration
public override float GetDurability()
Returns
Type Description
System.Single
Overrides
DurabilityItem.GetDurability()

GetMoveInfo(Player, INetObject)

Retrieves the initial info required for a WorldObject's movement, like deed/settlement restrictions and messages, calories required, etc.

Declaration
public MoveWorldObjectActionInfo GetMoveInfo(Player player, INetObject woNetObject)
Parameters
Type Name Description
Player player
INetObject woNetObject
Returns
Type Description
MoveWorldObjectActionInfo
Remarks

Contains enough info for the client to do the necessary validations and display things properly.

Initialize()

Declaration
public static void Initialize()

MakeItemFromWorldObjectType(Type)

Declaration
public static WorldObjectItem MakeItemFromWorldObjectType(Type type)
Parameters
Type Name Description
System.Type type
Returns
Type Description
WorldObjectItem

Move(Player, Vector3i, Quaternion, INetObject)

Attempts to move the WorldObject that this item represents, from its existing point to specified position and rotation.

Declaration
public Task<bool> Move(Player player, Vector3i pos, Quaternion rotation, INetObject woNetObject)
Parameters
Type Name Description
Player player
Vector3i pos
Quaternion rotation
INetObject woNetObject
Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

OnPickup(WorldObject)

Declaration
public virtual void OnPickup(WorldObject placedObject)
Parameters
Type Name Description
WorldObject placedObject

OnPostWorldObjectPlaced(WorldObject)

This called after the world object is placed, added to the world object manager and all its components initialized.

Declaration
public virtual void OnPostWorldObjectPlaced(WorldObject addedObject)
Parameters
Type Name Description
WorldObject addedObject

OnPreWorldObjectPlaced(WorldObject)

This is called immediately before placement, before initialization and net object activation.

Declaration
public virtual void OnPreWorldObjectPlaced(WorldObject placedObject)
Parameters
Type Name Description
WorldObject placedObject

Place(Player, Vector3, Quaternion, Int32)

RPC that attempts to place the WorldObject that is represented by this item.

Declaration
public void Place(Player player, Vector3 pos, Quaternion rotation, int placeOnSurfaceOfObjectID)
Parameters
Type Name Description
Player player
System.Numerics.Vector3 pos
Quaternion rotation
System.Int32 placeOnSurfaceOfObjectID
Remarks

Will still do server-side checks to see if it can indeed be placed, and can fail if it can't.

PlacingObject(GameActionPack, Player, ItemStack, Vector3, Quaternion)

Do anything special that needs to be done when this thing is placed, by putting it into a game action pack. The future placed object can be retreived by the passed func, inside posteffects (its assigned in a previous post effect, already setup to run when this is called)

Declaration
public virtual Task PlacingObject(GameActionPack pack, Player player, ItemStack containingStack, Vector3 pos, Quaternion rotation)
Parameters
Type Name Description
GameActionPack pack
Player player
ItemStack containingStack
System.Numerics.Vector3 pos
Quaternion rotation
Returns
Type Description
System.Threading.Tasks.Task

SetDurability(Single)

Declaration
public override void SetDurability(float dur)
Parameters
Type Name Description
System.Single dur
Overrides
DurabilityItem.SetDurability(Single)

Implements

IItem
ILinkableParameterized<T>
ILinkable
IHasIcon
System.ComponentModel.INotifyPropertyChanged
IPlaceableItem
IController
IViewController
IHasUniversalID

Extension Methods

ItemStackExtensions.NameAndNum(ItemRepresentation, Int32)
ItemUtils.CanItemExistInInventories(Item)
ItemUtils.CloneIfNeeded(Item)
TagUtils.Tags(Item)
TagUtils.TagNames(Object, Boolean)
TagUtils.TagDisplayNames(Object, Boolean)
WorldObjectUtil.RequiresComponent<T>(WorldObjectItem)
ClientSetViewExtensions.SetClassOfProperty(Object, Player, String, String, Int32)
MarketplaceExtensions.IsPaidItem(Item)
TypeTooltipExtensions.UILinkGeneric(Object)
EconomyTooltipLibrary.BuyItTooltip(Item, User, TooltipOrigin)
EconomyTooltipLibrary.SellItTooltip(Item, User, TooltipOrigin)
ILinkableTooltipLibrary.ItemLinkClicked(Item, TooltipOrigin)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾