Page 1 of 2

[Mod] Light Tool [0.4] [light_tool]

Posted: Thu Aug 08, 2019 22:40
by Extex
My First MOD!!!

Image

Light Tool adds a point-able beam of light like a Torch/Flashlight

Currently untested on high traffic servers (Though it should be fine)

This mod also adds an API to make your own

e.g

Code: Select all

light_tool.add_tool("my_mod:light_tool", 25)--First param: The name of your item, Second param: The range of the light beam

light_tool.light_beam(pos, dir, range)--First param: The start position of the beam, Second Param: The direction the beam is pointed, Third param: The max distance the beam can travel

light_tool.register_glow_node(nodename)--Registers a duplicate of the specified node that glows and behaves identically to the light beam (Used for light beams within water)
Animated gif.

Image
Spoiler
Replace the technic flashlight.lua with the flashlight.lua provided in mod to make it function with the technic flashlight

Also add light_tool to depends of technic mod
Spoiler
• Fix falling blocks glitch (help wanted)

Make it functional within liquids--done
License: Code (MIT), Texture (CC BY-SA 3.0)

Optional dependencies: default (for the crafting, and underwater lights)

Browse code: https://github.com/Extex101/light_tool

Download: https://github.com/Extex101/light_tool/ ... master.zip

Re: [Mod] Light Tool [light_tool]

Posted: Thu Aug 08, 2019 22:44
by runs
Oh, cool.

Re: [Mod] Light Tool [light_tool]

Posted: Thu Aug 08, 2019 23:22
by CalebJ
This is interesting, might be of use on servers if it isn't too laggy. Good first mod! :D

Re: [Mod] Light Tool [light_tool]

Posted: Fri Aug 09, 2019 09:00
by MCL
As I can see, it works by placing invisible nodes that emit light and then destroying them after 100 ms. Nice mod.

Re: [Mod] Light Tool [light_tool]

Posted: Fri Aug 09, 2019 13:55
by Red_King_Cyclops
Cool and useful mod. If you are interested in expanding this mod, I suggest adding in another light tool that works underwater.

Edit: I just realized that making the light tool work in fluids is already on your todo list.

Re: [Mod] Light Tool [light_tool]

Posted: Fri Aug 09, 2019 18:27
by TumeniNodes
Hey, this is pretty neat and useful. Nice job.
Should be using mod.conf though and eliminate the depends.txt and description.txt

Re: [Mod] Light Tool [light_tool]

Posted: Fri Aug 09, 2019 22:47
by Extex
runs thanks

CalebJ thanks if you could do a server test that'd be great!

Red_King_Cyclops Yeah XD I'm working on it right now

TumeniNodes: What do you mean? Could you give an example

Re: [Mod] Light Tool [light_tool]

Posted: Fri Aug 09, 2019 23:54
by TumeniNodes
Instead of a 'depends.txt' , you will use a file called 'mod.conf'

In the mod.conf file add:

name = light_tool
depends = only add this line if the mod has a hard dep
optional_depends = default
description = brief desc here

remove the 'description.txt' file, and add the more detailed description of the mod to your README.md file

The depends and description files are deprecated, and being phased out.
Everything they did can be handled within a mod.conf and README.md files.
(I need to go through and make those changes in my mods, too, but I procrastinate.)

Re: [Mod] Light Tool [light_tool]

Posted: Sat Aug 10, 2019 15:20
by Codesound
Awesome!!!!! Many and Many thanks!!!

At this point I believe that the RGB spot lamp for fixed installation are possible... or?

R

Re: [Mod] Light Tool [0.3] [light_tool]

Posted: Mon Aug 12, 2019 01:46
by Extex
Added underwater compatibility and technic flashlight redo

Re: [Mod] Light Tool [0.3] [light_tool]

Posted: Mon Aug 12, 2019 02:23
by Extex
Fixed falling block replacement bug
Currently experimental may be unstable

Re: [Mod] Light Tool [0.3] [light_tool]

Posted: Mon Aug 12, 2019 02:41
by benrob0329
Couldn't you also use VoxelManip to set the light levels for the nodes in front of the player?

Re: [Mod] Light Tool [0.3] [light_tool]

Posted: Mon Aug 12, 2019 05:19
by Extex
You can do that?
I'll look into it

Re: [Mod] Light Tool [0.3] [light_tool]

Posted: Mon Aug 12, 2019 07:41
by neoh4x0r
Extex wrote:Added underwater compatibility and technic flashlight redo
I just opended a issue on the github page: https://github.com/Extex101/light_tool/issues/1

You should probably add the technic mod as a dependency in mod.conf (since flashlight.lua uses items and methods from it for recipes and RE batteries).

Re: [Mod] Light Tool [0.3] [light_tool]

Posted: Mon Aug 12, 2019 07:52
by neoh4x0r
[removed -- seems the edited version got posted instead of updating this comment]

Re: [Mod] Light Tool [0.3] [light_tool]

