Jump to content

Is there a way to initialise a TESR model with parameters?


Jay Avery

Recommended Posts

I'd like to make a TESR with a model which can be varied depending on the TESR's state when the model is constructed. Not things like animation which change over time, but the actual model parts and boxes. Obviously I could just make multiple possible TE classes with their own corresponding TESRs, but I'd like to be able to create the variations in the code rather than manually. The trouble is, the TESR doesn't have a normal constructor (the sort of place where I could access a TE parameter and customise the model accordingly). The best thing I can think of is to store something like an 'isInitalised' boolean and then, on the first tick where it's not initialised, construct the model based on the TE parameter in renderTileEntityAt. But this seems kind of hacky and like it might cause other problems. I can't find any kind of initialisation method in the TESR, but I'm hopeful that I might be missing something. Or if I'm not, then does my above idea seem plausible, or terrible?

 

For context, I'm working on falling trees. My current plan is to create an invisible TE when the tree is cut. This TE will check and store the size and shape of the tree, then the TESR's model would be based on that information, and be animated as if falling. So there are countless possible variations in tree shape, and I'd like to be able to make the model procedurally rather than manually - but once the model is made it doesn't change.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.