From 1bfa51a394060ae72364f8cc6561b2a54056f700 Mon Sep 17 00:00:00 2001 From: David Leal Date: Wed, 24 Mar 2021 13:01:21 -0600 Subject: [PATCH] Update the framework and the template due to rec... ...ent API changes. --- framework.lua | 8 ++++++-- template.lua | 26 +++++++++++++++++++++----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/framework.lua b/framework.lua index 38be829..062ef49 100644 --- a/framework.lua +++ b/framework.lua @@ -7,8 +7,8 @@ function vehicle_mash.register_vehicle(name, def) terrain_type = def.terrain_type, collisionbox = def.collisionbox, can_fly = def.can_fly, - can_go_down = def.can_go_down, - can_go_up = def.can_go_up, + can_go_down = def.can_go_down, -- Applies only when `can_fly` is enabled + can_go_up = def.can_go_up, -- Applies only when `can_fly` is enabled player_rotation = def.player_rotation, driver_attach_at = def.driver_attach_at, driver_eye_offset = def.driver_eye_offset, @@ -33,8 +33,12 @@ function vehicle_mash.register_vehicle(name, def) tiles = def.tiles, visual_size = def.visual_size, stepheight = def.stepheight, + max_speed_forward = def.max_speed_forward, max_speed_reverse = def.max_speed_reverse, + max_speed_upwards = def.max_speed_upwards, -- Applies only when `can_fly` is enabled + max_speed_downwards = def.max_speed_downwards, -- Applies only when `can_fly` is enabled + accel = def.accel, braking = def.braking, turn_spd = def.turn_speed, diff --git a/template.lua b/template.lua index 4e8023d..1cc8cf6 100644 --- a/template.lua +++ b/template.lua @@ -1,16 +1,30 @@ local name = "car_template" -- mod name of vehicle local definition = { + terrain_type = 1, -- 0 = air, 1 = land, 2 = liquid, 3 = land + liquid description = "Template car", -- name as seen in inventory collisionbox = {0, 0, 0, 0, 0, 0}, -- back, bottom, starboard, front, top, port onplace_position_adj = 0, -- adjust placement position up/down - is_boat = false, -- does vehicle travel on water? + enable_crash = true, -- whether to destroy the vehicle when going too fast and crashes with a block or not + can_fly = false, -- if enabled, the specified vehicle will be able to fly around + can_go_down = false, -- applies only when `can_fly` is enabled + can_go_up = false, -- applies only when `can_fly` is enabled player_rotation = {x=0,y=0,z=0}, -- rotate player so they sit facing the correct direction driver_attach_at = {x=0,y=0,z=0}, -- attach the driver at driver_eye_offset = {x=0, y=0, z=0}, -- offset for first person driver view - number_of_passengers = 0, -- testing: 0 for none, do not increase at this time! - passenger_attach_at = {x=0,y=0,z=0}, -- attach the passenger, if applicable, at - passenger_eye_offset = {x=0, y=0, z=0}, -- offset for first person passenger view + number_of_passengers = 0, -- maximum number of passengers. Can have 3 passengers maximum + passenger_attach_at = {x=0,y=0,z=0}, -- attach the 1st passenger, if applicable, at the specified positions + passenger_eye_offset = {x=0, y=0, z=0}, -- offset for the 1st passenger in first-person view + passenger_detach_pos_offset = {x=0,y=0,z=0}, -- offset for the 1st passenger when they leave the vehicle + + passenger2_attach_at = {x=0,y=0,z=0}, -- attach the 2nd passenger, if applicable, at the specified positions + passenger2_eye_offset = {x=0,y=0,z=0}, -- offset for the 2nd passenger in first-person view + passenger2_detach_pos_offset = {x=0,y=0,z=0}, -- offset for the 2nd passenger when they leave the vehicle + + passenger3_attach_at = {x=0,y=0,z=0}, -- attach the 3rd passenger, if applicable, at the specified positions + passenger3_eye_offset = {x=0,y=0,z=0}, -- offset for the 3rd passenger in first-person view + passenger3_detach_pos_offset = {x=0,y=0,z=0}, -- offset for the 3rd passenger when they leave the vehicle + inventory_image = "filename.png", -- image to use in inventory wield_image = "filename.png", -- image to use in hand wield_scale = {x=1, y=1, z=1}, -- @@ -21,10 +35,12 @@ local definition = { stepheight = 0, -- what can the vehicle climb over?, 0.6 = climb slabs, 1.1 = climb nodes max_speed_forward = 10, -- vehicle maximum forward speed max_speed_reverse = 5, -- vehicle maximum reverse speed + max_speed_upwards = 5, -- vehicle maximum upwards speed (applies only if `can_fly` is enabled) + max_speed_downwards = 3.5, -- vehicle maximum downwards speed (applies only if `can_fly` is enabled) accel = 1, -- how fast vehicle accelerates braking = 2, -- how fast can the vehicle stop turn_speed = 2, -- how quick can the vehicle turn - drop_on_destroy = "", -- what gets dropped when vehicle is destroyed + drop_on_destroy = {""}, -- what gets dropped when vehicle is destroyed recipe = {} -- crafting recipe }