Page 2 of 3

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue May 08, 2018 16:22
by bell07
Planned is implementation to the sling mod. Or which kind of throwing did you mean?

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue May 08, 2018 16:24
by Phoenixflo44
I mean the mod here but is already good

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue May 08, 2018 16:33
by bell07
If you throw the torch using Q button down into a cave, the light follow the torch. ;)

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue May 08, 2018 16:38
by Phoenixflo44
That I meant otherwise good work.

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue May 08, 2018 20:57
by bell07
Enhanced throwing mod: https://github.com/minetest-mods/throwing/pull/16
Using enhanced version the shining for throwed items using https://github.com/minetest-mods/sling works out of the box
Image
Image

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue May 08, 2018 21:04
by texmex
You’re modder of the day bell07 <3

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue May 08, 2018 21:16
by sofar
bell07 wrote: 2. krondor registers only 1 helper node with light level 14. So krondors light is brighter, but with static brightness at maximum 14. My mod registers nodes 1-11. It is more dim but according the brightness of the wielded item.
suggestions:

I prefer to have a wielded item that is 2-3 levels darker than the placed thing, otherwise it's just too easy to always walk around with a lamp or torch all the time.

Also, having 1 node for each light level is not really needed, you can probably do a node for all the odd light levels, so you'd only have 6 nodes: 11, 9, 7, 5, 3 and 1. This won't change much visibly anyway.

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue May 08, 2018 21:25
by Devy
Just thought I'd put this out there. I implemented a similar thing for throwing lit items in my Geominer mod. Here's a glowstick being dropped but there is also one for throwing with your hand: Image

Geominer: viewtopic.php?f=9&t=17771

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue May 08, 2018 21:27
by bell07
sofar wrote:I prefer to have a wielded item that is 2-3 levels darker than the placed thing, otherwise it's just too easy to always walk around with a lamp or torch all the time.
The current setting is 2 levels darker. It is just 1 code line to change them

Code: Select all

local level_delta = 2
sofar wrote:Also, having 1 node for each light level is not really needed, you can probably do a node for all the odd light levels, so you'd only have 6 nodes: 11, 9, 7, 5, 3 and 1. This won't change much visibly anyway.
In the meantime the wielded_light registers all 1-14 nodes because of the level could be set manually using wielded_light.register_item_light().
I do not think to save 8 node definitions does an performance boost. Other mods defines > 100 items oO. I do not see the reason to support an other light levels count then mintest engine does.

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue May 08, 2018 21:36
by bell07
Devy wrote:Just thought I'd put this out there. I implemented a similar thing for throwing lit items in my Geominer mod.
I did not know that. Looking to the code....

The difference is my mod uses nodetimers to remove the shining node, and does not have flickering if different light sources are in the same coordinates, and also check if shining is neccessary reading current node light level...

Re: [mod] Lighten wielded item [wielded_light]

Posted: Wed May 09, 2018 02:04
by Devy
bell07 wrote:
Devy wrote:Just thought I'd put this out there. I implemented a similar thing for throwing lit items in my Geominer mod.
I did not know that. Looking to the code....

The difference is my mod uses nodetimers to remove the shining node, and does not have flickering if different light sources are in the same coordinates, and also check if shining is neccessary reading current node light level...
Yeah, I looked at your code and it seems way better than what I did. Good job!

In fact, I may use this instead of what I did.

Re: [mod] Lighten wielded item [wielded_light]

Posted: Wed May 09, 2018 09:12
by texmex
I always liked your idea Devy, but applying the effect to any (existing) item is what I really need, instead of new single-purpose items. (Q-dropped torch replaces droppable glowstick, sling-thrown torch replaces throwable glowstick). Multi-purpose ftw!

Re: [mod] Lighten wielded item [wielded_light]

Posted: Wed May 09, 2018 10:31
by Hamlet
bell07 wrote:Idea taken from torches_wieldlight in https://github.com/minetest-mods/torches, but written from scratch and usable for all shining items.[...]
Reading this thread I've noticed that the mod relies on placing and removing invisible light blocks; I've tried this kind of solution using Hardcore torchs by BrunoMine and I've found that this approach has one issue.

If the invisible light block is placed under a falling node (sand, gravel, etc.) when the said light block is removed it triggers the fall of the nodes above.

Recently I've discovered Opposite Torch by Atreela which relies on "minetest.fix_light": instead of placing invisible nodes it updates the surrounding nodes' light level.

Do you think that it could be used in your mod?

Re: [mod] Lighten wielded item [wielded_light]

Posted: Wed May 09, 2018 10:38
by Astrobe
The attenuation is nice to have, but users should consider weakening the torch itself because it has several positive side effects in my opinion - at least for survival games. And you don't have to "explain" why wielded torches are weaker than wall-mounted ones.

I was worried too before testing this mod that it would make static lights useless, but because my torches were already level 10 -bright, the handheld torches only let you see one or two blocks around.

Re: [mod] Lighten wielded item [wielded_light]

