This commit is contained in:
root 2021-06-27 17:39:50 +02:00
parent 6f3c3f8b60
commit e32f708c10
66 changed files with 1274 additions and 360 deletions

View file

@ -55,12 +55,14 @@ armor = {
crystal = "ethereal:crystal_ingot", crystal = "ethereal:crystal_ingot",
}, },
fire_nodes = { fire_nodes = {
{"nether:lava_source", 5, 8},
{"default:lava_source", 5, 8}, {"default:lava_source", 5, 8},
{"default:lava_flowing", 5, 8}, {"default:lava_flowing", 5, 8},
{"fire:basic_flame", 3, 4}, {"fire:basic_flame", 3, 4},
{"fire:permanent_flame", 3, 4}, {"fire:permanent_flame", 3, 4},
{"ethereal:crystal_spike", 2, 1}, {"ethereal:crystal_spike", 2, 1},
{"ethereal:fire_flower", 2, 1}, {"ethereal:fire_flower", 2, 1},
{"nether:lava_crust", 2, 1},
{"default:torch", 1, 1}, {"default:torch", 1, 1},
{"default:torch_ceiling", 1, 1}, {"default:torch_ceiling", 1, 1},
{"default:torch_wall", 1, 1}, {"default:torch_wall", 1, 1},
@ -671,3 +673,10 @@ armor.drop_armor = function(pos, stack)
end end
end end
end end
--- Allows skin mod to be set manually.
--
-- Useful for skin mod forks that do not use the same name.
armor.set_skin_mod = function(mod)
armor.skin_mod = mod
end

View file

@ -69,12 +69,12 @@ end
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
local name = player:get_player_name() local name = player:get_player_name()
wieldview.wielded_item[name] = "" wieldview.wielded_item[name] = ""
minetest.after(0, function() minetest.after(0, function(pname)
local pplayer = minetest.get_player_by_name(name) local pplayer = minetest.get_player_by_name(pname)
if player then if pplayer then
wieldview:update_wielded_item(pplayer) wieldview:update_wielded_item(pplayer)
end end
end) end, name)
end) end)
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)

View file

@ -19,5 +19,6 @@ Based on Immersive Sounds .36 mod by Neuromancer and optimized to run on servers
- 1.4 - Re-ordered water sets to come before fire and lava, day/night sounds play when leaves around and above ground - 1.4 - Re-ordered water sets to come before fire and lava, day/night sounds play when leaves around and above ground
- 1.5 - Added 'flame_sound' and fire redo check, code tidy and tweak, added ephemeral flag for background sounds. - 1.5 - Added 'flame_sound' and fire redo check, code tidy and tweak, added ephemeral flag for background sounds.
- 1.6 - Finding env_sounds disables water and lava sets, added 'ambience_water_move' flag to override water walking sounds, use eye level for head node. - 1.6 - Finding env_sounds disables water and lava sets, added 'ambience_water_move' flag to override water walking sounds, use eye level for head node.
- 1.7 - Music will play every 20-30 minutes if found, use '/mvol 0' to stop playing music or disable in-game.
Code license: MIT Code license: MIT

View file

