Imported from trollstream "ContentDB"

master
OldCoder 2022-09-04 22:01:38 -07:00
commit a9c07a08e2
28 changed files with 499 additions and 0 deletions

69
README.md Normal file
View File

@ -0,0 +1,69 @@
"Doorbell" created by "Miniontoby"
I have made a doorbell mod with a doorbell and a delete tool.
Working:
When you push the doorbell there is coming a doorbell_sound only at the person who's hosting the server or only singleplayer.
Recipe:
- = none,
| = delete_tool,
\ = doorbell,
/ = wood,
m_s = mesecons_button,
w_b = black wool,
w_w = white wool,
m_m = mesecons,
d_l = digiline,
Doorbell_locked {
\ | -
}
Doorbell {
w_b w_b w_b
w_b w_w w_b
w_b w_b w_b
}
Delete tool {
\
}
Doorbell 3D {
\ m_s -
}
Doorbell mesecons {
\ m_m -
}
Doorbell digilines{
\ d_l -
}
History:
I have made It when I was just 10 years old, but when I was 13 years old and I made the delete tool
I made the delete tool because I couldn't delete the doorbell.
You can use the delete tool for every node and it look like as the nodebreaker in the mod "Pipeworks".

1
author.txt Normal file
View File

@ -0,0 +1 @@
Miniontoby

57
changelog.txt Normal file
View File

@ -0,0 +1,57 @@
Version 1.1
I have made 2 more doorbells.
One looks as the mesecons button and the other one is the doorbell with right click.
The doorbell that already was there is now renamed to "doorbell_lock" because you can't delete them by hand (only by the delete tool) and that can you see as 'locked' and it has a lock drawing in the center.
===========================================================================================
Version 1.2
I have made a new doorbell.
The newest doorbell is named "doorbell_mesecons" and you need to have "mesecons". It does the doorbell sound when mesecons (that connected is) on is.
===========================================================================================
Version 1.3
I have made a change.
The mod is now looking of there is the mod "mesecons" and when that mod is on, it load the "doorbell_mesecons" and the "3D doorbell"
And the receipes are changed
===========================================================================================
Version 1.4
I have made a new Doorbell.
The newest doorbell is named "doorbell_digiline" and you need to have "digilines" for it. When you do make a lua controller with button you can do:
"if pin.c == true then
digiline_send("channel","doorbell")
end"
You need for this code the button at port "c" and change the "channel" to the channel you have chosen (when you right click on the doorbell).
===========================================================================================
Version 1.5
I have made a new Doorbell.
The newest doorbell is named "doorbell_marker" and when you right_click it the doorbell placer and you gets an waypoint of the position of the doorbell
===========================================================================================
Version 1.6
I have changed the code so that the player who is near the doorbell can hear it and the doorbell_marker that the owner it also can hear.
===========================================================================================

21
delete.lua Normal file
View File

@ -0,0 +1,21 @@
--doorbell mod
minetest.register_tool("doorbell:delete", {
inventory_image = "kapot.png",
description = "delete",
on_use = function (itemstack, user, pointed_thing)
local position = minetest.get_pointed_thing_position(pointed_thing)
if pointed_thing.type == "node" then
if position then
minetest.dig_node(position)
end
end
return nil
end,
})
minetest.register_craft({
output = '"doorbell:delete" 1',
recipe = {
{'doorbell:doorbell'},
}
})

3
depends.txt Normal file
View File

@ -0,0 +1,3 @@
default
mesecons?
digilines?

1
description.txt Normal file
View File

@ -0,0 +1 @@
A doorbell mod with a doorbell(inc. sound) and a delete tool. Made by "Miniontoby". More info check README.md

19
doorbell.lua Normal file
View File

@ -0,0 +1,19 @@
--doorbell mod
minetest.register_node("doorbell:doorbell",{
tiles = {"doorbell.png"},
description = "doorbell",
groups = {cracky=1},
on_rightclick = function(pos)
doorbell_play(pos, "deurbel1")
minetest.set_node(pos, {name = "doorbell:doorbell"})
end,
})
minetest.register_craft({
output = '"doorbell:doorbell" 1',
recipe = {
{'wool:black', 'wool:black', 'wool:black'},
{'wool:black', 'wool:white', 'wool:black'},
{'wool:black', 'wool:black', 'wool:black'},
}
})

89
doorbell3d.lua Normal file
View File

