From 511a972d5589038b026cb17f06e10bcc0878d11b Mon Sep 17 00:00:00 2001 From: Alexsandro Percy Date: Tue, 12 Sep 2023 16:52:48 -0300 Subject: [PATCH] added noob mode --- automobiles_buggy/buggy_entities.lua | 2 +- automobiles_catrelle/entities.lua | 2 +- automobiles_coupe/coupe_entities.lua | 2 +- automobiles_delorean/entities.lua | 2 +- automobiles_lib/ground_detection.lua | 1 + automobiles_lib/init.lua | 34 +++++++++++++++++++ .../motorcycle_entities.lua | 2 +- automobiles_roadster/roadster_entities.lua | 2 +- automobiles_trans_am/entities.lua | 2 +- automobiles_vespa/vespa_entities.lua | 2 +- 10 files changed, 43 insertions(+), 8 deletions(-) diff --git a/automobiles_buggy/buggy_entities.lua b/automobiles_buggy/buggy_entities.lua index fe8af78..14440df 100755 --- a/automobiles_buggy/buggy_entities.lua +++ b/automobiles_buggy/buggy_entities.lua @@ -239,7 +239,7 @@ minetest.register_entity("automobiles_buggy:buggy", { collide_with_objects = true, collisionbox = {-0.1, -0.45, -0.1, 0.1, 1, 0.1}, selectionbox = {-1.5, 0.0, -1.5, 1.5, 2, 1.5}, - stepheight = 0.7, + stepheight = 0.7 + automobiles_lib.extra_stepheight, visual = "mesh", mesh = "automobiles_buggy_body.b3d", --use_texture_alpha = true, diff --git a/automobiles_catrelle/entities.lua b/automobiles_catrelle/entities.lua index 730f49e..8fd015d 100755 --- a/automobiles_catrelle/entities.lua +++ b/automobiles_catrelle/entities.lua @@ -216,7 +216,7 @@ minetest.register_entity("automobiles_catrelle:catrelle", { collide_with_objects = true, collisionbox = {-0.1, -0.4, -0.1, 0.1, 1.8, 0.1}, selectionbox = {-2.0, 0.0, -2.0, 2.0, 2, 2.0}, - stepheight = 0.65, + stepheight = 0.65 + automobiles_lib.extra_stepheight, visual = "mesh", mesh = "automobiles_catrelle_body.b3d", --use_texture_alpha = true, diff --git a/automobiles_coupe/coupe_entities.lua b/automobiles_coupe/coupe_entities.lua index 5b32092..912f7db 100755 --- a/automobiles_coupe/coupe_entities.lua +++ b/automobiles_coupe/coupe_entities.lua @@ -247,7 +247,7 @@ minetest.register_entity("automobiles_coupe:coupe", { collide_with_objects = true, collisionbox = {-0.1, -0.2, -0.1, 0.1, 1, 0.1}, selectionbox = {-1.5, 0.0, -1.5, 1.5, 2, 1.5}, - stepheight = 0.65, + stepheight = 0.65 + automobiles_lib.extra_stepheight, visual = "mesh", mesh = "automobiles_coupe_body.b3d", --use_texture_alpha = true, diff --git a/automobiles_delorean/entities.lua b/automobiles_delorean/entities.lua index 81ce9c2..814424f 100755 --- a/automobiles_delorean/entities.lua +++ b/automobiles_delorean/entities.lua @@ -356,7 +356,7 @@ minetest.register_entity("automobiles_delorean:delorean", { collide_with_objects = true, collisionbox = {-0.1, -0.2, -0.1, 0.1, 1, 0.1}, selectionbox = {-1.5, 0.0, -1.5, 1.5, 2, 1.5}, - stepheight = 0.65, + stepheight = 0.65 + automobiles_lib.extra_stepheight, visual = "mesh", mesh = "automobiles_delorean_body.b3d", --use_texture_alpha = true, diff --git a/automobiles_lib/ground_detection.lua b/automobiles_lib/ground_detection.lua index e4d0693..872cbfd 100644 --- a/automobiles_lib/ground_detection.lua +++ b/automobiles_lib/ground_detection.lua @@ -141,6 +141,7 @@ function automobiles_lib.eval_interception(initial_pos, end_pos) if pos then local nodename = minetest.get_node(thing.under).name local drawtype = get_nodedef_field(nodename, "drawtype") + if drawtype ~= "plantlike" then if initial_pos.y >= pos.y then ret_y = pos.y diff --git a/automobiles_lib/init.lua b/automobiles_lib/init.lua index ac1f7bf..e7dfb39 100755 --- a/automobiles_lib/init.lua +++ b/automobiles_lib/init.lua @@ -3,6 +3,8 @@ local S = minetest.get_translator(minetest.get_current_modname()) automobiles_lib = {} +local storage = minetest.get_mod_storage() + automobiles_lib.fuel = {['biofuel:biofuel'] = 1,['biofuel:bottle_fuel'] = 1, ['biofuel:phial_fuel'] = 0.25, ['biofuel:fuel_can'] = 10, ['airutils:biofuel'] = 1,} @@ -10,6 +12,16 @@ automobiles_lib.fuel = {['biofuel:biofuel'] = 1,['biofuel:bottle_fuel'] = 1, automobiles_lib.gravity = 9.8 automobiles_lib.is_creative = minetest.settings:get_bool("creative_mode", false) + +local load_noob_mode = storage:get_int("noob_mode") +automobiles_lib.noob_mode = false +automobiles_lib.extra_stepheight = 0 +-- 1 == true ---- 2 == false +if load_noob_mode == 1 then + automobiles_lib.load_noob_mode = true + automobiles_lib.extra_stepheight = 1 +end + --cars colors automobiles_lib.colors ={ black='#2b2b2b', @@ -636,3 +648,25 @@ minetest.register_chatcommand("transfer_vehicle", { end end }) + +minetest.register_chatcommand("noobfy_the_vehicles", { + params = "", + description = "Enable/disable the NOOB mode for the vehicles", + privs = {server=true}, + func = function(name, param) + local command = param + + if command == "false" then + automobiles_lib.noob_mode = false + automobiles_lib.extra_stepheight = 0 + minetest.chat_send_player(name, ">>> Noob mode is disabled - A restart is required to changes take full effect") + else + automobiles_lib.noob_mode = true + automobiles_lib.extra_stepheight = 1 + minetest.chat_send_player(name, ">>> Noob mode is enabled - A restart is required to changes take full effect") + end + local save = 2 + if automobiles_lib.noob_mode == true then save = 1 end + storage:set_int("noob_mode", save) + end, +}) diff --git a/automobiles_motorcycle/motorcycle_entities.lua b/automobiles_motorcycle/motorcycle_entities.lua index 42c0cb4..800cb07 100755 --- a/automobiles_motorcycle/motorcycle_entities.lua +++ b/automobiles_motorcycle/motorcycle_entities.lua @@ -98,7 +98,7 @@ minetest.register_entity("automobiles_motorcycle:motorcycle", { collide_with_objects = true, collisionbox = {-0.1, -0.4, -0.1, 0.1, 1, 0.1}, selectionbox = {-1, 1, -1, 1, -1, 1}, - stepheight = 0.8, + stepheight = 0.8 + automobiles_lib.extra_stepheight, visual = "mesh", mesh = "automobiles_motorcycle_body.b3d", --use_texture_alpha = true, diff --git a/automobiles_roadster/roadster_entities.lua b/automobiles_roadster/roadster_entities.lua index 6c5080a..fec60bc 100755 --- a/automobiles_roadster/roadster_entities.lua +++ b/automobiles_roadster/roadster_entities.lua @@ -215,7 +215,7 @@ minetest.register_entity("automobiles_roadster:roadster", { collide_with_objects = true, collisionbox = {-0.1, -0.5, -0.1, 0.1, 1, 0.1}, selectionbox = {-1.5, 0.0, -1.5, 1.5, 2, 1.5}, - stepheight = 0.6, + stepheight = 0.6 + automobiles_lib.extra_stepheight, visual = "mesh", mesh = "automobiles_roadster.b3d", --use_texture_alpha = true, diff --git a/automobiles_trans_am/entities.lua b/automobiles_trans_am/entities.lua index ed19535..55c5c7d 100755 --- a/automobiles_trans_am/entities.lua +++ b/automobiles_trans_am/entities.lua @@ -297,7 +297,7 @@ minetest.register_entity("automobiles_trans_am:trans_am", { collide_with_objects = true, collisionbox = {-0.1, -0.2, -0.1, 0.1, 1.8, 0.1}, selectionbox = {-2.0, 0.0, -2.0, 2.0, 2, 2.0}, - stepheight = 0.65, + stepheight = 0.65 + automobiles_lib.extra_stepheight, visual = "mesh", mesh = "automobiles_trans_am_body.b3d", --use_texture_alpha = true, diff --git a/automobiles_vespa/vespa_entities.lua b/automobiles_vespa/vespa_entities.lua index a8fc633..a8cd7b4 100755 --- a/automobiles_vespa/vespa_entities.lua +++ b/automobiles_vespa/vespa_entities.lua @@ -98,7 +98,7 @@ minetest.register_entity("automobiles_vespa:vespa", { collide_with_objects = true, collisionbox = {-0.1, -0.24, -0.1, 0.1, 1, 0.1}, selectionbox = {-1, 1, -1, 1, -1, 1}, - stepheight = 0.8, + stepheight = 0.8 + automobiles_lib.extra_stepheight, visual = "mesh", mesh = "automobiles_vespa_body.b3d", --use_texture_alpha = true,