duplicator.StoreEntityModifier

From GMod Wiki

Jump to: navigation, search
Function
Syntax duplicator.StoreEntityModifier( Entity entity, String type, Table data )
Where is this used?
Description:
register a function to be applied when an entity is duplicated if it has the modifier type.
Returns: nil
Part of Library: duplicator
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Duplicator.StoreEntityModifier]Duplicator.StoreEntityModifier [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionThis is from the Weight STool by Spoco
Used onNewerShared.png
Code
local function SetMass( Player, Entity, Data )
	if not SERVER then return end
 
	if Data.Mass then
		local physobj = Entity:GetPhysicsObject()
		if physobj:IsValid() then physobj:SetMass(Data.Mass) end
	end
 
	duplicator.StoreEntityModifier( Entity, "mass", Data )
end
 
duplicator.RegisterEntityModifier( "mass", SetMass )
OutputN/A


Additional Notes

Ent.EntityMods[type]

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox