PDA

View Full Version : Faction "faction" is "foe"?



bmos
August 6th, 2022, 12:54
ActorManager.getFaction presumes "foe" if the friendfoe value is nil.
However, picking "faction" in the CT is what sets the friendfoe value to nil so I would expect it to presume "faction".
Tested in 5E and 3.5E.

Is this intentional?

Moon Wizard
August 7th, 2022, 00:55
Some info:
* The "faction" field does not exist in the combat tracker; it's named "friendfoe".
* The valid values are friend/neutral/foe or undefined.
* The ActorManager deliberately assumes "foe" as a fallback value, if undefined.

Regards,
JPG

bmos
August 7th, 2022, 01:34
Not sure what to tell you, the tooltip says "Faction"
https://i.imgur.com/I17rk2a.png
EDIT: But that is a helpful response. "Faction" is actually undefined and undefined = foe.
Got it.

Moon Wizard
August 7th, 2022, 04:46
Oh, you're talking about the tooltip. It is not dynamic, which is why it's a generic tooltip for that control.

Regards,
JPG

bmos
August 7th, 2022, 13:41
It actually is a dynamic tooltip, at least in 5E and 3.5E.
https://i.imgur.com/o7jH1yI.png
https://i.imgur.com/AtXmHUA.png
https://i.imgur.com/Dv838qb.png
https://i.imgur.com/peQARUE.png

If I'm following, what you're saying is that the tooltip "faction" is referring to the field, but the other tooltips are referring to the field values (when set).
When the field is not set to a value, it falls back to the tooltip that merely describes the field. IMO, this is a confusing experience.

Moon Wizard
August 8th, 2022, 00:48
So, what is the solution then? Just default to empty string? Then, you have a graphical button with no information on hover.

Regards,
JPG

bmos
August 8th, 2022, 15:15
In direct answer to your question, the tooltip could be Faction: Foe, Faction: Friend, Faction: Neutral, or Faction: None.

But honestly I'd lean more toward getFaction returning "" when the friendfoe node is nil (as it already returns "" sometimes -- i'm not sure of the steps to reproduce, but rhagelstrom and I have both noticed that).
I understand if that's too risky for compatibility with existing rulesets and will just do it in my extension if that makes more sense.

EDIT: I also noticed that the latest version of CoreRPG is already taking this aproach of presuming "" in at least one place: manager_combat_record.lua handleStandardCombatAddFields has DB.getValue(v, "friendfoe", "") (which does not presume "foe" if the node is nil, unlike in getFaction).

rhagelstrom
August 8th, 2022, 15:43
In direct answer to your question, the tooltip could be Faction: Foe, Faction: Friend, Faction: Neutral, or Faction: None.

But honestly I'd lean more toward getFaction returning "" when the friendfoe node is nil (as it already returns "" sometimes -- i'm not sure of the steps to reproduce, but rhagelstrom and I have both noticed that).
I understand if that's too risky for compatibility with existing rulesets and will just do it in my extension if that makes more sense.

I'll see if I can dig up how to reproduce. What I'm seeing is ActorManager.getFaction() returns empty string when faction=faction. I thought at some point I saw it return "foe" but I currently can't reproduce and perhaps was mistaken. If an Actor with faction=faction is added to the CT, the Actor is added to the CT as Foe.

rhagelstrom
August 8th, 2022, 17:31
Update:

When Actor is a PC with Faction=Faction then ActorManager.getFaction() returns "foe". When Actor is NPC with Faction=Faction ActorManager.getFaction() returns empty string. Tested in 5E

Moon Wizard
August 8th, 2022, 18:12
If you look at ActorManager.getFaction, this is the logic:


local nodeCT = ActorManager.getCTNode(rActor);
if nodeCT then
return DB.getValue(nodeCT, "friendfoe", "foe");
end
return nil;


I added a Debug.chat(sFaction) to CombatManager.showTurnMessage; and it's reporting correctly (friend, neutral, foe, empty string)

Regards,
JPG

Moon Wizard
August 8th, 2022, 18:31
I just pushed an update to the Test channel that changes the tooltips to "Faction: Hostile, Faction: Friend, Faction: Neutral, or Faction: None". The tooltips are fixed strings vs. the underlying data.

Regards,
JPG

SilentRuin
August 8th, 2022, 18:38
Just FYI - my extensions create factions as their own unique things - red green yellow blue - which they insure are respected as unique. So by default Moon is correct - but by extension - you can do what you wish.

bmos
August 8th, 2022, 21:26
Thank you!