Page 1 of 3

[Mod] Torches [3.0.1] [torches]

PostPosted: Sat May 25, 2013 21:31
by BlockMen
Hi everyone,

this mod adds 3D torches to Minetest in two different styles; by default in Minetest style (flames are animated textures).
The second style is Minecraft like, so flames are "animated" by using particles

Minetest styled:
Those torches use the same textures as the 2D torch, so its fully compatible with Texture Packs. By default ceiling torches
are removed and cannot be placed aswell. You can change this behavior by adding "torches_enable_ceiling = true" to your minetest.conf
Furthermore this style is more server traffic friendly, so it is enabled by default

Minecraft styled:
Those torches have a non-animated texture and needs to be supported by Texture Packs (currently most don't support this mod).
"Animation" is done like in Minecraft with particles, which cause (in the current implementation in the Minetest engine)
some amount of traffic and can cause lags at slow connections. The rate and distance when particles are send is configurable
in the first lines of "mc_style.lua". Enable this style by adding "torches_style = minecraft" to your minetest.conf. Note that
the ceiling setting is ignored with this style.

Notice:
Both styles convert existing torches to the new style. Keep in mind that by default ceiling torches get removed !

Depends:
default

Download:
Version 3.0.1: Download (Minetest 0.4.12 and later)

+ older Releases (WTFPL)


License:
LGPL 2.1 (Code) and CC-BY 3.0 (Textures and Meshes/Models)

Other:
Repository: on Github

Please give Feedback and ideas for improvement

PostPosted: Sat May 25, 2013 21:33
by Inocudom
http://forum.minetest.net/viewtopic.php?id=3021
The link above leads to a previous attempt to create 3D torches for Minetest. Maybe it's lantern could prove to be useful?

PostPosted: Sat May 25, 2013 21:39
by BlockMen
Inocudom wrote:http://forum.minetest.net/viewtopic.php?id=3021
The link above leads to a previous attempt to create 3D torches for Minetest. Maybe it's lantern could prove to be useful?


There are one or two more mods that have 3D torches, but none has particles flames, which have IMO alot benefits and also look IMO better.

And this mod will just have torches, nothing else ;)

PostPosted: Sat May 25, 2013 21:46
by Evergreen
Another amazing mod BlockMen! :D

PostPosted: Sun May 26, 2013 12:43
by BlockMen
Evergreen wrote:Another amazing mod BlockMen! :D

thanks.

--

Update: Version 1.1

Changelog:
- Torches on wall dont drop when node under it is digged
- Torches drop directly when not placed on floor or wall
- fixed different other placing bugs

PostPosted: Sun May 26, 2013 14:17
by babe223
http://forum.minetest.net/viewtopic.php?id=3021
My mod has animation of fire so no particle of smoke nor his '-'

PostPosted: Thu Jun 20, 2013 14:31
by AndrOn
These torches are regularly dropping torches items in my world, don't know why. (awesome mod by the way ;)

PostPosted: Thu Jun 20, 2013 18:23
by BlockMen
AndrOn wrote:These torches are regularly dropping torches items in my world, don't know why. (awesome mod by the way ;)


Are the torches dropping "themself" or do they stay and drop items? What version do you use (Minetest and mod)?

PostPosted: Thu Jun 20, 2013 18:59
by rubenwardy
Nice!

PostPosted: Fri Jun 21, 2013 14:37
by MaxCZ
NNNNNNNNNNNNNNNNNNNNNNNNNNNiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiccccccccccccccccccccccccccccceeeeeeeeeeeeeeeeeee

PostPosted: Fri Jun 21, 2013 21:42
by LionsDen
I really like the torches mod. :)

I do have one problem though. I can't place the torches on ceilings. They fall off right away. Placing torches on ceilings, upside down, is the most common way I use torches so it's a little bit of a pain for me. That is the only downside I have seen to the mod so far.

Great work. :)

PostPosted: Sat Jun 22, 2013 08:24
by BlockMen
LionsDen wrote:I do have one problem though. I can't place the torches on ceilings. They fall off right away.


Its a feature, not a bug ;)

PostPosted: Sat Aug 10, 2013 17:21
by CalumMc
Sometimes I see a torch raining dropped items directly under it, resulting in many items. Also if a player places a torch on a door, it actually destroys part of the door. In addition, this mod takes no notice of protection systems, leaving a mess of torches in my spawn. Is there a solution to these problems besides removing the mod? Thanks

PostPosted: Sun Aug 18, 2013 14:18
by BlockMen
CalumMc wrote:Sometimes I see a torch raining dropped items directly under it, resulting in many items. Also if a player places a torch on a door, it actually destroys part of the door. In addition, this mod takes no notice of protection systems, leaving a mess of torches in my spawn. Is there a solution to these problems besides removing the mod? Thanks


Currently i have no idea what is causing this issues, so i guess removing is currently the best solution...

PostPosted: Fri Sep 06, 2013 16:54
by BlockMen
Update. Version 1.2 released

--

accidentally i removed this post, sry

PostPosted: Wed Oct 09, 2013 07:12
by jenova99sephiros
Great mod

