Re: [Mod] Carts [carts]

PilzAdam wrote:

(...)
But I dont want to add this. I want some sounds that are played randomly.

As you wish. I just care about realistic sound.

Besides, there is nothing to stand in the way the default soundtrack consisted of randomly generated sounds while other sounds are played after the discovery of appropriate events.

Re: [Mod] Carts [carts]

Ragnarok wrote:
PilzAdam wrote:

(...)
But I dont want to add this. I want some sounds that are played randomly.

As you wish. I just care about realistic sound.

Besides, there is nothing to stand in the way the default soundtrack consisted of randomly generated sounds while other sounds are played after the discovery of appropriate events.

Yes i know but i like the sounds as they are.

Re: [Mod] Carts [carts]

Is it possible to store the items in the cart as inventory?  It looks strange with the items teleporting around...

Games: The Hungry Games.
Mods: Snow Biomes and Gates.
Also checkout my texture pack Gridtoon!

Re: [Mod] Carts [carts]

Splizard wrote:

Is it possible to store the items in the cart as inventory?  It looks strange with the items teleporting around...

No its not possible.

Re: [Mod] Carts [carts]

PilzAdam wrote:

This is realy strange because in line 390 if init.lua the method is_player() is not used. Try redownload.

I tried redownloading it but It still had the error

Are there any other cart mods?

Re: [Mod] Carts [carts]

graphics boy wrote:
PilzAdam wrote:

This is realy strange because in line 390 if init.lua the method is_player() is not used. Try redownload.

I tried redownloading it but It still had the error

Are there any other cart mods?

Could you please post the error message again. It is not possible that the error is in line 390 of init.lua
There is a vehicles mod but it is laggy.

Re: [Mod] Carts [carts]

ServerError: LuaError: error running function 'on_rightclick':
...v-20120606-win32\bin\..\mods\minetest\carts\init.lua:727: attempt to call
method 'is_player' (a nil value)

Re: [Mod] Carts [carts]

graphics boy wrote:

ServerError: LuaError: error running function 'on_rightclick':
...v-20120606-win32\bin\..\mods\minetest\carts\init.lua:727: attempt to call
method 'is_player' (a nil value)

Do you have latest version (29) of carts installed?
Do you have latest version (0.4.2-rc1) of minetest installed?

Re: [Mod] Carts [carts]

version 28 of carts
version 0.4.dev of minetest

Re: [Mod] Carts [carts]

graphics boy wrote:

version 0.4.dev of minetest

Wich 0.4.dev (0.4.2-rc1 is latest)?

Re: [Mod] Carts [carts]

Minetest-c55 0.4.dev-20120606

Re: [Mod] Carts [carts]

graphics boy wrote:

Minetest-c55 0.4.dev-20120606

This is maybe too old. Try a newer version.

Re: [Mod] Carts [carts]

The carts are now 3D.

Re: [Mod] Carts [carts]

I think I may have some input. n.n The minecarts in Minecraft were rectangular boxes, and these are square. Now, let me just say that I don't really care about the shape, but I was considering some general ideas about the carts:

Make 3 points within a rectangular minecart.
<back point (follows track)><player point(stays between the back and front points)><front point (follows track)>

Doing this could (in theory) make a smoother looking minecart, and possibly eliminate some of the lag in the cart's player movement. Just an idea, but thought it might come in handy.

Re: [Mod] Carts [carts]

aFoxNamedMorris wrote:

I think I may have some input. n.n The minecarts in Minecraft were rectangular boxes, and these are square. Now, let me just say that I don't really care about the shape, but I was considering some general ideas about the carts:

Make 3 points within a rectangular minecart.
<back point (follows track)><player point(stays between the back and front points)><front point (follows track)>

Doing this could (in theory) make a smoother looking minecart, and possibly eliminate some of the lag in the cart's player movement. Just an idea, but thought it might come in handy.

This wouldnt fix the lag when transporting players. Its an engine thing and I cant fix that in my mod.

Re: [Mod] Carts [carts]

Awr... :< Well, would the points at least make a rotating, elongated cart?

Re: [Mod] Carts [carts]

aFoxNamedMorris wrote:

Awr... :< Well, would the points at least make a rotating, elongated cart?

The cart is roatating but you dont see it. You can change the visuals of the cart by changing the nodebox in box.lua

