Примеры кода OpenSecurity

Artmoneyse

Администратор
Команда форума
Администратор
Примеры кода для измененных блоков OpenSecurity
Lua:
local term = require("term")
local c = require("component")
local gpu = c.gpu
local sr = require("serialization")
local ent = c.os_entdetector
local main = true
local ents = {}

while main do
  term.clear()
  ents = ent.scanEntities(64)

  for index in pairs(ents) do
  gpu.setForeground(0xFFFFFF)
  local name = ents[index].name
  local id = ents[index].id
  local height = ents[index].height
  local yaw = ents[index].yaw
  local pitch = ents[index].pitch
  local posX = ents[index].x
  local posY = ents[index].y
  local posZ = ents[index].z

    if(name == "Sheep") then
      gpu.setForeground(0xFF00FF)
    end

    if(name == "Blaze") then
      gpu.setForeground(0xFFFF00)
    end

    if(name == "Zombie") then
      gpu.setForeground(0xFF00FF)
    end

    if(name == "Skeleton") then
      gpu.setForeground(0xFF0000)
    end

      print("[id:"..id.."]"..name.." [x:"..posX..",y:"..posY..",z:"..posZ.."]".."[h:"..height.."]".."[yaw:"..yaw..",pitch:"..pitch.."]")

  end;
--print(sr.serialize(ent.scanEntities(64)))
  print("-------------------------------------------------------")
os.sleep(1.4)
end
gpu.setForeground(0xDDDDDD)
Lua:
local c = require("component")
local alarm = c.os_alarm
--alarm.deactivate() --off playing, use only if need stop playing after play
alarm.setRepeat(false) --no repeat
print(alarm.setRange(60)) --range 60 blocks
print(alarm.setAlarm("slava_ukraini")) --set song slava_ukraini
alarm.activate() --stop all playing sound and start play current selected
 
Последнее редактирование:
Сверху