Slingshotmodder
Based on game build 714014 | Last updated: 2026-03-03
Overview
Slingshotmodder is a lightweight helper component that encapsulates the logic for initiating and terminating slingshot modifications on an item. It verifies ownership constraints via linkeditem and delegates container operations to the slingshotmods component on the target entity. This component is typically attached to the modder (e.g., a player or tool) to orchestrate safe, permission-aware access to slingshot modification UI.
Usage example
local inst = CreateEntity()
inst:AddComponent("slingshotmodder")
-- Attempt to start modifying a target item with a user (e.g., player)
local success, reason = inst.components.slingshotmodder:StartModding(target, user)
if not success then
print("Modification blocked:", reason)
end
-- Later, to close the modification interface
inst.components.slingshotmodder:StopModding(target, user)
Dependencies & tags
Components used: linkeditem, slingshotmods
Tags: None identified.
Properties
No public properties.
Main functions
StartModding(target, user)
- Description: Validates that the
useris authorized to modifytarget(respecting ownership restrictions), then opens theslingshotmodsinterface for the target. Returns success status and an optional reason code on failure. - Parameters:
target(Entity) – The entity possessing theslingshotmodscomponent and optionally thelinkeditemcomponent.user(Entity, optional) – The entity attempting to open the interface; must have auseridproperty if provided.
- Returns:
success(boolean),reason(string, optional) —successistrueif opening succeeded;falseotherwise. On failure,reasonis"NOT_MINE"when ownership restriction is violated. - Error states: Fails with
"NOT_MINE"iftargethaslinkeditemwithIsEquippableRestrictedToOwner()returningtrue, anduser.useriddoes not match the item's owner. Also returnsfalseiftarget.components.slingshotmodsis missing or:Open(user)fails.
StopModding(target, user)
- Description: Closes the
slingshotmodsinterface ontargetfor the givenuser. - Parameters:
target(Entity) – The entity whoseslingshotmodscontainer should be closed.user(Entity) – The entity that previously opened the interface.
- Returns:
success(boolean) —trueif theslingshotmods:Close(user)call succeeded;falseifslingshotmodsis missing or closing failed (e.g., mismatched opener or non-master simulation). - Error states: Returns
falseiftargetlacks aslingshotmodscomponent or the underlying:Close()operation fails.
Events & listeners
- Listens to: None.
- Pushes: None. (This component does not fire events; it relies on
slingshotmodsto emitms_slingshotmodsclosed.)