Garry's Mod Wiki
Description
Register a function used for creating a duplicator-supported constraint.
Arguments
It is a good idea to check constraint.CanConstrain before doing anything else.
You must also call constraint.AddConstraintTable if creating custom constraint entities.
- This is what stores the constraint for duplicator to save and load, as well as for constraint.GetTable.
- The constraint entity must have
Typekey on it. This means that a single entity can only represent one constraint.
Optionally, the callback can return up to 4 entities, which are considered the "constraint" entities.
- Each of those is added to
"ropeconstraints"or"constraints"cleanup list based on entity's classname (Player:AddCleanup) - The first entity is added to the player's entity count (Player:AddCount) in Sandbox.
- None of these entities should be the 2 entities being constraint (i.e. a
prop_physics), but it can be one one of them if you know what you are doing.
The data would be taken the constraint entity table added via constraint.AddConstraintTable. All constraint library constraints call it on the appropriate entity for you. (Typically its the first entity returned by the callback)
Example
Example of how to define a custom constraint. You apply the constraint via the custom constraint_MyCustomConstraint function, and it will automatically support duplicator.
This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.
Page content is automatically updated four times a day. Edits and history are not available.
Last Parsed: Loading...