Page 1 of 1

[Mod Request] Flashlight Follows Mouse

Posted: Mon Mar 04, 2019 9:10 pm
by AngelSkyheart
I would like for the flashlight to follow the mouse rather than face the direction my character is facing. Can this be done?

Alternatively, if the flashlight and my character could face the mouse and just move backwards/sideways in the direction I'm going that would be even better, though I realize that would require additional animations, or at least reversing some of the animations.

I ask because there are a lot of top down shooting games that do this so you can see what the heck you're aiming at, though at the very least this would also have your character at least following your focus in a way that doesn't seem disconnected from your own.

A little side idea to add a touch of realism would be to have the character move slightly slower the further away they're moving in the direction they're not facing, so they're slightly slower when side stepping, and slower when backing up. Though I figure that part should be optional if added at all...

Re: [Mod Request] Flashlight Follows Mouse

Posted: Wed Mar 06, 2019 11:17 pm
by unhott
Modders have no ability to track where your mouse is at-- we can only listen for certain events. one of those events is on_selection_changed, which kind of tells us the position of your cursor, if it happens to hover over an entity.

I would love to be able to read mouse position, but there is probably a performance related reason why we can't read mouse position on the fly. And, even if it wouldn't be too performance heavy we are still at the mercy of the devs to be able to take the time to implement it.

Re: [Mod Request] Flashlight Follows Mouse

Posted: Thu Mar 07, 2019 5:47 am
by steinio

Re: [Mod Request] Flashlight Follows Mouse

Posted: Thu Mar 07, 2019 8:09 am
by darkfrei
Maybe laser target pointer with the color of player? Add parameter last_selected and set the beam (rendering.line) from player to this entity. Some of entities are not selectable in the game.

Re: [Mod Request] Flashlight Follows Mouse

Posted: Fri Sep 13, 2019 2:22 pm
by arZic
Sorry for digging up this thread, but I figured it's better to ask here instead of making a new post.
unhott wrote:
Wed Mar 06, 2019 11:17 pm
Modders have no ability to track where your mouse is at-- we can only listen for certain events. one of those events is on_selection_changed, which kind of tells us the position of your cursor, if it happens to hover over an entity.

I would love to be able to read mouse position, but there is probably a performance related reason why we can't read mouse position on the fly. And, even if it wouldn't be too performance heavy we are still at the mercy of the devs to be able to take the time to implement it.
Mods that change combat seems to be able to track the mouse to a degree. (https://mods.factorio.com/mod/Aim and https://mods.factorio.com/mod/KS_Combat)
These mods change the combat so that it's actual projectiles that are shot, so it requires to know where you are aiming the mouse cursor to actually hit something.

So my question is: Would it possible to get the mouse position/direction from the player without shooting a weapon?

Re: [Mod Request] Flashlight Follows Mouse

Posted: Fri Sep 13, 2019 2:28 pm
by darkfrei
I've made a new mod for this request: https://mods.factorio.com/mod/TorchLight
Would it possible to get the mouse position/direction from the player without shooting a weapon?
nope :(

Re: [Mod Request] Flashlight Follows Mouse

Posted: Sun Sep 15, 2019 9:23 pm
by eradicator
unhott wrote:
Wed Mar 06, 2019 11:17 pm
Modders have no ability to track where your mouse is at
In some ancient version (0.13?) this was actually possible. That it was removed means that it's unlikely to come back. It was probably removed to reduce network traffic.