duplicator.RegisterEntityClass

From Garry's Mod
Jump to: navigation, search
 duplicator.RegisterEntityClass( )

Contents

Description

This allows you to specify a specific function to be run when your SENT is pasted with the duplicator, instead of relying on the generic automatic functions.

NOTE

Automatically calls duplicator.Allow for the entity class.

Arguments

string name

The ClassName of the entity you wish to register a factory for

Arguments

function function

The factory function you want to have called. It should have the arguments (Player, ...) where ... is whatever arguments you request to be passed.

Arguments

vararg args

Strings of the names of arguments you want passed to function the from the EntityCopyData structure. As a special case, "Data" will pass the whole structure.

Examples

Example

Prints the datatable and then lets the duplicator do it's job

duplicator.RegisterEntityClass("prop_physics", function(ply, data)
	PrintTable(data)
	duplicator.GenericDuplicatorFunction(ply, data)
end, "Data")

Output:

Skin = 0
Mins = -14.357550 -14.390250 -25.934851
Flex:
	ColGroup = 0
Pos = -292.415070 -157.575043 -12262.056641
PhysicsObjects:
	0:
		Frozen = false
		Pos = 13.750092 0.490356 -4.675781
		Angle = 0.057 87.808 -0.031
Class = prop_physics
FlexScale = 1
Maxs = 14.438149 14.405550 25.995348
Model = models/props_borealis/bluebarrel001.mdl
Angle = 0.057 134.318 -0.031
Personal tools
Navigation