blob: a2074f80696bb6ea4033f462da93a26006145e08 (
plain)
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
|
-- AWARDS
-- by Rubenwardy, CC-BY-SA
-------------------------------------------------------
-- this is the trigger handler file for the awards mod
-------------------------------------------------------
-- Function for Triggers
awards.onDig={}
awards.onTick={}
-- Player functions
-- Trigger Handles
minetest.register_on_dignode(function(pos, oldnode, digger)
local nodedug = string.split(oldnode.name, ":")
local mod=nodedug[1]
local item=nodedug[2]
print (mod)
print (item)
local player = digger:get_player_name()
print("Awards [Event] - "..player.." has dug a node")
if (player~=nil and nodedug~=nil and mod~=nil and item~=nil) then
if not player_data[player] then
player_data[player]={}
player_data[player]['count']={}
player_data[player]['count']['default']={}
player_data[player]['count']['default']['dirt']=0
player_data[player]['name']=player
end
if not player_data[player]['count'][mod] then
player_data[player]['count'][mod]={}
end
if not player_data[player]['count'][mod][item] then
player_data[player]['count'][mod][item]=0
end
player_data[player]['count'][mod][item]=player_data[player]['count'][mod][item]+1
print(mod..":"..item.." 's count is now "..(player_data[player]['count'][mod][item]))
else
print(player.."'s dig event has been skipped")
end
end)
minetest.register_on_newplayer(function(player)
player_data[player:get_player_name()]={}
player_data[player:get_player_name()]['count']={}
player_data[player:get_player_name()]['count']['default']={}
player_data[player:get_player_name()]['count']['default']['dirt']=0
player_data[player:get_player_name()]['name']=player:get_player_name()
end)
|