Jump to content

Script includes and inheriting


Rekindled Phoenix
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...