Flint and steel

Post Reply
User avatar
jordan4ibanez
Member
Posts: 1895
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez
Location: Rhode Island, USA

Flint and steel

by jordan4ibanez » Post

Very simple. You use the flint and steel to light fires, giving some real purpose for fire. I'm sure I will improve on this eventually. Also it would be great if someone could tell me how to add health to a craftitem.
Image
Download: http://ubuntuone.com/50skCvr06V62lclyd4ln6p
Last edited by jordan4ibanez on Mon Apr 16, 2012 07:24, edited 1 time in total.
I've been gone for a long time

User avatar
neko259
Member
Posts: 805
Joined: Sun Jun 19, 2011 06:51

by neko259 » Post

I think I found the new use for matches in my fire mod :3
s3tuPDfUv2IyvXHzPmE31MQvnWULv1zj

User avatar
Ragnarok
Member
Posts: 216
Joined: Thu Mar 22, 2012 12:56
Location: Poland
Contact:

by Ragnarok » Post

Amazing! I've just burned down almost whole jungle. What do you think about crafting recipe like:

nothing, nothing, nothing
sandstone, sandstone, steel_ingot
sandstone, sandstone, steel_ingot

User avatar
MikoMiko
Member
Posts: 16
Joined: Sun Apr 08, 2012 17:41

by MikoMiko » Post

Is there a way to override the definition of the gravel node in {Minetest_Directory}/games/minetest-game/mods/default/init.lua? I'd to like make them give them flint instead of a gravel block sometimes. I added the following to {Minetest_Directory}/mods/minetest/flint_and_steel/init.lua, but much to my disappoint it didn't redefine default:gravel. Is there a way to do this without editing /default/init.lua?

Code: Select all

minetest.register_node("flint_and_steel:gravel", {
    description = "Gravel",
    tile_images = {"default_gravel.png"},
    is_ground_content = true,
    groups = {crumbly=2, falling_node=1},
    drop = {
        max_items = 1,
        items = {
            {
                items = {'flint_and_steel:flint'},
                rarity = 5,
            },
            {

                items = {'default:gravel'},
            }
        }
    },
    sounds = default.node_sound_dirt_defaults({
        footstep = {name="default_gravel_footstep", gain=0.45},
    }),
})

minetest.register_craft({
    output = 'flint_and_steel:flint_and_steel 1',
    recipe = {
        {'default:steel_ingot', '', ''},
        {'', 'flint_and_steel:flint', ''},
    }
})
Last edited by MikoMiko on Thu Apr 19, 2012 02:34, edited 1 time in total.

User avatar
lkjoel
Member
Posts: 779
Joined: Wed Feb 29, 2012 19:27
Location: Gallifrey
Contact:

by lkjoel » Post