Posted: Mon Aug 12, 2019 07:56
by neoh4x0r
benrob0329 wrote:Couldn't you also use VoxelManip to set the light levels for the nodes in front of the player?
Extex wrote:You can do that?
I'll look into it
Yes you could use VoxelManip https://dev.minetest.net/VoxelManip

Code: Select all

get_light_data() 
set_light_data(light_data)
The Voxel Manipulator can be used to set many nodes in a specified area at once, which is useful to avoid unnecessary calculations.
It will want to load an entire mapblock or region within a given area, and as such, it probably is not practical for setting the lighting of a few nodes in-front of the player.

Re: [Mod] Light Tool [0.3] [light_tool]

Posted: Mon Aug 12, 2019 17:35
by Extex
Read the spoiler labeled technic flashlight
It's mostly for a friend of mine who wanted support for the technic flashlight

Re: [Mod] Light Tool [0.4] [light_tool]

Posted: Tue Aug 13, 2019 23:04
by Extex
Fixed bug accidentally implement when adding register_glow_node
All downloaders please get the latest update since previous release was broken

Re: [Mod] Light Tool [0.4] [light_tool]

Posted: Wed Aug 14, 2019 21:00
by Red_King_Cyclops
Thanks for adding fluid support. An underwater light tool is very useful for deep sea exploration.

Re: [Mod] Light Tool [0.4] [light_tool]

Posted: Thu Aug 15, 2019 20:04
by ShadMOrdre
Extex,

This is a really great mod. Makes exploring caves and duanes geomoria far more creepy.

One issue, one feature. Maybe.

When standing next to any node, like with my side up against a cave wall, even when pointing into completely open space, the light beam goes dark.

Since flashlights are useless in broad daylight, and the corresponding processing to make this effect possible in game, would it at all be possible to disable the flashlight beam, ie turn off the flashlight, when the light levels around the player are at a higher level than the flashlight emits.

I notice lag when I have the flashlight active in my hand, while walking on the surface during the day. It would seem that the flashlight continues to emit it's light beam, when maybe it shouldn't.

Again, thanks for the awesome mod. I've been wanting this for a LONG time. I can't sling a torch, and have the light stick when the torch lands. It lights up while being thrown, but then goes dark. This is unsettling in a dark cave.

Shad

Re: [Mod] Light Tool [0.4] [light_tool]

Posted: Thu Aug 15, 2019 21:04
by Red_King_Cyclops
ShadMOrdre wrote:Extex,

This is a really great mod. Makes exploring caves and duanes geomoria far more creepy.

One issue, one feature. Maybe.

When standing next to any node, like with my side up against a cave wall, even when pointing into completely open space, the light beam goes dark.

Since flashlights are useless in broad daylight, and the corresponding processing to make this effect possible in game, would it at all be possible to disable the flashlight beam, ie turn off the flashlight, when the light levels around the player are at a higher level than the flashlight emits.

I notice lag when I have the flashlight active in my hand, while walking on the surface during the day. It would seem that the flashlight continues to emit it's light beam, when maybe it shouldn't.

Again, thanks for the awesome mod. I've been wanting this for a LONG time. I can't sling a torch, and have the light stick when the torch lands. It lights up while being thrown, but then goes dark. This is unsettling in a dark cave.

Shad
I noticed from the API that the light tool has a limit to the length of the light beam it emits, which is not entirely realistic.

Technically, with the wielded_light mod and the sling mod, you can sling torches across caverns and have them emit light the entire time.

Re: [Mod] Light Tool [0.4] [light_tool]

Posted: Thu Aug 15, 2019 22:41
by ShadMOrdre
Now that I think a little more, maybe a simple state based tool.

In on_place, you can easily enable/disable the beam. Effectively, an on/off switch. Might be far easier to code than determining light levels and such.

Another feature, within the state based tool concept, is to use a state as config, and allowing players to alter the strength of the light-source and length of light beam. It would be nice to switch to a higher powered light beam to shine further on in larger caves and dungeons, while enabling shorter beams for smaller spaces. All this allows some control over lag, while empowering this tool much further.

Red_King,

I use the slingshot and wielded_light mods, and they still serve a very valid purpose. My only issue, is that the light is so fleeting, in that if there is lag, the light may or may not show. When the torch lands, it becomes an item entity, so if you fire too many, you add to the lag. I'd like to see them sticky when landing, thus enabling lighting on demand. But that's best left to discussing in those topics.

Shad

Re: [Mod] Light Tool [0.4] [light_tool]

Posted: Fri Aug 16, 2019 04:47
by Extex
Variable distances? Not sure about that one. I made a less laggy version under the spark-edition branch that only places blocks at the very end and right in front of the player

On/Off? Just scroll onto something else

Re: [Mod] Light Tool [0.4] [light_tool]

Posted: Mon Aug 26, 2019 18:19
by Extex
1.8k downloads on contentDB!

Re: [Mod] Light Tool [0.4] [light_tool]

Posted: Mon Sep 30, 2019 23:32
by Extex
--removed--