1
0
Fork 0

Merge branch 'master' into datapacks

This commit is contained in:
Lizzy Fleckenstein 2021-03-12 11:13:09 +01:00
commit 80c6b547e5
27 changed files with 369 additions and 238 deletions

View File

@ -32,7 +32,12 @@ mgvalleys_spflags = noaltitude_chill,noaltitude_dry,nohumid_rivers,vary_river_de
# MCL2-specific stuff
keepInventory = false
dedicated_server_step = 0.001
# Performance settings
dedicated_server_step = 0.01
liquid_update = 0.25
abm_interval = 0.25
max_objects_per_block = 4096
max_packets_per_iteration = 10096
# Clientmodding to support official client
enable_client_modding = true

View File

@ -335,13 +335,13 @@ local function trace_explode(pos, strength, raydirs, radius, info, puncher)
minetest.after(0.3, function(obj, damage, impact, punch_dir) -- 0.2 is minimum delay for closing old formspec and open died formspec -- TODO: REMOVE THIS IN THE FUTURE
if not obj then return end
obj:punch(obj, 10, { damage_groups = { full_punch_interval = 1, fleshy = damage, knockback = impact * 20.0 } }, punch_dir)
obj:add_player_velocity(vector.multiply(punch_dir, impact * 20))
obj:add_velocity(vector.multiply(punch_dir, impact * 20))
end, obj, damage, impact, vector.new(punch_dir))
else
obj:punch(source, 10, { damage_groups = { full_punch_interval = 1, fleshy = damage, knockback = impact * 20.0 } }, punch_dir)
if obj:is_player() then
obj:add_player_velocity(vector.multiply(punch_dir, impact * 20))
obj:add_velocity(vector.multiply(punch_dir, impact * 20))
elseif ent.tnt_knockback then
obj:add_velocity(vector.multiply(punch_dir, impact * 20))
end

View File

@ -751,10 +751,10 @@ local check_for_death = function(self, cause, cmi_cause)
-- play damage sound if health was reduced and make mob flash red.
if damaged then
add_texture_mod(self, "^[colorize:#FF000040")
add_texture_mod(self, "^[colorize:red:130")
minetest.after(.2, function(self)
if self and self.object then
remove_texture_mod(self, "^[colorize:#FF000040")
remove_texture_mod(self, "^[colorize:red:130")
end
end, self)
mob_sound(self, "damage")

View File

@ -154,7 +154,7 @@ function mobs.attach(entity, player)
minetest.after(0.2, function(name)
local player = minetest.get_player_by_name(name)
if player then
mcl_player.player_set_animation(player, "sit" , 30)
mcl_player.player_set_animation(player, "sit_mount" , 30)
end
end, player:get_player_name())

View File

@ -366,6 +366,7 @@ mcl_player.player_register_model("mcl_armor_character.b3d", {
swim_mine = {x=411, y=430},
run_walk = {x=440, y=459},
run_walk_mine = {x=461, y=480},
sit_mount = {x=484, y=484},
},
})
@ -393,6 +394,7 @@ mcl_player.player_register_model("mcl_armor_character_female.b3d", {
swim_mine = {x=411, y=430},
run_walk = {x=440, y=459},
run_walk_mine = {x=461, y=480},
sit_mount = {x=484, y=484},
},
})

View File

