forked from VoxeLibre/VoxeLibre
Compare commits
34 Commits
master
...
api-cauldr
Author | SHA1 | Date |
---|---|---|
AFCMS | 225650904c | |
AFCMS | 1b144d507d | |
AFCMS | 738519f0a4 | |
AFCMS | d1ca012ea0 | |
AFCMS | a18a2127c5 | |
AFCMS | 7156afcd03 | |
AFCMS | e3b3e2343b | |
AFCMS | 6f23351126 | |
AFCMS | a99619774d | |
AFCMS | 989384f362 | |
AFCMS | 69da355f96 | |
AFCMS | 297d4e707c | |
AFCMS | b4033ddfc9 | |
AFCMS | c35c8a1713 | |
AFCMS | 64b49ba719 | |
AFCMS | d00490c86f | |
AFCMS | 8c91d23eb8 | |
AFCMS | 294cb3eb7d | |
AFCMS | cf4d57e584 | |
AFCMS | 890b95bb49 | |
AFCMS | 8611d27f1d | |
AFCMS | 59892abf6d | |
AFCMS | e69365f44d | |
AFCMS | aa0c7bd2cf | |
AFCMS | 2b73c16c69 | |
AFCMS | 36f479b2ec | |
AFCMS | 717a18ef16 | |
AFCMS | 9b0c87dabc | |
AFCMS | 3c83898095 | |
AFCMS | 6ebae965f6 | |
AFCMS | 5e5b3ebf75 | |
AFCMS | e68736a040 | |
AFCMS | 72149a2c56 | |
AFCMS | 182e825303 |
|
@ -1,8 +1,5 @@
|
||||||
# This is a game specific minetest.conf file, do not edit
|
# This is a game specific minetest.conf file, do not edit
|
||||||
|
|
||||||
# If any of these settings are set in your minetest.conf file in ~/.minetest (Linux) or in the root directory of the game (Run in place/Windows)
|
|
||||||
# They will override these settings
|
|
||||||
|
|
||||||
# Basic game rules
|
# Basic game rules
|
||||||
time_speed = 72
|
time_speed = 72
|
||||||
|
|
||||||
|
@ -36,7 +33,7 @@ mgvalleys_spflags = noaltitude_chill,noaltitude_dry,nohumid_rivers,vary_river_de
|
||||||
keepInventory = false
|
keepInventory = false
|
||||||
|
|
||||||
# Performance settings
|
# Performance settings
|
||||||
dedicated_server_step = 0.05 #tick rate
|
# dedicated_server_step = 0.001
|
||||||
# abm_interval = 0.25
|
# abm_interval = 0.25
|
||||||
# max_objects_per_block = 4096
|
# max_objects_per_block = 4096
|
||||||
# max_packets_per_iteration = 10096
|
# max_packets_per_iteration = 10096
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
# controls
|
|
||||||
|
|
||||||
## controls.players
|
|
||||||
Table containing player controls at runtime.
|
|
||||||
WARNING: Never use this table in writing
|
|
||||||
|
|
||||||
## controls.register_on_press(func)
|
|
||||||
Register a function that will be executed with (player, keyname) every time a player press a key.
|
|
||||||
|
|
||||||
## controls.registered_on_press
|
|
||||||
Table containing functions registered with controls.register_on_press().
|
|
||||||
|
|
||||||
## controls.register_on_release(func)
|
|
||||||
Register a function that will be executed with (player, keyname, clock_from_last_press) every time a player release a key.
|
|
||||||
|
|
||||||
## controls.registered_on_release
|
|
||||||
Table containing functions registered with controls.register_on_release().
|
|
||||||
|
|
||||||
## controls.register_on_hold(func)
|
|
||||||
Register a function that will be executed with (player, keyname, clock_from_start_hold) every time a player hold a key.
|
|
||||||
|
|
||||||
## controls.registered_on_hold
|
|
||||||
Table containing functions registered with controls.register_on_hold().
|
|
|
@ -1,45 +0,0 @@
|
||||||
# flowlib
|
|
||||||
Simple flow functions.
|
|
||||||
|
|
||||||
## flowlib.is_touching(realpos, nodepos, radius)
|
|
||||||
Return true if a sphere of <radius> at <realpos> collide with node at <nodepos>.
|
|
||||||
* realpos: position
|
|
||||||
* nodepos: position
|
|
||||||
* radius: number
|
|
||||||
|
|
||||||
## flowlib.is_water(pos)
|
|
||||||
Return true if node at <pos> is water, false overwise.
|
|
||||||
* pos: position
|
|
||||||
|
|
||||||
## flowlib.node_is_water(node)
|
|
||||||
Return true if <node> is water, false overwise.
|
|
||||||
* node: node
|
|
||||||
|
|
||||||
## flowlib.is_lava(pos)
|
|
||||||
Return true if node at <pos> is lava, false overwise.
|
|
||||||
* pos: position
|
|
||||||
|
|
||||||
## flowlib.node_is_lava(node)
|
|
||||||
Return true if <node> is lava, false overwise.
|
|
||||||
* node: node
|
|
||||||
|
|
||||||
## flowlib.is_liquid(pos)
|
|
||||||
Return true if node at <pos> is liquid, false overwise.
|
|
||||||
* pos: position
|
|
||||||
|
|
||||||
## flowlib.node_is_liquid(node)
|
|
||||||
Return true if <node> is liquid, false overwise.
|
|
||||||
* node: node
|
|
||||||
|
|
||||||
## flowlib.quick_flow(pos, node)
|
|
||||||
Return direction where the water is flowing (to be use to push mobs, items...).
|
|
||||||
* pos: position
|
|
||||||
* node: node
|
|
||||||
|
|
||||||
## flowlib.move_centre(pos, realpos, node, radius)
|
|
||||||
Return the pos of the nearest not water block near from <pos> in a sphere of <radius> at <realpos>.
|
|
||||||
WARNING: This function is never used in mcl2, use at your own risk. The informations described here may be wrong.
|
|
||||||
* pos: position
|
|
||||||
* realpos: position, position of the entity
|
|
||||||
* node: node
|
|
||||||
* radius: number
|
|
|
@ -1,27 +0,0 @@
|
||||||
# mcl_autogroup
|
|
||||||
This mod emulate digging times from mc.
|
|
||||||
|
|
||||||
## mcl_autogroup.can_harvest(nodename, toolname)
|
|
||||||
Return true if <nodename> can be dig with <toolname>.
|
|
||||||
* nodename: string, valid nodename
|
|
||||||
* toolname: (optional) string, valid toolname
|
|
||||||
|
|
||||||
## mcl_autogroup.get_groupcaps(toolname, efficiency)
|
|
||||||
This function is used to calculate diggroups for tools.
|
|
||||||
WARNING: This function can only be called after mod initialization.
|
|
||||||
* toolname: string, name of the tool being enchanted (like "mcl_tools:diamond_pickaxe")
|
|
||||||
* efficiency: (optional) integer, the efficiency level the tool is enchanted with (default 0)
|
|
||||||
|
|
||||||
## mcl_autogroup.get_wear(toolname, diggroup)
|
|
||||||
Return the max wear of <toolname> with <diggroup>
|
|
||||||
WARNING: This function can only be called after mod initialization.
|
|
||||||
* toolname: string, name of the tool used
|
|
||||||
* diggroup: string, the name of the diggroup the tool is used on
|
|
||||||
|
|
||||||
## mcl_autogroup.register_diggroup(group, def)
|
|
||||||
* group: string, name of the group to register as a digging group
|
|
||||||
* def: (optional) table, table with information about the diggroup (defaults to {} if unspecified)
|
|
||||||
* level: (optional) string, if specified it is an array containing the names of the different digging levels the digging group supports
|
|
||||||
|
|
||||||
## mcl_autogroup.registered_diggroups
|
|
||||||
List of registered diggroups, indexed by name.
|
|
|
@ -1,8 +0,0 @@
|
||||||
# mcl_colors
|
|
||||||
Mod providing global table containing legacity minecraft colors to be used in mods.
|
|
||||||
|
|
||||||
## mcl_colors.*
|
|
||||||
Colors by upper name, in hex value.
|
|
||||||
|
|
||||||
## mcl_colors.background.*
|
|
||||||
Background colors by upper name, in hex value.
|
|
|
@ -1,15 +0,0 @@
|
||||||
# mcl_explosions
|
|
||||||
This mod provide helper functions to create explosions.
|
|
||||||
|
|
||||||
## mcl_explosions.explode(pos, strength, info, puncher)
|
|
||||||
* pos: position, initial position of the explosion
|
|
||||||
* strenght: number, radius of the explosion
|
|
||||||
* info: table, explosion informations:
|
|
||||||
* drop_chance: number, if specified becomes the drop chance of all nodes in the explosion (default: 1.0 / strength)
|
|
||||||
* max_blast_resistance: int, if specified the explosion will treat all non-indestructible nodes as having a blast resistance of no more than this value
|
|
||||||
* sound: bool, if true, the explosion will play a sound (default: true)
|
|
||||||
* particles: bool, if true, the explosion will create particles (default: true)
|
|
||||||
* fire: bool, if true, 1/3 nodes become fire (default: false)
|
|
||||||
* griefing: bool, if true, the explosion will destroy nodes (default: true)
|
|
||||||
* grief_protected: bool, if true, the explosion will also destroy nodes which have been protected (default: false)
|
|
||||||
* puncher: (optional) entity, will be used as source for damage done by the explosion
|
|
|
@ -1,80 +0,0 @@
|
||||||
# mcl_worlds
|
|
||||||
This mod provides utility functions about positions and dimensions.
|
|
||||||
|
|
||||||
## mcl_worlds.is_in_void(pos)
|
|
||||||
This function returns:
|
|
||||||
|
|
||||||
* true, true: if pos is in deep void (deadly)
|
|
||||||
* true, false: if the pos is in void (non deadly)
|
|
||||||
* false, false: owerwise
|
|
||||||
|
|
||||||
Params:
|
|
||||||
|
|
||||||
* pos: position
|
|
||||||
|
|
||||||
## mcl_worlds.y_to_layer(y)
|
|
||||||
This function is used to calculate the minetest y layer and dimension of the given <y> minecraft layer.
|
|
||||||
Mainly used for ore generation.
|
|
||||||
Takes an Y coordinate as input and returns:
|
|
||||||
|
|
||||||
* The corresponding Minecraft layer (can be nil if void)
|
|
||||||
* The corresponding Minecraft dimension ("overworld", "nether" or "end") or "void" if <y> is in the void
|
|
||||||
If the Y coordinate is not located in any dimension, it will return: nil, "void"
|
|
||||||
|
|
||||||
Params:
|
|
||||||
|
|
||||||
* y: int
|
|
||||||
|
|
||||||
## mcl_worlds.pos_to_dimension(pos)
|
|
||||||
This function return the Minecraft dimension of <pos> ("overworld", "nether" or "end") or "void" if <y> is in the void.
|
|
||||||
|
|
||||||
* pos: position
|
|
||||||
|
|
||||||
## mcl_worlds.layer_to_y(layer, mc_dimension)
|
|
||||||
Takes a Minecraft layer and a “dimension” name and returns the corresponding Y coordinate for MineClone 2.
|
|
||||||
mc_dimension can be "overworld", "nether", "end" (default: "overworld").
|
|
||||||
|
|
||||||
* layer: int
|
|
||||||
* mc_dimension: string
|
|
||||||
|
|
||||||
## mcl_worlds.has_weather(pos)
|
|
||||||
Returns true if <pos> can have weather, false owerwise.
|
|
||||||
Weather can be only in the overworld.
|
|
||||||
|
|
||||||
* pos: position
|
|
||||||
|
|
||||||
## mcl_worlds.has_dust(pos)
|
|
||||||
Returns true if <pos> can have nether dust, false owerwise.
|
|
||||||
Nether dust can be only in the nether.
|
|
||||||
|
|
||||||
* pos: position
|
|
||||||
|
|
||||||
## mcl_worlds.compass_works(pos)
|
|
||||||
Returns true if compasses are working at <pos>, false owerwise.
|
|
||||||
In mc, you cant use compass in the nether and the end.
|
|
||||||
|
|
||||||
* pos: position
|
|
||||||
|
|
||||||
## mcl_worlds.compass_works(pos)
|
|
||||||
Returns true if clock are working at <pos>, false owerwise.
|
|
||||||
In mc, you cant use clock in the nether and the end.
|
|
||||||
|
|
||||||
* pos: position
|
|
||||||
|
|
||||||
## mcl_worlds.register_on_dimension_change(function(player, dimension))
|
|
||||||
Register a callback function func(player, dimension).
|
|
||||||
It will be called whenever a player changes between dimensions.
|
|
||||||
The void counts as dimension.
|
|
||||||
|
|
||||||
* player: player, the player who changed the dimension
|
|
||||||
* dimension: position, The new dimension of the player ("overworld", "nether", "end", "void").
|
|
||||||
|
|
||||||
|
|
||||||
## mcl_worlds.registered_on_dimension_change
|
|
||||||
Table containing all function registered with mcl_worlds.register_on_dimension_change()
|
|
||||||
|
|
||||||
## mcl_worlds.dimension_change(player, dimension)
|
|
||||||
Notify this mod of a dimmension change of <player> to <dimension>
|
|
||||||
|
|
||||||
* player: player, player who changed the dimension
|
|
||||||
* dimension: string, new dimension ("overworld", "nether", "end", "void")
|
|
|
@ -1,36 +1,14 @@
|
||||||
--these are lua locals, used for higher performance
|
|
||||||
local minetest,math,vector,ipairs = minetest,math,vector,ipairs
|
|
||||||
|
|
||||||
--this is used for the player pool in the sound buffer
|
|
||||||
local pool = {}
|
|
||||||
|
|
||||||
local tick = false
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
local name
|
|
||||||
name = player:get_player_name()
|
|
||||||
pool[name] = 0
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_on_leaveplayer(function(player)
|
|
||||||
local name
|
|
||||||
name = player:get_player_name()
|
|
||||||
pool[name] = nil
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
local has_awards = minetest.get_modpath("awards")
|
local has_awards = minetest.get_modpath("awards")
|
||||||
|
|
||||||
local mcl_item_entity = {}
|
mcl_item_entity = {}
|
||||||
|
|
||||||
--basic settings
|
--basic settings
|
||||||
local item_drop_settings = {} --settings table
|
local item_drop_settings = {} --settings table
|
||||||
item_drop_settings.dug_buffer = 0.65 -- the warm up period before a dug item can be collected
|
|
||||||
item_drop_settings.age = 1.0 --how old a dropped item (_insta_collect==false) has to be before collecting
|
item_drop_settings.age = 1.0 --how old a dropped item (_insta_collect==false) has to be before collecting
|
||||||
item_drop_settings.radius_magnet = 2.0 --radius of item magnet. MUST BE LARGER THAN radius_collect!
|
item_drop_settings.radius_magnet = 2.0 --radius of item magnet. MUST BE LARGER THAN radius_collect!
|
||||||
item_drop_settings.xp_radius_magnet = 7.25 --radius of xp magnet. MUST BE LARGER THAN radius_collect!
|
item_drop_settings.xp_radius_magnet = 7.25 --radius of xp magnet. MUST BE LARGER THAN radius_collect!
|
||||||
item_drop_settings.radius_collect = 0.2 --radius of collection
|
item_drop_settings.radius_collect = 0.2 --radius of collection
|
||||||
item_drop_settings.player_collect_height = 0.8 --added to their pos y value
|
item_drop_settings.player_collect_height = 1.0 --added to their pos y value
|
||||||
item_drop_settings.collection_safety = false --do this to prevent items from flying away on laggy servers
|
item_drop_settings.collection_safety = false --do this to prevent items from flying away on laggy servers
|
||||||
item_drop_settings.random_item_velocity = true --this sets random item velocity if velocity is 0
|
item_drop_settings.random_item_velocity = true --this sets random item velocity if velocity is 0
|
||||||
item_drop_settings.drop_single_item = false --if true, the drop control drops 1 item instead of the entire stack, and sneak+drop drops the stack
|
item_drop_settings.drop_single_item = false --if true, the drop control drops 1 item instead of the entire stack, and sneak+drop drops the stack
|
||||||
|
@ -96,71 +74,103 @@ local disable_physics = function(object, luaentity, ignore_check, reset_movement
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
tick = not tick
|
|
||||||
|
|
||||||
for _,player in pairs(minetest.get_connected_players()) do
|
for _,player in pairs(minetest.get_connected_players()) do
|
||||||
if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then
|
if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then
|
||||||
|
|
||||||
|
|
||||||
local name = player:get_player_name()
|
|
||||||
|
|
||||||
local pos = player:get_pos()
|
local pos = player:get_pos()
|
||||||
|
|
||||||
if tick == true and pool[name] > 0 then
|
|
||||||
minetest.sound_play("item_drop_pickup", {
|
|
||||||
pos = pos,
|
|
||||||
gain = 0.7,
|
|
||||||
max_hear_distance = 16,
|
|
||||||
pitch = math.random(70,110)/100
|
|
||||||
})
|
|
||||||
if pool[name] > 6 then
|
|
||||||
pool[name] = 6
|
|
||||||
else
|
|
||||||
pool[name] = pool[name] - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z}
|
local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z}
|
||||||
|
|
||||||
--magnet and collection
|
--magnet and collection
|
||||||
for _,object in pairs(minetest.get_objects_inside_radius(checkpos, item_drop_settings.xp_radius_magnet)) do
|
for _,object in pairs(minetest.get_objects_inside_radius(checkpos, item_drop_settings.xp_radius_magnet)) do
|
||||||
if not object:is_player() and vector.distance(checkpos, object:get_pos()) < item_drop_settings.radius_magnet and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and object:get_luaentity()._magnet_timer and (object:get_luaentity()._insta_collect or (object:get_luaentity().age > item_drop_settings.age)) then
|
if not object:is_player() and vector.distance(checkpos, object:get_pos()) < item_drop_settings.radius_magnet and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" and object:get_luaentity()._magnet_timer and (object:get_luaentity()._insta_collect or (object:get_luaentity().age > item_drop_settings.age)) then
|
||||||
|
object:get_luaentity()._magnet_timer = object:get_luaentity()._magnet_timer + dtime
|
||||||
|
local collected = false
|
||||||
if object:get_luaentity()._magnet_timer >= 0 and object:get_luaentity()._magnet_timer < item_drop_settings.magnet_time and inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
if object:get_luaentity()._magnet_timer >= 0 and object:get_luaentity()._magnet_timer < item_drop_settings.magnet_time and inv and inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
||||||
|
|
||||||
-- Collection
|
-- Collection
|
||||||
if not object:get_luaentity()._removed then
|
if vector.distance(checkpos, object:get_pos()) <= item_drop_settings.radius_collect and not object:get_luaentity()._removed then
|
||||||
-- Ignore if itemstring is not set yet
|
-- Ignore if itemstring is not set yet
|
||||||
if object:get_luaentity().itemstring ~= "" then
|
if object:get_luaentity().itemstring ~= "" then
|
||||||
inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
|
inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
|
||||||
|
minetest.sound_play("item_drop_pickup", {
|
||||||
|
pos = pos,
|
||||||
|
max_hear_distance = 16,
|
||||||
|
gain = 1.0,
|
||||||
|
}, true)
|
||||||
check_pickup_achievements(object, player)
|
check_pickup_achievements(object, player)
|
||||||
|
|
||||||
|
|
||||||
-- Destroy entity
|
-- Destroy entity
|
||||||
-- This just prevents this section to be run again because object:remove() doesn't remove the item immediately.
|
-- This just prevents this section to be run again because object:remove() doesn't remove the item immediately.
|
||||||
object:get_luaentity().target = checkpos
|
|
||||||
object:get_luaentity()._removed = true
|
object:get_luaentity()._removed = true
|
||||||
|
|
||||||
object:set_velocity({x=0,y=0,z=0})
|
|
||||||
object:set_acceleration({x=0,y=0,z=0})
|
|
||||||
|
|
||||||
object:move_to(checkpos)
|
|
||||||
|
|
||||||
pool[name] = pool[name] + 1
|
|
||||||
|
|
||||||
minetest.after(0.25, function()
|
|
||||||
--safety check
|
|
||||||
if object and object:get_luaentity() then
|
|
||||||
object:remove()
|
object:remove()
|
||||||
|
collected = true
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
|
-- Magnet
|
||||||
|
else
|
||||||
|
|
||||||
|
object:get_luaentity()._magnet_active = true
|
||||||
|
object:get_luaentity()._collector_timer = 0
|
||||||
|
|
||||||
|
-- Move object to player
|
||||||
|
disable_physics(object, object:get_luaentity())
|
||||||
|
|
||||||
|
local opos = object:get_pos()
|
||||||
|
local vec = vector.subtract(checkpos, opos)
|
||||||
|
vec = vector.add(opos, vector.divide(vec, 2))
|
||||||
|
object:move_to(vec)
|
||||||
|
|
||||||
|
|
||||||
|
--fix eternally falling items
|
||||||
|
minetest.after(0, function(object)
|
||||||
|
local lua = object:get_luaentity()
|
||||||
|
if lua then
|
||||||
|
object:set_acceleration({x=0, y=0, z=0})
|
||||||
end
|
end
|
||||||
|
end, object)
|
||||||
|
|
||||||
|
|
||||||
|
--this is a safety to prevent items flying away on laggy servers
|
||||||
|
if item_drop_settings.collection_safety == true then
|
||||||
|
if object:get_luaentity().init ~= true then
|
||||||
|
object:get_luaentity().init = true
|
||||||
|
minetest.after(1, function(args)
|
||||||
|
local playername = args[1]
|
||||||
|
local player = minetest.get_player_by_name(playername)
|
||||||
|
local object = args[2]
|
||||||
|
local lua = object:get_luaentity()
|
||||||
|
if player == nil or not player:is_player() or object == nil or lua == nil or lua.itemstring == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if inv:room_for_item("main", ItemStack(object:get_luaentity().itemstring)) then
|
||||||
|
inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
|
||||||
|
if not object:get_luaentity()._removed then
|
||||||
|
minetest.sound_play("item_drop_pickup", {
|
||||||
|
pos = pos,
|
||||||
|
max_hear_distance = 16,
|
||||||
|
gain = 1.0,
|
||||||
|
}, true)
|
||||||
|
end
|
||||||
|
check_pickup_achievements(object, player)
|
||||||
|
object:get_luaentity()._removed = true
|
||||||
|
object:remove()
|
||||||
|
else
|
||||||
|
enable_physics(object, object:get_luaentity())
|
||||||
|
end
|
||||||
|
end, {player:get_player_name(), object})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not collected then
|
||||||
|
if object:get_luaentity()._magnet_timer > 1 then
|
||||||
|
object:get_luaentity()._magnet_timer = -item_drop_settings.magnet_time
|
||||||
|
object:get_luaentity()._magnet_active = false
|
||||||
|
elseif object:get_luaentity()._magnet_timer < 0 then
|
||||||
|
object:get_luaentity()._magnet_timer = object:get_luaentity()._magnet_timer + dtime
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -220,13 +230,12 @@ local function get_fortune_drops(fortune_drops, fortune_level)
|
||||||
return drop or {}
|
return drop or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local doTileDrops = minetest.settings:get_bool("mcl_doTileDrops", true)
|
|
||||||
|
|
||||||
function minetest.handle_node_drops(pos, drops, digger)
|
function minetest.handle_node_drops(pos, drops, digger)
|
||||||
-- NOTE: This function override allows digger to be nil.
|
-- NOTE: This function override allows digger to be nil.
|
||||||
-- This means there is no digger. This is a special case which allows this function to be called
|
-- This means there is no digger. This is a special case which allows this function to be called
|
||||||
-- by hand. Creative Mode is intentionally ignored in this case.
|
-- by hand. Creative Mode is intentionally ignored in this case.
|
||||||
|
|
||||||
|
local doTileDrops = minetest.settings:get_bool("mcl_doTileDrops", true)
|
||||||
if (digger and digger:is_player() and minetest.is_creative_enabled(digger:get_player_name())) or doTileDrops == false then
|
if (digger and digger:is_player() and minetest.is_creative_enabled(digger:get_player_name())) or doTileDrops == false then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -326,10 +335,6 @@ function minetest.handle_node_drops(pos, drops, digger)
|
||||||
z = -z
|
z = -z
|
||||||
end
|
end
|
||||||
obj:set_velocity({x=1/x, y=obj:get_velocity().y, z=1/z})
|
obj:set_velocity({x=1/x, y=obj:get_velocity().y, z=1/z})
|
||||||
|
|
||||||
obj:get_luaentity().age = item_drop_settings.dug_buffer
|
|
||||||
|
|
||||||
obj:get_luaentity()._insta_collect = false
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -396,9 +401,6 @@ minetest.register_entity(":__builtin:item", {
|
||||||
-- Number of seconds this item entity has existed so far
|
-- Number of seconds this item entity has existed so far
|
||||||
age = 0,
|
age = 0,
|
||||||
|
|
||||||
-- How old it has become in the collection animation
|
|
||||||
collection_age = 0,
|
|
||||||
|
|
||||||
set_item = function(self, itemstring)
|
set_item = function(self, itemstring)
|
||||||
self.itemstring = itemstring
|
self.itemstring = itemstring
|
||||||
if self.itemstring == "" then
|
if self.itemstring == "" then
|
||||||
|
@ -564,11 +566,6 @@ minetest.register_entity(":__builtin:item", {
|
||||||
|
|
||||||
on_step = function(self, dtime)
|
on_step = function(self, dtime)
|
||||||
if self._removed then
|
if self._removed then
|
||||||
self.object:set_properties({
|
|
||||||
physical = false
|
|
||||||
})
|
|
||||||
self.object:set_velocity({x=0,y=0,z=0})
|
|
||||||
self.object:set_acceleration({x=0,y=0,z=0})
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self.age = self.age + dtime
|
self.age = self.age + dtime
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Item_Drop_Pickup - https://freesound.org/people/benniknop/sounds/317848/ (License: CC0)
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -735,9 +735,7 @@ local item_drop = function(self, cooked, looting_level)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add item if it exists
|
-- add item if it exists
|
||||||
for x = 1, num do
|
obj = minetest.add_item(pos, ItemStack(item .. " " .. num))
|
||||||
obj = minetest.add_item(pos, ItemStack(item .. " " .. 1))
|
|
||||||
end
|
|
||||||
|
|
||||||
if obj and obj:get_luaentity() then
|
if obj and obj:get_luaentity() then
|
||||||
|
|
||||||
|
@ -2819,10 +2817,6 @@ local do_states = function(self, dtime)
|
||||||
local arrow, ent
|
local arrow, ent
|
||||||
local v = 1
|
local v = 1
|
||||||
if not self.shoot_arrow then
|
if not self.shoot_arrow then
|
||||||
self.firing = true
|
|
||||||
minetest.after(1, function()
|
|
||||||
self.firing = false
|
|
||||||
end)
|
|
||||||
arrow = minetest.add_entity(p, self.arrow)
|
arrow = minetest.add_entity(p, self.arrow)
|
||||||
ent = arrow:get_luaentity()
|
ent = arrow:get_luaentity()
|
||||||
if ent.velocity then
|
if ent.velocity then
|
||||||
|
@ -3741,8 +3735,6 @@ function mobs:register_mob(name, def)
|
||||||
local can_despawn
|
local can_despawn
|
||||||
if def.can_despawn ~= nil then
|
if def.can_despawn ~= nil then
|
||||||
can_despawn = def.can_despawn
|
can_despawn = def.can_despawn
|
||||||
elseif def.spawn_class == "passive" then
|
|
||||||
can_despawn = false
|
|
||||||
else
|
else
|
||||||
can_despawn = true
|
can_despawn = true
|
||||||
end
|
end
|
||||||
|
@ -4229,11 +4221,6 @@ function mobs:register_arrow(name, def)
|
||||||
switch = 0,
|
switch = 0,
|
||||||
owner_id = def.owner_id,
|
owner_id = def.owner_id,
|
||||||
rotate = def.rotate,
|
rotate = def.rotate,
|
||||||
on_punch = function(self)
|
|
||||||
local vel = self.object:get_velocity()
|
|
||||||
self.object:set_velocity({x=vel.x * -1, y=vel.y * -1, z=vel.z * -1})
|
|
||||||
end,
|
|
||||||
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},
|
|
||||||
automatic_face_movement_dir = def.rotate
|
automatic_face_movement_dir = def.rotate
|
||||||
and (def.rotate - (pi / 180)) or false,
|
and (def.rotate - (pi / 180)) or false,
|
||||||
|
|
||||||
|
@ -4296,7 +4283,7 @@ function mobs:register_arrow(name, def)
|
||||||
|
|
||||||
if self.hit_player or self.hit_mob or self.hit_object then
|
if self.hit_player or self.hit_mob or self.hit_object then
|
||||||
|
|
||||||
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do
|
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.0)) do
|
||||||
|
|
||||||
if self.hit_player
|
if self.hit_player
|
||||||
and player:is_player() then
|
and player:is_player() then
|
||||||
|
|
|
@ -534,9 +534,7 @@ mobs:register_mob("mobs_mc:enderman", {
|
||||||
--if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then
|
--if (minetest.get_timeofday() * 24000) > 5001 and (minetest.get_timeofday() * 24000) < 19000 then
|
||||||
-- self:teleport(nil)
|
-- self:teleport(nil)
|
||||||
--else
|
--else
|
||||||
if pr:next(1, 8) == 8 then --FIXME: real mc rate
|
|
||||||
self:teleport(hitter)
|
self:teleport(hitter)
|
||||||
end
|
|
||||||
self.attack=hitter
|
self.attack=hitter
|
||||||
self.state="attack"
|
self.state="attack"
|
||||||
--end
|
--end
|
||||||
|
|
|
@ -63,15 +63,6 @@ mobs:register_mob("mobs_mc:ghast", {
|
||||||
makes_footstep_sound = false,
|
makes_footstep_sound = false,
|
||||||
instant_death = true,
|
instant_death = true,
|
||||||
fire_resistant = true,
|
fire_resistant = true,
|
||||||
do_custom = function(self)
|
|
||||||
if self.firing == true then
|
|
||||||
self.base_texture = {"mobs_mc_ghast_firing.png"}
|
|
||||||
self.object:set_properties({textures=self.base_texture})
|
|
||||||
else
|
|
||||||
self.base_texture = {"mobs_mc_ghast.png"}
|
|
||||||
self.object:set_properties({textures=self.base_texture})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,7 +74,6 @@ mobs:register_arrow("mobs_mc:fireball", {
|
||||||
visual_size = {x = 1, y = 1},
|
visual_size = {x = 1, y = 1},
|
||||||
textures = {"mcl_fire_fire_charge.png"},
|
textures = {"mcl_fire_fire_charge.png"},
|
||||||
velocity = 15,
|
velocity = 15,
|
||||||
collisionbox = {-.5, -.5, -.5, .5, .5, .5},
|
|
||||||
|
|
||||||
hit_player = function(self, player)
|
hit_player = function(self, player)
|
||||||
if rawget(_G, "armor") and armor.last_damage_types then
|
if rawget(_G, "armor") and armor.last_damage_types then
|
||||||
|
|
|
@ -157,29 +157,8 @@ local horse = {
|
||||||
self._regentimer = 0
|
self._regentimer = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Some weird human is riding. Buck them off?
|
-- if driver present allow control of horse
|
||||||
if self.driver and not self.tamed and self.buck_off_time <= 0 then
|
|
||||||
if math.random() < 0.2 then
|
|
||||||
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
|
||||||
-- TODO bucking animation
|
|
||||||
else
|
|
||||||
-- Nah, can't be bothered. Think about it again in one second
|
|
||||||
self.buck_off_time = 20
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Tick the timer for trying to buck the player off
|
|
||||||
if self.buck_off_time then
|
|
||||||
if self.driver then
|
if self.driver then
|
||||||
self.buck_off_time = self.buck_off_time - 1
|
|
||||||
else
|
|
||||||
-- Player isn't riding anymore so no need to count
|
|
||||||
self.buck_off_time = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- if driver present and horse has a saddle allow control of horse
|
|
||||||
if self.driver and self._saddle then
|
|
||||||
|
|
||||||
mobs.drive(self, "walk", "stand", false, dtime)
|
mobs.drive(self, "walk", "stand", false, dtime)
|
||||||
|
|
||||||
|
@ -212,50 +191,6 @@ local horse = {
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
local iname = item:get_name()
|
local iname = item:get_name()
|
||||||
local heal = 0
|
local heal = 0
|
||||||
|
|
||||||
-- Taming
|
|
||||||
self.temper = self.temper or (math.random(1,100))
|
|
||||||
|
|
||||||
if not self.tamed then
|
|
||||||
local temper_increase = 0
|
|
||||||
|
|
||||||
-- Feeding, intentionally not using mobs:feed_tame because horse taming is
|
|
||||||
-- different and more complicated
|
|
||||||
if (iname == mobs_mc.items.sugar) then
|
|
||||||
temper_increase = 3
|
|
||||||
elseif (iname == mobs_mc.items.wheat) then
|
|
||||||
temper_increase = 3
|
|
||||||
elseif (iname == mobs_mc.items.apple) then
|
|
||||||
temper_increase = 3
|
|
||||||
elseif (iname == mobs_mc.items.golden_carrot) then
|
|
||||||
temper_increase = 5
|
|
||||||
elseif (iname == mobs_mc.items.golden_apple) then
|
|
||||||
temper_increase = 10
|
|
||||||
|
|
||||||
-- Trying to ride
|
|
||||||
elseif not self.driver then
|
|
||||||
self.object:set_properties({stepheight = 1.1})
|
|
||||||
mobs.attach(self, clicker)
|
|
||||||
self.buck_off_time = 40 -- TODO how long does it take in minecraft?
|
|
||||||
if self.temper > 100 then
|
|
||||||
self.tamed = true -- NOTE taming can only be finished by riding the horse
|
|
||||||
if not self.owner or self.owner == "" then
|
|
||||||
self.owner = clicker:get_player_name()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
temper_increase = 5
|
|
||||||
|
|
||||||
-- Clicking on the horse while riding ==> unmount
|
|
||||||
elseif self.driver and self.driver == clicker then
|
|
||||||
mobs.detach(clicker, {x = 1, y = 0, z = 1})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- If nothing happened temper_increase = 0 and addition does nothing
|
|
||||||
self.temper = self.temper + temper_increase
|
|
||||||
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if can_breed(self.name) then
|
if can_breed(self.name) then
|
||||||
-- Breed horse with golden apple or golden carrot
|
-- Breed horse with golden apple or golden carrot
|
||||||
if (iname == mobs_mc.items.golden_apple) then
|
if (iname == mobs_mc.items.golden_apple) then
|
||||||
|
@ -267,8 +202,7 @@ local horse = {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Feed with anything else
|
-- Feed/tame with anything else
|
||||||
-- TODO heal amounts don't work
|
|
||||||
if (iname == mobs_mc.items.sugar) then
|
if (iname == mobs_mc.items.sugar) then
|
||||||
heal = 1
|
heal = 1
|
||||||
elseif (iname == mobs_mc.items.wheat) then
|
elseif (iname == mobs_mc.items.wheat) then
|
||||||
|
@ -278,7 +212,7 @@ local horse = {
|
||||||
elseif (iname == mobs_mc.items.hay_bale) then
|
elseif (iname == mobs_mc.items.hay_bale) then
|
||||||
heal = 20
|
heal = 20
|
||||||
end
|
end
|
||||||
if heal > 0 and mobs:feed_tame(self, clicker, heal, false, false) then
|
if heal > 0 and mobs:feed_tame(self, clicker, heal, false, true) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
|
@ -20,9 +20,9 @@ if hb.settings.bar_type == "progress_bar" then
|
||||||
hb.settings.start_offset_right.x = hb.load_setting("hudbars_start_offset_right_x", "number", 15)
|
hb.settings.start_offset_right.x = hb.load_setting("hudbars_start_offset_right_x", "number", 15)
|
||||||
hb.settings.start_offset_right.y = hb.load_setting("hudbars_start_offset_right_y", "number", -86)
|
hb.settings.start_offset_right.y = hb.load_setting("hudbars_start_offset_right_y", "number", -86)
|
||||||
else
|
else
|
||||||
hb.settings.start_offset_left.x = hb.load_setting("hudbars_start_statbar_offset_left_x", "number", -258)
|
hb.settings.start_offset_left.x = hb.load_setting("hudbars_start_statbar_offset_left_x", "number", -265)
|
||||||
hb.settings.start_offset_left.y = hb.load_setting("hudbars_start_statbar_offset_left_y", "number", -90)
|
hb.settings.start_offset_left.y = hb.load_setting("hudbars_start_statbar_offset_left_y", "number", -90)
|
||||||
hb.settings.start_offset_right.x = hb.load_setting("hudbars_start_statbar_offset_right_x", "number", 16)
|
hb.settings.start_offset_right.x = hb.load_setting("hudbars_start_statbar_offset_right_x", "number", 25)
|
||||||
hb.settings.start_offset_right.y = hb.load_setting("hudbars_start_statbar_offset_right_y", "number", -90)
|
hb.settings.start_offset_right.y = hb.load_setting("hudbars_start_statbar_offset_right_y", "number", -90)
|
||||||
end
|
end
|
||||||
-- Modified in MCL2!
|
-- Modified in MCL2!
|
||||||
|
|
|
@ -212,47 +212,22 @@ minetest.register_craftitem("mcl_buckets:bucket_empty", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.add_node(pointed_thing.under, {name="air"})
|
minetest.set_node(pointed_thing.under, {name="air"})
|
||||||
sound_take(nn, pointed_thing.under)
|
sound_take(nn, pointed_thing.under)
|
||||||
|
|
||||||
if mod_doc and doc.entry_exists("nodes", nn) then
|
if mod_doc and doc.entry_exists("nodes", nn) then
|
||||||
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", nn)
|
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", nn)
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif nn == "mcl_cauldrons:cauldron_3" then
|
elseif minetest.get_item_group(nn, "cauldron") then
|
||||||
-- Take water out of full cauldron
|
new_bucket = mcl_cauldrons.take_cauldron(pointed_thing.under, new_bucket, user)
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
|
|
||||||
if not minetest.is_creative_enabled(user:get_player_name()) then
|
|
||||||
new_bucket = ItemStack("mcl_buckets:bucket_water")
|
|
||||||
end
|
|
||||||
sound_take("mcl_core:water_source", pointed_thing.under)
|
|
||||||
elseif nn == "mcl_cauldrons:cauldron_3r" then
|
|
||||||
-- Take river water out of full cauldron
|
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
|
|
||||||
if not minetest.is_creative_enabled(user:get_player_name()) then
|
|
||||||
new_bucket = ItemStack("mcl_buckets:bucket_river_water")
|
|
||||||
end
|
|
||||||
sound_take("mclx_core:river_water_source", pointed_thing.under)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add liquid bucket and put it into inventory, if possible.
|
-- Add liquid bucket and put it into inventory, if possible.
|
||||||
-- Drop new bucket otherwise.
|
-- Drop new bucket otherwise.
|
||||||
if new_bucket then
|
if minetest.is_creative_enabled(user:get_player_name()) then --TODO
|
||||||
if itemstack:get_count() == 1 then
|
|
||||||
return new_bucket
|
|
||||||
else
|
|
||||||
local inv = user:get_inventory()
|
|
||||||
if inv:room_for_item("main", new_bucket) then
|
|
||||||
inv:add_item("main", new_bucket)
|
|
||||||
else
|
|
||||||
minetest.add_item(user:get_pos(), new_bucket)
|
|
||||||
end
|
|
||||||
if not minetest.is_creative_enabled(user:get_player_name()) then
|
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
_on_dispense = function(stack, pos, droppos, dropnode, dropdir)
|
_on_dispense = function(stack, pos, droppos, dropnode, dropdir)
|
||||||
-- Fill empty bucket with liquid or drop bucket if no liquid
|
-- Fill empty bucket with liquid or drop bucket if no liquid
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name = mcl_buckets
|
name = mcl_buckets
|
||||||
author = Kahrl
|
author = Kahrl
|
||||||
description =
|
description =
|
||||||
depends = mcl_worlds
|
depends = mcl_worlds, mcl_cauldrons
|
||||||
optional_depends = mcl_core, mclx_core, doc
|
optional_depends = mcl_core, mclx_core, doc
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ if mod_mcl_core then
|
||||||
if minetest.get_item_group(nn, "cauldron") ~= 0 then
|
if minetest.get_item_group(nn, "cauldron") ~= 0 then
|
||||||
-- Put water into cauldron
|
-- Put water into cauldron
|
||||||
if nn ~= "mcl_cauldrons:cauldron_3" then
|
if nn ~= "mcl_cauldrons:cauldron_3" then
|
||||||
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3"})
|
mcl_cauldrons.set_cauldron_level(pos, "water", 3)
|
||||||
end
|
end
|
||||||
sound_place("mcl_core:water_source", pos)
|
sound_place("mcl_core:water_source", pos)
|
||||||
return false
|
return false
|
||||||
|
@ -104,7 +104,7 @@ if mod_mclx_core then
|
||||||
if minetest.get_item_group(nn, "cauldron") ~= 0 then
|
if minetest.get_item_group(nn, "cauldron") ~= 0 then
|
||||||
-- Put water into cauldron
|
-- Put water into cauldron
|
||||||
if nn ~= "mcl_cauldrons:cauldron_3r" then
|
if nn ~= "mcl_cauldrons:cauldron_3r" then
|
||||||
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_3r"})
|
mcl_cauldrons.set_cauldron(pos, "river_water", 3)
|
||||||
end
|
end
|
||||||
sound_place("mcl_core:water_source", pos)
|
sound_place("mcl_core:water_source", pos)
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
# mcl_cauldrons
|
||||||
|
|
||||||
|
This mod add an API to add cauldrons to mcl.
|
||||||
|
|
||||||
|
## mcl_cauldrons.is_cauldron(name)
|
||||||
|
return true if name is cauldron, false overwise.
|
||||||
|
|
||||||
|
## mcl_cauldrons.get_cauldron_string(type, level)
|
||||||
|
return itemstring of cauldron with <type> and <level>
|
||||||
|
e.g: `mcl_cauldrons.get_cauldron_string("water", 1) --return itemstring of a water cauldron with 1 level of water`
|
||||||
|
|
||||||
|
## mcl_cauldrons.take_cauldron(pos, itemstack, user, sounds)
|
||||||
|
empty cauldron at `pos`
|
||||||
|
return `bucket` field of the cauldron def if user is player, itemstack overwise.
|
||||||
|
* pos: position of the cauldron
|
||||||
|
* itemstack: will be return if `bucket` field isn't defined in cauldron def or user is nil or not player.
|
||||||
|
* user: player who takes cauldron
|
||||||
|
* sounds: sounds table. If not nil, dug sound will be played.
|
||||||
|
|
||||||
|
## mcl_cauldrons.register_cauldron_type(def)
|
||||||
|
def can have these fields:
|
||||||
|
* name: name of the liquid e.g: "water"
|
||||||
|
* bucket: string of the bucket item. can be nil. e.g: "mcl_buckets:bucket_water"
|
||||||
|
* desc: description of the item. %s will be replaced by the level. e.g: "Water Cauldron %s/3 full"
|
||||||
|
* texture: texture of the flowing liquid e.g: "mcl_core_water_flowing.png"
|
||||||
|
|
||||||
|
## mcl_cauldrons.registered_cauldrons
|
||||||
|
Table containing chauldrons def indexed by name.
|
|
@ -0,0 +1,159 @@
|
||||||
|
local has_doc = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
|
||||||
|
local function survival_give(inv, original_item, itemstack)
|
||||||
|
if inv:room_for_item("main", itemstack) then
|
||||||
|
inv:add_item("main", itemstack)
|
||||||
|
return original_item:take_item()
|
||||||
|
else
|
||||||
|
minetest.add_item(user:get_pos(), itemstack)
|
||||||
|
return original_item
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function creative_give(inv, original_item, itemstack)
|
||||||
|
if not inv:contains_item("main", itemstack) then
|
||||||
|
inv:add_item("main", itemstack)
|
||||||
|
return original_item
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function give_item(user, original_item, itemstack)
|
||||||
|
local inv = user:get_inventory()
|
||||||
|
if inv then
|
||||||
|
if minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
|
creative_give(inv, original_item, itemstack)
|
||||||
|
else
|
||||||
|
survival_give(inv, original_item, itemstack)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_cauldrons.registered_cauldrons = {}
|
||||||
|
|
||||||
|
function mcl_cauldrons.register_cauldron_type(def)
|
||||||
|
for water_level = 1,3 do
|
||||||
|
local id = "mcl_cauldrons:cauldron_"..def.name.."_"..water_level
|
||||||
|
mcl_cauldrons.registered_cauldrons[id] = def
|
||||||
|
minetest.register_node(id, {
|
||||||
|
description = string.format(def.desc, water_level),
|
||||||
|
_doc_items_create_entry = false,
|
||||||
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
||||||
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {pickaxey=1, not_in_creative_inventory=1, cauldron=(1+water_level), cauldron_filled=water_level, comparator_signal=water_level},
|
||||||
|
node_box = mcl_cauldrons.cauldron_nodeboxes[water_level],
|
||||||
|
collision_box = mcl_cauldrons.cauldron_nodeboxes[0],
|
||||||
|
selection_box = { type = "regular" },
|
||||||
|
tiles = {
|
||||||
|
"("..def.texture.."^[verticalframe:16:0"..")^mcl_cauldrons_cauldron_top.png",
|
||||||
|
"mcl_cauldrons_cauldron_inner.png^mcl_cauldrons_cauldron_bottom.png",
|
||||||
|
"mcl_cauldrons_cauldron_side.png"
|
||||||
|
},
|
||||||
|
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||||
|
drop = "mcl_cauldrons:cauldron",
|
||||||
|
_mcl_hardness = 2,
|
||||||
|
_mcl_blast_resistance = 2,
|
||||||
|
})
|
||||||
|
-- Add entry aliases for the Help
|
||||||
|
if has_doc then
|
||||||
|
doc.add_entry_alias("nodes", "mcl_cauldrons:cauldron", "nodes", id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_cauldrons.is_cauldron(name)
|
||||||
|
return minetest.get_item_group(name, "cauldron") ~= 0
|
||||||
|
end
|
||||||
|
|
||||||
|
-------------------------------------
|
||||||
|
--Functions to get/set cauldron level
|
||||||
|
-------------------------------------
|
||||||
|
function mcl_cauldrons.get_cauldron_level(pos)
|
||||||
|
local nn = minetest.get_node(pos)
|
||||||
|
return minetest.get_item_group(nn.name, "cauldron")
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_cauldrons.set_cauldron_level(pos, type, level)
|
||||||
|
return minetest.set_node(pos, {name = mcl_cauldrons.get_cauldron_string(type, level)})
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_cauldrons.add_cauldron_level(pos, type, number)
|
||||||
|
local current = mcl_cauldrons.get_cauldron_level(pos)
|
||||||
|
local number = current + number
|
||||||
|
if number > 4 then number = 4 end
|
||||||
|
if number < 1 then number = 1 end
|
||||||
|
mcl_cauldrons.set_cauldron_level(pos, type, number)
|
||||||
|
return number, not current == number
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_cauldrons.get_cauldron_string(type, level)
|
||||||
|
if mcl_cauldrons.registered_cauldrons["mcl_cauldrons:cauldron_"..type.."_"..level] then
|
||||||
|
return "mcl_cauldrons:cauldron_"..type.."_"..level
|
||||||
|
elseif level == 0 then
|
||||||
|
return "mcl_cauldrons:cauldron"
|
||||||
|
else
|
||||||
|
minetest.log("warning", "[mcl_cauldrons] trying to get string from invalid cauldron params")
|
||||||
|
return "air"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
--Functions to take cauldron
|
||||||
|
----------------------------
|
||||||
|
function mcl_cauldrons.take_cauldron(pos, itemstack, user, sounds)
|
||||||
|
local nn = minetest.get_node(pos)
|
||||||
|
if mcl_cauldrons.registered_cauldrons[nn.name] and mcl_cauldrons.registered_cauldrons[nn.name].bucket then
|
||||||
|
if user and not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
|
minetest.set_node(pos, {name="mcl_cauldrons:cauldron"})
|
||||||
|
if sounds then minetest.sound_play(sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end
|
||||||
|
return give_item(user, original, ItemStack(mcl_cauldrons.registered_cauldrons[nn.name].bucket))
|
||||||
|
else
|
||||||
|
minetest.set_node(pos, {name="mcl_cauldrons:cauldron"})
|
||||||
|
if sounds then minetest.sound_play(sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.set_node(pos, {name="mcl_cauldrons:cauldron"})
|
||||||
|
if sounds then minetest.sound_play(sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function mcl_cauldrons.take_small_cauldron(pos, itemstack, user, sounds)
|
||||||
|
local nn = minetest.get_node(pos)
|
||||||
|
if mcl_cauldrons.registered_cauldrons[nn.name] and mcl_cauldrons.registered_cauldrons[nn.name].bottle then
|
||||||
|
if user and not minetest.is_creative_enabled(user:get_player_name()) then
|
||||||
|
local number, changed = mcl_cauldrons.add_cauldron_level(pos, mcl_cauldrons.registered_cauldrons[nn.name].name, -1)
|
||||||
|
if changed then
|
||||||
|
if sounds then minetest.sound_play(sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end
|
||||||
|
local item_name = mcl_cauldrons.registered_cauldrons[nn.name].bottle
|
||||||
|
local inv = placer:get_inventory()
|
||||||
|
minetest.sound_play("mcl_potions_bottle_fill", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
|
||||||
|
if minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
|
-- Don't replace empty bottle in creative for convenience reasons
|
||||||
|
if not inv:contains_item("main", item_name) then
|
||||||
|
inv:add_item("main", item_name)
|
||||||
|
end
|
||||||
|
elseif itemstack:get_count() == 1 then
|
||||||
|
return item_name
|
||||||
|
else
|
||||||
|
return give_item(user, ItemStack(mcl_cauldrons.registered_cauldrons[nn.name].bucket))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local number = mcl_cauldrons.add_cauldron_level(pos, mcl_cauldrons.registered_cauldrons[nn.name].name, -1)
|
||||||
|
if number ~= 0 then
|
||||||
|
if sounds then minetest.sound_play(sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local number = mcl_cauldrons.add_cauldron_level(pos, mcl_cauldrons.registered_cauldrons[nn.name].name, -1)
|
||||||
|
if number ~= 0 then
|
||||||
|
if sounds then minetest.sound_play(sounds.dug, {gain=1.0, pos = pos, pitch = 1 + math.random(-10, 10)*0.005}, true) end
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,143 +1,9 @@
|
||||||
local S = minetest.get_translator("mcl_cauldron")
|
local S = minetest.get_translator("mcl_cauldron")
|
||||||
|
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
|
||||||
|
mcl_cauldrons = {}
|
||||||
-- Cauldron mod, adds cauldrons.
|
-- Cauldron mod, adds cauldrons.
|
||||||
|
|
||||||
-- TODO: Extinguish fire of burning entities
|
dofile(modpath.."/utils.lua")
|
||||||
|
dofile(modpath.."/api.lua")
|
||||||
-- Convenience function because the cauldron nodeboxes are very similar
|
dofile(modpath.."/register.lua")
|
||||||
local create_cauldron_nodebox = function(water_level)
|
|
||||||
local floor_y
|
|
||||||
if water_level == 0 then -- empty
|
|
||||||
floor_y = -0.1875
|
|
||||||
elseif water_level == 1 then -- 1/3 filled
|
|
||||||
floor_y = 1/16
|
|
||||||
elseif water_level == 2 then -- 2/3 filled
|
|
||||||
floor_y = 4/16
|
|
||||||
elseif water_level == 3 then -- full
|
|
||||||
floor_y = 7/16
|
|
||||||
end
|
|
||||||
return {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.1875, -0.5, -0.375, 0.5, 0.5}, -- Left wall
|
|
||||||
{0.375, -0.1875, -0.5, 0.5, 0.5, 0.5}, -- Right wall
|
|
||||||
{-0.375, -0.1875, 0.375, 0.375, 0.5, 0.5}, -- Back wall
|
|
||||||
{-0.375, -0.1875, -0.5, 0.375, 0.5, -0.375}, -- Front wall
|
|
||||||
{-0.5, -0.3125, -0.5, 0.5, floor_y, 0.5}, -- Floor
|
|
||||||
{-0.5, -0.5, -0.5, -0.375, -0.3125, -0.25}, -- Left front foot, part 1
|
|
||||||
{-0.375, -0.5, -0.5, -0.25, -0.3125, -0.375}, -- Left front foot, part 2
|
|
||||||
{-0.5, -0.5, 0.25, -0.375, -0.3125, 0.5}, -- Left back foot, part 1
|
|
||||||
{-0.375, -0.5, 0.375, -0.25, -0.3125, 0.5}, -- Left back foot, part 2
|
|
||||||
{0.375, -0.5, 0.25, 0.5, -0.3125, 0.5}, -- Right back foot, part 1
|
|
||||||
{0.25, -0.5, 0.375, 0.375, -0.3125, 0.5}, -- Right back foot, part 2
|
|
||||||
{0.375, -0.5, -0.5, 0.5, -0.3125, -0.25}, -- Right front foot, part 1
|
|
||||||
{0.25, -0.5, -0.5, 0.375, -0.3125, -0.375}, -- Right front foot, part 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local cauldron_nodeboxes = {}
|
|
||||||
for w=0,3 do
|
|
||||||
cauldron_nodeboxes[w] = create_cauldron_nodebox(w)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Empty cauldron
|
|
||||||
minetest.register_node("mcl_cauldrons:cauldron", {
|
|
||||||
description = S("Cauldron"),
|
|
||||||
_tt_help = S("Stores water"),
|
|
||||||
_doc_items_longdesc = S("Cauldrons are used to store water and slowly fill up under rain."),
|
|
||||||
_doc_items_usagehelp = S("Place a water pucket into the cauldron to fill it with water. Place an empty bucket on a full cauldron to retrieve the water. Place a water bottle into the cauldron to fill the cauldron to one third with water. Place a glass bottle in a cauldron with water to retrieve one third of the water."),
|
|
||||||
wield_image = "mcl_cauldrons_cauldron.png",
|
|
||||||
inventory_image = "mcl_cauldrons_cauldron.png",
|
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
|
||||||
drawtype = "nodebox",
|
|
||||||
paramtype = "light",
|
|
||||||
is_ground_content = false,
|
|
||||||
groups = {pickaxey=1, deco_block=1, cauldron=1},
|
|
||||||
node_box = cauldron_nodeboxes[0],
|
|
||||||
selection_box = { type = "regular" },
|
|
||||||
tiles = {
|
|
||||||
"mcl_cauldrons_cauldron_inner.png^mcl_cauldrons_cauldron_top.png",
|
|
||||||
"mcl_cauldrons_cauldron_inner.png^mcl_cauldrons_cauldron_bottom.png",
|
|
||||||
"mcl_cauldrons_cauldron_side.png"
|
|
||||||
},
|
|
||||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
|
||||||
_mcl_hardness = 2,
|
|
||||||
_mcl_blast_resistance = 2,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Template function for cauldrons with water
|
|
||||||
local register_filled_cauldron = function(water_level, description, river_water)
|
|
||||||
local id = "mcl_cauldrons:cauldron_"..water_level
|
|
||||||
local water_tex
|
|
||||||
if river_water then
|
|
||||||
id = id .. "r"
|
|
||||||
water_tex = "default_river_water_source_animated.png^[verticalframe:16:0"
|
|
||||||
else
|
|
||||||
water_tex = "default_water_source_animated.png^[verticalframe:16:0"
|
|
||||||
end
|
|
||||||
minetest.register_node(id, {
|
|
||||||
description = description,
|
|
||||||
_doc_items_create_entry = false,
|
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
|
||||||
drawtype = "nodebox",
|
|
||||||
paramtype = "light",
|
|
||||||
is_ground_content = false,
|
|
||||||
groups = {pickaxey=1, not_in_creative_inventory=1, cauldron=(1+water_level), cauldron_filled=water_level, comparator_signal=water_level},
|
|
||||||
node_box = cauldron_nodeboxes[water_level],
|
|
||||||
collision_box = cauldron_nodeboxes[0],
|
|
||||||
selection_box = { type = "regular" },
|
|
||||||
tiles = {
|
|
||||||
"("..water_tex..")^mcl_cauldrons_cauldron_top.png",
|
|
||||||
"mcl_cauldrons_cauldron_inner.png^mcl_cauldrons_cauldron_bottom.png",
|
|
||||||
"mcl_cauldrons_cauldron_side.png"
|
|
||||||
},
|
|
||||||
sounds = mcl_sounds.node_sound_metal_defaults(),
|
|
||||||
drop = "mcl_cauldrons:cauldron",
|
|
||||||
_mcl_hardness = 2,
|
|
||||||
_mcl_blast_resistance = 2,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Add entry aliases for the Help
|
|
||||||
if minetest.get_modpath("doc") then
|
|
||||||
doc.add_entry_alias("nodes", "mcl_cauldrons:cauldron", "nodes", id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Filled cauldrons (3 levels)
|
|
||||||
register_filled_cauldron(1, S("Cauldron (1/3 Water)"))
|
|
||||||
register_filled_cauldron(2, S("Cauldron (2/3 Water)"))
|
|
||||||
register_filled_cauldron(3, S("Cauldron (3/3 Water)"))
|
|
||||||
|
|
||||||
if minetest.get_modpath("mclx_core") then
|
|
||||||
register_filled_cauldron(1, S("Cauldron (1/3 River Water)"), true)
|
|
||||||
register_filled_cauldron(2, S("Cauldron (2/3 River Water)"), true)
|
|
||||||
register_filled_cauldron(3, S("Cauldron (3/3 River Water)"), true)
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "mcl_cauldrons:cauldron",
|
|
||||||
recipe = {
|
|
||||||
{ "mcl_core:iron_ingot", "", "mcl_core:iron_ingot" },
|
|
||||||
{ "mcl_core:iron_ingot", "", "mcl_core:iron_ingot" },
|
|
||||||
{ "mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot" },
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
label = "cauldrons",
|
|
||||||
nodenames = {"group:cauldron_filled"},
|
|
||||||
interval = 0.5,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos, node)
|
|
||||||
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0.4)) do
|
|
||||||
if mcl_burning.is_burning(obj) then
|
|
||||||
mcl_burning.extinguish(obj)
|
|
||||||
local new_group = minetest.get_item_group(node.name, "cauldron_filled") - 1
|
|
||||||
minetest.swap_node(pos, {name = "mcl_cauldrons:cauldron" .. (new_group == 0 and "" or "_" .. new_group)})
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
|
@ -1,3 +1,4 @@
|
||||||
name = mcl_cauldrons
|
name = mcl_cauldrons
|
||||||
|
description = Add cauldrons to mcl
|
||||||
depends = mcl_core, mcl_sounds
|
depends = mcl_core, mcl_sounds
|
||||||
optional_depends = mclx_core, doc
|
optional_depends = mclx_core, doc
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
|
mcl_cauldrons.register_cauldron_type({
|
||||||
|
name = "water",
|
||||||
|
bucket = "mcl_buckets:bucket_water",
|
||||||
|
bottle = "mcl_potions:water",
|
||||||
|
desc = S("Cauldron (%s/3 Water)"),
|
||||||
|
texture = "default_water_source_animated.png"
|
||||||
|
})
|
||||||
|
|
||||||
|
if minetest.get_modpath("mclx_core") then
|
||||||
|
--register_filled_cauldron(1, S("Cauldron (1/3 River Water)"), true)
|
||||||
|
--register_filled_cauldron(2, S("Cauldron (2/3 River Water)"), true)
|
||||||
|
--register_filled_cauldron(3, S("Cauldron (3/3 River Water)"), true)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "mcl_cauldrons:cauldron",
|
||||||
|
recipe = {
|
||||||
|
{ "mcl_core:iron_ingot", "", "mcl_core:iron_ingot" },
|
||||||
|
{ "mcl_core:iron_ingot", "", "mcl_core:iron_ingot" },
|
||||||
|
{ "mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot" },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
label = "cauldrons",
|
||||||
|
nodenames = {"group:cauldron_filled"},
|
||||||
|
interval = 0.5,
|
||||||
|
chance = 1,
|
||||||
|
action = function(pos, node)
|
||||||
|
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0.4)) do
|
||||||
|
if mcl_burning.is_burning(obj) then
|
||||||
|
mcl_burning.extinguish(obj)
|
||||||
|
local new_group = minetest.get_item_group(node.name, "cauldron_filled") - 1
|
||||||
|
minetest.swap_node(pos, {name = "mcl_cauldrons:cauldron" .. (new_group == 0 and "" or "_" .. new_group)})
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
for i = 1, 3 do --Backward compatibility
|
||||||
|
minetest.register_alias("mcl_cauldrons:cauldron_"..i, "mcl_cauldrons:cauldron_water_"..i)
|
||||||
|
end
|
||||||
|
for i = 1, 3 do
|
||||||
|
minetest.register_alias("mcl_cauldrons:cauldron_"..i.."r", "mcl_cauldrons:cauldron_river_water_"..i)
|
||||||
|
end
|
|
@ -0,0 +1,63 @@
|
||||||
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
|
-- Convenience function because the cauldron nodeboxes are very similar
|
||||||
|
local create_cauldron_nodebox = function(water_level)
|
||||||
|
local floor_y
|
||||||
|
if water_level == 0 then -- empty
|
||||||
|
floor_y = -0.1875
|
||||||
|
elseif water_level == 1 then -- 1/3 filled
|
||||||
|
floor_y = 1/16
|
||||||
|
elseif water_level == 2 then -- 2/3 filled
|
||||||
|
floor_y = 4/16
|
||||||
|
elseif water_level == 3 then -- full
|
||||||
|
floor_y = 7/16
|
||||||
|
end
|
||||||
|
return {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.1875, -0.5, -0.375, 0.5, 0.5}, -- Left wall
|
||||||
|
{0.375, -0.1875, -0.5, 0.5, 0.5, 0.5}, -- Right wall
|
||||||
|
{-0.375, -0.1875, 0.375, 0.375, 0.5, 0.5}, -- Back wall
|
||||||
|
{-0.375, -0.1875, -0.5, 0.375, 0.5, -0.375}, -- Front wall
|
||||||
|
{-0.5, -0.3125, -0.5, 0.5, floor_y, 0.5}, -- Floor
|
||||||
|
{-0.5, -0.5, -0.5, -0.375, -0.3125, -0.25}, -- Left front foot, part 1
|
||||||
|
{-0.375, -0.5, -0.5, -0.25, -0.3125, -0.375}, -- Left front foot, part 2
|
||||||
|
{-0.5, -0.5, 0.25, -0.375, -0.3125, 0.5}, -- Left back foot, part 1
|
||||||
|
{-0.375, -0.5, 0.375, -0.25, -0.3125, 0.5}, -- Left back foot, part 2
|
||||||
|
{0.375, -0.5, 0.25, 0.5, -0.3125, 0.5}, -- Right back foot, part 1
|
||||||
|
{0.25, -0.5, 0.375, 0.375, -0.3125, 0.5}, -- Right back foot, part 2
|
||||||
|
{0.375, -0.5, -0.5, 0.5, -0.3125, -0.25}, -- Right front foot, part 1
|
||||||
|
{0.25, -0.5, -0.5, 0.375, -0.3125, -0.375}, -- Right front foot, part 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
mcl_cauldrons.cauldron_nodeboxes = {}
|
||||||
|
for w=0,3 do
|
||||||
|
mcl_cauldrons.cauldron_nodeboxes[w] = create_cauldron_nodebox(w)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Empty cauldron
|
||||||
|
minetest.register_node("mcl_cauldrons:cauldron", {
|
||||||
|
description = S("Cauldron"),
|
||||||
|
_tt_help = S("Stores water"),
|
||||||
|
_doc_items_longdesc = S("Cauldrons are used to store water and slowly fill up under rain."),
|
||||||
|
_doc_items_usagehelp = S("Place a water pucket into the cauldron to fill it with water. Place an empty bucket on a full cauldron to retrieve the water. Place a water bottle into the cauldron to fill the cauldron to one third with water. Place a glass bottle in a cauldron with water to retrieve one third of the water."),
|
||||||
|
wield_image = "mcl_cauldrons_cauldron.png",
|
||||||
|
inventory_image = "mcl_cauldrons_cauldron.png",
|
||||||
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
|
||||||
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {pickaxey=1, deco_block=1, cauldron=1},
|
||||||
|
node_box = mcl_cauldrons.cauldron_nodeboxes[0],
|
||||||
|
selection_box = { type = "regular" },
|
||||||
|
tiles = {
|
||||||
|
"mcl_cauldrons_cauldron_inner.png^mcl_cauldrons_cauldron_top.png",
|
||||||
|
"mcl_cauldrons_cauldron_inner.png^mcl_cauldrons_cauldron_bottom.png",
|
||||||
|
"mcl_cauldrons_cauldron_side.png"
|
||||||
|
},
|
||||||
|
sounds = mcl_sounds.node_sound_metal_defaults(),
|
||||||
|
_mcl_hardness = 2,
|
||||||
|
_mcl_blast_resistance = 2,
|
||||||
|
})
|
|
@ -7,10 +7,10 @@ local WATER_ALPHA = 179
|
||||||
local WATER_VISC = 1
|
local WATER_VISC = 1
|
||||||
local LAVA_VISC = 7
|
local LAVA_VISC = 7
|
||||||
local LIGHT_LAVA = minetest.LIGHT_MAX
|
local LIGHT_LAVA = minetest.LIGHT_MAX
|
||||||
local USE_TEXTURE_ALPHA = true
|
local USE_TEXTURE_ALPHA
|
||||||
|
|
||||||
if minetest.features.use_texture_alpha_string_modes then
|
if minetest.features.use_texture_alpha_string_modes then
|
||||||
USE_TEXTURE_ALPHA = "blend"
|
USE_TEXTURE_ALPHA = "blend"
|
||||||
|
WATER_ALPHA = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local lava_death_messages = {
|
local lava_death_messages = {
|
||||||
|
@ -40,6 +40,7 @@ minetest.register_node("mcl_core:water_flowing", {
|
||||||
},
|
},
|
||||||
sounds = mcl_sounds.node_sound_water_defaults(),
|
sounds = mcl_sounds.node_sound_water_defaults(),
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
use_texture_alpha = USE_TEXTURE_ALPHA,
|
use_texture_alpha = USE_TEXTURE_ALPHA,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "flowingliquid",
|
paramtype2 = "flowingliquid",
|
||||||
|
@ -85,6 +86,7 @@ S("• When water is directly below lava, the water turns into stone."),
|
||||||
},
|
},
|
||||||
sounds = mcl_sounds.node_sound_water_defaults(),
|
sounds = mcl_sounds.node_sound_water_defaults(),
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
alpha = WATER_ALPHA,
|
||||||
use_texture_alpha = USE_TEXTURE_ALPHA,
|
use_texture_alpha = USE_TEXTURE_ALPHA,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
|
|
|
@ -70,7 +70,7 @@ minetest.register_entity("mcl_end:crystal", {
|
||||||
collisionbox = {-1, 0.5, -1, 1, 2.5, 1},
|
collisionbox = {-1, 0.5, -1, 1, 2.5, 1},
|
||||||
mesh = "mcl_end_crystal.b3d",
|
mesh = "mcl_end_crystal.b3d",
|
||||||
textures = {"mcl_end_crystal.png"},
|
textures = {"mcl_end_crystal.png"},
|
||||||
collide_with_objects = false,
|
collide_with_objects = true,
|
||||||
},
|
},
|
||||||
on_punch = crystal_explode,
|
on_punch = crystal_explode,
|
||||||
on_activate = set_crystal_animation,
|
on_activate = set_crystal_animation,
|
||||||
|
|
|
@ -303,8 +303,8 @@ local flying_bobber_ENTITY={
|
||||||
collisionbox = {0,0,0,0,0,0},
|
collisionbox = {0,0,0,0,0,0},
|
||||||
pointable = false,
|
pointable = false,
|
||||||
|
|
||||||
get_staticdata = mcl_throwing.get_staticdata,
|
get_staticdata = get_staticdata,
|
||||||
on_activate = mcl_throwing.on_activate,
|
on_activate = on_activate,
|
||||||
|
|
||||||
_lastpos={},
|
_lastpos={},
|
||||||
_thrower = nil,
|
_thrower = nil,
|
||||||
|
|
|
@ -4,6 +4,11 @@ local S = minetest.get_translator("mcl_portals")
|
||||||
local SPAWN_MIN = mcl_vars.mg_end_min+70
|
local SPAWN_MIN = mcl_vars.mg_end_min+70
|
||||||
local SPAWN_MAX = mcl_vars.mg_end_min+98
|
local SPAWN_MAX = mcl_vars.mg_end_min+98
|
||||||
|
|
||||||
|
local PORTAL_ALPHA = 192
|
||||||
|
if minetest.features.use_texture_alpha_string_modes then
|
||||||
|
PORTAL_ALPHA = nil
|
||||||
|
end
|
||||||
|
|
||||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||||
|
|
||||||
local destroy_portal = function(pos)
|
local destroy_portal = function(pos)
|
||||||
|
@ -76,6 +81,7 @@ minetest.register_node("mcl_portals:portal_end", {
|
||||||
-- This is 15 in MC.
|
-- This is 15 in MC.
|
||||||
light_source = 14,
|
light_source = 14,
|
||||||
post_effect_color = {a = 192, r = 0, g = 0, b = 0},
|
post_effect_color = {a = 192, r = 0, g = 0, b = 0},
|
||||||
|
alpha = PORTAL_ALPHA,
|
||||||
after_destruct = destroy_portal,
|
after_destruct = destroy_portal,
|
||||||
-- This prevents “falling through”
|
-- This prevents “falling through”
|
||||||
collision_box = {
|
collision_box = {
|
||||||
|
|
|
@ -30,6 +30,7 @@ local N_Y_MIN, N_Y_MAX = mcl_vars.mg_bedrock_nether_bottom_min, mcl_vars.mg_be
|
||||||
local O_DY, N_DY = O_Y_MAX - O_Y_MIN + 1, N_Y_MAX - N_Y_MIN + 1
|
local O_DY, N_DY = O_Y_MAX - O_Y_MIN + 1, N_Y_MAX - N_Y_MIN + 1
|
||||||
|
|
||||||
-- Alpha and particles
|
-- Alpha and particles
|
||||||
|
local ALPHA = minetest.features.use_texture_alpha_string_modes and 192
|
||||||
local node_particles_allowed = minetest.settings:get("mcl_node_particles") or "none"
|
local node_particles_allowed = minetest.settings:get("mcl_node_particles") or "none"
|
||||||
local node_particles_levels = { none=0, low=1, medium=2, high=3 }
|
local node_particles_levels = { none=0, low=1, medium=2, high=3 }
|
||||||
local PARTICLES = node_particles_levels[node_particles_allowed]
|
local PARTICLES = node_particles_levels[node_particles_allowed]
|
||||||
|
@ -262,6 +263,7 @@ minetest.register_node(PORTAL, {
|
||||||
drop = "",
|
drop = "",
|
||||||
light_source = 11,
|
light_source = 11,
|
||||||
post_effect_color = {a = 180, r = 51, g = 7, b = 89},
|
post_effect_color = {a = 180, r = 51, g = 7, b = 89},
|
||||||
|
alpha = ALPHA,
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
|
|
|
@ -75,61 +75,13 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
|
||||||
from_liquid_source = true
|
from_liquid_source = true
|
||||||
river_water = node.name == "mclx_core:river_water_source"
|
river_water = node.name == "mclx_core:river_water_source"
|
||||||
-- Or reduce water level of cauldron by 1
|
-- Or reduce water level of cauldron by 1
|
||||||
elseif string.sub(node.name, 1, 14) == "mcl_cauldrons:" then
|
elseif mcl_cauldrons.is_cauldron(node.name) then
|
||||||
local pname = placer:get_player_name()
|
local pname = placer:get_player_name()
|
||||||
if minetest.is_protected(pointed_thing.under, pname) then
|
if minetest.is_protected(pointed_thing.under, pname) then
|
||||||
minetest.record_protection_violation(pointed_thing.under, pname)
|
minetest.record_protection_violation(pointed_thing.under, pname)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
if node.name == "mcl_cauldrons:cauldron_3" then
|
mcl_cauldrons.take_small_cauldron(pointed_thing.under, itemstack, placer, {dug = "mcl_potions_bottle_fill"})
|
||||||
get_water = true
|
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2"})
|
|
||||||
elseif node.name == "mcl_cauldrons:cauldron_2" then
|
|
||||||
get_water = true
|
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1"})
|
|
||||||
elseif node.name == "mcl_cauldrons:cauldron_1" then
|
|
||||||
get_water = true
|
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
|
|
||||||
elseif node.name == "mcl_cauldrons:cauldron_3r" then
|
|
||||||
get_water = true
|
|
||||||
river_water = true
|
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_2r"})
|
|
||||||
elseif node.name == "mcl_cauldrons:cauldron_2r" then
|
|
||||||
get_water = true
|
|
||||||
river_water = true
|
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron_1r"})
|
|
||||||
elseif node.name == "mcl_cauldrons:cauldron_1r" then
|
|
||||||
get_water = true
|
|
||||||
river_water = true
|
|
||||||
minetest.set_node(pointed_thing.under, {name="mcl_cauldrons:cauldron"})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if get_water then
|
|
||||||
local water_bottle
|
|
||||||
if river_water then
|
|
||||||
water_bottle = ItemStack("mcl_potions:river_water")
|
|
||||||
else
|
|
||||||
water_bottle = ItemStack("mcl_potions:water")
|
|
||||||
end
|
|
||||||
-- Replace with water bottle, if possible, otherwise
|
|
||||||
-- place the water potion at a place where's space
|
|
||||||
local inv = placer:get_inventory()
|
|
||||||
minetest.sound_play("mcl_potions_bottle_fill", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true)
|
|
||||||
if minetest.is_creative_enabled(placer:get_player_name()) then
|
|
||||||
-- Don't replace empty bottle in creative for convenience reasons
|
|
||||||
if not inv:contains_item("main", water_bottle) then
|
|
||||||
inv:add_item("main", water_bottle)
|
|
||||||
end
|
|
||||||
elseif itemstack:get_count() == 1 then
|
|
||||||
return water_bottle
|
|
||||||
else
|
|
||||||
if inv:room_for_item("main", water_bottle) then
|
|
||||||
inv:add_item("main", water_bottle)
|
|
||||||
else
|
|
||||||
minetest.add_item(placer:get_pos(), water_bottle)
|
|
||||||
end
|
|
||||||
itemstack:take_item()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
|
@ -154,31 +106,6 @@ local potion_image = function(colorstring, opacity)
|
||||||
return "mcl_potions_potion_overlay.png^[colorize:"..colorstring..":"..tostring(opacity).."^mcl_potions_potion_bottle.png"
|
return "mcl_potions_potion_overlay.png^[colorize:"..colorstring..":"..tostring(opacity).."^mcl_potions_potion_bottle.png"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Cauldron fill up rules:
|
|
||||||
-- Adding any water increases the water level by 1, preserving the current water type
|
|
||||||
local cauldron_levels = {
|
|
||||||
-- start = { add water, add river water }
|
|
||||||
{ "", "_1", "_1r" },
|
|
||||||
{ "_1", "_2", "_2" },
|
|
||||||
{ "_2", "_3", "_3" },
|
|
||||||
{ "_1r", "_2r", "_2r" },
|
|
||||||
{ "_2r", "_3r", "_3r" },
|
|
||||||
}
|
|
||||||
local fill_cauldron = function(cauldron, water_type)
|
|
||||||
local base = "mcl_cauldrons:cauldron"
|
|
||||||
for i=1, #cauldron_levels do
|
|
||||||
if cauldron == base .. cauldron_levels[i][1] then
|
|
||||||
if water_type == "mclx_core:river_water_source" then
|
|
||||||
return base .. cauldron_levels[i][3]
|
|
||||||
else
|
|
||||||
return base .. cauldron_levels[i][2]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Itemstring of potions is “mcl_potions:<NBT Potion Tag>”
|
-- Itemstring of potions is “mcl_potions:<NBT Potion Tag>”
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_potions:water", {
|
minetest.register_craftitem("mcl_potions:water", {
|
||||||
|
|
|
@ -33,9 +33,3 @@ Handle creative mode, and throw params.
|
||||||
|
|
||||||
* entity_name: the name of the entity to throw
|
* entity_name: the name of the entity to throw
|
||||||
* velocity: (optional) velocity overide (can be nil)
|
* velocity: (optional) velocity overide (can be nil)
|
||||||
|
|
||||||
## mcl_throwing.get_staticdata(self)
|
|
||||||
Must be used in entity def if you want the entity to be saved after unloading mapblock.
|
|
||||||
|
|
||||||
## mcl_throwing.on_activate(self, staticdata, dtime_s)
|
|
||||||
Must be used in entity def if you want the entity to be saved after unloading mapblock.
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ function mcl_throwing.dispense_function(stack, dispenserpos, droppos, dropnode,
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Staticdata handling because objects may want to be reloaded
|
-- Staticdata handling because objects may want to be reloaded
|
||||||
function mcl_throwing.get_staticdata(self)
|
local get_staticdata = function(self)
|
||||||
local thrower
|
local thrower
|
||||||
-- Only save thrower if it's a player name
|
-- Only save thrower if it's a player name
|
||||||
if type(self._thrower) == "string" then
|
if type(self._thrower) == "string" then
|
||||||
|
@ -71,7 +71,7 @@ function mcl_throwing.get_staticdata(self)
|
||||||
return minetest.serialize(data)
|
return minetest.serialize(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_throwing.on_activate(self, staticdata, dtime_s)
|
local on_activate = function(self, staticdata, dtime_s)
|
||||||
local data = minetest.deserialize(staticdata)
|
local data = minetest.deserialize(staticdata)
|
||||||
if data then
|
if data then
|
||||||
self._lastpos = data._lastpos
|
self._lastpos = data._lastpos
|
||||||
|
|
|
@ -9,8 +9,8 @@ local snowball_ENTITY={
|
||||||
collisionbox = {0,0,0,0,0,0},
|
collisionbox = {0,0,0,0,0,0},
|
||||||
pointable = false,
|
pointable = false,
|
||||||
|
|
||||||
get_staticdata = mcl_throwing.get_staticdata,
|
get_staticdata = get_staticdata,
|
||||||
on_activate = mcl_throwing.on_activate,
|
on_activate = on_activate,
|
||||||
_thrower = nil,
|
_thrower = nil,
|
||||||
|
|
||||||
_lastpos={},
|
_lastpos={},
|
||||||
|
@ -23,8 +23,8 @@ local egg_ENTITY={
|
||||||
collisionbox = {0,0,0,0,0,0},
|
collisionbox = {0,0,0,0,0,0},
|
||||||
pointable = false,
|
pointable = false,
|
||||||
|
|
||||||
get_staticdata = mcl_throwing.get_staticdata,
|
get_staticdata = get_staticdata,
|
||||||
on_activate = mcl_throwing.on_activate,
|
on_activate = on_activate,
|
||||||
_thrower = nil,
|
_thrower = nil,
|
||||||
|
|
||||||
_lastpos={},
|
_lastpos={},
|
||||||
|
@ -38,8 +38,8 @@ local pearl_ENTITY={
|
||||||
collisionbox = {0,0,0,0,0,0},
|
collisionbox = {0,0,0,0,0,0},
|
||||||
pointable = false,
|
pointable = false,
|
||||||
|
|
||||||
get_staticdata = mcl_throwing.get_staticdata,
|
get_staticdata = get_staticdata,
|
||||||
on_activate = mcl_throwing.on_activate,
|
on_activate = on_activate,
|
||||||
|
|
||||||
_lastpos={},
|
_lastpos={},
|
||||||
_thrower = nil, -- Player ObjectRef of the player who threw the ender pearl
|
_thrower = nil, -- Player ObjectRef of the player who threw the ender pearl
|
||||||
|
@ -203,7 +203,7 @@ local pearl_on_step = function(self, dtime)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
-- Activate when hitting a solid node or a plant
|
-- Activate when hitting a solid node or a plant
|
||||||
elseif walkable or nn == "mcl_core:vine" or nn == "mcl_core:deadbush" or minetest.get_item_group(nn, "flower") ~= 0 or minetest.get_item_group(nn, "sapling") ~= 0 or minetest.get_item_group(nn, "plant") ~= 0 or minetest.get_item_group(nn, "mushroom") ~= 0 or not def then
|
elseif walkable or nn == "mcl_core:vine" or nn == "mcl_core:deadbush" or minetest.get_item_group(nn, "flower") ~= 0 or minetest.get_item_group(nn, "sapling") ~= 0 or minetest.get_item_group(nn, "plant") ~= 0 or minetest.get_item_group(nn, "mushroom") ~= 0 or not def then
|
||||||
local player = self._thrower and minetest.get_player_by_name(self._thrower)
|
local player = minetest.get_player_by_name(self._thrower)
|
||||||
if player then
|
if player then
|
||||||
-- Teleport and hurt player
|
-- Teleport and hurt player
|
||||||
|
|
||||||
|
|
|
@ -313,7 +313,6 @@ mcl_structures.generate_fossil = function(pos, rotation, pr)
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_structures.generate_end_exit_portal = function(pos, rot)
|
mcl_structures.generate_end_exit_portal = function(pos, rot)
|
||||||
minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon")
|
|
||||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal.mts"
|
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_end_exit_portal.mts"
|
||||||
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
|
return mcl_structures.place_schematic(pos, path, rot or "0", nil, true)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue