diff --git a/api.lua b/api.lua index 6da5118..76e65c7 100644 --- a/api.lua +++ b/api.lua @@ -455,6 +455,12 @@ adv_vehicles.register_vehicle = function (vehname, veh_properties, veh_item) end end }) + + minetest.debug(dump(veh_item.craft_recipe)) + minetest.register_craft({ + output = "adv_vehicles:"..vehname, + recipe = veh_item.craft_recipe + }) end end local died_cars = {} diff --git a/init.lua b/init.lua index 130c5d8..1fcc745 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,44 @@ local modpath = minetest.get_modpath("adv_vehicles") dofile(modpath.."/api.lua") +minetest.register_craftitem("adv_vehicles:car_frame", { + description = "Car Frame (raw)", + inventory_image = "car_frame.png" +}) + +minetest.register_craftitem("adv_vehicles:wheel", { + description = "Wheel", + inventory_image = "wheel.png" +}) + +local plastic_itemstring +if minetest.get_modpath("basic_materials") then + plastic_itemstring = "basic_materials:plastic_sheet" +elseif minetest.get_modpath("luxury_decor") then + plastic_itemstring = "luxury_decor:plastic_sheet" +else + error("'plastic_sheet' crafting element is required to be registered!") +end + +minetest.register_craft({ + output = "adv_vehicles:car_frame", + recipe = { + {plastic_itemstring, plastic_itemstring, plastic_itemstring}, + {plastic_itemstring, plastic_itemstring, plastic_itemstring}, + {plastic_itemstring, "", ""} + } +}) + +minetest.register_craft({ + output = "adv_vehicles:wheel", + recipe = { + {plastic_itemstring, plastic_itemstring, "dye:dark_grey"}, + {"default:steel_ingot", plastic_itemstring, ""}, + {"", "", ""} + } + }) + + adv_vehicles.register_vehicle("bmw_118_two_seats", { hp_max = 60, mass = 1.3, @@ -14,8 +52,12 @@ adv_vehicles.register_vehicle("bmw_118_two_seats", { }, { description = "BMW 118 two-seater", - inv_image = "bmw_two_seats_inv.png" - }) + inv_image = "bmw_two_seats_inv.png", + craft_recipe = { + {"adv_vehicles:car_frame", "dye:blue", ""}, + {"adv_vehicles:wheel", "adv_vehicles:wheel", "adv_vehicles:wheel"}, + {"adv_vehicles:wheel", plastic_itemstring, ""} + }}) --[[minetest.register_craftitem("adv_vehicles:bmw_two_seats_inv", { description = "BMW 118 two-seater", @@ -51,8 +93,12 @@ adv_vehicles.register_vehicle("volvo", { }, { description = "Volvo Bus", - inv_image = "volvo_inv.png" - }) + inv_image = "volvo_inv.png", + craft_recipe = { + {"adv_vehicles:car_frame", "dye:yellow", "dye:yellow"}, + {"adv_vehicles:wheel", "adv_vehicles:wheel", "adv_vehicles:wheel"}, + {"adv_vehicles:wheel", plastic_itemstring, "default:steel_ingot"} + }}) adv_vehicles.register_vehicle("kamaz", { @@ -62,11 +108,18 @@ adv_vehicles.register_vehicle("kamaz", { cbox = {-1.5, -0.5, -3.5, 1.5, 2.5, 3.5}, model = "kamaz.b3d", textures = {"kamaz.png"}, - seats = {["driver"]={busy_by=nil, pos={x=0, z=-11.0}}, + seats = {["driver"]={busy_by=nil, pos={x=0, z=-18.0}}, }, - player_eye_offset = {x=0, y=0, z=-3.5} + player_eye_offset = {x=0, y=0, z=-18.0} }, { description = "Kamaz Truck", - inv_image = "kamaz_inv.png" + inv_image = "kamaz_inv.png", + craft_recipe = { + {"adv_vehicles:car_frame", "dye:grey", "dye:white"}, + {"adv_vehicles:wheel", "adv_vehicles:wheel", "adv_vehicles:wheel"}, + {"adv_vehicles:wheel", plastic_itemstring, "default:steel_ingot"} + } }) + + diff --git a/mod.conf b/mod.conf index 0299332..adc40a6 100644 --- a/mod.conf +++ b/mod.conf @@ -1 +1,4 @@ -depends = default +name = adv_vehicles +description = Adds different well-looked vehicles (cars, trucks, buses) +depends = default +optional_depends = basic_materials, luxury_decor diff --git a/models/bmw_118_two_seats.b3d b/models/bmw_118_two_seats.b3d index 5f08c22..8973383 100644 Binary files a/models/bmw_118_two_seats.b3d and b/models/bmw_118_two_seats.b3d differ diff --git a/models/bmw_118_two_seats.blend b/models/bmw_118_two_seats.blend index 59d00dc..f3beaed 100644 Binary files a/models/bmw_118_two_seats.blend and b/models/bmw_118_two_seats.blend differ diff --git a/models/bmw_118_two_seats.blend1 b/models/bmw_118_two_seats.blend1 index 5411033..66ad440 100644 Binary files a/models/bmw_118_two_seats.blend1 and b/models/bmw_118_two_seats.blend1 differ diff --git a/models/kamaz.b3d b/models/kamaz.b3d index e9318a4..4ab9bf0 100644 Binary files a/models/kamaz.b3d and b/models/kamaz.b3d differ diff --git a/models/kamaz.blend b/models/kamaz.blend index f1f3db4..d3c5449 100644 Binary files a/models/kamaz.blend and b/models/kamaz.blend differ diff --git a/models/kamaz.blend1 b/models/kamaz.blend1 index 76c5447..22a798a 100644 Binary files a/models/kamaz.blend1 and b/models/kamaz.blend1 differ diff --git a/models/volvo.b3d b/models/volvo.b3d index 94521cd..734e537 100644 Binary files a/models/volvo.b3d and b/models/volvo.b3d differ diff --git a/models/volvo.blend b/models/volvo.blend index e1f33d8..66c6c66 100644 Binary files a/models/volvo.blend and b/models/volvo.blend differ diff --git a/models/volvo.blend1 b/models/volvo.blend1 index e913047..45be96c 100644 Binary files a/models/volvo.blend1 and b/models/volvo.blend1 differ diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..257db11 Binary files /dev/null and b/screenshot.png differ diff --git a/textures/car_frame.png b/textures/car_frame.png new file mode 100644 index 0000000..8d61360 Binary files /dev/null and b/textures/car_frame.png differ diff --git a/textures/Screenshot_20190623_215039.png b/textures/kamaz_inv.png similarity index 100% rename from textures/Screenshot_20190623_215039.png rename to textures/kamaz_inv.png diff --git a/textures/wheel.png b/textures/wheel.png new file mode 100644 index 0000000..ff5bc82 Binary files /dev/null and b/textures/wheel.png differ