ribrdb / desynced-tools

Tools for working with behaviors and blueprints from Desynced.
MIT License
4 stars 3 forks source link

negative coordinates #58

Closed ttm02 closed 5 months ago

ttm02 commented 5 months ago

As far as I understand, the game does not support directly setting negative values. Apart from coordinates, where I can add negative coordinates in game (in the add instruction). Something like this does not compile:

let position = getLocation(self);
let new_pos = position + coord(-2, 0);

It is possible to work around this by using:

let position = getLocation(self);
let new_pos = position - coord(2, 0);

In terms of coordinates, I personally find this unintuitive (and therefore error-prone to use).

I don't know if fixing it is worthwhile, though. I just want to hint at this and think it may be a good idea to include it in documentation/examples.

swazrgb commented 5 months ago

Being able to use negative numbers (both for coordinates, and plain number types) is something I plan to PR, together with inlining other math ops (e.g. const x = -3 * 2 results in the value -6 being used in the place of the x variable.)

Unrelated to desynced-tools, but based on what beatwho (developer of desynced) has said on discord the game might also allow setting negative values at some point via its UI, this is supported by the behavior engine and can currently be already be done with the subtract instruction.

swazrgb commented 5 months ago

This is now supported.