Rekindled Phoenix Posted June 12, 2011 Share Posted June 12, 2011 I want others to be able to define avoidance and guidance radii that are attached to any object the user chooses. In order for them to inherit these, special property keys must be assigned. How do I handle includes or property group modifications that the parent is already making? Does the included / required script get executed before the main script is run? How would I add properties to the parent object? Quote Link to comment Share on other sites More sharing options...
Rekindled Phoenix Posted June 14, 2011 Author Share Posted June 14, 2011 Is it even possible to add properties to the parent object when it's added as a 'require' field? I'm thinking of it backwards. The scripting system is designed to be a 'per object instantiation' where access to a class requires parameters or a constructor. Lua is not structured where inherited objects have a reference to the parent that instantiated them. Would this be the best way for added scripts to modify their assigned object? --represents any object class require("PhoenixPath") local class=CreateClass(...) function class:InitDialog(propertygrid) self.super:InitDialog(propertygrid) -- AddPathingProperties(propertygrid) end function class:CreateObject(model) local object=self.super:CreateObject(model) -- SetKeys(object) end -- PhoenixPath library function AddPathingProperties(propertygrid) group=propertygrid:AddGroup("Pathing") group:AddProperty( "Avoidance Radius", PROPERTY_FLOAT,'|1,50,1') group:Expand(1) end function SetKeys(object) object.model:SetKey("AvoidanceRadius","2") end Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.