[Mod] Light Tool [0.4] [light_tool]

User avatar
Extex
Member
Posts: 244
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

[Mod] Light Tool [0.4] [light_tool]

by Extex » Post

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
Attachments
ugh.gif
ugh.gif (747.55 KiB) Viewed 2222 times
screenshot_20190808_145020.png
screenshot_20190808_145020.png (52.58 KiB) Viewed 2222 times
Last edited by Extex on Thu Nov 28, 2019 02:26, edited 7 times in total.
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: [Mod] Light Tool [light_tool]

by runs » Post

Oh, cool.

CalebJ
Member
Posts: 407
Joined: Sat Dec 29, 2018 19:21
GitHub: KaylebJay
IRC: KaylebJay
In-game: CalebJ
Location: Tunnelers' Abyss

Re: [Mod] Light Tool [light_tool]

by CalebJ » Post

This is interesting, might be of use on servers if it isn't too laggy. Good first mod! :D

User avatar
MCL
Member
Posts: 654
Joined: Mon Aug 20, 2018 00:44
GitHub: MCLx86
IRC: migdyn
In-game: singleplayer
Contact:

Re: [Mod] Light Tool [light_tool]

by MCL » Post

As I can see, it works by placing invisible nodes that emit light and then destroying them after 100 ms. Nice mod.
2014-02-14 - 2024-02-14 TEN YEARS OF MCL

Red_King_Cyclops
Member
Posts: 324
Joined: Sun Jun 16, 2019 20:17
Location: x=123, y=120, z=534

Re: [Mod] Light Tool [light_tool]

by Red_King_Cyclops » Post

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.
Currently working on new mods.

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: [Mod] Light Tool [light_tool]

by TumeniNodes » Post

Hey, this is pretty neat and useful. Nice job.
Should be using mod.conf though and eliminate the depends.txt and description.txt
A Wonderful World

User avatar
Extex
Member
Posts: 244
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

Re: [Mod] Light Tool [light_tool]

by Extex » Post

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
Last edited by Extex on Thu Oct 31, 2019 18:44, edited 1 time in total.
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

User avatar
TumeniNodes
Member
Posts: 2941
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: [Mod] Light Tool [light_tool]

by TumeniNodes » Post

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.)
A Wonderful World

User avatar
Codesound
Member
Posts: 365
Joined: Thu Jun 09, 2016 14:56

Re: [Mod] Light Tool [light_tool]

by Codesound » Post

Awesome!!!!! Many and Many thanks!!!

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

R

User avatar
Extex
Member
Posts: 244
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

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

by Extex » Post

Added underwater compatibility and technic flashlight redo
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

User avatar
Extex
Member
Posts: 244
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

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

by Extex » Post

Fixed falling block replacement bug
Currently experimental may be unstable
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

User avatar
benrob0329
Member
Posts: 1341
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
IRC: benrob0329
In-game: benrob03
Location: Michigan
Contact:

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

by benrob0329 » Post

Couldn't you also use VoxelManip to set the light levels for the nodes in front of the player?

User avatar
Extex
Member
Posts: 244
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

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

by Extex » Post

You can do that?
I'll look into it
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

neoh4x0r
Member
Posts: 82
Joined: Wed Aug 29, 2018 20:16
GitHub: neoh4x0r

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

by neoh4x0r » Post

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

neoh4x0r
Member
Posts: 82
Joined: Wed Aug 29, 2018 20:16
GitHub: neoh4x0r

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

by neoh4x0r » Post

[removed -- seems the edited version got posted instead of updating this comment]
Last edited by neoh4x0r on Mon Aug 12, 2019 07:57, edited 1 time in total.

neoh4x0r
Member
Posts: 82
Joined: Wed Aug 29, 2018 20:16
GitHub: neoh4x0r

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

by neoh4x0r » Post

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.

User avatar
Extex
Member
Posts: 244
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

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

by Extex » Post

Read the spoiler labeled technic flashlight
It's mostly for a friend of mine who wanted support for the technic flashlight
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

User avatar
Extex
Member
Posts: 244
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

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

by Extex » Post

Fixed bug accidentally implement when adding register_glow_node
All downloaders please get the latest update since previous release was broken
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

Red_King_Cyclops
Member
Posts: 324
Joined: Sun Jun 16, 2019 20:17
Location: x=123, y=120, z=534

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

by Red_King_Cyclops » Post

Thanks for adding fluid support. An underwater light tool is very useful for deep sea exploration.
Currently working on new mods.

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

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

by ShadMOrdre » Post

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

Red_King_Cyclops
Member
Posts: 324
Joined: Sun Jun 16, 2019 20:17
Location: x=123, y=120, z=534

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

by Red_King_Cyclops » Post

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.
Currently working on new mods.

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

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

by ShadMOrdre » Post

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

User avatar
Extex
Member
Posts: 244
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

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

by Extex » Post

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
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

User avatar
Extex
Member
Posts: 244
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

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

by Extex » Post

1.8k downloads on contentDB!
Last edited by Extex on Sat Mar 11, 2023 23:57, edited 8 times in total.
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

User avatar
Extex
Member
Posts: 244
Joined: Wed Mar 14, 2018 23:14
GitHub: Extex101
In-game: Extex

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

by Extex » Post

--removed--
Creator of jelys_pizzaria and motorbike, and player of persistent kingdoms. RIP

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests