Added diesel ICE and elements for it, steering wheel
113
README.md
|
@ -1,2 +1,111 @@
|
||||||
# Advanced Vehicles
|
# Advanced Vehicles 1.0.0-Release Candidate #1
|
||||||
Adds smart different cars (passenger cars, trucks, buses, service).
|
|
||||||
|
## Description
|
||||||
|
------------------------------
|
||||||
|
Adds smart different cars (passenger cars, trucks, buses, service). This mod introduces little API to register cars with analogical parameters that use the mod (see *API Documentation)
|
||||||
|
|
||||||
|
## API Documentation
|
||||||
|
------------------------------
|
||||||
|
###adv_vehicles.register_vehicle(vehicle_name, vehicle_properties, vehicle_item)
|
||||||
|
--Registers a vehicle in the game as an entity and an item spawner for it.
|
||||||
|
|
||||||
|
*vehicle_name* is entity string.
|
||||||
|
*vehicle_properties* is a table with following fields:
|
||||||
|
hp_max,
|
||||||
|
mass, is a property that sets a value of vehicle mass in tons. Necessary for calculating of the gravity.
|
||||||
|
max_vel, measured in metres in sec.
|
||||||
|
cbox, is collision box.
|
||||||
|
model,
|
||||||
|
textures,
|
||||||
|
seats, is a table that contains a data about each seat (busy_by, pos fields). Key should be string containing a sort of seat (driver or passenger).
|
||||||
|
player_eye_offset, is pos table
|
||||||
|
*vehicle_item* is a table with item spawner data. Fields: description, inv_image, craft_recipe.
|
||||||
|
|
||||||
|
###adv_vehicles.rotate_point_around_other_point(circle_center_pos, rotating_point_pos, fixed_point_yaw, current_point_yaw)
|
||||||
|
--This method implements affine transformation of a point *rotating_point_pos* rotation along a circle with *circle_center_pos* center.
|
||||||
|
|
||||||
|
*circle_center_pos* is position table.
|
||||||
|
*rotating_point_pos* is position table.
|
||||||
|
*fixed_point_yaw* is the last fixed yaw of a vehicle (saving in self.fixed_veh_rotate_angle).
|
||||||
|
*current_point_yaw* is current yaw of a vehicle.
|
||||||
|
|
||||||
|
###adv_vehicles.attach_player_to_veh(player, vehicle, seated, model, animation)
|
||||||
|
--Attaches a player to the vehicle.
|
||||||
|
|
||||||
|
*player* is PlayerObjectRef.
|
||||||
|
*vehicle* is ObjectRef.
|
||||||
|
*seated* is "driver" or "passenger" keys depending on which field in *seats_list* used.
|
||||||
|
*model* is vehicle model (.b3d format).
|
||||||
|
*animation* is a table with x, y fields
|
||||||
|
|
||||||
|
###adv_vehicles.detach_player_from_veh(player, vehicle, seated, model, animation)
|
||||||
|
--Opposite to *adv_vehicles.attach_player_to_car*. Detaches a player from the car and the same arguments.
|
||||||
|
|
||||||
|
###adv_vehicles.pave_vector(vehicle, vect_length, old_yaw)
|
||||||
|
--Paves the vector from '0' point relatively to the car origin towards to *vect_length*.
|
||||||
|
*old_yaw* is a integer value that saving in self.fixed_veh_rotate_angle.
|
||||||
|
This method should be caused continuously per 0.1 second to recalculate the car direction.
|
||||||
|
|
||||||
|
###adv_vehicles.rotate_collisionbox(vehicle, yaw)
|
||||||
|
This method is WIP and doesnt work properly currently.
|
||||||
|
|
||||||
|
*This documentation is in working progress.*
|
||||||
|
|
||||||
|
## Crafting Recipes
|
||||||
|
-----------------------------
|
||||||
|
L/B = Luxury Decor or Basic Materials
|
||||||
|
|
||||||
|
***Car Frame***
|
||||||
|
|
||||||
|
-------------------
|
||||||
|
L/B plastic_sheet L/B plastic_sheet L/B plastic_sheet
|
||||||
|
|
||||||
|
L/B plastic_sheet L/B plastic_sheet L/B plastic_sheet
|
||||||
|
|
||||||
|
L/B plastic_sheet
|
||||||
|
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
***Wheel***
|
||||||
|
|
||||||
|
-------------------
|
||||||
|
L/B plastic_sheet L/B plastic_sheet dye:dark_green
|
||||||
|
|
||||||
|
default:steel_ingot L/B plastic_sheet
|
||||||
|
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
***BMW 118 Car***
|
||||||
|
|
||||||
|
-------------------
|
||||||
|
adv_vehicles:car_frame dye:blue
|
||||||
|
|
||||||
|
adv_vehicles:wheel adv_vehicles:wheel adv_vehicles:wheel
|
||||||
|
|
||||||
|
adv_vehicles:wheel L/B plastic_sheet
|
||||||
|
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
***Volvo Bus***
|
||||||
|
|
||||||
|
-------------------
|
||||||
|
adv_vehicles:car_frame dye:yellow dye:yellow
|
||||||
|
|
||||||
|
adv_vehicles:wheel adv_vehicles:wheel adv_vehicles:wheel
|
||||||
|
|
||||||
|
adv_vehicles:wheel L/B plastic_sheet default:steel_ingot
|
||||||
|
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
***Kamaz Truck***
|
||||||
|
|
||||||
|
-------------------
|
||||||
|
adv_vehicles:car_frame dye:grey dye:white
|
||||||
|
|
||||||
|
adv_vehicles:wheel adv_vehicles:wheel adv_vehicles:wheel
|
||||||
|
|
||||||
|
adv_vehicles:wheel L/B plastic_sheet default:steel_ingot
|
||||||
|
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
7
api.lua
|
@ -190,9 +190,7 @@ adv_vehicles.vehicle_braking = function (vehicle, vector_l)
|
||||||
|
|
||||||
local new_acc = obj:get_acceleration()
|
local new_acc = obj:get_acceleration()
|
||||||
local new_vel = obj:get_velocity()
|
local new_vel = obj:get_velocity()
|
||||||
local new_vel_l = vector.length(new_vel)
|
if vector.length(new_vel) < 0.03 and not is_car_driven then
|
||||||
minetest.debug(vector.length(new_vel))
|
|
||||||
if new_vel_l < 0.03 and not is_car_driven then
|
|
||||||
obj:set_velocity({x=0, y=new_vel.y, z=0})
|
obj:set_velocity({x=0, y=new_vel.y, z=0})
|
||||||
obj:set_acceleration({x=0, y=new_acc.y, z=0})
|
obj:set_acceleration({x=0, y=new_acc.y, z=0})
|
||||||
end
|
end
|
||||||
|
@ -249,6 +247,7 @@ end
|
||||||
local nearby_nodes = minetest.find_node_near(pos, z_face, global_nodenames_list)]]
|
local nearby_nodes = minetest.find_node_near(pos, z_face, global_nodenames_list)]]
|
||||||
|
|
||||||
-- Registers a vehicle to the world and creates a spawner item for it with a crafting recipe.
|
-- Registers a vehicle to the world and creates a spawner item for it with a crafting recipe.
|
||||||
|
local is_origin_yaw_set
|
||||||
adv_vehicles.register_vehicle = function (vehname, veh_properties, veh_item)
|
adv_vehicles.register_vehicle = function (vehname, veh_properties, veh_item)
|
||||||
minetest.register_entity("adv_vehicles:"..vehname, {
|
minetest.register_entity("adv_vehicles:"..vehname, {
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
@ -309,6 +308,7 @@ adv_vehicles.register_vehicle = function (vehname, veh_properties, veh_item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
--entity.fixed_veh_rotate_angle = obj:get_yaw()
|
||||||
|
|
||||||
-- If a length of the velocity vector exceeds a 'max_vel' value, sets to zero the acceleration vector.
|
-- If a length of the velocity vector exceeds a 'max_vel' value, sets to zero the acceleration vector.
|
||||||
local vel_length = vector.length(vel)
|
local vel_length = vector.length(vel)
|
||||||
|
@ -375,6 +375,7 @@ adv_vehicles.register_vehicle = function (vehname, veh_properties, veh_item)
|
||||||
local object = minetest.add_entity(pointed_thing.above, "adv_vehicles:"..vehname)
|
local object = minetest.add_entity(pointed_thing.above, "adv_vehicles:"..vehname)
|
||||||
local yaw = math.deg(placer:get_look_horizontal())
|
local yaw = math.deg(placer:get_look_horizontal())
|
||||||
object:set_yaw(math.rad(yaw+180))
|
object:set_yaw(math.rad(yaw+180))
|
||||||
|
--is_origin_yaw_set=true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
28
init.lua
|
@ -19,6 +19,26 @@ minetest.register_craftitem("adv_vehicles:wheel", {
|
||||||
inventory_image = "wheel.png"
|
inventory_image = "wheel.png"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("adv_vehicles:steering_wheel", {
|
||||||
|
description = "Steering Wheel",
|
||||||
|
inventory_image = "steering_wheel.png"
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("adv_vehicles:diesel_ice", {
|
||||||
|
description = "Diesel ICE (Internal Combustion Engine)",
|
||||||
|
inventory_image = "diesel_ice.png"
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("adv_vehicles:cylinder", {
|
||||||
|
description = "ICE Cylinder",
|
||||||
|
inventory_image = "cylinder.png"
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("adv_vehicles:crankshaft", {
|
||||||
|
description = "ICE Crankshaft",
|
||||||
|
inventory_image = "crankshaft.png"
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("adv_vehicles:silicon_dust", {
|
minetest.register_craftitem("adv_vehicles:silicon_dust", {
|
||||||
description = "Silicon Dust",
|
description = "Silicon Dust",
|
||||||
inventory_image = "silicon_dust.png"
|
inventory_image = "silicon_dust.png"
|
||||||
|
@ -119,8 +139,8 @@ end
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "adv_vehicles:car_frame_material",
|
output = "adv_vehicles:car_frame_material",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"default:steel_ingot", "adv_vehicles:aluminium_dust", "adv_vehicles:aluminium_dust"},
|
{"default:steel_ingot", plastic_itemstring, "adv_vehicles:aluminium_dust"},
|
||||||
{"default:steel_ingot", plastic_itemstring, plastic_itemstring},
|
{"default:steel_ingot", plastic_itemstring, "adv_vehicles:aluminium_dust"},
|
||||||
{plastic_itemstring, "xpanes:pane_flat", ""}
|
{plastic_itemstring, "xpanes:pane_flat", ""}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -128,8 +148,8 @@ minetest.register_craft({
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "adv_vehicles:wheel",
|
output = "adv_vehicles:wheel",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"technic:rubber", "technic:rubber", plastic_itemstring},
|
{plastic_itemstring, plastic_itemstring, "dye:dark_grey"},
|
||||||
{"default:steel_ingot", "technic:rubber", ""},
|
{"default:steel_ingot", plastic_itemstring, ""},
|
||||||
{"", "", ""}
|
{"", "", ""}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
2
mod.conf
|
@ -1,4 +1,4 @@
|
||||||
name = adv_vehicles
|
name = adv_vehicles
|
||||||
description = Adds different well-looked vehicles (cars, trucks, buses)
|
description = Adds different well-looked vehicles (cars, trucks, buses)
|
||||||
depends = default
|
depends = default, technic
|
||||||
optional_depends = basic_materials, luxury_decor
|
optional_depends = basic_materials, luxury_decor
|
||||||
|
|
Before Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 2.0 KiB |