Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local com = require("component")
- local pim = com.pim
- local inv = pim.getInventorySize() - 4
- local name
- local count
- local head = pim.getStackInSlot(40)
- local CH_SIDE = "north" -- Сторона, с которой стоит сундук
- local radiation = {
- "reactorUraniumSimple",
- "reactorUraniumDual",
- "reactorUraniumQuad",
- "reactorUraniumSimpledepleted",
- "reactorUraniumDualdepleted",
- "reactorUraniumQuaddepleted",
- "reactorMOXSimple",
- "reactorMOXDual",
- "reactorMOXQuad",
- "reactorMOXSimpledepleted",
- "reactorMOXDualdepleted",
- "reactorMOXQuaddepleted",
- "reactorLithiumCell",
- "itemTritiumCell",
- "itemUran",
- "itemUran235",
- "itemUran235small",
- "itemUran238",
- "itemMOX",
- "itemPlutonium",
- "itemPlutoniumSmall",
- "itemRTGPellet"
- }
- local function simile(name_item) -- Сравнение с таблицей опасных предметов
- for i = 1, #radiation do
- if name_item == radiation[i] then
- return true
- end
- end
- return false
- end
- if head ~= nil and head.name == "itemArmorHazmatHelmet" then
- for i = 1, inv do
- name = pim.getStackInSlot(i)
- if name ~= nil and simile(name.name) then
- count = name.qty -- Количество итемов в слоте инвентаря
- local shest_slot = 8 -- Кууда будет помещён итем
- local sum = count
- repeat
- shest_slot = shest_slot + 1
- count = count - pim.pushItemIntoSlot(CH_SIDE, i, 64, shest_slot)
- until count == 0
- print(name.display_name .. " " .. sum .. " шт. было сброшено в сундук.")
- end
- end
- pim.pushItemIntoSlot(CH_SIDE, 40, 1, 1) -- Снимаем защитный костюм, одеваем свою бронь
- pim.pushItemIntoSlot(CH_SIDE, 39, 1, 2)
- pim.pushItemIntoSlot(CH_SIDE, 38, 1, 3)
- pim.pushItemIntoSlot(CH_SIDE, 37, 1, 4)
- pim.pullItemIntoSlot(CH_SIDE, 5, 1, 40)
- pim.pullItemIntoSlot(CH_SIDE, 6, 1, 39)
- pim.pullItemIntoSlot(CH_SIDE, 7, 1, 38)
- pim.pullItemIntoSlot(CH_SIDE, 8, 1, 37)
- else -- Снимаем бронь, одеваем защитный костюм
- pim.pushItemIntoSlot(CH_SIDE, 40, 1, 5)
- pim.pushItemIntoSlot(CH_SIDE, 39, 1, 6)
- pim.pushItemIntoSlot(CH_SIDE, 38, 1, 7)
- pim.pushItemIntoSlot(CH_SIDE, 37, 1, 8)
- pim.pullItemIntoSlot(CH_SIDE, 1, 1, 40)
- pim.pullItemIntoSlot(CH_SIDE, 2, 1, 39)
- pim.pullItemIntoSlot(CH_SIDE, 3, 1, 38)
- pim.pullItemIntoSlot(CH_SIDE, 4, 1, 37)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement