Flint and steel

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

Flint and steel

by jordan4ibanez » Mon Apr 16, 2012 07:23

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.
If you can think it, you can make it.
 

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

by neko259 » Mon Apr 16, 2012 08:06

I think I found the new use for matches in my fire mod :3
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

User avatar
Ragnarok
Member
 
Posts: 213
Joined: Thu Mar 22, 2012 12:56

by Ragnarok » Wed Apr 18, 2012 08:25

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
 

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

by MikoMiko » Thu Apr 19, 2012 02:33

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

lkjoel
Member
 
Posts: 778
Joined: Wed Feb 29, 2012 19:27

by lkjoel » Thu Apr 19, 2012 02:39

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.
 

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

by MikoMiko » Thu Apr 19, 2012 02:42

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

lkjoel
Member
 
Posts: 778
Joined: Wed Feb 29, 2012 19:27

by lkjoel » Thu Apr 19, 2012 02:58

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: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Thu Apr 19, 2012 03:00

If you can think it, you can make it.
 

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

by MikoMiko » Thu Apr 19, 2012 03:04

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

by minecraft64 » Fri Aug 17, 2012 20:57

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

by PilzAdam » Sat Aug 18, 2012 09:40

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:
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
minetest.register_node(":default:gravel", {...})
 

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

by PilzAdam » Sat Aug 18, 2012 09:42

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

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
itemstack:add_wear(65535/[number of uses])
 

leo_rockway
Member
 
Posts: 131
Joined: Tue Jul 31, 2012 20:37

by leo_rockway » Sat Aug 18, 2012 21:52

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

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

by cornernote » Mon Oct 01, 2012 11:50

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 » Mon Oct 01, 2012 14:26

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 » Mon Oct 01, 2012 16:32

Image
Image

it's dangerous to go alone! take this!
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Mon Oct 01, 2012 18:23

This is the code for flint and strike in fancy game mode
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
--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'},
    }
})
If you can think it, you can make it.
 

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

by Mito551 » Mon Oct 01, 2012 18:30

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

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Mon Oct 01, 2012 18:38

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
If you can think it, you can make it.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 5 guests

cron