ID:157830
 

1) Is it impossible to get MouseDown events in regions that are out of your line of sight or even off the map? Specifically, I'd like the screen-loc of any MouseDowns that occur on such tiles.

2)Is it also impossible to get the screen-loc value of a mouse cursor as it is moving in MouseDrag? Didn't see it in the params list.


If both of these are impossible I could be screwed.
Why do you want those?

And for the second answear, I suppose you want the mouse to show the icon you draggin, you could change the mouse pointer for this matter and then change it back once the obj is dropped
In response to Abrax
This is for a custom movement system
For 1), you can add a screen object with screen_loc of "SOUTHWEST to NORTHEAST" to cover the whole screen, and set its layer to, say, 0.5. It will only show up when there's nothing visible to show up in front of it (like turfs or areas) and then you should be able to use that to capture the clicks.
In response to Garthor
worked, but also


3) If two dense tiles are next to each other diagonally, your line of sight shows that light cannot pass through the infinitely small gap in between them, but apparently players can squeeze right through. Can this type of movement be disabled, or will I have to implement extra movement checks to prevent this special case?
In response to Obs
You'd have to block that movement entirely, which isn't too difficult:

mob/Move(newloc)
var/d = get_dir(src,newloc)
//diagonal movement
if(d&(d-1))
var/turf/T = d&(NORTH|SOUTH)
if(T.Enter(src))
T = d&(EAST|WEST)
if(T.Enter(src))
return ..()
//bump into one of those obstructions for the hell of it
return ..(T)
return ..()


Another option is to remove diagonal movement entirely and instead have the diagonal keys map to simply alternating between the two cardinal directions. Also removes silly things like moving faster diagonally.
In response to Garthor
If characters are walking around on an isometric map it makes no sense to not have diagonal movement.

I can see how its easy to check for these kind of movements but I don't see why it should be necessary to code that in the first place, it should be default behavior.
In response to Garthor
You know, this actually screws up mouse drags now.

MouseDrag apparently doesn't work over screen objects. It also doesn't work over tiles that are out of your line of sight.

I couldn't get the screen objects to sit at a layer lower than the AREA_LAYER either, but I just used a transparent screen object over the whole screen and that seemed to work pretty well. Except for the mouse drag thing.

A solution to get MouseDrags working again is to remove the screen objects with every mouse down and put them back on a mouse up, but the drag still does not work over the tiles that are out of the line of sight. This is a disaster.
In response to Garthor
Garthor wrote:
For 1), you can add a screen object with screen_loc of "SOUTHWEST to NORTHEAST" to cover the whole screen, and set its layer to, say, 0.5. It will only show up when there's nothing visible to show up in front of it (like turfs or areas) and then you should be able to use that to capture the clicks.


I'm still having trouble getting a screen object appear on any other layer besides the top most one, can you give an example of how to do this?
4) How do you deal with MouseDrops that occur outside of the entire game window? The MouseDrop() function won't get called
In response to Obs
You don't, since they never occur, just like you've said.
Generally you can't interact with things that occur outside of your game.
In response to Kaioken
Kaioken wrote:
You don't, since they never occur, just like you've said.
Generally you can't interact with things that occur outside of your game.


Yes, well since MouseDrop isn't called outside the game window you can't really tell when a mouseDrop was invalid

Like if you're dragging an item on the cursor and the user releases the mouse outside the game window.