Page 1 of 2

[MOD 0.12.x] Searching flashlight

Posted: Tue Mar 01, 2016 10:09 pm
by rk84
Type: Mod
Name: Searching flashlight
Description: Makes character turn to direction of selected entity while standing still.
License: MIT
Version: 1.0.0
Release: 2016-03-01
Tested-With-Factorio-Version: 0.12.22
Category: Other
Tags: Flashlight
Download-Url: https://github.com/rk84/searching-flashlight/releases
Website: https://github.com/rk84/searching-flashlight
License
Pictures
Version history

Re: [MOD 0.12.x] Searching flashlight

Posted: Tue Mar 01, 2016 10:18 pm
by Koub
Wow that looks so well thought :)
Hope I'll have to play one day so that I can give it a try :mrgreen:

Re: [MOD 0.12.x] Searching flashlight

Posted: Tue Mar 01, 2016 10:53 pm
by mngrif
This is pretty awesome! Any idea if it breaks multiplayer? It should...

Re: [MOD 0.12.x] Searching flashlight

Posted: Tue Mar 01, 2016 10:58 pm
by Supercheese
Whoah that's pretty neat! :o

Re: [MOD 0.12.x] Searching flashlight

Posted: Wed Mar 02, 2016 10:06 am
by rk84
mngrif wrote:This is pretty awesome! Any idea if it breaks multiplayer? It should...
It should not break in MP. The code doesn't use methods that I know to be unsupported and my 2 client test was successfull.

Re: [MOD 0.12.x] Searching flashlight

Posted: Wed Mar 30, 2016 9:30 pm
by dandielo
Hey there I've just got a small bug with this mod, this occurred in a MP session, when my friend got disconnected, I've quickly checked the code and added an additional check if a player is connected.

Code: Select all

-- Changed this 
if not players[i].vehicle and players[i].selected and players[i].character and not players[i].walking_state.walking then

-- Into this
if players[i].connected and not players[i].vehicle and players[i].selected and players[i].character and not players[i].walking_state.walking then

Re: [MOD 0.12.x] Searching flashlight

Posted: Tue Apr 12, 2016 12:35 pm
by Taehl
I've added this to my game-in-progress. After loading, once it begins to become night (within 30 seconds), I get this error:

Code: Select all

__searching-flashlight__/control.lua:16: Invalid direction
Also, it would be nice if your character lerped to the new angle instead of instantly snapping to it - it would look much smoother.

EDIT) I'm playing 0.12.29, in case that matters.

Re: [MOD 0.12.x] Searching flashlight

Posted: Wed Apr 13, 2016 9:15 am
by rk84
dandielo wrote:Hey there I've just got a small bug with this mod, this occurred in a MP session, when my friend got disconnected, I've quickly checked the code and added an additional check if a player is connected.

Code: Select all

-- Changed this 
if not players[i].vehicle and players[i].selected and players[i].character and not players[i].walking_state.walking then

-- Into this
if players[i].connected and not players[i].vehicle and players[i].selected and players[i].character and not players[i].walking_state.walking then
Thanks.
Taehl wrote:I've added this to my game-in-progress. After loading, once it begins to become night (within 30 seconds), I get this error:

Code: Select all

__searching-flashlight__/control.lua:16: Invalid direction
Also, it would be nice if your character lerped to the new angle instead of instantly snapping to it - it would look much smoother.

EDIT) I'm playing 0.12.29, in case that matters.
I added better clamping. Hoping it will fix that.
I can't make it smoother currently. Has only 8 directions. This must be due to nature of character entity. Walking "direction" is used over Smooth "orientation" unless in combat.

Re: [MOD 0.12.x] Searching flashlight

Posted: Thu Apr 14, 2016 2:26 am
by Taehl
What about the car and tank? They don't snap to the 8 directions. Watching their headlights sweep through the night is awesome and I want the player to do it too. Maybe there's a way to use the orientation thing instead?

Re: [MOD 0.12.x] Searching flashlight

Posted: Thu Apr 14, 2016 10:20 am
by rk84
Taehl wrote:What about the car and tank? They don't snap to the 8 directions. Watching their headlights sweep through the night is awesome and I want the player to do it too. Maybe there's a way to use the orientation thing instead?
Yes, I think that is possible, but it will add some complexity to this simple mod.

Re: [MOD 0.12.x] Searching flashlight

Posted: Wed Sep 07, 2016 11:08 am
by DevilXD
Will this mod get updated ? I'm still using it but something has broke since 0.14 version came out. It was working perfectly in the 0.13 version.

Re: [MOD 0.12.x] Searching flashlight

Posted: Wed Sep 07, 2016 1:05 pm
by aubergine18
I've sent a PR which should fix it, but in interim see if this version works:

https://github.com/aubergine10/searchin ... ee/patch-1

Please leave comment in the PR indicating whether problem is fixed:

https://github.com/rk84/searching-flashlight/pull/2

Re: [MOD 0.12.x] Searching flashlight

Posted: Thu Sep 15, 2016 6:24 pm
by aubergine18
The bug with player rotation is fixed in 0.14.6 viewtopic.php?t=32318

Re: [MOD 0.12.x] Searching flashlight

Posted: Thu Sep 15, 2016 8:38 pm
by rk84
I added 1.1.0 to mod portal.
Thank you for help aubergine18

Re: [MOD 0.12.x] Searching flashlight

Posted: Thu Sep 15, 2016 11:17 pm
by aubergine18
In your `info.json` it might be worth setting more specific factorio version to ensure the bugfix from 0.14.6 is available:

Code: Select all

"factorio_version": "0.14.7"

Re: [MOD 0.12.x] Searching flashlight

Posted: Fri Sep 16, 2016 6:11 am
by DevilXD
aubergine18 wrote:In your `info.json` it might be worth setting more specific factorio version to ensure the bugfix from 0.14.6 is available:
I don't think that variable works like that, rather something like this:

Code: Select all

"factorio_version": "0.14",
"dependencies": ["base >= 0.14.6"],

Re: [MOD 0.12.x] Searching flashlight

Posted: Fri Sep 16, 2016 9:42 am
by rk84
I changed the dependency version number. also removed version number from title. I assume/hope mod portal uses names as IDs.
I'm bit puzzled why ingame mod browser does not show version number, but info.json has it and mod portal site shows it.
ah must be because I run stable 0.13 and release is now only for 0.14. hmm

Re: [MOD 0.12.x] Searching flashlight

Posted: Wed Nov 09, 2016 1:28 am
by GotLag
FYI the mod doesn't work when unzipped, unless you rename the folder to "searching-flashlight_1.1.1"

Also you can streamline the code a bit:

Code: Select all

local dx = player.position.x - player.selected.position.x
local dy = player.selected.position.y - player.position.y
local orientation = (atan2(dx, dy) / pi + 1) / 2
player.character.direction = floor(orientation * 8 + 0.5) % 8
Seems to be a bit faster according to time_used_percent (~0.007 instead of ~0.009 on my computer).

Re: [MOD 0.12.x] Searching flashlight

Posted: Fri May 05, 2017 6:54 pm
by IsaacHeron
I'd love to see this updated for 0.15.

Re: [MOD 0.12.x] Searching flashlight

Posted: Fri May 05, 2017 7:03 pm
by Nexela
Added to picker extended in the next version :P

If you really want it as a stand alone let me know.