Try changing flint_and_steel:gravel to default:gravel, and see what you come up with (hoping it's not an error)
Last edited by lkjoel on Thu Apr 19, 2012 02:39, edited 1 time in total.
My mods: The Nether | Doctor Who (WIP)

I have quit minetest ... again. I am heavily unimpressed by both the game and the community.

User avatar
MikoMiko
Member
Posts: 16
Joined: Sun Apr 08, 2012 17:41

by MikoMiko » Post

Thanks for the suggestion, but I had tried that before posting, it raises the following error. I guess using default:gravel in mods isn't allowed.

Code: Select all

21:41:02: ERROR[main]: ========== ERROR FROM LUA ===========
21:41:02: ERROR[main]: Failed to load and run script from 
21:41:02: ERROR[main]: /home/UserName/Downloads/minetest-git/bin/../mods/minetest/flint_and_steel/init.lua:
21:41:02: ERROR[main]: ...nloads/minetest-git/bin/../builtin/misc_register.lua:62: Name default:gravel does not follow naming conventions: "modname:" or ":" prefix required
21:41:02: ERROR[main]: stack traceback:
21:41:02: ERROR[main]:     [C]: in function 'error'
21:41:02: ERROR[main]:     ...nloads/minetest-git/bin/../builtin/misc_register.lua:62: in function 'check_modname_prefix'
21:41:02: ERROR[main]:     ...nloads/minetest-git/bin/../builtin/misc_register.lua:98: in function 'register_item'
21:41:02: ERROR[main]:     ...nloads/minetest-git/bin/../builtin/misc_register.lua:154: in function 'register_node'
21:41:02: ERROR[main]:     ...st-git/bin/../mods/minetest/flint_and_steel/init.lua:27: in main chunk
21:41:02: ERROR[main]: =======END OF ERROR FROM LUA ========

User avatar
lkjoel
Member
Posts: 779
Joined: Wed Feb 29, 2012 19:27
Location: Gallifrey
Contact:

by lkjoel » Post

yep, I knew it would output an error :S. I'm clueless now
My mods: The Nether | Doctor Who (WIP)

I have quit minetest ... again. I am heavily unimpressed by both the game and the community.

User avatar
jordan4ibanez
Member
Posts: 1895
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez
Location: Rhode Island, USA

by jordan4ibanez » Post

I've been gone for a long time

User avatar
MikoMiko
Member
Posts: 16
Joined: Sun Apr 08, 2012 17:41

by MikoMiko » Post

jordan4ibanez wrote:ehh..works in here https://github.com/jordan4ibanez/Minetest-Ultra
Yeah, but I looked and you had to edit /default/init.lua. I was hoping there would be a way to avoid doing that and override in the mod but that doesn't seem to possible.

User avatar
minecraft64
Member
Posts: 16
Joined: Sun Jul 22, 2012 14:23
Location: Stalker Block!! XD
Contact:

by minecraft64 » Post

when i used the flint mod i had to copy the part of the code that makes it breakable to the mod so it would work
Got Tobuscus?

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

MikoMiko wrote:Is there a way to override the definition of the gravel node in {Minetest_Directory}/games/minetest-game/mods/default/init.lua? I'd to like make them give them flint instead of a gravel block sometimes. I added the following to {Minetest_Directory}/mods/minetest/flint_and_steel/init.lua, but much to my disappoint it didn't redefine default:gravel. Is there a way to do this without editing /default/init.lua?
This is a bit late but you can redefine nodes by setting a : in front of their name:

Code: Select all

minetest.register_node(":default:gravel", {...})

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

jordan4ibanez wrote:Also it would be great if someone could tell me how to add health to a craftitem.

Code: Select all

itemstack:add_wear(65535/[number of uses])

User avatar
leo_rockway
Member
Posts: 211
Joined: Tue Jul 31, 2012 20:37

by leo_rockway » Post

PilzAdam wrote:
MikoMiko wrote:Is there a way to override the definition of the gravel node in {Minetest_Directory}/games/minetest-game/mods/default/init.lua? I'd to like make them give them flint instead of a gravel block sometimes. I added the following to {Minetest_Directory}/mods/minetest/flint_and_steel/init.lua, but much to my disappoint it didn't redefine default:gravel. Is there a way to do this without editing /default/init.lua?
This is a bit late but you can redefine nodes by setting a : in front of their name:

Code: Select all

minetest.register_node(":default:gravel", {...})
Even overriding default:gravel I'm not getting drops of flint... either something is not working or the flint drops are very very very very rare.
Try Skyblock for MineClone 2
Listen to this sound and music pack!

User avatar
cornernote
Member
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Post

awesome mod!

i added a drop from gravel (tested and it works), and also a shapeless craft. grab the code here:
https://github.com/cornernote/minetest-flint_and_steel

please merge my changes back into this code

User avatar
Mito551
Member
Posts: 1271
Joined: Sat Jun 16, 2012 15:03

by Mito551 » Post

i'm using your code to add flint and steel to dwarves. but i'll go a bit other, my way...

User avatar
Mito551
Member
Posts: 1271
Joined: Sat Jun 16, 2012 15:03

by Mito551 » Post

Image
Image

it's dangerous to go alone! take this!

User avatar
jordan4ibanez
Member
Posts: 1895
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez
Location: Rhode Island, USA

by jordan4ibanez » Post

This is the code for flint and strike in fancy game mode

Code: Select all

--The igniter tool
minetest.register_tool("flint_and_strike:flint_and_strike", {
    description = "Flint and Strike",
    inventory_image = "flint_and_steel.png",
    stack_max = 1,
    on_use = function(itemstack, user, pointed_thing)
    if pointed_thing.type=="node" then
        if minetest.env:get_node(pointed_thing.under).name == "torch_plus:torch_unlit" then
            minetest.sound_play("flint", {pos=pointed_thing.under, loop=false})
            node = minetest.env:get_node(pointed_thing.under)
            minetest.env:add_node(pointed_thing.under, {name="torch_plus:torch_lit", param2 = node.param2})
            itemstack:add_wear(1000)
            return itemstack
        else
            if minetest.env:get_node(pointed_thing.above).name == "air" then
                minetest.sound_play("flint", {pos=pointed_thing.under, loop=false})
                itemstack:add_wear(1000)
                minetest.env:add_node(pointed_thing.above, {name="fire:basic_flame"})
                return itemstack
            end
        end
    end
end,
})

minetest.register_craft({
    type = "shapeless",
    output = 'flint_and_strike:flint_and_strike 1',
    recipe = {
        'flint_and_strike:stone_piece',
        'flint_and_strike:flint',
    }
})

minetest.register_craftitem("flint_and_strike:flint", {
    description = "Flint",
    inventory_image = "flint.png",
})

minetest.register_craftitem("flint_and_strike:stone_piece", {
    description = "Stone Piece",
    inventory_image = "stone_piece.png",
})

minetest.register_craft({
    output = 'flint_and_strike:flint',
    recipe = {
        {'default:gravel'},
    }
})
minetest.register_craft({
    output = 'flint_and_strike:flint',
    recipe = {
        {'default:sandstone'},
    }
})
minetest.register_craft({
    output = 'flint_and_strike:flint',
    recipe = {
        {'default:desert_stone'},
    }
})
minetest.register_craft({
    output = 'flint_and_strike:stone_piece',
    recipe = {
        {'default:cobble'},
    }
})
I've been gone for a long time

User avatar
Mito551
Member
Posts: 1271
Joined: Sat Jun 16, 2012 15:03

by Mito551 » Post

isn't it a bit more compex than yours? does it worth it?

User avatar
jordan4ibanez
Member
Posts: 1895
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez
Location: Rhode Island, USA

by jordan4ibanez » Post

Mito551 wrote:isn't it a bit more compex than yours? does it worth it?
i don't understand the first question, and yes, try out fancy game mode to see it in action
I've been gone for a long time

Post Reply

Who is online

Users browsing this forum: Skamiz Kazzarch and 8 guests