PDA

View Full Version : Busted my extension



SilentRuin
December 28th, 2021, 22:30
The type is no longer being returned by resolveActor structure.

I see several places the following code was changed from ...

local sRecordType = LibraryData.getRecordTypeFromDisplayClass(sClass);


to this...

local sRecordType = LibraryData.getRecordTypeFromRecordPath(sRecord);

But not in resolveActor - which now when I check the returned rActor.sType it's nil.

Which of course causes all sorts of problems for me.

celestian
December 28th, 2021, 22:50
The type is no longer being returned by resolveActor structure.

I see several places the following code was changed from ...

local sRecordType = LibraryData.getRecordTypeFromRecordPath(sRecord);

to this...

local sRecordType = LibraryData.getRecordTypeFromDisplayClass(sClass);

But not in resolveActor - which now when I check the returned rActor.sType it's nil.

Which of course causes all sorts of problems for me.

Switch to ActorManager.isPC()? I think I even do something like local isPC = (ActorManager.isPC(ActorManager.resolveActor(node) )) tho you can probably just do ActorManager.isPC(node) and it'd work.

SilentRuin
December 28th, 2021, 23:01
Switch to ActorManager.isPC()? I think I even do something like local isPC = (ActorManager.isPC(ActorManager.resolveActor(node) )) tho you can probably just do ActorManager.isPC(node) and it'd work.

Yeah I just redelivered my poly extension with a different way of determining "charsheet" or "npc" for the window class I used to open the windows. So I'm safe now - but saw this new call was not in the resolve logic and no idea if that will effect anything else (not me stuff). A simple search of 5e and corerpg ruleset shows the four places that function was not replaced. No idea why it was replaced in other places. Either way - I'm off that hook.

And your way is probably the smart way - but I had legacy way of checking for sure so not going to change that. I use isPC decisions in most places now - this was a really old extension (like a year and half old!) and quick and dirty fix to get it out ASAP was what I opted for. Even if not the "right" way in my opinion to do it (your suggestion is the right way).

SilentRuin
December 29th, 2021, 00:10
FYI for anyone who needs to check their code if they are having issues... I used a search for all places I had ".sType" and then determined which was off an actor structure (ignore the roll structures) as that was going to be a potential trouble spot. I had 4 places and changed them all to do the logic I used .sType for in a different way.

Moon Wizard
December 29th, 2021, 00:13
I was trying to move the code to rely on code path, instead of display class; based on requests from another developer, as well as trying to simplify parts of the code.

I've reverted the changes in actor manager and the top-level link controls, which should restore the previous behavior.

Regards,
JPG

LordEntrails
December 29th, 2021, 03:07
MOD: moved to workshop since this is developer/extension related.