[mod] Lighten wielded item [wielded_light]

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Lighten wielded item [wielded_light]

by bell07 » Post

Planned is implementation to the sling mod. Or which kind of throwing did you mean?

User avatar
Phoenixflo44
Member
Posts: 639
Joined: Fri Jul 28, 2017 15:01
In-game: EvilPhoenix
Location: Behind my PC, in Germany

Re: [mod] Lighten wielded item [wielded_light]

by Phoenixflo44 » Post

I mean the mod here but is already good
Spoiler
I hate my life

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Lighten wielded item [wielded_light]

by bell07 » Post

If you throw the torch using Q button down into a cave, the light follow the torch. ;)

User avatar
Phoenixflo44
Member
Posts: 639
Joined: Fri Jul 28, 2017 15:01
In-game: EvilPhoenix
Location: Behind my PC, in Germany

Re: [mod] Lighten wielded item [wielded_light]

by Phoenixflo44 » Post

That I meant otherwise good work.
Spoiler
I hate my life

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Lighten wielded item [wielded_light]

by bell07 » Post

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
Attachments
screenshot_20180508_225448.png
screenshot_20180508_225448.png (320.34 KiB) Viewed 1040 times
screenshot_20180508_225446.png
screenshot_20180508_225446.png (372.27 KiB) Viewed 1040 times

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [mod] Lighten wielded item [wielded_light]

by texmex » Post

You’re modder of the day bell07 <3

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [mod] Lighten wielded item [wielded_light]

by sofar » Post

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.

User avatar
Devy
Member
Posts: 133
Joined: Sat Jan 21, 2017 02:31
GitHub: DevyHeavy
In-game: devy

Re: [mod] Lighten wielded item [wielded_light]

by Devy » Post

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

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Lighten wielded item [wielded_light]

by bell07 » Post

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.

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Lighten wielded item [wielded_light]

by bell07 » Post

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

User avatar
Devy
Member
Posts: 133
Joined: Sat Jan 21, 2017 02:31
GitHub: DevyHeavy
In-game: devy

Re: [mod] Lighten wielded item [wielded_light]

by Devy » Post

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.

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [mod] Lighten wielded item [wielded_light]

by texmex » Post

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!

User avatar
Hamlet
Member
Posts: 766
Joined: Sat Jul 29, 2017 21:09
IRC: H4mlet
In-game: Hamlet
Location: Lombardy, Italy

Re: [mod] Lighten wielded item [wielded_light]

by Hamlet » Post

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?
My repositories: Codeberg.org | My ContentDB's page

Astrobe
Member
Posts: 577
Joined: Sun Apr 01, 2018 10:46

Re: [mod] Lighten wielded item [wielded_light]

by Astrobe » Post

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.
My game? It's Minefall.

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Lighten wielded item [wielded_light]

by bell07 » Post

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

Astrobe
Member
Posts: 577
Joined: Sun Apr 01, 2018 10:46

Re: [mod] Lighten wielded item [wielded_light]

by Astrobe » Post

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)

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Lighten wielded item [wielded_light]

by bell07 » Post

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

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Lighten wielded item [wielded_light]

by bell07 » Post

First post updated

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: [mod] Lighten wielded item [wielded_light]

by sofar » Post

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.

User avatar
Hamlet
Member
Posts: 766
Joined: Sat Jul 29, 2017 21:09
IRC: H4mlet
In-game: Hamlet
Location: Lombardy, Italy

Re: [mod] Lighten wielded item [wielded_light]

by Hamlet » Post

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.
My repositories: Codeberg.org | My ContentDB's page

User avatar
Lord_Vlad
Member
Posts: 112
Joined: Thu Jul 20, 2017 07:58

Re: [mod] Lighten wielded item [wielded_light]

by Lord_Vlad » Post

Geominer had an item that did that, you should look it up an see the code, it may help.

User avatar
Pyrollo
Developer
Posts: 385
Joined: Mon Jan 08, 2018 15:14
GitHub: pyrollo
In-game: Naj
Location: Paris

Re: [mod] Lighten wielded item [wielded_light]

by Pyrollo » Post

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 ?
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [mod] Lighten wielded item [wielded_light]

by texmex » Post

I also thought about that. Torches and lanterns should probably not work under water, but meselamps should.

bell07
Member
Posts: 604
Joined: Sun Sep 04, 2016 15:15
GitHub: bell07

Re: [mod] Lighten wielded item [wielded_light]

by bell07 » Post

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.

eddward
Member
Posts: 12
Joined: Wed Apr 14, 2021 21:47

Re: [mod] Lighten wielded item [wielded_light]

by eddward » Post

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests