Skip to main content

Below is a template for a ShapeClass script, used for controlling interactive parts.

Shape = class()
-- Constants-- https://scrapmechanictools.com/lua/Game-Script-Environment/Constants#shapeclass
Shape.colorNormal = sm.color.new( "#00ff00" )Shape.colorHighlight = sm.color.new( "#ff0000" )Shape.connectionInput = sm.interactable.connectionType.noneShape.connectionOutput = sm.interactable.connectionType.noneShape.maxParentCount = 0Shape.maxChildCount = 0Shape.poseWeightCount = 0
-- Serverside Callbacks
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#oncreatefunction Shape.server_onCreate( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onrefreshfunction Shape.server_onRefresh( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onfixedupdatefunction Shape.server_onFixedUpdate( self, dt )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#onexplosionfunction Shape.server_onExplosion( self, center, destructionLevel )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#onprojectilefunction Shape.server_onProjectile( self, position, airTime, velocity, projectileName, shooter, damage, customData, normal, uuid )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#onmeleefunction Shape.server_onMelee( self, position, attacker, damage, power, direction, normal )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#oncollisionfunction Shape.server_onCollision( self, other, position, selfPointVelocity, otherPointVelocity, normal )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#canerasefunction Shape.server_canErase( self )
    return trueend
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#onunloadfunction Shape.server_onUnload( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#ondestroyfunction Shape.server_onDestroy( self )
end


-- Clientside Callbacks
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#oncreatefunction Shape.client_onCreate( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onrefreshfunction Shape.client_onRefresh( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onfixedupdatefunction Shape.client_onFixedUpdate( self, dt )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onupdatefunction Shape.client_onUpdate( self, dt )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#onprojectilefunction Shape.client_onProjectile( self, position, airTime, velocity, projectileName, shooter, damage, customData, normal, uuid )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#onmeleefunction Shape.client_onMelee( self, position, attacker, damage, power, direction, normal )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#oncollisionfunction Shape.client_onCollision( self, other, position, selfPointVelocity, otherPointVelocity, normal )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#canerasefunction Shape.client_canErase( self )
    return trueend
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#oninteractfunction Shape.client_onInteract( self, character, state )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#caninteractfunction Shape.client_canInteract( self, character )
    return trueend
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#ontinkerfunction Shape.client_onTinker( self, character, state )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#cantinkerfunction Shape.client_canTinker( self, character )
    return trueend
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#oninteractthroughjointfunction Shape.client_onInteractThroughJoint( self, character, state, joint )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#caninteractthroughjointfunction Shape.client_canInteractThroughJoint( self, character )
    return trueend
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#onactionfunction Shape.client_onAction( self, action, state )
    return trueend
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#cancarryfunction Shape.client_canCarry( self )
    return trueend
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#getavailableparentconnectioncountfunction Shape.client_getAvailableParentConnectionCount( self, connectionType )
    return 0end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/ShapeClass#getavailablechildconnectioncountfunction Shape.client_getAvailableChildConnectionCount( self, connectionType )
    return 0end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onclientdataupdatefunction Shape.client_onClientDataUpdate( self, data, channel )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#ondestroyfunction Shape.client_onDestroy( self )
end