Merge remote-tracking branch 'origin/master' into new_mapgen_api

This commit is contained in:
kay27 2022-02-18 03:48:47 +04:00
commit 03371421d8
39 changed files with 905 additions and 38 deletions

View File

@ -245,13 +245,9 @@ need to state their sources. These PRs also need Fleckenstein's approval
before they are merged.
You can use these sources:
* Minecraft code (Name the source file and line, however DONT post any
proprietary code). You can use
[MCP](https://minecraft.fandom.com/wiki/Programs_and_editors/Mod_Coder_Pack)
to decompile Minecraft or look at
[Minestorm](https://github.com/Minestom/Minestom) code.
* Testing things inside of Minecraft (Attach screenshots / video footage
of the results)
* Looking at [Minestom](https://github.com/Minestom/Minestom) code. An open source Minecraft Server implementation
* [Official Minecraft Wiki](https://minecraft.fandom.com/wiki/Minecraft_Wiki)
(Include a link to the specific page you used)

View File

@ -0,0 +1,15 @@
# mcl_damage
This mod is intended to overall minetest's native damage system, to provide a better integration between features that deals with entities' health.
WARNING: Not using it inside your mods may cause strange bugs (using the native damage system may cause conflicts with this system).
## Callbacks
To modify the amount of damage made by something:
```lua
--obj: an ObjectRef
mcl_damage.register_modifier(function(obj, damage, reason)
end, 0)
```

View File

@ -2,47 +2,45 @@
local get_connected_players = minetest.get_connected_players
local get_node = minetest.get_node
local vector_add = vector.add
local vector = vector
local ceil = math.ceil
local pairs = pairs
walkover = {}
walkover.registered_globals = {}
function walkover.register_global(func)
table.insert(walkover.registered_globals, func)
end
local on_walk = {}
local registered_globals = {}
walkover.registered_globals = registered_globals
function walkover.register_global(func)
table.insert(registered_globals, func)
end
minetest.register_on_mods_loaded(function()
for name,def in pairs(minetest.registered_nodes) do
if def.on_walk_over then
on_walk[name] = def.on_walk_over
end
end
for _,func in ipairs(walkover.registered_globals) do --cache registered globals
table.insert(registered_globals, func)
end
end)
local timer = 0
minetest.register_globalstep(function(dtime)
timer = timer + dtime;
timer = timer + dtime
if timer >= 0.3 then
for _,player in pairs(get_connected_players()) do
local pp = player:get_pos()
pp.y = ceil(pp.y)
local loc = vector_add(pp, {x=0,y=-1,z=0})
if loc then
local nodeiamon = get_node(loc)
if nodeiamon then
if on_walk[nodeiamon.name] then
on_walk[nodeiamon.name](loc, nodeiamon, player)
for _, player in pairs(get_connected_players()) do
local ppos = player:get_pos()
ppos.y = ceil(ppos.y)
local npos = vector.add(ppos, vector.new(0, -1, 0))
if npos then
local node = get_node(npos)
if node then
if on_walk[node.name] then
on_walk[node.name](npos, node, player)
end
for i = 1, #registered_globals do
registered_globals[i](loc, nodeiamon, player)
registered_globals[i](npos, node, player)
end
end
end

View File

@ -267,7 +267,7 @@ function boat.on_step(self, dtime, moveresult)
return
end
local yaw = self.object:get_yaw()
if ctrl.up then
if ctrl and ctrl.up then
-- Forwards
self._v = self._v + 0.1 * v_factor
@ -276,7 +276,7 @@ function boat.on_step(self, dtime, moveresult)
self.object:set_animation({x=0, y=40}, paddling_speed, 0, true)
self._animation = 1
end
elseif ctrl.down then
elseif ctrl and ctrl.down then
-- Backwards
self._v = self._v - 0.1 * v_factor

298
mods/ITEMS/mcl_armor/API.md Normal file
View File

@ -0,0 +1,298 @@
# mcl_armor
This mod implements the ability of registering armors.
## Registering an Armor Set
The `mcl_armor.register_set()` function aims to simplify the process of registering a full set of armor.
This function register four pieces of armor (head, torso, leggings, feets) based on a definition table:
```lua
mcl_armor.register_set({
--name of the armor material (used for generating itemstrings)
name = "dummy_armor",
--description of the armor material
--do NOT translate this string, it will be concatenated will each piece of armor's description and result will be automatically fetched from your mod's translation files
description = "Dummy Armor",
--overide description of each armor piece
--do NOT localize this string
descriptions = {
head = "Cap", --default: "Helmet"
torso = "Tunic", --default: "Chestplate"
legs = "Pants", --default: "Leggings"
feet = "Shoes", --default: "Boots"
},
--this is used to calculate each armor piece durability with the minecraft algorithm
--head durability = durability * 0.6857 + 1
--torso durability = durability * 1.0 + 1
--legs durability = durability * 0.9375 + 1
--feet durability = durability * 0.8125 + 1
durability = 80,
--this is used then you need to specify the durability of each piece of armor
--this field have the priority over the durability one
--if the durability of some pieces of armor isn't specified in this field, the durability field will be used insteed
durabilities = {
head = 200,
torso = 500,
legs = 400,
feet = 300,
},
--this define how good enchants you will get then enchanting one piece of the armor in an enchanting table
--if set to zero or nil, the armor will not be enchantable
enchantability = 15,
--this define how much each piece of armor protect the player
--these points will be shown in the HUD (chestplate bar above the health bar)
points = {
head = 1,
torso = 3,
legs = 2,
feet = 1,
},
--this attribute reduce strong damage even more
--See https://minecraft.fandom.com/wiki/Armor#Armor_toughness for more explanations
--default: 0
toughness = 2,
--this field is used to specify some items groups that will be added to each piece of armor
--please note that some groups do NOT need to be added by hand, because they are already handeled by the register function:
--(armor, combat_armor, armor_<element>, combat_armor_<element>, mcl_armor_points, mcl_armor_toughness, mcl_armor_uses, enchantability)
groups = {op_armor = 1},
--specify textures that will be overlayed on the entity wearing the armor
--these fields have default values and its recommanded to keep the code clean by just using the default name for your textures
textures = {
head = "dummy_texture.png", --default: "<modname>_helmet_<material>.png"
torso = "dummy_texture.png", --default: "<modname>_chestplate_<material>.png"
legs = "dummy_texture.png", --default: "<modname>_leggings_<material>.png"
feet = "dummy_texture.png", --default: "<modname>_boots_<material>.png"
},
--you can also define these fields as functions, that will be called each time the API function mcl_armor.update(obj) is called (every time you equip/unequip some armor piece, take damage, and more)
--note that the enchanting overlay will not appear unless you implement it in the function
--this allow to make armors where the textures change whitout needing to register many other armors with different textures
textures = {
head = function(obj, itemstack)
if mcl_enchanting.is_enchanted(itemstack) then
return "dummy_texture.png^"..mcl_enchanting.overlay
else
return "dummy_texture.png"
end
end,
},
--WARNING: 2d preview is deprecated and will be removed soon
--specify textures that will be shown in player inventory then you disabled the 3d player inventory preview
--its similar to how works the textures field
previews = {
head = "dummy_texture.png", --default: "<modname>_helmet_<material>_preview.png"
torso = "dummy_texture.png", --default: "<modname>_chestplate_<material>_preview.png"
legs = "dummy_texture.png", --default: "<modname>_leggings_<material>_preview.png"
feet = "dummy_texture.png", --default: "<modname>_boots_<material>_preview.png"
},
--inventory textures aren't definable using a table similar to textures or previews
--you are forced to use the default texture names which are:
--head: "<modname>_inv_helmet_<material>.png
--torso: "<modname>_inv_chestplate_<material>.png
--legs: "<modname>_inv_leggings_<material>.png
--feet: "<modname>_inv_boots_<material>.png
--this callback table allow you to define functions that will be called each time an entity equip an armor piece or the mcl_armor.on_equip() function is called
--the functions accept two arguments: obj and itemstack
on_equip_callbacks = {
head = function(obj, itemstack)
--do stuff
end,
},
--this callback table allow you to define functions that will be called each time an entity unequip an armor piece or the mcl_armor.on_unequip() function is called
--the functions accept two arguments: obj and itemstack
on_unequip_callbacks = {
head = function(obj, itemstack)
--do stuff
end,
},
--this callback table allow you to define functions that will be called then an armor piece break
--the functions accept one arguments: obj
--the itemstack isn't sended due to how minetest handle items which have a zero durability
on_break_callbacks = {
head = function(obj)
--do stuff
end,
},
--this is used to generate automaticaly armor crafts based on each element type folowing the regular minecraft pattern
--if set to nil no craft will be added
craft_material = "mcl_mobitems:leather",
--this is used to generate cooking crafts for each piece of armor
--if set to nil no craft will be added
cook_material = "mcl_core:gold_nugget", --cooking any piece of this armor will output a gold nugged
--this is used for allowing each piece of the armor to be repaired by using an anvil with repair_material as aditionnal material
--it basicaly set the _repair_material item field of each piece of the armor
--if set to nil no repair material will be added
repair_material = "mcl_core:iron_ingot",
})
```
## Creating an Armor Piece
If you don't want to register a full set of armor, then you will need to manually register your own single item.
```lua
minetest.register_tool("dummy_mod:random_armor", {
description = S("Random Armor"),
--these two item fields are used for ingame documentation
--the mcl_armor.longdesc and mcl_armor.usage vars contains the basic usage and purpose of a piece of armor
--these vars may not be enough for that you want to do, so you may add some extra informations like that:
--_doc_items_longdesc = mcl_armor.longdesc.." "..S("Some extra informations.")
_doc_items_longdesc = mcl_armor.longdesc,
_doc_items_usagehelp = mcl_armor.usage,
--this field is similar to any item definition in minetest
--it just set the image shown then the armor is dropped as an item or inside an inventory
inventory_image = "mcl_armor_inv_elytra.png",
--this field is used by minetest internally and also by some helper functions
--in order for the tool to be shown is the right creative inventory tab, the right groups should be added
--"mcl_armor_uses" is required to give your armor a durability
--in that case, the armor can be worn by 10 points before breaking
--if you want the armor to be enchantable, you should also add the "enchantability" group, with the highest number the better enchants you can apply
groups = {armor = 1, non_combat_armor = 1, armor_torso = 1, non_combat_torso = 1, mcl_armor_uses = 10},
--this table is used by minetest for seraching item specific sounds
--the _mcl_armor_equip and _mcl_armor_unequip are used by the armor implementation to play sounds on equip and unequip
--note that you don't need to provide any file extention
sounds = {
_mcl_armor_equip = "mcl_armor_equip_leather",
_mcl_armor_unequip = "mcl_armor_unequip_leather",
},
--these fields should be initialised like that in most cases
--mcl_armor.equip_on_use is a function that try to equip the piece of armor you have in hand inside the right armor slot if the slot is empty
on_place = mcl_armor.equip_on_use,
on_secondary_use = mcl_armor.equip_on_use,
--this field define that the tool is ACTUALLY an armor piece and in which armor slot you can put it
--it should be set to "head", "torso", "legs" or "feet"
_mcl_armor_element = "torso",
--this field is used to provide the texture that will be overlayed on the object (player or mob) skin
--this field can be a texture name or a function that will be called each time the mcl_armor.update(obj) function is called
--see the mcl_armor.register_set() documentation for more explanations
_mcl_armor_texture = "mcl_armor_elytra.png"
--callbacks
--see the mcl_armor.register_set() documentation for more explanations
_on_equip = function(obj, itemstack)
end,
_on_unequip = function(obj, itemstack)
end,
_on_break = function(obj)
end,
})
```
## Interacting with Armor of an Entity
Mods may want to interact with armor of an entity.
Most global functions not described here may not be stable or may be for internal use only.
You can equip a piece of armor on an entity inside a mod by using `mcl_armor.equip()`.
```lua
--itemstack: an itemstack containing the armor piece to equip
--obj: the entity you want to equip the armor on
--swap: boolean, force equiping the armor piece, even if the entity already have one of the same type
mcl_armor.equip(itemstack, obj, swap)
```
You can update the entity apparence by using `mcl_armor.update()`.
This function put the armor overlay on the object's base texture.
If the object is player it will update his displayed armor points count in HUD.
This function will work both on players and mobs.
```lua
--obj: the entity you want the apparence to be updated
mcl_armor.update(obj)
```
## Handling Enchantments
Armors can be enchanted in most cases.
The enchanting part of MineClone2 is separated from the armor part, but closely linked.
Existing armor enchantments in Minecraft improve most of the time how the armor protect the entity from damage.
The `mcl_armor.register_protection_enchantment()` function aims to simplificate the creation of such enchants.
```lua
mcl_armor.register_protection_enchantment({
--this field is the id that will be used for registering enchanted book and store the enchant inside armor metadata.
--(his internal name)
id = "magic_protection",
--visible name of the enchant
--this field is used as the name of registered enchanted book and inside armor tooltip
--translation should be added
name = S("Magic Protection"),
--this field is used to know that the enchant currently do
--translation should be added
description = S("Reduces magic damage."),
--how many levels can the enchant have
--ex: 4 => I, II, III, IV
--default: 4
max_level = 4,
--which enchants this enchant will not be compatible with
--each of these values is a enchant id
incompatible = {blast_protection = true, fire_protection = true, projectile_protection = true},
--how much will the enchant consume from the enchantability group of the armor item
--default: 5
weight = 5,
--false => the enchant can be obtained in an enchanting table
--true => the enchant isn't obtainable in the enchanting table
--is true, you will probably need to implement some ways to obtain it
--even it the field is named "treasure", it will be no way to find it
--default: false
treasure = false,
--how much will damage be reduced
--see Minecraft Wiki for more informations
--https://minecraft.gamepedia.com/Armor#Damage_protection
--https://minecraft.gamepedia.com/Armor#Enchantments
factor = 1,
--restrict damage to one type
--allow the enchant to only protect of one type of damage
damage_type = "magic",
--restrict damage to one category
--allow to protect from many type of damage at once
--this is much less specific than damage_type and also much more customisable
--the "is_magic" flag is used in the "magic", "dragon_breath", "wither_skull" and "thorns" damage types
--you can checkout the mcl_damage source code for a list of availlable damage types and associated flags
--but be warned that mods can register additionnal damage types
damage_flag = "is_magic",
})
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 113 B

View File

@ -97,8 +97,9 @@ mcl_enchanting.enchantments.efficiency = {
weight = 10,
description = S("Increases mining speed."),
curse = false,
on_enchant = function(itemstack, level)
mcl_enchanting.update_groupcaps(itemstack)
on_enchant = function()
-- Updating digging speed is handled by update_groupcaps which
-- is called from load_enchantments.
end,
requires_tool = false,
treasure = false,
@ -671,8 +672,8 @@ mcl_enchanting.enchantments.unbreaking = {
tool_capabilities.punch_attack_uses = tool_capabilities.punch_attack_uses * (1 + level)
itemstack:get_meta():set_tool_capabilities(tool_capabilities)
-- Unbreaking for groupcaps is handled in this function.
mcl_enchanting.update_groupcaps(itemstack)
-- Updating digging durability is handled by update_groupcaps
-- which is called from load_enchantments.
end,
requires_tool = true,
treasure = false,

View File

@ -14,10 +14,11 @@ end
function mcl_enchanting.unload_enchantments(itemstack)
local itemdef = itemstack:get_definition()
if itemdef.tool_capabilities then
itemstack:get_meta():set_tool_capabilities(nil)
end
local meta = itemstack:get_meta()
if itemdef.tool_capabilities then
meta:set_tool_capabilities(nil)
meta:set_string("groupcaps_hash", "")
end
if meta:get_string("name") == "" then
meta:set_string("description", "")
meta:set_string("groupcaps_hash", "")
@ -33,6 +34,7 @@ function mcl_enchanting.load_enchantments(itemstack, enchantments)
enchantment_def.on_enchant(itemstack, level)
end
end
mcl_enchanting.update_groupcaps(itemstack)
end
tt.reload_itemstack_description(itemstack)
end

View File

@ -2,10 +2,7 @@ local groupcaps_cache = {}
-- Compute a hash value.
function compute_hash(value)
-- minetest.get_password_hash is quite fast, even if it uses a
-- cryptographic hashing function (SHA-1). It is written in C++ and it
-- is probably hard to write a faster hashing function in Lua.
return string.sub(minetest.get_password_hash("ryvnf", minetest.serialize(value)), 1, 8)
return string.sub(minetest.sha1(minetest.serialize(value)), 1, 8)
end
-- Get the groupcaps and hash for an enchanted tool. If this function is called

View File

@ -0,0 +1,284 @@
local S = minetest.get_translator("mcl_lanterns")
local modpath = minetest.get_modpath("mcl_lanterns")
mcl_lanterns = {}
--[[
TODO:
- add lantern specific sounds
- remove the hack arround walmounted nodes
]]
local allowed_non_solid_nodes_floor = {
"mcl_core:ice",
"mcl_nether:soul_sand",
"mcl_mobspawners:spawner",
"mcl_core:barrier",
"mcl_end:chorus_flower",
"mcl_end:chorus_flower_dead",
"mcl_end:end_rod",
"mcl_end:dragon_egg",
"mcl_portals:end_portal_frame_eye",
"mcl_lanterns:chain"
}
local allowed_non_solid_groups_floor = {"anvil", "wall", "glass", "fence", "fence_gate", "pane"}
local allowed_non_solid_nodes_ceiling = {
"mcl_core:ice",
"mcl_nether:soul_sand",
"mcl_mobspawners:spawner",
"mcl_core:barrier",
"mcl_end:chorus_flower",
"mcl_end:chorus_flower_dead",
"mcl_end:end_rod",
"mcl_core:grass_path",
"mcl_lanterns:chain"
}
local allowed_non_solid_groups_ceiling = {"anvil", "wall", "glass", "fence", "fence_gate", "soil", "pane", "end_portal_frame"}
local function check_placement(node, wdir)
local nn = node.name
local def = minetest.registered_nodes[nn]
if not def then
return false
else
--wdir:
--0: ceiling
--1: floor
if wdir == 0 then
if def.groups.solid or def.groups.opaque then
return true
else
for _,i in ipairs(allowed_non_solid_nodes_ceiling) do
if nn == i then
return true
end
end
for _,j in ipairs(allowed_non_solid_groups_ceiling) do
if def.groups[j] then
return true
end
end
return false
end
else --assuming wdir == 1
if def.groups.solid or def.groups.opaque then
return true
else
for _,i in ipairs(allowed_non_solid_nodes_floor) do
if nn == i then
return true
end
end
for _,j in ipairs(allowed_non_solid_groups_floor) do
if def.groups[j] then
return true
end
end
return false
end
end
end
end
function mcl_lanterns.register_lantern(name, def)
local itemstring_floor = "mcl_lanterns:"..name.."_floor"
local itemstring_ceiling = "mcl_lanterns:"..name.."_ceiling"
local sounds = mcl_sounds.node_sound_metal_defaults()
minetest.register_node(itemstring_floor, {
description = def.description,
_doc_items_longdesc = def.longdesc,
drawtype = "mesh",
mesh = "mcl_lanterns_lantern_floor.obj",
inventory_image = def.texture_inv,
wield_image = def.texture_inv,
tiles = {
{
name = def.texture,
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
}
},
use_texture_alpha = "clip",
paramtype = "light",
paramtype2 = "wallmounted",
place_param2 = 1,
node_placement_prediction = "",
sunlight_propagates = true,
light_source = def.light_level,
groups = {pickaxey = 1, attached_node = 1, deco_block = 1, lantern = 1},
selection_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, -0.1875, 0.1875, -0.0625, 0.1875},
{-0.125, -0.0625, -0.125, 0.125, 0.0625, 0.125},
{-0.0625, -0.5, -0.0625, 0.0625, 0.1875, 0.0625},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, -0.1875, 0.1875, -0.0625, 0.1875},
{-0.125, -0.0625, -0.125, 0.125, 0.0625, 0.125},
{-0.0625, -0.5, -0.0625, 0.0625, 0.1875, 0.0625},
},
},
sounds = sounds,
on_place = function(itemstack, placer, pointed_thing)
local new_stack = mcl_util.call_on_rightclick(itemstack, placer, pointed_thing)
if new_stack then
return new_stack
end
local under = pointed_thing.under
local above = pointed_thing.above
local node = minetest.get_node(under)
local wdir = minetest.dir_to_wallmounted(vector.subtract(under, above))
local fakestack = itemstack
if check_placement(node, wdir) == false then
return itemstack
end
if wdir == 0 then
fakestack:set_name(itemstring_ceiling)
elseif wdir == 1 then
fakestack:set_name(itemstring_floor)
end
local success
itemstack, success = minetest.item_place(fakestack, placer, pointed_thing, wdir)
itemstack:set_name(itemstring_floor)
if success then
minetest.sound_play(sounds.place, {pos = under, gain = 1}, true)
end
return itemstack
end,
on_rotate = false,
_mcl_hardness = 3.5,
_mcl_blast_resistance = 3.5,
})
minetest.register_node(itemstring_ceiling, {
description = def.description,
_doc_items_create_entry = false,
drawtype = "mesh",
mesh = "mcl_lanterns_lantern_ceiling.obj",
tiles = {
{
name = def.texture,
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
}
},
use_texture_alpha = "clip",
paramtype = "light",
paramtype2 = "wallmounted",
place_param2 = 0,
node_placement_prediction = "",
sunlight_propagates = true,
light_source = def.light_level,
groups = {pickaxey = 1, attached_node = 1, deco_block = 1, lantern = 1, not_in_creative_inventory = 1},
drop = itemstring_floor,
selection_box = {
type = "fixed",
fixed = {
{-0.1875, 0, -0.1875, 0.1875, 0.4375, 0.1875},
{-0.125, -0.125, -0.125, 0.125, 0, 0.125},
{-0.0625, -0.5, -0.0625, 0.0625, -0.125, 0.0625},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.1875, 0, -0.1875, 0.1875, 0.4375, 0.1875},
{-0.125, -0.125, -0.125, 0.125, 0, 0.125},
{-0.0625, -0.5, -0.0625, 0.0625, -0.125, 0.0625},
},
},
sounds = sounds,
on_rotate = false,
_mcl_hardness = 3.5,
_mcl_blast_resistance = 3.5,
})
end
minetest.register_node("mcl_lanterns:chain", {
description = S("Chain"),
_doc_items_longdesc = S("Chains are metallic decoration blocks."),
inventory_image = "mcl_lanterns_chain_inv.png",
tiles = {"mcl_lanterns_chain.png"},
drawtype = "mesh",
paramtype = "light",
paramtype2 = "facedir",
use_texture_alpha = "clip",
mesh = "mcl_lanterns_chain.obj",
is_ground_content = false,
sunlight_propagates = true,
collision_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
}
},
groups = {pickaxey = 1, deco_block = 1},
sounds = mcl_sounds.node_sound_metal_defaults(),
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
local p0 = pointed_thing.under
local p1 = pointed_thing.above
local param2 = 0
local placer_pos = placer:get_pos()
if placer_pos then
local dir = {
x = p1.x - placer_pos.x,
y = p1.y - placer_pos.y,
z = p1.z - placer_pos.z
}
param2 = minetest.dir_to_facedir(dir)
end
if p0.y - 1 == p1.y then
param2 = 20
elseif p0.x - 1 == p1.x then
param2 = 16
elseif p0.x + 1 == p1.x then
param2 = 12
elseif p0.z - 1 == p1.z then
param2 = 8
elseif p0.z + 1 == p1.z then
param2 = 4
end
return minetest.item_place(itemstack, placer, pointed_thing, param2)
end,
_mcl_blast_resistance = 6,
_mcl_hardness = 5,
})
minetest.register_craft({
output = "mcl_lanterns:chain",
recipe = {
{"mcl_core:iron_nugget"},
{"mcl_core:iron_ingot"},
{"mcl_core:iron_nugget"},
},
})
dofile(modpath.."/register.lua")

View File

@ -0,0 +1,6 @@
# textdomain: mcl_lanterns
Lantern=Lanterne
Soul Lantern=Lanterne des âmes
Lanterns are light sources which can be placed on the top or the bottom of most blocks.=Les lanternes sont des blocs lumineux qui peuvent être placés au dessus ou en dessous de la plupart des blocs.
Chain=Chaîne
Chains are metallic decoration blocks.=La chaîne est un bloc de décoration métalique.

View File

@ -0,0 +1,6 @@
# textdomain: mcl_lanterns
Lantern=
Soul Lantern=
Lanterns are light sources which can be placed on the top or the bottom of most blocks.=
Chain=
Chains are metallic decoration blocks.=

View File

@ -0,0 +1,6 @@
name = mcl_lanterns
description = Add lanterns and chains to MineClone2
depends = mcl_sounds
optional_depends =
author = AFCMS
title = MineClone2 Lanterns

View File

@ -0,0 +1,24 @@
# Blender v3.0.1 OBJ File: 'chain.blend'
# www.blender.org
o Plane
v 0.066291 0.500000 0.066291
v 0.066291 -0.500000 0.066291
v -0.066291 0.500000 -0.066291
v -0.066291 -0.500000 -0.066291
v -0.066291 0.500000 0.066291
v -0.066291 -0.500000 0.066291
v 0.066291 0.500000 -0.066291
v 0.066291 -0.500000 -0.066291
vt -0.000000 1.000000
vt 0.000000 -0.000000
vt 0.187500 0.000000
vt 0.187500 1.000000
vt 0.187500 1.000000
vt 0.187500 -0.000000
vt 0.375000 -0.000000
vt 0.375000 1.000000
vn 0.7071 0.0000 -0.7071
vn 0.7071 0.0000 0.7071
s off
f 1/1/1 2/2/1 4/3/1 3/4/1
f 5/5/2 6/6/2 8/7/2 7/8/2

View File

@ -0,0 +1,104 @@
# Blender v3.0.1 OBJ File: 'lantern.blend'
# www.blender.org
o Lantern_Ceiling
v 0.187500 -0.000000 0.187500
v 0.187500 0.437500 0.187500
v 0.187500 0.000000 -0.187500
v 0.187500 0.437500 -0.187500
v -0.187500 -0.000000 0.187500
v -0.187500 0.437500 0.187500
v -0.187500 0.000000 -0.187500
v -0.187500 0.437500 -0.187500
v 0.125000 -0.125000 0.125000
v 0.125000 -0.000000 0.125000
v 0.125000 -0.125000 -0.125000
v 0.125000 0.000000 -0.125000
v -0.125000 -0.125000 0.125000
v -0.125000 -0.000000 0.125000
v -0.125000 -0.125000 -0.125000
v -0.125000 0.000000 -0.125000
v 0.066291 -0.500000 -0.066291
v 0.066291 -0.125000 -0.066291
v -0.066291 -0.500000 0.066291
v -0.066291 -0.125000 0.066291
v -0.066291 -0.500000 -0.066291
v -0.066291 -0.125000 -0.066291
v 0.066291 -0.500000 0.066291
v 0.066291 -0.125000 0.066291
vt 0.000000 0.062500
vt 0.375000 0.062500
vt 0.375000 0.437500
vt 0.000000 0.437500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt -0.000000 0.437500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt 0.000000 0.437500
vt 0.000000 0.062500
vt 0.375000 0.062500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt 0.000000 0.437500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt -0.000000 0.437500
vt 0.062500 0.125000
vt 0.312500 0.125000
vt 0.312500 0.375000
vt 0.062500 0.375000
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.500000 0.770833
vt 0.500000 0.770833
vt 0.500000 0.770833
vt 0.500000 0.770833
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.687500 0.625000
vt 0.687500 0.250000
vt 0.875000 0.250000
vt 0.875000 0.625000
vt 0.687500 1.000000
vt 0.687500 0.625000
vt 0.875000 0.625000
vt 0.875000 1.000000
vn 0.0000 -1.0000 -0.0000
vn 0.0000 0.0000 -1.0000
vn -1.0000 -0.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 -0.0000 1.0000
vn 0.7071 -0.0000 0.7071
vn 0.7071 0.0000 -0.7071
s off
f 1/1/1 5/2/1 7/3/1 3/4/1
f 4/5/2 3/6/2 7/7/2 8/8/2
f 8/9/3 7/10/3 5/11/3 6/12/3
f 6/13/4 2/14/4 4/5/4 8/8/4
f 2/15/5 1/16/5 3/17/5 4/18/5
f 6/19/6 5/20/6 1/21/6 2/22/6
f 9/23/1 13/24/1 15/25/1 11/26/1
f 12/27/2 11/28/2 15/29/2 16/30/2
f 16/31/3 15/32/3 13/33/3 14/34/3
f 14/35/4 10/36/4 12/37/4 16/38/4
f 10/39/5 9/40/5 11/41/5 12/42/5
f 14/43/6 13/44/6 9/45/6 10/46/6
f 17/47/7 18/48/7 20/49/7 19/50/7
f 21/51/8 22/52/8 24/53/8 23/54/8

View File

@ -0,0 +1,104 @@
# Blender v3.0.1 OBJ File: 'lantern.blend'
# www.blender.org
o Lantern_Floor
v 0.187500 -0.062500 -0.187500
v 0.187500 -0.500000 -0.187500
v 0.187500 -0.062500 0.187500
v 0.187500 -0.500000 0.187500
v -0.187500 -0.062500 -0.187500
v -0.187500 -0.500000 -0.187500
v -0.187500 -0.062500 0.187500
v -0.187500 -0.500000 0.187500
v 0.125000 0.062500 -0.125000
v 0.125000 -0.062500 -0.125000
v 0.125000 0.062500 0.125000
v 0.125000 -0.062500 0.125000
v -0.125000 0.062500 -0.125000
v -0.125000 -0.062500 -0.125000
v -0.125000 0.062500 0.125000
v -0.125000 -0.062500 0.125000
v 0.066291 0.187500 0.066291
v 0.066291 0.062500 0.066291
v -0.066291 0.187500 -0.066291
v -0.066291 0.062500 -0.066291
v -0.066291 0.187500 0.066291
v -0.066291 0.062500 0.066291
v 0.066291 0.187500 -0.066291
v 0.066291 0.062500 -0.066291
vt 0.000000 0.062500
vt 0.375000 0.062500
vt 0.375000 0.437500
vt 0.000000 0.437500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt -0.000000 0.437500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt 0.000000 0.437500
vt 0.000000 0.062500
vt 0.375000 0.062500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt 0.000000 0.437500
vt 0.375000 0.437500
vt 0.375000 0.875000
vt -0.000000 0.875000
vt -0.000000 0.437500
vt 0.062500 0.125000
vt 0.312500 0.125000
vt 0.312500 0.375000
vt 0.062500 0.375000
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.500000 0.770833
vt 0.500000 0.770833
vt 0.500000 0.770833
vt 0.500000 0.770833
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.312500 0.875000
vt 0.312500 1.000000
vt 0.062500 1.000000
vt 0.062500 0.875000
vt 0.687500 0.937500
vt 0.687500 0.812500
vt 0.875000 0.812500
vt 0.875000 0.937500
vt 0.687500 0.937500
vt 0.687500 0.812500
vt 0.875000 0.812500
vt 0.875000 0.937500
vn 0.0000 1.0000 0.0000
vn 0.0000 0.0000 1.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 -1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 0.7071 0.0000 -0.7071
vn 0.7071 0.0000 0.7071
s off
f 1/1/1 5/2/1 7/3/1 3/4/1
f 4/5/2 3/6/2 7/7/2 8/8/2
f 8/9/3 7/10/3 5/11/3 6/12/3
f 6/13/4 2/14/4 4/5/4 8/8/4
f 2/15/5 1/16/5 3/17/5 4/18/5
f 6/19/6 5/20/6 1/21/6 2/22/6
f 9/23/1 13/24/1 15/25/1 11/26/1
f 12/27/2 11/28/2 15/29/2 16/30/2
f 16/31/3 15/32/3 13/33/3 14/34/3
f 14/35/4 10/36/4 12/37/4 16/38/4
f 10/39/5 9/40/5 11/41/5 12/42/5
f 14/43/6 13/44/6 9/45/6 10/46/6
f 17/47/7 18/48/7 20/49/7 19/50/7
f 21/51/8 22/52/8 24/53/8 23/54/8

View File

@ -0,0 +1,26 @@
local S = minetest.get_translator("mcl_lanterns")
mcl_lanterns.register_lantern("lantern", {
description = S("Lantern"),
longdesc = S("Lanterns are light sources which can be placed on the top or the bottom of most blocks."),
texture = "mcl_lanterns_lantern.png",
texture_inv = "mcl_lanterns_lantern_inv.png",
light_level = 14,
})
mcl_lanterns.register_lantern("soul_lantern", {
description = S("Soul Lantern"),
longdesc = S("Lanterns are light sources which can be placed on the top or the bottom of most blocks."),
texture = "mcl_lanterns_soul_lantern.png",
texture_inv = "mcl_lanterns_soul_lantern_inv.png",
light_level = 10,
})
minetest.register_craft({
output = "mcl_lanterns:lantern_floor",
recipe = {
{"mcl_core:iron_nugget", "mcl_core:iron_nugget", "mcl_core:iron_nugget"},
{"mcl_core:iron_nugget", "mcl_torches:torch" , "mcl_core:iron_nugget"},
{"mcl_core:iron_nugget", "mcl_core:iron_nugget", "mcl_core:iron_nugget"},
},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB