[MOD 0.12.x] Searching flashlight

Topics and discussion about specific mods
User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

[MOD 0.12.x] Searching flashlight

Post by rk84 » Tue Mar 01, 2016 10:09 pm

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
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela

Koub
Global Moderator
Global Moderator
Posts: 4801
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by Koub » Tue Mar 01, 2016 10:18 pm

Wow that looks so well thought :)
Hope I'll have to play one day so that I can give it a try :mrgreen:
Koub - Please consider English is not my native language.

User avatar
mngrif
Fast Inserter
Fast Inserter
Posts: 171
Joined: Wed Feb 13, 2013 10:44 am
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by mngrif » Tue Mar 01, 2016 10:53 pm

This is pretty awesome! Any idea if it breaks multiplayer? It should...
Some Stuff About Stuff And Things || My Silly Factorian Tricks
<_aD> OBSERVE SIGNAL ASPECT BEFORE CROSSING TRACK


User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by rk84 » Wed Mar 02, 2016 10:06 am

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.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela

User avatar
dandielo
Burner Inserter
Burner Inserter
Posts: 11
Joined: Wed Mar 30, 2016 9:25 pm
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by dandielo » Wed Mar 30, 2016 9:30 pm

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
Resurrecting DyTech's Mods, more about this Here!

User avatar
Taehl
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sun Jan 18, 2015 2:23 am
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by Taehl » Tue Apr 12, 2016 12:35 pm

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.

User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by rk84 » Wed Apr 13, 2016 9:15 am

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.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela

User avatar
Taehl
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sun Jan 18, 2015 2:23 am
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by Taehl » Thu Apr 14, 2016 2:26 am

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?

User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by rk84 » Thu Apr 14, 2016 10:20 am

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.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela

DevilXD
Fast Inserter
Fast Inserter
Posts: 210
Joined: Tue Aug 12, 2014 10:47 am
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by DevilXD » Wed Sep 07, 2016 11:08 am

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.

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by aubergine18 » Wed Sep 07, 2016 1:05 pm

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
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by aubergine18 » Thu Sep 15, 2016 6:24 pm

The bug with player rotation is fixed in 0.14.6 viewtopic.php?t=32318
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by rk84 » Thu Sep 15, 2016 8:38 pm

I added 1.1.0 to mod portal.
Thank you for help aubergine18
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by aubergine18 » Thu Sep 15, 2016 11:17 pm

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"
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

DevilXD
Fast Inserter
Fast Inserter
Posts: 210
Joined: Tue Aug 12, 2014 10:47 am
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by DevilXD » Fri Sep 16, 2016 6:11 am

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"],

User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by rk84 » Fri Sep 16, 2016 9:42 am

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
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela

GotLag
Filter Inserter
Filter Inserter
Posts: 510
Joined: Sat May 03, 2014 3:32 pm
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by GotLag » Wed Nov 09, 2016 1:28 am

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).

IsaacHeron
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Mar 01, 2016 4:03 pm
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by IsaacHeron » Fri May 05, 2017 6:54 pm

I'd love to see this updated for 0.15.

Nexela
Smart Inserter
Smart Inserter
Posts: 1815
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [MOD 0.12.x] Searching flashlight

Post by Nexela » Fri May 05, 2017 7:03 pm

Added to picker extended in the next version :P

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

Post Reply

Return to “Mods”

Who is online

Users browsing this forum: No registered users