1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
minetest.register_node(":firealarm:pullstation_off",{
description = "Fire Alarm Pull Station",
groups = { oddly_breakable_by_hand = 1 },
tiles = {
"firealarm_pullstation_back.png",
"firealarm_pullstation_back.png",
"firealarm_pullstation_back.png",
"firealarm_pullstation_back.png",
"firealarm_pullstation_back.png",
"firealarm_pullstation_front_off.png",
},
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.15,-0.5,0.4,0.18,-0.11,0.5},
},
},
on_punch = function(pos,_,player)
local name = player:get_player_name()
minetest.chat_send_player(name,string.format("Position: %d,%d,%d",pos.x,pos.y,pos.z))
end,
on_rightclick = function(pos,node)
local devInfo = firealarm.getDevInfo("signaling",pos)
if devInfo then
devInfo.active = true
node.name = "firealarm:pullstation_on"
minetest.set_node(pos,node)
minetest.sound_play("firealarm_pullstation_pull",{pos=pos})
if devInfo.associated then
local panelPos = minetest.get_position_from_hash(devInfo.associated)
if panelPos then firealarm.loadNode(panelPos) end
if type(firealarm.panelABM) == "function" then firealarm.panelABM(pos) end
end
end
end,
after_place_node = function(pos)
firealarm.setDevInfo("signaling",pos,{active = false,manualReset = true})
end,
after_dig_node = function(pos)
firealarm.setDevInfo("signaling",pos,nil)
end,
})
minetest.register_node(":firealarm:pullstation_on",{
drop = "firealarm:pullstation_off",
description = "Fire Alarm Pull Station (pulled state - you hacker you!)",
groups = { oddly_breakable_by_hand = 1,not_in_creative_inventory = 1 },
tiles = {
"firealarm_pullstation_back.png",
"firealarm_pullstation_back.png",
"firealarm_pullstation_back.png",
"firealarm_pullstation_back.png",
"firealarm_pullstation_back.png",
"firealarm_pullstation_front_on.png",
},
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.15,-0.5,0.4,0.18,-0.11,0.5},
},
},
on_punch = function(pos,_,player)
local name = player:get_player_name()
minetest.chat_send_player(name,string.format("Position: %d,%d,%d",pos.x,pos.y,pos.z))
end,
on_rightclick = function(pos,node,clicker)
if minetest.is_protected(pos,clicker) and not minetest.check_player_privs(clicker,"protection_bypass") then
minetest.record_protection_violation(pos,clicker:get_player_name())
minetest.chat_send_player(clicker:get_player_name(),"You are not authorized to reset this pull station")
return
end
local devInfo = firealarm.getDevInfo("signaling",pos)
if devInfo then
devInfo.active = false
node.name = "firealarm:pullstation_off"
minetest.set_node(pos,node)
minetest.sound_play("firealarm_pullstation_reset",{pos=pos})
end
end,
after_dig_node = function(pos)
firealarm.setDevInfo("signaling",pos,nil)
end,
})
|