Skip to content

VendorInteraction ​

Inherits: Interaction < Resource

Vendor interaction that opens the shop interface when activated

Properties ​

intvendor_definition_id
SFXSelectionshop_open_sfx
AnimationSelectionSocialshop_interaction_animation

Variables ​

VendorInventoryComponentvendor_inventory_instance
boolshop_is_activefalse
Playercurrent_customer

Methods ​

voidinitialize_vendor()
boolcan_interact( player: Player )
voidstart_interaction( player: Player )
voidend_interaction()
voidrestock_vendor()
voidcheck_auto_restock()
Dictionaryget_vendor_summary()
VendorDefinitionget_vendor_definition()
voidset_entity_reference( new_entity: Variant, p_system_hub: GameHost.SystemHub )
intget_item_stock( item_id: int )
boolis_item_available( item_id: int )
Array[Dictionary]get_available_items()
voidset_item_stock( item_id: int, quantity: int )
voidcleanup()

Property descriptions ​

int vendor_definition_id ​

The vendor definition that defines this vendor's shop configuration

SFXSelection shop_open_sfx ​

Optional audio to play when opening shop

AnimationSelectionSocial shop_interaction_animation ​

Optional animation to play when shop opens

Variable descriptions ​

VendorInventoryComponent vendor_inventory_instance ​

The runtime vendor inventory instance created from the definition

bool shop_is_active = false ​

Whether the shop is currently active

Player current_customer ​

Reference to the player currently shopping (if any)

Method descriptions ​

void initialize_vendor() ​

Initialize the vendor inventory from the definition Called when the entity is ready and components are set up

bool can_interact( player: Player ) ​

Check if the player can interact with this vendor

void start_interaction( player: Player ) ​

Start the vendor interaction - opens the shop UI

void end_interaction() ​

End the vendor interaction - closes the shop UI

void restock_vendor() ​

Manually trigger vendor restocking

void check_auto_restock() ​

Check if vendor needs restocking and do it automatically

Dictionary get_vendor_summary() ​

Get vendor summary for debugging

VendorDefinition get_vendor_definition() ​

Get the vendor definition

void set_entity_reference( new_entity: Variant, p_system_hub: GameHost.SystemHub ) ​

Set the entity reference and initialize vendor (called when adding interaction to entity)

int get_item_stock( item_id: int ) ​

Get current stock for a specific item

bool is_item_available( item_id: int ) ​

Check if an item is available for purchase

Array[Dictionary] get_available_items() ​

Get all items currently available for purchase

void set_item_stock( item_id: int, quantity: int ) ​

Manually set stock for an item (for testing/debugging)

void cleanup() ​

Give the timers back (the object is going away)