use api functions, fix missing function in morvalar.lua

This commit is contained in:
tenplus1 2023-10-13 08:58:31 +01:00
parent bcbd464bbc
commit 921648258e
7 changed files with 32 additions and 20 deletions

View File

@ -60,7 +60,7 @@ mobs:register_mob("nssm:mordain", {
local s = self.object:get_pos()
local p = self.attack:get_pos()
mobs:set_animation(self, "punch")
self:set_animation("punch")
if minetest.line_of_sight(
{x = p.x, y = p.y + 1.5, z = p.z},

View File

@ -62,7 +62,7 @@ mobs:register_mob("nssm:morde", {
local s = self.object:get_pos()
local p = self.attack:get_pos()
mobs:set_animation(self, "punch")
self:set_animation("punch")
self.health = self.health + (self.damage * 2)

View File

@ -71,7 +71,7 @@ mobs:register_mob("nssm:morgut", {
self.state = ""
mobs:set_animation(self, "run")
self:set_animation("run")
self.object:set_yaw(self.dir)
@ -99,7 +99,7 @@ mobs:register_mob("nssm:morgut", {
local s = self.object:get_pos()
local p = self.attack:get_pos()
mobs:set_animation(self, "punch")
self:set_animation("punch")
local m = 2
@ -182,7 +182,7 @@ mobs:register_mob("nssm:morgut", {
end
end
mobs:set_animation(self, "run")
self:set_animation("run")
self.flag = 1
self.morgut_timer = os.time()

View File

@ -73,7 +73,7 @@ mobs:register_mob("nssm:morlu", {
self.state = ""
mobs:set_animation(self, "run")
self:set_animation("run")
self:set_yaw(self.dir)
@ -99,7 +99,7 @@ mobs:register_mob("nssm:morlu", {
local s = self.object:get_pos()
local p = self.attack:get_pos()
mobs:set_animation(self, "punch")
self:set_animation("punch")
local m = 1
@ -215,7 +215,7 @@ mobs:register_mob("nssm:morlu", {
armor_elements[steal_pos].name
end
mobs:set_animation(self, "run")
self:set_animation("run")
self.flag = 1
self.morlu_timer = os.time()
@ -239,7 +239,7 @@ mobs:register_mob("nssm:morlu", {
local s = self.object:get_pos()
local p = self.attack:get_pos()
mobs:set_animation(self, "punch")
self:set_animation("punch")
if minetest.line_of_sight(
{x = p.x, y = p.y +1.5, z = p.z},

View File

@ -2,6 +2,18 @@ local time_limit = 120
local level = tonumber(minetest.settings:get("nssb.morlendor_level")) or -30000
local posmorvalarblock = {x = 827, y = level -94, z = -817}
local function perpendicular_vector(vec) --returns a vector rotated of 90° in 2D
local ang = math.pi / 2
local c = math.cos(ang)
local s = math.sin(ang)
local i = vec.x * c - vec.z * s
local k = vec.x * s + vec.z * c
local j = 0
return {x = i, y = j, z = k}
end
local function respawn_block(self)
--start a timer if it doesn't exist
self.stop_timer = self.stop_timer or os.time()
@ -90,7 +102,7 @@ mobs:register_mob("nssm:morvalar", {
local s = self.object:get_pos()
local p = self.attack:get_pos()
mobs:set_animation(self, "punch")
self:set_animation("punch")
local m = 1
@ -193,7 +205,7 @@ mobs:register_mob("nssm:morvalar", {
local s = self.object:get_pos()
local p = self.attack:get_pos()
mobs:set_animation(self, "punch")
self:set_animation("punch")
if minetest.line_of_sight(
{x = p.x, y = p.y + 1.5, z = p.z},
@ -291,7 +303,7 @@ mobs:register_mob("nssm:morvalar6", {
local s = self.object:get_pos()
local p = self.attack:get_pos()
mobs:set_animation(self, "punch")
self:set_animation("punch")
local m = 2
@ -439,7 +451,7 @@ mobs:register_mob("nssm:morvalar5", {
minetest.after(2, function(self)
mobs:set_animation(self, "punch")
self:set_animation("punch")
nssm:tnt_boom_nssm(p, {
damage_radius = 6, radius = 5, ignore_protection = false})
@ -523,7 +535,7 @@ mobs:register_mob("nssm:morvalar4", {
local s = self.object:get_pos()
local p = self.attack:get_pos()
mobs:set_animation(self, "punch")
self:set_animation("punch")
if minetest.line_of_sight({x = p.x, y = p.y + 1.5, z = p.z},
{x = s.x, y = s.y + 1.5, z = s.z}) == true then
@ -759,7 +771,7 @@ mobs:register_mob("nssm:morvalar2", {
if counter < 2 then
mobs:set_animation(self, "punch")
self:set_animation("punch")
local v = vector.subtract(p,s)
@ -860,7 +872,7 @@ mobs:register_mob("nssm:morvalar1", {
local s = self.object:get_pos()
local p = self.attack:get_pos()
mobs:set_animation(self, "punch")
self:set_animation("punch")
local m = 3
@ -962,7 +974,7 @@ mobs:register_mob("nssm:morvalar0", {
local s = self.object:get_pos()
local p = self.attack:get_pos()
mobs:set_animation(self, "punch")
self:set_animation("punch")
local m = 5 --velocity of the kamehameha
local obj = minetest.add_entity(s, "nssm:kamehameha_bad")

View File

@ -52,13 +52,13 @@ mobs:register_mob("nssm:morvy", {
custom_attack = function(self)
mobs:set_animation(self, "stand")
self:set_animation("stand")
self.morvy_counter = (self.morvy_counter or 0) + 1
if self.morvy_counter == 4 then
mobs:set_animation(self, "punch")
self:set_animation("punch")
self.morvy_counter = 0

View File

@ -67,7 +67,7 @@ mobs:register_mob("nssm:pumpking", {
if (os.time() - self.pumpking_timer) > 3 then
mobs:set_animation(self, "punch")
self:set_animation("punch")
self.pumpking_timer = os.time()