PostPosted: Sun Nov 17, 2013 20:54
by Johnyknowhow
Great,
More minecraftest,

PostPosted: Tue Jan 14, 2014 09:31
by Markov
Can you just edit textire to model for default torch? It'll be better!

PostPosted: Tue Jan 14, 2014 14:15
by BlockMen
Markov wrote:Can you just edit textire to model for default torch? It'll be better!


I don't like like the default texture, so my answer is: no.

PostPosted: Thu Jan 16, 2014 05:21
by gsmanners
Is there a way to make this work without the add_particle? I'm not sure, but I think having lots of particles in a really huge cavern would make the game lag a bit.

PostPosted: Thu Jan 16, 2014 13:32
by BlockMen
gsmanners wrote:Is there a way to make this work without the add_particle? I'm not sure, but I think having lots of particles in a really huge cavern would make the game lag a bit.


Well, you can try out if limiting helps. I made a dev-branch on github where flames are only spawned when a player is near torch (13 block by default).

https://github.com/BlockMen/torches/tree/dev

PostPosted: Thu Jan 16, 2014 14:00
by PilzAdam
BlockMen wrote:They have "real" flames

Wouldnt that harm my computer?

PostPosted: Thu Jan 16, 2014 14:21
by Evergreen
PilzAdam wrote:
BlockMen wrote:They have "real" flames

Wouldnt that harm my computer?
In fact, wouldn't that burn down your house?

PostPosted: Thu Jan 16, 2014 14:54
by BlockMen
PilzAdam wrote:
BlockMen wrote:They have "real" flames

Wouldnt that harm my computer?


Hmm...guess why I put the word "real" in quotation marks.

But be a man and try out if they harm your computer ;)

PostPosted: Thu Jan 16, 2014 23:28
by gsmanners
BlockMen wrote:Well, you can try out if limiting helps. I made a dev-branch on github where flames are only spawned when a player is near torch (13 block by default).

https://github.com/BlockMen/torches/tree/dev


Thanks. I'll give that a shot.

PostPosted: Fri Jan 17, 2014 00:42
by Iqualfragile
You made a mistake when redefining the torch, better use this diff:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
diff --git a/init.lua b/init.lua
index ea88ee8..96e0038 100644
--- a/init.lua
+++ b/init.lua
@@ -77,13 +77,8 @@ local function is_wall(wallparam)
 end

 --node_boxes
