Ir para o conteúdo principal
Version: bleeding-edge 🩸

Base Pickable

Pickables are special Actors which can be grabbed, held and used by Characters.

info

This is a base class. You cannot spawn it directly.

Examples of Pickable Actors are: Weapon, Melee and Grenade.

They have special methods and events and are highlighted when looked at by a Character.

🦠 Functions

ReturnsNameDescription
AddSkeletalMeshAttachedAttaches a Skeletal Mesh as master pose to this entity
AddStaticMeshAttachedAttaches a Static Mesh to this entity
PullUsePulls the usage of this Pickable (will start firing if this is a weapon)
ReleaseUseReleases the usage of this Pickable (will stop firing if this is a weapon)
RemoveSkeletalMeshAttachedRemoves, if it exists, a SkeletalMesh from this Pickable given its custom ID
RemoveStaticMeshAttachedRemoves, if it exists, a StaticMesh from this Pickable given its custom ID
SetAttachmentSettingsSets the Attachment Settings for this Pickable (how it attaches to the Character when Picking up)
SetCrosshairMaterialSets the crosshair material for this Pickable
SetPickableSets if this Pickable can be picked up from ground by the player
SkeletalMesh Reference GetAssetNameGets the name of the asset this Pickable uses
Character or nilGetHandlerGets the Character, if it exists, that's holding this Pickable

AddSkeletalMeshAttached

Spawns and attaches a SkeletalMesh to this Pickable, the SkeletalMesh must have the same skeleton used by this Actor's mesh, and will follow all animations from it. Uses a custom ID to be used for removing it later.

For customizing the Materials specific to a mesh attached with this function, use the following syntax as the parameter_name in the Base Paintable methods: attachable///[ATTACHABLE_ID]/[PARAMETER_NAME], where [ATTACHABLE_ID] is the ID of the Attachable, and [PARAMETER_NAME] is the name of the parameter you want to change.
my_entity:AddSkeletalMeshAttached(id, skeletal_mesh_path)
TypeParameterDefaultDescription
string idUnique ID to assign to the SkeletalMesh
SkeletalMesh Reference skeletal_mesh_pathPath to SkeletalMesh asset to attach

AddStaticMeshAttached

Spawns and attaches a StaticMesh to this Pickable in a Socket with a relative location and rotation. Uses a custom ID to be used for removing it later

For customizing the Materials specific to a mesh attached with this function, use the following syntax as the parameter_name in the Base Paintable methods: attachable///[ATTACHABLE_ID]/[PARAMETER_NAME], where [ATTACHABLE_ID] is the ID of the Attachable, and [PARAMETER_NAME] is the name of the parameter you want to change.
my_entity:AddStaticMeshAttached(id, static_mesh_path, socket?, relative_location?, relative_rotation?)
TypeParameterDefaultDescription
string idUnique ID to assign to the StaticMesh
StaticMesh Reference static_mesh_pathPath to StaticMesh asset to attach
string socket?Bone socket to attach to
Vector relative_location?Vector(0, 0, 0)Relative location
Rotator relative_rotation?Rotator(0, 0, 0)Relative rotation

PullUse

Pulls the usage of this Pickable (will start firing if this is a weapon)
my_entity:PullUse(release_use_after?)
TypeParameterDefaultDescription
number release_use_after?-1Time in seconds to automatically release the usage (-1 will not release, 0 will release one tick after)

ReleaseUse

Releases the usage of this Pickable (will stop firing if this is a weapon)
my_entity:ReleaseUse()

RemoveSkeletalMeshAttached

Removes, if it exists, a SkeletalMesh from this Pickable given its custom ID
my_entity:RemoveSkeletalMeshAttached(id)
TypeParameterDefaultDescription
string idUnique ID of the SkeletalMesh to remove

RemoveStaticMeshAttached

Removes, if it exists, a StaticMesh from this Pickable given its custom ID
my_entity:RemoveStaticMeshAttached(id)
TypeParameterDefaultDescription
string idUnique ID of the StaticMesh to remove

SetAttachmentSettings

Sets the Attachment Settings for this Pickable (how it attaches to the Character when Picking up)
my_entity:SetAttachmentSettings(relative_location, relative_rotation?, socket?)
TypeParameterDefaultDescription
Vector relative_locationLocation relative to the Socket
Rotator relative_rotation?Rotator(0, 0, 0)Rotation relative to the Socket
string socket?hand_r_socketCharacter Socket to attach to when picked up