@ -3,7 +3,7 @@ ambience = {}
-- settings -- settings
local SOUNDVOLUME = 1.0 local SOUNDVOLUME = 1.0
local MUSICVOLUME = 1.0 local MUSICVOLUME = 0.6
local play_music = minetest.settings:get_bool("ambience_music") ~= false local play_music = minetest.settings:get_bool("ambience_music") ~= false
local pplus = minetest.get_modpath("playerplus") local pplus = minetest.get_modpath("playerplus")
local radius = 6 local radius = 6
@ -91,7 +91,7 @@ end
-- setup table when player joins -- setup table when player joins
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
playing[player:get_player_name()] = {} playing[player:get_player_name()] = {music = -1}
end) end)
-- remove table when player leaves -- remove table when player leaves
@ -103,24 +103,31 @@ end)
-- plays music and selects sound set -- plays music and selects sound set
local get_ambience = function(player, tod, name) local get_ambience = function(player, tod, name)
-- play server or local music if available -- play server or local music if music enabled and music not already playing
if play_music then if play_music and MUSICVOLUME > 0 and playing[name].music < 0 then
-- play at midnight -- count backwards
if tod >= 0.0 and tod <= 0.01 then playing[name].music = playing[name].music -1
if not playing[name].music then -- play music every 20 minutes
if playing[name].music < -(60 * 20) then
playing[name].music = minetest.sound_play("ambience_music", { playing[name].music = minetest.sound_play("ambience_music", {
to_player = name, to_player = name,
gain = MUSICVOLUME gain = MUSICVOLUME
}) })
-- reset music timer after 10 minutes
minetest.after(60 * 10, function(name)
if playing[name] then
playing[name].music = -1
end
end, name)
end end
elseif tod > 0.1 and playing[name].music then --print("-- music count", playing[name].music)
playing[name].music = nil
end
end end
-- get foot and head level nodes at player position -- get foot and head level nodes at player position
@ -198,7 +205,7 @@ minetest.register_globalstep(function(dtime)
--print(string.format("elapsed time: %.4f\n", os.clock() - t1)) --print(string.format("elapsed time: %.4f\n", os.clock() - t1))
ok = playing[player_name] -- everything starts off ok if player around ok = playing[player_name] -- everything starts off ok if player found
-- are we playing something already? -- are we playing something already?
if ok and playing[player_name].handler then if ok and playing[player_name].handler then
@ -295,19 +302,23 @@ minetest.register_chatcommand("svol", {
-- music volume command (0 stops music) -- music volume command (0 stops music)
minetest.register_chatcommand("mvol", { minetest.register_chatcommand("mvol", {
params = "<mvol>", params = "<mvol>",
description = "set music volume (0.1 to 1.0)", description = "set music volume (0.1 to 1.0, 0 to stop music)",
privs = {server = true}, privs = {server = true},
func = function(name, param) func = function(name, param)
MUSICVOLUME = tonumber(param) or MUSICVOLUME MUSICVOLUME = tonumber(param) or MUSICVOLUME
-- ability to stop music just as it begins -- ability to stop music by setting volume to 0
if MUSICVOLUME == 0 and playing[name].music then if MUSICVOLUME == 0 and playing[name].music
and playing[name].music >= 0 then
minetest.sound_stop(playing[name].music) minetest.sound_stop(playing[name].music)
playing[name].music = -1
end end
if MUSICVOLUME < 0.1 then MUSICVOLUME = 0.1 end if MUSICVOLUME < 0 then MUSICVOLUME = 0 end
if MUSICVOLUME > 1.0 then MUSICVOLUME = 1.0 end if MUSICVOLUME > 1.0 then MUSICVOLUME = 1.0 end
return true, "Music volume set to " .. MUSICVOLUME return true, "Music volume set to " .. MUSICVOLUME

View file

@ -220,6 +220,21 @@ local anvildef = {
sounds = default.node_sound_metal_defaults(), sounds = default.node_sound_metal_defaults(),
---------------- added
can_dig = function(pos, player)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
if inv:is_empty("input") and inv:is_empty("output") then
if not minetest.is_protected(pos, player:get_player_name()) then
return true
end
end
end,
-----------------
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)

View file

@ -95,6 +95,8 @@ end)
-- default biomes deco -- default biomes deco
local deco = { local deco = {
{"default:dry_dirt", dry_grass, {}},
{"default:dry_dirt_with_dry_grass", dry_grass, {}},
{"default:dirt_with_dry_grass", dry_grass, flowers}, {"default:dirt_with_dry_grass", dry_grass, flowers},
{"default:sand", {}, {"default:dry_shrub", "", "", ""} }, {"default:sand", {}, {"default:dry_shrub", "", "", ""} },
{"default:desert_sand", {}, {"default:dry_shrub", "", "", ""} }, {"default:desert_sand", {}, {"default:dry_shrub", "", "", ""} },

View file

@ -11,13 +11,13 @@ if minetest.get_modpath("lucky_block") then
{"dro", {"bows:arrow_diamond"}, 5}, {"dro", {"bows:arrow_diamond"}, 5},
{"nod", "default:chest", 0, { {"nod", "default:chest", 0, {
{name = "default:stick", max = 5}, {name = "default:stick", max = 5},
{name = "default:flint", max = 3}, {name = "default:flint", max = 5},
{name = "default:steel_ingot", max = 3}, {name = "default:steel_ingot", max = 5},
{name = "default:bronze_ingot", max = 3}, {name = "default:bronze_ingot", max = 5},
{name = "default:mese_crystal_fragment", max = 3}, {name = "default:mese_crystal_fragment", max = 5},
{name = "farming:string", max = 5}, {name = "farming:string", max = 5},
{name = bows.feather, max = 4}, {name = bows.feather, max = 5},
{name = "bows:bow_bowie", max = 1} {name = "bows:bow_bowie", max = 1, chance = 4}
}}, }},
}) })
end end

View file

@ -9,6 +9,12 @@
local S = cottages.S local S = cottages.S
-- disable repair with anvil by setting a message for the item in question
cottages.forbid_repair = {}
-- example for hammer no longer beeing able to repair the hammer
--cottages.forbid_repair["cottages:hammer"] = 'The hammer is too complex for repairing.'
-- the hammer for the anvil -- the hammer for the anvil
minetest.register_tool("cottages:hammer", { minetest.register_tool("cottages:hammer", {
description = S("Steel hammer for repairing tools on the anvil"), description = S("Steel hammer for repairing tools on the anvil"),
@ -138,6 +144,12 @@ minetest.register_node("cottages:anvil", {
S('The workpiece slot is for damaged tools only.')); S('The workpiece slot is for damaged tools only.'));
return 0; return 0;
end end
if( listname=='input'
and cottages.forbid_repair[ stack:get_name() ]) then
minetest.chat_send_player( player:get_player_name(),
S(cottages.forbid_repair[ stack:get_name() ]));
return 0;
end
return stack:get_count() return stack:get_count()
end, end,
@ -181,6 +193,14 @@ minetest.register_node("cottages:anvil", {
-- 65535 is max damage -- 65535 is max damage
local damage_state = 40-math.floor(input:get_wear()/1638); local damage_state = 40-math.floor(input:get_wear()/1638);
-- just to make sure that it really can't get repaired if it should not
-- (if the check of placing the item in the input slot failed somehow)
if( puncher and name and cottages.forbid_repair[ input:get_name() ]) then
minetest.chat_send_player( name,
S(cottages.forbid_repair[ input:get_name() ]));
return;
end
local tool_name = input:get_name(); local tool_name = input:get_name();
local hud_image = ""; local hud_image = "";
if( tool_name if( tool_name

View file

@ -117,7 +117,7 @@ minetest.register_node("cottages:water_gen", {
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
is_ground_content = false, is_ground_content = false,
groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, groups = {tree = 1, choppy = 2, cracky = 1, flammable = 2},
sounds = cottages.sounds.wood, sounds = cottages.sounds.wood,
node_box = { node_box = {
type = "fixed", type = "fixed",
@ -178,8 +178,14 @@ minetest.register_node("cottages:water_gen", {
can_dig = function(pos,player) can_dig = function(pos,player)
local meta = minetest.get_meta(pos); local meta = minetest.get_meta(pos);
local inv = meta:get_inventory() local inv = meta:get_inventory()
return inv:is_empty("main") and local bucket = meta:get_string("bucket")
default.can_interact_with_node(player, pos) local start = meta:get_string("fillstarttime")
return inv:is_empty("main")
and default.can_interact_with_node(player, pos)
and (not(bucket) or bucket == "")
and ((not(start) or start == "" or
(minetest.get_us_time()/1000000) - tonumber(start)
>= cottages.water_fill_time -2))
end, end,
-- no inventory move allowed -- no inventory move allowed
allow_metadata_inventory_move = function(pos, from_list, from_index, allow_metadata_inventory_move = function(pos, from_list, from_index,
@ -213,7 +219,7 @@ minetest.register_node("cottages:water_gen", {
cottages.switch_public(pos, formname, fields, sender, 'tree trunk well') cottages.switch_public(pos, formname, fields, sender, 'tree trunk well')
end, end,
-- punch to place and retrieve bucket -- punch to place and retrieve bucket
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher, pointed_thing)
if( not( pos ) or not( node ) or not( puncher )) then if( not( pos ) or not( node ) or not( puncher )) then
return return
end end
@ -223,7 +229,8 @@ minetest.register_node("cottages:water_gen", {
local owner = meta:get_string("owner") local owner = meta:get_string("owner")
local public = meta:get_string("public") local public = meta:get_string("public")
if( name ~= owner and public~="public") then if( name ~= owner and public~="public") then
minetest.chat_send_player( name, S("This tree trunk well is owned by %s. You can't use it."):format(name)) minetest.chat_send_player( name,
S("This tree trunk well is owned by %s. You can't use it."):format(owner))
return return
end end
@ -233,13 +240,18 @@ minetest.register_node("cottages:water_gen", {
-- is the well working on something? (either empty or full bucket) -- is the well working on something? (either empty or full bucket)
local bucket = meta:get_string("bucket") local bucket = meta:get_string("bucket")
-- there is a bucket loaded - either empty or full -- there is a bucket loaded - either empty or full
if( bucket and bucket~="") then if( bucket and bucket~="" and bucket ~= "bucket:bucket_empty") then
if( not(pinv:room_for_item("main", bucket))) then if( not(pinv:room_for_item("main", bucket))) then
minetest.chat_send_player( puncher:get_player_name(), minetest.chat_send_player( puncher:get_player_name(),
S("Sorry. You have no room for the bucket. Please free some ".. S("Sorry. You have no room for the bucket. Please free some "..
"space in your inventory first!")) "space in your inventory first!"))
return return
end end
elseif( bucket and bucket == "bucket:bucket_empty") then
minetest.chat_send_player( puncher:get_player_name(),
S("Please wait until your bucket has been filled."))
-- do not give the empty bucket back immediately
return
end end
-- remove the old entity (either a bucket will be placed now or a bucket taken) -- remove the old entity (either a bucket will be placed now or a bucket taken)
@ -267,8 +279,6 @@ minetest.register_node("cottages:water_gen", {
if( wielded if( wielded
and wielded:get_name() and wielded:get_name()
and wielded:get_name() == "bucket:bucket_empty") then and wielded:get_name() == "bucket:bucket_empty") then
-- remove the bucket from the players inventory
pinv:remove_item( "main", "bucket:bucket_empty")
-- remember that we got a bucket loaded -- remember that we got a bucket loaded
meta:set_string("bucket", "bucket:bucket_empty") meta:set_string("bucket", "bucket:bucket_empty")
-- create the entity -- create the entity
@ -280,6 +290,8 @@ minetest.register_node("cottages:water_gen", {
minetest.after(cottages.water_fill_time, cottages.water_gen_fill_bucket, pos) minetest.after(cottages.water_fill_time, cottages.water_gen_fill_bucket, pos)
-- the bucket will only be filled if the water ran long enough -- the bucket will only be filled if the water ran long enough
meta:set_string("fillstarttime", tostring(minetest.get_us_time()/1000000)) meta:set_string("fillstarttime", tostring(minetest.get_us_time()/1000000))
-- remove the bucket from the players inventory
pinv:remove_item( "main", "bucket:bucket_empty")
return; return;
end end
-- buckets can also be emptied here -- buckets can also be emptied here

View file

@ -32,6 +32,25 @@ minetest.register_craft({
recipe = "group:food_corn" recipe = "group:food_corn"
}) })
-- popcorn
minetest.register_craftitem("farming:popcorn", {
description = S("Popcorn"),
inventory_image = "farming_popcorn.png",
groups = {food_popcorn = 1, flammable = 2},
on_use = minetest.item_eat(4)
})
minetest.register_craft({
output = "farming:popcorn",
recipe = {
{"group:food_pot", "group:food_oil", "group:food_corn"}
},
replacements = {
{"group:food_pot", "farming:pot"},
{"group:food_oil", "vessels:glass_bottle"}
}
})
-- cornstarch -- cornstarch
minetest.register_craftitem("farming:cornstarch", { minetest.register_craftitem("farming:cornstarch", {
description = S("Cornstarch"), description = S("Cornstarch"),

View file

@ -173,3 +173,6 @@ Created by gorlock (CC0)
Created by sirrobzeroone (CC0) Created by sirrobzeroone (CC0)
farming_gyoza.png farming_gyoza.png
farming_pineapple_ring.png farming_pineapple_ring.png
Created by TechM8 (https://www.deviantart.com/techm8)
farming_popcorn.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

View file

@ -0,0 +1,10 @@
# Convert '.po' file to '.txt' file.
### COMMAND SAMPLE
''''
$ lua po2tr.lua "Your Name (Your Site) <Your Email>" "pt_BR.po"
rm "pt_BR.tr" "mobs_animal.pt_BR.tr"
$ cat mobs_animal.pt_BR.tr | less
''''
Source Code: https://gitlab.com/4w/xtend/-/blob/master/xtend_default/tools/convert_po_file_to_tr_file/convert_po_file_to_tr_file.lua

View file

@ -0,0 +1,46 @@
# textdomain: Lunovox Heavenfinder (https://libreplanet.org/wiki/User:Lunovox) <lunovox@disroot.org>
Bee=Abelha
Honey=Mel
Beehive=Colméia
Honey Block=Bloco de Mel
Bunny=Coelho
Raw Rabbit=Carne de Coelho (Cru)
Cooked Rabbit=Coelho (Assado)
Rabbit Hide=Pele de Coelho
Chicken=Galinha
Chicken Egg=Ovo de Galinha
Fried Egg=Ovo Frito
Raw Chicken=Carne de Galinha (Crua)
Cooked Chicken=Galinha Assada
Feather=Pluma
Cow already milked!=Vaca já ordenhada!
Cow=Vaca
Bucket of Milk=Balde de leite
Cheese=Queijo
Cheese Block=Bloco de Queijo
[MOD] Mobs Redo 'Animals' loaded=[MOBS_ANIMAL] Mod carregado completamente
Kitten=Gato
Penguin=Pinguim
Rat=Rato
Cooked Rat=Rato (Assado)
Black=Preto
Blue=Azul
Brown=Marrom
Cyan=Ciano
Dark Green=Verde Escuro
Dark Grey=Cinza Escuro
Green=Verde
Grey=Cinza
Magenta=Rosa Magenta
Orange=Laranja
Pink=Rosa
Red=Vermelho
Violet=Violeta
White=Branco
Yellow=Amarelo
@1 Sheep=Ovelha @1
Raw Mutton=Carneiro (Cru)
Cooked Mutton=Carneiro (Assado)
Warthog=Javali
Raw Porkchop=Costeleta de Javali (Crua)
Cooked Porkchop=Costeleta de Javali Assada

View file

@ -0,0 +1,46 @@
# textdomain: Lunovox Heavenfinder (https://libreplanet.org/wiki/User:Lunovox) <lunovox@disroot.org>
Bee=Abelha
Honey=Mel
Beehive=Colméia
Honey Block=Bloco de Mel
Bunny=Coelho
Raw Rabbit=Carne de Coelho (Cru)
Cooked Rabbit=Coelho (Assado)
Rabbit Hide=Pele de Coelho
Chicken=Galinha
Chicken Egg=Ovo de Galinha
Fried Egg=Ovo Frito
Raw Chicken=Carne de Galinha (Crua)
Cooked Chicken=Galinha Assada
Feather=Pluma
Cow already milked!=Vaca já ordenhada!
Cow=Vaca
Bucket of Milk=Balde de leite
Cheese=Queijo
Cheese Block=Bloco de Queijo
[MOD] Mobs Redo 'Animals' loaded=[MOBS_ANIMAL] Mod carregado completamente
Kitten=Gato
Penguin=Pinguim
Rat=Rato
Cooked Rat=Rato (Assado)
Black=Preto
Blue=Azul
Brown=Marrom
Cyan=Ciano
Dark Green=Verde Escuro
Dark Grey=Cinza Escuro
Green=Verde
Grey=Cinza
Magenta=Rosa Magenta
Orange=Laranja
Pink=Rosa
Red=Vermelho
Violet=Violeta
White=Branco
Yellow=Amarelo
@1 Sheep=Ovelha @1
Raw Mutton=Carneiro (Cru)
Cooked Mutton=Carneiro (Assado)
Warthog=Javali
Raw Porkchop=Costeleta de Javali (Crua)
Cooked Porkchop=Costeleta de Javali Assada

View file

@ -0,0 +1,116 @@
#!/usr/bin/env luajit
-- Convert regular Gettext PO files to Minetest-specific TR files. If there is
-- already a TR file with the same name of the PO file except the file suffix
-- bneing .tr (or .TR) instead of .po (or .PO) then THIS FILE WILL BE
-- OVERWRITTEN WITHOUT INFORMATION OR A WAY TO RECOVER THE PREVIOUS FILE!
--
--
-- ▄██▄
-- ▀███
-- █
-- ▄▄▄▄▄ █
-- ▀▄ ▀▄ █ BACKUP
-- ▄▀▀▀▄ █▄▄▄▄█▄▄ ▄▀▀▀▄ █
-- █ ▄ █ █ ▄ █ █
-- ▀▄ ▄▀ ▀▄ ▄▀ █
-- █▀▀▀ ▀▀▀ █ █
-- █ █ █ ALL
-- ▄▀▄▄▀▄ █ ▄█▀█▀█▀█▀█▀█▄ █ █
-- █▒▒▒▒█ █ █████████████▄ █ █
-- █▒▒▒▒█ █ ██████████████▄ █ █
-- █▒▒▒▒█ █ ██████████████▄ █ █
-- █▒▒▒▒█ █ ██████████████ █ █
-- █▒▒▒▒█ █ ██████████████▀ █ █ THE
-- █▒▒▒▒█ ██ ██████████████ █ █
-- ▀████▀ ██▀█ █████████████▀ █▄█
-- ██ ██ ▀█ █▄█▄█▄█▄█▄█▀ ▄█▀
-- ██ ██ ▀█ ▄▀▓█
-- ██ ██ ▀█▀▄▄▄▄▄▄▄▄▄▀▀▓▓▓█
-- ████ █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
-- ███ █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█ THINGS
-- ██ █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
-- ██ █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
-- ██ ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
-- ██ ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
-- ██ ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▌ !!!
-- ██ ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▌
-- ██ ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▌
-- ██ ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▌
--
--
-- The syntax of TR files according to the introducing forum post is:
--
-- # textdomain: namespace
-- original 1 = translation 1
-- original 2 = translation 2
-- original 3 = tralslation 3
-- original N = translation N
--
-- Where namespace should be the name of the mod. Following strings have to be
-- escaped using @.
--
-- String | Escape
-- -------+--------
-- `@` |`@@`
-- `=` |`@=`
-- `\n` |`@\n`
--
-- See https://forum.minetest.net/viewtopic.php?t=18349 for details.
-- Preparation
if arg[1] == nil or arg[2] == nil then
print('Provide the namesspace as first parameter')
print('Provide the path to the source PO file as second parameter')
print('Example: '..arg[0]..' mymod path/to/my/source.po')
return
end
local SEP = package.path:match('(%p)%?%.') or '/' -- wonky but hey ... :)
-- Assign parameters to local variables
local namespace = arg[1]
local po_file = arg[2]
local tr_file = arg[2]:gsub('po$', 'tr'):gsub('PO$', 'TR')
-- Get the translations through crude plaintext file parsing
local file_contents = {}
local translations = {}
local po_file_handle = io.open(po_file, 'rb')
if po_file_handle == nil then print('No base file found') return end
for line in po_file_handle:lines() do
if line:match('^msgid') or line:match('^msgstr') then
table.insert(file_contents, line)
end
end
local escape_string = function (s)
s = s:gsub('@([^%d])', '@@%1') -- All @ not followed by a number become @@
s = s:gsub('([^@]@)$', '%1@') -- An @ at the end of the string become @@
s = s:gsub('=', '@=') -- All = become @=
return s
end
for number,line_content in pairs(file_contents) do
if line_content:match('^msgid') then
local o = line_content:gsub('^msgid "(.+)"$', '%1')
local t = file_contents[number + 1]:gsub('^msgstr "(.+)"$', '%1')
if o ~= 'msgid = ""' and t ~= 'msgstr ""' then
table.insert(translations, escape_string(o)..'='..escape_string(t))
end
end
end
print(number)
po_file_handle:close()
-- Write translation to file
local tr_file_handle = io.open(tr_file, 'w+')
if tr_file_handle == nil then print('Could not open target file') return end
tr_file_handle:write('# textdomain: '..namespace, "\n")
for _,line in pairs(translations) do tr_file_handle:write(line, "\n") end
tr_file_handle:close()

View file

@ -0,0 +1,199 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-31 11:28+0200\n"
"PO-Revision-Date: 2021-06-20 18:51-0300\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.6\n"
"Last-Translator: Lunovox Heavenfinder <lunovox@disroot.org>\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Language: pt_BR\n"
#: bee.lua
msgid "Bee"
msgstr "Abelha"
#: bee.lua
msgid "Honey"
msgstr "Mel"
#: bee.lua
msgid "Beehive"
msgstr "Colméia"
#: bee.lua
msgid "Honey Block"
msgstr "Bloco de Mel"
#: bunny.lua
msgid "Bunny"
msgstr "Coelho"
#: bunny.lua
msgid "Raw Rabbit"
msgstr "Carne de Coelho (Cru)"
#: bunny.lua
msgid "Cooked Rabbit"
msgstr "Coelho (Assado)"
#: bunny.lua
msgid "Rabbit Hide"
msgstr "Pele de Coelho"
#: chicken.lua
msgid "Chicken"
msgstr "Galinha"
#: chicken.lua
msgid "Chicken Egg"
msgstr "Ovo de Galinha"
#: chicken.lua
msgid "Fried Egg"
msgstr "Ovo Frito"
#: chicken.lua
msgid "Raw Chicken"
msgstr "Carne de Galinha (Crua)"
#: chicken.lua
msgid "Cooked Chicken"
msgstr "Galinha Assada"
#: chicken.lua
msgid "Feather"
msgstr "Pluma"
#: cow.lua
msgid "Cow already milked!"
msgstr "Vaca já ordenhada!"
#: cow.lua
msgid "Cow"
msgstr "Vaca"
#: cow.lua
msgid "Bucket of Milk"
msgstr "Balde de leite"
#: cow.lua
msgid "Cheese"
msgstr "Queijo"
#: cow.lua
msgid "Cheese Block"
msgstr "Bloco de Queijo"
#: init.lua
msgid "[MOD] Mobs Redo 'Animals' loaded"
msgstr "[MOBS_ANIMAL] Mod carregado completamente"
#: kitten.lua
msgid "Kitten"
msgstr "Gato"
#: penguin.lua
msgid "Penguin"
msgstr "Pinguim"
#: rat.lua
msgid "Rat"
msgstr "Rato"
#: rat.lua
msgid "Cooked Rat"
msgstr "Rato (Assado)"
#: sheep.lua
msgid "Black"
msgstr "Preto"
#: sheep.lua
msgid "Blue"
msgstr "Azul"
#: sheep.lua
msgid "Brown"
msgstr "Marrom"
#: sheep.lua
msgid "Cyan"
msgstr "Ciano"
#: sheep.lua
msgid "Dark Green"
msgstr "Verde Escuro"
#: sheep.lua
msgid "Dark Grey"
msgstr "Cinza Escuro"
#: sheep.lua
msgid "Green"
msgstr "Verde"
#: sheep.lua
msgid "Grey"
msgstr "Cinza"
#: sheep.lua
msgid "Magenta"
msgstr "Rosa Magenta"
#: sheep.lua
msgid "Orange"
msgstr "Laranja"
#: sheep.lua
msgid "Pink"
msgstr "Rosa"
#: sheep.lua
msgid "Red"
msgstr "Vermelho"
#: sheep.lua
msgid "Violet"
msgstr "Violeta"
#: sheep.lua
msgid "White"
msgstr "Branco"
#: sheep.lua
msgid "Yellow"
msgstr "Amarelo"
#: sheep.lua
msgid "@1 Sheep"
msgstr "Ovelha @1 "
#: sheep.lua
msgid "Raw Mutton"
msgstr "Carneiro (Cru)"
#: sheep.lua
msgid "Cooked Mutton"
msgstr "Carneiro (Assado)"
#: warthog.lua
msgid "Warthog"
msgstr "Javali"
#: warthog.lua
msgid "Raw Porkchop"
msgstr "Costeleta de Javali (Crua)"
#: warthog.lua
msgid "Cooked Porkchop"
msgstr "Costeleta de Javali Assada"

View file

@ -0,0 +1,46 @@
# textdomain: Lunovox Heavenfinder (https://libreplanet.org/wiki/User:Lunovox) <lunovox@disroot.org>
Bee=Abelha
Honey=Mel
Beehive=Colméia
Honey Block=Bloco de Mel
Bunny=Coelho
Raw Rabbit=Carne de Coelho (Cru)
Cooked Rabbit=Coelho (Assado)
Rabbit Hide=Pele de Coelho
Chicken=Galinha
Chicken Egg=Ovo de Galinha
Fried Egg=Ovo Frito
Raw Chicken=Carne de Galinha (Crua)
Cooked Chicken=Galinha Assada
Feather=Pluma
Cow already milked!=Vaca já ordenhada!
Cow=Vaca
Bucket of Milk=Balde de leite
Cheese=Queijo
Cheese Block=Bloco de Queijo
[MOD] Mobs Redo 'Animals' loaded=[MOBS_ANIMAL] Mod carregado completamente
Kitten=Gato
Penguin=Pinguim
Rat=Rato
Cooked Rat=Rato (Assado)
Black=Preto
Blue=Azul
Brown=Marrom
Cyan=Ciano
Dark Green=Verde Escuro
Dark Grey=Cinza Escuro
Green=Verde
Grey=Cinza
Magenta=Rosa Magenta
Orange=Laranja
Pink=Rosa
Red=Vermelho
Violet=Violeta
White=Branco
Yellow=Amarelo
@1 Sheep=Ovelha @1
Raw Mutton=Carneiro (Cru)
Cooked Mutton=Carneiro (Assado)
Warthog=Javali
Raw Porkchop=Costeleta de Javali (Crua)
Cooked Porkchop=Costeleta de Javali Assada

View file

@ -0,0 +1,199 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-31 11:28+0200\n"
"PO-Revision-Date: 2021-06-20 18:51-0300\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.6\n"
"Last-Translator: Lunovox Heavenfinder <lunovox@disroot.org>\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Language: pt_BR\n"
#: bee.lua
msgid "Bee"
msgstr "Abelha"
#: bee.lua
msgid "Honey"
msgstr "Mel"
#: bee.lua
msgid "Beehive"
msgstr "Colméia"
#: bee.lua
msgid "Honey Block"
msgstr "Bloco de Mel"
#: bunny.lua
msgid "Bunny"
msgstr "Coelho"
#: bunny.lua
msgid "Raw Rabbit"
msgstr "Carne de Coelho (Cru)"
#: bunny.lua
msgid "Cooked Rabbit"
msgstr "Coelho (Assado)"
#: bunny.lua
msgid "Rabbit Hide"
msgstr "Pele de Coelho"
#: chicken.lua
msgid "Chicken"
msgstr "Galinha"
#: chicken.lua
msgid "Chicken Egg"
msgstr "Ovo de Galinha"
#: chicken.lua
msgid "Fried Egg"
msgstr "Ovo Frito"
#: chicken.lua
msgid "Raw Chicken"
msgstr "Carne de Galinha (Crua)"
#: chicken.lua
msgid "Cooked Chicken"
msgstr "Galinha Assada"
#: chicken.lua
msgid "Feather"
msgstr "Pluma"
#: cow.lua
msgid "Cow already milked!"
msgstr "Vaca já ordenhada!"
#: cow.lua
msgid "Cow"
msgstr "Vaca"
#: cow.lua
msgid "Bucket of Milk"
msgstr "Balde de leite"
#: cow.lua
msgid "Cheese"
msgstr "Queijo"
#: cow.lua
msgid "Cheese Block"
msgstr "Bloco de Queijo"
#: init.lua
msgid "[MOD] Mobs Redo 'Animals' loaded"
msgstr "[MOBS_ANIMAL] Mod carregado completamente"
#: kitten.lua
msgid "Kitten"
msgstr "Gato"
#: penguin.lua
msgid "Penguin"
msgstr "Pinguim"
#: rat.lua
msgid "Rat"
msgstr "Rato"
#: rat.lua
msgid "Cooked Rat"
msgstr "Rato (Assado)"
#: sheep.lua
msgid "Black"
msgstr "Preto"
#: sheep.lua
msgid "Blue"
msgstr "Azul"
#: sheep.lua
msgid "Brown"
msgstr "Marrom"
#: sheep.lua
msgid "Cyan"
msgstr "Ciano"
#: sheep.lua
msgid "Dark Green"
msgstr "Verde Escuro"
#: sheep.lua
msgid "Dark Grey"
msgstr "Cinza Escuro"
#: sheep.lua
msgid "Green"
msgstr "Verde"
#: sheep.lua
msgid "Grey"
msgstr "Cinza"
#: sheep.lua
msgid "Magenta"
msgstr "Rosa Magenta"
#: sheep.lua
msgid "Orange"
msgstr "Laranja"
#: sheep.lua
msgid "Pink"
msgstr "Rosa"
#: sheep.lua
msgid "Red"
msgstr "Vermelho"
#: sheep.lua
msgid "Violet"
msgstr "Violeta"
#: sheep.lua
msgid "White"
msgstr "Branco"
#: sheep.lua
msgid "Yellow"
msgstr "Amarelo"
#: sheep.lua
msgid "@1 Sheep"
msgstr "Ovelha @1 "
#: sheep.lua
msgid "Raw Mutton"
msgstr "Carneiro (Cru)"
#: sheep.lua
msgid "Cooked Mutton"
msgstr "Carneiro (Assado)"
#: warthog.lua
msgid "Warthog"
msgstr "Javali"
#: warthog.lua
msgid "Raw Porkchop"
msgstr "Costeleta de Javali (Crua)"
#: warthog.lua
msgid "Cooked Porkchop"
msgstr "Costeleta de Javali Assada"

View file

@ -0,0 +1,46 @@
# textdomain: Lunovox Heavenfinder (https://libreplanet.org/wiki/User:Lunovox) <lunovox@disroot.org>
Bee=Abelha
Honey=Mel
Beehive=Colméia
Honey Block=Bloco de Mel
Bunny=Coelho
Raw Rabbit=Carne de Coelho (Cru)
Cooked Rabbit=Coelho (Assado)
Rabbit Hide=Pele de Coelho
Chicken=Galinha
Chicken Egg=Ovo de Galinha
Fried Egg=Ovo Frito
Raw Chicken=Carne de Galinha (Crua)
Cooked Chicken=Galinha Assada
Feather=Pluma
Cow already milked!=Vaca já ordenhada!
Cow=Vaca
Bucket of Milk=Balde de leite
Cheese=Queijo
Cheese Block=Bloco de Queijo
[MOD] Mobs Redo 'Animals' loaded=[MOBS_ANIMAL] Mod carregado completamente
Kitten=Gato
Penguin=Pinguim
Rat=Rato
Cooked Rat=Rato (Assado)
Black=Preto
Blue=Azul
Brown=Marrom
Cyan=Ciano
Dark Green=Verde Escuro
Dark Grey=Cinza Escuro
Green=Verde
Grey=Cinza
Magenta=Rosa Magenta
Orange=Laranja
Pink=Rosa
Red=Vermelho
Violet=Violeta
White=Branco
Yellow=Amarelo
@1 Sheep=Ovelha @1
Raw Mutton=Carneiro (Cru)
Cooked Mutton=Carneiro (Assado)
Warthog=Javali
Raw Porkchop=Costeleta de Javali (Crua)
Cooked Porkchop=Costeleta de Javali Assada

View file

@ -36,7 +36,7 @@ mobs:register_mob("mobs_monster:lava_flan", {
{name = "mobs:lava_orb", chance = 15, min = 1, max = 1}, {name = "mobs:lava_orb", chance = 15, min = 1, max = 1},
}, },
water_damage = 8, water_damage = 8,
lava_damage = 0, lava_damage = -1,
fire_damage = 0, fire_damage = 0,
light_damage = 0, light_damage = 0,
immune_to = { immune_to = {
@ -53,7 +53,7 @@ mobs:register_mob("mobs_monster:lava_flan", {
run_start = 20, run_start = 20,
run_end = 28, run_end = 28,
punch_start = 20, punch_start = 20,
punch_end = 28, punch_end = 28
}, },
on_die = function(self, pos) on_die = function(self, pos)
@ -176,7 +176,11 @@ minetest.register_tool(":mobs:pick_lava", {
full_punch_interval = 0.4, full_punch_interval = 0.4,
max_drop_level = 3, max_drop_level = 3,
groupcaps = { groupcaps = {
cracky = {times={[1]=1.80, [2]=0.80, [3]=0.40}, uses=40, maxlevel=3}, cracky = {
times = {[1] = 1.80, [2] = 0.80, [3] = 0.40},
uses = 40,
maxlevel = 3
}
}, },
damage_groups = {fleshy = 6, fire = 1}, damage_groups = {fleshy = 6, fire = 1},
}, },
@ -189,7 +193,7 @@ minetest.register_craft({
recipe = { recipe = {
{"mobs:lava_orb", "mobs:lava_orb", "mobs:lava_orb"}, {"mobs:lava_orb", "mobs:lava_orb", "mobs:lava_orb"},
{"", "default:obsidian_shard", ""}, {"", "default:obsidian_shard", ""},
{"", "default:obsidian_shard", ""}, {"", "default:obsidian_shard", ""}
} }
}) })
@ -253,7 +257,7 @@ mobs:register_mob("mobs_monster:obsidian_flan", {
run_start = 20, run_start = 20,
run_end = 28, run_end = 28,
punch_start = 20, punch_start = 20,
punch_end = 28, punch_end = 28
} }
}) })
@ -296,9 +300,11 @@ mobs:register_arrow("mobs_monster:obsidian_arrow", {
local radius = 1 local radius = 1
local def = minetest.registered_nodes[node] local def = minetest.registered_nodes[node]
if def then if def then
node = {name = node} node = {name = node}
end end
if def and def.tiles and def.tiles[1] then if def and def.tiles and def.tiles[1] then
texture = def.tiles[1] texture = def.tiles[1]
end end
@ -325,7 +331,7 @@ mobs:register_arrow("mobs_monster:obsidian_arrow", {
texture = texture, texture = texture,
-- ^ only as fallback for clients without support for `node` parameter -- ^ only as fallback for clients without support for `node` parameter
node = node, node = node,
collisiondetection = true, collisiondetection = true
}) })
minetest.set_node(pos, {name = "air"}) minetest.set_node(pos, {name = "air"})

View file

@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = { mobs = {
mod = "redo", mod = "redo",
version = "20210610", version = "20210614",
intllib = S, intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {} invis = minetest.global_exists("invisibility") and invisibility or {}
} }
@ -28,8 +28,7 @@ local rad = math.rad
local atann = math.atan local atann = math.atan
local atan = function(x) local atan = function(x)
if not x or x ~= x then if not x or x ~= x then
--error("atan bassed NaN") return 0 -- NaN
return 0
else else
return atann(x) return atann(x)
end end
@ -225,9 +224,6 @@ function mob_class:collision()
for _,object in ipairs(minetest.get_objects_inside_radius(pos, width)) do for _,object in ipairs(minetest.get_objects_inside_radius(pos, width)) do
if object:is_player() then if object:is_player() then
-- or (object:get_luaentity()
-- and object:get_luaentity()._cmi_is_mob == true
-- and object ~= self.object) then
local pos2 = object:get_pos() local pos2 = object:get_pos()
local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z} local vec = {x = pos.x - pos2.x, z = pos.z - pos2.z}
@ -406,7 +402,6 @@ function mob_class:set_animation(anim, force)
0, self.animation[anim .. "_loop"] ~= false) 0, self.animation[anim .. "_loop"] ~= false)
end end
-- above function exported for mount.lua
function mobs:set_animation(entity, anim) function mobs:set_animation(entity, anim)
entity.set_animation(entity, anim) entity.set_animation(entity, anim)
end end
@ -593,7 +588,7 @@ function mob_class:attempt_flight_correction(override)
local escape_direction = vdirection(pos, escape_target) local escape_direction = vdirection(pos, escape_target)
self.object:set_velocity( self.object:set_velocity(
vmultiply(escape_direction, 1)) --self.run_velocity)) vmultiply(escape_direction, 1))
return true return true
end end
@ -645,7 +640,7 @@ function mobs:yaw_to_pos(self, target, rot)
end end
-- if stay near set then check periodically for nodes and turn towards them -- if stay near set then periodically check for nodes and turn towards them
function mob_class:do_stay_near() function mob_class:do_stay_near()
if not self.stay_near then return false end if not self.stay_near then return false end
@ -742,9 +737,15 @@ function mob_class:update_tag()
col = "#FF0000" col = "#FF0000"
end end
-- build infotext
self.infotext = "Health: " .. self.health .. " / " .. self.hp_max
.. "\n" .. "Owner: " .. self.owner
-- set changes
self.object:set_properties({ self.object:set_properties({
nametag = self.nametag, nametag = self.nametag,
nametag_color = col nametag_color = col,
infotext = self.infotext
}) })
end end
@ -792,10 +793,7 @@ function mob_class:item_drop()
end end
-- only drop rare items (drops.min = 0) if killed by player -- only drop rare items (drops.min = 0) if killed by player
if death_by_player then if death_by_player or self.drops[n].min ~= 0 then
obj = minetest.add_item(pos, ItemStack(item .. " " .. num))
elseif self.drops[n].min ~= 0 then
obj = minetest.add_item(pos, ItemStack(item .. " " .. num)) obj = minetest.add_item(pos, ItemStack(item .. " " .. num))
end end
@ -870,18 +868,17 @@ function mob_class:check_for_death(cmi_cause)
end end
-- backup nametag so we can show health stats -- backup nametag so we can show health stats
if not self.nametag2 then -- if not self.nametag2 then
self.nametag2 = self.nametag or "" -- self.nametag2 = self.nametag or ""
end -- end
if show_health -- if show_health
and (cmi_cause and cmi_cause.type == "punch") then -- and (cmi_cause and cmi_cause.type == "punch") then
self.htimer = 2
self.nametag = "" .. self.health .. " / " .. self.hp_max
-- self.htimer = 2
-- self.nametag = "♥ " .. self.health .. " / " .. self.hp_max
self:update_tag() self:update_tag()
end -- end
return false return false
end end
@ -1051,13 +1048,13 @@ function mob_class:do_env_damage()
end end
-- reset nametag after showing health stats -- reset nametag after showing health stats
if self.htimer < 1 and self.nametag2 then -- if self.htimer < 1 and self.nametag2 then
self.nametag = self.nametag2 -- self.nametag = self.nametag2
self.nametag2 = nil -- self.nametag2 = nil
self:update_tag() self:update_tag()
end -- end
local pos = self.object:get_pos() ; if not pos then return end local pos = self.object:get_pos() ; if not pos then return end
@ -1081,8 +1078,7 @@ function mob_class:do_env_damage()
local nodef = minetest.registered_nodes[self.standing_in] local nodef = minetest.registered_nodes[self.standing_in]
-- water -- water
if self.water_damage ~= 0 if self.water_damage ~= 0 and nodef.groups.water then
and nodef.groups.water then
self.health = self.health - self.water_damage self.health = self.health - self.water_damage
@ -1094,8 +1090,7 @@ function mob_class:do_env_damage()
end end
-- lava damage -- lava damage
elseif self.lava_damage ~= 0 elseif self.lava_damage ~= 0 and nodef.groups.lava then
and nodef.groups.lava then
self.health = self.health - self.lava_damage self.health = self.health - self.lava_damage
@ -1107,8 +1102,7 @@ function mob_class:do_env_damage()
end end
-- fire damage -- fire damage
elseif self.fire_damage ~= 0 elseif self.fire_damage ~= 0 and nodef.groups.fire then
and nodef.groups.fire then
self.health = self.health - self.fire_damage self.health = self.health - self.fire_damage
@ -1241,19 +1235,21 @@ function mob_class:do_jump()
local blocked = minetest.registered_nodes[nodt.name].walkable local blocked = minetest.registered_nodes[nodt.name].walkable
--print("standing on:", self.standing_on, pos.y - 0.25) -- are we facing a fence or wall
--print("in front:", nod.name, pos.y + 0.5) if nod.name:find("fence") or nod.name:find("gate") or nod.name:find("wall") then
--print("in front above:", nodt.name, pos.y + 1.5) self.facing_fence = true
end
-- jump if standing on solid node (not snow) and not blocked above --[[
if (self.walk_chance == 0 print("on: " .. self.standing_on
or minetest.registered_items[nod.name].walkable) .. ", front: " .. nod.name
and not blocked .. ", front above: " .. nodt.name
and nod.name ~= node_snow then .. ", blocked: " .. (blocked and "yes" or "no")
.. ", fence: " .. (self.facing_fence and "yes" or "no")
if not nod.name:find("fence") )
and not nod.name:find("gate") ]]
and not nod.name:find("wall") then -- jump if standing on solid node (not snow) and not blocked
if (self.walk_chance == 0 or minetest.registered_items[nod.name].walkable)
and not blocked and not self.facing_fence and nod.name ~= node_snow then
local v = self.object:get_velocity() local v = self.object:get_velocity()
@ -1280,19 +1276,17 @@ function mob_class:do_jump()
self:mob_sound(self.sounds.jump) self:mob_sound(self.sounds.jump)
end end
self.jump_count = 0
return true return true
else
self.facing_fence = true
end
end end
-- if blocked against a block/wall for 5 counts then turn -- if blocked for 3 counts then turn
if not self.following if not self.following and (self.facing_fence or blocked) then
and (self.facing_fence or blocked) then
self.jump_count = (self.jump_count or 0) + 1 self.jump_count = (self.jump_count or 0) + 1
if self.jump_count > 4 then if self.jump_count > 2 then
local yaw = self.object:get_yaw() or 0 local yaw = self.object:get_yaw() or 0
local turn = random(0, 2) + 1.35 local turn = random(0, 2) + 1.35
@ -1363,7 +1357,7 @@ end
-- Thanks Wuzzy for the following editable settings -- Thanks Wuzzy for the following editable settings
local HORNY_TIME = 30 local HORNY_TIME = 30
local HORNY_AGAIN_TIME = 300 local HORNY_AGAIN_TIME = 60 * 5 -- 5 minutes
local CHILD_GROW_TIME = 60 * 20 -- 20 minutes local CHILD_GROW_TIME = 60 * 20 -- 20 minutes
-- find two animals of same type and breed if nearby and horny -- find two animals of same type and breed if nearby and horny
@ -1391,16 +1385,15 @@ function mob_class:breed()
if self.on_grown then if self.on_grown then
self.on_grown(self) self.on_grown(self)
else else
-- jump when fully grown so as not to fall into ground
-- self.object:set_velocity({
-- x = 0,
-- y = self.jump_height,
-- z = 0
-- })
local pos = self.object:get_pos() ; if not pos then return end local pos = self.object:get_pos() ; if not pos then return end
local ent = self.object:get_luaentity() local ent = self.object:get_luaentity()
pos.y = pos.y + (ent.collisionbox[2] * -1) - 0.4 pos.y = pos.y + (ent.collisionbox[2] * -1) - 0.4
self.object:set_pos(pos) self.object:set_pos(pos)
-- jump slightly when fully grown so as not to fall into ground
self.object:set_velocity({x = 0, y = 0.5, z = 0 })
end end
end end
@ -1623,6 +1616,40 @@ end
local los_switcher = false local los_switcher = false
local height_switcher = false local height_switcher = false
local can_dig_drop = function(pos)
if minetest.is_protected(pos, "") then
return false
end
local node = node_ok(pos, "air").name
local ndef = minetest.registered_nodes[node]
if node ~= "ignore"
and ndef
and ndef.drawtype ~= "airlike"
and not ndef.groups.level
and not ndef.groups.unbreakable
and not ndef.groups.liquid then
local drops = minetest.get_node_drops(node)
for _, item in ipairs(drops) do
minetest.add_item({
x = pos.x - 0.5 + random(),
y = pos.y - 0.5 + random(),
z = pos.z - 0.5 + random()
}, item)
end
minetest.remove_node(pos)
return true
end
return false
end
-- path finding and smart mob routine by rnd, -- path finding and smart mob routine by rnd,
-- line_of_sight and other edits by Elkien3 -- line_of_sight and other edits by Elkien3
@ -1788,8 +1815,8 @@ function mob_class:smart_mobs(s, p, dist, dtime)
-- lets make way by digging/building if not accessible -- lets make way by digging/building if not accessible
if self.pathfinding == 2 and mobs_griefing then if self.pathfinding == 2 and mobs_griefing then
-- is player higher than mob? -- is player more than 1 block higher than mob?
if s.y < p1.y then if p1.y > (s.y + 1) then
-- build upwards -- build upwards
if not minetest.is_protected(s, "") then if not minetest.is_protected(s, "") then
@ -1797,7 +1824,6 @@ function mob_class:smart_mobs(s, p, dist, dtime)
local ndef1 = minetest.registered_nodes[self.standing_in] local ndef1 = minetest.registered_nodes[self.standing_in]
if ndef1 and (ndef1.buildable_to or ndef1.groups.liquid) then if ndef1 and (ndef1.buildable_to or ndef1.groups.liquid) then
minetest.set_node(s, {name = mobs.fallback_node}) minetest.set_node(s, {name = mobs.fallback_node})
end end
end end
@ -1808,27 +1834,19 @@ function mob_class:smart_mobs(s, p, dist, dtime)
s.y = s.y + sheight s.y = s.y + sheight
-- remove one block above to make room to jump -- remove one block above to make room to jump
if not minetest.is_protected(s, "") then can_dig_drop(s)
local node1 = node_ok(s, "air").name
local ndef1 = minetest.registered_nodes[node1]
if node1 ~= "air"
and node1 ~= "ignore"
and ndef1
and not ndef1.groups.level
and not ndef1.groups.unbreakable
and not ndef1.groups.liquid then
minetest.set_node(s, {name = "air"})
minetest.add_item(s, ItemStack(node1))
end
end
s.y = s.y - sheight s.y = s.y - sheight
self.object:set_pos({x = s.x, y = s.y + 2, z = s.z}) self.object:set_pos({x = s.x, y = s.y + 2, z = s.z})
-- is player more than 1 block lower than mob
elseif p1.y < (s.y - 1) then
-- dig down
s.y = s.y - self.collisionbox[4] - 0.2
can_dig_drop(s)
else -- dig 2 blocks to make door toward player direction else -- dig 2 blocks to make door toward player direction
local yaw1 = self.object:get_yaw() + pi / 2 local yaw1 = self.object:get_yaw() + pi / 2
@ -1838,37 +1856,12 @@ function mob_class:smart_mobs(s, p, dist, dtime)
z = s.z + sin(yaw1) z = s.z + sin(yaw1)
} }
if not minetest.is_protected(p1, "") then -- dig bottom node first incase of door
can_dig_drop(p1)
local node1 = node_ok(p1, "air").name
local ndef1 = minetest.registered_nodes[node1]
if node1 ~= "air"
and node1 ~= "ignore"
and ndef1
and not ndef1.groups.level
and not ndef1.groups.unbreakable
and not ndef1.groups.liquid then
minetest.add_item(p1, ItemStack(node1))
minetest.set_node(p1, {name = "air"})
end
p1.y = p1.y + 1 p1.y = p1.y + 1
node1 = node_ok(p1, "air").name
ndef1 = minetest.registered_nodes[node1]
if node1 ~= "air" can_dig_drop(p1)
and node1 ~= "ignore"
and ndef1
and not ndef1.groups.level
and not ndef1.groups.unbreakable
and not ndef1.groups.liquid then
minetest.add_item(p1, ItemStack(node1))
minetest.set_node(p1, {name = "air"})
end
end
end end
end end
@ -2600,7 +2593,10 @@ function mob_class:do_states(dtime)
self:smart_mobs(s, p, dist, dtime) self:smart_mobs(s, p, dist, dtime)
end end
if self.at_cliff then -- distance padding to stop spinning mob
local pad = abs(p.x - s.x) + abs(p.z - s.z)
if self.at_cliff or pad < 0.2 then
self:set_velocity(0) self:set_velocity(0)
self:set_animation("stand") self:set_animation("stand")
@ -2618,7 +2614,6 @@ function mob_class:do_states(dtime)
self:set_animation("walk") self:set_animation("walk")
end end
end end
else -- rnd: if inside reach range else -- rnd: if inside reach range
self.path.stuck = false self.path.stuck = false
@ -2765,11 +2760,7 @@ function mob_class:falling(pos)
end end
-- fall at set speed -- fall at set speed
self.object:set_acceleration({ self.object:set_acceleration({x = 0, y = fall_speed, z = 0})
x = 0,
y = fall_speed,
z = 0
})
end end
@ -2792,8 +2783,9 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
-- error checking when mod profiling is enabled -- error checking when mod profiling is enabled
if not tool_capabilities then if not tool_capabilities then
minetest.log("warning",
"[mobs] Mod profiling enabled, damage not enabled") minetest.log("warning", "[mobs] Mod profiling enabled, damage not enabled")
return true return true
end end
@ -2869,6 +2861,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
if self.immune_to[n][1] == weapon_def.name then if self.immune_to[n][1] == weapon_def.name then
damage = self.immune_to[n][2] or 0 damage = self.immune_to[n][2] or 0
break break
-- if "all" then no tools deal damage unless it's specified in list -- if "all" then no tools deal damage unless it's specified in list
@ -2881,13 +2874,14 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
-- healing -- healing
if damage <= -1 then if damage <= -1 then
self.health = self.health - floor(damage) self.health = self.health - floor(damage)
return true return true
end end
if use_cmi if use_cmi
and cmi.notify_punch( and cmi.notify_punch(self.object, hitter, tflp, tool_capabilities, dir, damage) then
self.object, hitter, tflp, tool_capabilities, dir, damage) then
return true return true
end end
@ -2906,10 +2900,8 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
end end
end end
if tr then if tr and weapon_def.original_description then
if weapon_def.original_description then
toolranks.new_afteruse(weapon, hitter, nil, {wear = wear}) toolranks.new_afteruse(weapon, hitter, nil, {wear = wear})
end
else else
weapon:add_wear(wear) weapon:add_wear(wear)
end end
@ -2957,20 +2949,6 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
if self:check_for_death({type = "punch", puncher = hitter, hot = hot}) then if self:check_for_death({type = "punch", puncher = hitter, hot = hot}) then
return true return true
end end
--[[ add healthy afterglow when hit (causes lag with large textures)
minetest.after(0.1, function()
if not self.object:get_luaentity() then return end
self.object:set_texture_mod("^[colorize:#c9900070")
minetest.after(0.3, function()
if not self.object:get_luaentity() then return end
self.object:set_texture_mod(self.texture_mods)
end)
end) ]]
end -- END if damage end -- END if damage
-- knock back effect (only on full punch) -- knock back effect (only on full punch)
@ -2996,11 +2974,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
-- use tool knockback value or default -- use tool knockback value or default
kb = tool_capabilities.damage_groups["knockback"] or kb kb = tool_capabilities.damage_groups["knockback"] or kb
self.object:set_velocity({ self.object:set_velocity({x = dir.x * kb, y = up, z = dir.z * kb})
x = dir.x * kb,
y = up,
z = dir.z * kb
})
self.pause_timer = 0.25 self.pause_timer = 0.25
end end
@ -3247,10 +3221,8 @@ function mob_class:mob_activate(staticdata, def, dtime)
local armor local armor
if type(self.armor) == "table" then if type(self.armor) == "table" then
armor = table_copy(self.armor) armor = table_copy(self.armor)
-- armor.immortal = 1
else else
-- armor = {immortal = 1, fleshy = self.armor} armor = {fleshy = self.armor} -- immortal = 1
armor = {fleshy = self.armor}
end end
self.object:set_armor_groups(armor) self.object:set_armor_groups(armor)
@ -3348,23 +3320,7 @@ end
-- main mob function -- main mob function
function mob_class:on_step(dtime, moveresult) function mob_class:on_step(dtime, moveresult)
--[[ moveresult contains this for physical mobs if self.state == "die" then return end
{
touching_ground = boolean,
collides = boolean,
standing_on_object = boolean,
collisions = {
{
type = string, -- "node" or "object",
axis = string, -- "x", "y" or "z"
node_pos = vector, -- if type is "node"
object = ObjectRef, -- if type is "object"
old_velocity = vector,
new_velocity = vector,
}}
}]]
if self.state == "die" then return end ----------------
if use_cmi then if use_cmi then
cmi.notify_step(self.object, dtime) cmi.notify_step(self.object, dtime)
@ -3890,11 +3846,13 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
local numbers = settings:get(name) local numbers = settings:get(name)
if numbers then if numbers then
numbers = numbers:split(",") numbers = numbers:split(",")
chance = tonumber(numbers[1]) or chance chance = tonumber(numbers[1]) or chance
aoc = tonumber(numbers[2]) or aoc aoc = tonumber(numbers[2]) or aoc
if chance == 0 then if chance == 0 then
minetest.log("warning", minetest.log("warning",
string.format("[mobs] %s has spawning disabled", name)) string.format("[mobs] %s has spawning disabled", name))
return return
@ -4678,14 +4636,14 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
self.health = self.hp_max self.health = self.hp_max
if self.htimer < 1 then -- if self.htimer < 1 then
minetest.chat_send_player(clicker:get_player_name(), -- minetest.chat_send_player(clicker:get_player_name(),
S("@1 at full health (@2)", -- S("@1 at full health (@2)",
self.name:split(":")[2], tostring(self.health))) -- self.name:split(":")[2], tostring(self.health)))
self.htimer = 5 -- self.htimer = 5
end -- end
end end
self.object:set_hp(self.health) self.object:set_hp(self.health)

View file

@ -3,3 +3,4 @@ hunger?
hbhunger? hbhunger?
stamina? stamina?
lucky_block? lucky_block?
screwdriver?

View file

@ -4,8 +4,10 @@ local hmod = minetest.global_exists("hunger")
local hbmod = minetest.global_exists("hbhunger") local hbmod = minetest.global_exists("hbhunger")
local stmod = minetest.global_exists("stamina") local stmod = minetest.global_exists("stamina")
local screwdriver_exists = minetest.global_exists("screwdriver")
-- eat pie slice function -- eat pie slice function
local replace_pie = function(node, puncher, pos) local function replace_pie(node, puncher, pos)
-- is this my pie? -- is this my pie?
if minetest.is_protected(pos, puncher:get_player_name()) then if minetest.is_protected(pos, puncher:get_player_name()) then
@ -41,7 +43,11 @@ local replace_pie = function(node, puncher, pos)
node.name = pie .. "_" .. (num + 1) node.name = pie .. "_" .. (num + 1)
end end
minetest.swap_node(pos, {name = node.name}) minetest.swap_node(pos, node)
if num == 3 then
minetest.check_for_falling(pos)
end
-- Blockmen's hud_hunger mod -- Blockmen's hud_hunger mod
if hmod then if hmod then
@ -91,12 +97,13 @@ end
-- register pie bits -- register pie bits
local register_pie = function(pie, desc) local function register_pie(pie, desc)
-- full pie -- full pie
minetest.register_node("pie:" .. pie .. "_0", { minetest.register_node("pie:" .. pie .. "_0", {
description = desc, description = desc,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "clip", use_texture_alpha = "clip",
sunlight_propagates = false, sunlight_propagates = false,
tiles = { tiles = {
@ -108,9 +115,11 @@ local register_pie = function(pie, desc)
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {{-0.45, -0.5, -0.45, 0.45, 0, 0.45}} fixed = {-0.45, -0.5, -0.45, 0.45, 0, 0.45}
}, },
on_rotate = screwdriver_exists and screwdriver.rotate_simple,
on_punch = function(pos, node, puncher, pointed_thing) on_punch = function(pos, node, puncher, pointed_thing)
replace_pie(node, puncher, pos) replace_pie(node, puncher, pos)
end end
@ -120,6 +129,7 @@ local register_pie = function(pie, desc)
minetest.register_node("pie:" .. pie .. "_1", { minetest.register_node("pie:" .. pie .. "_1", {
description = "3/4 " .. desc, description = "3/4 " .. desc,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "clip", use_texture_alpha = "clip",
sunlight_propagates = true, sunlight_propagates = true,
tiles = { tiles = {
@ -131,9 +141,11 @@ local register_pie = function(pie, desc)
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {{-0.45, -0.5, -0.25, 0.45, 0, 0.45}} fixed = {-0.45, -0.5, -0.25, 0.45, 0, 0.45}
}, },
on_rotate = screwdriver_exists and screwdriver.rotate_simple,
on_punch = function(pos, node, puncher, pointed_thing) on_punch = function(pos, node, puncher, pointed_thing)
replace_pie(node, puncher, pos) replace_pie(node, puncher, pos)
end end
@ -143,6 +155,7 @@ local register_pie = function(pie, desc)
minetest.register_node("pie:" .. pie .. "_2", { minetest.register_node("pie:" .. pie .. "_2", {
description = "Half " .. desc, description = "Half " .. desc,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "clip", use_texture_alpha = "clip",
sunlight_propagates = true, sunlight_propagates = true,
tiles = { tiles = {
@ -154,9 +167,11 @@ local register_pie = function(pie, desc)
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {{-0.45, -0.5, 0.0, 0.45, 0, 0.45}} fixed = {-0.45, -0.5, 0.0, 0.45, 0, 0.45}
}, },
on_rotate = screwdriver_exists and screwdriver.rotate_simple,
on_punch = function(pos, node, puncher, pointed_thing) on_punch = function(pos, node, puncher, pointed_thing)
replace_pie(node, puncher, pos) replace_pie(node, puncher, pos)
end end
@ -166,6 +181,7 @@ local register_pie = function(pie, desc)
minetest.register_node("pie:" .. pie .. "_3", { minetest.register_node("pie:" .. pie .. "_3", {
description = "Piece of " .. desc, description = "Piece of " .. desc,
paramtype = "light", paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "clip", use_texture_alpha = "clip",
sunlight_propagates = true, sunlight_propagates = true,
tiles = { tiles = {
@ -177,9 +193,11 @@ local register_pie = function(pie, desc)
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {{-0.45, -0.5, 0.25, 0.45, 0, 0.45}} fixed = {-0.45, -0.5, 0.25, 0.45, 0, 0.45}
}, },
on_rotate = screwdriver_exists and screwdriver.rotate_simple,
on_punch = function(pos, node, puncher, pointed_thing) on_punch = function(pos, node, puncher, pointed_thing)
replace_pie(node, puncher, pos) replace_pie(node, puncher, pos)
end end

View file

@ -1,4 +1,4 @@
name = pie name = pie
depends = default depends = default
optional_depends = hunger, hbhunger, stamina, lucky_block optional_depends = hunger, hbhunger, stamina, lucky_block, screwdriver
description = Add a selection of tasty Pie/Cakes to eat. description = Add a selection of tasty Pie/Cakes to eat.

View file

@ -26,7 +26,7 @@ node_box = {
{-0.0612,-0.500000,-0.500000,0.0612,0.500000,-0.375000}, --NodeBox 1 {-0.0612,-0.500000,-0.500000,0.0612,0.500000,-0.375000}, --NodeBox 1
} }
}, },
groups = {snappy=3,flammable=2}, groups = {snappy=3,flammable=2,attached_node=1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
drop = 'default:stick' drop = 'default:stick'
}) })
@ -61,7 +61,8 @@ for i in pairs(BushBranchCenter) do
-- tree=1, -- MM: disabled because some recipes use group:tree for trunks -- tree=1, -- MM: disabled because some recipes use group:tree for trunks
snappy=3, snappy=3,
flammable=2, flammable=2,
leaves=1 leaves=1,
attached_node=1
}, },
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
drop = 'default:stick 4' drop = 'default:stick 4'
@ -104,7 +105,8 @@ for i in pairs(BushBranchSide) do
-- tree=1, -- MM: disabled because some recipes use group:tree for trunks -- tree=1, -- MM: disabled because some recipes use group:tree for trunks
snappy=3, snappy=3,
flammable=2, flammable=2,
leaves=1 leaves=1,
attached_node=1
}, },
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
drop = 'default:stick 3' drop = 'default:stick 3'

View file

@ -15,7 +15,7 @@ minetest.register_node("cavestuff:pebble_1",{
tiles = {"undergrowth_pebble.png"}, tiles = {"undergrowth_pebble.png"},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=3, stone=1}, groups = {cracky=3, stone=1, attached_node=1},
selection_box = cbox, selection_box = cbox,
collision_box = cbox, collision_box = cbox,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
@ -35,7 +35,7 @@ minetest.register_node("cavestuff:pebble_2",{
tiles = {"undergrowth_pebble.png"}, tiles = {"undergrowth_pebble.png"},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=3, stone=1, not_in_creative_inventory=1}, groups = {cracky=3, stone=1, attached_node=1, not_in_creative_inventory=1},
selection_box = cbox, selection_box = cbox,
collision_box = cbox, collision_box = cbox,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
@ -48,7 +48,7 @@ minetest.register_node("cavestuff:desert_pebble_1",{
tiles = {"default_desert_stone.png"}, tiles = {"default_desert_stone.png"},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=3, stone=1}, groups = {cracky=3, stone=1, attached_node=1},
selection_box = cbox, selection_box = cbox,
collision_box = cbox, collision_box = cbox,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
@ -67,7 +67,7 @@ minetest.register_node("cavestuff:desert_pebble_2",{
tiles = {"default_desert_stone.png"}, tiles = {"default_desert_stone.png"},
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
groups = {cracky=3, stone=1, not_in_creative_inventory=1}, groups = {cracky=3, stone=1, attached_node=1, not_in_creative_inventory=1},
selection_box = cbox, selection_box = cbox,
collision_box = cbox, collision_box = cbox,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),

View file

@ -4,6 +4,12 @@
-- TWiGS -- TWiGS
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
local fakenode = {
name = "default:stone", -- could be anything that's guaranteed to exist at mapgen time, and isn't buildable_to
param1 = 0,
param2 = 0
}
abstract_trunks.place_twig = function(pos) abstract_trunks.place_twig = function(pos)
local twig_size = math.random(1,27) local twig_size = math.random(1,27)
@ -26,6 +32,16 @@ abstract_trunks.place_twig = function(pos)
local node_s_w = minetest.get_node(south_west) local node_s_w = minetest.get_node(south_west)
local node_west = minetest.get_node(west) local node_west = minetest.get_node(west)
local node_n_w = minetest.get_node(north_west) local node_n_w = minetest.get_node(north_west)
node_north = minetest.registered_nodes[node_north.name] and node_north or fakenode
node_n_e = minetest.registered_nodes[node_n_e.name] and node_n_e or fakenode
node_east = minetest.registered_nodes[node_east.name] and node_east or fakenode
node_s_e = minetest.registered_nodes[node_s_e.name] and node_s_e or fakenode
node_south = minetest.registered_nodes[node_south.name] and node_south or fakenode
node_s_w = minetest.registered_nodes[node_s_w.name] and node_s_w or fakenode
node_west = minetest.registered_nodes[node_west.name] and node_west or fakenode
node_n_w = minetest.registered_nodes[node_n_w.name] and node_n_w or fakenode
-- small twigs -- small twigs
if twig_size <= 16 then if twig_size <= 16 then
minetest.swap_node(right_here, {name="trunks:twig_"..math.random(1,4), param2=math.random(0,3)}) minetest.swap_node(right_here, {name="trunks:twig_"..math.random(1,4), param2=math.random(0,3)})
@ -356,11 +372,12 @@ if Moss_on_ground == true then
abstract_trunks.grow_moss_on_ground = function(pos) abstract_trunks.grow_moss_on_ground = function(pos)
local on_ground = {x=pos.x, y=pos.y+1, z=pos.z} local on_ground = {x=pos.x, y=pos.y+1, z=pos.z}
local moss_type = math.random(1,21) local moss_type = math.random(1,21)
local rot = math.random(0,3)
if moss_type == 1 then if moss_type == 1 then
minetest.swap_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3)}) minetest.swap_node(on_ground, {name="trunks:moss_with_fungus_"..rot, param2=1})
else else
minetest.swap_node(on_ground, {name="trunks:moss", param2=math.random(0,3)}) minetest.swap_node(on_ground, {name="trunks:moss_plain_"..rot, param2=1})
end end
end end
@ -406,44 +423,49 @@ abstract_trunks.grow_moss_on_trunk = function(pos)
local node_under = minetest.get_node(undrneath) local node_under = minetest.get_node(undrneath)
--if minetest.get_item_group(node_under.name, "tree") < 1 then --if minetest.get_item_group(node_under.name, "tree") < 1 then
if minetest.registered_nodes[node_here.name].buildable_to then
local moss_type = math.random(1,41) local moss_type = math.random(1,41)
if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true, local rot = math.random(0,3)
if moss_type == 1 then if moss_type == 1 then
minetest.swap_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3) --[[1]]}) minetest.swap_node(on_ground, {name="trunks:moss_with_fungus_"..rot, param2=1})
elseif moss_type < 22 then elseif moss_type < 22 then
minetest.swap_node(on_ground, {name="trunks:moss", param2=math.random(0,3) --[[1]]}) minetest.swap_node(on_ground, {name="trunks:moss_plain_"..rot, param2=1})
end end
end end
if minetest.registered_nodes[node_north.name].buildable_to then
local moss_type = math.random(1,31) -- cliche of more moss at north local moss_type = math.random(1,31) -- cliche of more moss at north
if minetest.registered_nodes[node_north.name].buildable_to then -- instead of check_air = true, local rot = math.random(0,3)
if moss_type == 1 then if moss_type == 1 then
minetest.swap_node(at_side_n, {name="trunks:moss_fungus", param2=math.random(4,7)}) -- 5,4,6,7 minetest.swap_node(at_side_n, {name="trunks:moss_with_fungus_"..rot, param2=5})
elseif moss_type < 22 then elseif moss_type < 22 then
minetest.swap_node(at_side_n, {name="trunks:moss", param2=math.random(4,7)}) minetest.swap_node(at_side_n, {name="trunks:moss_plain_"..rot, param2=5})
end end
end end
if minetest.registered_nodes[node_east.name].buildable_to then
local moss_type = math.random(1,41) local moss_type = math.random(1,41)
if minetest.registered_nodes[node_east.name].buildable_to then -- instead of check_air = true, local rot = math.random(0,3)
if moss_type == 1 then if moss_type == 1 then
minetest.swap_node(at_side_e, {name="trunks:moss_fungus", param2=math.random(12,15)}) minetest.swap_node(at_side_e, {name="trunks:moss_with_fungus_"..rot, param2=3})
elseif moss_type < 22 then elseif moss_type < 22 then
minetest.swap_node(at_side_e, {name="trunks:moss", param2=math.random(12,15)}) minetest.swap_node(at_side_e, {name="trunks:moss_plain_"..rot, param2=3})
end end
end end
if minetest.registered_nodes[node_south.name].buildable_to then
local moss_type = math.random(1,41) local moss_type = math.random(1,41)
if minetest.registered_nodes[node_south.name].buildable_to then -- instead of check_air = true, local rot = math.random(0,3)
if moss_type == 1 then if moss_type == 1 then
minetest.swap_node(at_side_s, {name="trunks:moss_fungus", param2=math.random(8,11)}) minetest.swap_node(at_side_s, {name="trunks:moss_with_fungus_"..rot, param2=4})
elseif moss_type < 22 then elseif moss_type < 22 then
minetest.swap_node(at_side_s, {name="trunks:moss", param2=math.random(8,11)}) minetest.swap_node(at_side_s, {name="trunks:moss_plain_"..rot, param2=4})
end end
end end
if minetest.registered_nodes[node_west.name].buildable_to then
local moss_type = math.random(1,41) local moss_type = math.random(1,41)
if minetest.registered_nodes[node_west.name].buildable_to then -- instead of check_air = true, local rot = math.random(0,3)
if moss_type == 1 then if moss_type == 1 then
minetest.swap_node(at_side_w, {name="trunks:moss_fungus", param2=math.random(16,19)}) minetest.swap_node(at_side_w, {name="trunks:moss_with_fungus_"..rot, param2=2})
elseif moss_type < 22 then elseif moss_type < 22 then
minetest.swap_node(at_side_w, {name="trunks:moss", param2=math.random(16,19)}) minetest.swap_node(at_side_w, {name="trunks:moss_plain_"..rot, param2=2})
end end
end end
--end --end

View file

@ -65,42 +65,63 @@ end
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
-- MoSS -- MoSS
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
local flat_moss = {-1/2, -1/2, -1/2, 1/2, -15/32--[[<-flickers if smaller]], 1/2}
minetest.register_node("trunks:moss", { -- wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
-- wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
-- wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
-- was local flat_moss = {-1/2, -1/2, -1/2, 1/2, -15/32, 1/2}
local cbox = {
type = "wallmounted",
wall_top = {-1/2, 1/2, -1/2, 1/2, 15/32, 1/2},
wall_bottom = {-1/2, -1/2, -1/2, 1/2, -15/32, 1/2},
wall_side = {-1/2, -1/2, -1/2, -15/32, 1/2, 1/2}
}
for r = 0, 3 do
local xform = ""
if r > 0 then xform = "^[transformR"..r*90 end
minetest.register_node("trunks:moss_plain_"..r, {
description = S("Moss"), description = S("Moss"),
drawtype = "nodebox",--"signlike", drawtype = "nodebox",
tiles = {"trunks_moss.png"}, tiles = {"trunks_moss.png"..xform},
inventory_image = "trunks_moss.png", inventory_image = "trunks_moss.png",
wield_image = "trunks_moss.png", wield_image = "trunks_moss.png",
paramtype = "light", paramtype = "light",
paramtype2 = "facedir",--"wallmounted", paramtype2 = "wallmounted",
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
node_box = {type = "fixed", fixed = flat_moss}, node_box = cbox,
selection_box = {type = "fixed", fixed = flat_stick},--{type = "wallmounted"}, groups = {snappy = 3, flammable = 3, attached_node=1, not_in_creative_inventory = r},
groups = {snappy = 3, flammable = 3 },
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
drop = "trunks:moss_plain_0",
}) })
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
-- MoSS & FuNGuS -- MoSS & FuNGuS
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
minetest.register_node("trunks:moss_fungus", { minetest.register_node("trunks:moss_with_fungus_"..r, {
description = S("Moss with Fungus"), description = S("Moss with Fungus"),
drawtype = "nodebox",--"signlike", drawtype = "nodebox",
tiles = {"trunks_moss_fungus.png"}, tiles = {"trunks_moss_fungus.png"..xform},
inventory_image = "trunks_moss_fungus.png", inventory_image = "trunks_moss_fungus.png",
wield_image = "trunks_moss_fungus.png", wield_image = "trunks_moss_fungus.png",
paramtype = "light", paramtype = "light",
paramtype2 = "facedir",--"wallmounted", paramtype2 = "wallmounted",
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, walkable = false,
node_box = {type = "fixed", fixed = flat_moss}, node_box = cbox,
selection_box = {type = "fixed", fixed = flat_stick},--{type = "wallmounted"}, groups = {snappy = 3, flammable = 3, attached_node=1, not_in_creative_inventory = r},
groups = {snappy = 3, flammable = 3 },
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
drop = "trunks:moss_with_fungus_0",
}) })
end
minetest.register_alias("trunks:moss_plain", "trunks:moss_plain_0")
minetest.register_alias("trunks:moss_with_fungus", "trunks:moss_with_fungus_0")
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
-- TWiGS BLoCK -- TWiGS BLoCK
@ -361,7 +382,8 @@ for i in pairs(TRuNKS) do
snappy=1, snappy=1,
choppy=2, choppy=2,
oddly_breakable_by_hand=1, oddly_breakable_by_hand=1,
flammable=2--, flammable=2,
attached_node = 1
--not_in_creative_inventory=1 -- atm in inv for testing --not_in_creative_inventory=1 -- atm in inv for testing
}, },
--drop = "trunks:twig_1", -- not sure about this yet --drop = "trunks:twig_1", -- not sure about this yet
@ -376,3 +398,26 @@ end
end end
minetest.register_alias("trunks:pine_trunkroot", "trunks:pine_treeroot") minetest.register_alias("trunks:pine_trunkroot", "trunks:pine_treeroot")
-- convert moss to wallmounted mode so that attached_node works properly.
local fdirtowall = {
[0] = 1,
[1] = 5,
[2] = 4,
[3] = 3,
[4] = 2,
}
minetest.register_lbm({
name = "trunks:convert_moss_wallmounted",
label = "Convert moss to wallmounted mode",
run_at_every_load = true,
nodenames = {"trunks:moss", "trunks:moss_fungus"},
action = function(pos, node)
local basedir = math.floor(node.param2 / 4)
local rot = node.param2 % 4
local newname = node.name == "trunks:moss_fungus" and "trunks:moss_with_fungus" or "trunks:moss_plain"
minetest.set_node(pos, {name = newname.."_"..rot, param2 = fdirtowall[basedir] })
end
})

View file

@ -40,7 +40,7 @@ minetest.register_node("youngtrees:youngtree2_middle",{
{-0.500000,0.125000,-0.500000,0.500000,0.500000,0.500000}, --NodeBox 3 {-0.500000,0.125000,-0.500000,0.500000,0.500000,0.500000}, --NodeBox 3
} }
}, },
groups = {snappy=3,flammable=2}, groups = {snappy=3,flammable=2,attached_node=1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
drop = 'trunks:twig_1' drop = 'trunks:twig_1'
}) })
@ -58,7 +58,7 @@ minetest.register_node("youngtrees:youngtree_top", {
type = "fixed", type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
}, },
groups = {snappy=3,flammable=2}, groups = {snappy=3,flammable=2,attached_node=1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
drop = 'trunks:twig_1' drop = 'trunks:twig_1'
}) })
@ -77,7 +77,7 @@ minetest.register_node("youngtrees:youngtree_middle", {
type = "fixed", type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
}, },
groups = {snappy=3,flammable=2}, groups = {snappy=3,flammable=2,attached_node=1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
drop = 'trunks:twig_1' drop = 'trunks:twig_1'
}) })
@ -97,7 +97,7 @@ minetest.register_node("youngtrees:youngtree_bottom", {
type = "fixed", type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
}, },
groups = {snappy=3,flammable=2}, groups = {snappy=3,flammable=2,attached_node=1},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
drop = 'trunks:twig_1' drop = 'trunks:twig_1'
}) })

View file

@ -0,0 +1,3 @@
rainbow gohst
Phill
CC BY-SA 3.0

View file

@ -0,0 +1,3 @@
Danger
Phill
CC BY-SA 3.0

View file

@ -0,0 +1,3 @@
Monster Boy
Phill
CC BY-SA 3.0

View file

@ -0,0 +1,3 @@
Gohst sam
Phill
CC BY-SA 3.0

View file

@ -0,0 +1,3 @@
FBI
Phill
CC BY-SA 3.0

View file

@ -0,0 +1,3 @@
Endersam
Phill
CC BY-SA 3.0

View file

@ -0,0 +1,3 @@
Flaming
Flaming Strike
CC BY-SA 3.0

View file

@ -0,0 +1,3 @@
FBI Ninja
Phill
CC BY-SA 3.0

View file

@ -0,0 +1,3 @@
euro 2021 -FR10- minetest footmod? free NC share modify ok
DcyD3
CC BY-NC-SA 4.0

View file

@ -0,0 +1,3 @@
spider-man
DcyD3
CC BY-NC-SA 3.0

View file

@ -0,0 +1,3 @@
eye you !
DcyD3
CC BY-NC-SA 3.0

View file

@ -0,0 +1,3 @@
Xbox 360 Skin Pack 1
angel
CC BY 3.0

View file

@ -0,0 +1,3 @@
Irrlicht
Phill
CC BY-SA 3.0

View file

@ -0,0 +1,3 @@
kinie? 4minetest
DcyD3
CC BY-NC-SA 3.0

View file

@ -0,0 +1,3 @@
barca 4fans ! thx
DcyD3
CC BY-NC-SA 3.0

View file

@ -0,0 +1,3 @@
oh no no not me ! lool
DcyD3
CC BY-NC-SA 3.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -204,6 +204,30 @@ local function set_sprinting(name, sprinting)
end end
local function head_particle(player, texture)
local prop = player:get_properties()
local pos = player:get_pos() ; pos.y = pos.y + prop.eye_height -- mouth level
local dir = player:get_look_dir()
minetest.add_particlespawner({
amount = 5,
time = 0.1,
minpos = pos,
maxpos = pos,
minvel = {x = dir.x - 1, y = dir.y, z = dir.z - 1},
maxvel = {x = dir.x + 1, y = dir.y, z = dir.z + 1},
minacc = {x = 0, y = -5, z = 0},
maxacc = {x = 0, y = -9, z = 0},
minexptime = 1,
maxexptime = 1,
minsize = 1,
maxsize = 2,
texture = texture
})
end
local function drunk_tick() local function drunk_tick()
for _,player in ipairs(minetest.get_connected_players()) do for _,player in ipairs(minetest.get_connected_players()) do
@ -218,6 +242,9 @@ local function drunk_tick()
local num = stamina.players[name].drunk local num = stamina.players[name].drunk
if num and num > 0 and math.floor(num / 20) == num / 20 then if num and num > 0 and math.floor(num / 20) == num / 20 then
head_particle(player, "bubble.png")
minetest.sound_play("stamina_burp", minetest.sound_play("stamina_burp",
{to_player = name, gain = 0.7}, true) {to_player = name, gain = 0.7}, true)
end end
@ -381,6 +408,8 @@ local function poison_tick()
local hp = player:get_hp() - 1 local hp = player:get_hp() - 1
head_particle(player, "stamina_poison_particle.png")
if hp > 0 then if hp > 0 then
player:set_hp(hp, {poison = true}) player:set_hp(hp, {poison = true})
end end
@ -517,26 +546,9 @@ function stamina.eat(hp_change, replace_with_item, itemstack, user, pointed_thin
minetest.sound_play(snd, {to_player = name, gain = 0.7}, true) minetest.sound_play(snd, {to_player = name, gain = 0.7}, true)
-- particle effect when eating -- particle effect when eating
local prop = user:get_properties()
local pos = user:get_pos() ; pos.y = pos.y + prop.eye_height -- mouth level
local texture = minetest.registered_items[itemname].inventory_image local texture = minetest.registered_items[itemname].inventory_image
local dir = user:get_look_dir()
minetest.add_particlespawner({ head_particle(user, texture)
amount = 5,
time = 0.1,
minpos = pos,
maxpos = pos,
minvel = {x = dir.x - 1, y = dir.y, z = dir.z - 1},
maxvel = {x = dir.x + 1, y = dir.y, z = dir.z + 1},
minacc = {x = 0, y = -5, z = 0},
maxacc = {x = 0, y = -9, z = 0},
minexptime = 1,
maxexptime = 1,
minsize = 1,
maxsize = 2,
texture = texture
})
-- if player drinks milk then stop poison and being drunk -- if player drinks milk then stop poison and being drunk
local item_name = itemstack:get_name() or "" local item_name = itemstack:get_name() or ""

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

View file

@ -124,6 +124,7 @@ for idx,color in ipairs(tColors) do
paramtype = 'light', paramtype = 'light',
light_source = minetest.LIGHT_MAX, light_source = minetest.LIGHT_MAX,
sounds = default.node_sound_stone_defaults(),
groups = {choppy=2, cracky=1, not_in_creative_inventory=1}, groups = {choppy=2, cracky=1, not_in_creative_inventory=1},
is_ground_content = false, is_ground_content = false,
drop = "tubelib_addons2:lamp" drop = "tubelib_addons2:lamp"

View file

@ -71,6 +71,7 @@ minetest.register_node("tubelib_addons2:lamp_on", {
paramtype = "light", paramtype = "light",
paramtype2 = "color", paramtype2 = "color",
palette = "unifieddyes_palette_extended.png", palette = "unifieddyes_palette_extended.png",
sounds = default.node_sound_stone_defaults(),
groups = {choppy=2, cracky=1, not_in_creative_inventory=1, ud_param2_colorable = 1}, groups = {choppy=2, cracky=1, not_in_creative_inventory=1, ud_param2_colorable = 1},
on_construct = unifieddyes.on_construct, on_construct = unifieddyes.on_construct,