CHANGE/FIX: token facing

Developer discussion regarding MapTool 1.4

Moderators: dorpond, trevor, Azhrei

Forum rules
Posting now open to all registered forum users.
User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: CHANGE/FIX: token facing

Post by wolph42 »

In that case: (good name btw) make sure that an angle is returned when facing is NOT set. Irc when facing is not set its angle is 180, but not sure, so check first.

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: CHANGE/FIX: token facing

Post by aliasmask »

Maybe there shouldn't be a null facing. Just an internal show facing. I think the default facing is 90 or -90 I don't recall.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: CHANGE/FIX: token facing

Post by JamzTheMan »

Could just return 0 (or 360) if not set, you still get a 'valid' setting but also know it's not set, if needed.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: CHANGE/FIX: token facing

Post by aliasmask »

Well, if the facing is null, it does returns "" but the actual token facing is -90. My point is the token is always facing somewhere. Just the little arrow may or may not be showing up.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: CHANGE/FIX: token facing

Post by wolph42 »

aliasmask wrote:Well, if the facing is null, it does returns "" but the actual token facing is -90. My point is the token is always facing somewhere. Just the little arrow may or may not be showing up.
Indeed, and -90 is 180, so no facing should return 180

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: CHANGE/FIX: token facing

Post by Jagged »

JamzTheMan wrote: assume someone at sometime had a reason to go -180 to 180.
I suspect because its suitable for Swing

User avatar
aliasmask
RPTools Team
Posts: 9029
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: CHANGE/FIX: token facing

Post by aliasmask »

I think you can put any number for facing and it will be converted. But when getting the facing back I don't think -180 is included.

d4rkAlf
Cave Troll
Posts: 35
Joined: Thu Apr 16, 2015 9:48 am

Re: CHANGE/FIX: token facing

Post by d4rkAlf »

I went and had a look at the current code in the master branch. If a token does not have a facing then getFacing will return null. The macro function getTokenFacing interprets this has having no facing and will return the empty string "".

I have updated my tokenfacing branch to include the latest batch of improvements:
https://github.com/DarkAlf/maptool/tree/tokenfacing

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: CHANGE/FIX: token facing

Post by Jagged »

Git Hubs gone down! Did you break it? ;)

d4rkAlf
Cave Troll
Posts: 35
Joined: Thu Apr 16, 2015 9:48 am

Re: CHANGE/FIX: token facing

Post by d4rkAlf »

I finally figured out how it should be done using modulo. :D

Code: Select all

public void setFacingInDegrees(float facing) {
		facing %= 360;
		if (facing < 0) {
			facing += 360;
		}
		this.facing = facing;
}
I've also made a new pull request. Please have a look at Github.

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: CHANGE/FIX: token facing

Post by RPTroll »

This didn't seem to make it into the 00 build. Was it added or no?
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: CHANGE/FIX: token facing

Post by Jagged »

No. At the point of DarkAlf's last change, it was still producing some errors in token facing when loading pre-existing maps. I think when you had stamps that were flipped as well as rotated, but not 100% sure.

Plus I am not sure this approach is the right one. All we wanted was a new set of functions to return facing in radians. Making an additional step of changing the way facing is represented in the underlying data seems to risk bugs for little actual benefit.

Post Reply

Return to “MapTool 1.4”