-minetest.register_craftitem(":default:torch", {
-       description = "Torch",
-       inventory_image = "torches_torch.png",
-       wield_image = "torches_torch.png",
-       wield_scale = {x=1,y=1,z=1+1/16},
-       liquids_pointable = false,
-       on_place = function(itemstack, placer, pointed_thing)
+minetest.override_item("default:torch",{
+       on_place = function(itemstack, placer, pointed_thing)
                if pointed_thing.type ~= "node" or string.find(minetest.env:get_node(pointed_thing.above).name, "torch") then
                        return itemstack
                end
@@ -92,20 +87,18 @@ minetest.register_craftitem(":default:torch", {
                local wdir = minetest.dir_to_wallmounted({x = under.x - above.x, y = under.y - above.y, z = under.z - above.z})
                local u_n = minetest.get_node(under)
                if u_n and not minetest.registered_nodes[u_n.name].walkable then above = under end
-               local u_n = minetest.get_node(above)
+                       local u_n = minetest.get_node(above)
                if u_n and minetest.registered_nodes[u_n.name].walkable then return itemstack end
                if wdir == 1 then
-                       minetest.env:add_node(above, {name = "torches:floor"})
-               else
+                       minetest.env:add_node(above, {name = "torches:floor"})
+               else   
                        minetest.env:add_node(above, {name = "torches:wand", param2 = is_wall(wdir)})
                end
                if not wdir == 0 or not minetest.setting_getbool("creative_mode") then
                        itemstack:take_item()
                end
                return itemstack
-
        end
-
 })

 minetest.register_node("torches:floor", {

PostPosted: Fri Jan 17, 2014 00:50
by gsmanners
Hmm... I was about to say it's working a lot better, although there is still the problem of torches sometimes falling for no apparent reason at times.

Image

I'm a little nuts with the torches here, but I think limiting the add_particle within 13 is a good optimization. I think this many torches would have made me lag quite a bit in the old vesion.

PostPosted: Fri Jan 17, 2014 09:13
by BlockMen
Iqualfragile wrote:You made a mistake when redefining the torch, better use this diff:
[spoiler]
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
diff --git a/init.lua b/init.lua
index ea88ee8..96e0038 100644
--- a/init.lua
+++ b/init.lua
@@ -77,13 +77,8 @@ local function is_wall(wallparam)
 end

 --node_boxes
-minetest.register_craftitem(":default:torch", {
-       description = "Torch",
-       inventory_image = "torches_torch.png",
-       wield_image = "torches_torch.png",
-       wield_scale = {x=1,y=1,z=1+1/16},
-       liquids_pointable = false,
-       on_place = function(itemstack, placer, pointed_thing)
+minetest.override_item("default:torch",{
+       on_place = function(itemstack, placer, pointed_thing)
                if pointed_thing.type ~= "node" or string.find(minetest.env:get_node(pointed_thing.above).name, "torch") then
                        return itemstack
                end
@@ -92,20 +87,18 @@ minetest.register_craftitem(":default:torch", {
                local wdir = minetest.dir_to_wallmounted({x = under.x - above.x, y = under.y - above.y, z = under.z - above.z})
                local u_n = minetest.get_node(under)
                if u_n and not minetest.registered_nodes[u_n.name].walkable then above = under end
-               local u_n = minetest.get_node(above)
+                       local u_n = minetest.get_node(above)
                if u_n and minetest.registered_nodes[u_n.name].walkable then return itemstack end
                if wdir == 1 then
-                       minetest.env:add_node(above, {name = "torches:floor"})
-               else
+                       minetest.env:add_node(above, {name = "torches:floor"})
+               else   
                        minetest.env:add_node(above, {name = "torches:wand", param2 = is_wall(wdir)})
                end
                if not wdir == 0 or not minetest.setting_getbool("creative_mode") then
                        itemstack:take_item()
                end
                return itemstack
-
        end
-
 })

 minetest.register_node("torches:floor", {
[/spoiler]


First: Its no mistake, it the "old" way of redefining.
Second: I will stay at that to allow people with older Minetest versions use this mod to, IMO the "overwrite" function is not necessary at all.


gsmanners wrote:Hmm... I was about to say it's working a lot better, although there is still the problem of torches sometimes falling for no apparent reason at times.

http://i.imgur.com/APxUnvS.jpg

I'm a little nuts with the torches here, but I think limiting the add_particle within 13 is a good optimization. I think this many torches would have made me lag quite a bit in the old vesion.


Ok, thanks for your feedback. I will look for the "dropping"-issue by time and use the limiting in next release then.

PostPosted: Fri Jan 17, 2014 16:27
by Iqualfragile
BlockMen wrote:
Iqualfragile wrote:You made a mistake when redefining the torch, better use this diff:
[spoiler]
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
diff --git a/init.lua b/init.lua
index ea88ee8..96e0038 100644
--- a/init.lua
+++ b/init.lua
@@ -77,13 +77,8 @@ local function is_wall(wallparam)
 end

 --node_boxes
-minetest.register_craftitem(":default:torch", {
-       description = "Torch",
-       inventory_image = "torches_torch.png",
-       wield_image = "torches_torch.png",
-       wield_scale = {x=1,y=1,z=1+1/16},
-       liquids_pointable = false,
-       on_place = function(itemstack, placer, pointed_thing)
+minetest.override_item("default:torch",{
+       on_place = function(itemstack, placer, pointed_thing)
                if pointed_thing.type ~= "node" or string.find(minetest.env:get_node(pointed_thing.above).name, "torch") then
                        return itemstack
                end
@@ -92,20 +87,18 @@ minetest.register_craftitem(":default:torch", {
                local wdir = minetest.dir_to_wallmounted({x = under.x - above.x, y = under.y - above.y, z = under.z - above.z})
                local u_n = minetest.get_node(under)
                if u_n and not minetest.registered_nodes[u_n.name].walkable then above = under end
-               local u_n = minetest.get_node(above)
+                       local u_n = minetest.get_node(above)
                if u_n and minetest.registered_nodes[u_n.name].walkable then return itemstack end
                if wdir == 1 then
-                       minetest.env:add_node(above, {name = "torches:floor"})
-               else
+                       minetest.env:add_node(above, {name = "torches:floor"})
+               else   
                        minetest.env:add_node(above, {name = "torches:wand", param2 = is_wall(wdir)})
                end
                if not wdir == 0 or not minetest.setting_getbool("creative_mode") then
                        itemstack:take_item()
                end
                return itemstack
-
        end
-
 })

 minetest.register_node("torches:floor", {
[/spoiler]


First: Its no mistake, it the "old" way of redefining.
Second: I will stay at that to allow people with older Minetest versions use this mod to, IMO the "overwrite" function is not necessary at all.

It actually has a mistake which i avoided by just overriding one single value: you did not define the torch as diggable at all.
overriding helps do avoid those mistakes, keep up with changes in the original mod and reduce collisions between mods, maybe it would be best to publish two seperate versions of your mod for different minetest versions (you could use mmdb for that).

PostPosted: Fri Jan 17, 2014 17:29
by BlockMen
Iqualfragile wrote:It actually has a mistake which i avoided by just overriding one single value: you did not define the torch as diggable at all.
overriding helps do avoid those mistakes, keep up with changes in the original mod and reduce collisions between mods, maybe it would be best to publish two seperate versions of your mod for different minetest versions (you could use mmdb for that).


I would have been able to just override/add the on_place function before, but i decided to override the complete definition to have a craft item instead. By that i missed that craft item-nodes (or whatever you want call then old torches) are not diggable.

So this mistake would not been prevented since my intention was to to change the definiton at all, not just that particular function.

But thanks for pointing out that old torches are not diggable.