SetCrosshairMaterial

Sets the crosshair material for this Pickable
my_entity:SetCrosshairMaterial(material_asset)
TypeParameterDefaultDescription
Material Reference material_assetAsset path to the crosshair material

SetPickable

Sets if this Pickable can be picked up from ground by the player
my_entity:SetPickable(is_pickable)
TypeParameterDefaultDescription
boolean is_pickable

GetAssetName

Gets the name of the asset this Pickable uses

Returns SkeletalMesh Reference
local ret = my_entity:GetAssetName()

GetHandler

Gets the Character, if it exists, that's holding this Pickable

Returns Character or nil
local ret = my_entity:GetHandler()

🚀 Events

NameDescription
DropWhen a Character drops this Pickable
HitWhen this Pickable hits something
InteractTriggered when a Character interacts with this Pickable (i.e. tries to pick it up)
PickUpTriggered When a Character picks this up
PullUseTriggered when a Character presses the use button for this Pickable (i.e. clicks left mouse button with this equipped)
ReleaseUseTriggered when a Character releases the use button for this Pickable (i.e. releases left mouse button with this equipped)

Drop

When a Character drops this Pickable
Pickable.Subscribe("Drop", function(self, character, was_triggered_by_player)

end)
TypeArgumentDescription
Base Pickable selfThe Pickable which has been dropped
Character characterThe Character that dropped it
boolean was_triggered_by_playerIf the Player actively pressed the Drop binding to drop

Hit

When this Pickable hits something
Pickable.Subscribe("Hit", function(self, impact_force, normal_impulse, impact_location, velocity)

end)
TypeArgumentDescription
Base Pickable selfThe Actor that was hit
number impact_forceThe intensity of the hit normalized by the Pickable's weight
Vector normal_impulseThe impulse direction of the hit
Vector impact_locationThe world space location of the impact
Vector velocityThe Pickable's velocity at the moment it hit

Interact

Triggered when a Character interacts with this Pickable (i.e. tries to pick it up)

Return false to prevent the interaction
Pickable.Subscribe("Interact", function(self, character)

end)
TypeArgumentDescription
Base Pickable selfThe Pickable that just got interacted with
Character characterThe Character that interacted with it

PickUp

Triggered When a Character picks this up
Pickable.Subscribe("PickUp", function(self, character)

end)
TypeArgumentDescription
Base Pickable selfThe Pickable that just got picked up
Character characterThe Character that picked it up

PullUse

Triggered when a Character presses the use button for this Pickable (i.e. clicks left mouse button with this equipped)
Pickable.Subscribe("PullUse", function(self, character)

end)
TypeArgumentDescription
Base Pickable selfThe Pickable which has just been used
Character characterThe Character that used it

ReleaseUse

Triggered when a Character releases the use button for this Pickable (i.e. releases left mouse button with this equipped)
Pickable.Subscribe("ReleaseUse", function(self, character)

end)
TypeArgumentDescription
Base Pickable selfThe Pickable which has just stopped being used
Character characterThe Character that stopped using it

➕ Available Crosshairs

nanos world provides a bunch of crosshair materials which can be used in Weapons/Pickables. You can of course create your own crosshair materialr and use those instead!

All available CrosshairsAll available Crosshairs

List of crosshair materials included in the default asset pack

  • nanos-world::MI_Crosshair_Circle
  • nanos-world::MI_Crosshair_Crossbow
  • nanos-world::MI_Crosshair_Dot
  • nanos-world::MI_Crosshair_Holo
  • nanos-world::MI_Crosshair_Launcher
  • nanos-world::MI_Crosshair_Regular
  • nanos-world::MI_Crosshair_Regular_X
  • nanos-world::MI_Crosshair_Rocket
  • nanos-world::MI_Crosshair_Separated_Triangle
  • nanos-world::MI_Crosshair_Shotgun
  • nanos-world::MI_Crosshair_Square
  • nanos-world::MI_Crosshair_Submachine
  • nanos-world::MI_Crosshair_Tee
  • nanos-world::MI_Crosshair_ThreeDots
  • nanos-world::MI_Crosshair_Triangle
  • nanos-world::MI_Crosshair_Vee