Jump to content

Just need clarification on some code


Meridias561

Recommended Posts

Hey all. I'm sure this is going to be a rather simple question for those who are more code knowledgeable than I am so here goes. In an effort to adapt the homestead system for use in a mod I'm making, I've been digging through the code to figure out how everything ties together. In the BYOHWorkbenchScript script that is on the drafting table at the homesteads, there is this line of code:

BYOHHouseCraftingTriggerScript mytrigger = (GetLinkedRef() as BYOHHouseCraftingTriggerScript)

So I can figure out what this does, would someone be willing to translate that to english for me? :)

Link to comment
Share on other sites

BYOHHouseCraftingTriggerScript mytrigger = (GetLinkedRef() as BYOHHouseCraftingTriggerScript)

The method GetLinkedRef does exactly what it says on the tin -- it gets the reference linked to from the specified object. That there is no specified object (e.g. it's not someObject.GetLinkedRef()) is a sort of shorthand for running it on the current object, i.e. it's equivalent to self.GetLinkedRef().

 

The linked ref is then cast to a BYOHHouseCraftingTriggerScript object and stored in the variable mytrigger; based on these names I can only assume that the linked reference is a trigger of some kind with a script attached to it (named BYOHHouseCraftingTriggerScript), in which case this line is getting to that script so that it can call functions and/or access properties stored in it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...