@ -1,4 +1,6 @@
mcl_farming.plant_lists = {}
local plant_lists = {}
local plant_nodename_to_id_list = {}
local function get_intervals_counter(pos, interval, chance)
@ -51,11 +53,12 @@ local function get_avg_light_level(pos)
end
function mcl_farming:add_plant(identifier, full_grown, names, interval, chance)
plant_lists[identifier] = {}
plant_lists[identifier].full_grown = full_grown
plant_lists[identifier].names = names
plant_lists[identifier].interval = interval
plant_lists[identifier].chance = chance
mcl_farming.plant_lists[identifier] = {}
mcl_farming.plant_lists[identifier].full_grown = full_grown
mcl_farming.plant_lists[identifier].names = names
mcl_farming.plant_lists[identifier].interval = interval
mcl_farming.plant_lists[identifier].chance = chance
plant_lists = mcl_farming.plant_lists --provide local copy of plant lists (performances)
minetest.register_abm({
label = string.format("Farming plant growth (%s)", identifier),
nodenames = names,

View File

@ -1,5 +0,0 @@
mcl_core
mcl_sounds
mcl_farming
mcl_flowers
doc?

View File

@ -1,31 +1,8 @@
local S = minetest.get_translator("mcl_flowerpots")
local has_doc = minetest.get_modpath("doc")
local flowers = {
{"dandelion", "mcl_flowers:dandelion", S("Dandelion Flower Pot")},
{"poppy", "mcl_flowers:poppy", S("Poppy Flower Pot")},
{"blue_orchid", "mcl_flowers:blue_orchid", S("Blue Orchid Flower Pot")},
{"allium", "mcl_flowers:allium", S("Allium Flower Pot")},
{"azure_bluet", "mcl_flowers:azure_bluet", S("Azure Bluet Flower Pot")},
{"tulip_red", "mcl_flowers:tulip_red", S("Red Tulip Flower Pot")},
{"tulip_pink", "mcl_flowers:tulip_pink", S("Pink Tulip Flower Pot")},
{"tulip_white", "mcl_flowers:tulip_white", S("White Tulip Flower Pot")},
{"tulip_orange", "mcl_flowers:tulip_orange", S("Orange Tulip Flower Pot")},
{"oxeye_daisy", "mcl_flowers:oxeye_daisy", S("Oxeye Daisy Flower Pot")},
{"mushroom_brown", "mcl_mushrooms:mushroom_brown", S("Brown Mushroom Flower Pot")},
{"mushroom_red", "mcl_mushrooms:mushroom_red", S("Red Mushroom Flower Pot")},
{"sapling", "mcl_core:sapling", S("Oak Sapling Flower Pot")},
{"acaciasapling", "mcl_core:acaciasapling", S("Acacia Sapling Flower Pot")},
{"junglesapling", "mcl_core:junglesapling", S("Jungle Sapling Flower Pot")},
{"darksapling", "mcl_core:darksapling", S("Dark Oak Sapling Flower Pot")},
{"sprucesapling", "mcl_core:sprucesapling", S("Spruce Sapling Flower Pot")},
{"birchsapling", "mcl_core:birchsapling", S("Birch Sapling Flower Pot")},
{"deadbush", "mcl_core:deadbush", S("Dead Bush Flower Pot")},
{"fern", "mcl_flowers:fern", S("Fern Flower Pot"), {"mcl_flowers_fern_inv.png"}},
}
local cubes = {
{"cactus", "mcl_core:cactus", S("Cactus Flower Pot")},
}
mcl_flowerpots = {}
mcl_flowerpots.registered_pots = {}
minetest.register_node("mcl_flowerpots:flower_pot", {
description = S("Flower Pot"),
@ -62,24 +39,10 @@ minetest.register_node("mcl_flowerpots:flower_pot", {
return
end
local item = clicker:get_wielded_item():get_name()
for _, row in ipairs(flowers) do
local flower = row[1]
local flower_node = row[2]
if item == flower_node then
minetest.swap_node(pos, {name="mcl_flowerpots:flower_pot_"..flower})
if not minetest.is_creative_enabled(clicker:get_player_name()) then
itemstack:take_item()
end
end
end
for _, row in ipairs(cubes) do
local flower = row[1]
local flower_node = row[2]
if item == flower_node then
minetest.swap_node(pos, {name="mcl_flowerpots:flower_pot_"..flower})
if not minetest.is_creative_enabled(clicker:get_player_name()) then
itemstack:take_item()
end
if mcl_flowerpots.registered_pots[item] then
minetest.swap_node(pos, {name="mcl_flowerpots:flower_pot_"..mcl_flowerpots.registered_pots[item]})
if not minetest.is_creative_enabled(clicker:get_player_name()) then
itemstack:take_item()
end
end
end,
@ -94,112 +57,160 @@ minetest.register_craft({
}
})
for _, row in ipairs(flowers) do
local flower = row[1]
local flower_node = row[2]
local desc = row[3]
local texture
if row[4] then
texture = row[4]
else
texture = minetest.registered_nodes[flower_node]["tiles"]
end
minetest.register_node("mcl_flowerpots:flower_pot_"..flower, {
description = desc,
_doc_items_create_entry = false,
drawtype = "mesh",
mesh = "flowerpot.obj",
tiles = {
"[combine:32x32:0,0=mcl_flowerpots_flowerpot.png:0,0="..texture[1],
},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
visual_scale = 0.5,
wield_scale = {x=1.0, y=1.0, z=1.0},
paramtype = "light",
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
collision_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
is_ground_content = false,
groups = {dig_immediate=3, attached_node=1, dig_by_piston=1, not_in_creative_inventory=1, flower_pot=2},
sounds = mcl_sounds.node_sound_stone_defaults(),
on_rightclick = function(pos, item, clicker)
local name = clicker:get_player_name()
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return
end
minetest.add_item({x=pos.x, y=pos.y+0.5, z=pos.z}, flower_node)
minetest.set_node(pos, {name="mcl_flowerpots:flower_pot"})
end,
drop = {
items = {
{ items = { "mcl_flowerpots:flower_pot", flower_node } }
}
},
})
-- Add entry alias for the Help
if minetest.get_modpath("doc") then
doc.add_entry_alias("nodes", "mcl_flowerpots:flower_pot", "nodes", "mcl_flowerpots:flower_pot_"..flower)
end
function mcl_flowerpots.register_potted_flower(name, def)
mcl_flowerpots.registered_pots[name] = def.name
minetest.register_node(":mcl_flowerpots:flower_pot_"..def.name, {
description = def.desc.." "..S("Flower Pot"),
_doc_items_create_entry = false,
drawtype = "mesh",
mesh = "flowerpot.obj",
tiles = {
"[combine:32x32:0,0=mcl_flowerpots_flowerpot.png:0,0="..def.image,
},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
visual_scale = 0.5,
wield_scale = {x=1.0, y=1.0, z=1.0},
paramtype = "light",
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
collision_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
is_ground_content = false,
groups = {dig_immediate=3, attached_node=1, dig_by_piston=1, not_in_creative_inventory=1, flower_pot=2},
sounds = mcl_sounds.node_sound_stone_defaults(),
on_rightclick = function(pos, item, clicker)
local player_name = clicker:get_player_name()
if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name)
return
end
minetest.add_item({x=pos.x, y=pos.y+0.5, z=pos.z}, name)
minetest.set_node(pos, {name="mcl_flowerpots:flower_pot"})
end,
drop = {
items = {
{ items = { "mcl_flowerpots:flower_pot", name } }
}
},
})
-- Add entry alias for the Help
if has_doc then
doc.add_entry_alias("nodes", "mcl_flowerpots:flower_pot", "nodes", "mcl_flowerpots:flower_pot_"..name)
end
end
for _, row in ipairs(cubes) do
local flower = row[1]
local flower_node = row[2]
local desc = row[3]
minetest.register_node("mcl_flowerpots:flower_pot_"..flower, {
description = desc,
_doc_items_create_entry = false,
drawtype = "mesh",
mesh = "flowerpot_with_long_cube.obj",
tiles = {
"mcl_flowerpots_"..flower..".png",
},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
visual_scale = 0.5,
wield_scale = {x=1.0, y=1.0, z=1.0},
paramtype = "light",
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
collision_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
is_ground_content = false,
groups = {dig_immediate=3, attached_node=1, dig_by_piston=1, not_in_creative_inventory=1, flower_pot=2},
sounds = mcl_sounds.node_sound_stone_defaults(),
on_rightclick = function(pos, item, clicker)
local name = ""
if clicker:is_player() then
name = clicker:get_player_name()
end
if minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, name)
return
end
minetest.add_item({x=pos.x, y=pos.y+0.5, z=pos.z}, flower_node)
minetest.set_node(pos, {name="mcl_flowerpots:flower_pot"})
end,
drop = {
items = {
{ items = { "mcl_flowerpots:flower_pot", flower_node } }
}
},
function mcl_flowerpots.register_potted_cube(name, def)
mcl_flowerpots.registered_pots[name] = def.name
minetest.register_node(":mcl_flowerpots:flower_pot_"..def.name, {
description = def.desc.." "..S("Flower Pot"),
_doc_items_create_entry = false,
drawtype = "mesh",
mesh = "flowerpot_with_long_cube.obj",
tiles = {
def.image,
},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
visual_scale = 0.5,
wield_scale = {x=1.0, y=1.0, z=1.0},
paramtype = "light",
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
collision_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
is_ground_content = false,
groups = {dig_immediate=3, attached_node=1, dig_by_piston=1, not_in_creative_inventory=1, flower_pot=2},
sounds = mcl_sounds.node_sound_stone_defaults(),
on_rightclick = function(pos, item, clicker)
local player_name = ""
if clicker:is_player() then
player_name = clicker:get_player_name()
end
if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name)
return
end
minetest.add_item({x=pos.x, y=pos.y+0.5, z=pos.z}, name)
minetest.set_node(pos, {name="mcl_flowerpots:flower_pot"})
end,
drop = {
items = {
{ items = { "mcl_flowerpots:flower_pot", name } }
}
},
})
-- Add entry alias for the Help
if has_doc then
doc.add_entry_alias("nodes", "mcl_flowerpots:flower_pot", "nodes", "mcl_flowerpots:flower_pot_"..def.name)
end
end
--forced because hard dependency to mcl_core
mcl_flowerpots.register_potted_cube("mcl_core:cactus", {
name = "cactus",
desc = S("Cactus"),
image = "mcl_flowerpots_cactus.png",
})
-- Add entry alias for the Help
if minetest.get_modpath("doc") then
doc.add_entry_alias("nodes", "mcl_flowerpots:flower_pot", "nodes", "mcl_flowerpots:flower_pot_"..flower)
end
end
mcl_flowerpots.register_potted_flower("mcl_mushrooms:mushroom_brown", {
name = "mushroom_brown",
desc = S("Brown Mushroom"),
image = "farming_mushroom_brown.png",
})
mcl_flowerpots.register_potted_flower("mcl_mushrooms:mushroom_red", {
name = "mushroom_red",
desc = S("Red Mushroom"),
image = "farming_mushroom_red.png",
})
mcl_flowerpots.register_potted_flower("mcl_core:sapling", {
name = "sapling",
desc = S("Oak Sapling"),
image = "default_sapling.png",
})
mcl_flowerpots.register_potted_flower("mcl_core:acaciasapling", {
name = "acaciasapling",
desc = S("Acacia Sapling"),
image = "default_acacia_sapling.png",
})
mcl_flowerpots.register_potted_flower("mcl_core:junglesapling", {
name = "junglesapling",
desc = S("Jungle Sapling"),
image = "default_junglesapling.png",
})
mcl_flowerpots.register_potted_flower("mcl_core:darksapling", {
name = "darksapling",
desc = S("Dark Oak Sapling"),
image = "mcl_core_sapling_big_oak.png",
})
mcl_flowerpots.register_potted_flower("mcl_core:sprucesapling", {
name = "sprucesapling",
desc = S("Spruce Sapling"),
image = "mcl_core_sapling_spruce.png",
})
mcl_flowerpots.register_potted_flower("mcl_core:birchsapling", {
name = "birchsapling",
desc = S("Birch Sapling"),
image = "mcl_core_sapling_birch.png",
})
mcl_flowerpots.register_potted_flower("mcl_core:deadbush", {
name = "deadbush",
desc = S("Dead Bush"),
image = "default_dry_shrub.png",
})

View File

@ -0,0 +1,3 @@
name=mcl_flowerpots
depends=mcl_core, mcl_sounds, mcl_farming
optional_depends=doc

View File

@ -0,0 +1,9 @@
# API
Flower mod for mcl2
# Functions
## mcl_flowers.register_simple_flower(name, desc, image, simple_selection_box)
Register a simple flower:
* name: legacity name eg: "my_super_flower"
* desc: description eg: "My Super Flower"
* image: texture
* simple_selection_box: nodebox of the flower

View File

@ -1,5 +0,0 @@
mcl_core
mcl_util
mcl_sounds
screwdriver?
doc?

View File

@ -1,7 +1,10 @@
local S = minetest.get_translator("mcl_flowers")
local mod_screwdriver = minetest.get_modpath("screwdriver") ~= nil
local has_mcl_flowerpots = minetest.get_modpath("mcl_flowerpots")
local modpath = minetest.get_modpath("mcl_flowers")
mcl_flowers = {}
mcl_flowers.registered_simple_flowers = {}
-- Simple flower template
local smallflowerlongdesc = S("This is a small flower. Small flowers are mainly used for dye production and can also be potted.")
local plant_usage_help = S("It can only be placed on a block on which it would also survive.")
@ -51,43 +54,49 @@ local on_place_flower = mcl_util.generate_on_place_plant_function(function(pos,
return ok, colorize
end)
local function add_simple_flower(name, desc, image, simple_selection_box)
minetest.register_node("mcl_flowers:"..name, {
description = desc,
function mcl_flowers.register_simple_flower(name, def)
local newname = "mcl_flowers:"..name
if not def._mcl_silk_touch_drop then def._mcl_silk_touch_drop = nil end
if not def.drop then def.drop = newname end
mcl_flowers.registered_simple_flowers[newname] = {
name=name,
desc=def.desc,
image=def.image,
simple_selection_box=def.simple_selection_box,
}
minetest.register_node(newname, {
description = def.desc,
_doc_items_longdesc = smallflowerlongdesc,
_doc_items_usagehelp = plant_usage_help,
drawtype = "plantlike",
waving = 1,
tiles = { image..".png" },
inventory_image = image..".png",
wield_image = image..".png",
tiles = { def.image },
inventory_image = def.image,
wield_image = def.image,
sunlight_propagates = true,
paramtype = "light",
walkable = false,
stack_max = 64,
drop = def.drop,
groups = {dig_immediate=3,flammable=2,fire_encouragement=60,fire_flammability=100,plant=1,flower=1,place_flowerlike=1,non_mycelium_plant=1,attached_node=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1,enderman_takable=1,deco_block=1},
sounds = mcl_sounds.node_sound_leaves_defaults(),
node_placement_prediction = "",
on_place = on_place_flower,
selection_box = {
type = "fixed",
fixed = simple_selection_box,
fixed = def.selection_box,
},
_mcl_silk_touch_drop = def._mcl_silk_touch_drop,
})
if def.potted and has_mcl_flowerpots then
mcl_flowerpots.register_potted_flower(newname, {
name = name,
desc = def.desc,
image = def.image,
})
end
end
add_simple_flower("poppy", S("Poppy"), "mcl_flowers_poppy", { -5/16, -0.5, -5/16, 5/16, 5/16, 5/16 })
add_simple_flower("dandelion", S("Dandelion"), "flowers_dandelion_yellow", { -4/16, -0.5, -4/16, 4/16, 3/16, 4/16 })
add_simple_flower("oxeye_daisy", S("Oxeye Daisy"), "mcl_flowers_oxeye_daisy", { -4/16, -0.5, -4/16, 4/16, 4/16, 4/16 })
add_simple_flower("tulip_orange", S("Orange Tulip"), "flowers_tulip", { -3/16, -0.5, -3/16, 3/16, 5/16, 3/16 })
add_simple_flower("tulip_pink", S("Pink Tulip"), "mcl_flowers_tulip_pink", { -3/16, -0.5, -3/16, 3/16, 5/16, 3/16 })
add_simple_flower("tulip_red", S("Red Tulip"), "mcl_flowers_tulip_red", { -3/16, -0.5, -3/16, 3/16, 6/16, 3/16 })
add_simple_flower("tulip_white", S("White Tulip"), "mcl_flowers_tulip_white", { -3/16, -0.5, -3/16, 3/16, 4/16, 3/16 })
add_simple_flower("allium", S("Allium"), "mcl_flowers_allium", { -3/16, -0.5, -3/16, 3/16, 6/16, 3/16 })
add_simple_flower("azure_bluet", S("Azure Bluet"), "mcl_flowers_azure_bluet", { -5/16, -0.5, -5/16, 5/16, 3/16, 5/16 })
add_simple_flower("blue_orchid", S("Blue Orchid"), "mcl_flowers_blue_orchid", { -5/16, -0.5, -5/16, 5/16, 7/16, 5/16 })
local wheat_seed_drop = {
max_items = 1,
items = {
@ -159,6 +168,14 @@ def_fern.selection_box = {
minetest.register_node("mcl_flowers:fern", def_fern)
if has_mcl_flowerpots then
mcl_flowerpots.register_potted_flower("mcl_flowers:fern", {
name = "fern",
desc = S("Fern"),
image = "mcl_flowers_fern_inv.png",
})
end
local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_img, selbox_radius, selbox_top_height, drop, shears_drop, is_flower, grass_color, fortune_drop)
if not inv_img then
inv_img = top_img
@ -480,3 +497,4 @@ local fix_doubleplants = minetest.settings:get_bool("fix_doubleplants", true)
})
end
dofile(modpath.."/register.lua")

View File

@ -0,0 +1,3 @@
name=mcl_flowers
depends=mcl_core, mcl_util, mcl_sounds
optional_depends=screwdriver, doc, mcl_flowerpots

View File

@ -0,0 +1,62 @@
local S = minetest.get_translator("mcl_flowers")
mcl_flowers.register_simple_flower("poppy", {
desc = S("Poppy"),
image = "mcl_flowers_poppy.png",
selection_box = { -5/16, -0.5, -5/16, 5/16, 5/16, 5/16 },
potted = true,
})
mcl_flowers.register_simple_flower("dandelion", {
desc = S("Dandelion"),
image = "flowers_dandelion_yellow.png",
selection_box = { -4/16, -0.5, -4/16, 4/16, 3/16, 4/16 },
potted = true,
})
mcl_flowers.register_simple_flower("oxeye_daisy", {
desc = S("Oxeye Daisy"),
image = "mcl_flowers_oxeye_daisy.png",
selection_box = { -4/16, -0.5, -4/16, 4/16, 4/16, 4/16 },
potted = true,
})
mcl_flowers.register_simple_flower("tulip_orange", {
desc = S("Orange Tulip"),
image = "flowers_tulip.png",
selection_box = { -3/16, -0.5, -3/16, 3/16, 5/16, 3/16 },
potted = true,
})
mcl_flowers.register_simple_flower("tulip_pink", {
desc = S("Pink Tulip"),
image = "mcl_flowers_tulip_pink.png",
selection_box = { -3/16, -0.5, -3/16, 3/16, 5/16, 3/16 },
potted = true,
})
mcl_flowers.register_simple_flower("tulip_red", {
desc = S("Red Tulip"),
image = "mcl_flowers_tulip_red.png",
selection_box = { -3/16, -0.5, -3/16, 3/16, 6/16, 3/16 },
potted = true,
})
mcl_flowers.register_simple_flower("tulip_white", {
desc = S("White Tulip"),
image = "mcl_flowers_tulip_white.png",
selection_box = { -3/16, -0.5, -3/16, 3/16, 4/16, 3/16 },
potted = true,
})
mcl_flowers.register_simple_flower("allium", {
desc = S("Allium"),
image = "mcl_flowers_allium.png",
selection_box = { -3/16, -0.5, -3/16, 3/16, 6/16, 3/16 },
potted = true,
})
mcl_flowers.register_simple_flower("azure_bluet", {
desc = S("Azure Bluet"),
image = "mcl_flowers_azure_bluet.png",
selection_box = { -5/16, -0.5, -5/16, 5/16, 3/16, 5/16 },
potted = true,
})
mcl_flowers.register_simple_flower("blue_orchid", {
desc = S("Blue Orchid"),
image = "mcl_flowers_blue_orchid.png",
selection_box = { -5/16, -0.5, -5/16, 5/16, 7/16, 5/16 },
potted = true,
})

View File

@ -0,0 +1,18 @@
# mcl_jukebox
## mcl_jukebox.register_record(title, author, identifier, image, sound)
* title: title of the track
* author: author of the track
* identifier: short string used in the item registration
* image: the texture of the track
* sound: sound file of the track
## mcl_jukebox.registered_records
Table indexed by item name containing:
* title: title of the track
* author: author of the track
* identifier: short string used in the item registration
* image: the texture of the track
* sound: sound file of the track

View File

@ -1,2 +0,0 @@
mcl_core
mcl_sounds

View File

@ -1 +0,0 @@
Jukebox and music discs are used to play background music on a per-player basis.

View File

@ -1,5 +1,8 @@
local S = minetest.get_translator("mcl_jukebox")
mcl_jukebox = {}
mcl_jukebox.registered_records = {}
-- Player name-indexed table containing the currently heard track
local active_tracks = {}
@ -10,47 +13,30 @@ local active_huds = {}
-- Used to make sure that minetest.after only applies to the latest HUD change event
local hud_sequence_numbers = {}
-- List of music
local recorddata = {
-- { title, author, identifier }
{ "The Evil Sister (Jordach's Mix)", "SoundHelix", "13" } ,
{ "The Energetic Rat (Jordach's Mix)", "SoundHelix", "wait" },
{ "Eastern Feeling", "Jordach", "blocks"},
{ "Minetest", "Jordach", "far" },
{ "Credit Roll (Jordach's HD Mix)", "Junichi Masuda", "chirp" },
{ "Winter Feeling", "Tom Peter", "strad" },
{ "Synthgroove (Jordach's Mix)", "HeroOfTheWinds", "mellohi" },
{ "The Clueless Frog (Jordach's Mix)", "SoundHelix", "mall" },
}
local records = #recorddata
for r=1, records do
local doc = false
local entryname, longdesc, usagehelp
if r == 1 then
doc = true
entryname = S("Music Disc")
longdesc = S("A music disc holds a single music track which can be used in a jukebox to play music.")
usagehelp = S("Place a music disc into an empty jukebox to play the music. Use the jukebox again to retrieve the music disc. The music can only be heard by you, not by other players.")
end
minetest.register_craftitem("mcl_jukebox:record_"..r, {
function mcl_jukebox.register_record(title, author, identifier, image, sound)
mcl_jukebox.registered_records["mcl_jukebox:record_"..identifier] = {title, author, identifier, image, sound}
local entryname = S("Music Disc")
local longdesc = S("A music disc holds a single music track which can be used in a jukebox to play music.")
local usagehelp = S("Place a music disc into an empty jukebox to play the music. Use the jukebox again to retrieve the music disc. The music can only be heard by you, not by other players.")
minetest.register_craftitem(":mcl_jukebox:record_"..identifier, {
description =
core.colorize("#55FFFF", S("Music Disc")) .. "\n" ..
core.colorize("#989898", S("@1—@2", recorddata[r][2], recorddata[r][1])),
_doc_items_create_entry = doc,
core.colorize("#989898", S("@1—@2", author, title)),
_doc_items_create_entry = true,
_doc_items_entry_name = entryname,
_doc_items_longdesc = longdesc,
_doc_items_usagehelp = usagehelp,
inventory_image = "mcl_jukebox_record_"..recorddata[r][3]..".png",
--inventory_image = "mcl_jukebox_record_"..recorddata[r][3]..".png",
inventory_image = image,
stack_max = 1,
groups = { music_record = r },
groups = { music_record = 1 },
})
end
local function now_playing(player, track_id)
local function now_playing(player, name)
local playername = player:get_player_name()
local hud = active_huds[playername]
local text = S("Now playing: @1—@2", recorddata[track_id][2], recorddata[track_id][1])
local text = S("Now playing: @1—@2", mcl_jukebox.registered_records[name][2], mcl_jukebox.registered_records[name][1])
if not hud_sequence_numbers[playername] then
hud_sequence_numbers[playername] = 1
@ -106,18 +92,18 @@ minetest.register_craft({
})
local play_record = function(pos, itemstack, player)
local record_id = minetest.get_item_group(itemstack:get_name(), "music_record")
if record_id ~= 0 then
local name = itemstack:get_name()
if mcl_jukebox.registered_records[name] then
local cname = player:get_player_name()
if active_tracks[cname] ~= nil then
minetest.sound_stop(active_tracks[cname])
active_tracks[cname] = nil
end
active_tracks[cname] = minetest.sound_play("mcl_jukebox_track_"..record_id, {
active_tracks[cname] = minetest.sound_play(mcl_jukebox.registered_records[name][5], {
to_player = cname,
gain = 1,
})
now_playing(player, record_id)
now_playing(player, name)
return true
end
return false
@ -239,3 +225,12 @@ minetest.register_craft({
recipe = "mcl_jukebox:jukebox",
burntime = 15,
})
mcl_jukebox.register_record("The Evil Sister (Jordach's Mix)", "SoundHelix", "13", "mcl_jukebox_record_13.png", "mcl_jukebox_track_1")
mcl_jukebox.register_record("The Energetic Rat (Jordach's Mix)", "SoundHelix", "wait", "mcl_jukebox_record_wait.png", "mcl_jukebox_track_2")
mcl_jukebox.register_record("Eastern Feeling", "Jordach", "blocks", "mcl_jukebox_record_blocks.png", "mcl_jukebox_track_3")
mcl_jukebox.register_record("Minetest", "Jordach", "far", "mcl_jukebox_record_far.png", "mcl_jukebox_track_4")
mcl_jukebox.register_record("Credit Roll (Jordach's HD Mix)", "Junichi Masuda", "chirp", "mcl_jukebox_record_chirp.png", "mcl_jukebox_track_5")
mcl_jukebox.register_record("Winter Feeling", "Tom Peter", "strad", "mcl_jukebox_record_strad.png", "mcl_jukebox_track_6")
mcl_jukebox.register_record("Synthgroove (Jordach's Mix)", "HeroOfTheWinds", "mellohi", "mcl_jukebox_record_mellohi.png", "mcl_jukebox_track_7")
mcl_jukebox.register_record("The Clueless Frog (Jordach's Mix)", "SoundHelix", "mall", "mcl_jukebox_record_mall.png", "mcl_jukebox_track_8")

View File

@ -1 +1,3 @@
name = mcl_jukebox
description = Jukebox and music discs are used to play background music on a per-player basis.
depends = mcl_core, mcl_sounds

View File

@ -590,23 +590,36 @@ function mcl_potions.make_invisible(player, toggle)
local is_player = player:is_player()
local entity = player:get_luaentity()
local playername = player:get_player_name()
local skin_file = ""
if toggle then -- hide player
if player:is_player() then
EF.invisible[player].old_size = player:get_properties().visual_size
elseif entity then
skin_file = "mobs_mc_empty.png"
if entity then
EF.invisible[player].old_size = entity.visual_size
else -- if not a player or entity, do nothing
elseif not player:is_player() then -- if not a player or entity, do nothing
return
end
player:set_properties({visual_size = {x = 0, y = 0}})
if minetest.get_modpath("mcl_armor") and player:is_player() then
armor.textures[playername].skin = skin_file
armor:update_player_visuals(player)
elseif not player:is_player() and minetest.get_modpath("mcl_armor") or not player:is_player() and not minetest.get_modpath("mcl_armor") then
player:set_properties({visual_size = {x = 0, y = 0}})
end
player:set_nametag_attributes({color = {a = 0}})
elseif EF.invisible[player] then -- show player
player:set_properties({visual_size = EF.invisible[player].old_size})
if minetest.get_modpath("mcl_armor") and player:is_player() then
skin_file = mcl_skins.skins[playername] .. ".png"
armor.textures[playername].skin = skin_file
armor:update_player_visuals(player)
elseif not player:is_player() and minetest.get_modpath("mcl_armor") or not player:is_player() and not minetest.get_modpath("mcl_armor") then
player:set_properties({visual_size = EF.invisible[player].old_size})
end
player:set_nametag_attributes({color = {r = 255, g = 255, b = 255, a = 255}})
end
@ -999,4 +1012,3 @@ function mcl_potions._extinguish_nearby_fire(pos, radius)
end
return exting
end

View File

@ -33,6 +33,7 @@ mcl_player.player_register_model("character.b3d", {
sneak_walk_mine = {x=325, y=344},
run_walk = {x=440, y=460},
run_walk_mine = {x=461, y=481},
sit_mount = {x=484, y=484},
},
})

View File

@ -66,13 +66,13 @@ minetest.register_globalstep(function(dtime)
-- set head pitch and yaw when swimming
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90-degrees(dir_to_pitch(player_velocity)),yaw - player_vel_yaw * -1,0))
-- sets eye height, and nametag color accordingly
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,0.8,0.35}, eye_height = 0.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
-- control body bone when swimming
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(degrees(dir_to_pitch(player_velocity)) - 90,player_vel_yaw * -1 - yaw + 180,0))
elseif player:get_attach() == nil then
-- sets eye height, and nametag color accordingly
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
if player_velocity.x > 0.35 or player_velocity.z > 0.35 or player_velocity.x < -0.35 or player_velocity.z < -0.35 then
if player_vel_yaw * -1 - yaw < 90 or player_vel_yaw * -1 - yaw > 270 then
@ -91,7 +91,7 @@ minetest.register_globalstep(function(dtime)
else
local attached = player:get_attach(parent)
local attached_yaw = degrees(attached:get_yaw())
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.5, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,degrees(player:get_look_horizontal()) * -1 + attached_yaw,0))
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
end