mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-12 02:50:25 +01:00
Fix [buckets] w/ acid or sand, make [death_message] work w/ aliases
This commit is contained in:
parent
2841c76d60
commit
32ae8aca19
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
minetest.register_alias("bucket", "bucket:bucket_empty")
|
minetest.register_alias("bucket", "bucket:bucket_empty")
|
||||||
minetest.register_alias("bucket_water", "bucket:bucket_water")
|
minetest.register_alias("bucket_water", "bucket:bucket_water")
|
||||||
minetest.register_alias("bucket_acid", "bucket:bucket_acid")
|
|
||||||
minetest.register_alias("bucket_lava", "bucket:bucket_lava")
|
minetest.register_alias("bucket_lava", "bucket:bucket_lava")
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@ -53,6 +52,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
|
|||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
liquids_pointable = true,
|
liquids_pointable = true,
|
||||||
groups = groups,
|
groups = groups,
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
on_place = function(itemstack, user, pointed_thing)
|
||||||
-- Must be pointing to node
|
-- Must be pointing to node
|
||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
@ -60,10 +60,8 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
|
|||||||
end
|
end
|
||||||
|
|
||||||
local node = minetest.get_node_or_nil(pointed_thing.under)
|
local node = minetest.get_node_or_nil(pointed_thing.under)
|
||||||
local ndef
|
local ndef = node and minetest.registered_nodes[node.name]
|
||||||
if node then
|
|
||||||
ndef = minetest.registered_nodes[node.name]
|
|
||||||
end
|
|
||||||
-- Call on_rightclick if the pointed node defines it
|
-- Call on_rightclick if the pointed node defines it
|
||||||
if ndef and ndef.on_rightclick and
|
if ndef and ndef.on_rightclick and
|
||||||
user and not user:get_player_control().sneak then
|
user and not user:get_player_control().sneak then
|
||||||
@ -106,8 +104,6 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Empty Bucket code by Casimir.
|
|
||||||
|
|
||||||
minetest.register_craftitem("bucket:bucket_empty", {
|
minetest.register_craftitem("bucket:bucket_empty", {
|
||||||
description = "Empty Bucket",
|
description = "Empty Bucket",
|
||||||
inventory_image = "bucket.png",
|
inventory_image = "bucket.png",
|
||||||
@ -145,7 +141,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
|
|||||||
else
|
else
|
||||||
local pos = user:getpos()
|
local pos = user:getpos()
|
||||||
pos.y = math.floor(pos.y + 0.5)
|
pos.y = math.floor(pos.y + 0.5)
|
||||||
core.add_item(pos, liquiddef.itemname)
|
minetest.add_item(pos, liquiddef.itemname)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- set to return empty buckets minus 1
|
-- set to return empty buckets minus 1
|
||||||
@ -186,24 +182,6 @@ bucket.register_liquid(
|
|||||||
"Lava Bucket"
|
"Lava Bucket"
|
||||||
)
|
)
|
||||||
|
|
||||||
bucket.register_liquid(
|
|
||||||
"default:acid_source",
|
|
||||||
"default:acid_flowing",
|
|
||||||
"bucket:bucket_acid",
|
|
||||||
"bucket_acid.png",
|
|
||||||
"Acid Bucket",
|
|
||||||
{not_in_creative_inventory = 1}
|
|
||||||
)
|
|
||||||
|
|
||||||
bucket.register_liquid(
|
|
||||||
"default:sand_source",
|
|
||||||
"default:sand_flowing",
|
|
||||||
"bucket:bucket_sand",
|
|
||||||
"bucket_sand.png",
|
|
||||||
"Sand Bucket",
|
|
||||||
{not_in_creative_inventory = 1}
|
|
||||||
)
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "bucket:bucket_lava",
|
recipe = "bucket:bucket_lava",
|
||||||
@ -211,11 +189,3 @@ minetest.register_craft({
|
|||||||
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
|
replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "bucket:bucket_sand",
|
|
||||||
recipe = {
|
|
||||||
{"group:sand"},
|
|
||||||
{"group:sand"},
|
|
||||||
{"bucket:bucket_water"},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
@ -124,12 +124,12 @@ local monsters = {
|
|||||||
["mobs:cow"] = "cow",
|
["mobs:cow"] = "cow",
|
||||||
["mobs:creeper"] = "creeper",
|
["mobs:creeper"] = "creeper",
|
||||||
["mobs:dog"] = "dog",
|
["mobs:dog"] = "dog",
|
||||||
["mobs:greenbig"] = "big green slim",
|
["mobs:greenbig"] = "big green slime",
|
||||||
["mobs:greenmedium"] = "medium green slim",
|
["mobs:greenmedium"] = "medium green slime",
|
||||||
["mobs:greensmall"] = "small green slim",
|
["mobs:greensmall"] = "small green slime",
|
||||||
["mobs:lavabig"] = "big lava slim",
|
["mobs:lavabig"] = "big lava slime",
|
||||||
["mobs:lavamedium"] = "medium lava slim",
|
["mobs:lavamedium"] = "medium lava slime",
|
||||||
["mobs:lavasmall"] = "small lava slim",
|
["mobs:lavasmall"] = "small lava slime",
|
||||||
["mobs:yeti"] = "yeti",
|
["mobs:yeti"] = "yeti",
|
||||||
["mobs:snowball"] = "yeti",
|
["mobs:snowball"] = "yeti",
|
||||||
["mobs:npc"] = "npc",
|
["mobs:npc"] = "npc",
|
||||||
@ -197,6 +197,11 @@ minetest.register_on_respawnplayer(function(player)
|
|||||||
whacked[player:get_player_name()] = nil
|
whacked[player:get_player_name()] = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
local function equiv(what, to)
|
||||||
|
what = (type(what) ~= 'string') and what.name or what
|
||||||
|
return what == to or minetest.registered_aliases[what] == to
|
||||||
|
end
|
||||||
|
|
||||||
if RANDOM_MESSAGES == true then
|
if RANDOM_MESSAGES == true then
|
||||||
minetest.register_on_dieplayer(function(player)
|
minetest.register_on_dieplayer(function(player)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
@ -219,10 +224,10 @@ if RANDOM_MESSAGES == true then
|
|||||||
elseif player:get_breath() == 0 and node.groups.water then
|
elseif player:get_breath() == 0 and node.groups.water then
|
||||||
death_message = messages.water[math.random(1,#messages.water)]
|
death_message = messages.water[math.random(1,#messages.water)]
|
||||||
-- Death by fire
|
-- Death by fire
|
||||||
elseif node.name == "fire:basic_flame" then
|
elseif equiv(node, "fire:basic_flame") then
|
||||||
death_message = messages.fire[math.random(1,#messages.fire)]
|
death_message = messages.fire[math.random(1,#messages.fire)]
|
||||||
-- Death in quicksand
|
-- Death in quicksand
|
||||||
elseif player:get_breath() == 0 and node.name == "default:sand_source" or node.name == "default:sand_flowing" then
|
elseif player:get_breath() == 0 and equiv(node, "default:sand_source") or equiv(node, "default:sand_flowing") then
|
||||||
death_message = messages.sand[math.random(1,#messages.sand)]
|
death_message = messages.sand[math.random(1,#messages.sand)]
|
||||||
-- Death by something else
|
-- Death by something else
|
||||||
else
|
else
|
||||||
@ -254,7 +259,7 @@ else
|
|||||||
elseif player:get_breath() == 0 then
|
elseif player:get_breath() == 0 then
|
||||||
minetest.chat_send_all(player_name .. " ran out of air.")
|
minetest.chat_send_all(player_name .. " ran out of air.")
|
||||||
-- Death by fire
|
-- Death by fire
|
||||||
elseif node.name == "fire:basic_flame" then
|
elseif equiv(node, "fire:basic_flame") then
|
||||||
minetest.chat_send_all(player_name .. " burned to a crisp.")
|
minetest.chat_send_all(player_name .. " burned to a crisp.")
|
||||||
-- Death by something else
|
-- Death by something else
|
||||||
else
|
else
|
||||||
|
@ -33,3 +33,8 @@ do -- moreores
|
|||||||
minetest.register_alias('silver_block', modname .. ':silverblock')
|
minetest.register_alias('silver_block', modname .. ':silverblock')
|
||||||
minetest.register_alias('tin_block', modname .. ':tinblock')
|
minetest.register_alias('tin_block', modname .. ':tinblock')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.register_alias('bucket_acid', modname .. ':bucket_acid')
|
||||||
|
minetest.register_alias('bucket:bucket_acid', modname .. ':bucket_acid')
|
||||||
|
minetest.register_alias('bucket_sand', modname .. ':bucket_sand')
|
||||||
|
minetest.register_alias('bucket:bucket_sand', modname .. ':bucket_sand')
|
||||||
|
@ -1 +1,2 @@
|
|||||||
default
|
default
|
||||||
|
bucket
|
||||||
|
@ -11,3 +11,4 @@ dofile(modpath .. '/biomes.lua')
|
|||||||
dofile(modpath .. '/mapgen.lua')
|
dofile(modpath .. '/mapgen.lua')
|
||||||
dofile(modpath .. '/nodes.lua')
|
dofile(modpath .. '/nodes.lua')
|
||||||
dofile(modpath .. '/trees.lua')
|
dofile(modpath .. '/trees.lua')
|
||||||
|
dofile(modpath .. '/registers.lua')
|
||||||
|
28
mods/mff/mff_classic/registers.lua
Normal file
28
mods/mff/mff_classic/registers.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
local modname = minetest.get_current_modname()
|
||||||
|
|
||||||
|
bucket.register_liquid(
|
||||||
|
modname .. ':acid_source',
|
||||||
|
modname .. ':acid_flowing',
|
||||||
|
modname .. ':bucket_acid',
|
||||||
|
'bucket_acid.png',
|
||||||
|
"Acid Bucket",
|
||||||
|
{not_in_creative_inventory = 1}
|
||||||
|
)
|
||||||
|
|
||||||
|
bucket.register_liquid(
|
||||||
|
modname .. ':sand_source',
|
||||||
|
modname .. ':sand_flowing',
|
||||||
|
modname .. ':bucket_sand',
|
||||||
|
'bucket_sand.png',
|
||||||
|
"Sand Bucket",
|
||||||
|
{not_in_creative_inventory = 1}
|
||||||
|
)
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = modname .. ':bucket_sand',
|
||||||
|
recipe = {
|
||||||
|
{'group:sand'},
|
||||||
|
{'group:sand'},
|
||||||
|
{'bucket:bucket_water'}
|
||||||
|
},
|
||||||
|
})
|
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 250 B |
Loading…
Reference in New Issue
Block a user