Update Fork #9
|
@ -31,6 +31,12 @@ Refer to [Minetest Lua API](https://github.com/minetest/minetest/blob/master/doc
|
||||||
|
|
||||||
Follow [Lua code style guidelines](https://dev.minetest.net/Lua_code_style_guidelines). Use tabs, not spaces for indentation (tab size = 8). Never use `minetest.env`.
|
Follow [Lua code style guidelines](https://dev.minetest.net/Lua_code_style_guidelines). Use tabs, not spaces for indentation (tab size = 8). Never use `minetest.env`.
|
||||||
|
|
||||||
|
If you do a translation, try detecting translational issues with `check_translate_files.py` - just run it from tools folder:
|
||||||
|
```bash
|
||||||
|
# python3 check_translate_files.py fr | less
|
||||||
|
```
|
||||||
|
(`fr` is a language code)
|
||||||
|
|
||||||
Check your code works as expected.
|
Check your code works as expected.
|
||||||
|
|
||||||
Commit & push your changes to a new branch (not master, one change per a branch).
|
Commit & push your changes to a new branch (not master, one change per a branch).
|
||||||
|
|
|
@ -201,6 +201,8 @@ These groups are used mostly for informational purposes
|
||||||
* `building_block=1`: Block is a building block
|
* `building_block=1`: Block is a building block
|
||||||
* `deco_block=1`: Block is a decorational block
|
* `deco_block=1`: Block is a decorational block
|
||||||
|
|
||||||
|
* `blast_furnace_smeltable=1` : Item or node is smeltable by a blast furnace
|
||||||
|
* `smoker_cookable=1` : Food is cookable by a smoker.
|
||||||
|
|
||||||
## Fake item groups
|
## Fake item groups
|
||||||
These groups put similar items together which should all be treated by the gameplay or the GUI as a single item.
|
These groups put similar items together which should all be treated by the gameplay or the GUI as a single item.
|
||||||
|
|
|
@ -70,7 +70,11 @@ an explanation.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
This game requires latest stable [Minetest](http://minetest.net) to run, please install
|
This game requires latest stable [Minetest](http://minetest.net) to run, please install
|
||||||
it first. Only stable versions of Minetest are officially supported.
|
it first. Only latest stable version of Minetest is officially supported.
|
||||||
|
There are lots of questions about Ubuntu, which has minetest-5.1.1 still.
|
||||||
|
Please, first of all, visit this page, it should fix the problem: https://launchpad.net/~minetestdevs/+archive/ubuntu/stable
|
||||||
|
Also, here is endless issue #123: https://git.minetest.land/MineClone5/MineClone5/issues/123 - really less preferable way.
|
||||||
|
|
||||||
There is no support for running MineClone 5 in development versions of Minetest.
|
There is no support for running MineClone 5 in development versions of Minetest.
|
||||||
|
|
||||||
To install MineClone 5 (if you haven't already), move this directory into the
|
To install MineClone 5 (if you haven't already), move this directory into the
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
# textdomain:mcl_explosions
|
||||||
|
@1 was caught in an explosion.=@1 es mòrt(a) dins una petarada.
|
|
@ -148,16 +148,48 @@ local chunk_scan_range = {
|
||||||
[ CS_NODES] = {LAST_BLOCK+1, LAST_BLOCK+1},
|
[ CS_NODES] = {LAST_BLOCK+1, LAST_BLOCK+1},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local EDGE_MIN = mcl_mapgen.EDGE_MIN
|
||||||
|
local EDGE_MAX = mcl_mapgen.EDGE_MAX
|
||||||
local function is_chunk_finished(minp)
|
local function is_chunk_finished(minp)
|
||||||
local center = vector.add(minp, HALF_CS_NODES)
|
local center_x = minp.x + HALF_CS_NODES
|
||||||
for check_x = center.x - CS_NODES, center.x + CS_NODES, CS_NODES do
|
local center_y = minp.y + HALF_CS_NODES
|
||||||
for check_y = center.y - CS_NODES, center.y + CS_NODES, CS_NODES do
|
local center_z = minp.z + HALF_CS_NODES
|
||||||
for check_z = center.z - CS_NODES, center.z + CS_NODES, CS_NODES do
|
local from_x = center_x - CS_NODES
|
||||||
local pos = vector.new(check_x, check_y, check_z)
|
local from_y = center_y - CS_NODES
|
||||||
if pos ~= center then
|
local from_z = center_z - CS_NODES
|
||||||
minetest_get_voxel_manip():read_from_map(pos, pos)
|
local to_x = center_x + CS_NODES
|
||||||
local node = minetest_get_node(pos)
|
local to_y = center_y + CS_NODES
|
||||||
|
local to_z = center_z + CS_NODES
|
||||||
|
if from_x < EDGE_MIN then from_x = center_x end
|
||||||
|
if from_y < EDGE_MIN then from_y = center_y end
|
||||||
|
if from_z < EDGE_MIN then from_z = center_z end
|
||||||
|
if to_x > EDGE_MAX then to_x = center_x end
|
||||||
|
if to_y > EDGE_MAX then to_y = center_y end
|
||||||
|
if to_z > EDGE_MAX then to_z = center_z end
|
||||||
|
for check_x = from_x, to_x, CS_NODES do
|
||||||
|
local are_we_in_central_chunk = check_x == center_x
|
||||||
|
for check_y = from_y, to_y, CS_NODES do
|
||||||
|
are_we_in_central_chunk = are_we_in_central_chunk and (check_y == center_y)
|
||||||
|
for check_z = from_z, to_z, CS_NODES do
|
||||||
|
are_we_in_central_chunk = are_we_in_central_chunk and (check_z == center_z)
|
||||||
|
if not are_we_in_central_chunk then
|
||||||
|
local check_pos = {x = check_x, y = check_y, z = check_z}
|
||||||
|
minetest_get_voxel_manip():read_from_map(check_pos, check_pos)
|
||||||
|
local node = minetest_get_node(check_pos)
|
||||||
if node.name == "ignore" then
|
if node.name == "ignore" then
|
||||||
|
-- return nil, means false, means, there is something to generate still,
|
||||||
|
-- (because one of adjacent chunks is unfinished - "ignore" means that),
|
||||||
|
-- means this chunk will be changed, at least one of its sides or corners
|
||||||
|
-- means it's unsafe to place anything there right now, it might disappar,
|
||||||
|
-- better to wait, see the diagram of conflict/ok areas per a single axis:
|
||||||
|
|
||||||
|
-- conflict| ok |conflict|conflict| ok |conflict|conflict| ok |conflict
|
||||||
|
-- (_________Chunk1_________)|(_________Chunk2_________)|(_________Chunk3_________)
|
||||||
|
-- [Block1]|[MidBlk]|[BlockN]|[Block1]|[MidBlk]|[BlockN]|[Block1]|[MidBlk]|[BlockN]
|
||||||
|
-- \_____________Chunk2-with-shell____________/
|
||||||
|
-- ...______Chunk1-with-shell________/ \________Chunk3-with-shell______...
|
||||||
|
-- Generation of chunk 1 AFFECTS 2 ^^^ ^^^ Generation of chunk 3 affects 2
|
||||||
|
-- ^^^^^^^^Chunk 2 gen. affects 1 and 3^^^^^^^^
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -325,7 +357,7 @@ minetest.register_on_generated(function(minp, maxp, chunkseed)
|
||||||
-- mcl_mapgen.register_mapgen_lvm(function(vm_context), order_number) --
|
-- mcl_mapgen.register_mapgen_lvm(function(vm_context), order_number) --
|
||||||
-- --
|
-- --
|
||||||
for _, v in pairs(queue_chunks_lvm) do
|
for _, v in pairs(queue_chunks_lvm) do
|
||||||
vm_context = v.f(vm_context)
|
v.f(vm_context)
|
||||||
end
|
end
|
||||||
-- --
|
-- --
|
||||||
-- mcl_mapgen.register_mapgen(function(minp, maxp, chunkseed, vm_context), order_number) --
|
-- mcl_mapgen.register_mapgen(function(minp, maxp, chunkseed, vm_context), order_number) --
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
mcl_util = {}
|
mcl_util = {}
|
||||||
|
|
||||||
|
local minetest_get_item_group = minetest.get_item_group
|
||||||
|
local minetest_get_meta = minetest.get_meta
|
||||||
|
local minetest_get_node = minetest.get_node
|
||||||
|
local minetest_get_node_timer = minetest.get_node_timer
|
||||||
|
local table_copy = table.copy
|
||||||
|
|
||||||
-- Updates all values in t using values from to*.
|
-- Updates all values in t using values from to*.
|
||||||
function table.update(t, ...)
|
function table.update(t, ...)
|
||||||
for _, to in ipairs{...} do
|
for _, to in ipairs{...} do
|
||||||
|
@ -33,36 +39,6 @@ function mcl_util.rotate_axis(itemstack, placer, pointed_thing)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns position of the neighbor of a double chest node
|
|
||||||
-- or nil if node is invalid.
|
|
||||||
-- This function assumes that the large chest is actually intact
|
|
||||||
-- * pos: Position of the node to investigate
|
|
||||||
-- * param2: param2 of that node
|
|
||||||
-- * side: Which "half" the investigated node is. "left" or "right"
|
|
||||||
function mcl_util.get_double_container_neighbor_pos(pos, param2, side)
|
|
||||||
if side == "right" then
|
|
||||||
if param2 == 0 then
|
|
||||||
return {x=pos.x-1, y=pos.y, z=pos.z}
|
|
||||||
elseif param2 == 1 then
|
|
||||||
return {x=pos.x, y=pos.y, z=pos.z+1}
|
|
||||||
elseif param2 == 2 then
|
|
||||||
return {x=pos.x+1, y=pos.y, z=pos.z}
|
|
||||||
elseif param2 == 3 then
|
|
||||||
return {x=pos.x, y=pos.y, z=pos.z-1}
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if param2 == 0 then
|
|
||||||
return {x=pos.x+1, y=pos.y, z=pos.z}
|
|
||||||
elseif param2 == 1 then
|
|
||||||
return {x=pos.x, y=pos.y, z=pos.z-1}
|
|
||||||
elseif param2 == 2 then
|
|
||||||
return {x=pos.x-1, y=pos.y, z=pos.z}
|
|
||||||
elseif param2 == 3 then
|
|
||||||
return {x=pos.x, y=pos.y, z=pos.z+1}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Iterates through all items in the given inventory and
|
-- Iterates through all items in the given inventory and
|
||||||
-- returns the slot of the first item which matches a condition.
|
-- returns the slot of the first item which matches a condition.
|
||||||
-- Returns nil if no item was found.
|
-- Returns nil if no item was found.
|
||||||
|
@ -87,7 +63,7 @@ end
|
||||||
|
|
||||||
-- Returns true if itemstack is a shulker box
|
-- Returns true if itemstack is a shulker box
|
||||||
local function is_not_shulker_box(itemstack)
|
local function is_not_shulker_box(itemstack)
|
||||||
local g = minetest.get_item_group(itemstack:get_name(), "shulker_box")
|
local g = minetest_get_item_group(itemstack:get_name(), "shulker_box")
|
||||||
return g == 0 or g == nil
|
return g == 0 or g == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -133,136 +109,116 @@ end
|
||||||
--- source_stack_id (optional): The inventory position ID of the source inventory to take the item from (-1 for slot of the first valid item; -1 is default)
|
--- source_stack_id (optional): The inventory position ID of the source inventory to take the item from (-1 for slot of the first valid item; -1 is default)
|
||||||
--- destination_list (optional): List name of the destination inventory. Default is normally "main"; "src" for furnace
|
--- destination_list (optional): List name of the destination inventory. Default is normally "main"; "src" for furnace
|
||||||
-- Returns true on success and false on failure.
|
-- Returns true on success and false on failure.
|
||||||
|
local SHULKER_BOX = 3
|
||||||
|
local FURNACE = 4
|
||||||
|
local DOUBLE_CHEST_LEFT = 5
|
||||||
|
local DOUBLE_CHEST_RIGHT = 6
|
||||||
|
local CONTAINER_GROUP_TO_LIST = {
|
||||||
|
[1] = "main",
|
||||||
|
[2] = "main",
|
||||||
|
[SHULKER_BOX] = "main",
|
||||||
|
[FURNACE] = "dst",
|
||||||
|
[DOUBLE_CHEST_LEFT] = "main",
|
||||||
|
[DOUBLE_CHEST_RIGHT] = "main",
|
||||||
|
}
|
||||||
function mcl_util.move_item_container(source_pos, destination_pos, source_list, source_stack_id, destination_list)
|
function mcl_util.move_item_container(source_pos, destination_pos, source_list, source_stack_id, destination_list)
|
||||||
local dpos = table.copy(destination_pos)
|
local spos = table_copy(source_pos)
|
||||||
local spos = table.copy(source_pos)
|
local snode = minetest_get_node(spos)
|
||||||
local snode = minetest.get_node(spos)
|
local sctype = minetest_get_item_group(snode.name, "container")
|
||||||
local dnode = minetest.get_node(dpos)
|
local default_source_list = CONTAINER_GROUP_TO_LIST[sctype]
|
||||||
|
if not default_source_list then return end
|
||||||
local dctype = minetest.get_item_group(dnode.name, "container")
|
if sctype == DOUBLE_CHEST_RIGHT then
|
||||||
local sctype = minetest.get_item_group(snode.name, "container")
|
local sparam2 = snode.param2
|
||||||
|
if sparam2 == 0 then spos.x = spos.x - 1
|
||||||
-- Container type 7 does not allow any movement
|
elseif sparam2 == 1 then spos.z = spos.z + 1
|
||||||
if sctype == 7 then
|
elseif sparam2 == 2 then spos.x = spos.x + 1
|
||||||
return false
|
elseif sparam2 == 3 then spos.z = spos.z - 1
|
||||||
end
|
|
||||||
|
|
||||||
-- Normalize double container by forcing to always use the left segment first
|
|
||||||
local function normalize_double_container(pos, node, ctype)
|
|
||||||
if ctype == 6 then
|
|
||||||
pos = mcl_util.get_double_container_neighbor_pos(pos, node.param2, "right")
|
|
||||||
if not pos then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
node = minetest.get_node(pos)
|
|
||||||
ctype = minetest.get_item_group(node.name, "container")
|
|
||||||
-- The left segment seems incorrect? We better bail out!
|
|
||||||
if ctype ~= 5 then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return pos, node, ctype
|
snode = minetest_get_node(spos)
|
||||||
|
sctype = minetest_get_item_group(snode.name, "container")
|
||||||
|
if sctype ~= DOUBLE_CHEST_LEFT then return end
|
||||||
end
|
end
|
||||||
|
local smeta = minetest_get_meta(spos)
|
||||||
spos, snode, sctype = normalize_double_container(spos, snode, sctype)
|
|
||||||
dpos, dnode, dctype = normalize_double_container(dpos, dnode, dctype)
|
|
||||||
if not spos or not dpos then return false end
|
|
||||||
|
|
||||||
local smeta = minetest.get_meta(spos)
|
|
||||||
local dmeta = minetest.get_meta(dpos)
|
|
||||||
|
|
||||||
local sinv = smeta:get_inventory()
|
local sinv = smeta:get_inventory()
|
||||||
|
local source_list = source_list or default_source_list
|
||||||
|
|
||||||
|
local dpos = table_copy(destination_pos)
|
||||||
|
local dnode = minetest_get_node(dpos)
|
||||||
|
local dctype = minetest_get_item_group(dnode.name, "container")
|
||||||
|
local default_destination_list = CONTAINER_GROUP_TO_LIST[sctype]
|
||||||
|
if not default_destination_list then return end
|
||||||
|
if dctype == DOUBLE_CHEST_RIGHT then
|
||||||
|
local dparam2 = dnode.param2
|
||||||
|
if dparam2 == 0 then dpos.x = dpos.x - 1
|
||||||
|
elseif dparam2 == 1 then dpos.z = dpos.z + 1
|
||||||
|
elseif dparam2 == 2 then dpos.x = dpos.x + 1
|
||||||
|
elseif dparam2 == 3 then dpos.z = dpos.z - 1
|
||||||
|
end
|
||||||
|
dnode = minetest_get_node(dpos)
|
||||||
|
dctype = minetest_get_item_group(dnode.name, "container")
|
||||||
|
if dctype ~= DOUBLE_CHEST_LEFT then return end
|
||||||
|
end
|
||||||
|
local dmeta = minetest_get_meta(dpos)
|
||||||
local dinv = dmeta:get_inventory()
|
local dinv = dmeta:get_inventory()
|
||||||
|
|
||||||
-- Default source lists
|
|
||||||
if not source_list then
|
|
||||||
-- Main inventory for most container types
|
|
||||||
if sctype == 2 or sctype == 3 or sctype == 5 or sctype == 6 or sctype == 7 then
|
|
||||||
source_list = "main"
|
|
||||||
-- Furnace: output
|
|
||||||
elseif sctype == 4 then
|
|
||||||
source_list = "dst"
|
|
||||||
-- Unknown source container type. Bail out
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Automatically select stack slot ID if set to automatic
|
-- Automatically select stack slot ID if set to automatic
|
||||||
if not source_stack_id then
|
local source_stack_id = source_stack_id or -1
|
||||||
source_stack_id = -1
|
|
||||||
end
|
|
||||||
if source_stack_id == -1 then
|
if source_stack_id == -1 then
|
||||||
local cond = nil
|
local cond = nil
|
||||||
-- Prevent shulker box inception
|
-- Prevent shulker box inception
|
||||||
if dctype == 3 then
|
if dctype == SHULKER_BOX then cond = is_not_shulker_box end
|
||||||
cond = is_not_shulker_box
|
|
||||||
end
|
|
||||||
source_stack_id = mcl_util.get_eligible_transfer_item_slot(sinv, source_list, dinv, dpos, cond)
|
source_stack_id = mcl_util.get_eligible_transfer_item_slot(sinv, source_list, dinv, dpos, cond)
|
||||||
if not source_stack_id then
|
if not source_stack_id then
|
||||||
-- Try again if source is a double container
|
if sctype == DOUBLE_CHEST_LEFT then
|
||||||
if sctype == 5 then
|
local sparam2 = snode.param2
|
||||||
spos = mcl_util.get_double_container_neighbor_pos(spos, snode.param2, "left")
|
if sparam2 == 0 then spos.x = spos.x + 1
|
||||||
smeta = minetest.get_meta(spos)
|
elseif sparam2 == 1 then spos.z = spos.z - 1
|
||||||
sinv = smeta:get_inventory()
|
elseif sparam2 == 2 then spos.x = spos.x - 1
|
||||||
|
elseif sparam2 == 3 then spos.z = spos.z + 1
|
||||||
source_stack_id = mcl_util.get_eligible_transfer_item_slot(sinv, source_list, dinv, dpos, cond)
|
|
||||||
if not source_stack_id then
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
else
|
snode = minetest_get_node(spos)
|
||||||
return false
|
sctype = minetest_get_item_group(snode.name, "container")
|
||||||
|
if sctype ~= DOUBLE_CHEST_RIGHT then return end
|
||||||
|
smeta = minetest_get_meta(spos)
|
||||||
|
sinv = smeta:get_inventory()
|
||||||
|
source_stack_id = mcl_util.get_eligible_transfer_item_slot(sinv, source_list, dinv, dpos, cond)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if not source_stack_id then return end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Abort transfer if shulker box wants to go into shulker box
|
-- Abort transfer if shulker box wants to go into shulker box
|
||||||
if dctype == 3 then
|
if dctype == SHULKER_BOX then
|
||||||
local stack = sinv:get_stack(source_list, source_stack_id)
|
local stack = sinv:get_stack(source_list, source_stack_id)
|
||||||
if stack and minetest.get_item_group(stack:get_name(), "shulker_box") == 1 then
|
if stack and minetest_get_item_group(stack:get_name(), "shulker_box") == 1 then return end
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- Container type 7 does not allow any placement
|
|
||||||
if dctype == 7 then
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If it's a container, put it into the container
|
local destination_list = destination_list or default_destination_list
|
||||||
if dctype ~= 0 then
|
-- Move item
|
||||||
-- Automatically select a destination list if omitted
|
local ok = mcl_util.move_item(sinv, source_list, source_stack_id, dinv, destination_list)
|
||||||
if not destination_list then
|
-- Try transfer to neighbor node if transfer failed and double container
|
||||||
-- Main inventory for most container types
|
if not ok then
|
||||||
if dctype == 2 or dctype == 3 or dctype == 5 or dctype == 6 or dctype == 7 then
|
if dctype == DOUBLE_CHEST_LEFT then
|
||||||
destination_list = "main"
|
local dparam2 = dnode.param2
|
||||||
-- Furnace source slot
|
if dparam2 == 0 then dpos.x = dpos.x + 1
|
||||||
elseif dctype == 4 then
|
elseif dparam2 == 1 then dpos.z = dpos.z - 1
|
||||||
destination_list = "src"
|
elseif dparam2 == 2 then dpos.x = dpos.x - 1
|
||||||
|
elseif dparam2 == 3 then dpos.z = dpos.z + 1
|
||||||
end
|
end
|
||||||
end
|
dnode = minetest_get_node(dpos)
|
||||||
if destination_list then
|
dctype = minetest_get_item_group(dnode.name, "container")
|
||||||
-- Move item
|
if dctype ~= DOUBLE_CHEST_RIGHT then return end
|
||||||
local ok = mcl_util.move_item(sinv, source_list, source_stack_id, dinv, destination_list)
|
dmeta = minetest_get_meta(dpos)
|
||||||
|
dinv = dmeta:get_inventory()
|
||||||
-- Try transfer to neighbor node if transfer failed and double container
|
ok = mcl_util.move_item(sinv, source_list, source_stack_id, dinv, destination_list)
|
||||||
if not ok and dctype == 5 then
|
|
||||||
dpos = mcl_util.get_double_container_neighbor_pos(dpos, dnode.param2, "left")
|
|
||||||
dmeta = minetest.get_meta(dpos)
|
|
||||||
dinv = dmeta:get_inventory()
|
|
||||||
|
|
||||||
ok = mcl_util.move_item(sinv, source_list, source_stack_id, dinv, destination_list)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Update furnace
|
|
||||||
if ok and dctype == 4 then
|
|
||||||
-- Start furnace's timer function, it will sort out whether furnace can burn or not.
|
|
||||||
minetest.get_node_timer(dpos):start(1.0)
|
|
||||||
end
|
|
||||||
|
|
||||||
return ok
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
-- Update furnace
|
||||||
|
if ok and dctype == FURNACE then
|
||||||
|
-- Start furnace's timer function, it will sort out whether furnace can burn or not.
|
||||||
|
minetest_get_node_timer(dpos):start(1.0)
|
||||||
|
end
|
||||||
|
return ok
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns the ID of the first non-empty slot in the given inventory list
|
-- Returns the ID of the first non-empty slot in the given inventory list
|
||||||
|
@ -292,7 +248,7 @@ function mcl_util.generate_on_place_plant_function(condition)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Call on_rightclick if the pointed node defines it
|
-- Call on_rightclick if the pointed node defines it
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
local node = minetest_get_node(pointed_thing.under)
|
||||||
if placer and not placer:get_player_control().sneak then
|
if placer and not placer:get_player_control().sneak then
|
||||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
||||||
|
@ -300,8 +256,8 @@ function mcl_util.generate_on_place_plant_function(condition)
|
||||||
end
|
end
|
||||||
|
|
||||||
local place_pos
|
local place_pos
|
||||||
local def_under = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
local def_under = minetest.registered_nodes[minetest_get_node(pointed_thing.under).name]
|
||||||
local def_above = minetest.registered_nodes[minetest.get_node(pointed_thing.above).name]
|
local def_above = minetest.registered_nodes[minetest_get_node(pointed_thing.above).name]
|
||||||
if not def_under or not def_above then
|
if not def_under or not def_above then
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
@ -359,7 +315,7 @@ function mcl_util.call_on_rightclick(itemstack, player, pointed_thing)
|
||||||
-- Call on_rightclick if the pointed node defines it
|
-- Call on_rightclick if the pointed node defines it
|
||||||
if pointed_thing and pointed_thing.type == "node" then
|
if pointed_thing and pointed_thing.type == "node" then
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest_get_node(pos)
|
||||||
if player and not player:get_player_control().sneak then
|
if player and not player:get_player_control().sneak then
|
||||||
local nodedef = minetest.registered_nodes[node.name]
|
local nodedef = minetest.registered_nodes[node.name]
|
||||||
local on_rightclick = nodedef and nodedef.on_rightclick
|
local on_rightclick = nodedef and nodedef.on_rightclick
|
||||||
|
@ -372,7 +328,7 @@ end
|
||||||
|
|
||||||
function mcl_util.calculate_durability(itemstack)
|
function mcl_util.calculate_durability(itemstack)
|
||||||
local unbreaking_level = mcl_enchanting.get_enchantment(itemstack, "unbreaking")
|
local unbreaking_level = mcl_enchanting.get_enchantment(itemstack, "unbreaking")
|
||||||
local armor_uses = minetest.get_item_group(itemstack:get_name(), "mcl_armor_uses")
|
local armor_uses = minetest_get_item_group(itemstack:get_name(), "mcl_armor_uses")
|
||||||
|
|
||||||
local uses
|
local uses
|
||||||
|
|
||||||
|
@ -417,6 +373,7 @@ function mcl_util.deal_damage(target, damage, mcl_reason)
|
||||||
-- target:punch(puncher, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy = damage}}, vector.direction(puncher:get_pos(), target:get_pos()), damage)
|
-- target:punch(puncher, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy = damage}}, vector.direction(puncher:get_pos(), target:get_pos()), damage)
|
||||||
if luaentity.health > 0 then
|
if luaentity.health > 0 then
|
||||||
luaentity.health = luaentity.health - damage
|
luaentity.health = luaentity.health - damage
|
||||||
|
luaentity.pause_timer = 0.4
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -152,3 +152,23 @@ minetest.register_globalstep(function(dtime)
|
||||||
dimtimer = 0
|
dimtimer = 0
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
function mcl_worlds.get_cloud_parameters()
|
||||||
|
if mcl_mapgen.name == "valleys" then
|
||||||
|
return {
|
||||||
|
height = 384,
|
||||||
|
speed = {x=-2, z=0},
|
||||||
|
thickness=5,
|
||||||
|
color="#FFF0FEF",
|
||||||
|
ambient = "#201060",
|
||||||
|
}
|
||||||
|
else
|
||||||
|
-- MC-style clouds: Layer 127, thickness 4, fly to the “West”
|
||||||
|
return {
|
||||||
|
height = mcl_worlds.layer_to_y(127),
|
||||||
|
speed = {x=-2, z=0},
|
||||||
|
thickness = 4,
|
||||||
|
color = "#FFF0FEF",
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -0,0 +1,674 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
@ -0,0 +1,87 @@
|
||||||
|
# tga_encoder
|
||||||
|
A TGA Encoder written in Lua without the use of external Libraries.
|
||||||
|
|
||||||
|
Created by fleckenstein for MineClone2, then improved by erlehmann.
|
||||||
|
|
||||||
|
May be used as a Minetest mod.
|
||||||
|
|
||||||
|
See `examples.lua` for example code and usage hints.
|
||||||
|
|
||||||
|
## Use Cases for `tga_encoder`
|
||||||
|
|
||||||
|
### Encoding Textures for Editing
|
||||||
|
|
||||||
|
TGA images of types 1/2/3 consist of header data followed by a pixel array.
|
||||||
|
|
||||||
|
This makes it trivial to parse TGA files – and even edit pixels in-place.
|
||||||
|
|
||||||
|
No checksums need to be updated on any kind of in-place texture editing.
|
||||||
|
|
||||||
|
**Tip**: When storing an editable image in item meta, use zlib compression.
|
||||||
|
|
||||||
|
### Legacy Minetest Texture Encoding
|
||||||
|
|
||||||
|
Minetest 5.4 did not include `minetest.encode_png()` (or any equvivalent).
|
||||||
|
|
||||||
|
Since `tga_encoder` is written in pure Lua, it does not need engine support.
|
||||||
|
|
||||||
|
**Tip:** Look at `examples.lua` and the Minetest mod `mcl_maps` for guidance.
|
||||||
|
|
||||||
|
### Advanced Texture Format Control
|
||||||
|
|
||||||
|
The function `minetest.encode_png()` always encodes images as 32bpp RGBA.
|
||||||
|
|
||||||
|
`tga_encoder` allows saving images as grayscale, 16bpp RGBA and 24bpp RGB.
|
||||||
|
|
||||||
|
For generating maps from terrain, color-mapped formats can be more useful.
|
||||||
|
|
||||||
|
### Encoding Very Small Textures
|
||||||
|
|
||||||
|
Images of size 8×8 or below are often smaller than an equivalent PNG file.
|
||||||
|
|
||||||
|
Note that on many filesystems files use at least 4096 bytes (i.e. 64×64).
|
||||||
|
|
||||||
|
Therefore, saving bytes on files up to a few 100 bytes is often useless.
|
||||||
|
|
||||||
|
### Encoding Reference Textures
|
||||||
|
|
||||||
|
TGA is a simple format, which makes it easy to create reference textures.
|
||||||
|
|
||||||
|
Using a hex editor, one can trivially see how all the pixels are stored.
|
||||||
|
|
||||||
|
## Supported Image Types
|
||||||
|
|
||||||
|
For all types, images are encoded in a fast single pass (i.e. append-only).
|
||||||
|
|
||||||
|
### Color-Mapped Images (Type 1)
|
||||||
|
|
||||||
|
These images contain a palette, followed by pixel data.
|
||||||
|
|
||||||
|
* `A1R5G5B5` (8bpp RGB)
|
||||||
|
* `B8G8R8` (8bpp RGB)
|
||||||
|
* `B8G8R8A8` (8bpp RGBA)
|
||||||
|
|
||||||
|
### True-Color Images (Type 2)
|
||||||
|
|
||||||
|
These images contain uncompressed RGB(A) pixel data.
|
||||||
|
|
||||||
|
* `A1R5G5B5` (16bpp RGBA)
|
||||||
|
* `B8G8R8` (24bpp RGB)
|
||||||
|
* `B8G8R8A8` (32bpp RGBA)
|
||||||
|
|
||||||
|
### Grayscale Images (Type 3)
|
||||||
|
|
||||||
|
* `Y8` (8bpp grayscale)
|
||||||
|
|
||||||
|
### Run-Length Encoded (RLE), True-Color Images (Type 10)
|
||||||
|
|
||||||
|
These images contain compressed RGB(A) pixel data.
|
||||||
|
|
||||||
|
* `A1R5G5B5` (16bpp RGBA)
|
||||||
|
* `B8G8R8` (24bpp RGB)
|
||||||
|
* `B8G8R8A8` (32bpp RGBA)
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
* Actually support `R8G8B8A8` input for `A1R5G5B5` output
|
||||||
|
* Add both zoomable and explorable maps to `mcl_maps`.
|
|
@ -0,0 +1,150 @@
|
||||||
|
dofile("init.lua")
|
||||||
|
|
||||||
|
-- encode a bitmap
|
||||||
|
local _ = { 0, 0, 0 }
|
||||||
|
local R = { 255, 127, 127 }
|
||||||
|
local pixels = {
|
||||||
|
{ _, _, _, _, _, _, _ },
|
||||||
|
{ _, _, _, R, _, _, _ },
|
||||||
|
{ _, _, R, R, R, _, _ },
|
||||||
|
{ _, R, R, R, R, R, _ },
|
||||||
|
{ _, R, R, R, R, R, _ },
|
||||||
|
{ _, _, R, _, R, _, _ },
|
||||||
|
{ _, _, _, _, _, _, _ },
|
||||||
|
}
|
||||||
|
tga_encoder.image(pixels):save("bitmap_small.tga")
|
||||||
|
|
||||||
|
-- change a single pixel, then rescale the bitmap
|
||||||
|
local pixels_orig = pixels
|
||||||
|
pixels_orig[4][4] = { 255, 255, 255 }
|
||||||
|
local pixels = {}
|
||||||
|
for x = 1,56,1 do
|
||||||
|
local x_orig = math.ceil(x/8)
|
||||||
|
for z = 1,56,1 do
|
||||||
|
local z_orig = math.ceil(z/8)
|
||||||
|
local color = pixels_orig[z_orig][x_orig]
|
||||||
|
pixels[z] = pixels[z] or {}
|
||||||
|
pixels[z][x] = color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
tga_encoder.image(pixels):save("bitmap_large.tga")
|
||||||
|
|
||||||
|
-- note that the uncompressed grayscale TGA file written in this
|
||||||
|
-- example is 80 bytes – but an optimized PNG file is 81 bytes …
|
||||||
|
local pixels = {}
|
||||||
|
for x = 1,6,1 do -- left to right
|
||||||
|
for z = 1,6,1 do -- bottom to top
|
||||||
|
local color = { math.min(x * z * 4 - 1, 255) }
|
||||||
|
pixels[z] = pixels[z] or {}
|
||||||
|
pixels[z][x] = color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
tga_encoder.image(pixels):save("gradient_8bpp_raw.tga", {color_format="Y8", compression="RAW"})
|
||||||
|
|
||||||
|
local pixels = {}
|
||||||
|
for x = 1,16,1 do -- left to right
|
||||||
|
for z = 1,16,1 do -- bottom to top
|
||||||
|
local r = math.min(x * 32 - 1, 255)
|
||||||
|
local g = math.min(z * 32 - 1, 255)
|
||||||
|
local b = 0
|
||||||
|
-- blue rectangle in top right corner
|
||||||
|
if x > 8 and z > 8 then
|
||||||
|
r = 0
|
||||||
|
g = 0
|
||||||
|
b = math.min(z * 16 - 1, 255)
|
||||||
|
end
|
||||||
|
local color = { r, g, b }
|
||||||
|
pixels[z] = pixels[z] or {}
|
||||||
|
pixels[z][x] = color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local gradients = tga_encoder.image(pixels)
|
||||||
|
gradients:save("gradients_8bpp_raw.tga", {color_format="Y8", compression="RAW"})
|
||||||
|
gradients:save("gradients_16bpp_raw.tga", {color_format="A1R5G5B5", compression="RAW"})
|
||||||
|
gradients:save("gradients_16bpp_rle.tga", {color_format="A1R5G5B5", compression="RLE"})
|
||||||
|
gradients:save("gradients_24bpp_raw.tga", {color_format="B8G8R8", compression="RAW"})
|
||||||
|
gradients:save("gradients_24bpp_rle.tga", {color_format="B8G8R8", compression="RLE"})
|
||||||
|
|
||||||
|
for x = 1,16,1 do -- left to right
|
||||||
|
for z = 1,16,1 do -- bottom to top
|
||||||
|
local color = pixels[z][x]
|
||||||
|
color[#color+1] = ((x * x) + (z * z)) % 256
|
||||||
|
pixels[z][x] = color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
gradients:save("gradients_32bpp_raw.tga", {color_format="B8G8R8A8", compression="RAW"})
|
||||||
|
-- the RLE-compressed file is larger than just dumping pixels because
|
||||||
|
-- the gradients in this picture can not be compressed well using RLE
|
||||||
|
gradients:save("gradients_32bpp_rle.tga", {color_format="B8G8R8A8", compression="RLE"})
|
||||||
|
|
||||||
|
local pixels = {}
|
||||||
|
for x = 1,512,1 do -- left to right
|
||||||
|
for z = 1,512,1 do -- bottom to top
|
||||||
|
local oz = (z - 256) / 256 + 0.75
|
||||||
|
local ox = (x - 256) / 256
|
||||||
|
local px, pz, i = 0, 0, 0
|
||||||
|
while (px * px) + (pz * pz) <= 4 and i < 128 do
|
||||||
|
px = (px * px) - (pz * pz) + oz
|
||||||
|
pz = (2 * px * pz) + ox
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
local color = {
|
||||||
|
math.max(0, math.min(255, math.floor(px * 64))),
|
||||||
|
math.max(0, math.min(255, math.floor(pz * 64))),
|
||||||
|
math.max(0, math.min(255, math.floor(i))),
|
||||||
|
}
|
||||||
|
pixels[z] = pixels[z] or {}
|
||||||
|
pixels[z][x] = color
|
||||||
|
end
|
||||||
|
end
|
||||||
|
tga_encoder.image(pixels):save("fractal_8bpp.tga", {color_format="Y8"})
|
||||||
|
tga_encoder.image(pixels):save("fractal_16bpp.tga", {color_format="A1R5G5B5"})
|
||||||
|
tga_encoder.image(pixels):save("fractal_24bpp.tga", {color_format="B8G8R8"})
|
||||||
|
|
||||||
|
-- encode a colormapped bitmap
|
||||||
|
local K = { 0 }
|
||||||
|
local B = { 1 }
|
||||||
|
local R = { 2 }
|
||||||
|
local G = { 3 }
|
||||||
|
local W = { 4 }
|
||||||
|
local colormap = {
|
||||||
|
{ 1, 2, 3 }, -- K
|
||||||
|
{ 0, 0, 255 }, -- B
|
||||||
|
{ 255, 0, 0 }, -- R
|
||||||
|
{ 0, 255, 0 }, -- G
|
||||||
|
{ 253, 254, 255 }, -- W
|
||||||
|
}
|
||||||
|
local pixels = {
|
||||||
|
{ W, K, W, K, W, K, W },
|
||||||
|
{ R, G, B, R, G, B, K },
|
||||||
|
{ K, W, K, W, K, W, K },
|
||||||
|
{ G, B, R, G, B, R, W },
|
||||||
|
{ W, W, W, K, K, K, W },
|
||||||
|
{ B, R, G, B, R, G, K },
|
||||||
|
{ B, R, G, B, R, G, W },
|
||||||
|
}
|
||||||
|
-- note that the uncompressed colormapped TGA file written in this
|
||||||
|
-- example is 108 bytes – but an optimized PNG file is 121 bytes …
|
||||||
|
tga_encoder.image(pixels):save("colormapped_B8G8R8.tga", {colormap=colormap})
|
||||||
|
-- encoding as A1R5G5B5 saves 1 byte per palette entry → 103 bytes
|
||||||
|
tga_encoder.image(pixels):save("colormapped_A1R5G5B5.tga", {colormap=colormap, color_format="A1R5G5B5"})
|
||||||
|
|
||||||
|
-- encode a colormapped bitmap with transparency
|
||||||
|
local _ = { 0 }
|
||||||
|
local K = { 1 }
|
||||||
|
local W = { 2 }
|
||||||
|
local colormap = {
|
||||||
|
{ 0, 0, 0, 0 },
|
||||||
|
{ 0, 0, 0, 255 },
|
||||||
|
{ 255, 255, 255, 255 },
|
||||||
|
}
|
||||||
|
local pixels = {
|
||||||
|
{ _, K, K, K, K, K, _ },
|
||||||
|
{ _, K, W, W, W, K, _ },
|
||||||
|
{ K, K, W, W, W, K, K },
|
||||||
|
{ K, W, W, W, W, W, K },
|
||||||
|
{ _, K, W, W, W, K, _ },
|
||||||
|
{ _, _, K, W, K, _, _ },
|
||||||
|
{ _, _, _, K, _, _, _ },
|
||||||
|
}
|
||||||
|
tga_encoder.image(pixels):save("colormapped_B8G8R8A8.tga", {colormap=colormap})
|
|
@ -0,0 +1,594 @@
|
||||||
|
tga_encoder = {}
|
||||||
|
|
||||||
|
local image = setmetatable({}, {
|
||||||
|
__call = function(self, ...)
|
||||||
|
local t = setmetatable({}, {__index = self})
|
||||||
|
t:constructor(...)
|
||||||
|
return t
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
function image:constructor(pixels)
|
||||||
|
self.pixels = pixels
|
||||||
|
self.width = #pixels[1]
|
||||||
|
self.height = #pixels
|
||||||
|
end
|
||||||
|
|
||||||
|
local pixel_depth_by_color_format = {
|
||||||
|
["Y8"] = 8,
|
||||||
|
["A1R5G5B5"] = 16,
|
||||||
|
["B8G8R8"] = 24,
|
||||||
|
["B8G8R8A8"] = 32,
|
||||||
|
}
|
||||||
|
|
||||||
|
function image:encode_colormap_spec(properties)
|
||||||
|
local colormap = properties.colormap
|
||||||
|
local colormap_pixel_depth = 0
|
||||||
|
if 0 ~= #colormap then
|
||||||
|
colormap_pixel_depth = pixel_depth_by_color_format[
|
||||||
|
properties.color_format
|
||||||
|
]
|
||||||
|
end
|
||||||
|
local colormap_spec =
|
||||||
|
string.char(0, 0) .. -- first entry index
|
||||||
|
string.char(#colormap % 256, math.floor(#colormap / 256)) .. -- number of entries
|
||||||
|
string.char(colormap_pixel_depth) -- bits per pixel
|
||||||
|
self.data = self.data .. colormap_spec
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_image_spec(properties)
|
||||||
|
local color_format = properties.color_format
|
||||||
|
assert(
|
||||||
|
"Y8" == color_format or -- (8 bit grayscale = 1 byte = 8 bits)
|
||||||
|
"A1R5G5B5" == color_format or -- (A1R5G5B5 = 2 bytes = 16 bits)
|
||||||
|
"B8G8R8" == color_format or -- (B8G8R8 = 3 bytes = 24 bits)
|
||||||
|
"B8G8R8A8" == color_format -- (B8G8R8A8 = 4 bytes = 32 bits)
|
||||||
|
)
|
||||||
|
local pixel_depth
|
||||||
|
if 0 ~= #properties.colormap then
|
||||||
|
pixel_depth = self.pixel_depth
|
||||||
|
else
|
||||||
|
pixel_depth = pixel_depth_by_color_format[color_format]
|
||||||
|
end
|
||||||
|
assert( nil ~= pixel_depth)
|
||||||
|
self.data = self.data
|
||||||
|
.. string.char(0, 0) -- X-origin
|
||||||
|
.. string.char(0, 0) -- Y-origin
|
||||||
|
.. string.char(self.width % 256, math.floor(self.width / 256)) -- width
|
||||||
|
.. string.char(self.height % 256, math.floor(self.height / 256)) -- height
|
||||||
|
.. string.char(pixel_depth)
|
||||||
|
.. string.char(0) -- image descriptor
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_colormap(properties)
|
||||||
|
local colormap = properties.colormap
|
||||||
|
if 0 == #colormap then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local color_format = properties.color_format
|
||||||
|
assert (
|
||||||
|
"A1R5G5B5" == color_format or
|
||||||
|
"B8G8R8" == color_format or
|
||||||
|
"B8G8R8A8" == color_format
|
||||||
|
)
|
||||||
|
local colors = {}
|
||||||
|
if "A1R5G5B5" == color_format then
|
||||||
|
-- Sample depth rescaling is done according to the algorithm presented in:
|
||||||
|
-- <https://www.w3.org/TR/2003/REC-PNG-20031110/#13Sample-depth-rescaling>
|
||||||
|
local max_sample_in = math.pow(2, 8) - 1
|
||||||
|
local max_sample_out = math.pow(2, 5) - 1
|
||||||
|
for i = 1,#colormap,1 do
|
||||||
|
local color = colormap[i]
|
||||||
|
local colorword = 32768 +
|
||||||
|
((math.floor((color[1] * max_sample_out / max_sample_in) + 0.5)) * 1024) +
|
||||||
|
((math.floor((color[2] * max_sample_out / max_sample_in) + 0.5)) * 32) +
|
||||||
|
((math.floor((color[3] * max_sample_out / max_sample_in) + 0.5)) * 1)
|
||||||
|
local color_bytes = string.char(
|
||||||
|
colorword % 256,
|
||||||
|
math.floor(colorword / 256)
|
||||||
|
)
|
||||||
|
colors[#colors + 1] = color_bytes
|
||||||
|
end
|
||||||
|
elseif "B8G8R8" == color_format then
|
||||||
|
for i = 1,#colormap,1 do
|
||||||
|
local color = colormap[i]
|
||||||
|
local color_bytes = string.char(
|
||||||
|
color[3], -- B
|
||||||
|
color[2], -- G
|
||||||
|
color[1] -- R
|
||||||
|
)
|
||||||
|
colors[#colors + 1] = color_bytes
|
||||||
|
end
|
||||||
|
elseif "B8G8R8A8" == color_format then
|
||||||
|
for i = 1,#colormap,1 do
|
||||||
|
local color = colormap[i]
|
||||||
|
local color_bytes = string.char(
|
||||||
|
color[3], -- B
|
||||||
|
color[2], -- G
|
||||||
|
color[1], -- R
|
||||||
|
color[4] -- A
|
||||||
|
)
|
||||||
|
colors[#colors + 1] = color_bytes
|
||||||
|
end
|
||||||
|
end
|
||||||
|
assert( 0 ~= #colors )
|
||||||
|
self.data = self.data .. table.concat(colors)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_header(properties)
|
||||||
|
local color_format = properties.color_format
|
||||||
|
local colormap = properties.colormap
|
||||||
|
local compression = properties.compression
|
||||||
|
local colormap_type
|
||||||
|
local image_type
|
||||||
|
if "Y8" == color_format and "RAW" == compression then
|
||||||
|
colormap_type = 0
|
||||||
|
image_type = 3 -- grayscale
|
||||||
|
elseif (
|
||||||
|
"A1R5G5B5" == color_format or
|
||||||
|
"B8G8R8" == color_format or
|
||||||
|
"B8G8R8A8" == color_format
|
||||||
|
) then
|
||||||
|
if "RAW" == compression then
|
||||||
|
if 0 ~= #colormap then
|
||||||
|
colormap_type = 1
|
||||||
|
image_type = 1 -- colormapped RGB(A)
|
||||||
|
else
|
||||||
|
colormap_type = 0
|
||||||
|
image_type = 2 -- RAW RGB(A)
|
||||||
|
end
|
||||||
|
elseif "RLE" == compression then
|
||||||
|
colormap_type = 0
|
||||||
|
image_type = 10 -- RLE RGB
|
||||||
|
end
|
||||||
|
end
|
||||||
|
assert( nil ~= colormap_type )
|
||||||
|
assert( nil ~= image_type )
|
||||||
|
self.data = self.data
|
||||||
|
.. string.char(0) -- image id
|
||||||
|
.. string.char(colormap_type)
|
||||||
|
.. string.char(image_type)
|
||||||
|
self:encode_colormap_spec(properties) -- color map specification
|
||||||
|
self:encode_image_spec(properties) -- image specification
|
||||||
|
self:encode_colormap(properties)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data(properties)
|
||||||
|
local color_format = properties.color_format
|
||||||
|
local colormap = properties.colormap
|
||||||
|
local compression = properties.compression
|
||||||
|
|
||||||
|
local data_length_before = #self.data
|
||||||
|
if "Y8" == color_format and "RAW" == compression then
|
||||||
|
if 8 == self.pixel_depth then
|
||||||
|
self:encode_data_Y8_as_Y8_raw()
|
||||||
|
elseif 24 == self.pixel_depth then
|
||||||
|
self:encode_data_R8G8B8_as_Y8_raw()
|
||||||
|
end
|
||||||
|
elseif "A1R5G5B5" == color_format then
|
||||||
|
if 0 ~= #colormap then
|
||||||
|
if "RAW" == compression then
|
||||||
|
if 8 == self.pixel_depth then
|
||||||
|
self:encode_data_Y8_as_Y8_raw()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if "RAW" == compression then
|
||||||
|
self:encode_data_R8G8B8_as_A1R5G5B5_raw()
|
||||||
|
elseif "RLE" == compression then
|
||||||
|
self:encode_data_R8G8B8_as_A1R5G5B5_rle()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif "B8G8R8" == color_format then
|
||||||
|
if 0 ~= #colormap then
|
||||||
|
if "RAW" == compression then
|
||||||
|
if 8 == self.pixel_depth then
|
||||||
|
self:encode_data_Y8_as_Y8_raw()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if "RAW" == compression then
|
||||||
|
self:encode_data_R8G8B8_as_B8G8R8_raw()
|
||||||
|
elseif "RLE" == compression then
|
||||||
|
self:encode_data_R8G8B8_as_B8G8R8_rle()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif "B8G8R8A8" == color_format then
|
||||||
|
if 0 ~= #colormap then
|
||||||
|
if "RAW" == compression then
|
||||||
|
if 8 == self.pixel_depth then
|
||||||
|
self:encode_data_Y8_as_Y8_raw()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if "RAW" == compression then
|
||||||
|
self:encode_data_R8G8B8A8_as_B8G8R8A8_raw()
|
||||||
|
elseif "RLE" == compression then
|
||||||
|
self:encode_data_R8G8B8A8_as_B8G8R8A8_rle()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local data_length_after = #self.data
|
||||||
|
assert(
|
||||||
|
data_length_after ~= data_length_before,
|
||||||
|
"No data encoded for color format: " .. color_format
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_Y8_as_Y8_raw()
|
||||||
|
assert(8 == self.pixel_depth)
|
||||||
|
local raw_pixels = {}
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
local raw_pixel = string.char(pixel[1])
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(raw_pixels)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8_as_Y8_raw()
|
||||||
|
assert(24 == self.pixel_depth)
|
||||||
|
local raw_pixels = {}
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
-- the HSP RGB to brightness formula is
|
||||||
|
-- sqrt( 0.299 r² + .587 g² + .114 b² )
|
||||||
|
-- see <https://alienryderflex.com/hsp.html>
|
||||||
|
local gray = math.floor(
|
||||||
|
math.sqrt(
|
||||||
|
0.299 * pixel[1]^2 +
|
||||||
|
0.587 * pixel[2]^2 +
|
||||||
|
0.114 * pixel[3]^2
|
||||||
|
) + 0.5
|
||||||
|
)
|
||||||
|
local raw_pixel = string.char(gray)
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(raw_pixels)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8_as_A1R5G5B5_raw()
|
||||||
|
assert(24 == self.pixel_depth)
|
||||||
|
local raw_pixels = {}
|
||||||
|
-- Sample depth rescaling is done according to the algorithm presented in:
|
||||||
|
-- <https://www.w3.org/TR/2003/REC-PNG-20031110/#13Sample-depth-rescaling>
|
||||||
|
local max_sample_in = math.pow(2, 8) - 1
|
||||||
|
local max_sample_out = math.pow(2, 5) - 1
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
local colorword = 32768 +
|
||||||
|
((math.floor((pixel[1] * max_sample_out / max_sample_in) + 0.5)) * 1024) +
|
||||||
|
((math.floor((pixel[2] * max_sample_out / max_sample_in) + 0.5)) * 32) +
|
||||||
|
((math.floor((pixel[3] * max_sample_out / max_sample_in) + 0.5)) * 1)
|
||||||
|
local raw_pixel = string.char(colorword % 256, math.floor(colorword / 256))
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(raw_pixels)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8_as_A1R5G5B5_rle()
|
||||||
|
assert(24 == self.pixel_depth)
|
||||||
|
local colorword = nil
|
||||||
|
local previous_r = nil
|
||||||
|
local previous_g = nil
|
||||||
|
local previous_b = nil
|
||||||
|
local raw_pixel = ''
|
||||||
|
local raw_pixels = {}
|
||||||
|
local count = 1
|
||||||
|
local packets = {}
|
||||||
|
local raw_packet = ''
|
||||||
|
local rle_packet = ''
|
||||||
|
-- Sample depth rescaling is done according to the algorithm presented in:
|
||||||
|
-- <https://www.w3.org/TR/2003/REC-PNG-20031110/#13Sample-depth-rescaling>
|
||||||
|
local max_sample_in = math.pow(2, 8) - 1
|
||||||
|
local max_sample_out = math.pow(2, 5) - 1
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
if pixel[1] ~= previous_r or pixel[2] ~= previous_g or pixel[3] ~= previous_b or count == 128 then
|
||||||
|
if nil ~= previous_r then
|
||||||
|
colorword = 32768 +
|
||||||
|
((math.floor((previous_r * max_sample_out / max_sample_in) + 0.5)) * 1024) +
|
||||||
|
((math.floor((previous_g * max_sample_out / max_sample_in) + 0.5)) * 32) +
|
||||||
|
((math.floor((previous_b * max_sample_out / max_sample_in) + 0.5)) * 1)
|
||||||
|
if 1 == count then
|
||||||
|
-- remember pixel verbatim for raw encoding
|
||||||
|
raw_pixel = string.char(colorword % 256, math.floor(colorword / 256))
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
if 128 == #raw_pixels then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- encode raw pixels, if any
|
||||||
|
if #raw_pixels > 0 then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
-- RLE encoding
|
||||||
|
rle_packet = string.char(128 + count - 1, colorword % 256, math.floor(colorword / 256))
|
||||||
|
packets[#packets +1] = rle_packet
|
||||||
|
end
|
||||||
|
end
|
||||||
|
count = 1
|
||||||
|
previous_r = pixel[1]
|
||||||
|
previous_g = pixel[2]
|
||||||
|
previous_b = pixel[3]
|
||||||
|
else
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
colorword = 32768 +
|
||||||
|
((math.floor((previous_r * max_sample_out / max_sample_in) + 0.5)) * 1024) +
|
||||||
|
((math.floor((previous_g * max_sample_out / max_sample_in) + 0.5)) * 32) +
|
||||||
|
((math.floor((previous_b * max_sample_out / max_sample_in) + 0.5)) * 1)
|
||||||
|
if 1 == count then
|
||||||
|
raw_pixel = string.char(colorword % 256, math.floor(colorword / 256))
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
else
|
||||||
|
-- encode raw pixels, if any
|
||||||
|
if #raw_pixels > 0 then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
-- RLE encoding
|
||||||
|
rle_packet = string.char(128 + count - 1, colorword % 256, math.floor(colorword / 256))
|
||||||
|
packets[#packets +1] = rle_packet
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(packets)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8_as_B8G8R8_raw()
|
||||||
|
assert(24 == self.pixel_depth)
|
||||||
|
local raw_pixels = {}
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
local raw_pixel = string.char(pixel[3], pixel[2], pixel[1])
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(raw_pixels)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8_as_B8G8R8_rle()
|
||||||
|
assert(24 == self.pixel_depth)
|
||||||
|
local previous_r = nil
|
||||||
|
local previous_g = nil
|
||||||
|
local previous_b = nil
|
||||||
|
local raw_pixel = ''
|
||||||
|
local raw_pixels = {}
|
||||||
|
local count = 1
|
||||||
|
local packets = {}
|
||||||
|
local raw_packet = ''
|
||||||
|
local rle_packet = ''
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
if pixel[1] ~= previous_r or pixel[2] ~= previous_g or pixel[3] ~= previous_b or count == 128 then
|
||||||
|
if nil ~= previous_r then
|
||||||
|
if 1 == count then
|
||||||
|
-- remember pixel verbatim for raw encoding
|
||||||
|
raw_pixel = string.char(previous_b, previous_g, previous_r)
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
if 128 == #raw_pixels then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- encode raw pixels, if any
|
||||||
|
if #raw_pixels > 0 then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
-- RLE encoding
|
||||||
|
rle_packet = string.char(128 + count - 1, previous_b, previous_g, previous_r)
|
||||||
|
packets[#packets +1] = rle_packet
|
||||||
|
end
|
||||||
|
end
|
||||||
|
count = 1
|
||||||
|
previous_r = pixel[1]
|
||||||
|
previous_g = pixel[2]
|
||||||
|
previous_b = pixel[3]
|
||||||
|
else
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if 1 == count then
|
||||||
|
raw_pixel = string.char(previous_b, previous_g, previous_r)
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
else
|
||||||
|
-- encode raw pixels, if any
|
||||||
|
if #raw_pixels > 0 then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
-- RLE encoding
|
||||||
|
rle_packet = string.char(128 + count - 1, previous_b, previous_g, previous_r)
|
||||||
|
packets[#packets +1] = rle_packet
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(packets)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8A8_as_B8G8R8A8_raw()
|
||||||
|
assert(32 == self.pixel_depth)
|
||||||
|
local raw_pixels = {}
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
local raw_pixel = string.char(pixel[3], pixel[2], pixel[1], pixel[4])
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(raw_pixels)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_data_R8G8B8A8_as_B8G8R8A8_rle()
|
||||||
|
assert(32 == self.pixel_depth)
|
||||||
|
local previous_r = nil
|
||||||
|
local previous_g = nil
|
||||||
|
local previous_b = nil
|
||||||
|
local previous_a = nil
|
||||||
|
local raw_pixel = ''
|
||||||
|
local raw_pixels = {}
|
||||||
|
local count = 1
|
||||||
|
local packets = {}
|
||||||
|
local raw_packet = ''
|
||||||
|
local rle_packet = ''
|
||||||
|
for _, row in ipairs(self.pixels) do
|
||||||
|
for _, pixel in ipairs(row) do
|
||||||
|
if pixel[1] ~= previous_r or pixel[2] ~= previous_g or pixel[3] ~= previous_b or pixel[4] ~= previous_a or count == 128 then
|
||||||
|
if nil ~= previous_r then
|
||||||
|
if 1 == count then
|
||||||
|
-- remember pixel verbatim for raw encoding
|
||||||
|
raw_pixel = string.char(previous_b, previous_g, previous_r, previous_a)
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
if 128 == #raw_pixels then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- encode raw pixels, if any
|
||||||
|
if #raw_pixels > 0 then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
-- RLE encoding
|
||||||
|
rle_packet = string.char(128 + count - 1, previous_b, previous_g, previous_r, previous_a)
|
||||||
|
packets[#packets +1] = rle_packet
|
||||||
|
end
|
||||||
|
end
|
||||||
|
count = 1
|
||||||
|
previous_r = pixel[1]
|
||||||
|
previous_g = pixel[2]
|
||||||
|
previous_b = pixel[3]
|
||||||
|
previous_a = pixel[4]
|
||||||
|
else
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if 1 == count then
|
||||||
|
raw_pixel = string.char(previous_b, previous_g, previous_r, previous_a)
|
||||||
|
raw_pixels[#raw_pixels + 1] = raw_pixel
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
else
|
||||||
|
-- encode raw pixels, if any
|
||||||
|
if #raw_pixels > 0 then
|
||||||
|
raw_packet = string.char(#raw_pixels - 1)
|
||||||
|
packets[#packets + 1] = raw_packet
|
||||||
|
for i=1, #raw_pixels do
|
||||||
|
packets[#packets +1] = raw_pixels[i]
|
||||||
|
end
|
||||||
|
raw_pixels = {}
|
||||||
|
end
|
||||||
|
-- RLE encoding
|
||||||
|
rle_packet = string.char(128 + count - 1, previous_b, previous_g, previous_r, previous_a)
|
||||||
|
packets[#packets +1] = rle_packet
|
||||||
|
end
|
||||||
|
self.data = self.data .. table.concat(packets)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode_footer()
|
||||||
|
self.data = self.data
|
||||||
|
.. string.char(0, 0, 0, 0) -- extension area offset
|
||||||
|
.. string.char(0, 0, 0, 0) -- developer area offset
|
||||||
|
.. "TRUEVISION-XFILE"
|
||||||
|
.. "."
|
||||||
|
.. string.char(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:encode(properties)
|
||||||
|
self.data = ""
|
||||||
|
self:encode_header(properties) -- header
|
||||||
|
-- no color map and image id data
|
||||||
|
self:encode_data(properties) -- encode data
|
||||||
|
-- no extension or developer area
|
||||||
|
self:encode_footer() -- footer
|
||||||
|
end
|
||||||
|
|
||||||
|
function image:save(filename, properties)
|
||||||
|
local properties = properties or {}
|
||||||
|
properties.colormap = properties.colormap or {}
|
||||||
|
properties.compression = properties.compression or "RAW"
|
||||||
|
|
||||||
|
self.pixel_depth = #self.pixels[1][1] * 8
|
||||||
|
|
||||||
|
local color_format_defaults_by_pixel_depth = {
|
||||||
|
[8] = "Y8",
|
||||||
|
[24] = "B8G8R8",
|
||||||
|
[32] = "B8G8R8A8",
|
||||||
|
}
|
||||||
|
if nil == properties.color_format then
|
||||||
|
if 0 ~= #properties.colormap then
|
||||||
|
properties.color_format =
|
||||||
|
color_format_defaults_by_pixel_depth[
|
||||||
|
#properties.colormap[1] * 8
|
||||||
|
]
|
||||||
|
else
|
||||||
|
properties.color_format =
|
||||||
|
color_format_defaults_by_pixel_depth[
|
||||||
|
self.pixel_depth
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
assert( nil ~= properties.color_format )
|
||||||
|
|
||||||
|
self:encode(properties)
|
||||||
|
|
||||||
|
local f = assert(io.open(filename, "wb"))
|
||||||
|
f:write(self.data)
|
||||||
|
f:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
tga_encoder.image = image
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = tga_encoder
|
||||||
|
description = A TGA Encoder written in Lua without the use of external Libraries.
|
|
@ -30,26 +30,26 @@ local S = minetest.get_translator("extra_mobs")
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
local cod = {
|
local cod = {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "water",
|
spawn_class = "water",
|
||||||
can_despawn = true,
|
can_despawn = true,
|
||||||
passive = true,
|
passive = true,
|
||||||
hp_min = 3,
|
hp_min = 3,
|
||||||
hp_max = 3,
|
hp_max = 3,
|
||||||
xp_min = 1,
|
xp_min = 1,
|
||||||
xp_max = 3,
|
xp_max = 3,
|
||||||
armor = 100,
|
armor = 100,
|
||||||
rotate = 270,
|
rotate = 270,
|
||||||
tilt_swim = true,
|
tilt_swim = true,
|
||||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 0.79, 0.3},
|
collisionbox = {-0.3, 0.0, -0.3, 0.3, 0.79, 0.3},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "extra_mobs_cod.b3d",
|
mesh = "extra_mobs_cod.b3d",
|
||||||
textures = {
|
textures = {
|
||||||
{"extra_mobs_cod.png"}
|
{"extra_mobs_cod.png"}
|
||||||
},
|
},
|
||||||
sounds = {
|
sounds = {
|
||||||
},
|
},
|
||||||
animation = {
|
animation = {
|
||||||
stand_start = 1,
|
stand_start = 1,
|
||||||
stand_end = 20,
|
stand_end = 20,
|
||||||
walk_start = 1,
|
walk_start = 1,
|
||||||
|
@ -57,45 +57,52 @@ local cod = {
|
||||||
run_start = 1,
|
run_start = 1,
|
||||||
run_end = 20,
|
run_end = 20,
|
||||||
},
|
},
|
||||||
drops = {
|
drops = {
|
||||||
{name = "mcl_fishing:fish_raw",
|
{name = "mcl_fishing:fish_raw",
|
||||||
chance = 1,
|
chance = 1,
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,},
|
max = 1,},
|
||||||
{name = "mcl_dye:white",
|
{name = "mcl_dye:white",
|
||||||
chance = 20,
|
chance = 20,
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,},
|
max = 1,},
|
||||||
},
|
},
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
makes_footstep_sound = false,
|
makes_footstep_sound = false,
|
||||||
swim = true,
|
swim = true,
|
||||||
breathes_in_water = true,
|
breathes_in_water = true,
|
||||||
jump = false,
|
jump = false,
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
runaway = true,
|
runaway = true,
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
self.object:set_bone_position("body", vector.new(0,1,0), vector.new(degrees(dir_to_pitch(self.object:get_velocity())) * -1 + 90,0,0))
|
self.object:set_bone_position("body", vector.new(0,1,0), vector.new(degrees(dir_to_pitch(self.object:get_velocity())) * -1 + 90,0,0))
|
||||||
if minetest.get_item_group(self.standing_in, "water") ~= 0 then
|
if minetest.get_item_group(self.standing_in, "water") ~= 0 then
|
||||||
if self.object:get_velocity().y < 2.5 then
|
if self.object:get_velocity().y < 2.5 then
|
||||||
self.object:add_velocity({ x = 0 , y = math.random(-.002, .002) , z = 0 })
|
self.object:add_velocity({ x = 0 , y = math.random(-.002, .002) , z = 0 })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _,object in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 10)) do
|
for _,object in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 10)) do
|
||||||
local lp = object:get_pos()
|
local lp = object:get_pos()
|
||||||
local s = self.object:get_pos()
|
local s = self.object:get_pos()
|
||||||
local vec = {
|
local vec = {
|
||||||
x = lp.x - s.x,
|
x = lp.x - s.x,
|
||||||
y = lp.y - s.y,
|
y = lp.y - s.y,
|
||||||
z = lp.z - s.z
|
z = lp.z - s.z
|
||||||
}
|
}
|
||||||
if object and not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "extra_mobs:cod" then
|
if object and not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "extra_mobs:cod" then
|
||||||
self.state = "runaway"
|
self.state = "runaway"
|
||||||
self.object:set_rotation({x=0,y=(atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate,z=0})
|
self.object:set_rotation({x=0,y=(atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate,z=0})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end,
|
||||||
|
on_rightclick = function(self, clicker)
|
||||||
|
if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then
|
||||||
|
self.object:remove()
|
||||||
|
clicker:set_wielded_item("mcl_fishing:bucket_cod")
|
||||||
|
awards.unlock(clicker:get_player_name(), "mcl:tacticalFishing")
|
||||||
|
end
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("extra_mobs:cod", cod)
|
mobs:register_mob("extra_mobs:cod", cod)
|
||||||
|
|
|
@ -21,9 +21,11 @@ local S = minetest.get_translator("extra_mobs")
|
||||||
local followitem = "mcl_farming:sweet_berry"
|
local followitem = "mcl_farming:sweet_berry"
|
||||||
|
|
||||||
local fox = {
|
local fox = {
|
||||||
type = "monster",
|
type = "animal",
|
||||||
passive = false,
|
passive = false,
|
||||||
spawn_class = "hostile",
|
spawn_class = "hostile",
|
||||||
|
skittish = true,
|
||||||
|
runaway = true,
|
||||||
hp_min = 10,
|
hp_min = 10,
|
||||||
hp_max = 10,
|
hp_max = 10,
|
||||||
xp_min = 1,
|
xp_min = 1,
|
||||||
|
@ -32,9 +34,20 @@ local fox = {
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
damage = 2,
|
damage = 2,
|
||||||
reach = 1.5,
|
reach = 1.5,
|
||||||
|
jump = true,
|
||||||
|
makes_footstep_sound = true,
|
||||||
|
walk_velocity = 3,
|
||||||
|
run_velocity = 6,
|
||||||
|
follow_velocity = 2,
|
||||||
|
follow = followitem,
|
||||||
|
pathfinding = 1,
|
||||||
|
fear_height = 4,
|
||||||
|
view_range = 16,
|
||||||
collisionbox = {-0.3, -0.01, -0.3, 0.3, 0.84, 0.3},
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 0.84, 0.3},
|
||||||
|
specific_attack = { "mobs_mc:chicken", "extra_mobs:cod", "extra_mobs:salmon" },
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "extra_mobs_fox.b3d",
|
mesh = "extra_mobs_fox.b3d",
|
||||||
|
rotate = 270,
|
||||||
textures = { {
|
textures = { {
|
||||||
"extra_mobs_fox.png",
|
"extra_mobs_fox.png",
|
||||||
"extra_mobs_trans.png",
|
"extra_mobs_trans.png",
|
||||||
|
@ -42,10 +55,6 @@ local fox = {
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
sounds = {
|
sounds = {
|
||||||
},
|
},
|
||||||
jump = true,
|
|
||||||
makes_footstep_sound = true,
|
|
||||||
walk_velocity = 3,
|
|
||||||
run_velocity = 6,
|
|
||||||
drops = {
|
drops = {
|
||||||
},
|
},
|
||||||
animation = {
|
animation = {
|
||||||
|
@ -63,9 +72,9 @@ local fox = {
|
||||||
lay_start = 34,
|
lay_start = 34,
|
||||||
lay_end = 34,
|
lay_end = 34,
|
||||||
},
|
},
|
||||||
runaway = true,
|
|
||||||
on_spawn = function(self)
|
on_spawn = function(self)
|
||||||
if minetest.find_node_near(self.object:get_pos(), 4, "mcl_core:snow") ~= nil or minetest.find_node_near(self.object:get_pos(), 4, "mcl_core:dirt_with_grass_snow") ~= nil then
|
if minetest.find_node_near(self.object:get_pos(), 4, "mcl_core:snow") ~= nil
|
||||||
|
or minetest.find_node_near(self.object:get_pos(), 4, "mcl_core:dirt_with_grass_snow") ~= nil then
|
||||||
self.object:set_properties({textures={"extra_mobs_artic_fox.png", "extra_mobs_trans.png"}})
|
self.object:set_properties({textures={"extra_mobs_artic_fox.png", "extra_mobs_trans.png"}})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -83,7 +92,11 @@ local fox = {
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
for _,object in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 8)) do
|
for _,object in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 8)) do
|
||||||
if object and not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "extra_mobs:fox" and self.state ~= "attack" and math.random(1, 500) == 1 then
|
if object
|
||||||
|
and not object:is_player()
|
||||||
|
and object:get_luaentity()
|
||||||
|
and object:get_luaentity().name == "extra_mobs:fox"
|
||||||
|
and self.state ~= "attack" and math.random(1, 500) == 1 then
|
||||||
self.horny = true
|
self.horny = true
|
||||||
end
|
end
|
||||||
local lp = object:get_pos()
|
local lp = object:get_pos()
|
||||||
|
@ -93,15 +106,30 @@ local fox = {
|
||||||
y = lp.y - s.y,
|
y = lp.y - s.y,
|
||||||
z = lp.z - s.z
|
z = lp.z - s.z
|
||||||
}
|
}
|
||||||
if object and object:is_player() and not object:get_player_control().sneak or not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "mobs_mc:wolf" then
|
-- scare logic
|
||||||
self.state = "runaway"
|
if (object
|
||||||
self.object:set_rotation({x=0,y=(atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate,z=0})
|
and object:is_player()
|
||||||
if self.reach > vector.distance(self.object:get_pos(), object:get_pos()) and self.timer > .9 then
|
and not object:get_player_control().sneak)
|
||||||
self.timer = 0
|
or (not object:is_player()
|
||||||
object:punch(self.object, 1.0, {
|
and object:get_luaentity()
|
||||||
full_punch_interval = 1.0,
|
and object:get_luaentity().name == "mobs_mc:wolf") then
|
||||||
damage_groups = {fleshy = self.damage}
|
-- don't keep setting it once it's set
|
||||||
}, nil)
|
if not self.state == "runaway" then
|
||||||
|
self.state = "runaway"
|
||||||
|
self.object:set_rotation({x=0,y=(atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate,z=0})
|
||||||
|
end
|
||||||
|
-- if it is within a distance of the player or wolf
|
||||||
|
if 6 > vector.distance(self.object:get_pos(), object:get_pos()) then
|
||||||
|
self.timer = self.timer + 1
|
||||||
|
-- have some time before getting scared
|
||||||
|
if self.timer > 6 then
|
||||||
|
self.timer = 0
|
||||||
|
-- punch the fox for the player, but don't do any damage
|
||||||
|
self.object:punch(object, 0, {
|
||||||
|
full_punch_interval = 0,
|
||||||
|
damage_groups = {fleshy = 0}
|
||||||
|
}, nil)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -109,10 +137,6 @@ local fox = {
|
||||||
do_punch = function(self)
|
do_punch = function(self)
|
||||||
self.state = "runaway"
|
self.state = "runaway"
|
||||||
end,
|
end,
|
||||||
follow = followitem,
|
|
||||||
fear_height = 4,
|
|
||||||
view_range = 16,
|
|
||||||
specific_attack = { "mobs_mc:chicken", "extra_mobs:cod", "extra_mobs:salmon" },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("extra_mobs:fox", fox)
|
mobs:register_mob("extra_mobs:fox", fox)
|
||||||
|
@ -146,21 +170,21 @@ mobs:spawn_setup({
|
||||||
--mobs:spawn_specific("extra_mobs:fox", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 6000, 3, 0, 500)
|
--mobs:spawn_specific("extra_mobs:fox", "overworld", "ground", 0, minetest.LIGHT_MAX+1, 30, 6000, 3, 0, 500)
|
||||||
--[[
|
--[[
|
||||||
mobs:spawn_specific(
|
mobs:spawn_specific(
|
||||||
"extra_mobs:artic_fox",
|
"extra_mobs:artic_fox",
|
||||||
"overworld",
|
"overworld",
|
||||||
"ground",
|
"ground",
|
||||||
{
|
{
|
||||||
"ColdTaiga",
|
"ColdTaiga",
|
||||||
"IcePlainsSpikes",
|
"IcePlainsSpikes",
|
||||||
"IcePlains",
|
"IcePlains",
|
||||||
"ExtremeHills+_snowtop",
|
"ExtremeHills+_snowtop",
|
||||||
},
|
},
|
||||||
0,
|
0,
|
||||||
minetest.LIGHT_MAX+1,
|
minetest.LIGHT_MAX+1,
|
||||||
30,
|
30,
|
||||||
6000,
|
6000,
|
||||||
3,
|
3,
|
||||||
mobs_mc.spawn_height.water,
|
mobs_mc.spawn_height.water,
|
||||||
mobs_mc.spawn_height.overworld_max)
|
mobs_mc.spawn_height.overworld_max)
|
||||||
]]--
|
]]--
|
||||||
-- spawn eggs
|
-- spawn eggs
|
||||||
|
|
|
@ -231,3 +231,13 @@ water)
|
||||||
|
|
||||||
-- spawn egg
|
-- spawn egg
|
||||||
mobs:register_egg("extra_mobs:glow_squid", S("Glow Squid"), "extra_mobs_spawn_icon_glow_squid.png", 0)
|
mobs:register_egg("extra_mobs:glow_squid", S("Glow Squid"), "extra_mobs_spawn_icon_glow_squid.png", 0)
|
||||||
|
|
||||||
|
-- dropped item (used to craft glowing itemframe)
|
||||||
|
|
||||||
|
minetest.register_craftitem("extra_mobs:glow_ink_sac", {
|
||||||
|
description = S("Glow Ink Sac"),
|
||||||
|
_doc_items_longdesc = S("Use it to craft the Glow Item Frame."),
|
||||||
|
_doc_items_usagehelp = S("Use the Glow Ink Sac and the normal Item Frame to craft the Glow Item Frame."),
|
||||||
|
inventory_image = "extra_mobs_glow_ink_sac.png",
|
||||||
|
groups = { craftitem = 1 },
|
||||||
|
})
|
||||||
|
|
|
@ -1,330 +0,0 @@
|
||||||
local S = minetest.get_translator("extra_mobs")
|
|
||||||
|
|
||||||
minetest.register_craftitem("extra_mobs:glow_ink_sac", {
|
|
||||||
description = S("Glow Ink Sac"),
|
|
||||||
_doc_items_longdesc = S("Use it to craft the Glow Item Frame."),
|
|
||||||
_doc_items_usagehelp = S("Use the Glow Ink Sac and the normal Item Frame to craft the Glow Item Frame."),
|
|
||||||
inventory_image = "extra_mobs_glow_ink_sac.png",
|
|
||||||
groups = { craftitem = 1 },
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
--[[This mod is originally by Zeg9, but heavily modified for MineClone 2.
|
|
||||||
|
|
||||||
Model created by 22i, licensed under the
|
|
||||||
GNU GPLv3 <https://www.gnu.org/licenses/gpl-3.0.html>.
|
|
||||||
|
|
||||||
Source: <https://github.com/22i/amc>
|
|
||||||
]]
|
|
||||||
|
|
||||||
|
|
||||||
local VISUAL_SIZE = 0.3
|
|
||||||
|
|
||||||
minetest.register_entity("extra_mobs:glow_item_frame_item",{
|
|
||||||
hp_max = 1,
|
|
||||||
visual = "wielditem",
|
|
||||||
visual_size = {x=VISUAL_SIZE, y=VISUAL_SIZE},
|
|
||||||
physical = false,
|
|
||||||
pointable = false,
|
|
||||||
textures = { "blank.png" },
|
|
||||||
_texture = "blank.png",
|
|
||||||
_scale = 1,
|
|
||||||
glow = minetest.LIGHT_MAX,
|
|
||||||
|
|
||||||
on_activate = function(self, staticdata)
|
|
||||||
if staticdata ~= nil and staticdata ~= "" then
|
|
||||||
local data = staticdata:split(';')
|
|
||||||
if data and data[1] and data[2] then
|
|
||||||
self._nodename = data[1]
|
|
||||||
self._texture = data[2]
|
|
||||||
if data[3] then
|
|
||||||
self._scale = data[3]
|
|
||||||
else
|
|
||||||
self._scale = 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if self._texture ~= nil then
|
|
||||||
self.object:set_properties({
|
|
||||||
textures={self._texture},
|
|
||||||
visual_size={x=VISUAL_SIZE/self._scale, y=VISUAL_SIZE/self._scale},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
get_staticdata = function(self)
|
|
||||||
if not self then return end
|
|
||||||
if self._nodename ~= nil and self._texture ~= nil then
|
|
||||||
local ret = self._nodename .. ';' .. self._texture
|
|
||||||
if self._scale ~= nil then
|
|
||||||
ret = ret .. ';' .. tostring(self._scale)
|
|
||||||
end
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
return ""
|
|
||||||
end,
|
|
||||||
|
|
||||||
_update_texture = function(self)
|
|
||||||
if self._texture ~= nil then
|
|
||||||
self.object:set_properties({
|
|
||||||
textures={self._texture},
|
|
||||||
visual_size={x=VISUAL_SIZE/self._scale, y=VISUAL_SIZE/self._scale},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
local facedir = {}
|
|
||||||
facedir[0] = {x=0,y=0,z=1}
|
|
||||||
facedir[1] = {x=1,y=0,z=0}
|
|
||||||
facedir[2] = {x=0,y=0,z=-1}
|
|
||||||
facedir[3] = {x=-1,y=0,z=0}
|
|
||||||
|
|
||||||
local remove_item_entity = function(pos, node)
|
|
||||||
local objs = nil
|
|
||||||
if node.name == "extra_mobs:glow_item_frame" then
|
|
||||||
objs = minetest.get_objects_inside_radius(pos, .5)
|
|
||||||
end
|
|
||||||
if objs then
|
|
||||||
for _, obj in ipairs(objs) do
|
|
||||||
if obj and obj:get_luaentity() and obj:get_luaentity().name == "extra_mobs:glow_item_frame_item" then
|
|
||||||
obj:remove()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local update_item_entity = function(pos, node, param2)
|
|
||||||
remove_item_entity(pos, node)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
local item = inv:get_stack("main", 1)
|
|
||||||
if not item:is_empty() then
|
|
||||||
if not param2 then
|
|
||||||
param2 = node.param2
|
|
||||||
end
|
|
||||||
if node.name == "extra_mobs:glow_item_frame" then
|
|
||||||
local posad = facedir[param2]
|
|
||||||
pos.x = pos.x + posad.x*6.5/16
|
|
||||||
pos.y = pos.y + posad.y*6.5/16
|
|
||||||
pos.z = pos.z + posad.z*6.5/16
|
|
||||||
end
|
|
||||||
local e = minetest.add_entity(pos, "extra_mobs:glow_item_frame_item")
|
|
||||||
local lua = e:get_luaentity()
|
|
||||||
lua._nodename = node.name
|
|
||||||
local itemname = item:get_name()
|
|
||||||
if itemname == "" or itemname == nil then
|
|
||||||
lua._texture = "blank.png"
|
|
||||||
lua._scale = 1
|
|
||||||
else
|
|
||||||
lua._texture = itemname
|
|
||||||
local def = minetest.registered_items[itemname]
|
|
||||||
if def and def.wield_scale then
|
|
||||||
lua._scale = def.wield_scale.x
|
|
||||||
else
|
|
||||||
lua._scale = 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
lua:_update_texture()
|
|
||||||
if node.name == "extra_mobs:glow_item_frame" then
|
|
||||||
local yaw = math.pi*2 - param2 * math.pi/2
|
|
||||||
e:set_yaw(yaw)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local drop_item = function(pos, node, meta, clicker)
|
|
||||||
local cname = ""
|
|
||||||
if clicker and clicker:is_player() then
|
|
||||||
cname = clicker:get_player_name()
|
|
||||||
end
|
|
||||||
if node.name == "extra_mobs:glow_item_frame" and not minetest.is_creative_enabled(cname) then
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
local item = inv:get_stack("main", 1)
|
|
||||||
if not item:is_empty() then
|
|
||||||
minetest.add_item(pos, item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
meta:set_string("infotext", "")
|
|
||||||
remove_item_entity(pos, node)
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_node("extra_mobs:glow_item_frame",{
|
|
||||||
description = S("Glow Item Frame"),
|
|
||||||
_tt_help = S("Can hold an item and glows"),
|
|
||||||
_doc_items_longdesc = S("Glow Item frames are decorative blocks in which items can be placed."),
|
|
||||||
_doc_items_usagehelp = S("Just place any item on the item frame. Use the item frame again to retrieve the item."),
|
|
||||||
drawtype = "mesh",
|
|
||||||
is_ground_content = false,
|
|
||||||
mesh = "extra_mobs_glow_item_frame.obj",
|
|
||||||
selection_box = { type = "fixed", fixed = {-6/16, -6/16, 7/16, 6/16, 6/16, 0.5} },
|
|
||||||
collision_box = { type = "fixed", fixed = {-6/16, -6/16, 7/16, 6/16, 6/16, 0.5} },
|
|
||||||
tiles = {"extra_mobs_glow_item_frame_border.png", "extra_mobs_glow_item_frame_border.png", "extra_mobs_glow_item_frame_border.png", "extra_mobs_glow_item_frame_border.png", "extra_mobs_glow_item_frame_border.png", "extra_mobs_glow_item_frame_border.png"},
|
|
||||||
inventory_image = "extra_mobs_glow_item_frame_item.png",
|
|
||||||
wield_image = "extra_mobs_glow_item_frame.png",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
|
|
||||||
--FIXME: should only be glowing, no light source. How is that possible with a node?
|
|
||||||
light_source = 1,
|
|
||||||
|
|
||||||
sunlight_propagates = true,
|
|
||||||
groups = { dig_immediate=3,deco_block=1,dig_by_piston=1,container=7,attached_node_facedir=1 },
|
|
||||||
sounds = mcl_sounds.node_sound_defaults(),
|
|
||||||
node_placement_prediction = "",
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
|
||||||
if pointed_thing.type ~= "node" then
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Use pointed node's on_rightclick function first, if present
|
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
|
||||||
if placer and not placer:get_player_control().sneak then
|
|
||||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
|
||||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return minetest.item_place(itemstack, placer, pointed_thing, minetest.dir_to_facedir(vector.direction(pointed_thing.above, pointed_thing.under)))
|
|
||||||
end,
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("main", 1)
|
|
||||||
end,
|
|
||||||
on_rightclick = function(pos, node, clicker, itemstack)
|
|
||||||
if not itemstack then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local pname = clicker:get_player_name()
|
|
||||||
if minetest.is_protected(pos, pname) then
|
|
||||||
minetest.record_protection_violation(pos, pname)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
drop_item(pos, node, meta, clicker)
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
if itemstack:is_empty() then
|
|
||||||
remove_item_entity(pos, node)
|
|
||||||
meta:set_string("infotext", "")
|
|
||||||
inv:set_stack("main", 1, "")
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
local put_itemstack = ItemStack(itemstack)
|
|
||||||
put_itemstack:set_count(1)
|
|
||||||
inv:set_stack("main", 1, put_itemstack)
|
|
||||||
update_item_entity(pos, node)
|
|
||||||
-- Add node infotext when item has been named
|
|
||||||
local imeta = itemstack:get_meta()
|
|
||||||
local iname = imeta:get_string("name")
|
|
||||||
if iname then
|
|
||||||
meta:set_string("infotext", iname)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
|
||||||
itemstack:take_item()
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
|
||||||
local name = player:get_player_name()
|
|
||||||
if minetest.is_protected(pos, name) then
|
|
||||||
minetest.record_protection_violation(pos, name)
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return count
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
|
||||||
local name = player:get_player_name()
|
|
||||||
if minetest.is_protected(pos, name) then
|
|
||||||
minetest.record_protection_violation(pos, name)
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return stack:get_count()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
|
||||||
local name = player:get_player_name()
|
|
||||||
if minetest.is_protected(pos, name) then
|
|
||||||
minetest.record_protection_violation(pos, name)
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return stack:get_count()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
on_destruct = function(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
drop_item(pos, node, meta)
|
|
||||||
end,
|
|
||||||
on_rotate = function(pos, node, user, mode, param2)
|
|
||||||
if mode == screwdriver.ROTATE_FACE then
|
|
||||||
-- Rotate face
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
|
|
||||||
local objs = nil
|
|
||||||
if node.name == "extra_mobs:glow_item_frame" then
|
|
||||||
objs = minetest.get_objects_inside_radius(pos, .5)
|
|
||||||
end
|
|
||||||
if objs then
|
|
||||||
for _, obj in ipairs(objs) do
|
|
||||||
if obj and obj:get_luaentity() and obj:get_luaentity().name == "extra_mobs:glow_item_frame_item" then
|
|
||||||
update_item_entity(pos, node, (node.param2+1) % 4)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return
|
|
||||||
elseif mode == screwdriver.ROTATE_AXIS then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = 'extra_mobs:glow_item_frame',
|
|
||||||
recipe = {'mcl_itemframes:item_frame', 'extra_mobs:glow_ink_sac'},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_lbm({
|
|
||||||
label = "Update legacy item frames",
|
|
||||||
name = "extra_mobs:update_legacy_glow_item_frames",
|
|
||||||
nodenames = {"extra_mobs:glow_frame"},
|
|
||||||
action = function(pos, node)
|
|
||||||
-- Swap legacy node, then respawn entity
|
|
||||||
node.name = "extra_mobs:glow_item_frame"
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local item = meta:get_string("item")
|
|
||||||
minetest.swap_node(pos, node)
|
|
||||||
if item ~= "" then
|
|
||||||
local itemstack = ItemStack(minetest.deserialize(meta:get_string("itemdata")))
|
|
||||||
local inv = meta:get_inventory()
|
|
||||||
inv:set_size("main", 1)
|
|
||||||
if not itemstack:is_empty() then
|
|
||||||
inv:set_stack("main", 1, itemstack)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
update_item_entity(pos, node)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- FIXME: Item entities can get destroyed by /clearobjects
|
|
||||||
minetest.register_lbm({
|
|
||||||
label = "Respawn item frame item entities",
|
|
||||||
name = "extra_mobs:respawn_entities",
|
|
||||||
nodenames = {"extra_mobs:glow_item_frame"},
|
|
||||||
run_at_every_load = true,
|
|
||||||
action = function(pos, node)
|
|
||||||
update_item_entity(pos, node)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_alias("extra_mobs:glow_frame", "extra_mobs:glow_item_frame")
|
|
||||||
|
|
||||||
--------------------
|
|
|
@ -21,8 +21,3 @@ dofile(path .. "/cod.lua")
|
||||||
dofile(path .. "/salmon.lua")
|
dofile(path .. "/salmon.lua")
|
||||||
dofile(path .. "/dolphin.lua")
|
dofile(path .. "/dolphin.lua")
|
||||||
dofile(path .. "/glow_squid.lua")
|
dofile(path .. "/glow_squid.lua")
|
||||||
|
|
||||||
--Items
|
|
||||||
dofile(path .. "/glow_squid_items.lua")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
# textdomain:extra_mobs
|
||||||
|
Hoglin=Hoglin
|
||||||
|
Piglin=Piglin
|
||||||
|
Piglin Brute=Piglin Barbare
|
||||||
|
Strider=Arpenteur
|
||||||
|
Fox=Renard
|
||||||
|
Cod=Poisson
|
||||||
|
Salmon=Saumon
|
||||||
|
Dolphin=Dauphin
|
||||||
|
Glow Squid=Pieuvre Lumineuse
|
||||||
|
Glow Ink Sac=Sac d'Encre Lumineuse
|
|
@ -8,10 +8,4 @@ Cod=Треска
|
||||||
Salmon=Лосось
|
Salmon=Лосось
|
||||||
dolphin=Дельфин
|
dolphin=Дельфин
|
||||||
Glow Squid=Светящийся спрут
|
Glow Squid=Светящийся спрут
|
||||||
Glow Ink Sac=Светящийся чернильный мешок
|
Glow Ink Sac=Светящийся чернильный мешок
|
||||||
Use it to craft the Glow Item Frame.=Используется для крафта светящейся рамки.
|
|
||||||
Use the Glow Ink Sac and the normal Item Frame to craft the Glow Item Frame.=Используйте светящийся чернильный мешок и обычную рамку для крафта светящейся рамки.
|
|
||||||
Glow Item Frame=Светящаяся рамка
|
|
||||||
Can hold an item and glows=Светится и может хранить предмет
|
|
||||||
Glow Item frames are decorative blocks in which items can be placed.=Светящаяся рамка это декоративный блок в который можно положить предметы.
|
|
||||||
Just place any item on the item frame. Use the item frame again to retrieve the item.=Просто используйте любой предмет на рамке. Используйте рамку снова, чтобы забрать предмет.
|
|
|
@ -1,17 +1,11 @@
|
||||||
# textdomain:extra_mobs
|
# textdomain:extra_mobs
|
||||||
Hoglin=
|
Hoglin=
|
||||||
piglin=
|
Piglin=
|
||||||
piglin Brute=
|
Piglin Brute=
|
||||||
Strider=
|
Strider=
|
||||||
Fox=
|
Fox=
|
||||||
Cod=
|
Cod=
|
||||||
Salmon=
|
Salmon=
|
||||||
dolphin=
|
Dolphin=
|
||||||
Glow Squid=
|
Glow Squid=
|
||||||
Glow Ink Sac=
|
Glow Ink Sac=
|
||||||
Use it to craft the Glow Item Frame.=
|
|
||||||
Use the Glow Ink Sac and the normal Item Frame to craft the Glow Item Frame.=
|
|
||||||
Glow Item Frame=
|
|
||||||
Can hold an item and glows=
|
|
||||||
Glow Item frames are decorative blocks in which items can be placed.=
|
|
||||||
Just place any item on the item frame. Use the item frame again to retrieve the item.=
|
|
|
@ -10,26 +10,26 @@ local S = minetest.get_translator("extra_mobs")
|
||||||
--###################
|
--###################
|
||||||
|
|
||||||
local salmon = {
|
local salmon = {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
spawn_class = "water",
|
spawn_class = "water",
|
||||||
can_despawn = true,
|
can_despawn = true,
|
||||||
passive = true,
|
passive = true,
|
||||||
hp_min = 3,
|
hp_min = 3,
|
||||||
hp_max = 3,
|
hp_max = 3,
|
||||||
xp_min = 1,
|
xp_min = 1,
|
||||||
xp_max = 3,
|
xp_max = 3,
|
||||||
armor = 100,
|
armor = 100,
|
||||||
rotate = 270,
|
rotate = 270,
|
||||||
tilt_swim = true,
|
tilt_swim = true,
|
||||||
collisionbox = {-0.4, 0.0, -0.4, 0.4, 0.79, 0.4},
|
collisionbox = {-0.4, 0.0, -0.4, 0.4, 0.79, 0.4},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "extra_mobs_salmon.b3d",
|
mesh = "extra_mobs_salmon.b3d",
|
||||||
textures = {
|
textures = {
|
||||||
{"extra_mobs_salmon.png"}
|
{"extra_mobs_salmon.png"}
|
||||||
},
|
},
|
||||||
sounds = {
|
sounds = {
|
||||||
},
|
},
|
||||||
animation = {
|
animation = {
|
||||||
stand_start = 1,
|
stand_start = 1,
|
||||||
stand_end = 20,
|
stand_end = 20,
|
||||||
walk_start = 1,
|
walk_start = 1,
|
||||||
|
@ -37,24 +37,31 @@ local salmon = {
|
||||||
run_start = 1,
|
run_start = 1,
|
||||||
run_end = 20,
|
run_end = 20,
|
||||||
},
|
},
|
||||||
drops = {
|
drops = {
|
||||||
{name = "mcl_fishing:salmon_raw",
|
{name = "mcl_fishing:salmon_raw",
|
||||||
chance = 1,
|
chance = 1,
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,},
|
max = 1,},
|
||||||
{name = "mcl_dye:white",
|
{name = "mcl_dye:white",
|
||||||
chance = 20,
|
chance = 20,
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 1,},
|
max = 1,},
|
||||||
},
|
},
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
makes_footstep_sound = false,
|
makes_footstep_sound = false,
|
||||||
swim = true,
|
swim = true,
|
||||||
breathes_in_water = true,
|
breathes_in_water = true,
|
||||||
jump = false,
|
jump = false,
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
runaway = true,
|
runaway = true,
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
|
on_rightclick = function(self, clicker)
|
||||||
|
if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then
|
||||||
|
self.object:remove()
|
||||||
|
clicker:set_wielded_item("mcl_fishing:bucket_salmon")
|
||||||
|
awards.unlock(clicker:get_player_name(), "mcl:tacticalFishing")
|
||||||
|
end
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("extra_mobs:salmon", salmon)
|
mobs:register_mob("extra_mobs:salmon", salmon)
|
||||||
|
|
Before Width: | Height: | Size: 296 B After Width: | Height: | Size: 296 B |
|
@ -166,11 +166,13 @@ function boat.on_activate(self, staticdata, dtime_s)
|
||||||
self._last_v = self._v
|
self._last_v = self._v
|
||||||
self._itemstring = data.itemstring
|
self._itemstring = data.itemstring
|
||||||
|
|
||||||
while #data.textures < 5 do
|
if data.textures then
|
||||||
table.insert(data.textures, data.textures[1])
|
while #data.textures < 5 do
|
||||||
end
|
table.insert(data.textures, data.textures[1])
|
||||||
|
end
|
||||||
|
|
||||||
self.object:set_properties({textures = data.textures})
|
self.object:set_properties({textures = data.textures})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ Boats are used to travel on the surface of water.=Les bateaux sont utilisés pou
|
||||||
Dark Oak Boat=Bateau en Chêne Noir
|
Dark Oak Boat=Bateau en Chêne Noir
|
||||||
Jungle Boat=Bateau en Acajou
|
Jungle Boat=Bateau en Acajou
|
||||||
Oak Boat=Bateau en Chêne
|
Oak Boat=Bateau en Chêne
|
||||||
|
Obsidian Boat=Bateau en Obsidienne
|
||||||
Rightclick on a water source to place the boat. Rightclick the boat to enter it. Use [Left] and [Right] to steer, [Forwards] to speed up and [Backwards] to slow down or move backwards. Use [Sneak] to leave the boat, punch the boat to make it drop as an item.=Faites un clic droit sur une source d'eau pour placer le bateau. Faites un clic droit sur le bateau pour y entrer. Utilisez [Gauche] et [Droite] pour diriger, [Avant] pour accélérer et [Arrière] pour ralentir ou reculer. Utilisez [Sneak] pour le quitter, frappez le bateau pour le faire tomber en tant qu'objet.
|
Rightclick on a water source to place the boat. Rightclick the boat to enter it. Use [Left] and [Right] to steer, [Forwards] to speed up and [Backwards] to slow down or move backwards. Use [Sneak] to leave the boat, punch the boat to make it drop as an item.=Faites un clic droit sur une source d'eau pour placer le bateau. Faites un clic droit sur le bateau pour y entrer. Utilisez [Gauche] et [Droite] pour diriger, [Avant] pour accélérer et [Arrière] pour ralentir ou reculer. Utilisez [Sneak] pour le quitter, frappez le bateau pour le faire tomber en tant qu'objet.
|
||||||
Spruce Boat=Bateau en Sapin
|
Spruce Boat=Bateau en Sapin
|
||||||
Water vehicle=Véhicule aquatique
|
Water vehicle=Véhicule aquatique
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# textdomain: mcl_boats
|
||||||
|
Acacia Boat=Barca de Cacièr
|
||||||
|
Birch Boat=Barca de Bèç
|
||||||
|
Boat=Barca
|
||||||
|
Boats are used to travel on the surface of water.= Las Barcas permetàn de vogar per l'aiga.
|
||||||
|
Dark Oak Boat=Barca de Jàrric
|
||||||
|
Jungle Boat=Barca de Jungla
|
||||||
|
Oak Boat=Barca de Ròure
|
||||||
|
Obsidian Boat=Barca d'Obsidiana
|
||||||
|
Rightclick on a water source to place the boat. Rightclick the boat to enter it. Use [Left] and [Right] to steer, [Forwards] to speed up and [Backwards] to slow down or move backwards. Use [Sneak] to leave the boat, punch the boat to make it drop as an item.=Fasetz un clic dreit sobre una sorça d'aiga per botar la barca. Fasetz un clic dreit sobre la barca per ne'n dintrar. Utilisatz [Esquèrra] e [Dreita] per menar, [Davant] per accelerar, e [Darrèir] per alentir o recular. Utilizatz [S'acatar] per o quitar, picatz la barca per o faire tombar en objèct.
|
||||||
|
Spruce Boat=Barca de Sap
|
||||||
|
Water vehicle=Veïcule d'Aiga
|
||||||
|
Sneak to dismount=S'acatar per descendre
|
|
@ -0,0 +1,3 @@
|
||||||
|
# textdomain: mcl_falling_nodes
|
||||||
|
@1 was smashed by a falling anvil.=@1 fuguèt espotit per una enclutge.
|
||||||
|
@1 was smashed by a falling block.=@1 fuguèt espotit per un blòc.
|
|
@ -65,6 +65,8 @@ mcl_item_entity.register_pickup_achievement("tree", "mcl:mineWood")
|
||||||
mcl_item_entity.register_pickup_achievement("mcl_mobitems:blaze_rod", "mcl:blazeRod")
|
mcl_item_entity.register_pickup_achievement("mcl_mobitems:blaze_rod", "mcl:blazeRod")
|
||||||
mcl_item_entity.register_pickup_achievement("mcl_mobitems:leather", "mcl:killCow")
|
mcl_item_entity.register_pickup_achievement("mcl_mobitems:leather", "mcl:killCow")
|
||||||
mcl_item_entity.register_pickup_achievement("mcl_core:diamond", "mcl:diamonds")
|
mcl_item_entity.register_pickup_achievement("mcl_core:diamond", "mcl:diamonds")
|
||||||
|
mcl_item_entity.register_pickup_achievement("mcl_core:crying_obsidian", "mcl:whosCuttingOnions")
|
||||||
|
mcl_item_entity.register_pickup_achievement("mcl_nether:ancient_debris", "mcl:hiddenInTheDepths")
|
||||||
|
|
||||||
local function check_pickup_achievements(object, player)
|
local function check_pickup_achievements(object, player)
|
||||||
if has_awards then
|
if has_awards then
|
||||||
|
@ -154,6 +156,10 @@ minetest.register_globalstep(function(dtime)
|
||||||
object:set_velocity({x=0,y=0,z=0})
|
object:set_velocity({x=0,y=0,z=0})
|
||||||
object:set_acceleration({x=0,y=0,z=0})
|
object:set_acceleration({x=0,y=0,z=0})
|
||||||
|
|
||||||
|
if object._flowing then
|
||||||
|
object._flowing = false
|
||||||
|
end
|
||||||
|
|
||||||
object:move_to(checkpos)
|
object:move_to(checkpos)
|
||||||
|
|
||||||
pool[name] = pool[name] + 1
|
pool[name] = pool[name] + 1
|
||||||
|
@ -793,6 +799,9 @@ minetest.register_entity(":__builtin:item", {
|
||||||
|
|
||||||
local oldvel = self.object:get_velocity() -- v is vector, vel is velocity
|
local oldvel = self.object:get_velocity() -- v is vector, vel is velocity
|
||||||
|
|
||||||
|
-- apply gravity *before* drag computations
|
||||||
|
oldvel.y = oldvel.y - get_gravity() * dtime
|
||||||
|
|
||||||
-- drag
|
-- drag
|
||||||
local fluid_drag = item_drop_settings.fluid_drag
|
local fluid_drag = item_drop_settings.fluid_drag
|
||||||
|
|
||||||
|
@ -806,12 +815,6 @@ minetest.register_entity(":__builtin:item", {
|
||||||
newv.x = newv.x - (oldvel.x - newv.x) * fluid_drag * dtime
|
newv.x = newv.x - (oldvel.x - newv.x) * fluid_drag * dtime
|
||||||
newv.y = newv.y - (oldvel.y - newv.y) * fluid_drag * dtime
|
newv.y = newv.y - (oldvel.y - newv.y) * fluid_drag * dtime
|
||||||
newv.z = newv.z - (oldvel.z - newv.z) * fluid_drag * dtime
|
newv.z = newv.z - (oldvel.z - newv.z) * fluid_drag * dtime
|
||||||
|
|
||||||
newv.y = newv.y + -0.22 -- (keep slight downward thrust from previous version of code)
|
|
||||||
-- NOTE: is there any particular reason we have this, anyway?
|
|
||||||
-- since fluid drag is now on, we could as well just
|
|
||||||
-- apply gravity here; drag will slow down the fall
|
|
||||||
-- realistically
|
|
||||||
|
|
||||||
self.object:set_velocity({x = oldvel.x + newv.x * dtime, y = oldvel.y + newv.y * dtime, z = oldvel.z + newv.z * dtime})
|
self.object:set_velocity({x = oldvel.x + newv.x * dtime, y = oldvel.y + newv.y * dtime, z = oldvel.z + newv.z * dtime})
|
||||||
|
|
||||||
|
|
|
@ -227,6 +227,11 @@ functions needed for the mob to work properly which contains the following:
|
||||||
older mobs.
|
older mobs.
|
||||||
'pushable' Allows players, & other mobs to push the mob.
|
'pushable' Allows players, & other mobs to push the mob.
|
||||||
|
|
||||||
|
'spawn_with_armor' If set to true, the mob has a small chance of spawning with
|
||||||
|
random matched armor. If set to a string, the string represents
|
||||||
|
the material type of the armor. Any materials used by
|
||||||
|
mcl_armor will work. Example: "gold"
|
||||||
|
It is assumed that the first texture is for armor.
|
||||||
|
|
||||||
|
|
||||||
MineClone 2 extensions:
|
MineClone 2 extensions:
|
||||||
|
|
|
@ -375,6 +375,7 @@ function mobs:register_mob(name, def)
|
||||||
--moves the wrong way
|
--moves the wrong way
|
||||||
swap_y_with_x = def.swap_y_with_x or false,
|
swap_y_with_x = def.swap_y_with_x or false,
|
||||||
reverse_head_yaw = def.reverse_head_yaw or false,
|
reverse_head_yaw = def.reverse_head_yaw or false,
|
||||||
|
_spawn_with_armor = def.spawn_with_armor,
|
||||||
|
|
||||||
--END HEAD CODE VARIABLES
|
--END HEAD CODE VARIABLES
|
||||||
|
|
||||||
|
@ -401,6 +402,7 @@ function mobs:register_mob(name, def)
|
||||||
ignited_by_sunlight = def.ignited_by_sunlight or false,
|
ignited_by_sunlight = def.ignited_by_sunlight or false,
|
||||||
eye_height = def.eye_height or 1.5,
|
eye_height = def.eye_height or 1.5,
|
||||||
defuse_reach = def.defuse_reach or 4,
|
defuse_reach = def.defuse_reach or 4,
|
||||||
|
spawn = def.spawn,
|
||||||
-- End of MCL2 extensions
|
-- End of MCL2 extensions
|
||||||
|
|
||||||
on_spawn = def.on_spawn,
|
on_spawn = def.on_spawn,
|
||||||
|
@ -415,7 +417,7 @@ function mobs:register_mob(name, def)
|
||||||
|
|
||||||
--on_breed = def.on_breed,
|
--on_breed = def.on_breed,
|
||||||
|
|
||||||
--on_grown = def.on_grown,
|
on_grown = def.on_grown,
|
||||||
|
|
||||||
--on_detach_child = mob_detach_child,
|
--on_detach_child = mob_detach_child,
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ local function land_state_switch(self, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
--ignore everything else if following
|
--ignore everything else if following
|
||||||
if mobs.check_following(self) and
|
if mobs.check_following(self, dtime) and
|
||||||
(not self.breed_lookout_timer or (self.breed_lookout_timer and self.breed_lookout_timer == 0)) and
|
(not self.breed_lookout_timer or (self.breed_lookout_timer and self.breed_lookout_timer == 0)) and
|
||||||
(not self.breed_timer or (self.breed_timer and self.breed_timer == 0)) then
|
(not self.breed_timer or (self.breed_timer and self.breed_timer == 0)) then
|
||||||
self.state = "follow"
|
self.state = "follow"
|
||||||
|
@ -984,7 +984,7 @@ function mobs.mob_step(self, dtime)
|
||||||
|
|
||||||
--go get the closest player
|
--go get the closest player
|
||||||
if attacking then
|
if attacking then
|
||||||
|
mobs.do_head_logic(self, dtime, attacking)
|
||||||
self.memory = 6 --6 seconds of memory
|
self.memory = 6 --6 seconds of memory
|
||||||
|
|
||||||
--set initial punch timer
|
--set initial punch timer
|
||||||
|
@ -1040,6 +1040,7 @@ function mobs.mob_step(self, dtime)
|
||||||
--don't break eye contact
|
--don't break eye contact
|
||||||
if self.hostile and self.attacking then
|
if self.hostile and self.attacking then
|
||||||
mobs.set_yaw_while_attacking(self)
|
mobs.set_yaw_while_attacking(self)
|
||||||
|
mobs.do_head_logic(self, dtime, self.attacking)
|
||||||
end
|
end
|
||||||
|
|
||||||
--perfectly reset pause_timer
|
--perfectly reset pause_timer
|
||||||
|
|
|
@ -26,6 +26,8 @@ local math_random = math.random
|
||||||
|_|
|
|_|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
local minetest_line_of_sight = minetest.line_of_sight
|
||||||
|
|
||||||
mobs.explode_attack_walk = function(self,dtime)
|
mobs.explode_attack_walk = function(self,dtime)
|
||||||
|
|
||||||
--this needs an exception
|
--this needs an exception
|
||||||
|
@ -36,17 +38,27 @@ mobs.explode_attack_walk = function(self,dtime)
|
||||||
|
|
||||||
mobs.set_yaw_while_attacking(self)
|
mobs.set_yaw_while_attacking(self)
|
||||||
|
|
||||||
local distance_from_attacking = vector_distance(self.object:get_pos(), self.attacking:get_pos())
|
local pos = self.object:get_pos()
|
||||||
|
local attack_pos = self.attacking:get_pos()
|
||||||
|
local distance_from_attacking = vector_distance(pos, attack_pos)
|
||||||
|
|
||||||
--make mob walk up to player within 2 nodes distance then start exploding
|
--make mob walk up to player within 2 nodes distance then start exploding
|
||||||
if distance_from_attacking >= self.reach and
|
if (
|
||||||
--don't allow explosion to cancel unless out of the reach boundary
|
distance_from_attacking >= self.reach and
|
||||||
not (self.explosion_animation and self.explosion_animation > 0 and distance_from_attacking <= self.defuse_reach) then
|
|
||||||
|
|
||||||
|
--don't allow explosion to cancel unless out of the reach boundary
|
||||||
|
not (self.explosion_animation and self.explosion_animation > 0 and distance_from_attacking <= self.defuse_reach) or
|
||||||
|
--don't allow creeper to finish exploding animation if can't see target
|
||||||
|
not minetest_line_of_sight(
|
||||||
|
{x = pos.x, y = pos.y + self.eye_height, z = pos.z},
|
||||||
|
{x = attack_pos.x, y = attack_pos.y + (self.attacking.eye_height or 0), z = attack_pos.z}
|
||||||
|
)
|
||||||
|
) then
|
||||||
mobs.set_velocity(self, self.run_velocity)
|
mobs.set_velocity(self, self.run_velocity)
|
||||||
mobs.set_mob_animation(self,"run")
|
mobs.set_mob_animation(self,"run")
|
||||||
|
|
||||||
mobs.reverse_explosion_animation(self,dtime)
|
mobs.reverse_explosion_animation(self,dtime)
|
||||||
|
|
||||||
else
|
else
|
||||||
mobs.set_velocity(self,0)
|
mobs.set_velocity(self,0)
|
||||||
|
|
||||||
|
@ -344,4 +356,4 @@ mobs.projectile_attack_fly = function(self, dtime)
|
||||||
mobs.shoot_projectile(self)
|
mobs.shoot_projectile(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ local minetest_get_objects_inside_radius = minetest.get_objects_inside_radius
|
||||||
local vector = vector
|
local vector = vector
|
||||||
|
|
||||||
--check to see if someone nearby has some tasty food
|
--check to see if someone nearby has some tasty food
|
||||||
mobs.check_following = function(self) -- returns true or false
|
mobs.check_following = function(self, dtime) -- returns true or false
|
||||||
--ignore
|
--ignore
|
||||||
if not self.follow then
|
if not self.follow then
|
||||||
self.following_person = nil
|
self.following_person = nil
|
||||||
|
@ -15,6 +15,7 @@ mobs.check_following = function(self) -- returns true or false
|
||||||
|
|
||||||
--check if the follower is a player incase they log out
|
--check if the follower is a player incase they log out
|
||||||
if follower and follower:is_player() then
|
if follower and follower:is_player() then
|
||||||
|
mobs.do_head_logic(self, dtime, follower)
|
||||||
local stack = follower:get_wielded_item()
|
local stack = follower:get_wielded_item()
|
||||||
--safety check
|
--safety check
|
||||||
if not stack then
|
if not stack then
|
||||||
|
@ -145,11 +146,12 @@ end
|
||||||
|
|
||||||
--make the baby grow up
|
--make the baby grow up
|
||||||
mobs.baby_grow_up = function(self)
|
mobs.baby_grow_up = function(self)
|
||||||
self.baby = nil
|
self.baby = nil
|
||||||
self.visual_size = self.backup_visual_size
|
self.visual_size = self.backup_visual_size
|
||||||
self.collisionbox = self.backup_collisionbox
|
self.collisionbox = self.backup_collisionbox
|
||||||
self.selectionbox = self.backup_selectionbox
|
self.selectionbox = self.backup_selectionbox
|
||||||
self.object:set_properties(self)
|
self.object:set_properties(self)
|
||||||
|
if self.on_grown then self.on_grown(self) end
|
||||||
end
|
end
|
||||||
|
|
||||||
--makes the baby grow up faster with diminishing returns
|
--makes the baby grow up faster with diminishing returns
|
||||||
|
|
|
@ -6,9 +6,9 @@ local degrees = function(yaw)
|
||||||
return yaw*180.0/math.pi
|
return yaw*180.0/math.pi
|
||||||
end
|
end
|
||||||
|
|
||||||
mobs.do_head_logic = function(self,dtime)
|
mobs.do_head_logic = function(self, dtime, player)
|
||||||
|
|
||||||
local player = minetest.get_player_by_name("singleplayer")
|
local player = player or minetest.get_player_by_name("singleplayer")
|
||||||
|
|
||||||
local look_at = player:get_pos()
|
local look_at = player:get_pos()
|
||||||
look_at.y = look_at.y + player:get_properties().eye_height
|
look_at.y = look_at.y + player:get_properties().eye_height
|
||||||
|
@ -89,10 +89,21 @@ mobs.do_head_logic = function(self,dtime)
|
||||||
head_pitch = head_pitch + self.head_pitch_modifier
|
head_pitch = head_pitch + self.head_pitch_modifier
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.swap_y_with_x then
|
local head_bone = self.head_bone
|
||||||
self.object:set_bone_position(self.head_bone, bone_pos, vector.new(degrees(head_pitch),degrees(head_yaw),0))
|
if (type(head_bone) == "table") then
|
||||||
|
for _, v in pairs(head_bone) do
|
||||||
|
if self.swap_y_with_x then
|
||||||
|
self.object:set_bone_position(v, bone_pos, vector.new(degrees(head_pitch),degrees(head_yaw),0))
|
||||||
|
else
|
||||||
|
self.object:set_bone_position(v, bone_pos, vector.new(degrees(head_pitch),0,degrees(head_yaw)))
|
||||||
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
self.object:set_bone_position(self.head_bone, bone_pos, vector.new(degrees(head_pitch),0,degrees(head_yaw)))
|
if self.swap_y_with_x then
|
||||||
|
self.object:set_bone_position(head_bone, bone_pos, vector.new(degrees(head_pitch),degrees(head_yaw),0))
|
||||||
|
else
|
||||||
|
self.object:set_bone_position(head_bone, bone_pos, vector.new(degrees(head_pitch),0,degrees(head_yaw)))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
--set_bone_position([bone, position, rotation])
|
--set_bone_position([bone, position, rotation])
|
||||||
end
|
end
|
|
@ -13,8 +13,13 @@ mobs.can_despawn = function(self)
|
||||||
if self.tamed or self.bred or self.nametag then return false end
|
if self.tamed or self.bred or self.nametag then return false end
|
||||||
local mob_pos = self.object:get_pos()
|
local mob_pos = self.object:get_pos()
|
||||||
if not mob_pos then return true end
|
if not mob_pos then return true end
|
||||||
|
local players = minetest_get_connected_players()
|
||||||
|
if #players == 0 then return false end
|
||||||
|
-- If no players, probably this is being called from get_staticdata() at server shutdown time
|
||||||
|
-- Minetest is to buggy (as of 5.5) to delete entities at server shutdown time anyway
|
||||||
|
|
||||||
local distance = 999
|
local distance = 999
|
||||||
for _, player in pairs(minetest_get_connected_players()) do
|
for _, player in pairs(players) do
|
||||||
if player and player:get_hp() > 0 then
|
if player and player:get_hp() > 0 then
|
||||||
local player_pos = player:get_pos()
|
local player_pos = player:get_pos()
|
||||||
local new_distance = vector_distance(player_pos, mob_pos)
|
local new_distance = vector_distance(player_pos, mob_pos)
|
||||||
|
@ -62,6 +67,102 @@ mobs.mob_staticdata = function(self)
|
||||||
return minetest.serialize(tmp)
|
return minetest.serialize(tmp)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mobs.armor_setup = function(self)
|
||||||
|
if not self._armor_items then
|
||||||
|
local armor = {}
|
||||||
|
-- Source: https://minecraft.fandom.com/wiki/Zombie
|
||||||
|
local materials = {
|
||||||
|
{name = "leather", chance = 0.3706},
|
||||||
|
{name = "gold", chance = 0.4873},
|
||||||
|
{name = "chain", chance = 0.129},
|
||||||
|
{name = "iron", chance = 0.0127},
|
||||||
|
{name = "diamond", chance = 0.0004}
|
||||||
|
}
|
||||||
|
local types = {
|
||||||
|
{name = "helmet", chance = 0.15},
|
||||||
|
{name = "chestplate", chance = 0.75},
|
||||||
|
{name = "leggings", chance = 0.75},
|
||||||
|
{name = "boots", chance = 0.75}
|
||||||
|
}
|
||||||
|
|
||||||
|
local material
|
||||||
|
if type(self._spawn_with_armor) == "string" then
|
||||||
|
material = self._spawn_with_armor
|
||||||
|
else
|
||||||
|
local chance = 0
|
||||||
|
for i, m in pairs(materials) do
|
||||||
|
chance = chance + m.chance
|
||||||
|
if math.random() <= chance then
|
||||||
|
material = m.name
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for i, t in pairs(types) do
|
||||||
|
if math.random() <= t.chance then
|
||||||
|
armor[t.name] = material
|
||||||
|
else
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Save armor items in lua entity
|
||||||
|
self._armor_items = {}
|
||||||
|
for atype, material in pairs(armor) do
|
||||||
|
local item = "mcl_armor:" .. atype .. "_" .. material
|
||||||
|
self._armor_items[atype] = item
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Setup armor drops
|
||||||
|
for atype, material in pairs(armor) do
|
||||||
|
local wear = math.random(1, 65535)
|
||||||
|
local item = "mcl_armor:" .. atype .. "_" .. material .. " 1 " .. wear
|
||||||
|
self.drops = table.copy(self.drops)
|
||||||
|
table.insert(self.drops, {
|
||||||
|
name = item,
|
||||||
|
chance = 1/0.085, -- 8.5%
|
||||||
|
min = 1,
|
||||||
|
max = 1,
|
||||||
|
looting = "rare",
|
||||||
|
looting_factor = 0.01 / 3,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Configure textures
|
||||||
|
local t = ""
|
||||||
|
local first_image = true
|
||||||
|
for atype, material in pairs(armor) do
|
||||||
|
if not first_image then
|
||||||
|
t = t .. "^"
|
||||||
|
end
|
||||||
|
t = t .. "mcl_armor_" .. atype .. "_" .. material .. ".png"
|
||||||
|
first_image = false
|
||||||
|
end
|
||||||
|
if t ~= "" then
|
||||||
|
self.base_texture = table.copy(self.base_texture)
|
||||||
|
self.base_texture[1] = t
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Configure damage groups based on armor
|
||||||
|
-- Source: https://minecraft.fandom.com/wiki/Armor#Armor_points
|
||||||
|
local points = 2
|
||||||
|
for atype, material in pairs(armor) do
|
||||||
|
local item_name = "mcl_armor:" .. atype .. "_" .. material
|
||||||
|
points = points + minetest.get_item_group(item_name, "mcl_armor_points")
|
||||||
|
end
|
||||||
|
local armor_strength = 100 - 4 * points
|
||||||
|
local armor_groups = self.object:get_armor_groups()
|
||||||
|
armor_groups.fleshy = armor_strength
|
||||||
|
self.armor = armor_groups
|
||||||
|
|
||||||
|
-- Helmet protects mob from sun damage
|
||||||
|
if armor.helmet then
|
||||||
|
self.ignited_by_sunlight = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- activate mob and reload settings
|
-- activate mob and reload settings
|
||||||
mobs.mob_activate = function(self, staticdata, def, dtime)
|
mobs.mob_activate = function(self, staticdata, def, dtime)
|
||||||
|
@ -104,6 +205,11 @@ mobs.mob_activate = function(self, staticdata, def, dtime)
|
||||||
self.base_colbox = self.collisionbox
|
self.base_colbox = self.collisionbox
|
||||||
self.base_selbox = self.selectionbox
|
self.base_selbox = self.selectionbox
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Setup armor on mobs
|
||||||
|
if self._spawn_with_armor then
|
||||||
|
mobs.armor_setup(self)
|
||||||
|
end
|
||||||
|
|
||||||
-- for current mobs that dont have this set
|
-- for current mobs that dont have this set
|
||||||
if not self.base_selbox then
|
if not self.base_selbox then
|
||||||
|
|
|
@ -267,6 +267,8 @@ function mobs:spawn_setup(def)
|
||||||
local day_toggle = def.day_toggle
|
local day_toggle = def.day_toggle
|
||||||
local on_spawn = def.on_spawn
|
local on_spawn = def.on_spawn
|
||||||
local check_position = def.check_position
|
local check_position = def.check_position
|
||||||
|
local group_size_min = def.group_size_min or 1
|
||||||
|
local group_size_max = def.group_size_max or 1
|
||||||
|
|
||||||
-- chance/spawn number override in minetest.conf for registered mob
|
-- chance/spawn number override in minetest.conf for registered mob
|
||||||
local numbers = minetest.settings:get(name)
|
local numbers = minetest.settings:get(name)
|
||||||
|
@ -300,10 +302,23 @@ function mobs:spawn_setup(def)
|
||||||
day_toggle = day_toggle,
|
day_toggle = day_toggle,
|
||||||
check_position = check_position,
|
check_position = check_position,
|
||||||
on_spawn = on_spawn,
|
on_spawn = on_spawn,
|
||||||
|
group_size_min = group_size_min,
|
||||||
|
group_size_max = group_size_max,
|
||||||
}
|
}
|
||||||
summary_chance = summary_chance + chance
|
summary_chance = summary_chance + chance
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function mobs.spawn_mob(name, pos)
|
||||||
|
local def = minetest.registered_entities[name]
|
||||||
|
if not def then return end
|
||||||
|
if def.spawn then
|
||||||
|
return def.spawn(pos)
|
||||||
|
end
|
||||||
|
return minetest.add_entity(pos, name)
|
||||||
|
end
|
||||||
|
|
||||||
|
local spawn_mob = mobs.spawn_mob
|
||||||
|
|
||||||
function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_light, max_light, interval, chance, aoc, min_height, max_height, day_toggle, on_spawn)
|
function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_light, max_light, interval, chance, aoc, min_height, max_height, day_toggle, on_spawn)
|
||||||
|
|
||||||
-- Do mobs spawn at all?
|
-- Do mobs spawn at all?
|
||||||
|
@ -341,6 +356,8 @@ function mobs:spawn_specific(name, dimension, type_of_spawning, biomes, min_ligh
|
||||||
spawn_dictionary[key]["min_height"] = min_height
|
spawn_dictionary[key]["min_height"] = min_height
|
||||||
spawn_dictionary[key]["max_height"] = max_height
|
spawn_dictionary[key]["max_height"] = max_height
|
||||||
spawn_dictionary[key]["day_toggle"] = day_toggle
|
spawn_dictionary[key]["day_toggle"] = day_toggle
|
||||||
|
spawn_dictionary[key]["group_size_min"] = 1
|
||||||
|
spawn_dictionary[key]["group_size_max"] = 3
|
||||||
|
|
||||||
summary_chance = summary_chance + chance
|
summary_chance = summary_chance + chance
|
||||||
end
|
end
|
||||||
|
@ -442,9 +459,9 @@ if mobs_spawn then
|
||||||
and (mob_def.check_position and mob_def.check_position(spawning_position) or true)
|
and (mob_def.check_position and mob_def.check_position(spawning_position) or true)
|
||||||
then
|
then
|
||||||
--everything is correct, spawn mob
|
--everything is correct, spawn mob
|
||||||
local object = minetest.add_entity(spawning_position, mob_def.name)
|
local object = spawn_mob(mob_def.name, spawning_position)
|
||||||
if object then
|
if object then
|
||||||
return mob_def.on_spawn and mob_def.on_spawn(object, pos)
|
return mob_def.on_spawn and mob_def.on_spawn(object, spawning_position)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
current_summary_chance = current_summary_chance - mob_chance
|
current_summary_chance = current_summary_chance - mob_chance
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# textdomain: mcl_mobs
|
# textdomain: mcl_mobs
|
||||||
Peaceful mode active! No monsters will spawn.=Mode paisible actif! Aucun monstre n'apparaîtra.
|
Peaceful mode active! No monsters will spawn.=Mode paisible actif ! Aucun monstre n'apparaîtra.
|
||||||
This allows you to place a single mob.=Cela vous permet de placer un seul mob.
|
This allows you to place a single mob.=Cela vous permet de placer un seul mob.
|
||||||
Just place it where you want the mob to appear. Animals will spawn tamed, unless you hold down the sneak key while placing. If you place this on a mob spawner, you change the mob it spawns.=Placez-le là où vous voulez que le mob apparaisse. Les animaux apparaîtront apprivoisés, sauf si vous maintenez la touche furtive enfoncée pendant le placement. Si vous le placez sur un générateur de mob, vous changez le mob qu'il génère.
|
Just place it where you want the mob to appear. Animals will spawn tamed, unless you hold down the sneak key while placing. If you place this on a mob spawner, you change the mob it spawns.=Placez-le là où vous voulez que le mob apparaisse. Les animaux apparaîtront apprivoisés, sauf si vous maintenez la touche furtive enfoncée pendant le placement. Si vous le placez sur un générateur de mob, vous changez le mob qu'il génère.
|
||||||
You need the “maphack” privilege to change the mob spawner.=Vous avez besoin du privilège "maphack" pour changer le générateur de mob.
|
You need the “maphack” privilege to change the mob spawner.=Vous avez besoin du privilège "maphack" pour changer le générateur de mob.
|
||||||
Name Tag=Étiquette de nom
|
Name Tag=Étiquette de nom
|
||||||
A name tag is an item to name a mob.=Une étiquette de nom est un élément pour nommer un mob.
|
A name tag is an item to name a mob.=Une étiquette de nom est un élément pour nommer un mob.
|
||||||
Before you use the name tag, you need to set a name at an anvil. Then you can use the name tag to name a mob. This uses up the name tag.=Avant d'utiliser l'étiquette de nom, vous devez définir un nom sur une enclume. Ensuite, vous pouvez utiliser l'étiquette de nom pour nommer un mob. Cela utilise l'étiquette de nom.
|
Before you use the name tag, you need to set a name at an anvil. Then you can use the name tag to name a mob. This uses up the name tag.=Avant d'utiliser l'étiquette de nom, vous devez définir un nom sur une enclume. Ensuite, vous pouvez utiliser l'étiquette de nom pour nommer un mob. Cela utilise l'étiquette de nom.
|
||||||
Only peaceful mobs allowed!=Seuls les mobs pacifiques sont autorisés!
|
Only peaceful mobs allowed!=Seuls les mobs pacifiques sont autorisés !
|
||||||
Give names to mobs=Donne des noms aux mobs
|
Give names to mobs=Donne des noms aux mobs
|
||||||
Set name at anvil=Définir le nom sur l'enclume
|
Set name at anvil=Définir le nom sur l'enclume
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
# textdomain:mcl_paintings
|
||||||
|
Painting=Pintura
|
|
@ -61,6 +61,7 @@ dofile(path .. "/villager.lua") -- KrupnoPavel Mesh and animation by toby109tt
|
||||||
--dofile(path .. "/agent.lua") -- Mesh and animation by toby109tt / https://github.com/22i
|
--dofile(path .. "/agent.lua") -- Mesh and animation by toby109tt / https://github.com/22i
|
||||||
|
|
||||||
-- Illagers and witch
|
-- Illagers and witch
|
||||||
|
dofile(path .. "/pillager.lua") -- Mesh by KrupnoPavel and MrRar, animation by MrRar
|
||||||
dofile(path .. "/villager_evoker.lua") -- Mesh and animation by toby109tt / https://github.com/22i
|
dofile(path .. "/villager_evoker.lua") -- Mesh and animation by toby109tt / https://github.com/22i
|
||||||
dofile(path .. "/villager_vindicator.lua") -- Mesh and animation by toby109tt / https://github.com/22i
|
dofile(path .. "/villager_vindicator.lua") -- Mesh and animation by toby109tt / https://github.com/22i
|
||||||
dofile(path .. "/villager_zombie.lua") -- Mesh and animation by toby109tt / https://github.com/22i
|
dofile(path .. "/villager_zombie.lua") -- Mesh and animation by toby109tt / https://github.com/22i
|
||||||
|
|
|
@ -74,3 +74,4 @@ Tool Smith=Fabriquant d'outil
|
||||||
Cleric=Clerc
|
Cleric=Clerc
|
||||||
Nitwit=Crétin
|
Nitwit=Crétin
|
||||||
Protects you from death while wielding it=Vous protège de la mort en le maniant
|
Protects you from death while wielding it=Vous protège de la mort en le maniant
|
||||||
|
Pillager=Pillard
|
|
@ -0,0 +1,77 @@
|
||||||
|
# textdomain: mobs_mc
|
||||||
|
Totem of Undying=Totèm d'Imortalitat
|
||||||
|
A totem of undying is a rare artifact which may safe you from certain death.=Un totèm d'imortalitat es un artefacte rara que pòt vos sauvar d'una mòrt surada.
|
||||||
|
The totem only works while you hold it in your hand. If you receive fatal damage, you are saved from death and you get a second chance with 1 HP. The totem is destroyed in the process, however.=
|
||||||
|
Agent=Agent
|
||||||
|
Bat=Ratapenada
|
||||||
|
Blaze=Blaze
|
||||||
|
Chicken=Pola
|
||||||
|
Cow=Vacha
|
||||||
|
Mooshroom=Champavacha
|
||||||
|
Creeper=Creeper
|
||||||
|
Ender Dragon=Drac de l'End
|
||||||
|
Enderman=Òme de l'End
|
||||||
|
Endermite=Endarna
|
||||||
|
Ghast=Trèva
|
||||||
|
Elder Guardian=Gardian Ainat
|
||||||
|
Guardian=Gardian
|
||||||
|
Horse=Ega
|
||||||
|
Skeleton Horse=Ega Esquelèta
|
||||||
|
Zombie Horse=Ega Mòrtaviva
|
||||||
|
Donkey=Asne
|
||||||
|
Mule=Miula
|
||||||
|
Iron Golem=Golèm de Fèrre
|
||||||
|
Llama=Lama
|
||||||
|
Ocelot=Ocelòt
|
||||||
|
Parrot=Papagai
|
||||||
|
Pig=Pòrc
|
||||||
|
Polar Bear=Ors Polar
|
||||||
|
Rabbit=Lapin
|
||||||
|
Killer Bunny=Lapin Tuaire
|
||||||
|
The Killer Bunny=Lo Lapin Tuaire
|
||||||
|
Sheep=Moton
|
||||||
|
Shulker=
|
||||||
|
Silverfish=
|
||||||
|
Skeleton=
|
||||||
|
Stray=
|
||||||
|
Wither Skeleton=
|
||||||
|
Magma Cube=
|
||||||
|
Slime=
|
||||||
|
Snow Golem=
|
||||||
|
Spider=
|
||||||
|
Cave Spider=
|
||||||
|
Squid=
|
||||||
|
Vex=
|
||||||
|
Evoker=
|
||||||
|
Illusioner=
|
||||||
|
Villager=
|
||||||
|
Vindicator=
|
||||||
|
Zombie Villager=
|
||||||
|
Witch=
|
||||||
|
Wither=
|
||||||
|
Wolf=
|
||||||
|
Husk=
|
||||||
|
Zombie=
|
||||||
|
Zombie Pigman=
|
||||||
|
Iron Horse Armor=
|
||||||
|
Iron horse armor can be worn by horses to increase their protection from harm a bit.=
|
||||||
|
Golden Horse Armor=
|
||||||
|
Golden horse armor can be worn by horses to increase their protection from harm.=
|
||||||
|
Diamond Horse Armor=
|
||||||
|
Diamond horse armor can be worn by horses to greatly increase their protection from harm.=
|
||||||
|
Place it on a horse to put on the horse armor. Donkeys and mules can't wear horse armor.=
|
||||||
|
Farmer=
|
||||||
|
Fisherman=
|
||||||
|
Fletcher=
|
||||||
|
Shepherd=
|
||||||
|
Librarian=
|
||||||
|
Cartographer=
|
||||||
|
Armorer=
|
||||||
|
Leatherworker=
|
||||||
|
Butcher=
|
||||||
|
Weapon Smith=
|
||||||
|
Tool Smith=
|
||||||
|
Cleric=
|
||||||
|
Nitwit=
|
||||||
|
Protects you from death while wielding it=
|
||||||
|
Pillager=
|
|
@ -74,3 +74,4 @@ Tool Smith=
|
||||||
Cleric=
|
Cleric=
|
||||||
Nitwit=
|
Nitwit=
|
||||||
Protects you from death while wielding it=
|
Protects you from death while wielding it=
|
||||||
|
Pillager=
|
||||||
|
|
|
@ -0,0 +1,159 @@
|
||||||
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
|
local function reload(self)
|
||||||
|
if not self or not self.object then return end
|
||||||
|
minetest.sound_play("mcl_bows_crossbow_drawback_1", {object = self.object, max_hear_distance=16}, true)
|
||||||
|
local props = self.object:get_properties()
|
||||||
|
if not props then return end
|
||||||
|
props.textures[2] = "mcl_bows_crossbow_3.png^[resize:16x16"
|
||||||
|
self.object:set_properties(props)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function reset_animation(self, animation)
|
||||||
|
if not self or not self.object or self.current_animation ~= animation then return end
|
||||||
|
self.current_animation = "stand_reload" -- Mobs Redo won't set the animation unless we do this
|
||||||
|
mobs.set_mob_animation(self, animation)
|
||||||
|
end
|
||||||
|
|
||||||
|
pillager = {
|
||||||
|
description = S("Pillager"),
|
||||||
|
type = "monster",
|
||||||
|
spawn_class = "hostile",
|
||||||
|
hostile = true,
|
||||||
|
rotate = 270,
|
||||||
|
hp_min = 24,
|
||||||
|
hp_max = 24,
|
||||||
|
xp_min = 6,
|
||||||
|
xp_max = 6,
|
||||||
|
breath_max = -1,
|
||||||
|
eye_height = 1.5,
|
||||||
|
projectile_cooldown = 3, -- Useless
|
||||||
|
shoot_interval = 3, -- Useless
|
||||||
|
shoot_offset = 1.5,
|
||||||
|
dogshoot_switch = 1,
|
||||||
|
dogshoot_count_max = 1.8,
|
||||||
|
projectile_cooldown_min = 3,
|
||||||
|
projectile_cooldown_max = 2.5,
|
||||||
|
armor = {fleshy = 100},
|
||||||
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.98, 0.3},
|
||||||
|
pathfinding = 1,
|
||||||
|
group_attack = true,
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "mobs_mc_pillager.b3d",
|
||||||
|
|
||||||
|
--head code
|
||||||
|
has_head = false,
|
||||||
|
head_bone = "head",
|
||||||
|
|
||||||
|
swap_y_with_x = true,
|
||||||
|
reverse_head_yaw = true,
|
||||||
|
|
||||||
|
head_bone_pos_y = 2.4,
|
||||||
|
head_bone_pos_z = 0,
|
||||||
|
|
||||||
|
head_height_offset = 1.1,
|
||||||
|
head_direction_offset = 0,
|
||||||
|
head_pitch_modifier = 0,
|
||||||
|
--end head code
|
||||||
|
|
||||||
|
visual_size = {x=2.75, y=2.75},
|
||||||
|
makes_footstep_sound = true,
|
||||||
|
walk_velocity = 1.2,
|
||||||
|
run_velocity = 4,
|
||||||
|
damage = 2,
|
||||||
|
reach = 8,
|
||||||
|
view_range = 16,
|
||||||
|
fear_height = 4,
|
||||||
|
attack_type = "projectile",
|
||||||
|
arrow = "mcl_bows:arrow_entity",
|
||||||
|
sounds = {
|
||||||
|
random = "mobs_mc_pillager_grunt2",
|
||||||
|
war_cry = "mobs_mc_pillager_grunt1",
|
||||||
|
death = "mobs_mc_pillager_ow2",
|
||||||
|
damage = "mobs_mc_pillager_ow1",
|
||||||
|
distance = 16,
|
||||||
|
},
|
||||||
|
textures = {
|
||||||
|
{
|
||||||
|
"mobs_mc_pillager.png", -- Skin
|
||||||
|
"mcl_bows_crossbow_3.png^[resize:16x16", -- Wielded item
|
||||||
|
}
|
||||||
|
},
|
||||||
|
drops = {
|
||||||
|
{
|
||||||
|
name = "mcl_bows:arrow",
|
||||||
|
chance = 1,
|
||||||
|
min = 0,
|
||||||
|
max = 2,
|
||||||
|
looting = "common",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = "mcl_bows:crossbow",
|
||||||
|
chance = 100 / 8.5,
|
||||||
|
min = 1,
|
||||||
|
max = 1,
|
||||||
|
looting = "rare",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
animation = {
|
||||||
|
unloaded_walk_start = 1,
|
||||||
|
unloaded_walk_end = 40,
|
||||||
|
unloaded_stand_start = 41,
|
||||||
|
unloaded_stand_end = 60,
|
||||||
|
|
||||||
|
reload_stand_speed = 20,
|
||||||
|
reload_stand_start = 61,
|
||||||
|
reload_stand_end = 100,
|
||||||
|
|
||||||
|
stand_speed = 6,
|
||||||
|
stand_start = 101,
|
||||||
|
stand_end = 109,
|
||||||
|
|
||||||
|
walk_speed = 25,
|
||||||
|
walk_start = 111,
|
||||||
|
walk_end = 150,
|
||||||
|
run_speed = 40,
|
||||||
|
run_start = 111,
|
||||||
|
run_end = 150,
|
||||||
|
|
||||||
|
reload_run_speed = 20,
|
||||||
|
reload_run_start = 151,
|
||||||
|
reload_run_end = 190,
|
||||||
|
|
||||||
|
die_speed = 15,
|
||||||
|
die_start = 191,
|
||||||
|
die_end = 192,
|
||||||
|
die_loop = false,
|
||||||
|
|
||||||
|
stand_unloaded_start = 40,
|
||||||
|
stand_unloaded_end = 59,
|
||||||
|
},
|
||||||
|
shoot_arrow = function(self, pos, dir)
|
||||||
|
minetest.sound_play("mcl_bows_crossbow_shoot", {object = self.object, max_hear_distance=16}, true)
|
||||||
|
local props = self.object:get_properties()
|
||||||
|
props.textures[2] = "mcl_bows_crossbow_0.png^[resize:16x16"
|
||||||
|
self.object:set_properties(props)
|
||||||
|
local old_anim = self.current_animation
|
||||||
|
if old_anim == "run" then
|
||||||
|
mobs.set_mob_animation(self, "reload_run")
|
||||||
|
end
|
||||||
|
if old_anim == "stand" then
|
||||||
|
mobs.set_mob_animation(self, "reload_stand")
|
||||||
|
end
|
||||||
|
self.current_animation = old_anim -- Mobs Redo will imediately reset the animation otherwise
|
||||||
|
minetest.after(1, reload, self)
|
||||||
|
minetest.after(2, reset_animation, self, old_anim)
|
||||||
|
mobs.shoot_projectile_handling(
|
||||||
|
"mcl_bows:arrow", pos, dir, self.object:get_yaw(),
|
||||||
|
self.object, 30, math.random(3,4))
|
||||||
|
|
||||||
|
-- While we are at it, change the sounds since there is no way to do this in Mobs Redo
|
||||||
|
if self.sounds and self.sounds.random then
|
||||||
|
self.sounds = table.copy(self.sounds)
|
||||||
|
self.sounds.random = "mobs_mc_pillager_grunt" .. math.random(2)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
mobs:register_mob("mobs_mc:pillager", pillager)
|
||||||
|
mobs:register_egg("mobs_mc:pillager", S("Pillager"), "mobs_mc_spawn_icon_pillager.png", 0)
|
|
@ -2,118 +2,27 @@
|
||||||
|
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
local rabbit = {
|
local mob_name = "mobs_mc:rabbit"
|
||||||
description = S("Rabbit"),
|
|
||||||
type = "animal",
|
|
||||||
spawn_class = "passive",
|
|
||||||
passive = true,
|
|
||||||
reach = 1,
|
|
||||||
rotate = 270,
|
|
||||||
hp_min = 3,
|
|
||||||
hp_max = 3,
|
|
||||||
xp_min = 1,
|
|
||||||
xp_max = 3,
|
|
||||||
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.49, 0.2},
|
|
||||||
|
|
||||||
visual = "mesh",
|
local textures = {
|
||||||
mesh = "mobs_mc_rabbit.b3d",
|
|
||||||
textures = {
|
|
||||||
{"mobs_mc_rabbit_brown.png"},
|
{"mobs_mc_rabbit_brown.png"},
|
||||||
{"mobs_mc_rabbit_gold.png"},
|
{"mobs_mc_rabbit_gold.png"},
|
||||||
{"mobs_mc_rabbit_white.png"},
|
{"mobs_mc_rabbit_white.png"},
|
||||||
{"mobs_mc_rabbit_white_splotched.png"},
|
{"mobs_mc_rabbit_white_splotched.png"},
|
||||||
{"mobs_mc_rabbit_salt.png"},
|
{"mobs_mc_rabbit_salt.png"},
|
||||||
{"mobs_mc_rabbit_black.png"},
|
{"mobs_mc_rabbit_black.png"},
|
||||||
},
|
|
||||||
visual_size = {x=1.5, y=1.5},
|
|
||||||
sounds = {
|
|
||||||
random = "mobs_mc_rabbit_random",
|
|
||||||
damage = "mobs_mc_rabbit_hurt",
|
|
||||||
death = "mobs_mc_rabbit_death",
|
|
||||||
attack = "mobs_mc_rabbit_attack",
|
|
||||||
eat = "mobs_mc_animal_eat_generic",
|
|
||||||
distance = 16,
|
|
||||||
},
|
|
||||||
makes_footstep_sound = false,
|
|
||||||
walk_velocity = 1,
|
|
||||||
run_velocity = 3.7,
|
|
||||||
follow_velocity = 1.1,
|
|
||||||
floats = 1,
|
|
||||||
runaway = true,
|
|
||||||
jump = true,
|
|
||||||
drops = {
|
|
||||||
{name = mobs_mc.items.rabbit_raw, chance = 1, min = 0, max = 1, looting = "common",},
|
|
||||||
{name = mobs_mc.items.rabbit_hide, chance = 1, min = 0, max = 1, looting = "common",},
|
|
||||||
{name = mobs_mc.items.rabbit_foot, chance = 10, min = 0, max = 1, looting = "rare", looting_factor = 0.03,},
|
|
||||||
},
|
|
||||||
fear_height = 4,
|
|
||||||
animation = {
|
|
||||||
speed_normal = 25, speed_run = 50,
|
|
||||||
stand_start = 0, stand_end = 0,
|
|
||||||
walk_start = 0, walk_end = 20,
|
|
||||||
run_start = 0, run_end = 20,
|
|
||||||
},
|
|
||||||
-- Follow (yellow) dangelions, carrots and golden carrots
|
|
||||||
follow = mobs_mc.follow.rabbit,
|
|
||||||
view_range = 8,
|
|
||||||
-- Eat carrots and reduce their growth stage by 1
|
|
||||||
replace_rate = 10,
|
|
||||||
replace_what = mobs_mc.replace.rabbit,
|
|
||||||
on_rightclick = function(self, clicker)
|
|
||||||
-- Feed, tame protect or capture
|
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
|
||||||
end,
|
|
||||||
do_custom = function(self)
|
|
||||||
-- Easter egg: Change texture if rabbit is named “Toast”
|
|
||||||
if self.nametag == "Toast" and not self._has_toast_texture then
|
|
||||||
self._original_rabbit_texture = self.base_texture
|
|
||||||
self.base_texture = { "mobs_mc_rabbit_toast.png" }
|
|
||||||
self.object:set_properties({ textures = self.base_texture })
|
|
||||||
self._has_toast_texture = true
|
|
||||||
elseif self.nametag ~= "Toast" and self._has_toast_texture then
|
|
||||||
self.base_texture = self._original_rabbit_texture
|
|
||||||
self.object:set_properties({ textures = self.base_texture })
|
|
||||||
self._has_toast_texture = false
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:rabbit", rabbit)
|
local sounds = {
|
||||||
|
random = "mobs_mc_rabbit_random",
|
||||||
|
damage = "mobs_mc_rabbit_hurt",
|
||||||
|
death = "mobs_mc_rabbit_death",
|
||||||
|
attack = "mobs_mc_rabbit_attack",
|
||||||
|
eat = "mobs_mc_animal_eat_generic",
|
||||||
|
distance = 16,
|
||||||
|
}
|
||||||
|
|
||||||
-- The killer bunny (Only with spawn egg)
|
local biome_list = {
|
||||||
local killer_bunny = table.copy(rabbit)
|
|
||||||
killer_bunny.description = S("Killer Bunny")
|
|
||||||
killer_bunny.type = "monster"
|
|
||||||
killer_bunny.spawn_class = "hostile"
|
|
||||||
killer_bunny.attack_type = "dogfight"
|
|
||||||
killer_bunny.specific_attack = { "player", "mobs_mc:wolf", "mobs_mc:dog" }
|
|
||||||
killer_bunny.damage = 8
|
|
||||||
killer_bunny.passive = false
|
|
||||||
-- 8 armor points
|
|
||||||
killer_bunny.armor = 50
|
|
||||||
killer_bunny.textures = { "mobs_mc_rabbit_caerbannog.png" }
|
|
||||||
killer_bunny.view_range = 16
|
|
||||||
killer_bunny.replace_rate = nil
|
|
||||||
killer_bunny.replace_what = nil
|
|
||||||
killer_bunny.on_rightclick = nil
|
|
||||||
killer_bunny.run_velocity = 6
|
|
||||||
killer_bunny.do_custom = function(self)
|
|
||||||
if not self._killer_bunny_nametag_set then
|
|
||||||
self.nametag = S("The Killer Bunny")
|
|
||||||
self._killer_bunny_nametag_set = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:killer_bunny", killer_bunny)
|
|
||||||
|
|
||||||
-- Mob spawning rules.
|
|
||||||
-- Different skins depending on spawn location <- we'll get to this when the spawning algorithm is fleshed out
|
|
||||||
|
|
||||||
mobs:spawn_specific(
|
|
||||||
"mobs_mc:rabbit",
|
|
||||||
"overworld",
|
|
||||||
"ground",
|
|
||||||
{
|
|
||||||
"FlowerForest_beach",
|
"FlowerForest_beach",
|
||||||
"Forest_beach",
|
"Forest_beach",
|
||||||
"StoneBeach",
|
"StoneBeach",
|
||||||
|
@ -161,73 +70,149 @@ mobs:spawn_specific(
|
||||||
"MesaBryce",
|
"MesaBryce",
|
||||||
"JungleEdge",
|
"JungleEdge",
|
||||||
"SavannaM",
|
"SavannaM",
|
||||||
},
|
|
||||||
9,
|
|
||||||
minetest.LIGHT_MAX+1,
|
|
||||||
30,
|
|
||||||
15000,
|
|
||||||
8,
|
|
||||||
mobs_mc.spawn_height.overworld_min,
|
|
||||||
mobs_mc.spawn_height.overworld_max)
|
|
||||||
|
|
||||||
--[[
|
|
||||||
local spawn = {
|
|
||||||
name = "mobs_mc:rabbit",
|
|
||||||
neighbors = {"air"},
|
|
||||||
chance = 15000,
|
|
||||||
active_object_count = 10,
|
|
||||||
min_light = 0,
|
|
||||||
max_light = minetest.LIGHT_MAX+1,
|
|
||||||
min_height = mobs_mc.spawn_height.overworld_min,
|
|
||||||
max_height = mobs_mc.spawn_height.overworld_max,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local spawn_desert = table.copy(spawn)
|
local function spawn_rabbit(pos)
|
||||||
spawn_desert.nodes = mobs_mc.spawn.desert
|
local biome_data = minetest.get_biome_data(pos)
|
||||||
spawn_desert.on_spawn = function(self, pos)
|
local biome_name = biome_data and minetest.get_biome_name(biome_data.biome) or ""
|
||||||
local texture = "mobs_mc_rabbit_gold.png"
|
local mob = minetest.add_entity(pos, mob_name)
|
||||||
self.base_texture = { "mobs_mc_rabbit_gold.png" }
|
if not mob then return end
|
||||||
self.object:set_properties({textures = self.base_texture})
|
local self = mob:get_luaentity()
|
||||||
end
|
|
||||||
mobs:spawn(spawn_desert)
|
|
||||||
|
|
||||||
local spawn_snow = table.copy(spawn)
|
|
||||||
spawn_snow.nodes = mobs_mc.spawn.snow
|
|
||||||
spawn_snow.on_spawn = function(self, pos)
|
|
||||||
local texture
|
local texture
|
||||||
local r = math.random(1, 100)
|
if biome_name:find("Desert") then
|
||||||
-- 80% white fur
|
texture = "mobs_mc_rabbit_gold.png"
|
||||||
if r <= 80 then
|
|
||||||
texture = "mobs_mc_rabbit_white.png"
|
|
||||||
-- 20% black and white fur
|
|
||||||
else
|
else
|
||||||
texture = "mobs_mc_rabbit_white_splotched.png"
|
local r = math.random(1, 100)
|
||||||
|
if biome_name:find("Ice") or biome_name:find("snow") or biome_name:find("Cold") then
|
||||||
|
-- 80% white fur
|
||||||
|
if r <= 80 then
|
||||||
|
texture = "mobs_mc_rabbit_white.png"
|
||||||
|
-- 20% black and white fur
|
||||||
|
else
|
||||||
|
texture = "mobs_mc_rabbit_white_splotched.png"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- 50% brown fur
|
||||||
|
if r <= 50 then
|
||||||
|
texture = "mobs_mc_rabbit_brown.png"
|
||||||
|
-- 40% salt fur
|
||||||
|
elseif r <= 90 then
|
||||||
|
texture = "mobs_mc_rabbit_salt.png"
|
||||||
|
-- 10% black fur
|
||||||
|
else
|
||||||
|
texture = "mobs_mc_rabbit_black.png"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self.base_texture = { texture }
|
self.base_texture = {texture}
|
||||||
self.object:set_properties({textures = self.base_texture})
|
self.object:set_properties({textures = {texture}})
|
||||||
end
|
end
|
||||||
mobs:spawn(spawn_snow)
|
|
||||||
|
|
||||||
local spawn_grass = table.copy(spawn)
|
local function do_custom_rabbit(self)
|
||||||
spawn_grass.nodes = mobs_mc.spawn.grassland
|
-- Easter egg: Change texture if rabbit is named “Toast”
|
||||||
spawn_grass.on_spawn = function(self, pos)
|
if self.nametag == "Toast" and not self._has_toast_texture then
|
||||||
local texture
|
self._original_rabbit_texture = self.base_texture
|
||||||
local r = math.random(1, 100)
|
self.base_texture = { "mobs_mc_rabbit_toast.png" }
|
||||||
-- 50% brown fur
|
self.object:set_properties({ textures = self.base_texture })
|
||||||
if r <= 50 then
|
self._has_toast_texture = true
|
||||||
texture = "mobs_mc_rabbit_brown.png"
|
elseif self.nametag ~= "Toast" and self._has_toast_texture then
|
||||||
-- 40% salt fur
|
self.base_texture = self._original_rabbit_texture
|
||||||
elseif r <= 90 then
|
self.object:set_properties({ textures = self.base_texture })
|
||||||
texture = "mobs_mc_rabbit_salt.png"
|
self._has_toast_texture = false
|
||||||
-- 10% black fur
|
|
||||||
else
|
|
||||||
texture = "mobs_mc_rabbit_black.png"
|
|
||||||
end
|
end
|
||||||
self.base_texture = { texture }
|
|
||||||
self.object:set_properties({textures = self.base_texture})
|
|
||||||
end
|
end
|
||||||
mobs:spawn(spawn_grass)
|
|
||||||
]]--
|
local rabbit = {
|
||||||
|
description = S("Rabbit"),
|
||||||
|
type = "animal",
|
||||||
|
spawn_class = "passive",
|
||||||
|
passive = true,
|
||||||
|
reach = 1,
|
||||||
|
rotate = 270,
|
||||||
|
hp_min = 3,
|
||||||
|
hp_max = 3,
|
||||||
|
xp_min = 1,
|
||||||
|
xp_max = 3,
|
||||||
|
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.49, 0.2},
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "mobs_mc_rabbit.b3d",
|
||||||
|
textures = textures,
|
||||||
|
visual_size = {x=1.5, y=1.5},
|
||||||
|
sounds = sounds,
|
||||||
|
makes_footstep_sound = false,
|
||||||
|
walk_velocity = 1,
|
||||||
|
run_velocity = 3.7,
|
||||||
|
follow_velocity = 1.1,
|
||||||
|
floats = 1,
|
||||||
|
runaway = true,
|
||||||
|
jump = true,
|
||||||
|
drops = {
|
||||||
|
{name = mobs_mc.items.rabbit_raw, chance = 1, min = 0, max = 1, looting = "common",},
|
||||||
|
{name = mobs_mc.items.rabbit_hide, chance = 1, min = 0, max = 1, looting = "common",},
|
||||||
|
{name = mobs_mc.items.rabbit_foot, chance = 10, min = 0, max = 1, looting = "rare", looting_factor = 0.03,},
|
||||||
|
},
|
||||||
|
fear_height = 4,
|
||||||
|
animation = {
|
||||||
|
speed_normal = 25, speed_run = 50,
|
||||||
|
stand_start = 0, stand_end = 0,
|
||||||
|
walk_start = 0, walk_end = 20,
|
||||||
|
run_start = 0, run_end = 20,
|
||||||
|
},
|
||||||
|
-- Follow (yellow) dangelions, carrots and golden carrots
|
||||||
|
follow = mobs_mc.follow.rabbit,
|
||||||
|
view_range = 8,
|
||||||
|
-- Eat carrots and reduce their growth stage by 1
|
||||||
|
replace_rate = 10,
|
||||||
|
replace_what = mobs_mc.replace.rabbit,
|
||||||
|
on_rightclick = function(self, clicker)
|
||||||
|
-- Feed, tame protect or capture
|
||||||
|
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
||||||
|
end,
|
||||||
|
do_custom = do_custom_rabbit,
|
||||||
|
spawn = spawn_rabbit
|
||||||
|
}
|
||||||
|
|
||||||
|
mobs:register_mob(mob_name, rabbit)
|
||||||
|
|
||||||
|
-- The killer bunny (Only with spawn egg)
|
||||||
|
local killer_bunny = table.copy(rabbit)
|
||||||
|
killer_bunny.description = S("Killer Bunny")
|
||||||
|
killer_bunny.type = "monster"
|
||||||
|
killer_bunny.spawn_class = "hostile"
|
||||||
|
killer_bunny.attack_type = "dogfight"
|
||||||
|
killer_bunny.specific_attack = { "player", "mobs_mc:wolf", "mobs_mc:dog" }
|
||||||
|
killer_bunny.damage = 8
|
||||||
|
killer_bunny.passive = false
|
||||||
|
-- 8 armor points
|
||||||
|
killer_bunny.armor = 50
|
||||||
|
killer_bunny.textures = { "mobs_mc_rabbit_caerbannog.png" }
|
||||||
|
killer_bunny.view_range = 16
|
||||||
|
killer_bunny.replace_rate = nil
|
||||||
|
killer_bunny.replace_what = nil
|
||||||
|
killer_bunny.on_rightclick = nil
|
||||||
|
killer_bunny.run_velocity = 6
|
||||||
|
killer_bunny.do_custom = function(self)
|
||||||
|
if not self._killer_bunny_nametag_set then
|
||||||
|
self.nametag = S("The Killer Bunny")
|
||||||
|
self._killer_bunny_nametag_set = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
mobs:register_mob("mobs_mc:killer_bunny", killer_bunny)
|
||||||
|
|
||||||
|
-- Mob spawning rules.
|
||||||
|
-- Different skins depending on spawn location <- we customized spawn function
|
||||||
|
|
||||||
|
mobs:spawn_setup({
|
||||||
|
name = mob_name,
|
||||||
|
min_light = 9,
|
||||||
|
chance = 1000,
|
||||||
|
aoc = 8,
|
||||||
|
biomes = biome_list,
|
||||||
|
group_size_max = 1,
|
||||||
|
baby_min = 1,
|
||||||
|
baby_max = 2,
|
||||||
|
})
|
||||||
|
|
||||||
-- Spawn egg
|
-- Spawn egg
|
||||||
mobs:register_egg("mobs_mc:rabbit", S("Rabbit"), "mobs_mc_spawn_icon_rabbit.png", 0)
|
mobs:register_egg("mobs_mc:rabbit", S("Rabbit"), "mobs_mc_spawn_icon_rabbit.png", 0)
|
||||||
|
|
|
@ -87,11 +87,11 @@ mobs:register_mob("mobs_mc:sheep", {
|
||||||
swap_y_with_x = false,
|
swap_y_with_x = false,
|
||||||
reverse_head_yaw = false,
|
reverse_head_yaw = false,
|
||||||
|
|
||||||
head_bone_pos_y = 3.6,
|
head_bone_pos_y = 0,
|
||||||
head_bone_pos_z = -0.6,
|
head_bone_pos_z = 0,
|
||||||
|
|
||||||
head_height_offset = 1.0525,
|
head_height_offset = 1.2,
|
||||||
head_direction_offset = 0.5,
|
head_direction_offset = 0,
|
||||||
head_pitch_modifier = 0,
|
head_pitch_modifier = 0,
|
||||||
--end head code
|
--end head code
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ mobs:register_mob("mobs_mc:sheep", {
|
||||||
},
|
},
|
||||||
animation = {
|
animation = {
|
||||||
speed_normal = 25, run_speed = 65,
|
speed_normal = 25, run_speed = 65,
|
||||||
stand_start = 40, stand_end = 80,
|
stand_start = 0, stand_end = 0,
|
||||||
walk_start = 0, walk_end = 40,
|
walk_start = 0, walk_end = 40,
|
||||||
run_start = 0, run_end = 40,
|
run_start = 0, run_end = 40,
|
||||||
},
|
},
|
||||||
|
@ -330,6 +330,24 @@ mobs:register_mob("mobs_mc:sheep", {
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
on_spawn = function(self)
|
||||||
|
if self.baby then
|
||||||
|
self.animation = table.copy(self.animation)
|
||||||
|
self.animation.stand_start = 81
|
||||||
|
self.animation.stand_end = 81
|
||||||
|
self.animation.walk_start = 81
|
||||||
|
self.animation.walk_end = 121
|
||||||
|
self.animation.run_start = 81
|
||||||
|
self.animation.run_end = 121
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
on_grown = function(self)
|
||||||
|
self.animation = nil
|
||||||
|
local anim = self.current_animation
|
||||||
|
self.current_animation = nil -- Mobs Redo does nothing otherwise
|
||||||
|
mobs.set_mob_animation(self, anim)
|
||||||
|
end
|
||||||
})
|
})
|
||||||
mobs:spawn_specific(
|
mobs:spawn_specific(
|
||||||
"mobs_mc:sheep",
|
"mobs_mc:sheep",
|
||||||
|
|
After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 477 B |
|
@ -712,6 +712,11 @@ local trade_inventory = {
|
||||||
elseif listname == "output" then
|
elseif listname == "output" then
|
||||||
if not trader_exists(player:get_player_name()) then
|
if not trader_exists(player:get_player_name()) then
|
||||||
return 0
|
return 0
|
||||||
|
-- Begin Award Code
|
||||||
|
-- May need to be moved if award gets unlocked in the wrong cases.
|
||||||
|
elseif trader_exists(player:get_player_name()) then
|
||||||
|
awards.unlock(player:get_player_name(), "mcl:whatAdeal")
|
||||||
|
-- End Award Code
|
||||||
end
|
end
|
||||||
-- Only allow taking full stack
|
-- Only allow taking full stack
|
||||||
local count = stack:get_count()
|
local count = stack:get_count()
|
||||||
|
|
|
@ -204,6 +204,7 @@ local zombie = {
|
||||||
attack_type = "punch",
|
attack_type = "punch",
|
||||||
punch_timer_cooloff = 0.5,
|
punch_timer_cooloff = 0.5,
|
||||||
harmed_by_heal = true,
|
harmed_by_heal = true,
|
||||||
|
spawn_with_armor = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
mobs:register_mob("mobs_mc:zombie", zombie)
|
mobs:register_mob("mobs_mc:zombie", zombie)
|
||||||
|
|
|
@ -238,8 +238,8 @@ after(5, function(dtime)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_chatcommand("lightning", {
|
minetest.register_chatcommand("lightning", {
|
||||||
params = "[<X> <Y> <Z>]",
|
params = "[<X> <Y> <Z> | <player name>]",
|
||||||
description = S("Let lightning strike at the specified position or yourself"),
|
description = S("Let lightning strike at the specified position or player. No parameter will strike yourself."),
|
||||||
privs = { maphack = true },
|
privs = { maphack = true },
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos = {}
|
local pos = {}
|
||||||
|
@ -247,21 +247,21 @@ minetest.register_chatcommand("lightning", {
|
||||||
pos.x = tonumber(pos.x)
|
pos.x = tonumber(pos.x)
|
||||||
pos.y = tonumber(pos.y)
|
pos.y = tonumber(pos.y)
|
||||||
pos.z = tonumber(pos.z)
|
pos.z = tonumber(pos.z)
|
||||||
|
local player_to_strike
|
||||||
if not (pos.x and pos.y and pos.z) then
|
if not (pos.x and pos.y and pos.z) then
|
||||||
pos = nil
|
pos = nil
|
||||||
|
player_to_strike = minetest.get_player_by_name(param)
|
||||||
|
if not player_to_strike and param == "" then
|
||||||
|
player_to_strike = minetest.get_player_by_name(name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if name == "" and pos == nil then
|
if not player_to_strike and pos == nil then
|
||||||
return false, "No position specified and unknown player"
|
return false, "No position specified and unknown player"
|
||||||
end
|
end
|
||||||
if pos then
|
if pos then
|
||||||
lightning.strike(pos)
|
lightning.strike(pos)
|
||||||
else
|
elseif player_to_strike then
|
||||||
local player = minetest.get_player_by_name(name)
|
lightning.strike(player_to_strike:get_pos())
|
||||||
if player then
|
|
||||||
lightning.strike(player:get_pos())
|
|
||||||
else
|
|
||||||
return false, S("No position specified and unknown player")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
# textdomain: lightning
|
||||||
|
@1 was struck by lightning.=@1 fuguèt pica·t·da per lo tròn
|
||||||
|
Let lightning strike at the specified position or yourself=Pica lo tròn vès una posicion mencionada o sobre vosautr·e·a·s-mema
|
||||||
|
No position specified and unknown player=Pas de posicion mencionada e jogair·e·a pas conegu·t·da
|
|
@ -1,4 +1,4 @@
|
||||||
# textdomain: lightning
|
# textdomain: lightning
|
||||||
@1 was struck by lightning.=@1 a été frappé(e) par la foudre.
|
@1 was struck by lightning.=@1 a été frappé(e) par la foudre.
|
||||||
Let lightning strike at the specified position or yourself=Fait frapper la foudre à la position spécifiée ou sur vous-même
|
Let lightning strike at the specified position or player. No parameter will strike yourself.=Fait frapper la foudre sur la position ou le joueur indiqué. Sans paramètre, la foudre frappera sur vous-même.
|
||||||
No position specified and unknown player=Aucune position spécifiée et joueur inconnu
|
No position specified and unknown player=Aucune position spécifiée et joueur inconnu
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# textdomain: lightning
|
# textdomain: lightning
|
||||||
@1 was struck by lightning.=
|
@1 was struck by lightning.=
|
||||||
Let lightning strike at the specified position or yourself=
|
Let lightning strike at the specified position or player. No parameter will strike yourself.=
|
||||||
No position specified and unknown player=
|
No position specified and unknown player=
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# textdomain: mcl_void_damage
|
||||||
|
The void is off-limits to you!=Lo voeida es defendut per vosautr·e·a·s !
|
||||||
|
@1 fell into the endless void.=@1 es tombar dins la voeida infinida.
|
|
@ -5,4 +5,4 @@ Error: No weather specified.=Erreur: Aucune météo spécifiée.
|
||||||
Error: Invalid parameters.=Erreur: Paramètres non valides.
|
Error: Invalid parameters.=Erreur: Paramètres non valides.
|
||||||
Error: Duration can't be less than 1 second.=Erreur: La durée ne peut pas être inférieure à 1 seconde.
|
Error: Duration can't be less than 1 second.=Erreur: La durée ne peut pas être inférieure à 1 seconde.
|
||||||
Error: Invalid weather specified. Use “clear”, “rain”, “snow” or “thunder”.=Erreur: Météo non valide spécifiée. Utilisez "clear" (clair), "rain" (pluie), "snow" (neige) ou "thunder" (tonnerre).
|
Error: Invalid weather specified. Use “clear”, “rain”, “snow” or “thunder”.=Erreur: Météo non valide spécifiée. Utilisez "clear" (clair), "rain" (pluie), "snow" (neige) ou "thunder" (tonnerre).
|
||||||
Toggles between clear weather and weather with downfall (randomly rain, thunderstorm or snow)=Bascule entre temps clair et temps avec chute (au hasard entre pluie, orage ou neige)
|
Toggles between clear weather and weather with downfall (randomly rain, thunderstorm or snow)=Bascule entre temps clair et temps avec des précipitations (au hasard entre pluie, orage ou neige)
|
||||||
|
|
|
@ -241,7 +241,7 @@ local function initsky(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- MC-style clouds: Layer 127, thickness 4, fly to the “West”
|
-- MC-style clouds: Layer 127, thickness 4, fly to the “West”
|
||||||
player:set_clouds({height=mcl_worlds.layer_to_y(127), speed={x=-2, z=0}, thickness=4, color="#FFF0FEF"})
|
player:set_clouds(mcl_worlds:get_cloud_parameters() or {height=mcl_worlds.layer_to_y(127), speed={x=-2, z=0}, thickness=4, color="#FFF0FEF"})
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_joinplayer(initsky)
|
minetest.register_on_joinplayer(initsky)
|
||||||
|
|
|
@ -611,11 +611,14 @@ do
|
||||||
io.close(file)
|
io.close(file)
|
||||||
if string then
|
if string then
|
||||||
local savetable = minetest.deserialize(string)
|
local savetable = minetest.deserialize(string)
|
||||||
for name, players_stored_data in pairs(savetable.players_stored_data) do
|
local savetable_players_stored_data = savetable and savetable.players_stored_data
|
||||||
doc.data.players[name] = {}
|
if savetable_players_stored_data then
|
||||||
doc.data.players[name].stored_data = players_stored_data
|
for name, players_stored_data in pairs(savetable_players_stored_data) do
|
||||||
|
doc.data.players[name] = {}
|
||||||
|
doc.data.players[name].stored_data = players_stored_data
|
||||||
|
end
|
||||||
|
minetest.log("action", "[doc] doc.mt successfully read.")
|
||||||
end
|
end
|
||||||
minetest.log("action", "[doc] doc.mt successfully read.")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,6 @@ Skeleton view range: -50%=
|
||||||
Creeper view range: -50%=
|
Creeper view range: -50%=
|
||||||
Damage: @1=
|
Damage: @1=
|
||||||
Damage (@1): @2=
|
Damage (@1): @2=
|
||||||
Durability: @1
|
|
||||||
Healing: @1=
|
Healing: @1=
|
||||||
Healing (@1): @2=
|
Healing (@1): @2=
|
||||||
Full punch interval: @1s=
|
Full punch interval: @1s=
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# textdomain:awards
|
# textdomain: awards
|
||||||
@1/@2 chat messages=@1/@2 chat messages
|
@1/@2 chat messages=@1/@2 chat messages
|
||||||
@1/@2 crafted=@1/@2 fabrication
|
@1/@2 crafted=@1/@2 fabrication
|
||||||
@1/@2 deaths=@1/@2 Mort
|
@1/@2 deaths=@1/@2 Mort
|
||||||
|
@ -6,12 +6,11 @@
|
||||||
@1/@2 game joins=@1/@2 sessions
|
@1/@2 game joins=@1/@2 sessions
|
||||||
@1/@2 placed=@1/@2 mis
|
@1/@2 placed=@1/@2 mis
|
||||||
@1 (got)=@1 (obtenu)
|
@1 (got)=@1 (obtenu)
|
||||||
@1: @1=@1: @1
|
@1: @2=@1: @2
|
||||||
@1’s awards:=Récompenses de @1:
|
@1’s awards:=Récompenses de @1:
|
||||||
(Secret Award)=(Récompense Secrètte)
|
(Secret Award)=(Récompense Secrètte)
|
||||||
<achievement ID>=<Succès ID>
|
<achievement ID>=<Succès ID>
|
||||||
<name>=<nom>
|
<name>=<nom>
|
||||||
A Cat in a Pop-Tart?!=Un chat beurré ?!
|
|
||||||
Achievement gotten!=Succès obtenu !
|
Achievement gotten!=Succès obtenu !
|
||||||
Achievement gotten:=Succès obtenu :
|
Achievement gotten:=Succès obtenu :
|
||||||
Achievement gotten: @1=Succès obtenu : @1
|
Achievement gotten: @1=Succès obtenu : @1
|
||||||
|
@ -28,9 +27,9 @@ Join the game.=Rejoignez le jeu.
|
||||||
List awards in chat (deprecated)=Liste des récompenses dans le chat (obsolète)
|
List awards in chat (deprecated)=Liste des récompenses dans le chat (obsolète)
|
||||||
Place a block: @1=Placer un bloc: @1
|
Place a block: @1=Placer un bloc: @1
|
||||||
Place blocks: @1×@2=Placer des blocs: @1×@2
|
Place blocks: @1×@2=Placer des blocs: @1×@2
|
||||||
Secret Achievement gotten!=Succès secret obtenu !
|
Secret achievement gotten!=Succès secret obtenu !
|
||||||
Secret Achievement gotten:=Succès secret obtenu :
|
Secret achievement gotten:=Succès secret obtenu :
|
||||||
Secret Achievement gotten: @1=Succès secret obtenu : @1
|
Secret achievement gotten: @1=Succès secret obtenu : @1
|
||||||
Show details of an achievement=Afficher les détails d'un succès
|
Show details of an achievement=Afficher les détails d'un succès
|
||||||
Show, clear, disable or enable your achievements=Affichez, effacez, désactivez ou activez vos succès
|
Show, clear, disable or enable your achievements=Affichez, effacez, désactivez ou activez vos succès
|
||||||
Get this achievement to find out what it is.=Obtenez ce succès pour découvrir de quoi il s'agit.
|
Get this achievement to find out what it is.=Obtenez ce succès pour découvrir de quoi il s'agit.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# textdomain:awards
|
# textdomain: awards
|
||||||
@1/@2 chat messages=
|
@1/@2 chat messages=
|
||||||
@1/@2 crafted=
|
@1/@2 crafted=
|
||||||
@1/@2 deaths=
|
@1/@2 deaths=
|
||||||
|
|
|
@ -101,6 +101,18 @@ awards.register_achievement("mcl:bookcase", {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
awards.register_achievement("mcl:buildIronPickaxe", {
|
||||||
|
title = S("Isn't It Iron Pick"),
|
||||||
|
-- TODO: This achievement should support all non-wood pickaxes
|
||||||
|
description = S("Craft a iron pickaxe using sticks and iron."),
|
||||||
|
icon = "default_tool_steelpick.png",
|
||||||
|
trigger = {
|
||||||
|
type = "craft",
|
||||||
|
item = "mcl_tools:pick_iron",
|
||||||
|
target = 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
-- Item pickup achievements: These are awarded when picking up a certain item.
|
-- Item pickup achievements: These are awarded when picking up a certain item.
|
||||||
-- The achivements are manually given in the mod mcl_item_entity.
|
-- The achivements are manually given in the mod mcl_item_entity.
|
||||||
awards.register_achievement("mcl:diamonds", {
|
awards.register_achievement("mcl:diamonds", {
|
||||||
|
@ -125,6 +137,24 @@ awards.register_achievement("mcl:mineWood", {
|
||||||
icon = "default_tree.png",
|
icon = "default_tree.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
awards.register_achievement("mcl:whosCuttingOnions", {
|
||||||
|
title = S("Who is Cutting Onions?"),
|
||||||
|
description = S("Pick up a crying obsidian from the floor."),
|
||||||
|
icon = "default_obsidian.png^mcl_core_crying_obsidian.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
awards.register_achievement("mcl:hiddenInTheDepths", {
|
||||||
|
title = S("Hidden in the Depths"),
|
||||||
|
description = S("Pick up an Ancient Debris from the floor."),
|
||||||
|
icon = "mcl_nether_ancient_debris_side.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
awards.register_achievement("mcl:notQuiteNineLives", {
|
||||||
|
title = S('Not Quite "Nine" Lives'),
|
||||||
|
description = S("Charge a Respawn Anchor to the maximum."),
|
||||||
|
icon = "respawn_anchor_side4.png",
|
||||||
|
})
|
||||||
|
|
||||||
-- Smelting achivements: These are awarded when picking up an item from a furnace
|
-- Smelting achivements: These are awarded when picking up an item from a furnace
|
||||||
-- output. They are given in mcl_furnaces.
|
-- output. They are given in mcl_furnaces.
|
||||||
awards.register_achievement("mcl:acquireIron", {
|
awards.register_achievement("mcl:acquireIron", {
|
||||||
|
@ -163,6 +193,73 @@ awards.register_achievement("mcl:buildNetherPortal", {
|
||||||
icon = "default_obsidian.png",
|
icon = "default_obsidian.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
awards.register_achievement("mcl:enterEndPortal", {
|
||||||
|
title = S("The End?"),
|
||||||
|
description = S("Or the beginning?\nHint: Enter an end portal."),
|
||||||
|
icon = "mcl_end_end_stone.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Triggered in mcl_totems
|
||||||
|
awards.register_achievement("mcl:postMortal", {
|
||||||
|
title = S("Postmortal"),
|
||||||
|
description = S("Use a Totem of Undying to cheat death."),
|
||||||
|
icon = "mcl_totems_totem.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Triggered in mcl_beds
|
||||||
|
awards.register_achievement("mcl:sweetDreams", {
|
||||||
|
title = S("Sweet Dreams"),
|
||||||
|
description = S("Sleep in a bed to change your respawn point."),
|
||||||
|
icon = "mcl_beds_bed_red.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Triggered in mcl_smithing_table
|
||||||
|
awards.register_achievement("mcl:seriousDedication", {
|
||||||
|
title = S("Serious Dedication"),
|
||||||
|
description = S("Use a Netherite Ingot to upgrade a hoe, and then completely reevaluate your life choices."),
|
||||||
|
icon = "farming_tool_netheritehoe.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Triggered in mobs_mc
|
||||||
|
awards.register_achievement("mcl:whatAdeal", {
|
||||||
|
title = S("What A Deal!"),
|
||||||
|
description = S("Successfully trade with a Villager."),
|
||||||
|
icon = "mcl_core_emerald.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Triggered in mcl_fishing
|
||||||
|
awards.register_achievement("mcl:fishyBusiness", {
|
||||||
|
title = S("Fishy Business"),
|
||||||
|
description = S("Catch a fish. \nHint: Catch a fish, salmon, clownfish, or pufferfish."),
|
||||||
|
icon = "mcl_fishing_fishing_rod.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Armor Advancements
|
||||||
|
--[[awards.register_achievement("mcl:suitUp", {
|
||||||
|
title = S("Suit Up"),
|
||||||
|
description = S("Protect yourself with a piece of iron armor."),
|
||||||
|
icon = "mcl_armor_inv_chestplate_iron.png",
|
||||||
|
})]]--
|
||||||
|
|
||||||
|
--[[awards.register_achievement("mcl:coverMeDiamonds", {
|
||||||
|
title = S("Cover Me with Diamonds"),
|
||||||
|
description = S("Diamond armor saves lives."),
|
||||||
|
icon = "mcl_armor_inv_chestplate_diamond.png",
|
||||||
|
})]]--
|
||||||
|
|
||||||
|
--[[awards.register_achievement("mcl:coverMeDebris", {
|
||||||
|
title = S("Cover Me in Debris"),
|
||||||
|
description = S("Get a full suit of Netherite armor."),
|
||||||
|
icon = "mcl_armor_inv_chestplate_netherite.png",
|
||||||
|
})]]--
|
||||||
|
|
||||||
|
-- Triggered in extra_mobs
|
||||||
|
awards.register_achievement("mcl:tacticalFishing", {
|
||||||
|
title = S("Tactical Fishing"),
|
||||||
|
description = S("Catch a fish... without a fishing rod!"),
|
||||||
|
icon = "pufferfish_bucket.png",
|
||||||
|
})
|
||||||
|
|
||||||
-- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.)
|
-- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.)
|
||||||
|
|
||||||
if non_pc_achievements then
|
if non_pc_achievements then
|
||||||
|
|
|
@ -10,7 +10,7 @@ Craft a stone pickaxe using sticks and cobblestone.=Fabriquez une pioche en pier
|
||||||
Craft a wooden sword using wooden planks and sticks on a crafting table.=Fabriquez une épée en bois à l'aide de planches et de bâtons en bois sur un établi.
|
Craft a wooden sword using wooden planks and sticks on a crafting table.=Fabriquez une épée en bois à l'aide de planches et de bâtons en bois sur un établi.
|
||||||
DIAMONDS!=DIAMANTS!
|
DIAMONDS!=DIAMANTS!
|
||||||
Delicious Fish=Délicieux Poisson
|
Delicious Fish=Délicieux Poisson
|
||||||
Dispense With This=Dispenser de ça
|
Dispense With This=Dispensé de ça
|
||||||
Eat a cooked porkchop.=Mangez du porc cuit.
|
Eat a cooked porkchop.=Mangez du porc cuit.
|
||||||
Eat a cooked rabbit.=Mangez du lapin cuit.
|
Eat a cooked rabbit.=Mangez du lapin cuit.
|
||||||
Get really desperate and eat rotten flesh.=Soyez vraiment désespéré et mangez de la chair pourrie.
|
Get really desperate and eat rotten flesh.=Soyez vraiment désespéré et mangez de la chair pourrie.
|
||||||
|
@ -47,3 +47,31 @@ Use a crafting table to craft a wooden hoe from wooden planks and sticks.=Utilis
|
||||||
Use a crafting table to craft a wooden pickaxe from wooden planks and sticks.=Utilisez un établi pour fabriquer une pioche en bois à partir de planches et de bâtons en bois.
|
Use a crafting table to craft a wooden pickaxe from wooden planks and sticks.=Utilisez un établi pour fabriquer une pioche en bois à partir de planches et de bâtons en bois.
|
||||||
Use obsidian and a fire starter to construct a Nether portal.=Utilisez de l'obsidienne et un briquet pour construire un portail du Nether.
|
Use obsidian and a fire starter to construct a Nether portal.=Utilisez de l'obsidienne et un briquet pour construire un portail du Nether.
|
||||||
Use wheat to craft a bread.=Utilisez du blé pour fabriquer un pain.
|
Use wheat to craft a bread.=Utilisez du blé pour fabriquer un pain.
|
||||||
|
Stone Age=L'Age de Pierre
|
||||||
|
Mine a stone with new pickaxe.=Miner de la roche avec une nouvelle pioche
|
||||||
|
Hot Stuff=Chaud Devant !
|
||||||
|
Put lava in a bucket.=Remplir un Seau de lave
|
||||||
|
Ice Bucket Challenge=Le défi du seau d'eau glacée
|
||||||
|
Obtain an obsidian block.=Obtenir un bloc d'obsidienne
|
||||||
|
Isn't It Iron Pick=Bonne Pioche !
|
||||||
|
Craft a iron pickaxe using sticks and iron.=Fabriquer une pioche de fer avec des batons et du fer
|
||||||
|
Who is Cutting Onions?=Qui épluche des oignons ?
|
||||||
|
Pick up a crying obsidian from the floor.=Ramasser une obsidienne pleureuse sur le sol.
|
||||||
|
Hidden in the Depths=Caché dans les profondeurs
|
||||||
|
Pick up an Ancient Debris from the floor.=Ramasser un Ancien Débris
|
||||||
|
Not Quite "Nine" Lives=Presque "neuf" vies
|
||||||
|
Charge a Respawn Anchor to the maximum.=Charger une Ancre de Réapparition au maximum.
|
||||||
|
The End?=L'End ?
|
||||||
|
Or the beginning?\nHint: Enter an end portal.=Ou le commencement ?\nAstuce : Entrer dans un portail de l'End.
|
||||||
|
Postmortal=Aux frontières de la mort
|
||||||
|
Use a Totem of Undying to cheat death.=Utiliser un Totem d'imortalité pour tromper la mort.
|
||||||
|
Sweet Dreams=Bonne nuit les petits
|
||||||
|
Sleep in a bed to change your respawn point.=Dormez dans un lit pour changer votre point de réapparition.
|
||||||
|
Serious Dedication=Sérieux dévouement
|
||||||
|
Use a Netherite Ingot to upgrade a hoe, and then completely reevaluate your life choices.=Utilisez un lingot de netherite pour améliorez une houe, puis réévaluez complètement vos choix de vie.
|
||||||
|
Fishy Business=Merci pour le poisson
|
||||||
|
Catch a fish. \nHint: Catch a fish, salmon, clownfish, or pufferfish.=Attrapez un poisson. \nAstuce : attrapez un poisson, saumon, poisson-clown, ou poisson-globe.
|
||||||
|
What A Deal!=Adjugé, Vendu !
|
||||||
|
Successfully trade with a Villager.=Commercez avec succès avec un villageois.
|
||||||
|
Tactical Fishing=Pêche tactique
|
||||||
|
Catch a fish... without a fishing rod=Attrapez un poisson... sans canne à pêche
|
|
@ -53,3 +53,25 @@ Hot Stuff=
|
||||||
Put lava in a bucket.=
|
Put lava in a bucket.=
|
||||||
Ice Bucket Challenge=
|
Ice Bucket Challenge=
|
||||||
Obtain an obsidian block.=
|
Obtain an obsidian block.=
|
||||||
|
Isn't It Iron Pick=
|
||||||
|
Craft a iron pickaxe using sticks and iron.=
|
||||||
|
Who is Cutting Onions?=
|
||||||
|
Pick up a crying obsidian from the floor.=
|
||||||
|
Hidden in the Depths=
|
||||||
|
Pick up an Ancient Debris from the floor.=
|
||||||
|
Not Quite "Nine" Lives=
|
||||||
|
Charge a Respawn Anchor to the maximum.=
|
||||||
|
The End?=
|
||||||
|
Or the beginning?\nHint: Enter an end portal.=
|
||||||
|
Postmortal=
|
||||||
|
Use a Totem of Undying to cheat death.=
|
||||||
|
Sweet Dreams=
|
||||||
|
Sleep in a bed to change your respawn point.=
|
||||||
|
Serious Dedication=
|
||||||
|
Use a Netherite Ingot to upgrade a hoe, and then completely reevaluate your life choices.=
|
||||||
|
Fishy Business=
|
||||||
|
Catch a fish. \nHint: Catch a fish, salmon, clownfish, or pufferfish.=
|
||||||
|
What A Deal!=
|
||||||
|
Successfully trade with a Villager.=
|
||||||
|
Tactical Fishing=
|
||||||
|
Catch a fish... without a fishing rod=
|
||||||
|
|
|
@ -6,6 +6,7 @@ Alexander Minges
|
||||||
aligator
|
aligator
|
||||||
ArTee3
|
ArTee3
|
||||||
Artem Arbatsky
|
Artem Arbatsky
|
||||||
|
balazsszalab
|
||||||
basxto
|
basxto
|
||||||
Benjamin Schötz
|
Benjamin Schötz
|
||||||
Blue Blancmange
|
Blue Blancmange
|
||||||
|
@ -13,6 +14,7 @@ Booglejr
|
||||||
Brandon
|
Brandon
|
||||||
Bu-Gee
|
Bu-Gee
|
||||||
bzoss
|
bzoss
|
||||||
|
CableGuy67
|
||||||
chmodsayshello
|
chmodsayshello
|
||||||
Code-Sploit
|
Code-Sploit
|
||||||
cora
|
cora
|
||||||
|
@ -31,6 +33,7 @@ Emojigit
|
||||||
epCode
|
epCode
|
||||||
erlehmann
|
erlehmann
|
||||||
FinishedFragment
|
FinishedFragment
|
||||||
|
FlamingRCCars
|
||||||
Glaucos Ginez
|
Glaucos Ginez
|
||||||
Gustavo Ramos Rehermann
|
Gustavo Ramos Rehermann
|
||||||
Guy Liner
|
Guy Liner
|
||||||
|
@ -39,6 +42,7 @@ HimbeerserverDE
|
||||||
iliekprogrammar
|
iliekprogrammar
|
||||||
j1233
|
j1233
|
||||||
Jared Moody
|
Jared Moody
|
||||||
|
Johannes Fritz
|
||||||
jordan4ibanez
|
jordan4ibanez
|
||||||
kabou
|
kabou
|
||||||
kay27
|
kay27
|
||||||
|
@ -46,13 +50,14 @@ Laurent Rocher
|
||||||
Li0n
|
Li0n
|
||||||
marcin-serwin
|
marcin-serwin
|
||||||
Marcin Serwin
|
Marcin Serwin
|
||||||
|
Mark Roth
|
||||||
Mental-Inferno
|
Mental-Inferno
|
||||||
Midgard
|
Midgard
|
||||||
MysticTempest
|
MysticTempest
|
||||||
Nicholas Niro
|
Nicholas Niro
|
||||||
nickolas360
|
nickolas360
|
||||||
Nicu
|
Nicu
|
||||||
nikolaus-albinger
|
Niklp
|
||||||
Nils Dagsson Moskopp
|
Nils Dagsson Moskopp
|
||||||
NO11
|
NO11
|
||||||
NO411
|
NO411
|
||||||
|
@ -60,6 +65,7 @@ Oil_boi
|
||||||
pitchum
|
pitchum
|
||||||
PrairieAstronomer
|
PrairieAstronomer
|
||||||
PrairieWind
|
PrairieWind
|
||||||
|
River River
|
||||||
Rocher Laurent
|
Rocher Laurent
|
||||||
rootyjr
|
rootyjr
|
||||||
Rootyjr
|
Rootyjr
|
||||||
|
@ -68,6 +74,7 @@ Sab Pyrope
|
||||||
Saku Laesvuori
|
Saku Laesvuori
|
||||||
sfan5
|
sfan5
|
||||||
SmallJoker
|
SmallJoker
|
||||||
|
Sumyjkl
|
||||||
superfloh247
|
superfloh247
|
||||||
Sven792
|
Sven792
|
||||||
Sydney Gems
|
Sydney Gems
|
||||||
|
@ -75,6 +82,7 @@ talamh
|
||||||
TechDudie
|
TechDudie
|
||||||
Thinking
|
Thinking
|
||||||
Tianyang Zhang
|
Tianyang Zhang
|
||||||
|
unknown
|
||||||
U.N.Owen
|
U.N.Owen
|
||||||
Wouters Dorian
|
Wouters Dorian
|
||||||
wuniversales
|
wuniversales
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
Please run the following command to update contributor list:
|
Please run `./update_credits.sh` from [tools](../../../tools) folder to update contributor list.
|
||||||
|
|
||||||
```bash
|
|
||||||
# git log --pretty="%an" | sort | uniq >CONTRUBUTOR_LIST.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
Please check that there is no error on execution, and `CONTRUBUTOR_LIST.txt` is updated.
|
Please check that there is no error on execution, and `CONTRUBUTOR_LIST.txt` is updated.
|
||||||
|
|
||||||
|
|
|
@ -1,59 +1,56 @@
|
||||||
# textdomain: mcl_death_messages
|
# textdomain: mcl_death_messages
|
||||||
@1 was fatally hit by an arrow.=@1 a été mortellement touché par une flèche.
|
@1 went up in flames=@1 a marché dans les flammes
|
||||||
@1 has been killed with an arrow.=@1 a été tué avec une flèche.
|
@1 walked into fire whilst fighting @2=@1 a marché dans les flammes en combattant @2
|
||||||
@1 was shot by an arrow from @2.=@1 a été abattu par une flèche de @2.
|
@1 was struck by lightning=@1 a été frappé par la foudre
|
||||||
@1 was shot by an arrow from a skeleton.=@1 a été abattu par une flèche d'un squelette.
|
@1 was struck by lightning whilst fighting @2=@1 a été frappé par la foudre en combattant @2
|
||||||
@1 was shot by an arrow from a stray.=@1 a été abattu par une flèche d'un vagabond.
|
@1 burned to death=@1 a brûlé vif
|
||||||
@1 was shot by an arrow from an illusioner.=@1 a été abattu par une flèche d'un illusionniste.
|
@1 was burnt to a crisp whilst fighting @2=@1 a brûlé comme une saucisse en combattant @2
|
||||||
@1 was shot by an arrow.=@1 a été abattu par une flèche.
|
@1 tried to swim in lava=@1 a tenté de nager dans la lave
|
||||||
@1 forgot to breathe.=@1 a oublié de respirer.
|
@1 tried to swim in lava to escape @2=@1 a tenté de nager dans la lave pour échapper à @2
|
||||||
@1 drowned.=@1 s'est noyé.
|
@1 discovered the floor was lava=@1 a découvert que le sol était en lave
|
||||||
@1 ran out of oxygen.=@1 a manqué d'oxygène.
|
@1 walked into danger zone due to @2=@1 a marché dans la zone de danger à cause de @2
|
||||||
@1 was killed by @2.=@1 a été tué par @2.
|
@1 suffocated in a wall=@1 est mort asphyxié dans un mur
|
||||||
@1 was killed.=@1 a été tué.
|
@1 suffocated in a wall whilst fighting @2=@1 est mort asphyxié dans un mur en combattant @2
|
||||||
@1 was killed by a mob.=@1 a été tué par un mob.
|
@1 drowned=@1 s'est noyé
|
||||||
@1 was burned to death by a blaze's fireball.=@1 a été brûlé vif par la boule de feu d'un blaze.
|
@1 drowned whilst trying to escape @2=@1 s'est noyé en essayant d'échapper à @2
|
||||||
@1 was killed by a fireball from a blaze.=@1 a été tué par une boule de feu lors d'un blaze.
|
@1 starved to death=@1 est mort de faim
|
||||||
@1 was burned by a fire charge.=@1 a été brûlé par un incendie.
|
@1 starved to death whilst fighting @2=@1 est mort de faim en combattant @2
|
||||||
A ghast scared @1 to death.=Un ghast a éffrayé @1 à mort.
|
@1 was pricked to death=@1 a été piqué à mort
|
||||||
@1 has been fireballed by a ghast.=@1 a été pétrifié par un ghast.
|
@1 walked into a cactus whilst trying to escape @2=@1 a marché dans un cactus en essayant d'échapper à @2
|
||||||
@1 fell from a high cliff.=@1 est tombé d'une haute falaise.
|
@1 hit the ground too hard=@1 a heurté le sol trop fort
|
||||||
@1 took fatal fall damage.=@1 a succombé à un chute mortelle.
|
@1 hit the ground too hard whilst trying to escape @2=@1 a heurté le sol trop fort en essayant d'échapper à @2
|
||||||
@1 fell victim to gravity.=@1 a été victime de la gravité.
|
@1 experienced kinetic energy=@1 a expérimenté l'énergie cinétique
|
||||||
@1 died.=@1 est mort.
|
@1 experienced kinetic energy whilst trying to escape @2=@1 a expérimenté l'énergie cinétique en essayant d'échapper à @2
|
||||||
@1 was killed by a zombie.=@1 a été tué par un zombie.
|
@1 fell out of the world=@1 est tombé hors du monde
|
||||||
@1 was killed by a baby zombie.=@1 a été tué par un bébé zombie.
|
@1 didn't want to live in the same world as @2=@1 ne voulait vivre dans le même monde que @2
|
||||||
@1 was killed by a blaze.=@1 a été tué par un blaze.
|
@1 died=@1 est mort
|
||||||
@1 was killed by a slime.=@1 a été tué par un slime.
|
@1 died because of @2=@1 est mort à cause de @2
|
||||||
@1 was killed by a witch.=@1 a été tué par un sorcier.
|
@1 was killed by magic=@1 a été tué par magie
|
||||||
@1 was killed by a magma cube.=@1 a été tué par un cube de magma.
|
@1 was killed by magic whilst trying to escape @2=@1 a été tué par magie en essayant d'échapper à @2
|
||||||
@1 was killed by a wolf.=@1 a été tué par un loup.
|
@1 was killed by @2 using magic=@1 a été tué par @2 en utilisant la magie
|
||||||
@1 was killed by a cat.=@1 a été tué par un chat.
|
@1 was killed by @2 using @3=@1 a été tué par @2 en utilisant @3
|
||||||
@1 was killed by an ocelot.=@1 a été tué par un ocelot.
|
@1 was roasted in dragon breath=@1 a été rôti dans le souffle du dragon
|
||||||
@1 was killed by an ender dragon.=@1 a été tué par un ender dragon.
|
@1 was roasted in dragon breath by @2=@1 a été rôti dans le souffle du dragon par @2
|
||||||
@1 was killed by a wither.=@1 a été tué par un wither.
|
@1 withered away=@1 s'est flétri
|
||||||
@1 was killed by an enderman.=@1 a été tué par un enderman.
|
@1 withered away whilst fighting @2=@1 s'est flétri en combattant @2
|
||||||
@1 was killed by an endermite.=@1 a été tué par un endermite.
|
@1 was shot by a skull from @2=@1 a été abattu par un crane de @2
|
||||||
@1 was killed by a ghast.=@1 a été tué par un ghast.
|
@1 was squashed by a falling anvil=@1 a été écrasé par une enclume
|
||||||
@1 was killed by an elder guardian.=@1 a été tué par un grand gardien.
|
@1 was squashed by a falling anvil whilst fighting @2=@1 a été écrasé par une enclume en combattant @2
|
||||||
@1 was killed by a guardian.=@1 a été tué par un gardien.
|
@1 was squashed by a falling block=@1 a été écrasé par un bloc tombant
|
||||||
@1 was killed by an iron golem.=@1 a été tué par un golem de fer.
|
@1 was squashed by a falling block whilst fighting @2=@1 a été écrasé par un bloc tombant en combattant @2
|
||||||
@1 was killed by a polar_bear.=@1 a été tué par un ours blanc.
|
@1 was slain by @2=@1 a été tué par @2
|
||||||
@1 was killed by a killer bunny.=@1 a été tué par un lapin tueur.
|
@1 was slain by @2 using @3=@1 a été tué par @2 avec @3
|
||||||
@1 was killed by a shulker.=@1 a été tué par un shulker.
|
@1 was shot by @2=@1 a été abattu par @2
|
||||||
@1 was killed by a silverfish.=@1 a été tué par un poisson d'argent.
|
@1 was shot by @2 using @3=@1 a été abattu par @2 avec @3
|
||||||
@1 was killed by a skeleton.=@1 a été tué par un squelette.
|
@1 was fireballed by @2=@1 a reçu une boule de feu de @2
|
||||||
@1 was killed by a stray.=@1 a été tué par un vagabond.
|
@1 was fireballed by @2 using @3=@1 a reçu une boule de feu de @2 en utilisant @3
|
||||||
@1 was killed by a slime.=@1 a été tué par un slime.
|
@1 was killed trying to hurt @2=@1 a été tué en essayant de blesser @2
|
||||||
@1 was killed by a spider.=@1 a été tué par une araignée.
|
@1 was killed by @3 trying to hurt @2=@1 a été tué par @3 en essayant de blesser @2
|
||||||
@1 was killed by a cave spider.=@1 a été tué par une araignée venimeuse.
|
@1 blew up=@1 a explosé
|
||||||
@1 was killed by a vex.=@1 a été tué par un vex.
|
@1 was blown up by @2=@1 a été explosé par @2
|
||||||
@1 was killed by an evoker.=@1 a été tué par un invocateur.
|
@1 was blown up by @2 using @3=@1 a été explosé par @2 en utilisant @3
|
||||||
@1 was killed by an illusioner.=@1 a été tué par un illusionniste.
|
@1 was squished too much=@1 a été trop écrabouillé
|
||||||
@1 was killed by a vindicator.=@1 a été tué par un vindicateur.
|
@1 was squashed by @2=@1 a été écrasé par @2
|
||||||
@1 was killed by a zombie villager.=@1 a été tué par un villageois zombie.
|
@1 went off with a bang=@1 est parti avec un bang
|
||||||
@1 was killed by a husk.=@1 a été tué par un zombie momie.
|
@1 went off with a bang due to a firework fired from @3 by @2=@1 est parti avec un bang à cause d'un feu d'artifice tiré de @3 par @2
|
||||||
@1 was killed by a baby husk.=@1 a été tué par un bébé zombie momie.
|
|
||||||
@1 was killed by a zombie pigman.=@1 a été tué par un zombie-couchon.
|
|
||||||
@1 was killed by a baby zombie pigman.=@1 a été tué par un bébé zombie-couchon
|
|
||||||
@1 was slain by @2.=@1 a été tué par @2
|
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
@1 was roasted in dragon breath by @2=
|
@1 was roasted in dragon breath by @2=
|
||||||
@1 withered away=
|
@1 withered away=
|
||||||
@1 withered away whilst fighting @2=
|
@1 withered away whilst fighting @2=
|
||||||
@1 was killed by magic=
|
|
||||||
@1 was shot by a skull from @2=
|
@1 was shot by a skull from @2=
|
||||||
@1 was squashed by a falling anvil=
|
@1 was squashed by a falling anvil=
|
||||||
@1 was squashed by a falling anvil whilst fighting @2=
|
@1 was squashed by a falling anvil whilst fighting @2=
|
||||||
|
@ -41,8 +40,6 @@
|
||||||
@1 was squashed by a falling block whilst fighting @2=
|
@1 was squashed by a falling block whilst fighting @2=
|
||||||
@1 was slain by @2=
|
@1 was slain by @2=
|
||||||
@1 was slain by @2 using @3=
|
@1 was slain by @2 using @3=
|
||||||
@1 was slain by @2=
|
|
||||||
@1 was slain by @2 using @3=
|
|
||||||
@1 was shot by @2=
|
@1 was shot by @2=
|
||||||
@1 was shot by @2 using @3=
|
@1 was shot by @2 using @3=
|
||||||
@1 was fireballed by @2=
|
@1 was fireballed by @2=
|
||||||
|
|
|
@ -5,3 +5,4 @@ Error: Too many parameters!=Erreur: Trop de paramètres!
|
||||||
Error: Incorrect value of XP=Erreur: Valeur incorrecte de XP
|
Error: Incorrect value of XP=Erreur: Valeur incorrecte de XP
|
||||||
Error: Player not found=Erreur: Joueur introuvable
|
Error: Player not found=Erreur: Joueur introuvable
|
||||||
Added @1 XP to @2, total: @3, experience level: @4=Ajout de @1 XP à @2, total: @3, niveau d'expérience: @4
|
Added @1 XP to @2, total: @3, experience level: @4=Ajout de @1 XP à @2, total: @3, niveau d'expérience: @4
|
||||||
|
Bottle o' Enchanting=Fiole d'expérience
|
|
@ -1,14 +1,20 @@
|
||||||
local refresh_interval = .63
|
local refresh_interval = .63
|
||||||
local huds = {}
|
local huds = {}
|
||||||
local default_debug = 3
|
local default_debug = 5
|
||||||
local after = minetest.after
|
local after = minetest.after
|
||||||
local get_connected_players = minetest.get_connected_players
|
local get_connected_players = minetest.get_connected_players
|
||||||
local get_biome_name = minetest.get_biome_name
|
local get_biome_name = minetest.get_biome_name
|
||||||
local get_biome_data = minetest.get_biome_data
|
local get_biome_data = minetest.get_biome_data
|
||||||
|
local get_node = minetest.get_node
|
||||||
local format = string.format
|
local format = string.format
|
||||||
|
local table_concat = table.concat
|
||||||
|
local floor = math.floor
|
||||||
|
local minetest_get_gametime = minetest.get_gametime
|
||||||
|
local get_voxel_manip = minetest.get_voxel_manip
|
||||||
|
|
||||||
local min1, min2, min3 = mcl_mapgen.overworld.min, mcl_mapgen.end_.min, mcl_mapgen.nether.min
|
local min1, min2, min3 = mcl_mapgen.overworld.min, mcl_mapgen.end_.min, mcl_mapgen.nether.min
|
||||||
local max1, max2, max3 = mcl_mapgen.overworld.max, mcl_mapgen.end_.max, mcl_mapgen.nether.max + 128
|
local max1, max2, max3 = mcl_mapgen.overworld.max, mcl_mapgen.end_.max, mcl_mapgen.nether.max + 128
|
||||||
|
local CS = mcl_mapgen.CS_NODES
|
||||||
|
|
||||||
local modname = minetest.get_current_modname()
|
local modname = minetest.get_current_modname()
|
||||||
local modpath = minetest.get_modpath(modname)
|
local modpath = minetest.get_modpath(modname)
|
||||||
|
@ -17,6 +23,7 @@ local storage = minetest.get_mod_storage()
|
||||||
local player_dbg = minetest.deserialize(storage:get_string("player_dbg") or "return {}") or {}
|
local player_dbg = minetest.deserialize(storage:get_string("player_dbg") or "return {}") or {}
|
||||||
|
|
||||||
local function get_text(pos, bits)
|
local function get_text(pos, bits)
|
||||||
|
local pos = pos
|
||||||
local bits = bits
|
local bits = bits
|
||||||
if bits == 0 then return "" end
|
if bits == 0 then return "" end
|
||||||
local y = pos.y
|
local y = pos.y
|
||||||
|
@ -27,16 +34,42 @@ local function get_text(pos, bits)
|
||||||
elseif y >= min2 and y <= max2 then
|
elseif y >= min2 and y <= max2 then
|
||||||
y = y - min2
|
y = y - min2
|
||||||
end
|
end
|
||||||
local biome_data = get_biome_data(pos)
|
|
||||||
local biome_name = biome_data and get_biome_name(biome_data.biome) or "No biome"
|
local will_show_mapgen_status = bits % 8 > 3
|
||||||
local text
|
local will_show_coordinates = bits % 4 > 1
|
||||||
if bits == 1 then
|
local will_show_biome_name = bits % 2 > 0
|
||||||
text = biome_name
|
local will_be_shown = {}
|
||||||
elseif bits == 2 then
|
|
||||||
text = format("x:%.1f y:%.1f z:%.1f", pos.x, y, pos.z)
|
if will_show_biome_name then
|
||||||
elseif bits == 3 then
|
local biome_data = get_biome_data(pos)
|
||||||
text = format("%s x:%.1f y:%.1f z:%.1f", biome_name, pos.x, y, pos.z)
|
local biome_name = biome_data and get_biome_name(biome_data.biome) or "No biome"
|
||||||
|
will_be_shown[#will_be_shown + 1] = biome_name
|
||||||
end
|
end
|
||||||
|
if will_show_coordinates then
|
||||||
|
local coordinates = format("x:%.1f y:%.1f z:%.1f", pos.x, y, pos.z)
|
||||||
|
will_be_shown[#will_be_shown + 1] = coordinates
|
||||||
|
end
|
||||||
|
if will_show_mapgen_status then
|
||||||
|
local pos_x = floor(pos.x)
|
||||||
|
local pos_y = floor(pos.y)
|
||||||
|
local pos_z = floor(pos.z)
|
||||||
|
local c = 0
|
||||||
|
for x = pos_x - CS, pos_x + CS, CS do
|
||||||
|
for y = pos_y - CS, pos_y + CS, CS do
|
||||||
|
for z = pos_z - CS, pos_z + CS, CS do
|
||||||
|
local pos = {x = x, y = y, z = z}
|
||||||
|
get_voxel_manip():read_from_map(pos, pos)
|
||||||
|
local node = get_node(pos)
|
||||||
|
if node.name ~= "ignore" then c = c + 1 end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local p = floor(c / 27 * 100 + 0.5)
|
||||||
|
local status = format("Generated %u%% (%u/27 chunks)", p, c)
|
||||||
|
will_be_shown[#will_be_shown + 1] = status
|
||||||
|
end
|
||||||
|
|
||||||
|
local text = table_concat(will_be_shown, ' ')
|
||||||
return text
|
return text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -82,14 +115,14 @@ minetest.register_on_authplayer(function(name, ip, is_success)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_chatcommand("debug",{
|
minetest.register_chatcommand("debug",{
|
||||||
description = S("Set debug bit mask: 0 = disable, 1 = biome name, 2 = coordinates, 3 = all"),
|
description = S("Set debug bit mask: 0 = disable, 1 = biome name, 2 = coordinates, 4 = mapgen status, 7 = all"),
|
||||||
func = function(name, params)
|
func = function(name, params)
|
||||||
local dbg = math.floor(tonumber(params) or default_debug)
|
local dbg = math.floor(tonumber(params) or default_debug)
|
||||||
if dbg < 0 or dbg > 3 then
|
if dbg < 0 or dbg > 7 then
|
||||||
minetest.chat_send_player(name, S("Error! Possible values are integer numbers from @1 to @2", 0, 3))
|
minetest.chat_send_player(name, S("Error! Possible values are integer numbers from @1 to @2", 0, 7))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if dbg == default_dbg then
|
if dbg == default_debug then
|
||||||
player_dbg[name] = nil
|
player_dbg[name] = nil
|
||||||
else
|
else
|
||||||
player_dbg[name] = dbg
|
player_dbg[name] = dbg
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
# textdomain: mcl_info
|
||||||
|
Set debug bit mask: 0 @= disable, 1 @= biome name, 2 @= coordinates, 4 @= mapgen status, 7 @= all=Réglage du masque de débugage : 0 @= désactiver, 1 @= nom de biome, 2 @= coordonnées, 4 @= mapgen status, 7 @= tout=
|
||||||
|
Error! Possible values are integer numbers from @1 to @2=Erreur ! Les valeurs autorisées sont des nombres entiers de @1 à @2
|
||||||
|
Debug bit mask set to @1=Masque de débugage réglé à @1
|
|
@ -1,4 +1,4 @@
|
||||||
# textdomain: mcl_info
|
# textdomain: mcl_info
|
||||||
Set debug bit mask: 0 @= disable, 1 @= biome name, 2 @= coordinates, 3 @= all=Установка отладочной битовой маски: 0 @= отключить, 1 @= биом, 2 @= координаты, 3 @= всё
|
Set debug bit mask: 0 @= disable, 1 @= biome name, 2 @= coordinates, 4 @= mapgen status, 7 @= all=Установка отладочной битовой маски: 0 @= отключить, 1 @= биом, 2 @= координаты, 4 @= состояние мапгена, 7 @= всё
|
||||||
Error! Possible values are integer numbers from @1 to @2=Ошибка! Допустимые значения - целые числа от @1 до @2
|
Error! Possible values are integer numbers from @1 to @2=Ошибка! Допустимые значения - целые числа от @1 до @2
|
||||||
Debug bit mask set to @1=Отладочной битовой маске присвоено значение @1
|
Debug bit mask set to @1=Отладочной битовой маске присвоено значение @1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# textdomain: mcl_info
|
# textdomain: mcl_info
|
||||||
Set debug bit mask: 0 @= disable, 1 @= biome name, 2 @= coordinates, 3 @= all=
|
Set debug bit mask: 0 @= disable, 1 @= biome name, 2 @= coordinates, 4 @= mapgen status, 7 @= all=
|
||||||
Error! Possible values are integer numbers from @1 to @2=
|
Error! Possible values are integer numbers from @1 to @2=
|
||||||
Debug bit mask set to @1=
|
Debug bit mask set to @1=
|
||||||
|
|
|
@ -339,14 +339,6 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size,
|
||||||
if name == "inv" then
|
if name == "inv" then
|
||||||
inv_bg = "crafting_inventory_creative_survival.png"
|
inv_bg = "crafting_inventory_creative_survival.png"
|
||||||
|
|
||||||
-- Show armor and player image
|
|
||||||
local player_preview
|
|
||||||
if minetest.settings:get_bool("3d_player_preview", true) then
|
|
||||||
player_preview = mcl_player.get_player_formspec_model(player, 3.9, 1.4, 1.2333, 2.4666, "")
|
|
||||||
else
|
|
||||||
player_preview = "image[3.9,1.4;1.2333,2.4666;"..mcl_player.player_get_preview(player).."]"
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Background images for armor slots (hide if occupied)
|
-- Background images for armor slots (hide if occupied)
|
||||||
local armor_slot_imgs = ""
|
local armor_slot_imgs = ""
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
|
@ -386,8 +378,7 @@ function mcl_inventory.set_creative_formspec(player, start_i, pagenum, inv_size,
|
||||||
|
|
||||||
armor_slot_imgs..
|
armor_slot_imgs..
|
||||||
-- player preview
|
-- player preview
|
||||||
player_preview..
|
mcl_player.get_player_formspec_model(player, 3.9, 1.4, 1.2333, 2.4666, "")..
|
||||||
|
|
||||||
-- crafting guide button
|
-- crafting guide button
|
||||||
"image_button[9,1;1,1;craftguide_book.png;__mcl_craftguide;]"..
|
"image_button[9,1;1,1;craftguide_book.png;__mcl_craftguide;]"..
|
||||||
"tooltip[__mcl_craftguide;"..F(S("Recipe book")).."]"..
|
"tooltip[__mcl_craftguide;"..F(S("Recipe book")).."]"..
|
||||||
|
|
|
@ -61,14 +61,6 @@ local function set_inventory(player, armor_change_only)
|
||||||
inv:set_width("craft", 2)
|
inv:set_width("craft", 2)
|
||||||
inv:set_size("craft", 4)
|
inv:set_size("craft", 4)
|
||||||
|
|
||||||
-- Show armor and player image
|
|
||||||
local player_preview
|
|
||||||
if minetest.settings:get_bool("3d_player_preview", true) then
|
|
||||||
player_preview = mcl_player.get_player_formspec_model(player, 1.0, 0.0, 2.25, 4.5, "")
|
|
||||||
else
|
|
||||||
player_preview = "image[1.1,0.2;2,4;"..mcl_player.player_get_preview(player).."]"
|
|
||||||
end
|
|
||||||
|
|
||||||
local armor_slots = {"helmet", "chestplate", "leggings", "boots"}
|
local armor_slots = {"helmet", "chestplate", "leggings", "boots"}
|
||||||
local armor_slot_imgs = ""
|
local armor_slot_imgs = ""
|
||||||
for a=1,4 do
|
for a=1,4 do
|
||||||
|
@ -83,7 +75,7 @@ local function set_inventory(player, armor_change_only)
|
||||||
|
|
||||||
local form = "size[9,8.75]"..
|
local form = "size[9,8.75]"..
|
||||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]"..
|
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]"..
|
||||||
player_preview..
|
mcl_player.get_player_formspec_model(player, 1.0, 0.0, 2.25, 4.5, "")..
|
||||||
--armor
|
--armor
|
||||||
"list[current_player;armor;0,0;1,1;1]"..
|
"list[current_player;armor;0,0;1,1;1]"..
|
||||||
"list[current_player;armor;0,1;1,1;2]"..
|
"list[current_player;armor;0,1;1,1;2]"..
|
||||||
|
|
|
@ -3,6 +3,7 @@ Recipe book=Livre de recettes
|
||||||
Help=Aide
|
Help=Aide
|
||||||
Select player skin=Sélectionnez l'apparence du joueur
|
Select player skin=Sélectionnez l'apparence du joueur
|
||||||
Achievements=Accomplissements
|
Achievements=Accomplissements
|
||||||
|
Switch stack size=Échanger les tailles de piles
|
||||||
Building Blocks=Blocs de Construction
|
Building Blocks=Blocs de Construction
|
||||||
Decoration Blocks=Blocs de Décoration
|
Decoration Blocks=Blocs de Décoration
|
||||||
Redstone=Redstone
|
Redstone=Redstone
|
||||||
|
|
|
@ -17,6 +17,7 @@ minetest.register_node("mcl_bells:bell", {
|
||||||
4/16, 7/16, 4/16,
|
4/16, 7/16, 4/16,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
groups = { pickaxey = 1 }
|
||||||
})
|
})
|
||||||
|
|
||||||
if has_mcl_wip then
|
if has_mcl_wip then
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
# textdomain: mcl_bells
|
||||||
|
Bell=Cloche
|
|
@ -1,2 +1,2 @@
|
||||||
# textdomain: mcl_observers
|
# textdomain: mcl_bells
|
||||||
Bell=
|
Bell=
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
local S = minetest.get_translator("mcl_target")
|
||||||
|
|
||||||
|
local mod_farming = minetest.get_modpath("mcl_farming")
|
||||||
|
|
||||||
|
mcl_target = {}
|
||||||
|
|
||||||
|
function mcl_target.hit(pos, time)
|
||||||
|
minetest.set_node(pos, {name="mcl_target:target_on"})
|
||||||
|
mesecon.receptor_on(pos, mesecon.rules.alldirs)
|
||||||
|
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
timer:start(time)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("mcl_target:target_off", {
|
||||||
|
description = S("Target"),
|
||||||
|
_doc_items_longdesc = S("A target is a block that provides a temporary redstone charge when hit by a projectile."),
|
||||||
|
_doc_items_usagehelp = S("Throw a projectile on the target to activate it."),
|
||||||
|
tiles = {"mcl_target_target_top.png", "mcl_target_target_top.png", "mcl_target_target_side.png"},
|
||||||
|
groups = {hoey = 1},
|
||||||
|
sounds = mcl_sounds.node_sound_dirt_defaults({
|
||||||
|
footstep = {name="default_grass_footstep", gain=0.1},
|
||||||
|
}),
|
||||||
|
mesecons = {
|
||||||
|
receptor = {
|
||||||
|
state = mesecon.state.off,
|
||||||
|
rules = mesecon.rules.alldirs,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
_mcl_blast_resistance = 0.5,
|
||||||
|
_mcl_hardness = 0.5,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("mcl_target:target_on", {
|
||||||
|
description = S("Target"),
|
||||||
|
_doc_items_create_entry = false,
|
||||||
|
tiles = {"mcl_target_target_top.png", "mcl_target_target_top.png", "mcl_target_target_side.png"},
|
||||||
|
groups = {hoey = 1, not_in_creative_inventory = 1},
|
||||||
|
drop = "mcl_target:target_off",
|
||||||
|
sounds = mcl_sounds.node_sound_dirt_defaults({
|
||||||
|
footstep = {name="default_grass_footstep", gain=0.1},
|
||||||
|
}),
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if node.name == "mcl_target:target_on" then --has not been dug
|
||||||
|
minetest.set_node(pos, {name="mcl_target:target_off"})
|
||||||
|
mesecon.receptor_off(pos, mesecon.rules.alldirs)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
mesecons = {
|
||||||
|
receptor = {
|
||||||
|
state = mesecon.state.on,
|
||||||
|
rules = mesecon.rules.alldirs,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
_mcl_blast_resistance = 0.5,
|
||||||
|
_mcl_hardness = 0.5,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
if mod_farming then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "mcl_target:target_off",
|
||||||
|
recipe = {
|
||||||
|
{"", "mesecons:redstone", ""},
|
||||||
|
{"mesecons:redstone", "mcl_farming:hay_block", "mesecons:redstone"},
|
||||||
|
{"", "mesecons:redstone", ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# textdomain: mcl_target
|
||||||
|
Target=Cible
|
||||||
|
A target is a block that provides a temporary redstone charge when hit by a projectile.=La cible est un bloc qui se comporte comme une source d'énergie temporaire quand elle est frappée par un projectile.
|
||||||
|
Throw a projectile on the target to activate it.=Lancer un projectile sur la cible pour l'activer.
|
|
@ -0,0 +1,4 @@
|
||||||
|
# textdomain: mcl_target
|
||||||
|
Target=
|
||||||
|
A target is a block that provides a temporary redstone charge when hit by a projectile.=
|
||||||
|
Throw a projectile on the target to activate it.=
|
|
@ -0,0 +1,3 @@
|
||||||
|
name = mcl_target
|
||||||
|
author = AFCMS
|
||||||
|
depends = mesecons, mcl_sounds
|
After Width: | Height: | Size: 752 B |
After Width: | Height: | Size: 752 B |
|
@ -216,6 +216,18 @@ mesecon.register_button(
|
||||||
S("A stone button is a redstone component made out of stone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second."),
|
S("A stone button is a redstone component made out of stone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second."),
|
||||||
"mesecons_button_push")
|
"mesecons_button_push")
|
||||||
|
|
||||||
|
mesecon.register_button(
|
||||||
|
"polished_blackstone",
|
||||||
|
S("Polished Blackstone Button"),
|
||||||
|
"mcl_blackstone_polished.png",
|
||||||
|
"mcl_blackstone:blackstone_polished",
|
||||||
|
mcl_sounds.node_sound_stone_defaults(),
|
||||||
|
{material_stone=1,handy=1,pickaxey=1},
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
S("A polished blackstone button is a redstone component made out of polished blackstone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second."),
|
||||||
|
"mesecons_button_push")
|
||||||
|
|
||||||
local woods = {
|
local woods = {
|
||||||
{ "wood", "mcl_core:wood", "default_wood.png", S("Oak Button") },
|
{ "wood", "mcl_core:wood", "default_wood.png", S("Oak Button") },
|
||||||
{ "acaciawood", "mcl_core:acaciawood", "default_acacia_wood.png", S("Acacia Button") },
|
{ "acaciawood", "mcl_core:acaciawood", "default_acacia_wood.png", S("Acacia Button") },
|
||||||
|
@ -223,6 +235,8 @@ local woods = {
|
||||||
{ "darkwood", "mcl_core:darkwood", "mcl_core_planks_big_oak.png", S("Dark Oak Button") },
|
{ "darkwood", "mcl_core:darkwood", "mcl_core_planks_big_oak.png", S("Dark Oak Button") },
|
||||||
{ "sprucewood", "mcl_core:sprucewood", "mcl_core_planks_spruce.png", S("Spruce Button") },
|
{ "sprucewood", "mcl_core:sprucewood", "mcl_core_planks_spruce.png", S("Spruce Button") },
|
||||||
{ "junglewood", "mcl_core:junglewood", "default_junglewood.png", S("Jungle Button") },
|
{ "junglewood", "mcl_core:junglewood", "default_junglewood.png", S("Jungle Button") },
|
||||||
|
{ "warped_hyphae_wood", "mcl_mushroom:warped_hyphae_wood", "warped_hyphae_wood.png", S("Warped Hyphae Button") },
|
||||||
|
{ "crimson_hyphae_wood", "mcl_mushroom:crimson_hyphae_wood", "crimson_hyphae_wood.png", S("Crimson Hyphae Button") },
|
||||||
}
|
}
|
||||||
|
|
||||||
for w=1, #woods do
|
for w=1, #woods do
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# textdomain: mesecons_button
|
# textdomain: mesecons_button
|
||||||
Use the button to push it.=Utilisez le bouton pour le pousser.
|
Use the button to push it.=Utilisez le bouton pour le pousser.
|
||||||
Stone Button=Bouton de pierre
|
Stone Button=Bouton de pierre
|
||||||
|
Polished Blackstone Button=Bouton de Pierre Noire Polie
|
||||||
A stone button is a redstone component made out of stone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second.=Un bouton en pierre est un composant Redstone en pierre qui peut être poussé pour fournir de la puissance Redstone. Lorsqu'il est poussé, il alimente les composants Redstone adjacents pendant 1 seconde.
|
A stone button is a redstone component made out of stone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second.=Un bouton en pierre est un composant Redstone en pierre qui peut être poussé pour fournir de la puissance Redstone. Lorsqu'il est poussé, il alimente les composants Redstone adjacents pendant 1 seconde.
|
||||||
Oak Button=Bouton en Chêne
|
Oak Button=Bouton en Chêne
|
||||||
Acacia Button=Bouton en Acacia
|
Acacia Button=Bouton en Acacia
|
||||||
|
@ -8,6 +9,8 @@ Birch Button=Bouton en Bouleau
|
||||||
Dark Oak Button=Bouton en Chêne Noir
|
Dark Oak Button=Bouton en Chêne Noir
|
||||||
Spruce Button=Bouton en Sapin
|
Spruce Button=Bouton en Sapin
|
||||||
Jungle Button=Bouton en Acajou
|
Jungle Button=Bouton en Acajou
|
||||||
|
Warped Hyphae Button=Bouton en Hyphae Tordu
|
||||||
|
Crimson Hyphae Button=Bouton en Hyphae Ecarlate
|
||||||
A wooden button is a redstone component made out of wood which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1.5 seconds. Wooden buttons may also be pushed by arrows.=Un bouton en bois est un composant de redstone en bois qui peut être poussé pour fournir une puissance de redstone. Lorsqu'il est poussé, il alimente les composants Redstone adjacents pendant 1,5 seconde. Les boutons en bois peuvent également être poussés par des flèches.
|
A wooden button is a redstone component made out of wood which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1.5 seconds. Wooden buttons may also be pushed by arrows.=Un bouton en bois est un composant de redstone en bois qui peut être poussé pour fournir une puissance de redstone. Lorsqu'il est poussé, il alimente les composants Redstone adjacents pendant 1,5 seconde. Les boutons en bois peuvent également être poussés par des flèches.
|
||||||
Provides redstone power when pushed=Fournit une puissance de redstone lorsqu'il est poussé
|
Provides redstone power when pushed=Fournit une puissance de redstone lorsqu'il est poussé
|
||||||
Push duration: @1s=Durée de poussée: @1s
|
Push duration: @1s=Durée de poussée: @1s
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# textdomain: mesecons_button
|
# textdomain: mesecons_button
|
||||||
Use the button to push it.=
|
Use the button to push it.=
|
||||||
Stone Button=
|
Stone Button=
|
||||||
|
Polished Blackstone Button=
|
||||||
A stone button is a redstone component made out of stone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second.=
|
A stone button is a redstone component made out of stone which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1 second.=
|
||||||
Oak Button=
|
Oak Button=
|
||||||
Acacia Button=
|
Acacia Button=
|
||||||
|
@ -8,6 +9,8 @@ Birch Button=
|
||||||
Dark Oak Button=
|
Dark Oak Button=
|
||||||
Spruce Button=
|
Spruce Button=
|
||||||
Jungle Button=
|
Jungle Button=
|
||||||
|
Warped Hyphae Button=
|
||||||
|
Crimson Hyphae Button=
|
||||||
A wooden button is a redstone component made out of wood which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1.5 seconds. Wooden buttons may also be pushed by arrows.=
|
A wooden button is a redstone component made out of wood which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1.5 seconds. Wooden buttons may also be pushed by arrows.=
|
||||||
Provides redstone power when pushed=
|
Provides redstone power when pushed=
|
||||||
Push duration: @1s=
|
Push duration: @1s=
|
||||||
|
|
|
@ -164,6 +164,8 @@ local woods = {
|
||||||
{ "darkwood", "mcl_core:darkwood", "mcl_core_planks_big_oak.png", S("Dark Oak Pressure Plate" )},
|
{ "darkwood", "mcl_core:darkwood", "mcl_core_planks_big_oak.png", S("Dark Oak Pressure Plate" )},
|
||||||
{ "sprucewood", "mcl_core:sprucewood", "mcl_core_planks_spruce.png", S("Spruce Pressure Plate") },
|
{ "sprucewood", "mcl_core:sprucewood", "mcl_core_planks_spruce.png", S("Spruce Pressure Plate") },
|
||||||
{ "junglewood", "mcl_core:junglewood", "default_junglewood.png", S("Jungle Pressure Plate") },
|
{ "junglewood", "mcl_core:junglewood", "default_junglewood.png", S("Jungle Pressure Plate") },
|
||||||
|
{ "warped_hyphae_wood", "mcl_mushrooom:warped_hyphae_wood", "warped_hyphae_wood.png", S("Warped Hyphae Pressure Plate")},
|
||||||
|
{ "crimson_hyphae_wood", "mcl_mushrooom:crimson_hyphae_wood", "crimson_hyphae_wood.png", S("Crimson Hyphae Pressure Plate")},
|
||||||
}
|
}
|
||||||
|
|
||||||
for w=1, #woods do
|
for w=1, #woods do
|
||||||
|
@ -201,6 +203,19 @@ mesecon.register_pressure_plate(
|
||||||
{ player = true, mob = true },
|
{ player = true, mob = true },
|
||||||
S("A stone pressure plate is a redstone component which supplies its surrounding blocks with redstone power while a player or mob stands on top of it. It is not triggered by anything else."))
|
S("A stone pressure plate is a redstone component which supplies its surrounding blocks with redstone power while a player or mob stands on top of it. It is not triggered by anything else."))
|
||||||
|
|
||||||
|
mesecon.register_pressure_plate(
|
||||||
|
"mesecons_pressureplates:pressure_plate_polished_blackstone",
|
||||||
|
S("Polished Blackstone Pressure Plate"),
|
||||||
|
{"mcl_blackstone_polished.png"},
|
||||||
|
{"mcl_blackstone_polished.png"},
|
||||||
|
"default_stone.png",
|
||||||
|
nil,
|
||||||
|
{{"mcl_blackstone:blackstone_polished", "mcl_blackstone:blackstone_polished"}},
|
||||||
|
mcl_sounds.node_sound_stone_defaults(),
|
||||||
|
{pickaxey=1, material_stone=1},
|
||||||
|
{ player = true, mob = true },
|
||||||
|
S("A polished blackstone pressure plate is a redstone component which supplies its surrounding blocks with redstone power while a player or mob stands on top of it. It is not triggered by anything else."))
|
||||||
|
|
||||||
mesecon.register_pressure_plate(
|
mesecon.register_pressure_plate(
|
||||||
"mesecons_pressureplates:pressure_plate_gold",
|
"mesecons_pressureplates:pressure_plate_gold",
|
||||||
S("Light-Weighted Pressure Plate"),
|
S("Light-Weighted Pressure Plate"),
|
||||||
|
@ -211,5 +226,18 @@ mesecon.register_pressure_plate(
|
||||||
{{"mcl_core:gold_ingot", "mcl_core:gold_ingot"}},
|
{{"mcl_core:gold_ingot", "mcl_core:gold_ingot"}},
|
||||||
mcl_sounds.node_sound_metal_defaults(),
|
mcl_sounds.node_sound_metal_defaults(),
|
||||||
{pickaxey=1},
|
{pickaxey=1},
|
||||||
{ player = true, mob = true },
|
nil,
|
||||||
S("A light-weighted pressure plate is a redstone component which supplies its surrounding blocks with redstone power while a player or mob stands on top of it. It is not triggered by anything else."))
|
S("A light-weighted pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it."))
|
||||||
|
|
||||||
|
mesecon.register_pressure_plate(
|
||||||
|
"mesecons_pressureplates:pressure_plate_iron",
|
||||||
|
S("Heavy-Weighted Pressure Plate"),
|
||||||
|
{"default_steel_block.png"},
|
||||||
|
{"default_steel_block.png"},
|
||||||
|
"default_steel_block.png",
|
||||||
|
nil,
|
||||||
|
{{"mcl_core:iron_ingot", "mcl_core:iron_ingot"}},
|
||||||
|
mcl_sounds.node_sound_metal_defaults(),
|
||||||
|
{pickaxey=1},
|
||||||
|
nil,
|
||||||
|
S("A heavy-weighted pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it."))
|
||||||
|
|
|
@ -6,10 +6,18 @@ Birch Pressure Plate=Plaque de pression en Bouleau
|
||||||
Dark Oak Pressure Plate=Plaque de pression en Chêne Noir
|
Dark Oak Pressure Plate=Plaque de pression en Chêne Noir
|
||||||
Spruce Pressure Plate=Plaque de pression en Sapin
|
Spruce Pressure Plate=Plaque de pression en Sapin
|
||||||
Jungle Pressure Plate=Plaque de pression en Acajou
|
Jungle Pressure Plate=Plaque de pression en Acajou
|
||||||
|
Warped Hyphae Pressure Plate=Plaque de pression en Hyphae Tordue
|
||||||
|
Crimson Hyphae Pressure Plate=Plaque de pression en Hyphae Ecarlate
|
||||||
A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.=Une plaque de pression en bois est un composant de redstone qui alimente ses blocs environnants en puissance de redstone tandis que tout objet mobile (y compris les objets lâchés, les joueurs et les mobs) repose dessus.
|
A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.=Une plaque de pression en bois est un composant de redstone qui alimente ses blocs environnants en puissance de redstone tandis que tout objet mobile (y compris les objets lâchés, les joueurs et les mobs) repose dessus.
|
||||||
Stone Pressure Plate=Plaque de pression en pierre
|
Stone Pressure Plate=Plaque de pression en pierre
|
||||||
A stone pressure plate is a redstone component which supplies its surrounding blocks with redstone power while a player or mob stands on top of it. It is not triggered by anything else.=Une plaque de pression en pierre est un composant de redstone qui alimente ses blocs environnants en puissance de redstone pendant qu'un joueur ou un mob se tient au-dessus. Il n'est déclenché par rien d'autre.
|
A stone pressure plate is a redstone component which supplies its surrounding blocks with redstone power while a player or mob stands on top of it. It is not triggered by anything else.=Une plaque de pression en pierre est un composant de redstone qui alimente ses blocs environnants en puissance de redstone pendant qu'un joueur ou un mob se tient au-dessus. Il n'est déclenché par rien d'autre.
|
||||||
Provides redstone power when pushed=Fournit une puissance de redstone lorsqu'il est poussé
|
Polished Blackstone Pressure Plate=Plaque de pression en pierre noire polie
|
||||||
|
A polished blackstone pressure plate is a redstone component which supplies its surrounding blocks with redstone power while a player or mob stands on top of it. It is not triggered by anything else.=Une plaque de pression en pierre noire polie est un composant de redstone qui alimente ses blocs environnants en puissance de redstone pendant qu'un joueur ou un mob se tient au-dessus. Il n'est déclenché par rien d'autre.
|
||||||
|
Light-Weighted Pressure Plate=Plaque de pression pondérée légère
|
||||||
|
A light-weighted pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.=Une plaque de pression pondérée légère est un composant de redstone qui alimente ses blocs environnants en puissance de redstone tandis que tout objet mobile (y compris les objets lâchés, les joueurs et les mobs) repose dessus.
|
||||||
|
Heavy-Weighted Pressure Plate=Plaque de pression pondérée lourde
|
||||||
|
A heavy-weighted pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.=Une plaque de pression pondérée lourde est un composant de redstone qui alimente ses blocs environnants en puissance de redstone tandis que tout objet mobile (y compris les objets lâchés, les joueurs et les mobs) repose dessus.
|
||||||
|
Provides redstone power when pushed=Fournit une puissance de redstone lorsque poussé
|
||||||
Pushable by players, mobs and objects=Poussable par les joueurs, les mobs et les objets
|
Pushable by players, mobs and objects=Poussable par les joueurs, les mobs et les objets
|
||||||
Pushable by players and mobs=Poussable par les joueurs et les mobs
|
Pushable by players and mobs=Poussable par les joueurs et les mobs
|
||||||
Pushable by players=Poussable par les joueurs
|
Pushable by players=Poussable par les joueurs
|
||||||
|
|
|
@ -6,9 +6,17 @@ Birch Pressure Plate=
|
||||||
Dark Oak Pressure Plate=
|
Dark Oak Pressure Plate=
|
||||||
Spruce Pressure Plate=
|
Spruce Pressure Plate=
|
||||||
Jungle Pressure Plate=
|
Jungle Pressure Plate=
|
||||||
|
Warped Hyphae Pressure Plate=
|
||||||
|
Crimson Hyphae Pressure Plate=
|
||||||
A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.=
|
A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.=
|
||||||
Stone Pressure Plate=
|
Stone Pressure Plate=
|
||||||
A stone pressure plate is a redstone component which supplies its surrounding blocks with redstone power while a player or mob stands on top of it. It is not triggered by anything else.=
|
A stone pressure plate is a redstone component which supplies its surrounding blocks with redstone power while a player or mob stands on top of it. It is not triggered by anything else.=
|
||||||
|
Polished Blackstone Pressure Plate=
|
||||||
|
A polished blackstone pressure plate is a redstone component which supplies its surrounding blocks with redstone power while a player or mob stands on top of it. It is not triggered by anything else.=
|
||||||
|
Light-Weighted Pressure Plate=
|
||||||
|
A light-weighted pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.=
|
||||||
|
Heavy-Weighted Pressure Plate=
|
||||||
|
A heavy-weighted pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it.=
|
||||||
Provides redstone power when pushed=
|
Provides redstone power when pushed=
|
||||||
Pushable by players, mobs and objects=
|
Pushable by players, mobs and objects=
|
||||||
Pushable by players and mobs=
|
Pushable by players and mobs=
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
# textdomain: mcl_amethyst
|
||||||
|
Amethyst Cluster= Abarolada d'Ametista
|
||||||
|
Amethyst Cluster is the final growth of amethyst bud.= L'Abarolada d'Ametista es l'etapa fin finala de creissança dau borron d'ametista.
|
||||||
|
Amethyst Shard= Esclap d'Ametista
|
||||||
|
An amethyst shard is a crystalline mineral.= Un Esclap d'Ametista es un minerau cristallin.
|
||||||
|
Block of Amethyst= Blòc d'Ametista
|
||||||
|
Budding Amethyst= Ametista Borronanta
|
||||||
|
Calcite= Calcita
|
||||||
|
Calcite can be found as part of amethyst geodes.= La Calcita pòt se trobar dins una geòda d'ametista.
|
||||||
|
Large Amethyst Bud= Borron d'Ametista Bèl
|
||||||
|
Large Amethyst Bud is the third growth of amethyst bud.= Lo Borron d'Ametista Bèl es la tresèima etapa de creissança dau borron d'ametista.
|
||||||
|
Medium Amethyst Bud= Borron d'Ametista Mejan
|
||||||
|
Medium Amethyst Bud is the second growth of amethyst bud.= Lo Borron d'Ametista Mejan es la segonda etapa de creissança dau borron d'ametista.
|
||||||
|
Small Amethyst Bud= Borron d'Ametista Pichòt
|
||||||
|
Small Amethyst Bud is the first growth of amethyst bud.= Lo Borron d'Ametista Pichòt es la pormèira etapa de creissança dau borron d'ametista.
|
||||||
|
The Block of Amethyst is a decoration block crafted from amethyst shards.= Lo Blòc d'Ametista es un blòc de decoracion fabricat dempuèi d'esclaps d'ametista.
|
||||||
|
The Budding Amethyst can grow amethyst= L'Ametista Borronanta pòt créisser l'ametista.
|
||||||
|
Tinted Glass= Veire Tintat
|
||||||
|
Tinted Glass is a type of glass which blocks lights while it is visually transparent.= Lo Veire Tintat es un tipe de veire que barra la lutz en estant clarent.
|
|
@ -0,0 +1,288 @@
|
||||||
|
# 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,
|
||||||
|
},
|
||||||
|
|
||||||
|
--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",
|
||||||
|
})
|
||||||
|
```
|