start basic cart work

This commit is contained in:
unknown 2021-09-23 00:04:29 -04:00
parent 2eb7a11c50
commit 2e84494120
8 changed files with 275 additions and 143 deletions

Binary file not shown.

41
mods/fl_trains/cart.lua Normal file
View File

@ -0,0 +1,41 @@
minetest.register_entity("fl_trains:cart", {
--mte object properties
initial_properties = {
physical = true,
--stepheight = 0.4,
collide_with_objects = true,
collisionbox = {-0.5, 0.0, -0.5, 0.5, 0, 0.5},
visual = "mesh",
mesh = "farlands_cart_demo.obj",
textures = {
"farlands_cart.png",
},
backface_culling = false,
visual_size = {x=10, y=10, z=10},
static_save = true,
damage_texture_modifier = "^[colorize:#FF000040"
},
--on_step = mobkit.stepfunc, --this is required
--on_activate = fl_wildlife.actfunc, --this is required as well(useing custom that calls mobkits and adds nametags)
--get_staticdata = mobkit.statfunc, --who knows, no documentation (probably save entity data)
--more mte properties
on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir)
minetest.chat_send_all("punched")
end,
})
minetest.register_craftitem("fl_trains:cart", {
description = "cart",
inventory_image = "farlands_cart_item.png",
wield_image = "farlands_cart_item.png",
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then return end
local node = minetest.get_node_or_nil(pointed_thing.under)
if string.find(node.name, "fl_trains") then
minetest.add_entity(pointed_thing.under, "fl_trains:cart")
end
end,
groups = {not_in_creative_inventory = 1}
})

View File