Posted: Wed May 09, 2018 11:31
by bell07
Hamlet wrote:If the invisible light block is placed under a falling node (sand, gravel, etc.) when the said light block is removed it triggers the fall of the nodes above.
Tried shortly and the issue does not appear in wielded_item. I use minetest.swap_node() to remove the block, that does not trigger falling nodes.
Hamlet wrote:Recently I've discovered Opposite Torch by Atreela which relies on "minetest.fix_light": instead of placing invisible nodes it updates the surrounding nodes' light level.
Interessting, I search for an other solution then placing blocks, because I can re-place only the air by shining node. Therefore the shining does not work on stairs, snow, ladders and other "nearly empty nodes".
But how I can set the light level using minetest.fix_light(pos1, pos2)?
Astrobe wrote:I was worried too before testing this mod that it would make static lights useless, but because my torches were already level 10 -bright, the handheld torches only let you see one or two blocks around.
That was the reason why I implemented attenuation, the placing torches should not gets obsolete by this mod. And about realizm: How the shining should be if you wield 99-torches-stack?

PS: If you have issues with to bright items in your subgame (like meselamp) you can override the value using wielded_light.register_item_light(itemname, light_level)
So it is possible to leave meselamp with placed light_level 14 as is, but set wielded item shining to light_level=1

Re: [mod] Lighten wielded item [wielded_light]

Posted: Wed May 09, 2018 12:09
by Astrobe
bell07 wrote:But how I can set the light level using minetest.fix_light(pos1, pos2)?
Actually the real "unlight" is done by make_darkness() or darken_place(), which looks like a heavy process. The author uses some sort of trick not to do it on every activation of the ABM (once per second).
bell07 wrote:That was the reason why I implemented attenuation, the placing torches should not gets obsolete by this mod. And about realizm: How the shining should be if you wield 99-torches-stack?
I don't think light is additive in Minetest, that's why we can't have lazors :-D (Archimedes' Death Ray mod? make a mirror from glass and tin, surround it with eight mese lights, watch the cows burn)

Re: [mod] Lighten wielded item [wielded_light]

Posted: Wed May 09, 2018 12:51
by bell07
Astrobe wrote:Actually the real "unlight" is done by make_darkness() or darken_place(), which looks like a heavy process. The author uses some sort of trick not to do it on every activation of the ABM (once per second).
Looked to the code, it is really a lot of woodo appears, for an area 30x30x30 the light calculation is done manually in lua each second. It is a hack, therefore to reset a "fix" function is needed. For a not moved object it is maybe ok, but the wielded_light requires a lightwight way to "smooth move" the light source if player or item moves. The current setting is update each 0.2 seconds with minimum shining duration x3. The trick I use is to reset the nodetimer if the helper node already in place and should continue shining. So the full node replacement is really on demand only.

But my way is not possible to take opposite shining ...

Re: [mod] Lighten wielded item [wielded_light]

Posted: Thu May 10, 2018 09:09
by bell07
First post updated

Re: [mod] Lighten wielded item [wielded_light]

Posted: Mon May 14, 2018 20:40
by sofar
Hamlet wrote: If the invisible light block is placed under a falling node (sand, gravel, etc.) when the said light block is removed it triggers the fall of the nodes above.
This can be avoided. Not sure if `swap_node` avoids the update, but a vmanip will for sure.

Manually updating the entire light map is likely more expensive.

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue May 15, 2018 22:33
by Hamlet
sofar wrote:
Hamlet wrote: If the invisible light block is placed under a falling node (sand, gravel, etc.) when the said light block is removed it triggers the fall of the nodes above.
This can be avoided. Not sure if `swap_node` avoids the update, but a vmanip will for sure.

Manually updating the entire light map is likely more expensive.
I've checked both mods for the issue that I've mentioned, none of them has it.

Re: [mod] Lighten wielded item [wielded_light]

Posted: Thu May 24, 2018 17:12
by Lord_Vlad
Geominer had an item that did that, you should look it up an see the code, it may help.

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue Sep 04, 2018 13:09
by Pyrollo
Hi,

Using wielded_light I was wondering if it would be easy to make it work also under water.

Have you already considered that ? Have you encountered any obstacle that prevents to do it so ?

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue Sep 04, 2018 18:12
by texmex
I also thought about that. Torches and lanterns should probably not work under water, but meselamps should.

Re: [mod] Lighten wielded item [wielded_light]

Posted: Tue Sep 04, 2018 21:00
by bell07
Mod Update!

Add search for alternative positions if current position is not air, like the newcomer "ilumination" mod does.

Played around shininig in water with same logic. Does flacker, in minetest 0.4.17.1, did not tested with Minetest-5.0.0.
Not merged to master because of this issues, but available for testing in https://github.com/minetest-mods/wielde ... ater_shine branch.

Re: [mod] Lighten wielded item [wielded_light]

Posted: Sun Apr 25, 2021 23:04
by eddward
Hi. I'm curious what state the underwater support is in and how hard it might be for a complete noob to pick up?

I assumed that the light going out under water was intentional, because torches/fire, but got annoyed when I was using glow glass. I noticed the ladder thing too, but it hadn't quite sunk in that there was a technical issue involving non-air nodes.