master
Nathaniel Freeman 2021-08-08 03:38:24 +02:00
parent 33d37a1047
commit 7fc49924f3
5 changed files with 79 additions and 77 deletions

View File

@ -1,13 +1,17 @@
# textdomain: uwu
### functions.lua ###
UnU happiness: @1=
UwU happiness: @1=
### nodes.lua ###
UnU Pet happiness: @1=
Little UwU Block=
UwU Block=
UwU Crystal=
UwU Ore=
UwU Pet happiness: @1=
### tools.lua ###

View File

@ -1,13 +1,17 @@
# textdomain: uwu
### functions.lua ###
UnU happiness: @1=Felicidad de el cubito UnU: @1
UwU happiness: @1=Felicidad de el cubito UwU: @1
### nodes.lua ###
UnU Pet happiness: @1=Felicidad de el cubito UnU: @1
Little UwU Block=Uwito
UwU Block=Cubito UwU
UwU Crystal=Cristalcito UwU
UwU Ore=Mena de UwU
UwU Pet happiness: @1=Felicidad de el cubito UwU: @1
### tools.lua ###

140
nodes.lua
View File

@ -22,46 +22,14 @@
local S = core.get_translator(core.get_current_modname())
local uwutimer = math.random(600, 1200)
local function uwuwalk(pos)
local oldnode = core.get_node(pos)
local oldnodemeta = core.get_meta(pos):to_table()
local up = {x=pos.x, y=pos.y+1, z=pos.z}
local down = {x=pos.x, y=pos.y-1, z=pos.z}
local side1 = {x=pos.x+1, y=pos.y, z=pos.z}
local side2 = {x=pos.x-1, y=pos.y, z=pos.z}
local side3 = {x=pos.x, y=pos.y, z=pos.z+1}
local side4 = {x=pos.x, y=pos.y, z=pos.z-1}
local newpos
local r = math.random(1, 6)
if r == 1 and core.get_node(side1).name == "air" then
newpos = side1
elseif r == 2 and core.get_node(side2).name == "air" then
newpos = side2
elseif r == 3 and core.get_node(side3).name == "air" then
newpos = side3
elseif r == 4 and core.get_node(side4).name == "air" then
newpos = side4
elseif r == 5 and core.get_node(up).name == "air" then
newpos = up
elseif r == 6 and core.get_node(down).name == "air" then
newpos = down
else
return
end
core.set_node(newpos, oldnode)
core.get_meta(newpos):from_table(oldnodemeta)
core.get_node_timer(newpos):start(uwutimer)
core.set_node(pos, {name = "air"})
end
-- UwU Bloque
-- UwU Block
core.register_node("uwu:block", {
description = S("UwU Block"),
tiles = {"uwu_yellow.png", "uwu_yellow.png", "uwu_yellow.png^uwu_face.png"},
inventory_image = "uwu_yellow.png^uwu_face.png",
is_ground_content = false,
paramtype = "light",
sunlight_propagates = true,
stack_max = 64,
groups = {pickaxey=1, handy=1, uwu=1, building_block=1},
@ -70,56 +38,82 @@ core.register_node("uwu:block", {
_mcl_hardness = 0.3,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local meta = core.get_meta(pos)
meta:set_int("happiness", 1)
meta:set_string("infotext", S("UwU Pet happiness: @1", 1) )
core.get_node_timer(pos):start(uwutimer)
uwu.add_happiness(pos, 1)
core.get_node_timer(pos):start(uwu.timer)
end,
on_rightclick = function(pos, node, clicker, itemstack)
local wielditem = clicker:get_wielded_item()
local itemname = wielditem:get_name()
local isfood = core.get_item_group(itemname, "food") -- int num
local energy = core.get_item_group(itemname, "eatable") or 1
local meta = core.get_meta(pos)
local happiness = meta:get_int("happiness") -- if nil "get_int()" convert in 0 Magic!
local pitch
if happiness <= 0 then pitch = -1/happiness end
if isfood == 2 then
itemstack:take_item()
meta:set_int("happiness", happiness+energy)
core.sound_play("burp", {
pos = pos,
gain = 22,
max_hear_distance = 20,
pitch = math.random(70,110)/100
})
meta:set_string("infotext", S("UwU Pet happiness: @1", happiness+energy) )
return
end
core.sound_play("uwu", {
pos = pos,
gain = 15,
max_hear_distance = 20,
pitch = pitch
})
uwu.on_rightclick(pos, node, clicker, itemstack)
end,
on_timer = function(pos, elapsed)
local meta = core.get_meta(pos)
local happiness = meta:get_int("happiness")
meta:set_int("happiness", happiness-1)
core.get_node_timer(pos):start(uwutimer)
if happiness-1 <= 0 then
meta:set_string("infotext", S("UnU Pet happiness: @1", happiness-1) )
if happiness >= uwu.growhappiness then
uwu.grow(pos)
else
meta:set_string("infotext", S("UwU Pet happiness: @1", happiness-1) )
uwu.add_happiness(pos, -1, 5)
uwu.say_uwu(pos, 20)
uwu.walk(pos)
end
uwuwalk(pos)
core.get_node_timer(pos):start(uwu.timer)
end,
})
-- UwU Mena
local lituwubox = {
type = "fixed",
fixed = {
{-4/16, -8/16, -4/16, 4/16, 0/16, 4/16}
}
}
-- Little UwU
core.register_node("uwu:little", {
description = S("Little UwU Block"),
drawtype = "nodebox",
tiles = {"uwu_yellow.png", "uwu_yellow.png", "uwu_yellow.png^uwu_little_face.png"},
is_ground_content = false,
paramtype = "light",
sunlight_propagates = true,
selection_box = lituwubox,
node_box = lituwubox,
stack_max = 64,
groups = {pickaxey=1, handy=1, uwu=1, building_block=1},
sounds = mcl_sounds.node_sound_glass_defaults(),
_mcl_blast_resistance = 1,
_mcl_hardness = 0.3,
after_place_node = function(pos, placer, itemstack, pointed_thing)
uwu.add_happiness(pos, 1)
core.get_node_timer(pos):start(uwu.timer)
end,
on_rightclick = function(pos, node, clicker, itemstack)
uwu.on_rightclick(pos, node, clicker, itemstack)
end,
on_timer = function(pos, elapsed)
local meta = core.get_meta(pos)
local happiness = meta:get_int("happiness")
if happiness >= uwu.growhappiness then
uwu.grow(pos)
else
uwu.add_happiness(pos, -1, 5)
uwu.say_uwu(pos, 20)
uwu.walk(pos)
end
core.get_node_timer(pos):start(uwu.timer)
end,
on_punch = function(pos, node, puncher, pointed_thing)
uwu.walk(pos)
end
})
-- UwU ore
core.register_node("uwu:ore", {
description = S("UwU Ore"),
tiles = {"default_stone.png^uwu_ore.png"},
@ -143,7 +137,7 @@ core.register_node("uwu:ore", {
})
-- UwU Cristalcito
-- UwU Crystal
core.register_node("uwu:crystal", {
description = S("UwU Crystal"),
drawtype = "plantlike",

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 144 B