123456789101112131415161718192021222324252627282930 |
- minetest.register_craftitem('lobby:shank', {
- description = 'Traitor\'s Shank',
- inventory_image = 'lobby_shank.png',
- groups = {not_in_creative_inventory=1},
- on_use = function(itemstack, player, pointed_thing)
- local physics_table = player:get_physics_override()
- if physics_table.speed ~= 0 then
- local traitor = player:get_player_name()
- local obj = pointed_thing.ref
- if obj and pointed_thing.type == "object" then
- local player_name = obj:get_player_name()
- if player_name ~= '' then
- local map_name = lobby.game[traitor]
- local victim = minetest.get_player_by_name(player_name)
- victim:set_hp(0)
- local count = lobby.map[map_name]
- if count == 1 then
- lobby.traitor_win(traitor, map_name)
- itemstack:take_item()
- return itemstack
- end
- end
- end
- end
- end,
- on_drop = function(itemstack, dropper, pos)
- return
- end,
- })
|