Skip to content

Commit

Permalink
remove owner infotext if no owner present
Browse files Browse the repository at this point in the history
  • Loading branch information
tenplus1 committed Feb 5, 2022
1 parent 18c7f0a commit 9f74408
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ local use_cmi = minetest.global_exists("cmi")

mobs = {
mod = "redo",
version = "20220120",
version = "20220205",
intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {}
}
Expand Down Expand Up @@ -785,7 +785,7 @@ function mob_class:update_tag()
end

self.infotext = "Health: " .. self.health .. " / " .. self.hp_max
.. "\n" .. "Owner: " .. self.owner
.. (self.owner == "" and "" or "\n" .. "Owner: " .. self.owner)
.. text

-- set changes
Expand Down
14 changes: 8 additions & 6 deletions mount.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

local abs, cos, floor, sin, sqrt, pi =
math.abs, math.cos, math.floor, math.sin, math.sqrt, math.pi
------------------------------------------------------------------------------

--
-- Helper functions
--

local node_ok = function(pos, fallback)

fallback = fallback or mobs.fallback_node

local node = minetest.get_node_or_nil(pos)
Expand Down Expand Up @@ -46,6 +46,7 @@ end


local function get_sign(i)

i = i or 0

if i == 0 then
Expand All @@ -57,6 +58,7 @@ end


local function get_velocity(v, yaw, y)

local x = -sin(yaw) * v
local z = cos(yaw) * v

Expand Down Expand Up @@ -92,7 +94,6 @@ local function force_detach(player)

end

-------------------------------------------------------------------------------

minetest.register_on_leaveplayer(function(player)
force_detach(player)
Expand All @@ -112,7 +113,6 @@ minetest.register_on_dieplayer(function(player)
return true
end)

-------------------------------------------------------------------------------

-- Just for correct detaching
local function find_free_pos(pos)
Expand Down Expand Up @@ -147,7 +147,6 @@ local function find_free_pos(pos)
return pos
end

-------------------------------------------------------------------------------

function mobs.attach(entity, player)

Expand Down Expand Up @@ -192,6 +191,7 @@ end


function mobs.detach(player)

force_detach(player)

minetest.after(0.1, function()
Expand Down Expand Up @@ -262,6 +262,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
entity.object:set_yaw(horz - entity.rotate)

if can_fly then

-- fly up
if ctrl.jump then

Expand Down Expand Up @@ -430,11 +431,12 @@ function mobs.fly(entity, _, speed, shoots, arrow, moving_anim, stand_anim)
local ctrl = entity.driver:get_player_control() ; if not ctrl then return end
local velo = entity.object:get_velocity()
local dir = entity.driver:get_look_dir()
local yaw = entity.driver:get_look_horizontal() + 1.57 -- offset fix between old and new commands
local yaw = entity.driver:get_look_horizontal() + 1.57

if not ctrl or not velo then return end
if not ctrl or not velo then return end

if ctrl.up then

entity.object:set_velocity({
x = dir.x * speed,
y = dir.y * speed + 2,
Expand Down

0 comments on commit 9f74408

Please sign in to comment.