@ -0,0 +1,89 @@
mesecon.button_turnoff = function (pos)
local node = minetest.get_node(pos)
if node.name ~= "doorbell:button_on" then -- has been dug
return
end
minetest.swap_node(pos, {name = "doorbell:button_off", param2 = node.param2})
end
minetest.register_node("doorbell:button_off", {
drawtype = "nodebox",
tiles = {
"doorbell_button_sides.png",
"doorbell_button_sides.png",
"doorbell_button_sides.png",
"doorbell_button_sides.png",
"doorbell_button_sides.png",
"doorbell_button_off.png"
},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
legacy_wallmounted = true,
walkable = false,
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = { -6/16, -6/16, 5/16, 6/16, 6/16, 8/16 }
},
node_box = {
type = "fixed",
fixed = {
{ -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, -- the thin plate behind the button
{ -4/16, -2/16, 4/16, 4/16, 2/16, 6/16 } -- the button itself
}
},
groups = {dig_immediate=2},
description = "doorbell 3D",
on_rightclick = function (pos, node)
minetest.swap_node(pos, {name = "doorbell:button_on", param2=node.param2})
doorbell_play(pos, "deurbel1")
minetest.get_node_timer(pos):start(1)
end,
sounds = default.node_sound_stone_defaults(),
on_blast = mesecon.on_blastnode,
})
minetest.register_node("doorbell:button_on", {
drawtype = "nodebox",
tiles = {
"doorbell_button_sides.png",
"doorbell_button_sides.png",
"doorbell_button_sides.png",
"doorbell_button_sides.png",
"doorbell_button_sides.png",
"doorbell_button_on.png"
},
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
legacy_wallmounted = true,
walkable = false,
on_rotate = false,
light_source = minetest.LIGHT_MAX-7,
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = { -6/16, -6/16, 5/16, 6/16, 6/16, 8/16 }
},
node_box = {
type = "fixed",
fixed = {
{ -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 },
{ -4/16, -2/16, 11/32, 4/16, 2/16, 6/16 }
}
},
groups = {dig_immediate=2, not_in_creative_inventory=1},
drop = 'doorbell:button_off',
description = "doorbell 3D",
sounds = default.node_sound_stone_defaults(),
on_timer = mesecon.button_turnoff,
on_blast = mesecon.on_blastnode,
})
minetest.register_craft({
output = "doorbell:button_off 2",
recipe = {
{"doorbell:doorbell","mesecons_button:button_off"},
}
})

37
doorbell_digiline.lua Normal file
View File

