mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2024-12-24 01:30:22 +01:00
remove owner infotext if no owner present
This commit is contained in:
parent
18c7f0a422
commit
9f74408792
4
api.lua
4
api.lua
@ -28,7 +28,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20220120",
|
version = "20220205",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||||
}
|
}
|
||||||
@ -785,7 +785,7 @@ function mob_class:update_tag()
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.infotext = "Health: " .. self.health .. " / " .. self.hp_max
|
self.infotext = "Health: " .. self.health .. " / " .. self.hp_max
|
||||||
.. "\n" .. "Owner: " .. self.owner
|
.. (self.owner == "" and "" or "\n" .. "Owner: " .. self.owner)
|
||||||
.. text
|
.. text
|
||||||
|
|
||||||
-- set changes
|
-- set changes
|
||||||
|
12
mount.lua
12
mount.lua
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
local abs, cos, floor, sin, sqrt, pi =
|
local abs, cos, floor, sin, sqrt, pi =
|
||||||
math.abs, math.cos, math.floor, math.sin, math.sqrt, math.pi
|
math.abs, math.cos, math.floor, math.sin, math.sqrt, math.pi
|
||||||
------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Helper functions
|
-- Helper functions
|
||||||
--
|
--
|
||||||
|
|
||||||
local node_ok = function(pos, fallback)
|
local node_ok = function(pos, fallback)
|
||||||
|
|
||||||
fallback = fallback or mobs.fallback_node
|
fallback = fallback or mobs.fallback_node
|
||||||
|
|
||||||
local node = minetest.get_node_or_nil(pos)
|
local node = minetest.get_node_or_nil(pos)
|
||||||
@ -46,6 +46,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
local function get_sign(i)
|
local function get_sign(i)
|
||||||
|
|
||||||
i = i or 0
|
i = i or 0
|
||||||
|
|
||||||
if i == 0 then
|
if i == 0 then
|
||||||
@ -57,6 +58,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
local function get_velocity(v, yaw, y)
|
local function get_velocity(v, yaw, y)
|
||||||
|
|
||||||
local x = -sin(yaw) * v
|
local x = -sin(yaw) * v
|
||||||
local z = cos(yaw) * v
|
local z = cos(yaw) * v
|
||||||
|
|
||||||
@ -92,7 +94,6 @@ local function force_detach(player)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function(player)
|
minetest.register_on_leaveplayer(function(player)
|
||||||
force_detach(player)
|
force_detach(player)
|
||||||
@ -112,7 +113,6 @@ minetest.register_on_dieplayer(function(player)
|
|||||||
return true
|
return true
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- Just for correct detaching
|
-- Just for correct detaching
|
||||||
local function find_free_pos(pos)
|
local function find_free_pos(pos)
|
||||||
@ -147,7 +147,6 @@ local function find_free_pos(pos)
|
|||||||
return pos
|
return pos
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function mobs.attach(entity, player)
|
function mobs.attach(entity, player)
|
||||||
|
|
||||||
@ -192,6 +191,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function mobs.detach(player)
|
function mobs.detach(player)
|
||||||
|
|
||||||
force_detach(player)
|
force_detach(player)
|
||||||
|
|
||||||
minetest.after(0.1, function()
|
minetest.after(0.1, function()
|
||||||
@ -262,6 +262,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
|
|||||||
entity.object:set_yaw(horz - entity.rotate)
|
entity.object:set_yaw(horz - entity.rotate)
|
||||||
|
|
||||||
if can_fly then
|
if can_fly then
|
||||||
|
|
||||||
-- fly up
|
-- fly up
|
||||||
if ctrl.jump then
|
if ctrl.jump then
|
||||||
|
|
||||||
@ -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 ctrl = entity.driver:get_player_control() ; if not ctrl then return end
|
||||||
local velo = entity.object:get_velocity()
|
local velo = entity.object:get_velocity()
|
||||||
local dir = entity.driver:get_look_dir()
|
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
|
if ctrl.up then
|
||||||
|
|
||||||
entity.object:set_velocity({
|
entity.object:set_velocity({
|
||||||
x = dir.x * speed,
|
x = dir.x * speed,
|
||||||
y = dir.y * speed + 2,
|
y = dir.y * speed + 2,
|
||||||
|
Loading…
Reference in New Issue
Block a user