From cf8c44cb8099f1b6387b056d9efb2b1a4c16123f Mon Sep 17 00:00:00 2001 From: loosewheel <76670709+loosewheel@users.noreply.github.com> Date: Thu, 25 Nov 2021 07:06:57 +1000 Subject: [PATCH] Add files via upload --- breaker.lua | 2 +- cannon.lua | 25 +++++++++++++++++++++++++ change.log | 5 +++++ init.lua | 2 +- readme.txt | 2 +- 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/breaker.lua b/breaker.lua index b8abf1f..c7b0a19 100644 --- a/breaker.lua +++ b/breaker.lua @@ -138,9 +138,9 @@ local function can_break_node (pos, breakpos) if node_def then -- try tool first local tool = get_tool (pos) + local dig_params = nil if tool then - local dig_params = nil local tool_def = minetest.registered_items[tool:get_name ()] if tool_def then diff --git a/cannon.lua b/cannon.lua index 1b803f3..175f186 100644 --- a/cannon.lua +++ b/cannon.lua @@ -180,6 +180,25 @@ end +local function aim_barrel_delayed (pos, aimpos) + local x = tonumber (aimpos.x) or 0 + local y = tonumber (aimpos.y) or 0 + local z = tonumber (aimpos.z) or 0 + + if z < 1 then + return + end + + local angle = vector.dir_to_rotation (aimpos) + + local rot = math.floor (math.deg (-angle.y) + 0.5) + local pitch = math.floor (math.deg (angle.x) + 0.5) + + set_barrel_angle_delayed (pos, pitch, rot) +end + + + local function fire_cannon (pos) local meta = minetest.get_meta (pos) @@ -764,6 +783,12 @@ local function digilines_support () msg.pitch and msg.yaw and msg.name and msg.look_vector then process_controller_input (pos, msg) + + elseif type (msg.action) == "string" and msg.action == "aim" and + type (msg.aim) == "table" then + + aim_barrel_delayed (pos, msg.aim) + end end diff --git a/change.log b/change.log index 2b8a35c..c6cb695 100644 --- a/change.log +++ b/change.log @@ -62,3 +62,8 @@ v0.1.9 v0.1.10 * Added cannons. + + +v0.1.11 +* Fix to breakers (?). +* Added position aiming to cannons. diff --git a/init.lua b/init.lua index a1c66dc..615c3aa 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,4 @@ -local version = "0.1.10" +local version = "0.1.11" local mod_storage = minetest.get_mod_storage () diff --git a/readme.txt b/readme.txt index 3f7b1e8..5816552 100644 --- a/readme.txt +++ b/readme.txt @@ -13,7 +13,7 @@ CC BY-SA 3.0 Version ======= -0.1.10 +0.1.11 Minetest Version