Re: [Mod] Carts [carts]

PilzAdam wrote:
aFoxNamedMorris wrote:

Awr... :< Well, would the points at least make a rotating, elongated cart?

The cart is roatating but you dont see it. You can change the visuals of the cart by changing the nodebox in box.lua

Ooh! Thanks a ton! ^-^

119 (edited by tinoesroho 2012-08-14 03:48:22)

Re: [Mod] Carts [carts]

Hey PilzAdam,

I've been playing around with code and I've developed an "automated" furnace that allows the cart to drop stuff into it.

-- Based on celeron55's furnace
minetest.register_craft({
    output = 'carts:furnace',
    recipe = {
        {'default:cobble', 'default:cobble', 'default:cobble'},
        {'default:cobble', 'default:cobble', 'default:cobble'},
        {'default:cobble', 'default:cobble', 'default:cobble'},
    }
})

default.furnace_inactive_formspec =
    "invsize[8,9;]"..
    "image[2,2;1,1;default_furnace_fire_bg.png]"..
    "list[current_name;fuel;2,3;1,1;]"..
    "list[current_name;in;2,1;1,1;]"..
    "list[current_name;dst;5,1;2,2;]"..
    "list[current_player;main;0,5;8,4;]"

minetest.register_node("carts:furnace", {
    description = "Furnace",
    tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
        "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"},
    paramtype2 = "facedir",
    groups = {cracky=2},
    legacy_facedir_simple = true,
    sounds = default.node_sound_stone_defaults(),
    on_construct = function(pos)
        local meta = minetest.env:get_meta(pos)
        meta:set_string("formspec", default.furnace_inactive_formspec)
        meta:set_string("infotext", "Automated Furnace")
        local inv = meta:get_inventory()
        inv:set_size("fuel", 1)
        inv:set_size("in", 4)
        inv:set_size("dst", 9)
    end,
    can_dig = function(pos,player)
        local meta = minetest.env:get_meta(pos);
        local inv = meta:get_inventory()
        if not inv:is_empty("fuel") then
            return false
        elseif not inv:is_empty("dst") then
            return false
        elseif not inv:is_empty("in") then
            return false
        end
        return true
    end,
})

minetest.register_node("carts:furnace_active", {
    description = "Furnace",
    tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png",
        "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front_active.png"},
    paramtype2 = "facedir",
    light_source = 8,
    drop = "carts:furnace",
    groups = {cracky=2},
    legacy_facedir_simple = true,
    sounds = default.node_sound_stone_defaults(),
    on_construct = function(pos)
        local meta = minetest.env:get_meta(pos)
        meta:set_string("formspec", default.furnace_inactive_formspec)
        meta:set_string("infotext", "Automated Furnace");
        local inv = meta:get_inventory()
        inv:set_size("fuel", 1)
        inv:set_size("in", 4)
        inv:set_size("dst", 9)
    end,
    can_dig = function(pos,player)
        local meta = minetest.env:get_meta(pos);
        local inv = meta:get_inventory()
        if not inv:is_empty("fuel") then
            return false
        elseif not inv:is_empty("dst") then
            return false
        elseif not inv:is_empty("in") then
            return false
        end
        return true
    end,
})

function hacky_swap_node(pos,name)
    local node = minetest.env:get_node(pos)
    local meta = minetest.env:get_meta(pos)
    local meta0 = meta:to_table()
    if node.name == name then
        return
    end
    node.name = name
    local meta0 = meta:to_table()
    minetest.env:set_node(pos,node)
    meta = minetest.env:get_meta(pos)
    meta:from_table(meta0)
end

