Tractor, and destroy node drops
This commit is contained in:
parent
9e66fdb024
commit
1e357198f4
9
api.lua
9
api.lua
@ -217,7 +217,14 @@ function vehicles.object_drive(entity, dtime, def)
|
|||||||
|
|
||||||
--destroy node
|
--destroy node
|
||||||
if destroy_node ~= nil and node == destroy_node then
|
if destroy_node ~= nil and node == destroy_node then
|
||||||
minetest.remove_node(pos)
|
minetest.dig_node(pos)
|
||||||
|
local item = minetest.get_node_drops(destroy_node)
|
||||||
|
if item[1] ~= nil then
|
||||||
|
minetest.add_item(pos, item[1])
|
||||||
|
end
|
||||||
|
if item[2] ~= nil then
|
||||||
|
minetest.add_item(pos, item[1])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--face the right way
|
--face the right way
|
||||||
|
31
init.lua
31
init.lua
@ -472,6 +472,37 @@ minetest.register_entity("vehicles:firetruck", {
|
|||||||
|
|
||||||
vehicles.register_spawner("vehicles:firetruck", S("Fire truck"), "vehicles_firetruck_inv.png")
|
vehicles.register_spawner("vehicles:firetruck", S("Fire truck"), "vehicles_firetruck_inv.png")
|
||||||
|
|
||||||
|
minetest.register_entity("vehicles:tractor", {
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "tractor.b3d",
|
||||||
|
textures = {"vehicles_tractor.png"},
|
||||||
|
velocity = 15,
|
||||||
|
acceleration = -5,
|
||||||
|
stepheight = 1.5,
|
||||||
|
hp_max = 200,
|
||||||
|
physical = true,
|
||||||
|
collisionbox = {-0.8, 0, -0.8, 0.8, 1.4, 0.8},
|
||||||
|
on_rightclick = function(self, clicker)
|
||||||
|
if self.driver and clicker == self.driver then
|
||||||
|
vehicles.object_detach(self, clicker, {x=1, y=0, z=1})
|
||||||
|
elseif not self.driver then
|
||||||
|
vehicles.object_attach(self, clicker, {x=0, y=14, z=-10}, true, {x=0, y=2, z=-5})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_punch = vehicles.on_punch,
|
||||||
|
on_step = function(self, dtime)
|
||||||
|
return vehicles.on_step(self, dtime, {
|
||||||
|
speed = 8,
|
||||||
|
decell = 0.5,
|
||||||
|
driving_sound = "engine",
|
||||||
|
sound_duration = 11,
|
||||||
|
destroy_node = "farming:wheat_5",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vehicles.register_spawner("vehicles:tractor", S("Tractor"), "vehicles_tractor_inv.png")
|
||||||
|
|
||||||
minetest.register_entity("vehicles:geep", {
|
minetest.register_entity("vehicles:geep", {
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "geep.b3d",
|
mesh = "geep.b3d",
|
||||||
|
BIN
models/tractor.b3d
Normal file
BIN
models/tractor.b3d
Normal file
Binary file not shown.
BIN
textures/vehicles_tractor.png
Normal file
BIN
textures/vehicles_tractor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
BIN
textures/vehicles_tractor_inv.png
Normal file
BIN
textures/vehicles_tractor_inv.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 411 B |
Loading…
x
Reference in New Issue
Block a user