cityrp.interaction
Interactions are a configurable menu that can appear on any entity when a user holds use on it.
If an entity has normal use functionality, behaviour will be modified to the following: Hold E: Show interaction menu Tap E: Regular entity use functionality Don't register interactions in this file, do it in some plugin or something. Data structure for an interaction looks like the following, everything is required unless otherwise stated: data = { id = "Interaction ID", -- The id of the interaction, must be unique for the given class name = "Interaction Name", -- The name of the interaction description = "Interaction Description", -- The description of the interaction condition = function(client, ent) -- The condition to check if the interaction should be shown, do context dependent checks here. This is executed on BOTH the client and server. return true -- True if the interaction should be shown, false if not end, action = function(client, ent) -- The action to perform when the interaction is clicked print("Clicked!") end }
Functions
cityrp.interaction.CanUse(client, entity, data)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
client
Player
-
entity
Entity
-
data
interactionData
Returns
-
boolean
cityrp.interaction.Get(class, id)
View source »Gets an interaction by entity and id
Parameters
-
class
string
-
id
string
Returns
-
optional
cityrp.interaction.GetAllByClass(class)
View source »Gets all interactions by entity class
Parameters
-
class
string
Returns
-
optional
cityrp.interaction.GetValid(entity, client)
View source »Documentation for this section is incomplete and needs expanding.
Parameters
-
entity
Entity
-
client
Player
Returns
cityrp.interaction.Has(entity, client)
View source »Checks if an entity has any interactions
Parameters
-
entity
Entity
-
client
Player
optional
Returns
-
boolean
cityrp.interaction.HasValid(entity, client)
View source »Checks if this entity has any interactions that are avaliable for use
Parameters
-
entity
Entity
-
client
Player
Returns
-
boolean
cityrp.interaction.Register(class, data, quickCond)
View source »Register an interaction
Parameters
-
class
string
-
data
interactionData
-
quickCond
fun(entity : Entity)
optional
Quick function to check if the interaction should be shown
Tables
interactionData
View source »Documentation for this section is incomplete and needs expanding.
Fields
-
id
string
-
name
string
-
description
string
-
:
fun(client
Player, ent : Entity) action : nil
-
:
fun(client
Player, ent : Entity) action : nil