[Mod] Carts [carts]
-
- Member
- Posts: 19
- Joined: Fri Jul 27, 2012 08:57
- GitHub: Cg-boy
-
- Member
- Posts: 19
- Joined: Fri Jul 27, 2012 08:57
- GitHub: Cg-boy
Minetest-c55 0.4.dev-20120606
carts 23
carts 23
Last edited by graphics boy on Sun Jul 29, 2012 09:14, edited 1 time in total.
I like 3d graphics
-
- Member
- Posts: 19
- Joined: Fri Jul 27, 2012 08:57
- GitHub: Cg-boy
I had that problem too and adding mesecons to depends.txt of carts fixed it.PilzAdam wrote:Maybe it helps when you add "mesecons" to depends.txttee-jay wrote:I have the latest mesecons version from github (7568182) and have the exact same problem sfan5 has.
Yes it does work without mesecons.
When this dont fix it I have no idea what to do. I dont have this bug.
It's working great, thank you very much.
Also, does it have a box that the cart takes its contents too? I only find one that the cart drops the content, not for taking.
If it's possible, I would be able to create closed circuit tracks that carts take contents from one side and drop on the other.
Last edited by Tggtt on Sun Jul 29, 2012 23:14, edited 1 time in total.
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
Thanks for the feedback.Tggtt wrote: I had that problem too and adding mesecons to depends.txt of carts fixed it.
It's working great, thank you very much.
Good idea.Tggtt wrote: Also, does it have a box that the cart takes its contents too? I only find one that the cart drops the content, not for taking.
If it's possible, I would be able to create closed circuit tracks that carts take contents from one side and drop on the other.
EDIT: Added.
Last edited by PilzAdam on Mon Jul 30, 2012 10:04, edited 1 time in total.
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
You dont have add mesecons to depends.txt with version 25.PilzAdam wrote:Maybe it helps when you add "mesecons" to depends.txttee-jay wrote:I have the latest mesecons version from github (7568182) and have the exact same problem sfan5 has.
Yes it does work without mesecons.
When this dont fix it I have no idea what to do. I dont have this bug.
Thanks a lot. I think you forgot to add the recipe for pickup_plate in the first post.
[EDIT] sorry, I saw it now.
I had to open the code to find it.
While reading the code for the pickup_plate, I came across your "fors" to search for the boxes and plates. I think you should try merging the "fors" because they are exactly the same, only the "if" changes. Merging them would improve performance for the same result.
[EDIT]
This is what I meant by merging the "fors". I believe it has the exact same result.
However, it could cause the cart to deliver itens to a box that is too near to the plate. You may want to invert the order of the "ifs".
When the server is laggy, the "cart missing the rail" problem happens more often. I have reduced the MAX_SPEED as a work around.
[EDIT] sorry, I saw it now.
I had to open the code to find it.
While reading the code for the pickup_plate, I came across your "fors" to search for the boxes and plates. I think you should try merging the "fors" because they are exactly the same, only the "if" changes. Merging them would improve performance for the same result.
[EDIT]
This is what I meant by merging the "fors". I believe it has the exact same result.
Code: Select all
--search for pickup plates and take items
-- and
-- search for boxes and place all items (except players) in it
for x=-1,1 do
local pos = {x=self.object:getpos().x+x, y=self.object:getpos().y, z=self.object:getpos().z}
local name = minetest.env:get_node(pos).name
if name == "carts:pickup_plate" then
pos.x = math.floor(0.5+pos.x)
pos.y = math.floor(0.5+pos.y)
pos.z = math.floor(0.5+pos.z)
local items = minetest.env:get_objects_inside_radius(pos, 1)
for i,item in ipairs(items) do
if not item:is_player() then
table.insert(self.items, item)
elseif TRANSPORT_PLAYER then
table.insert(self.items, item)
end
end
end
if name == "carts:chest" and self.items ~= {} then
local items_tmp = {}
for i,item in ipairs(self.items) do
if not item:is_player() then
item:setpos({x=math.floor(0.5+pos.x), y=math.floor(0.5+pos.y)+0.2,
z=math.floor(0.5+pos.z)})
else
table.insert(items_tmp, item)
end
end
self.items = items_tmp
end
end
for z=-1,1 do
local pos = {x=self.object:getpos().x, y=self.object:getpos().y, z=self.object:getpos().z+z}
local name = minetest.env:get_node(pos).name
if name == "carts:pickup_plate" then
pos.x = math.floor(0.5+pos.x)
pos.y = math.floor(0.5+pos.y)
pos.z = math.floor(0.5+pos.z)
local items = minetest.env:get_objects_inside_radius(pos, 1)
for i,item in ipairs(items) do
if not item:is_player() then
table.insert(self.items, item)
elseif TRANSPORT_PLAYER then
table.insert(self.items, item)
end
end
end
if name == "carts:chest" and self.items ~= {} then
local items_tmp = {}
for i,item in ipairs(self.items) do
if not item:is_player() then
item:setpos({x=math.floor(0.5+pos.x), y=math.floor(0.5+pos.y)+0.2,
z=math.floor(0.5+pos.z)})
else
table.insert(items_tmp, item)
end
end
self.items = items_tmp
end
end
When the server is laggy, the "cart missing the rail" problem happens more often. I have reduced the MAX_SPEED as a work around.
Last edited by Tggtt on Tue Jul 31, 2012 05:41, edited 1 time in total.
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
Mine would stop if i made a stair-like slope into my mine. I got it working really nicely (havent seen it crash) with a really small change:
edit: no it still crashes sometimes
Code: Select all
-- downhill
local vel = self.object:getvelocity()
vel.y = -3*MAX_SPEED -- used to be -2*MAX_SPEED
edit: no it still crashes sometimes
Last edited by cornernote on Tue Jul 31, 2012 08:36, edited 1 time in total.
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
Ive added your picture.Tggtt wrote:Thanks a lot. I think you forgot to add the recipe for pickup_plate in the first post.
Ive changed it (see version 26).Tggtt wrote: I had to open the code to find it.
While reading the code for the pickup_plate, I came across your "fors" to search for the boxes and plates. I think you should try merging the "fors" because they are exactly the same, only the "if" changes. Merging them would improve performance for the same result.
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
My cart works with -2*MAX_SPEED.cornernote wrote:Mine would stop if i made a stair-like slope into my mine. I got it working really nicely (havent seen it crash) with a really small change:
Code: Select all
-- downhill local vel = self.object:getvelocity() vel.y = -3*MAX_SPEED -- used to be -2*MAX_SPEED
edit: no it still crashes sometimes
I made a bit more natural sound for cart. Do you like it?:
http://speedy.sh/r4dPu/carts-cart-sound.ogg
License: WTFPL
http://speedy.sh/r4dPu/carts-cart-sound.ogg
License: WTFPL
my mods: infrastructure_modpack | papyrus_bed | papyrus_door my blog: radekslowik.pl
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
Ive set this to the default one but leave the old one in the sound folder so everyone can choose on his own.Ragnarok wrote:I made a bit more natural sound for cart. Do you like it?:
http://speedy.sh/r4dPu/carts-cart-sound.ogg
License: WTFPL
Fantastic What do you think about using two different sounds for cart on straight rails and railway crossover?
my mods: infrastructure_modpack | papyrus_bed | papyrus_door my blog: radekslowik.pl
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
I had the idea that theres only one short sound that is played when the cart enters a new rail block.Ragnarok wrote:Fantastic What do you think about using two different sounds for cart on straight rails and railway crossover?
With this method you can make many different sounds that are played randomly. You can also make different sounds for different rails.
But the sounds have to be realy short.
This can be problematic because of embedding the clatter of train wheels in the sound. Rails are too short. But you can use sound which has approx. 4-rails-length (with current speed of cart). You could check rails below cart, and if it meets an crossover (or bend) swap sound and simultaneously block the substitution of a different sound for a period equal to 4-rails-length (8-rails-length?).
my mods: infrastructure_modpack | papyrus_bed | papyrus_door my blog: radekslowik.pl
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
I can do this if you provide the sounds. The coding is easy.Ragnarok wrote:This can be problematic because of embedding the clatter of train wheels in the sound. Rails are too short. But you can use sound which has approx. 4-rails-length (with current speed of cart). You could check rails below cart, and if it meets an crossover (or bend) swap sound and simultaneously block the substitution of a different sound for a period equal to 4-rails-length (8-rails-length?).
Ok, I'll make sounds. Maybe it would be better if the default sound will play all the time and swapped only when the train hovers on the crossover (and played for few moments)? You could then use the sounds of various lengths regardless of the cart speed. What do you think?
my mods: infrastructure_modpack | papyrus_bed | papyrus_door my blog: radekslowik.pl
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
I would prefer the short sounds.Ragnarok wrote:Ok, I'll make sounds. Maybe it would be better if the default sound will play all the time and swapped only when the train hovers on the crossover (and played for few moments)? You could then use the sounds of various lengths regardless of the cart speed. What do you think?
Two sounds 2s long (10 rails) and one 1s (5 rails):
http://speedy.sh/jqz7M/carts-sounds.7z
License: WTFPL, enjoy
http://speedy.sh/jqz7M/carts-sounds.7z
License: WTFPL, enjoy
my mods: infrastructure_modpack | papyrus_bed | papyrus_door my blog: radekslowik.pl
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
Thanks a lot!Ragnarok wrote:Two sounds 2s long (10 rails) and one 1s (5 rails):
http://speedy.sh/jqz7M/carts-sounds.7z
License: WTFPL, enjoy
Im still working on a other mod so it will take some time (1 day).
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
PilzAdam wrote:My cart works with -2*MAX_SPEED.cornernote wrote:Mine would stop if i made a stair-like slope into my mine. I got it working really nicely (havent seen it crash) with a really small change:
Code: Select all
-- downhill local vel = self.object:getvelocity() vel.y = -3*MAX_SPEED -- used to be -2*MAX_SPEED
edit: no it still crashes sometimes
does it ever stop on a descent slope? (not just 1 step down, then flat, i mean lots of steps like this)...
|_
|_
|_
|_
- PilzAdam
- Member
- Posts: 4026
- Joined: Fri Jul 20, 2012 16:19
- GitHub: PilzAdam
- IRC: PilzAdam
- Location: Germany
cornernote wrote:PilzAdam wrote:My cart works with -2*MAX_SPEED.cornernote wrote:Mine would stop if i made a stair-like slope into my mine. I got it working really nicely (havent seen it crash) with a really small change:
Code: Select all
-- downhill local vel = self.object:getvelocity() vel.y = -3*MAX_SPEED -- used to be -2*MAX_SPEED
edit: no it still crashes sometimes
does it ever stop on a descent slope? (not just 1 step down, then flat, i mean lots of steps like this)...
|_
|_
|_
|_
This works for me.
-
- Member
- Posts: 844
- Joined: Wed Jul 11, 2012 15:02
Who is online
Users browsing this forum: No registered users and 59 guests