[Mod] Carts [carts]

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

by Ragnarok » Post

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.

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

by PilzAdam » Post

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.

User avatar
Splizard
Member
Posts: 227
Joined: Wed Jan 25, 2012 07:20
GitHub: Splizard
IRC: Splizard
In-game: Splizard
Location: New Zealand
Contact:

by Splizard » Post

Is it possible to store the items in the cart as inventory? It looks strange with the items teleporting around...
Games: Builda City, The Hungry Games Mods: Lifters, Snow Biomes and Gates. Also checkout my texture pack Gridtoon!

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

by PilzAdam » Post

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.

graphics boy
Member
Posts: 19
Joined: Fri Jul 27, 2012 08:57
GitHub: Cg-boy

by graphics boy » Post

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?
I like 3d graphics

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

by PilzAdam » Post

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.

graphics boy
Member
Posts: 19
Joined: Fri Jul 27, 2012 08:57
GitHub: Cg-boy

by graphics boy » Post

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)
I like 3d graphics

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

by PilzAdam » Post

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?

graphics boy
Member
Posts: 19
Joined: Fri Jul 27, 2012 08:57
GitHub: Cg-boy

by graphics boy » Post

version 28 of carts
version 0.4.dev of minetest
I like 3d graphics

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

by PilzAdam » Post

graphics boy wrote:version 0.4.dev of minetest
Wich 0.4.dev (0.4.2-rc1 is latest)?

graphics boy
Member
Posts: 19
Joined: Fri Jul 27, 2012 08:57
GitHub: Cg-boy

by graphics boy » Post

Minetest-c55 0.4.dev-20120606
I like 3d graphics

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

by PilzAdam » Post

graphics boy wrote:Minetest-c55 0.4.dev-20120606
This is maybe too old. Try a newer version.

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

by PilzAdam » Post

The carts are now 3D.

User avatar
aFoxNamedMorris
Member
Posts: 14
Joined: Sat Aug 11, 2012 15:57

by aFoxNamedMorris » Post

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.

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

by PilzAdam » Post

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.

User avatar
aFoxNamedMorris
Member
Posts: 14
Joined: Sat Aug 11, 2012 15:57

by aFoxNamedMorris » Post

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

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

by PilzAdam » Post

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

User avatar
aFoxNamedMorris
Member
Posts: 14
Joined: Sat Aug 11, 2012 15:57

by aFoxNamedMorris » Post

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! ^-^

tinoesroho
Member
Posts: 570
Joined: Fri Feb 17, 2012 21:55
Location: Canada

by tinoesroho » Post

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
})
Last edited by tinoesroho on Tue Aug 14, 2012 03:48, edited 1 time in total.
We are what we create.

I tinker and occasionally make (lousy) mods. Currently building an MMO subgame and updating mods. Pirate Party of Canada member. Sporadic author. 21 years old.

My github:
https://github.com/tinoesroho/

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

by cornernote » Post

a RAIL FURNACE! NICE! =)

tinoesroho
Member
Posts: 570
Joined: Fri Feb 17, 2012 21:55
Location: Canada

by tinoesroho » Post

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...
We are what we create.

I tinker and occasionally make (lousy) mods. Currently building an MMO subgame and updating mods. Pirate Party of Canada member. Sporadic author. 21 years old.

My github:
https://github.com/tinoesroho/

User avatar
RealBadAngel
Member
Posts: 557
Joined: Wed Jul 18, 2012 16:30

by RealBadAngel » Post

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

Josh
Member
Posts: 1146
Joined: Fri Jun 29, 2012 23:11
Location: Victoria, Australia

by Josh » Post

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?

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

by PilzAdam » Post

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.

User avatar
aFoxNamedMorris
Member
Posts: 14
Joined: Sat Aug 11, 2012 15:57

by aFoxNamedMorris » Post

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?

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests