Replace deprecated code

Minetest shows warnings about using deprecated code such as the setpos() method.
Furthermore, two nodes are no longer semi-transparent due to code deprecation.
This commit is contained in:
HybridDog 2024-08-31 15:55:16 +02:00
parent 4a8d03b613
commit 5f5aec9e54
3 changed files with 23 additions and 19 deletions

View File

@ -1,3 +0,0 @@
default
nyancat?
treecapitator?

View File

@ -28,7 +28,7 @@ local cloudstone_sounds = {
minetest.register_node("nyanland:cloudstone", {
tiles = {"nyanland_cloudstone.png"},
use_texture_alpha = true,
use_texture_alpha = "blend",
sunlight_propagates = true,
light_source = 10,
groups = {dig_immediate = 3, not_in_creative_inventory=1},
@ -37,7 +37,7 @@ minetest.register_node("nyanland:cloudstone", {
minetest.register_node("nyanland:cloudstone_var", {
tiles = {"nyanland_cloudstone_var.png", "nyanland_cloudstone_var.png", "nyanland_cloudstone.png"},
use_texture_alpha = true,
use_texture_alpha = "blend",
sunlight_propagates = true,
drop = '',
light_source = 10,
@ -257,9 +257,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
local map_lengths_xyz = {x=side_length, y=side_length, z=side_length}
local pmap1 = minetest.get_perlin_map(hole, map_lengths_xyz
):get2dMap_flat{x=minp.x, y=minp.z}
):get_2d_map_flat{x=minp.x, y=minp.z}
local pmap2 = minetest.get_perlin_map(height, map_lengths_xyz
):get2dMap_flat{x=minp.x, y=minp.z}
):get_2d_map_flat{x=minp.x, y=minp.z}
local num = 1
local tab = {}
@ -452,22 +452,24 @@ local function spawn_falling_node(pos, node)
end
minetest.register_entity("nyanland:head_entity", {
physical = true,
lastpos = {x=0, y=0, z=0},
textures = {"nyancat_side.png", "nyancat_side.png", "nyancat_side.png",
"nyancat_side.png", "nyancat_back.png", "nyancat_front.png"},
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
visual = "cube",
visual_size = {x=1.001, y=1.001},
initial_properties = {
physical = true,
textures = {"nyancat_side.png", "nyancat_side.png", "nyancat_side.png",
"nyancat_side.png", "nyancat_back.png", "nyancat_front.png"},
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
visual = "cube",
visual_size = {x=1.001, y=1.001},
},
on_activate = function(self)
self.object:setvelocity{x=0, y=0, z=-2}
self.object:set_velocity{x=0, y=0, z=-2}
self.object:set_armor_groups{immortal=1}
self.lastpos = vector.round(self.object:getpos())
self.lastpos = vector.round(self.object:get_pos())
self.timer = math.random()*8-4
end,
on_punch = function(self)
local mesepos = self.object:getpos()
local mesepos = self.object:get_pos()
if math.random(10) == 1 then
minetest.sound_play("nyanland_cat",
{pos = mesepos, gain = 0.9, max_hear_distance = 35})
@ -483,7 +485,7 @@ minetest.register_entity("nyanland:head_entity", {
self.object:remove()
return
end
local finepos = self.object:getpos()
local finepos = self.object:get_pos()
local pos = vector.round(finepos)
if vector.equals(self.lastpos, pos) then
return
@ -509,7 +511,9 @@ minetest.register_entity("nyanland:head_entity", {
end
minetest.add_node(p, {name="nyancat:nyancat_rainbow"})
end
end
end,
lastpos = {x=0, y=0, z=0},
})

3
mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = nyanland
depends = default
optional_depends = nyancat,treecapitator