@ -1,143 +1,3 @@
minetest.register_node("fl_trains:straight_track", {
description = "straight track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_straight.obj",
tiles = {"farlands_rail.png", "farlands_ties.png"},
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:curve_right_track", {
description = "right curve track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_curved_right.obj",
tiles = {"farlands_ties.png", "farlands_rail.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:curve_left_track", {
description = "left curve track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_curved_left.obj",
tiles = {"farlands_ties.png", "farlands_rail.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:straight_45_track", {
description = "45 degree straight track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_straight_45.obj",
tiles = {"farlands_ties.png", "farlands_rail.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:crossing_track", {
description = "corssing track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_crossing.obj",
tiles = {"farlands_ties.png", "farlands_rail.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:switch_right_track", {
description = "switch right track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_switch_right.obj",
tiles = {"farlands_ties.png", "farlands_rail.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:switch_left_track", {
description = "switch left track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_switch_left.obj",
tiles = {"farlands_ties.png", "farlands_rail.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:straight_rise_track", {
description = "straight rise track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_straight_rise.obj",
tiles = {"farlands_rail.png", "farlands_ties.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
local modpath = minetest.get_modpath("fl_trains")
dofile(modpath .. "/track.lua")
dofile(modpath .. "/cart.lua")

View File

@ -0,0 +1,88 @@
# Blender v2.93.3 OBJ File: 'untitled.blend'
# www.blender.org
o Cube
v 0.495000 0.000000 -0.495000
v 0.495000 -0.500000 -0.495000
v 0.495000 0.000000 0.495000
v 0.495000 -0.500000 0.495000
v -0.495000 0.000000 -0.495000
v -0.495000 -0.500000 -0.495000
v -0.495000 0.000000 0.495000
v -0.495000 -0.500000 0.495000
v -0.450000 -0.450000 0.450000
v -0.450000 0.000000 0.450000
v -0.450000 -0.450000 -0.450000
v -0.450000 0.000000 -0.450000
v 0.450000 -0.450000 0.450000
v 0.450000 0.000000 0.450000
v 0.450000 -0.450000 -0.450000
v 0.450000 0.000000 -0.450000
vt 0.515625 0.312500
vt 0.691406 0.312500
vt 0.691406 0.656250
vt 0.515625 0.656250
vt 0.343750 0.656250
vt 0.515625 0.656250
vt 0.515625 1.000000
vt 0.343750 1.000000
vt 0.000000 0.000000
vt 0.343750 0.000000
vt 0.343750 0.343750
vt 0.000000 0.343750
vt 0.691406 0.312500
vt 0.863281 0.312500
vt 0.863281 0.656250
vt 0.691406 0.656250
vt 0.343750 0.312500
vt 0.515625 0.312500
vt 0.515625 0.656250
vt 0.343750 0.656250
vt 0.671875 0.968750
vt 0.515625 0.968750
vt 0.515625 0.656250
vt 0.671875 0.656250
vt 0.968750 0.312500
vt 0.812500 0.312500
vt 0.812500 0.000000
vt 0.968750 0.000000
vt 0.828125 0.968750
vt 0.671875 0.968750
vt 0.671875 0.656250
vt 0.828125 0.656250
vt 0.812500 0.312500
vt 0.656250 0.312500
vt 0.656250 0.000000
vt 0.812500 0.000000
vt 0.343750 0.000000
vt 0.656250 0.000000
vt 0.656250 0.312500
vt 0.343750 0.312500
vt 0.343750 0.343750
vt 0.343750 0.687500
vt 0.328125 0.671875
vt 0.328125 0.359375
vt 0.000000 0.343750
vt 0.015625 0.359375
vt 0.000000 0.687500
vt 0.015625 0.671875
vn 0.0000 0.0000 1.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 -1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 0.0000 1.0000 0.0000
s off
f 4/1/1 3/2/1 7/3/1 8/4/1
f 8/5/2 7/6/2 5/7/2 6/8/2
f 6/9/3 2/10/3 4/11/3 8/12/3
f 2/13/4 1/14/4 3/15/4 4/16/4
f 6/17/5 5/18/5 1/19/5 2/20/5
f 9/21/2 10/22/2 12/23/2 11/24/2
f 11/25/5 12/26/5 16/27/5 15/28/5
f 15/29/4 16/30/4 14/31/4 13/32/4
f 13/33/1 14/34/1 10/35/1 9/36/1
f 11/37/3 15/38/3 13/39/3 9/40/3
f 5/41/6 7/42/6 10/43/6 12/44/6
f 1/45/6 5/41/6 12/44/6 16/46/6
f 3/47/6 1/45/6 16/46/6 14/48/6
f 7/42/6 3/47/6 14/48/6 10/43/6

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

143
mods/fl_trains/track.lua Normal file
View File

@ -0,0 +1,143 @@
minetest.register_node("fl_trains:straight_track", {
description = "straight track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_straight.obj",
tiles = {"farlands_rail.png", "farlands_ties.png"},
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:curve_right_track", {
description = "right curve track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_curved_right.obj",
tiles = {"farlands_ties.png", "farlands_rail.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:curve_left_track", {
description = "left curve track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_curved_left.obj",
tiles = {"farlands_ties.png", "farlands_rail.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:straight_45_track", {
description = "45 degree straight track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_straight_45.obj",
tiles = {"farlands_ties.png", "farlands_rail.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:crossing_track", {
description = "corssing track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_crossing.obj",
tiles = {"farlands_ties.png", "farlands_rail.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:switch_right_track", {
description = "switch right track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_switch_right.obj",
tiles = {"farlands_ties.png", "farlands_rail.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:switch_left_track", {
description = "switch left track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_switch_left.obj",
tiles = {"farlands_ties.png", "farlands_rail.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})
minetest.register_node("fl_trains:straight_rise_track", {
description = "straight rise track",
paramtype = "light",
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "farlands_straight_rise.obj",
tiles = {"farlands_rail.png", "farlands_ties.png", },
groups = {oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,-0.475,0.5},
},
collision_box = {
type = "fixed",
fixed = {0,0,0,0,0,0},
},
})