Take bike after placing

master
Extex101 2020-03-08 16:30:19 -07:00 committed by GitHub
parent 876e6726a4
commit 2045996072
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -89,9 +89,14 @@ for id, colour in pairs (bikelist) do
description = colour:gsub("^%l", string.upper):gsub("_", " ").." bike",
inventory_image = "motorbike_"..colour.."_inv.png",
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node then
return
end
local pos = {x=pointed_thing.above.x, y=pointed_thing.above.y+1, z=pointed_thing.above.z}
local bike = minetest.add_entity(pos, "motorbike:bike_"..colour, biker.get_plate(placer:get_player_name()))
local ent = bike:get_luaentity()
itemstack:take_item()
return itemstack
end,
})
minetest.register_craft({