@@ -5,6 +5,59 @@ local blacklist = {
5
5
" default:pick_stone" ,
6
6
}
7
7
8
+ --[[
9
+ local item_value = {
10
+ ["grenades:poison"] = 5,
11
+ ["grenades:frag"] = 6,
12
+ ["grenades:smoke"] = 2,
13
+ ["ctf_ranged:pistol_loaded"] = 2,
14
+ ["ctf_ranged:pistol"] = 1,
15
+ ["ctf_ranged:rifle"] = 4,
16
+ ["ctf_ranged:rifle_loaded"] = 5,
17
+ ["ctf_ranged:smg"] = 4,
18
+ ["ctf_ranged:smg_loaded"] = 5,
19
+ ["ctf_ranged:sniper_magnum"] = 8,
20
+ ["ctf_ranged:sniper_magnum_loaded"] = 10,
21
+ ["ctf_ranged:ammo"] = 4,
22
+ ["default:diamond"] = 2.5,
23
+ ["default:mese_crystal"] = 2,
24
+ ["default:mese"] = 18,
25
+ ["default:steel_ingot"] = 1,
26
+ ["default:iron_lump"] = 1,
27
+ ["default:sword_diamond"] = 16,
28
+ ["default:sword_steel"] = 7,
29
+ ["default:sword_mese"] = 13,
30
+ ["default:pick_steel"] = 3,
31
+ ["default:pick_mese"] = 6,
32
+ ["default:pick_diamond"] = 7,
33
+ ["default:axe_steel"] = 3,
34
+ ["default:axe_mese"] = 6,
35
+ ["default:axe_diamond"] = 7,
36
+ ["default:shovel_steel"] = 2,
37
+ ["default:shovel_mese"] = 3,
38
+ ["default:shovel_diamond"] = 4,
39
+ ["default:stick"] = 0.5,
40
+ ["default:wood"] = 1,
41
+ ["default:cobble"] = 1,
42
+ ["ctf_map:reinforced_cobble"] = 3,
43
+ ["ctf_map:damage_cobble"] = 3,
44
+ ["ctf_map:unwalkable_cobble"] = 1,
45
+ ["ctf_map:unwalkable_stone"] = 1,
46
+ ["ctf_map:unwalkable_dirt"] = 1,
47
+ ["default:steelblock"] = 2.5,
48
+ ["default:bronzeblock"] = 2.5,
49
+ ["default:obsidian_block"] = 3.5,
50
+ ["ctf_map:spike"] = 2.5,
51
+ ["default:apple"] = 1.5,
52
+ ["ctf_healing:medkit"] = 6,
53
+ ["ctf_healing:bandage"] = 6,
54
+ }
55
+ --]]
56
+
57
+
58
+
59
+
60
+
8
61
local function get_chest_access (name )
9
62
local current_mode = ctf_modebase :get_current_mode ()
10
63
if not current_mode then return false , false end
@@ -246,13 +299,27 @@ for _, team in ipairs(ctf_teams.teamlist) do
246
299
end
247
300
end
248
301
249
- function def .on_metadata_inventory_put (pos , listname , index , stack , player )
250
- minetest .log (" action" , string.format (" %s puts %s to team chest at %s" ,
251
- player :get_player_name (),
252
- stack :to_string (),
253
- minetest .pos_to_string (pos )
254
- ))
302
+
303
+ function def .on_metadata_inventory_put (pos , listname , index , stack , player )
304
+ minetest .log (" action" , string.format (" %s puts %s to team chest at %s" ,
305
+ player :get_player_name (),
306
+ stack :to_string (),
307
+ minetest .pos_to_string (pos )
308
+ ))
309
+ local meta = stack :get_meta ()
310
+ local dropped_by = meta :get_string (" dropped_by" )
311
+ local pname = player :get_player_name ()
312
+ if dropped_by ~= pname and dropped_by ~= " " then
313
+ local cur_mode = ctf_modebase :get_current_mode ()
314
+ if pname and cur_mode then
315
+ -- local score = (item_value[stack:get_name()] or 0) * stack:get_count()
316
+ cur_mode .recent_rankings .add (pname , { score = 1 }, false )
317
+ end
255
318
end
319
+ meta :set_string (" dropped_by" , " " )
320
+ local inv = minetest .get_inventory ({ type = " node" , pos = pos })
321
+ inv :set_stack (listname , index , stack )
322
+ end
256
323
257
324
function def .on_metadata_inventory_take (pos , listname , index , stack , player )
258
325
minetest .log (" action" , string.format (" %s takes %s from team chest at %s" ,
0 commit comments