minetest.register_abm({
    nodenames = {"carts:furnace","carts:furnace_active"},
    interval = 1.0,
    chance = 1,
    action = function(pos, node, active_object_count, active_object_count_wider)
        local meta = minetest.env:get_meta(pos)
        for i, name in ipairs({
                "fuel_totaltime",
                "fuel_time",
                "in_totaltime",
                "in_time"
        }) do
            if meta:get_string(name) == "" then
                meta:set_float(name, 0.0)
            end
        end

        local inv = meta:get_inventory()

        local inlist = inv:get_list("in")
        local cooked = nil
       
        if inlist then
            cooked = minetest.get_craft_result({method = "cooking", width = 1, items = inlist})
        end
       
        local was_active = false
       
        if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
            was_active = true
            meta:set_float("fuel_time", meta:get_float("fuel_time") + 1)
            meta:set_float("in_time", meta:get_float("in_time") + 1)
            if cooked and cooked.item and meta:get_float("in_time") >= cooked.time then
                -- check if there's room for output in "dst" list
                if inv:room_for_item("dst",cooked.item) then
                    -- Put result in "dst" list
                    inv:add_item("dst", cooked.item)
                    -- take stuff from "in" list
                    instack = inv:get_stack("in", 1)
                    instack:take_item()
                    inv:set_stack("in", 1, instack)
                else
                    print("Could not insert item'")
                end
                meta:set_string("in_time", 0)
            end
        end
       
        if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then
            local percent = math.floor(meta:get_float("fuel_time") /
                    meta:get_float("fuel_totaltime") * 100)
            meta:set_string("infotext","Furnace active: "..percent.."%")
            hacky_swap_node(pos,"carts:furnace_active")
            meta:set_string("formspec",
                "invsize[8,9;]"..
                "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:"..
                        (100-percent)..":default_furnace_fire_fg.png]"..
                "list[current_name;fuel;2,3;1,1;]"..
                "list[current_name;in;2,1;1,1;]"..
                "list[current_name;dst;5,1;2,2;]"..
                "list[current_player;main;0,5;8,4;]")
            return
        end

        local fuel = nil
        local cooked = nil
        local fuellist = inv:get_list("fuel")
        local inlist = inv:get_list("in")
       
        if inlist then
            cooked = minetest.get_craft_result({method = "cooking", width = 1, items = inlist})
        end
        if fuellist then
            fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist})
        end

        if fuel.time <= 0 then
            meta:set_string("infotext","Furnace out of fuel")
            hacky_swap_node(pos,"carts:furnace")
            meta:set_string("formspec", default.furnace_inactive_formspec)
            return
        end

        if cooked.item:is_empty() then
            if was_active then
                meta:set_string("infotext","Furnace is empty")
                hacky_swap_node(pos,"carts:furnace")
                meta:set_string("formspec", default.furnace_inactive_formspec)
            end
            return
        end

        meta:set_string("fuel_totaltime", fuel.time)
        meta:set_string("fuel_time", 0)
       
        local stack = inv:get_stack("fuel", 1)
        stack:take_item()
        inv:set_stack("fuel", 1, stack)
    end,
})

minetest.register_abm({
    nodenames = {"default:furnace"},
    interval = 0,
    chance = 1,
    action = function(pos)
        minetest.env:add_entity(pos,"carts:furnace")
    minetest.env:remove_node(pos)
    end
})

Re: [Mod] Carts [carts]

a RAIL FURNACE!  NICE!  =)

Re: [Mod] Carts [carts]

It wasn't that hard to do. I wound up disabling normal furnaces and left automated stuff as a replacement. Now if only I could get automated pickup of the output...

Re: [Mod] Carts [carts]

print("Could not insert '"..cooked.item.."'")

remove this line from furnaces code. its a bug. when filled whole inventory will cause crash, and world will be unusable.
or at least remove ..cooked.item..

123

Re: [Mod] Carts [carts]

I tried this & it works! thank's PilzAdam you make great mods i find them very cool! Also an way to ride the cart is to stand on it but it's very glitchy. When will we be able to ride the carts?

If you dont like something in minetest, you can remove it.....

Re: [Mod] Carts [carts]

Josh wrote:

I tried this & it works! thank's PilzAdam you make great mods i find them very cool! Also an way to ride the cart is to stand on it but it's very glitchy. When will we be able to ride the carts?

There need to be some new functions for the lua api. So it depends on the engine developers.

Re: [Mod] Carts [carts]

PilzAdam wrote:
Josh wrote:

I tried this & it works! thank's PilzAdam you make great mods i find them very cool! Also an way to ride the cart is to stand on it but it's very glitchy. When will we be able to ride the carts?

There need to be some new functions for the lua api. So it depends on the engine developers.

Yeah... It'd be nice if you could just tap the 'mine' button, teleport in, press the 'place' button, and ride. 4 walls, a floor, and all moving, pushing/pulling the player around.... that'd be nice.

One day, maybe. n.n Tho I've never looked at the code to this game, and my C++ is VERY rusty atm... Maybe I should study again?