@ -0,0 +1,37 @@
--doorbell mod
minetest.register_node("doorbell:doorbell_digiline",{
tiles = {"doorbell_digiline.png"},
description = "doorbell_digiline",
groups = {cracky=3},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec","field[channel;Channel;${channel}")
end,
on_receive_fields = function(pos, formname, fields, sender)
local name = sender:get_player_name()
local meta = minetest.get_meta(pos)
if fields.channel then meta:set_string("channel",fields.channel) end
end,
digiline =
{
receptor = {},
effector = {
action = function(pos,node,channel,msg)
local meta = minetest.get_meta(pos)
local setchan = meta:get_string("channel")
if channel ~= setchan then return end
if msg == "doorbell" then
doorbell_play(pos, "deurbel1")
end
end
}
},
})
minetest.register_craft({
output = '"doorbell:doorbell_digiline" 1',
recipe = {
{'doorbell:doorbell', "digilines:wire_std_00000000"},
}
})

16
doorbell_lock.lua Normal file
View File

@ -0,0 +1,16 @@
--doorbell mod
minetest.register_node("doorbell:doorbell_lock",{
tiles = {"doorbell_locked.png"},
description = "doorbell_locked",
on_punch = function(pos)
doorbell_play(pos, "deurbel1")
minetest.set_node(pos, {name = "doorbell:doorbell_lock"})
end,
})
minetest.register_craft({
output = '"doorbell:doorbell_lock" 1',
recipe = {
{'doorbell:doorbell', 'doorbell:delete'},
}
})

68
doorbell_marker.lua Normal file
View File

@ -0,0 +1,68 @@
--doorbell mod
local doorbell_way = {}
minetest.register_node("doorbell:doorbell_marker", {
tiles = {"doorbell_marker.png"},
description = "doorbell marker",
groups = {cracky = 1},
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("owner", "")
end,
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local player_name = player:get_player_name()
local meta = minetest.get_meta(pos)
local owner_name = meta:get_string("owner")
local owner_player = minetest.get_player_by_name(owner_name)
if not doorbell_way[player_name] then
doorbell_way[player_name] = player:hud_add({
hud_elem_type = "waypoint",
world_pos = pos,
name = "Doorbell",
text = pos,
number = 0xEDF010,
})
doorbell_play(player:get_pos(), "deurbel1")
end
if owner_player and owner_name ~= player_name and not doorbell_way[owner_name] then
doorbell_way[owner_name] = owner_player:hud_add({
hud_elem_type = "waypoint",
world_pos = pos,
name = "Doorbell",
text = pos,
number = 0xEDF010,
})
doorbell_play(owner_player:get_pos(), "deurbel1")
end
end,
on_punch = function(pos, node, player, pointed_thing)
local player_name = player:get_player_name()
local meta = minetest.get_meta(pos)
local owner_name = meta:get_string("owner")
local owner_player = minetest.get_player_by_name(owner_name)
if doorbell_way[player_name] then
player:hud_remove(doorbell_way[player_name])
doorbell_way[player_name] = nil
end
if owner_player and owner_name ~= player_name and doorbell_way[owner_name] then
owner_player:hud_remove(doorbell_way[owner_name])
doorbell_way[owner_name] = nil
end
end,
})
minetest.register_craft({
output = '"doorbell:doorbell_marker" 1',
recipe = {
{'wool:black', 'wool:black', 'wool:black'},
{'wool:black', 'wool:blue', 'wool:black'},
{'wool:black', 'wool:black', 'wool:black'},
}
})

53
doorbell_mesecons.lua Normal file
View File

@ -0,0 +1,53 @@
local mesedoorbell_rules = {
{x=0, y=0, z=-1},
{x=1, y=0, z=0},
{x=-1, y=0, z=0},
{x=0, y=0, z=1},
{x=1, y=1, z=0},
{x=1, y=-1, z=0},
{x=-1, y=1, z=0},
{x=-1, y=-1, z=0},
{x=0, y=1, z=1},
{x=0, y=-1, z=1},
{x=0, y=1, z=-1},
{x=0, y=-1, z=-1},
{x=0, y=-1, z=0},
}
minetest.register_node("doorbell:doorbell_mesecon_off", {
tiles = {"doorbell_off.png"},
description = "doorbell Mesecons",
is_ground_content = false,
groups = {cracky = 2, mesecon_effector_off = 1, mesecon = 2},
mesecons = {effector = {
rules = mesedoorbell_rules,
action_on = function (pos, node)
minetest.swap_node(pos, {name = "doorbell:doorbell_mesecon_on", param2 = node.param2})
doorbell_play(pos, "deurbel1")
end,
}},
on_blast = mesecon.on_blastnode,
})
minetest.register_node("doorbell:doorbell_mesecon_on", {
tiles = {"doorbell_on.png"},
description = "doorbell Mesecons",
is_ground_content = false,
groups = {cracky = 2, not_in_creative_inventory = 1, mesecon = 2},
drop = "doorbell:doorbell_mesecon_off",
light_source = minetest.LIGHT_MAX - 2,
mesecons = {effector = {
rules = mesedoorbell_rules,
action_off = function (pos, node)
minetest.swap_node(pos, {name = "doorbell:doorbell_mesecon_off", param2 = node.param2})
end,
}},
on_blast = mesecon.on_blastnode,
})
minetest.register_craft({
output = "doorbell:doorbell_mesecon_off",
recipe = {
{"doorbell:doorbell", "group:mesecon_conductor_craftable"}
}
})

14
functions.lua Normal file
View File

@ -0,0 +1,14 @@
doorbell_play = function(pos, param2)
pos.y = pos.y-1
local nodeunder = minetest.get_node(pos).name
local soundname = node_sounds[nodeunder]
if not soundname then
soundname = soundnames[param2]
if not soundname then
minetest.log("error", "[doorbell] No soundname found, test param2")
return
end
end
pos.y = pos.y+1
minetest.sound_play(soundname, {pos = pos})
end

51
init.lua Normal file
View File

@ -0,0 +1,51 @@
--doorbell mod
print("Load 'Doorbell' mod [Doorbell]")
print("")
dofile(minetest.get_modpath("doorbell").."/functions.lua")
print("Load doorbell [Doorbell]")
dofile(minetest.get_modpath("doorbell").."/doorbell.lua")
print("[OK] Loaded doorbell [Doorbell]")
print("")
print("Load Delete [Doorbell]")
dofile(minetest.get_modpath("doorbell").."/delete.lua")
print("[OK] Loaded Delete [Doorbell]")
print("")
print("Load doorbell_lock [Doorbell]")
dofile(minetest.get_modpath("doorbell").."/doorbell_lock.lua")
print("[OK] Loaded doorbell_lock [Doorbell]")
print("")
print("Check mesecons is on [Doorbell]")
print("")
if minetest.get_modpath('mesecons') then
print("Load doorbell 3D [Doorbell]")
dofile(minetest.get_modpath("doorbell").."/doorbell3d.lua")
print("[OK] Loaded doorbell 3D [Doorbell]")
print("")
print("Load doorbell_mesecons [Doorbell]")
dofile(minetest.get_modpath("doorbell").."/doorbell_mesecons.lua")
print("[OK] Loaded doorbell_mesecons [Doorbell]")
print("")
end
print("Check digiline is on [Doorbell]")
print("")
if minetest.get_modpath('digilines') then
print("Load doorbell_digiline [Doorbell]")
dofile(minetest.get_modpath("doorbell").."/doorbell_digiline.lua")
print("[OK] Loaded doorbell_digiline [Doorbell]")
print("")
end
print("Load doorbell_marker [Doorbell]")
dofile(minetest.get_modpath("doorbell").."/doorbell_marker.lua")
print("[OK] Loaded doorbell_marker [Doorbell]")
print("")
print("[OK] Loaded 'Doorbell' mod [Doorbell]")

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 KiB

BIN
screenshot2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 KiB

BIN
sounds/deurbel1.ogg Normal file

Binary file not shown.

BIN
sounds/deurbel1.wav Normal file

Binary file not shown.

BIN
textures/doorbell.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
textures/doorbell_off.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
textures/doorbell_on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
textures/kapot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB