Table of Contents

Struct IObjectsComponent

Namespace
SampSharp.OpenMp.Core.Api
Assembly
SampSharp.OpenMp.Core.dll

This type represents a pointer to an unmanaged open.mp IObjectsComponent interface.

[OpenMpApi(new Type[] { typeof(IPoolComponent<IObject>) })]
public readonly struct IObjectsComponent : IEquatable<IObjectsComponent>, IObjectsComponent.IManagedInterface, IPoolComponent<IObject>.IManagedInterface, IComponent.IManagedInterface, IUnmanagedInterface
Implements
Inherited Members

Constructors

IObjectsComponent(nint)

Initializes a new instance of the IObjectsComponent struct.

public IObjectsComponent(nint handle)

Parameters

handle nint

A pointer to the unmanaged interface.

Properties

Handle

Gets the handle to the unmanaged interface instance.

public nint Handle { get; }

Property Value

nint

HasValue

Gets a value indicating whether the pointer has a value.

public bool HasValue { get; }

Property Value

bool

Methods

AsPool()

Converts this component to a pool.

public IPool<IObject> AsPool()

Returns

IPool<IObject>

A pool.

ComponentName()

Gets the name of the component.

public string ComponentName()

Returns

string

The component name.

ComponentVersion()

Gets the version of the component.

public SemanticVersion ComponentVersion()

Returns

SemanticVersion

The component version.

Create(int, Vector3, Vector3, float)

Creates a new object with the specified model ID, position, and rotation.

public IObject Create(int modelID, Vector3 position, Vector3 rotation, float drawDist = 0)

Parameters

modelID int

The model ID of the object.

position Vector3

The position of the object.

rotation Vector3

The rotation of the object.

drawDist float

The draw distance of the object. Defaults to 0.

Returns

IObject

A new instance of IObject.

Equals(IObjectsComponent)

public bool Equals(IObjectsComponent other)

Parameters

other IObjectsComponent

Returns

bool

Equals(object?)

public override bool Equals(object? other)

Parameters

other object

Returns

bool

GetComponentType()

Gets the type of the component.

public ComponentType GetComponentType()

Returns

ComponentType

The component type.

GetDefaultCameraCollision()

Gets the default camera collision state.

public bool GetDefaultCameraCollision()

Returns

bool

true if camera collision is enabled by default; otherwise, false.

GetEventDispatcher()

Gets the event dispatcher for handling object events.

public IEventDispatcher<IObjectEventHandler> GetEventDispatcher()

Returns

IEventDispatcher<IObjectEventHandler>

An event dispatcher for IObjectEventHandler.

GetHashCode()

public override int GetHashCode()

Returns

int

SetDefaultCameraCollision(bool)

Sets the default camera collision state.

public void SetDefaultCameraCollision(bool collision)

Parameters

collision bool

A value indicating whether camera collision is enabled by default.

SupportedVersion()

Gets the supported version of the component.

public int SupportedVersion()

Returns

int

The supported version of the component.

Remarks

The idea is for the SDK to be totally forward compatible, so code built at any time will always work, thanks to ABI compatibility. This method is an emergency trap door, just in case that's ever not the problem. Check which major version this component was built for, if it isn't the current major version, fail to load it. Always just returns a constant, recompiling will often be enough to upgrade. virtual and final to be the vtable, but it can't be overridden because it is a constant.

Operators

operator ==(IObjectsComponent, object?)

Determines whether the specified values are equal.

public static bool operator ==(IObjectsComponent lhs, object? rhs)

Parameters

lhs IObjectsComponent

The value on the left side of the operator.

rhs object

The value on the right side of the operator.

Returns

bool

true if the values are equal; otherwise, false.

explicit operator IObjectsComponent(IComponent)

Casts the IComponent to a IObjectsComponent.

public static explicit operator IObjectsComponent(IComponent value)

Parameters

value IComponent

The IComponent to cast.

Returns

IObjectsComponent

The converted IObjectsComponent.

explicit operator IComponent(IObjectsComponent)

Casts the IObjectsComponent to a IComponent.

public static explicit operator IComponent(IObjectsComponent value)

Parameters

value IObjectsComponent

The IObjectsComponent to cast.

Returns

IComponent

The converted IComponent.

explicit operator IPoolComponent<IObject>(IObjectsComponent)

public static explicit operator IPoolComponent<IObject>(IObjectsComponent value)

Parameters

value IObjectsComponent

The IObjectsComponent to cast.

Returns

IPoolComponent<IObject>

The converted IPoolComponent<T>.

explicit operator IObjectsComponent(IPoolComponent<IObject>)

public static explicit operator IObjectsComponent(IPoolComponent<IObject> value)

Parameters

value IPoolComponent<IObject>

The IPoolComponent<T> to cast.

Returns

IObjectsComponent

The converted IObjectsComponent.

operator !=(IObjectsComponent, object?)

Determines whether the specified values are not equal.

public static bool operator !=(IObjectsComponent lhs, object? rhs)

Parameters

lhs IObjectsComponent

The value on the left side of the operator.

rhs object

The value on the right side of the operator.

Returns

bool

true if the values are not equal; otherwise, false.

Explicit Interface Implementations

ComponentId

Gets the identifier of the component type.

static UID ComponentId { get; }

Returns

UID

FromComponentHandle(nint)

Casts a handle from a IComponent handle to a handle of this type.

static nint FromComponentHandle(nint handle)

Parameters

handle nint

The IComponent handle.

Returns

nint

The handle of this type.