Entity/Use

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (More accurate to say 'Use key', it's not always E.)
(document confusion over caller and activator)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{Func
 
{{Func
|Description=Activates the entity, as if a player pressed the Use key (Default 'E') on it.
+
|Description=Activates the entity, as if a player pressed the Use key (Default {{Key|E}}) on it.
 
|Realm=Server
 
|Realm=Server
 
|IsClass=Yes
 
|IsClass=Yes
|Name=Use
 
|Parent=Entity
 
 
}}
 
}}
 
{{Arg
 
{{Arg
 
|type=Player
 
|type=Player
|name=User
+
|name=activator
|desc=The player to credit with activating the entity.
+
|desc=The player who is using the entity
 +
}}
 +
{{Arg
 +
|type=Entity
 +
|name=caller
 +
|desc=This should be the same as ''activator''.
 +
 
 +
This is supposed to be the entity that is acting as a proxy for the player (eg a button), but due to confusion over the difference between activator and caller, third party code may expect caller to be the activator and vice versa.
 +
 
 +
Therefore, the only safe thing to do is to set both arguments to be the player.
 +
}}
 +
{{Arg
 +
|type=number
 +
|name=useType
 +
|desc=The type of use to trigger. See {{Enum|USE}}
 +
}}
 +
{{Arg
 +
|type=number
 +
|name=integer
 +
|desc=You can usually set this to 1.
 
}}
 
}}

Latest revision as of 00:25, 3 February 2019

 Entity:Use( )

Contents

Description

Activates the entity, as if a player pressed the Use key (Default E) on it.

Arguments

Player activator

The player who is using the entity

Arguments

Entity caller

This should be the same as activator.

This is supposed to be the entity that is acting as a proxy for the player (eg a button), but due to confusion over the difference between activator and caller, third party code may expect caller to be the activator and vice versa.

Therefore, the only safe thing to do is to set both arguments to be the player.

Arguments

number useType

The type of use to trigger. See USE_ Enums

Arguments

number integer

You can usually set this to 1.
Personal tools
Navigation