content
stringlengths
5
1.05M
slot0 = class("EquipUpgradeLayer", import("..base.BaseUI")) slot0.CHAT_DURATION_TIME = 0.3 slot0.getUIName = function (slot0) return "EquipUpgradeUI" end slot0.setItems = function (slot0, slot1) slot0.itemVOs = slot1 end slot0.init = function (slot0) pg.UIMgr.GetInstance():BlurPanel(slot0._tf, false, { weight = LayerWeightConst.SECOND_LAYER }) slot0.mainPanel = slot0:findTF("main") slot0.finishPanel = slot0:findTF("finish_panel") setActive(slot0.mainPanel, true) setActive(slot0.finishPanel, false) slot0.equipmentList = slot0:findTF("panel/equipment_list", slot0.mainPanel) slot0.equipmentContain = slot0:findTF("equipments", slot0.equipmentList) slot0.equipmentTpl = slot0:getTpl("equiptpl", slot0.equipmentContain) setActive(slot0.equipmentList, false) slot0.equipmentPanel = slot0:findTF("panel/equipment_panel", slot0.mainPanel) slot0.materialPanel = slot0:findTF("panel/material_panel", slot0.mainPanel) slot0.startBtn = slot0:findTF("start_btn", slot0.materialPanel) slot0.overLimit = slot0:findTF("materials/limit", slot0.materialPanel) setText(slot0:findTF("text", slot0.overLimit), i18n("equipment_upgrade_overlimit")) slot0.materialsContain = slot0:findTF("materials/materials", slot0.materialPanel) slot0.uiMain = pg.UIMgr.GetInstance().UIMain slot0.Overlay = pg.UIMgr.GetInstance().OverlayMain end slot0.updateRes = function (slot0, slot1) slot0.playerVO = slot1 end slot0.didEnter = function (slot0) onButton(slot0, slot0._tf:Find("bg"), function () slot0:emit(slot1.ON_CLOSE) end, SFX_CANCEL) slot0.updateAll(slot0) end slot0.updateAll = function (slot0) setActive(slot0.equipmentList, slot0.contextData.shipVO) if slot0.contextData.shipVO then slot0:displayEquipments() if slot0.contextData.pos then triggerButton(slot0.equipmentTFs[slot0.contextData.pos]) else triggerButton(slot0.equipmentContain:GetChild(0)) end else slot0:updateEquipment() slot0:updateMaterials() end end slot0.displayEquipments = function (slot0) slot0.equipmentTFs = {} removeAllChildren(slot0.equipmentContain) for slot5, slot6 in ipairs(slot0.contextData.shipVO.equipments) do if slot6 then slot7 = cloneTplTo(slot0.equipmentTpl, slot0.equipmentContain) updateEquipment(slot7, slot6) setActive(slot8, false) if slot0:isMaterialEnough(slot6) and slot6.config.next ~= 0 then setActive(slot8, true) blinkAni(slot8, 0.5) end onButton(slot0, slot7, function () if slot0.contextData.pos then setActive(slot0.equipmentTFs[slot0]:Find("selected"), false) slot1(slot0.equipmentTFs[slot0]:Find("tip"), slot0:isMaterialEnough(slot1:getEquip(slot0)) and slot1:getEquip(slot0).config.next ~= 0) end slot0.contextData.pos = slot2 slot0.contextData.equipmentId = slot3.id slot0.contextData.equipmentVO = slot3 setActive(slot0.equipmentTFs[slot0.contextData.pos]:Find("selected"), true) setActive(slot0.equipmentTFs[slot0.contextData.pos]:Find("tip"), false) slot0:updateEquipment() slot0:updateMaterials() end, SFX_PANEL) slot0.equipmentTFs[slot5] = slot7 end end end slot0.isMaterialEnough = function (slot0, slot1) slot2 = true if not slot1.config.trans_use_item then return false end for slot7 = 1, #slot3, 1 do if defaultValue(slot0.itemVOs[slot3[slot7][1]], { count = 0 }).count < slot3[slot7][2] then slot2 = false end end return slot2 end slot0.updateEquipment = function (slot0) slot0.contextData.equipmentId = slot0.contextData.equipmentVO.id slot0:updateAttrs(slot0.equipmentPanel:Find("view/content"), slot1, (slot0.contextData.equipmentVO.config.next > 0 and slot1:MigrateTo(slot1.config.next)) or nil) changeToScrollText(slot0.equipmentPanel:Find("name_container"), slot1.config.name) setActive(findTF(slot0.equipmentPanel, "unique"), slot1:isUnique()) updateEquipment(slot0:findTF("equiptpl", slot0.equipmentPanel), slot1) end function slot1(slot0) slot0.sub = { _.detect(slot0.sub, function (slot0) return slot0.type == AttributeType.Damage end) } end function slot2(slot0) slot0.sub = { _.detect(slot0.sub, function (slot0) return slot0.type == AttributeType.Corrected end) } end slot0.updateAttrs = function (slot0, slot1, slot2, slot3) for slot8 = 1, #slot2:GetPropertiesInfo().weapon.sub, 1 do slot0(slot4.weapon.sub[slot8]) end slot1(slot4.equipInfo) slot4.equipInfo.lock_open = true if slot3 then Equipment.InsertAttrsUpgrade(slot4.attrs, slot3:GetPropertiesInfo().attrs) if checkExist(slot6, { "name" }) ~= checkExist(slot3:GetSkill(), { "name" }) then table.insert(slot4.attrs, { lock_open = true, name = i18n("skill"), value = setColorStr(checkExist(slot6, { "name" }) or i18n("equip_info_25"), "#FFDE00FF"), sub = { { name = i18n("equip_info_26"), value = setColorStr(checkExist(slot7, { "name" }) or i18n("equip_info_25"), "#FFDE00FF") } } }) end if #slot5.weapon.sub > #slot4.weapon.sub then for slot11 = #slot4.weapon.sub, #slot5.weapon.sub, 1 do table.insert(slot4.weapon.sub, { name = i18n("equip_info_25"), sub = {} }) end end for slot11 = #slot4.weapon.sub, 1, -1 do slot12 = slot4.weapon.sub[slot11] if slot5.weapon.sub[slot11] then slot0(slot5.weapon.sub[slot11]) else slot13 = { name = i18n("equip_info_25"), sub = {} } end if slot12.name ~= slot13.name then slot12.sub = { { name = i18n("equip_info_27"), value = slot13.name } } else Equipment.InsertAttrsUpgrade(slot12.sub, slot13.sub) end if #slot12.sub == 0 then table.remove(slot4.weapon.sub, slot11) if slot5.weapon.sub[slot11] then table.remove(slot5.weapon.sub, slot11) end end end slot1(slot5.equipInfo) Equipment.InsertAttrsUpgrade(slot4.equipInfo.sub, slot5.equipInfo.sub) end updateEquipUpgradeInfo(slot1, slot4, slot0.contextData.shipVO) end slot0.updateMaterials = function (slot0) slot1 = true slot4 = slot0.contextData.equipmentVO.config.trans_use_gold slot3 = defaultValue(slot0.contextData.equipmentVO.config.trans_use_item, {}) slot5 = nil slot6 = 0 for slot10 = 1, 3, 1 do setActive(findTF(slot11, "off"), not slot3[slot10]) setActive(findTF(slot11, "equiptpl"), slot3[slot10]) if slot3[slot10] then updateItem(slot13, Item.New({ id = slot3[slot10][1] })) onButton(slot0, slot13, function () slot0:emit(EquipUpgradeMediator.ON_ITEM, slot0) end, SFX_PANEL) slot15 = defaultValue(slot0.itemVOs[slot3[slot10][1]], { count = 0 }).count .. "/" .. slot3[slot10][2] if defaultValue(slot0.itemVOs[slot3[slot10][1]], ).count < slot3[slot10][2] then slot15 = setColorStr(slot14.count, COLOR_RED) .. "/" .. slot3[slot10][2] slot1 = false slot5 = slot3[slot10] end setActive(slot16, true) setText(slot16, slot15) onButton(slot0, slot13:Find("click"), function () setActive(slot0:Find("click"), false) slot1 = slot1 - 1 end, SFX_PANEL) setActive(slot13.Find(slot13, "click"), slot2.config.level > 10) slot6 = slot6 + ((slot2.config.level > 10 and 1) or 0) end end setText(slot0:findTF("cost/consume", slot0.materialPanel), slot4) setActive(slot0.startBtn, slot3) setActive(slot0.materialsContain, slot7) setActive(slot0.overLimit, not Equipment.canUpgrade(slot2.configId)) onButton(slot0, slot0.startBtn, function () if not slot0 then if not ItemTipPanel.ShowItemTipbyID(slot1[1]) then pg.TipsMgr.GetInstance():ShowTips(i18n("ship_shipUpgradeLayer2_noMaterail")) end return end if slot2 > 0 then pg.TipsMgr.GetInstance():ShowTips(i18n("equipment_upgrade_costcheck_error")) return end if slot3.playerVO.gold < slot4 then GoShoppingMsgBox(i18n("switch_to_shop_tip_2", i18n("word_gold")), ChargeScene.TYPE_ITEM, { { 59001, slot4 - slot3.playerVO.gold, } }) return end slot3:emit(EquipUpgradeMediator.EQUIPMENT_UPGRDE) end, SFX_UI_DOCKYARD_REINFORCE) setButtonEnabled(slot0.startBtn, slot7) end slot0.upgradeFinish = function (slot0, slot1, slot2) setActive(slot0.mainPanel, false) setActive(slot0.finishPanel, true) onButton(slot0, slot0.finishPanel:Find("bg"), function () setActive(slot0.mainPanel, true) setActive(slot0.finishPanel, false) end, SFX_CANCEL) changeToScrollText(slot0.finishPanel.Find(slot4, "frame/equipment_panel/name_container"), slot2.config.name) setActive(findTF(slot0.finishPanel, "frame/equipment_panel/unique"), slot2:isUnique()) updateEquipment(slot3, slot2) slot0:updateAttrs(slot0:findTF("frame/equipment_panel/view/content", slot0.finishPanel), slot1, slot2) end slot0.willExit = function (slot0) pg.UIMgr.GetInstance():UnblurPanel(slot0._tf) end return slot0
---@type vm local config = require 'config' local defaultlibs = require 'library.defaultlibs' local files = require 'files' local guide = require 'core.guide' local rbxlibs = require 'library.rbxlibs' local rojo = require 'library.rojo' local util = require 'utility' local vm = require 'vm.vm' function vm.getGlobals(key, uri, onlySet) local globals = {} local scriptCache = vm.getCache 'scriptCache' for _, lib in pairs(rbxlibs.global) do if key == "*" or lib.name == key then if lib.name == "script" and uri then if not scriptCache[uri] then local script = util.shallowCopy(lib) local scriptValue = rojo.Scripts[uri] if scriptValue then script.value = scriptValue else script.value[1] = rojo:scriptClass(uri) end scriptCache[uri] = script end globals[#globals+1] = scriptCache[uri] else globals[#globals+1] = lib end end end if uri:match("%.spec%.lua$") or uri:match("%.spec%/init%.lua$") then for _, lib in pairs(defaultlibs.testez) do if key == "*" or lib.name == key then globals[#globals+1] = lib end end end local dummyCache = vm.getCache 'globalDummy' for name in pairs(config.config.diagnostics.globals) do if key == '*' or name == key then if not dummyCache[key] then dummyCache[key] = { type = 'dummy', start = 0, finish = 0, [1] = key } end globals[#globals+1] = dummyCache[key] end end if not uri or not files.exists(uri) then return globals end local ast = files.getAst(uri) if not ast then return globals end local fileGlobals = guide.findGlobals(ast.ast) local mark = {} for _, res in ipairs(fileGlobals) do if mark[res] then goto CONTINUE end if not onlySet or vm.isSet(res) then mark[res] = true if key == "*" or guide.getSimpleName(res) == key then globals[#globals+1] = res end end ::CONTINUE:: end return globals end function vm.getGlobalSets(key, uri) return vm.getGlobals(key, uri, true) end
unitevents = {}
------------------------------ -- Combo Point Widget ------------------------------ --[[ - Proc Widget --]] local comboWidgetPath = "Interface\\Addons\\TidyPlatesWidgets\\ComboWidget\\" local artpath = "Interface\\Addons\\TidyPlatesWidgets\\ComboWidget\\" local artfile = artpath.."PointArtLegion.tga" local grid = .0625 local monkOffset = 10 local WidgetList = {} local function GetDruidPoints() local points = GetComboPoints("player", "target") return points end local function GetRoguePoints() local points = GetComboPoints("player", "target") --[[ if points and points > 0 then -- Anticipation if points > 4 then local name, _, _, count = UnitAura("player", Anticipation) if name and count > 0 then points = points + count end end end --]] return points end local function GetPaladinPoints() local points = UnitPower("player", SPELL_POWER_HOLY_POWER) if points > 0 then points = points + monkOffset end return points end local function GetMonkPoints() -- 0 to 4 local points = UnitPower("player", SPELL_POWER_CHI) local maxPoints = UnitPowerMax("player", SPELL_POWER_CHI) if points > 0 and maxPoints == 4 then points = points + monkOffset end return points end local function DummyFunction() return nil end local GetPoints local PlayerClass = select(2,UnitClassBase("player")) if PlayerClass == "ROGUE" then GetPoints = GetRoguePoints elseif PlayerClass == "DRUID" then GetPoints = GetDruidPoints elseif PlayerClass == "MONK" then GetPoints = GetMonkPoints elseif PlayerClass == "PALADIN" then --GetPoints = GetPaladinPoints GetPoints = DummyFunction else GetPoints = DummyFunction end -- Update Graphics local function UpdateWidgetFrame(frame) local points if UnitExists("target") then points = GetPoints() end if points and points > 0 then --frame.Icon:SetTexture(comboWidgetPath..tostring(points)) frame.Icon:SetTexCoord(0, 1, grid*(points-1), grid *(points)) --object:SetTexCoord(objectstyle.left or 0, objectstyle.right or 1, objectstyle.top or 0, objectstyle.bottom or 1) frame:Show() else frame:_Hide() end end -- Context local function UpdateWidgetContext(frame, plate, unit) local guid = unit.guid -- Add to Widget List if guid then if frame.guid then WidgetList[frame.guid] = nil end frame.guid = guid WidgetList[guid] = frame end -- Update Widget if UnitGUID("target") == guid then UpdateWidgetFrame(frame) else frame:_Hide() end end local function ClearWidgetContext(frame) local guid = frame.guid if guid then WidgetList[guid] = nil frame.guid = nil end end -- Watcher Frame local WatcherFrame = CreateFrame("Frame", nil, WorldFrame ) local isEnabled = false WatcherFrame:RegisterEvent("UNIT_COMBO_POINTS") WatcherFrame:RegisterEvent("UNIT_POWER") WatcherFrame:RegisterEvent("UNIT_DISPLAYPOWER") WatcherFrame:RegisterEvent("UNIT_AURA") WatcherFrame:RegisterEvent("UNIT_FLAGS") local function WatcherFrameHandler(frame, event, unitid) local guid = UnitGUID("target") if UnitExists("target") then local widget = WidgetList[guid] if widget then UpdateWidgetFrame(widget) end -- To update all, use: for guid, widget in pairs(WidgetList) do UpdateWidgetFrame(widget) end end end local function EnableWatcherFrame(arg) if arg then WatcherFrame:SetScript("OnEvent", WatcherFrameHandler); isEnabled = true else WatcherFrame:SetScript("OnEvent", nil); isEnabled = false end end -- Widget Creation local function CreateWidgetFrame(extended) local parent = extended.widgetFrame -- Required Widget Code local frame = CreateFrame("Frame", nil, parent) frame:Hide() -- Custom Code frame:SetHeight(32) frame:SetWidth(64) frame.Icon = frame:CreateTexture(nil, "OVERLAY") frame.Icon:SetPoint("CENTER", frame, "CENTER") frame.Icon:SetHeight(16) frame.Icon:SetWidth(64) frame.Icon:SetTexture(artfile) --frame.Icon:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", -2, -2) --frame.Icon:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 2, 2) -- End Custom Code -- Required Widget Code frame.UpdateContext = UpdateWidgetContext frame.Update = UpdateWidgetFrame frame._Hide = frame.Hide frame.Hide = function() ClearWidgetContext(frame); frame:_Hide() end if not isEnabled then EnableWatcherFrame(true) end return frame end TidyPlatesWidgets.CreateComboPointWidget = CreateWidgetFrame
-- utf8 vim.g.encoding = "UTF-8" vim.o.fileencoding = 'utf-8' -- jk移动时光标下上方保留8行 vim.o.scrolloff = 8 -- Lines of context -- Round indent vim.o.sidescrolloff = 8 -- Columns of context -- 使用相对行号 vim.wo.number = true -- Show line numbers --vim.wo.relativenumber = true -- Relative line numbers -- 高亮所在行 vim.wo.cursorline = true -- 显示左侧图标指示列 vim.wo.signcolumn = "yes" -- 右侧参考线,超过表示代码太长了,考虑换行 -- vim.wo.colorcolumn = "80" -- 缩进2个空格等于一个Tab vim.o.tabstop = 4 -- Number of spaces tabs count for vim.bo.tabstop = 4 vim.o.softtabstop = 4 vim.o.shiftround = true -- >> << 时移动长度 vim.o.shiftwidth = 2 -- Size of an indent vim.bo.shiftwidth = 2 -- 新行对齐当前行,空格替代tab vim.o.expandtab = true vim.bo.expandtab = true vim.o.autoindent = true vim.bo.autoindent = true vim.o.smartindent = true -- Insert indents automatically -- 搜索大小写不敏感,除非包含大写 vim.o.ignorecase = true -- Ignore case vim.o.smartcase = true -- Do not ignore case with capitals vim.o.hlsearch = false -- 搜索不要高亮 vim.o.incsearch = true -- 边输入边搜索 vim.o.showmode = false -- 使用增强状态栏后不再需要 vim 的模式提示 vim.o.cmdheight = 2 -- 命令行高为2,提供足够的显示空间 vim.o.autoread = true -- 当文件被外部程序修改时,自动加载 vim.bo.autoread = true vim.o.wrap = false -- Disable line wrap vim.wo.wrap = false -- 禁止折行 vim.o.whichwrap = 'b,s,<,>,[,],h,l' -- 行结尾可以跳到下一行 -- 允许隐藏被修改过的buffer vim.o.hidden = true --Enable background buffers vim.o.mouse = "a" -- 鼠标支持 vim.o.backup = false -- 禁止创建备份文件 vim.o.writebackup = false vim.o.swapfile = false vim.o.updatetime = 300 -- smaller updatetime vim.o.timeoutlen = 100 -- 等待mappings -- split window 从下边和右边出现 vim.o.splitbelow = true -- Put new windows below current vim.o.splitright = true -- Put new windows right of current vim.g.completeopt = "menu,menuone,noselect,noinsert" -- 自动补全不自动选中 vim.o.background = "dark" -- 样式 vim.o.termguicolors = true -- True color support vim.opt.termguicolors = true vim.o.list = true -- 不可见字符的显示,这里只把空格显示为一个点 --vim.o.listchars = "space:·" -- Show some invisible characters vim.o.wildmenu = true -- 补全增强 vim.o.shortmess = vim.o.shortmess .. 'c' -- Dont' pass messages to |ins-completin menu| vim.o.pumheight = 10 vim.o.showtabline = 2 -- always show tabline --opt.completeopt = {'menuone', 'noinsert', 'noselect'} -- Completion options (for deoplete) --opt.expandtab = true -- Use spaces instead of tabs --opt.hidden = true --opt.ignorecase = true vim.opt.joinspaces = false -- No double spaces with join --opt.list = true --opt.number = true -- opt.relativenumber = true --vim.opt.scrolloff = 4 --opt.shiftround = true ----opt.shiftwidth = 4 --opt.sidescrolloff = 8 --opt.smartcase = true --opt.smartindent = true --opt.splitbelow = true --opt.splitright = true --opt.tabstop = 4 --opt.termguicolors = true vim.opt.wildmode = {'list', 'longest'} --opt.wrap = false vim.opt.laststatus=2
local config = require("lapis.config") -- Global config variables. BCRYPT_NUM_CYCLES = 8 -- Server configuration. config("development", { port = 9009, session_name = "svd_viz_session", secret = "test_secret_change_me", postgres = { host = "127.0.0.1", user = "postgres", password = "postgres_password", database = "svd_viz_test" } })
local bit = require 'bit' return setmetatable({}, { __newindex = function(self, k, v) if type(k) ~= 'string' or type(v) ~= 'number' then error('bad error definition', 2) end v = bit.tobit(v) rawset(self, k, v) rawset(self, v, k) end; __index = function(self, k) if type(k) == 'string' then error('undefined error: ' .. k, 2) end if type(k) ~= 'number' then return nil end local bk = bit.tobit(k) if bk ~= k then local entry = self[bk] if entry ~= nil then return entry end end return '(error 0x' .. bit.tohex(bk) .. ')' end; __call = function(self, def) for k,v in pairs(def) do self[k] = v end return self end; })
local UpdateBeat = UpdateBeat local reservedFields = { "netHandler", "isInstance", "transform", "gameObject", "luaBehavior", "enableShowAnimation", "enableHideAnimation", "widgets", "sortingLayer", "autoClose", "withMask", "maskColor", "autoInject", "needBehaviorCall", "assetBundle", "viewName", "priority", "dispose", "onViewAction", "viewCtrl", "parentView", "canvasGroup", "_visible", "_viewID", "_viewID", "uiManager", "_updateHandle", } local ViewIDGen = 0 local __creator = function () local ins = { netHandler = true, isInstance = true, } local mt = { __tostring = function (t) return string.format( "BaseView %s:%s:ID=%d", t.assetBundle, t.viewName, t._viewID) end } -- if DEBUG then --for debug error check. -- mt.__newindex = function (t, k, v) -- local vv = t[k] -- if v ~= false and table.containsValue(reservedFields, k) then -- error(string.format( "[%s] is Reserved Property in BaseView, do not change it's type.", k)) -- end -- rawset(t, k, v) -- end -- end setmetatable(ins, mt) return ins end local BaseView = class("BaseView", __creator) local function _PublicDeclare(self) self.gameObject = false self.transform = false self.luaBehavior = false --for auto inject. self.widgets = false --switch for auto inject widgets self.autoInject = false self.needBehaviorCall = false --attach viewCtrl for history reason self.viewCtrl = false --parent view if has any self.parentView = false --redefine this can load asset from other place. self.assetBundle = false self.viewName = false self.enableShowAnimation = false self.enableHideAnimation = false end local function _PrivateDeclare(self) self._visible = false self.__lastVisible = false self._originScale = false self._originPosition = false self._originLocalPosition = false self._originRotation = false self._updateHandle = false self._viewID = false self._childView = false end function BaseView:ctor(...) _PublicDeclare(self) _PrivateDeclare(self) ViewIDGen = ViewIDGen + 1 self._viewID = ViewIDGen self._childView = {} self._originPosition = Vector3.zero self._originLocalPosition = Vector3.zero self.autoInject = true self.needBehaviorCall = true self.assetBundle = self:classname() self.viewName = self.assetBundle end function BaseView:onCreate() if self.Update then if not self._updateHandle then self._updateHandle = UpdateBeat:CreateListener(self.Update, self) end UpdateBeat:AddListener(self._updateHandle) end end function BaseView:_recordVisiualState(visible) self.__lastVisible = visible end function BaseView:onDispose() self.gameObject = false self.transform = false self.luaBehavior = false if self._updateHandle then UpdateBeat:RemoveListener(self._updateHandle) self._updateHandle = false end end function BaseView:showAnimation(overcallback) end function BaseView:hideAnimation(overcallback) end -------------------以下为帮助函数------------------------- function BaseView:AddListener(obj, functor, extraParam, eventIdentifier) if not obj or not functor then logError("[BaseView:AddListener] Can't add nil listener.") return end local behavior = self.luaBehavior if behavior then behavior:AddListener(obj, functor, extraParam, eventIdentifier) else logError("[BaseView:AddListener] luaBehavior is nil") end end --[[ release single listener for object. ]] function BaseView:RemoveListener(obj) if not obj then logError("[BaseView:RemoveListener] Can't remove nil listener.") return end local behavior = self.luaBehavior if behavior then behavior:ReleaseListener(obj) else logError("[BaseView:RemoveListener] luaBehavior is nil") end end function BaseView:ID() return self._viewID end function BaseView:IsLoaded() return self.gameObject and IsNil(self.gameObject) == false end function BaseView:AddChildView(view, obj) local i = #self._childView self._childView[i+1] = view view.parentView = self if not IsNil(obj) then view:SetViewObject(obj) end return i end function BaseView:GetChildAt(index) local n = self:GetChildCount() if index > 0 and index <= n then return self._childView[index] else logError("[BaseView:GetChildAt] Error Index: " .. index) end end function BaseView:GetChildByName(name) for i, v in ipairs(self._childView) do if v:classname() == name then return v, i end end return nil end function BaseView:RemoveChildView(view) table.removeItem(self._childView, view) end function BaseView:RemoveChildAt(index) local n = self:GetChildCount() if index > 0 and index <= n then table.remove(self._childView, index) else logError("[BaseView:RemoveChildAt] Error Index: " .. index) end end function BaseView:GetChildCount() return #self._childView end --[[ 为View绑定GameObject用于复用 ]] function BaseView:SetViewObject(obj, attachToCanvas) if IsNil(obj) then logError("something wrong, ui asset load error.") return end local go if attachToCanvas and self.uiManager then go = self.uiManager:_attachToCanvas(self, obj) else go = obj end self.gameObject = go self.transform = go.transform self:ResetOriginRTS() --self.gameObject.name = string.format("%s_%d", self.gameObject.name, self._viewID) --为了只改一个地方字段名。。。 self.luaBehavior = LuaBehaviour.AddBehaviour(go, self, self.autoInject and self.widgets or nil, self.canvasGroup) self.__animator = go:GetComponent("Animator") self:onCreate() end function BaseView:ResetOriginRTS() self._originRotation = self.transform.rotation self._originPosition = self.transform.position self._originLocalPosition = self.transform.localPosition self._originScale = self.transform.localScale end function BaseView:GetOriginPosition() return self._originPosition end function BaseView:GetOriginLocalPosition() return self._originLocalPosition end function BaseView:Visible() if not self.gameObject or not self.gameObject.activeSelf then return false end local p = self.parentView if p then return p._visible else return self._visible end end function BaseView:SetActive(active) active = active or false if self:IsLoaded() then self.gameObject:SetActive(active) end end function BaseView:Dispose() if self.disposed then return end if self:IsLoaded() then self.disposed = true GameObject.Destroy(self.gameObject) self:onDispose() end end return BaseView
level_max_x = { -- Emerald Hill Zone ["zone=0,act=0"] = 0x2A40, ["zone=0,act=1"] = 0x29C0, -- Chemical Plant Zone ["zone=13,act=0"] = 0x2840, ["zone=13,act=1"] = 0x2943, -- Aquatic Ruin Zone ["zone=15,act=0"] = 0x298C, ["zone=15,act=1"] = 0x298D, -- Casino Night Zone ["zone=12,act=0"] = 0x2840, ["zone=12,act=1"] = 0x2740, -- Hill Top Zone ["zone=7,act=0"] = 0x2900, ["zone=7,act=1"] = 0x2E2E, -- Mystic Cave Zone ["zone=11,act=0"] = 0x2450, ["zone=11,act=1"] = 0x21A0, -- Oil Ocean Zone ["zone=10,act=0"] = 0x3040, ["zone=10,act=1"] = 0x2856, -- Metropolis Zone ["zone=4,act=0"] = 0x2300, ["zone=4,act=1"] = 0x1F40, ["zone=5,act=0"] = 0x29AF, -- Wing Fortress Zone ["zone=6,act=0"] = 0x29D9, } function level_key() return string.format("zone=%d,act=%d", data.zone, data.act) end function clip(v, min, max) if v < min then return min elseif v > max then return max else return v end end data.prev_lives = 3 function contest_done() if data.game_mode == 16 then -- bonus level return true end if data.lives < data.prev_lives then return true end data.prev_lives = data.lives if calc_progress(data) >= 1 then return true end return false end data.offset_x = nil end_x = nil function calc_progress(data) if data.offset_x == nil then data.offset_x = -data.x end_x = level_max_x[level_key()] - data.x end local cur_x = clip(data.x + data.offset_x, 0, end_x) return cur_x / end_x end data.prev_progress = 0 frame_limit = 18000 function contest_reward() local progress = calc_progress(data) local reward = (progress - data.prev_progress) * 9000 data.prev_progress = progress -- bonus for beating level if progress >= 1 then reward = reward + (1 - clip(scenario.frame / frame_limit, 0, 1)) * 1000 end return reward end data.xpos_last_x = nil function xpos_done() if data.lives < data.prev_lives then return true end data.prev_lives = data.lives if scenario.frame >= frame_limit then return true end if data.game_mode == 16 then return true end return data.x > level_max_x[level_key()] end function xpos_rew() if data.xpos_last_x == nil then data.xpos_last_x = data.x end local result = data.x - data.xpos_last_x data.xpos_last_x = data.x return result end
--* This Document is AutoGenerate by OrangeFilter, Don't Change it! * ---@meta --- ---[3.2]segment data[parent:] --- ---@class OF_SegmentFrameData --- ---[3.2]body segment texture --- ---@field segmentTexture OF_Texture#of_texture --- ---[4.4]hair segment texture --- ---@field hairTexture OF_Texture#of_texture --- ---[4.6]clothes segment texture --- ---@field clothesTexture OF_Texture#of_texture OF_SegmentFrameData = {} return OF_SegmentFrameData
-- for managing physical chat channels local Main = CommsAddon function Main:JoinChannels() local joined = {} for k, v in pairs( self.db.global.comms ) do if not joined[v.chat] then joined[v.chat] = true JoinPermanentChannel( v.chat ) end end end function Main:JoinChatChannel( name ) JoinPermanentChannel( name ) end function Main:LeaveChatChannel( name ) LeaveChannelByName( name ) end
local _M = {} _M.__index = _M _M.LOOP = 0 _M.ONE_SHOT = 1 _M.REVERSE = 2 _M.PING_PONG = 3 function _M:add_frame(sframe) self.frames[#self.frames+1] = sframe end function _M:update(dt) if self.delay <= 0 then return end self.time = self.time + dt while self.time >= self.delay do self.time = self.time - self.delay if self.mode == _M.LOOP then self.index = self.index + 1 if self.index > #self.frames then self.index = 1 end elseif self.mode == _M.ONE_SHOT then if (self.index + 1) < #self.frames then self.index = self.index + 1 end elseif self.mode == _M.REVERSE then if self.index > 1 then self.index = self.index - 1 end end end end function _M:current_frame() return self.frames[self.index] end function _M.create() local anim = {} setmetatable(anim, _M) anim.frames = {} anim.time = 0 anim.index = 1 anim.delay = 0.3 anim.mode = _M.LOOP return anim end return _M
--*********************************************************** --** ROBERT JOHNSON ** --*********************************************************** require "TimedActions/ISBaseTimedAction" ---@class ISPlowAction : ISBaseTimedAction ISPlowAction = ISBaseTimedAction:derive("ISPlowAction"); function ISPlowAction:isValid() return true; end function ISPlowAction:waitToStart() self.character:faceLocation(self.gridSquare:getX(), self.gridSquare:getY()) return self.character:shouldBeTurning() end function ISPlowAction:update() self.character:faceLocation(self.gridSquare:getX(), self.gridSquare:getY()) if self.item then self.item:setJobDelta(self:getJobDelta()); end self.character:setMetabolicTarget(Metabolics.DiggingSpade); end function ISPlowAction:start() if self.item then self.item:setJobType(getText("ContextMenu_Dig")); self.item:setJobDelta(0.0); end self.sound = getSoundManager():PlayWorldSound("Shoveling", self.gridSquare, 0, 10, 1, true); -- self.gridSquare:playSound("shoveling", true); addSound(self.character, self.character:getX(), self.character:getY(), self.character:getZ(), 10, 1) self:setActionAnim(ISFarmingMenu.getShovelAnim(self.item)) if self.item then self:setOverrideHandModels(self.item:getStaticModel(), nil) else self:setOverrideHandModels(nil, nil) end end function ISPlowAction:stop() if self.sound and self.sound:isPlaying() then self.sound:stop(); end ISBaseTimedAction.stop(self); if self.item then self.item:setJobDelta(0.0); end end function ISPlowAction:perform() if self.item then self.item:getContainer():setDrawDirty(true); self.item:setJobDelta(0.0); elseif ZombRand(10) == 0 then -- chance of getting hurt if ZombRand(2) == 0 then self.character:getBodyDamage():getBodyPart(BodyPartType.Hand_L):SetScratchedWeapon(true); else self.character:getBodyDamage():getBodyPart(BodyPartType.Hand_R):SetScratchedWeapon(true); end end if self.sound and self.sound:isPlaying() then self.sound:stop(); end local sq = self.gridSquare local args = { x = sq:getX(), y = sq:getY(), z = sq:getZ() } CFarmingSystem.instance:sendCommand(self.character, 'plow', args) CFarmingSystem.instance:changePlayer(self.character) -- maybe give worm ? if ZombRand(5) == 0 then self.character:getInventory():AddItem("Base.Worm"); end ISBaseTimedAction.perform(self); end function ISPlowAction:new (character, square, item, time) local o = {} setmetatable(o, self) self.__index = self o.character = character; o.stopOnWalk = true; o.stopOnRun = true; o.maxTime = time; -- custom fields if not item then o.maxTime = time * 2; end if character:isTimedActionInstant() then o.maxTime = 1; end o.item = item; o.gridSquare = square o.caloriesModifier = 5; return o end
--------------------------------------------------------------------- --private variables --------------------------------------------------------------------- local edf = {} local edfStarted = {} local thisResource = getThisResource() local rootElement = getRootElement() createResourceCallInterface("mapmanager") addEvent"onElementPropertyChanged" local DUMMY_ID = 3003 local DUMMY_DIMENSION = -99 local DUMMY_INTERIOR = 14 -- basic types list local basicTypes = { "object","vehicle","pickup","marker","blip","colshape","radararea","ped","water" } -- basic types lookup table local isBasic = {} for k, theType in ipairs(basicTypes) do isBasic[theType] = true end -- basic element create functions table (cdata holds creation parameters) local edfCreateBasic = { object = function(cdata) return createObject(cdata.model, cdata.position[1], cdata.position[2], cdata.position[3], cdata.rotation[1], cdata.rotation[2], cdata.rotation[3]) end, vehicle = function(cdata) local vehicle = createVehicle(cdata.model, cdata.position[1], cdata.position[2], cdata.position[3], cdata.rotation[1], cdata.rotation[2], cdata.rotation[3], cdata.plate) if cdata.color then setVehicleColor ( vehicle, cdata.color[1], cdata.color[2], cdata.color[3], cdata.color[4] ) end if cdata.upgrades then for i, upgrade in ipairs(cdata.upgrades) do addVehicleUpgrade(vehicle, upgrade) end end return vehicle end, marker = function(cdata) local r,g,b,a = getColorFromString(cdata.color) if r then cdata.colorR = r; cdata.colorG = g; cdata.colorB = b; cdata.colorA = a end return createMarker(cdata.position[1], cdata.position[2], cdata.position[3], cdata.type, cdata.size, cdata.colorR, cdata.colorG, cdata.colorB, cdata.colorA) end, pickup = function(cdata) local pType, pAmount, pAmmo if cdata.type == "health" then pType = 0 pAmount = cdata.amount elseif cdata.type == "armor" then pType = 1 pAmount = cdata.amount else pType = 2 pAmount = tonumber(cdata.type) pAmmo = cdata.amount end local pickup if pAmmo then pickup = createPickup(cdata.position[1], cdata.position[2], cdata.position[3], pType, pAmount, cdata.respawn, pAmmo) else pickup = createPickup(cdata.position[1], cdata.position[2], cdata.position[3], pType, pAmount, cdata.respawn) end --! workaround setElementData(pickup, "amount", pAmount) setElementData(pickup, "respawn", cdata.respawn) return pickup end, blip = function(cdata) local r,g,b,a = getColorFromString(cdata.color) if r then cdata.colorR = r; cdata.colorG = g; cdata.colorB = b; cdata.colorA = a end return createBlip(cdata.position[1], cdata.position[2], cdata.position[3], cdata.icon, cdata.size, cdata.colorR, cdata.colorG, cdata.colorB, cdata.colorA) end, radararea = function(cdata) local r,g,b,a = getColorFromString(cdata.color) if r then cdata.colorR = r; cdata.colorG = g; cdata.colorB = b; cdata.colorA = a end return createRadarArea(cdata.posX, cdata.posY, cdata.sizeX, cdata.sizeY, cdata.colorR, cdata.colorG, cdata.colorB, cdata.colorA) end, colshape = function(cdata) if cdata.type == "sphere" then return createColSphere(cdata.position[1], cdata.position[2], cdata.position[3], cdata.radius) elseif cdata.type == "tube" then return createColTube(cdata.position[1], cdata.position[2], cdata.position[3], cdata.radius, cdata.height) elseif cdata.type == "rectangle" then return createColRectangle(cdata.position[1], cdata.position[2], cdata.position[3], cdata.width, cdata.depth) elseif cdata.type == "cube" or cdata.type == "cuboid" then return createColCube(cdata.position[1], cdata.position[2], cdata.position[3], cdata.width, cdata.depth, cdata.height) end end, ped = function(cdata) local ped = createPed ( cdata.model, cdata.position[1], cdata.position[2], cdata.position[3] ) setPedRotation ( ped, (cdata.rotZ or 0) ) return ped end, water = function(cdata) return createWater ( cdata.position[1] - cdata.sizeX/2, cdata.position[2] - cdata.sizeY/2, cdata.position[3], cdata.position[1] + cdata.sizeX/2, cdata.position[2] - cdata.sizeY/2, cdata.position[3], cdata.position[1] - cdata.sizeX/2, cdata.position[2] + cdata.sizeY/2, cdata.position[3], cdata.position[1] + cdata.sizeX/2, cdata.position[2] + cdata.sizeY/2, cdata.position[3] ) end, } -- table to keep track of created representations local createdRepresentations = {} -- EDF events addEvent("onEDFLoad") addEvent("onEDFUnload") addEventHandler("onResourceStart", rootElement, function (resource) --stop here if the resource disables edf checking if getResourceInfo(resource,"edf:represent") == "false" then return end if mapmanager.isMap(resource) then outputDebugString('Going to represent map ' .. getResourceName(resource),0,180,180,255) -- if it's a map, represent it local startedResourceRoot = getResourceRootElement(resource) local startedResourceMaps = getElementChildren(startedResourceRoot) local gamemodes = mapmanager.getGamemodesCompatibleWithMap(resource) for i,gamemode in ipairs(gamemodes) do if edf[gamemode] then for k, map in ipairs(startedResourceMaps) do local mapElements = getElementChildren(map) for k, element in ipairs(mapElements) do edfRepresentElement(element, gamemode) end end end end else if edfStarted[resource] then return end local resourcename = getResourceName(resource) -- otherwise it may contain an edf definition local def = edfLoadDefinition(resource) -- stop here if it couldn't be loaded if not def then return end if edfStarted[resource] == false then edfStarted[resource] = true end -- Notify that the load has been successful outputDebugString("Loaded definitions for '"..resourcename.."'.",0,180,180,255) end end ) addEventHandler("onResourceStop", rootElement, function (resource) if edfStarted[resource] then return end edfUnloadDefinition(resource) if createdRepresentations[resource] then for k, element in ipairs(createdRepresentations[resource]) do if isElement(element) then destroyElement(element) end end createdRepresentations[resource] = nil end end ) --------------------------------------------------------------------- --public functions --------------------------------------------------------------------- function edfStartResource ( resource ) if not getResourceName(resource) then return false elseif getResourceState(resource) == "running" then -- load the definition local def = edfLoadDefinition(resource) -- stop here if it couldn't be loaded if not def then return end edfStarted[resource] = true -- Notify that the load has been successful outputDebugString("Loaded definitions for '"..getResourceName(resource).."'.",0,180,180,255) return true else edfStarted[resource] = false return startResource(resource,false,false,true,false,false,false,false,false,true) end end function edfStopResource ( resource ) if not getResourceName(resource) or getResourceState ( resource ) ~= "running" then return false end edfStarted[resource] = nil return stopResource ( resource ) end --Loads [fromResource]'s definition to edf[inResource] (alreadyLoaded is for circular-inclusion protection purposes) function edfLoadDefinition(fromResource, inResource, alreadyLoaded) local fromResourceName = getResourceName(fromResource) --get the EDF filename local definitionName = getResourceInfo(fromResource, "edf:definition") if not definitionName then return false end --try to load it local definitionRoot = xmlLoadFile(':' .. getResourceName(fromResource) .. '/' .. definitionName) if not definitionRoot then outputDebugString(fromResourceName .. ': couldn\'t load edf file', 1) return false end --if we weren't told where to load it, it's in the def for the same resource we loaded it from if not inResource then inResource = fromResource end --create a new table if there is no definition loaded edf[inResource] = edf[inResource] or {} local definition = edf[inResource] --store the definition name edf[inResource].definitionName = xmlNodeGetAttribute(definitionRoot,"name") createdRepresentations[inResource] = {} --load all extended resources to be used as a base, and avoid circular extension local extends = xmlNodeGetAttribute(definitionRoot,"extends") if extends then --get all extended resource names separated by commas extends = split(extends,44) alreadyLoaded = alreadyLoaded or {} alreadyLoaded[fromResourceName] = true --for each resource it extends for k, extendedResourceName in ipairs(extends) do -- ignore it if it's the base definition, as it's always loaded if extendedResourceName ~= getResourceName(thisResource) then if alreadyLoaded[extendedResourceName] then outputDebugString("You can't extend resource '"..extendedResourceName.."'s EDF with '"..fromResourceName.."' twice.",2) else --if there's no circular extensions, load the def alreadyLoaded[extendedResourceName] = true local extendedResource = getResourceFromName(extendedResourceName) edfLoadDefinition(extendedResource, fromResource, alreadyLoaded) end end end end local i definition.elements = {} --this loop stores node data and parents for every element in the loaded EDF definition i = 0 repeat --try to get a new node until we go out of range local node = xmlFindChild(definitionRoot, "element", i) if not node then break end --check the element has a defined type name local name = xmlNodeGetAttribute(node,"name") if name then --create a new data table if there wasn't one already definition.elements[name] = definition.elements[name] or {} --add the node data to the type definition edfAddElementNodeData(node,inResource) --add the node parents to the type definition edfAddElementNodeParents(node,inResource) end i = i + 1 until false --this loop stores the children data for every element in the EDF i = 0 repeat --try to get a new node until we go out of range local node = xmlFindChild(definitionRoot,"element",i) if not node then break end --check the element has a defined type name local name = xmlNodeGetAttribute(node,"name") if name then --add the children data to the type definition edfAddElementNodeChildren(node,inResource) end i = i + 1 until false definition.settings = {} i = 0 repeat --try to get a new node until we go out of range local node = xmlFindChild(definitionRoot,"setting",i) if not node then break end --check the element has a defined type name local name = xmlNodeGetAttribute(node,"name") if name then --add the children data to the type definition edfAddSettingNodeData(node,inResource) end i = i + 1 until false i = 0 local serverScripts,clientScripts = {},{} repeat --try to get a new node until we go out of range local node = xmlFindChild(definitionRoot,"script",i) if not node then break end --check the element has a defined type name local name = xmlNodeGetAttribute(node,"src") if name then if xmlNodeGetAttribute(node,"type") == "client" then table.insert(clientScripts,name) else table.insert(serverScripts,name) end end i = i + 1 until false readScripts(serverScripts,clientScripts,fromResource) --if we've reached this point, trigger the load event local triggerFrom = rootElement if getResourceState(fromResource) == "running" then triggerFrom = getResourceRootElement(fromResource) end triggerEvent("onEDFLoad",triggerFrom,fromResource) xmlUnloadFile(definitionRoot) return true end --Unloads [resource]'s definition function edfUnloadDefinition(resource) --Destroy the actual custom elements if not edf[resource] then return false end for elementName,dataTable in pairs(edf[resource].elements) do for i,element in ipairs(getElementsByType(elementName)) do if edfGetCreatorResource(element) == resource then destroyElement( element ) end end end edf[resource] = nil triggerEvent("onEDFUnload",rootElement,resource) return true end --Represents an [element] according to its definition in edf[resource].elements function edfRepresentElement(theElement, resource, parentData, editorMode, restricted) local elementType = getElementType(theElement) -- make elementDefinition point to the element's definition local elementDefinition = edf[resource]["elements"][elementType] -- quit if that resource doesn't have a representation for it if not elementDefinition then outputDebugString('No definition for ' .. elementType) return false end -- if a creator resource doesn't exist, set it as the new resource setElementData ( theElement, "edf:creatorResource", getResourceName(resource) ) -- don't represent it if that'd make it go over the instance limit local limit = elementDefinition.limit if limit and #getElementsByType(elementType) > limit then outputDebugString("'"..elementType.."' limit exceeded, not representing.",2) return false end -- check all defined fields for validity and stores them in a parent data table local parentData = parentData or {} for dataField, dataDefinition in pairs(elementDefinition.data) do local checkedData = edfCheckElementData(theElement, dataField, dataDefinition) if checkedData == nil then outputDebugString('Failed validation for ' .. elementType .. '!' .. dataField) return false end parentData[dataField] = checkedData end -- get the position and rotation parentData.position = parentData.position or { edfGetElementPosition(theElement) } if not parentData.position[1] then parentData.position = {0,0,0} end parentData.rotation = parentData.rotation or { edfGetElementRotation(theElement) } if not parentData.rotation[1] then parentData.rotation = {0,0,0} end --ensure a dimension & interior is set parentData.dimension = parentData.dimension or 0 parentData.interior = parentData.interior or 0 setElementDimension ( theElement, parentData.dimension ) -- if there are children, if #elementDefinition.children > 0 then -- determine if the element children will be glued together -- (always glue them if we're on editor mode) glued = elementDefinition.glued or editorMode local dummyElement if glued then dummyElement = createObject( DUMMY_ID, parentData.position[1], parentData.position[2], parentData.position[3], parentData.rotation[1], parentData.rotation[2], parentData.rotation[3] ) -- setObjectScale(dummyElement,0) setElementDimension(dummyElement, parentData.dimension) setElementInterior(dummyElement, parentData.interior) setElementParent(dummyElement, theElement) setElementData(dummyElement, "edf:rep", true) setElementData(dummyElement, "edf:dummy", true) setElementData(theElement, "edf:handle", dummyElement) table.insert(createdRepresentations[resource], dummyElement) -- triggerClientEvent ( "hideDummy", dummyElement ) end -- for each child, for index, definedChild in ipairs(elementDefinition.children) do local component, componentHandle local inherited = {} -- skip editor-only reps if not in editor mode if editorMode then -- if it is a basic type, if isBasic[definedChild.type] then -- we'll build a new table with this child's data local childData = {} -- for each defined datafield and its value, for dataField, dataValue in pairs(definedChild.data) do -- if it has to be inherited, if type(dataValue) == "string" and string.sub(dataValue,1,1) == '!' and string.sub(dataValue, -1) == '!' then inherited[string.sub(dataValue,2,-2)] = dataField -- get it from the parent data table local parentDataField = string.sub(dataValue,2,-2) dataValue = parentData[parentDataField] -- if it is a position or rotation, add the parent's elseif dataField == "position" or dataField == "rotation" then local newCoord = {} for i, value in ipairs(dataValue) do newCoord[i] = value + parentData[dataField][i] end dataValue = newCoord end childData[dataField] = dataValue end -- create our basic element component = edfCreateBasic[definedChild.type](childData) componentHandle = component setElementInterior(component, parentData.interior) setElementDimension(component, parentData.dimension) -- if it is a custom type, else -- build a restriction table if we don't have one, restricted = restricted or {} -- and mark our current type as restricted restricted[elementType] = true -- if the type was restricted, warn and don't do anything if restricted[definedChild.type] then outputDebugString("Circular inclusion in element '"..elementType.."': you can't include the type '"..definedChild.type.."' again.",2) else component = createElement(definedChild.type) -- we'll build a new table with this element's data, -- based on that of its parent local subParentData = parentData -- for each defined datafield and its value, for dataField, dataValue in pairs(definedChild.data) do -- if it has to be inherited, if type(dataValue) == "string" and string.sub(dataValue,1,1) == '!' and string.sub(dataValue, -1) == '!' then inherited[string.sub(dataValue,2,-2)] = true -- get it from the parent data table local parentDataField = string.sub(dataValue,2,-2) dataValue = parentData[parentDataField] end subParentData[dataField] = dataField end component = edfRepresentElement(component, resource, subParentData, editorMode, restricted) componentHandle = edfGetHandle(component) end end if component then setElementData (component,"edf:inherited",inherited) setElementParent(component, theElement) setElementData(component, "edf:rep", true) if glued then local offset = definedChild.data.position or {0,0,0} attachElements(componentHandle, dummyElement, unpack(offset)) end table.insert(createdRepresentations[resource],component) end end end --for loop end --if check return theElement end --Creates an [elementType] element as defined in [fromResource] and represents it function edfCreateElement(elementType, creatorClient, fromResource, parametersTable, editorMode) local theElement if not isElement(creatorClient) or getElementType(creatorClient)~="player" then outputDebugString("edfCreateElement: Non-existing creator specified",1) return false end if not edf[fromResource] then outputDebugString("edfCreateElement: Resource '"..getResourceName(fromResource).."'s definition isn't loaded.",1) return false end if not edf[fromResource]["elements"][elementType] then outputDebugString("edfCreateElement: Resource '"..getResourceName(fromResource).."' doesn't define type '"..elementType.."'.",1) return false end parametersTable = parametersTable or {} parametersTable.position = parametersTable.position or {0,0,0} parametersTable.rotation = parametersTable.rotation or {0,0,0} parametersTable.interior = parametersTable.interior or 0 parametersTable.dimension = parametersTable.dimension or 0 if isBasic[elementType] then local childData = {} for property, propertyData in pairs(edf[fromResource]["elements"][elementType].data) do --try to get the given value in target datatype if convert[propertyData.datatype] then parametersTable[property] = convert[propertyData.datatype](parametersTable[property]) end --store the value, or its default childData[property] = parametersTable[property] or propertyData.default end theElement = edfCreateBasic[elementType](childData) setElementInterior(theElement, parametersTable.interior) setElementDimension(theElement, parametersTable.dimension) -- setElementData if it is not an edf property for dataField, dataValue in pairs(parametersTable) do if not edf[fromResource]["elements"][elementType].data[dataField] then setElementData(theElement, dataField, dataValue) end end else local newElement = createElement(elementType) if not newElement then return false end for dataField, dataValue in pairs(parametersTable) do if dataField == "position" then edfSetElementPosition(newElement, dataValue[1], dataValue[2], dataValue[3]) elseif dataField == "rotation" then edfSetElementRotation(newElement, dataValue[1], dataValue[2], dataValue[3]) elseif dataField == "interior" then setElementInterior(newElement, dataValue) elseif dataField == "dimension" then setElementDimension(newElement, dataValue) else setElementData(newElement, dataField, dataValue) end end theElement = edfRepresentElement(newElement, fromResource, parametersTable, editorMode) if not theElement then destroyElement(newElement) return false end end edfSetCreatorResource(theElement,fromResource) edfSetCreatorClient(theElement,creatorClient) return theElement end function edfCloneElement(theElement, editorMode ) if not isElement(theElement) then outputDebugString("edfCloneElement: Invalid element specified.",1) return false end local creatorResource = edfGetCreatorResource(theElement) local creatorClient = edfGetCreatorClient(theElement) local elementType = getElementType(theElement) if not edf[creatorResource] then outputDebugString("edfCreateElement: Resource '"..getResourceName(fromResource).."'s definition isn't loaded.",1) return false end if not edf[creatorResource]["elements"][elementType] then outputDebugString("edfCreateElement: Resource '"..getResourceName(fromResource).."' doesn't define type '"..elementType.."'.",1) return false end parametersTable = {} parametersTable.position = {edfGetElementPosition(theElement)} or {0,0,0} parametersTable.rotation = {edfGetElementRotation(theElement)} or {0,0,0} parametersTable.interior = edfGetElementInterior(theElement) or 0 parametersTable.dimension = edfGetElementDimension(theElement) or 0 if isBasic[elementType] then local childData = {} for property, propertyData in pairs(edf[creatorResource]["elements"][elementType].data) do --try to get the given value in target datatype if convert[propertyData.datatype] then parametersTable[property] = convert[propertyData.datatype](parametersTable[property]) end --store the value, or its default childData[property] = parametersTable[property] or propertyData.default end theElement = cloneElement(theElement) setElementInterior(theElement, parametersTable.interior) setElementDimension(theElement, parametersTable.dimension) else local newElement = cloneElement(theElement) if not newElement then return false end for dataField, dataValue in pairs(parametersTable) do if dataField == "position" then edfSetElementPosition(newElement, dataValue[1], dataValue[2], dataValue[3]) elseif dataField == "rotation" then edfSetElementRotation(newElement, dataValue[1], dataValue[2], dataValue[3]) else setElementData(newElement, dataField, dataValue) end end theElement = edfRepresentElement(newElement, creatorResource, parametersTable, editorMode) if not theElement then destroyElement(newElement) return false end end edfSetCreatorResource(theElement,creatorResource) edfSetCreatorClient(theElement,creatorClient) return theElement end --Updates an [element]'s visual representation according to element data changes function edfUpdateRepresentation(theElement, resource, editorMode) if not edf[resource] then return false end for i, child in ipairs(getElementChildren(theElement)) do --destroy all reps if edfGetParent(child) == theElement then destroyElement(child) end end --represent it again edfRepresentElement(theElement, resource, false, editorMode) end --Returns a list of resources whose defs are loaded function edfGetLoadedEDFResources() local loadedDefinitions = {} for resource in pairs(edf) do table.insert(loadedDefinitions, resource) end return loadedDefinitions end --Returns a full def for a resource function edfGetDefinition(fromResource) if edf[fromResource] == nil then outputDebugString("edfGetDefinition: The definition from resource '"..tostring(getResourceName(fromResource)).."' isn't loaded.",1) return false else return edf[fromResource] end end --Returns whether a resource has a definition or not function edfHasDefinition(resource) if getResourceInfo(resource, "edf:definition") then return true else return false end end --Returns a custom element's invisible handle function edfGetHandle( edfElement ) return getElementData(edfElement, "edf:handle") or false end --Returns whether or not an element is part of an edf element's representation function edfIsRepresentation( elem ) return getElementData(elem, "edf:rep") end --Returns an element's EDF parent function edfGetParent( repPart ) if getElementData(repPart, "edf:rep") then return getElementParent(repPart) else return repPart end end --Returns an element's EDF ancestor function edfGetAncestor( repPart ) if getElementData(repPart, "edf:rep") then return edfGetAncestor( getElementParent(repPart) ) else return repPart end end --Returns a custom element's creator resource function edfGetCreatorResource( edfElement ) local resourceName = getElementData( edfElement, "edf:creatorResource" ) if resourceName then return getResourceFromName( resourceName ) else return thisResource end end --Forcefully sets the creator resource function edfSetCreatorResource( edfElement, creator ) return setElementData( edfElement, "edf:creatorResource", getResourceName(creator) ) end --Returns a custom element's creator client function edfGetCreatorClient( edfElement ) return getElementData( edfElement, "edf:creatorClient" ) end --Forcefully sets the creator client function edfSetCreatorClient( edfElement, creator ) return setElementData( edfElement, "edf:creatorClient", creator ) end --Returns an element's position, or its posX/Y/Z element data, or false function edfGetElementPosition(element) local px, py, pz if isBasic[getElementType(element)] then px, py, pz = getElementPosition(element) else local handle = edfGetHandle(element) if handle then px, py, pz = getElementPosition(handle) else px = tonumber(getElementData(element,"posX")) py = tonumber(getElementData(element,"posY")) pz = tonumber(getElementData(element,"posZ")) end end if px and py and pz then return px, py, pz else return false end end --Returns an element's rotation, or its rotX/Y/Z element data, or false function edfGetElementRotation(element) local etype = getElementType(element) local rx, ry, rz if etype == "object" then rx, ry, rz = getObjectRotation(element) elseif etype == "vehicle" then rx, ry, rz = getVehicleRotation(element) elseif etype == "player" or etype == "ped" then rx = 0 ry = 0 rz = getPedRotation(element) else local handle = edfGetHandle(element) if handle then rx, ry, rz = getObjectRotation(handle) else rx = tonumber(getElementData(element,"rotX")) ry = tonumber(getElementData(element,"rotY")) rz = tonumber(getElementData(element,"rotZ")) end end if rx and ry and rz then return rx, ry, rz else return false end end --Sets an element's position, or its posX/Y/Z element data function edfSetElementPosition(element, px, py, pz) local ancestor = edfGetAncestor(element) or element setElementData(ancestor, "position", {px, py, pz}) if isBasic[getElementType(element)] then if setElementPosition(element, px, py, pz) then triggerEvent ( "onElementPropertyChanged", ancestor, "position" ) return true end else local handle = edfGetHandle(element) if handle then if setElementPosition(handle, px, py, pz) then triggerEvent ( "onElementPropertyChanged", ancestor, "position" ) return true end else setElementData(element, "posX", px or 0) setElementData(element, "posY", py or 0) setElementData(element, "posZ", pz or 0) triggerEvent ( "onElementPropertyChanged", ancestor, "position" ) return true end end return false end --Sets an element's rotation, or its rotX/Y/Z element data function edfSetElementRotation(element, rx, ry, rz) local ancestor = edfGetAncestor(element) or element setElementData(ancestor, "rotation", {rx, ry, rz}) local etype = getElementType(element) if etype == "object" then if setObjectRotation(element, rx, ry, rz) then triggerEvent ( "onElementPropertyChanged", ancestor, "rotation" ) return true end elseif etype == "vehicle" then if setVehicleRotation(element, rx, ry, rz) then triggerEvent ( "onElementPropertyChanged", ancestor, "rotation" ) return true end elseif etype == "player" or etype == "ped" then if setPedRotation(element, rz) then triggerEvent ( "onElementPropertyChanged", ancestor, "rotation" ) return true end else local handle = edfGetHandle(element) if handle then if setObjectRotation(handle, rx, ry, rz) then triggerEvent ( "onElementPropertyChanged", ancestor, "rotation" ) return true end else setElementData(element, "rotX", rx or 0) setElementData(element, "rotY", ry or 0) setElementData(element, "rotZ", rz or 0) triggerEvent ( "onElementPropertyChanged", ancestor, "rotation" ) return true end end return false end function edfGetElementInterior(element) return getElementInterior(element) or tonumber(getElementData(element, "interior")) or 0 end function edfSetElementInterior(element, interior) setElementInterior(element, interior) if getElementChildrenCount( element ) > 0 then for k, child in ipairs( getElementChildren( element ) ) do if edfGetParent(child) == edfGetParent(element) then edfSetElementInterior( child, interior ) end end end return true end function edfGetElementDimension(element) return getElementDimension(element) or tonumber(getElementData(element, "edf:dimension")) or 0 end function edfSetElementDimension(element, dimension) setElementDimension(element, dimension) if getElementChildrenCount( element ) > 0 then for k, child in ipairs( getElementChildren( element ) ) do if edfGetParent(child) == edfGetParent(element) then edfSetElementDimension( child, dimension ) end end end return true end function edfSetElementProperty(element, property, value) --Set the value for any representations edfSetElementPropertyForRepresentations(element,property,value) local elementType = getElementType(element) -- if our property is an entity attribute we have access to, set it if propertySetters[elementType] and propertySetters[elementType][property] then local wasSet = propertySetters[elementType][property](element, value) -- don't do anything else if this failed if not wasSet then return false end end setElementData(element, property, value) triggerEvent ( "onElementPropertyChanged", element, property ) return true end function edfSetElementPropertyForRepresentations(element,property,value) --Check if the property is inherited to reps for k,child in ipairs(getElementChildren(element)) do if edfGetAncestor(child) == element then --Check that the child is a representation of the element local inherited = getElementData(child,"edf:inherited") if inherited then --Check that the property is inherited to this child if inherited[property] then local elementType = getElementType(child) local dataField = inherited[property] if propertySetters[elementType] and propertySetters[elementType][dataField] then propertySetters[elementType][dataField](child, value) else --If this representation inherits data from another element edfSetElementPropertyForRepresentations(child,dataField,value) end end end end end end function edfGetElementProperty(element, property) local elementType = getElementType(element) -- if our property is an entity attribute we have access to, get it if propertyGetters[elementType] and propertyGetters[elementType][property] then return propertyGetters[elementType][property](element) else return getElementData(element, property, value) end end --------------------------------------------------------------------- --private functions --------------------------------------------------------------------- --Stores [node]'s data for an EDF element type in edf[resource]["elements"][type] function edfAddElementNodeData(node, resource) -- get the element type name local name = xmlNodeGetAttribute(node,"name") local typeDefinition = edf[resource]["elements"][name] -- update the type instance limit typeDefinition.limit = tonumber(xmlNodeGetAttribute(node,"limit")) or typeDefinition.limit -- update the type friendly name typeDefinition.friendlyname = xmlNodeGetAttribute(node,"friendlyname") or typeDefinition.friendlyname -- update the type description typeDefinition.description = xmlNodeGetAttribute(node,"description") or typeDefinition.description -- update the type icon typeDefinition.icon = xmlNodeGetAttribute(node,"icon") or typeDefinition.icon --update the name of the parent typeDefinition.parentName = xmlNodeGetAttribute(node,"parentName") or typeDefinition.parentName --update the description of the parent typeDefinition.parentDescription = xmlNodeGetAttribute(node,"parentDescription") or typeDefinition.parentDescription --update the type shortcut typeDefinition.shortcut = xmlNodeGetAttribute(node,"shortcut") or typeDefinition.shortcut local isValidShortcut -- update the type createable state -- If the "createable" attribute is not present, xmlNodeGetAttribute returns nil and then -- it defaults to true. If it's present, xmlNodeGetAttribute returns a string and then the -- value in that string is returned by convert.boolean(). typeDefinition.createable = convert.boolean(xmlNodeGetAttribute(node,"createable") or true) or typeDefinition.createable -- update the type glue state typeDefinition.glued = convert.boolean(xmlNodeGetAttribute(node,"glued")) or typeDefinition.glued -- declare the data fields table for this type typeDefinition.data = typeDefinition.data or {} -- make dataFields a reference to it to keep it short local dataFields = typeDefinition.data -- this loop adds all data fields to the definition table for our type local j = 0 repeat -- try to get a new data node until we go out of range local subnode = xmlFindChild(node,"data",j) if not subnode then break end -- get the data field's name local dname = xmlNodeGetAttribute(subnode,"name") if dname then if string.lower(dname) == "id" then outputDebugString("ID is not an allowed data field name.",2) else -- create the data fields table if there isn't one already dataFields[dname] = dataFields[dname] or {} -- Keep the index that it had in the edf dataFields[dname].index = j -- update the data field's datatype dataFields[dname].datatype = xmlNodeGetAttribute(subnode,"type") or dataFields[dname].datatype local validValues = gettok(dataFields[dname].datatype, 2, 58) if validValues then dataFields[dname].validvalues = split(validValues, 44) dataFields[dname].datatype = gettok(dataFields[dname].datatype, 1, 58) else dataFields[dname].validvalues = nil end -- update the data field's default value --local convertFunction = convert[dataFields[dname].datatype] or convert.string dataFields[dname].default = xmlNodeGetAttribute(subnode,"default") or dataFields[dname].default -- convert the default value to the datafield's type if a conversion function exists if convert[dataFields[dname].datatype] then dataFields[dname].default = convert[dataFields[dname].datatype](dataFields[dname].default, dataFields[dname].validvalues) end -- update the data field description dataFields[dname].description = xmlNodeGetAttribute(subnode,"description") or dataFields[dname].description -- update the required flag (default: true) local requiredAttribute = xmlNodeGetAttribute(subnode,"required") if requiredAttribute then dataFields[dname].required = convert.boolean(requiredAttribute) else dataFields[dname].required = dataFields[dname].required or true end if dname == typeDefinition.shortcut then isValidShortcut = true end end end j = j + 1 until false if not isValidShortcut then typeDefinition.shortcut = nil end return true end --Stores all children data for an EDF element in edf[resource]["elements"][type] function edfAddElementNodeChildren(node, resource) -- get the element type name local name = xmlNodeGetAttribute(node,"name") -- declare the children table for this type edf[resource]["elements"][name].children = edf[resource]["elements"][name].children or {} -- make childrenTable a reference to it to keep it short local childrenTable = edf[resource]["elements"][name].children -- for each basic type that could be used as a children, for typeName, typeDefinition in pairs(edf[thisResource]["elements"]) do local k = 0 repeat --try to get a new node until we go out of range local subnode = xmlFindChild(node,typeName,k) if not subnode then break end -- create a child table local child = {} child.type = typeName child.editorOnly = convert.boolean(xmlNodeGetAttribute(subnode, "editorOnly")) child.data = {} -- make dataFields point to the data fields from the typedef to keep it short local dataFields = typeDefinition.data -- add the "offset" data for this child child.data = edfGetChildData(subnode, dataFields) -- if it was successful, insert it if child.data then table.insert(childrenTable, child) end k = k + 1 until false end -- for each known custom element type that could be used as a children, for typeName, typeDefinition in pairs(edf[resource]["elements"]) do local k = 0 repeat --try to get a new node until we go out of range local subnode = xmlFindChild(node,typeName,k) if not subnode then break end -- create a child table local child = {} child.type = typeName child.data = {} -- make dataFields point to the data fields from the typedef to keep it short local dataFields = typeDefinition.data -- add the "offset" data for this child child.data = edfGetChildData(subnode, dataFields) -- if it was successful, insert it if child.data then table.insert(childrenTable, child) end k = k + 1 until false end return true end --Stores allowed parents for an EDF element in edf[resource]["elements"][type] function edfAddElementNodeParents(node, resource) -- get the element type name local name = xmlNodeGetAttribute(node,"name") -- declare the parents table for this type edf[resource]["elements"][name].parents = edf[resource]["elements"][name].parents or {} -- make parentsTable a reference to it to keep it short local parentsTable = edf[resource]["elements"][name].parents -- for each parent tag, local k = 0 repeat --try to get a new node until we go out of range local subnode = xmlFindChild(node,"parent",k) if not subnode then break end local parentType = xmlNodeGetAttribute(subnode, "type") if parentType then table.insert(parentsTable, parentType) end --If there was a name & description specified, add it if it doesnt exist edf[resource]["elements"][name].parentName = edf[resource]["elements"][name].parentName or xmlNodeGetAttribute(subnode, "name") edf[resource]["elements"][name].parentDescription = edf[resource]["elements"][name].parentDescription or xmlNodeGetAttribute(subnode, "description") k = k + 1 until false return true end --Stores [node]'s data for an EDF setting in edf[resource]["settings"][name] function edfAddSettingNodeData(node, resource) -- get the element type name local name = xmlNodeGetAttribute(node,"name") edf[resource]["settings"][name] = edf[resource]["settings"][name] or {} local settingDefinition = edf[resource]["settings"][name] -- update the setting description settingDefinition.description = xmlNodeGetAttribute(node,"description") or settingDefinition.description -- update the setting friendly name settingDefinition.friendlyname = xmlNodeGetAttribute(node,"friendlyname") or settingDefinition.friendlyname -- update the setting type settingDefinition.datatype = xmlNodeGetAttribute(node,"type") or settingDefinition.datatype -- update the setting default local defaultAttribute = xmlNodeGetAttribute(node,"default") if defaultAttribute then local dataType = settingDefinition.datatype local token = gettok ( settingDefinition.datatype,1,58 ) local token2 = gettok ( settingDefinition.datatype,2,58 ) local validvalues if token2 then dataType = token validvalues = split(token2, 44) end settingDefinition.default = convert[dataType](defaultAttribute,validvalues) else settingDefinition.default = nil end -- update the setting required flag local requiredAttribute = xmlNodeGetAttribute(node,"required") if requiredAttribute then settingDefinition.required = convert.boolean(requiredAttribute) else settingDefinition.required = dataFields[dname].required or true end return true end --Reads data for an EDF child from its xmlnode, using dataFields as the definition function edfGetChildData(node, dataFields) local childData = {} for dataField, fieldProperties in pairs(dataFields) do local datatype = fieldProperties.datatype -- if we don't have a conversion function for this datatype, default to string if not convert[datatype] then datatype = "string" end -- get the default value local default = fieldProperties.default -- get the actual value (make it nil, not false, if not present) local value if dataField == "position" then value = {} value[1] = xmlNodeGetAttribute(node, "posX") or 0 value[2] = xmlNodeGetAttribute(node, "posY") or 0 value[3] = xmlNodeGetAttribute(node, "posZ") or 0 elseif dataField == "rotation" then value = {} value[1] = xmlNodeGetAttribute(node, "rotX") or 0 value[2] = xmlNodeGetAttribute(node, "rotY") or 0 value[3] = xmlNodeGetAttribute(node, "rotZ") or 0 else value = xmlNodeGetAttribute(node, dataField) or nil if value then -- if it isn't prefixed and suffixed with !s -- (that is, it won't be inherited from the parent element), convert it if string.sub(value,1,1) ~= '!' or string.sub(value, -1) ~= '!' then value = convert[datatype](value, elementType) end end end if value ~= nil then -- if we could convert it, just store the value childData[dataField] = value elseif default then -- if we couldn't, but there is a default, use it childData[dataField] = default elseif fieldProperties.required then -- if valid and default weren't valid and it's required, we have to stop here outputDebugString("Value of required attribute '"..dataField.."' doesn't match its type ('"..datatype.."'), and there's no valid default.",1) return false end end return childData end --Checks element data for conformity with its type spec function edfCheckElementData(theElement, dataField, dataDefinition) local theData = getElementData(theElement, dataField) if dataField == 'position' or dataField == 'rotation' then -- Position and rotation are not single strings with a special format that needs checking return false elseif not theData then -- if there is no data, set it to default theData = dataDefinition.default else -- if there is data, we're checking the type matches local correctType = dataDefinition.datatype -- if we don't have a conversion function for this datatype, default to string if not convert[correctType] then correctType = "string" end local convertedValue = convert[correctType](theData, dataDefinition.validvalues) -- if the attribute has an invalid type, if convertedValue == nil then -- output a warning local warning = "Attribute '"..dataField.."' has an invalid type in element '"..getElementType(theElement).."': should be '"..correctType.."'." outputDebugString(warning,2) -- and set it to default theData = dataDefinition.default else theData = convertedValue end end -- if there is still no data (because it wasnt set and there was no default)... if theData == nil then if dataDefinition.required then --...and the data is required, then it is an error and we have to stop here outputDebugString("Attribute '"..dataField.."' missing in element '"..getElementType(theElement).."'.", 1) return nil else return false end end -- we set the new element data in case we have changed it setElementData(theElement, dataField, theData) return theData end -- Returns the appropiate resource for an element type function edfGetResourceForElementType(elementType) local res = nil for resource, data in pairs(edf) do if resource ~= thisResource then for name, _ in pairs(data.elements) do if name == elementType then res = resource break end end if res then break end end end return res end
AddCSLuaFile() DEFINE_BASECLASS("drivable_combine_soldier") ENT.Base = "drivable_combine_soldier" ENT.PrintName = "Combine Soldier (smg)" ENT.Author = "TankNut" ENT.Category = "Drivable" ENT.Spawnable = true ENT.Model = Model("models/Combine_Soldier.mdl") ENT.GunClass = "drivable_gun_smg1"
local spec_helper = require "spec.spec_helpers" describe("CLI", function() setup(function() pcall(spec_helper.stop_kong) end) teardown(function() pcall(spec_helper.stop_kong) end) it("the status check should fail when Kong is not running", function() assert.error_matches(function() spec_helper.status_kong() end, "Kong is not running", nil, true) end) it("the status check should not fail when Kong is running", function() local _, code = spec_helper.start_kong() assert.are.same(0, code) local ok = pcall(spec_helper.status_kong) assert.truthy(ok) local ok = pcall(spec_helper.stop_kong) assert.truthy(ok) end) it("the status check should fail when some services are not running", function() local _, code = spec_helper.start_kong() assert.are.same(0, code) os.execute("pkill serf") assert.error_matches(function() spec_helper.status_kong() end, "Some services required by Kong are not running. Please execute \"kong restart\"!", nil, true) end) end)
object_draft_schematic_dance_prop_prop_glowstick_l_s02 = object_draft_schematic_dance_prop_shared_prop_glowstick_l_s02:new { } ObjectTemplates:addTemplate(object_draft_schematic_dance_prop_prop_glowstick_l_s02, "object/draft_schematic/dance_prop/prop_glowstick_l_s02.iff")
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --General Public License as published by the Free Software --Foundation; either version 2 of the License, --or (at your option) any later version. --This program is distributed in the hope that it will be useful, --but WITHOUT ANY WARRANTY; without even the implied warranty of --MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --See the GNU Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_charisma = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_charisma.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2925842, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_charisma, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_charisma.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_charisma_2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_charisma_2.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3961130234, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_charisma_2, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_charisma_2.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_entertainer = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_entertainer.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 768952240, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_entertainer, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_entertainer.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_entertainer_2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_entertainer_2.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2552206589, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_entertainer_2, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_entertainer_2.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_medic = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_medic.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1589090972, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_medic, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_medic.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_medic_2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_medic_2.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3813406638, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_medic_2, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_medic_2.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_taming = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_taming.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1620152707, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_taming, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_taming.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_taming_2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_taming_2.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 899505469, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_taming_2, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_taming_2.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_training = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_training.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2024699150, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_training, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_training.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_training_2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_training_2.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2809419089, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_casual_training_2, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_casual_training_2.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_armor = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_armor.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2665358309, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_armor, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_armor.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_armor_2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_armor_2.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 395605474, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_armor_2, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_armor_2.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_bleeding = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_bleeding.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1070501512, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_bleeding, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_bleeding.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_bleeding_2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_bleeding_2.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2262729200, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_bleeding_2, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_bleeding_2.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_camo = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_camo.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3361810650, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_camo, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_camo.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_camo_2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_camo_2.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 756747736, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_camo_2, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_camo_2.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_cover = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_cover.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2635065111, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_cover, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_cover.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_cover_2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_cover_2.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3034020975, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_cover_2, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_cover_2.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_defense = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_defense.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1421353901, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_defense, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_defense.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_defense_2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_defense_2.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1217369934, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_defense_2, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_defense_2.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_intimidate = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_intimidate.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1549050933, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_intimidate, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_intimidate.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_intimidate_2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_intimidate_2.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3053086977, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_clothing_field_intimidate_2, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_clothing_field_intimidate_2.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_heavy_filling = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_heavy_filling.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 295650264, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_heavy_filling, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_heavy_filling.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_heavy_flavor = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_heavy_flavor.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 4077000315, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_heavy_flavor, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_heavy_flavor.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_heavy_nutrition = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_heavy_nutrition.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 463434519, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_heavy_nutrition, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_heavy_nutrition.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_heavy_quantity = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_heavy_quantity.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3722871954, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_heavy_quantity, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_heavy_quantity.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_light_filling = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_light_filling.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2624931359, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_light_filling, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_light_filling.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_light_flavor = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_light_flavor.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3804703928, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_light_flavor, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_light_flavor.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_light_nutrition = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_light_nutrition.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1803745287, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_light_nutrition, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_light_nutrition.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_light_quantity = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_light_quantity.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1864508847, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_light_quantity, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_light_quantity.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_medium_filling = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_medium_filling.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 903570077, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_medium_filling, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_medium_filling.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_medium_flavor = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_medium_flavor.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 929619132, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_medium_flavor, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_medium_flavor.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_medium_nutrition = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_medium_nutrition.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2027905587, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_medium_nutrition, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_medium_nutrition.iff") object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_medium_quantity = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_medium_quantity.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 316670382, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_bio_engineer_bio_component_shared_bio_component_food_medium_quantity, "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_medium_quantity.iff")
require("lockbox").insecure(); local Bit = require("lockbox.util.bit"); local String = require("string"); local Math = require("math"); local Queue = require("lockbox.util.queue"); local AND = Bit.band; local OR = Bit.bor; local NOT = Bit.bnot; local XOR = Bit.bxor; local LROT = Bit.lrotate; local LSHIFT = Bit.lshift; local RSHIFT = Bit.rshift; --RIPEMD160 is little-endian local bytes2word = function(b0, b1, b2, b3) local i = b3; i = LSHIFT(i, 8); i = OR(i, b2); i = LSHIFT(i, 8); i = OR(i, b1); i = LSHIFT(i, 8); i = OR(i, b0); return i; end local word2bytes = function(word) local b0, b1, b2, b3; b0 = AND(word, 0xFF); word = RSHIFT(word, 8); b1 = AND(word, 0xFF); word = RSHIFT(word, 8); b2 = AND(word, 0xFF); word = RSHIFT(word, 8); b3 = AND(word, 0xFF); return b0, b1, b2, b3; end local dword2bytes = function(i) local b4, b5, b6, b7 = word2bytes(Math.floor(i / 0x100000000)); local b0, b1, b2, b3 = word2bytes(i); return b0, b1, b2, b3, b4, b5, b6, b7; end local F = function(x, y, z) return XOR(x, XOR(y, z)); end local G = function(x, y, z) return OR(AND(x, y), AND(NOT(x), z)); end local H = function(x, y, z) return XOR(OR(x, NOT(y)), z); end local I = function(x, y, z) return OR(AND(x, z), AND(y, NOT(z))); end local J = function(x, y, z) return XOR(x, OR(y, NOT(z))); end local FF = function(a, b, c, d, e, x, s) a = a + F(b, c, d) + x; a = LROT(a, s) + e; a = AND(a, 0xFFFFFFFF); return a; end local GG = function(a, b, c, d, e, x, s) a = a + G(b, c, d) + x + 0x5a827999; a = LROT(a, s) + e; a = AND(a, 0xFFFFFFFF); return a; end local HH = function(a, b, c, d, e, x, s) a = a + H(b, c, d) + x + 0x6ed9eba1; a = LROT(a, s) + e; a = AND(a, 0xFFFFFFFF); return a; end local II = function(a, b, c, d, e, x, s) a = a + I(b, c, d) + x + 0x8f1bbcdc; a = LROT(a, s) + e; a = AND(a, 0xFFFFFFFF); return a; end local JJ = function(a, b, c, d, e, x, s) a = a + J(b, c, d) + x + 0xa953fd4e; a = LROT(a, s) + e; a = AND(a, 0xFFFFFFFF); return a; end local FFF = function(a, b, c, d, e, x, s) a = a + F(b, c, d) + x; a = LROT(a, s) + e; a = AND(a, 0xFFFFFFFF); return a; end local GGG = function(a, b, c, d, e, x, s) a = a + G(b, c, d) + x + 0x7a6d76e9; a = LROT(a, s) + e; a = AND(a, 0xFFFFFFFF); return a; end local HHH = function(a, b, c, d, e, x, s) a = a + H(b, c, d) + x + 0x6d703ef3; a = LROT(a, s) + e; a = AND(a, 0xFFFFFFFF); return a; end local III = function(a, b, c, d, e, x, s) a = a + I(b, c, d) + x + 0x5c4dd124; a = LROT(a, s) + e; a = AND(a, 0xFFFFFFFF); return a; end local JJJ = function(a, b, c, d, e, x, s) a = a + J(b, c, d) + x + 0x50a28be6; a = LROT(a, s) + e; a = AND(a, 0xFFFFFFFF); return a; end local RIPEMD160 = function() local queue = Queue(); local A = 0x67452301; local B = 0xefcdab89; local C = 0x98badcfe; local D = 0x10325476; local E = 0xc3d2e1f0; local public = {}; local processBlock = function() local aa, bb, cc, dd, ee = A, B, C, D, E; local aaa, bbb, ccc, ddd, eee = A, B, C, D, E; local X = {}; for i = 0, 15 do X[i] = bytes2word(queue.pop(), queue.pop(), queue.pop(), queue.pop()); end aa, cc = FF(aa, bb, cc, dd, ee, X[ 0], 11), LROT(cc, 10); ee, bb = FF(ee, aa, bb, cc, dd, X[ 1], 14), LROT(bb, 10); dd, aa = FF(dd, ee, aa, bb, cc, X[ 2], 15), LROT(aa, 10); cc, ee = FF(cc, dd, ee, aa, bb, X[ 3], 12), LROT(ee, 10); bb, dd = FF(bb, cc, dd, ee, aa, X[ 4], 5), LROT(dd, 10); aa, cc = FF(aa, bb, cc, dd, ee, X[ 5], 8), LROT(cc, 10); ee, bb = FF(ee, aa, bb, cc, dd, X[ 6], 7), LROT(bb, 10); dd, aa = FF(dd, ee, aa, bb, cc, X[ 7], 9), LROT(aa, 10); cc, ee = FF(cc, dd, ee, aa, bb, X[ 8], 11), LROT(ee, 10); bb, dd = FF(bb, cc, dd, ee, aa, X[ 9], 13), LROT(dd, 10); aa, cc = FF(aa, bb, cc, dd, ee, X[10], 14), LROT(cc, 10); ee, bb = FF(ee, aa, bb, cc, dd, X[11], 15), LROT(bb, 10); dd, aa = FF(dd, ee, aa, bb, cc, X[12], 6), LROT(aa, 10); cc, ee = FF(cc, dd, ee, aa, bb, X[13], 7), LROT(ee, 10); bb, dd = FF(bb, cc, dd, ee, aa, X[14], 9), LROT(dd, 10); aa, cc = FF(aa, bb, cc, dd, ee, X[15], 8), LROT(cc, 10); ee, bb = GG(ee, aa, bb, cc, dd, X[ 7], 7), LROT(bb, 10); dd, aa = GG(dd, ee, aa, bb, cc, X[ 4], 6), LROT(aa, 10); cc, ee = GG(cc, dd, ee, aa, bb, X[13], 8), LROT(ee, 10); bb, dd = GG(bb, cc, dd, ee, aa, X[ 1], 13), LROT(dd, 10); aa, cc = GG(aa, bb, cc, dd, ee, X[10], 11), LROT(cc, 10); ee, bb = GG(ee, aa, bb, cc, dd, X[ 6], 9), LROT(bb, 10); dd, aa = GG(dd, ee, aa, bb, cc, X[15], 7), LROT(aa, 10); cc, ee = GG(cc, dd, ee, aa, bb, X[ 3], 15), LROT(ee, 10); bb, dd = GG(bb, cc, dd, ee, aa, X[12], 7), LROT(dd, 10); aa, cc = GG(aa, bb, cc, dd, ee, X[ 0], 12), LROT(cc, 10); ee, bb = GG(ee, aa, bb, cc, dd, X[ 9], 15), LROT(bb, 10); dd, aa = GG(dd, ee, aa, bb, cc, X[ 5], 9), LROT(aa, 10); cc, ee = GG(cc, dd, ee, aa, bb, X[ 2], 11), LROT(ee, 10); bb, dd = GG(bb, cc, dd, ee, aa, X[14], 7), LROT(dd, 10); aa, cc = GG(aa, bb, cc, dd, ee, X[11], 13), LROT(cc, 10); ee, bb = GG(ee, aa, bb, cc, dd, X[ 8], 12), LROT(bb, 10); dd, aa = HH(dd, ee, aa, bb, cc, X[ 3], 11), LROT(aa, 10); cc, ee = HH(cc, dd, ee, aa, bb, X[10], 13), LROT(ee, 10); bb, dd = HH(bb, cc, dd, ee, aa, X[14], 6), LROT(dd, 10); aa, cc = HH(aa, bb, cc, dd, ee, X[ 4], 7), LROT(cc, 10); ee, bb = HH(ee, aa, bb, cc, dd, X[ 9], 14), LROT(bb, 10); dd, aa = HH(dd, ee, aa, bb, cc, X[15], 9), LROT(aa, 10); cc, ee = HH(cc, dd, ee, aa, bb, X[ 8], 13), LROT(ee, 10); bb, dd = HH(bb, cc, dd, ee, aa, X[ 1], 15), LROT(dd, 10); aa, cc = HH(aa, bb, cc, dd, ee, X[ 2], 14), LROT(cc, 10); ee, bb = HH(ee, aa, bb, cc, dd, X[ 7], 8), LROT(bb, 10); dd, aa = HH(dd, ee, aa, bb, cc, X[ 0], 13), LROT(aa, 10); cc, ee = HH(cc, dd, ee, aa, bb, X[ 6], 6), LROT(ee, 10); bb, dd = HH(bb, cc, dd, ee, aa, X[13], 5), LROT(dd, 10); aa, cc = HH(aa, bb, cc, dd, ee, X[11], 12), LROT(cc, 10); ee, bb = HH(ee, aa, bb, cc, dd, X[ 5], 7), LROT(bb, 10); dd, aa = HH(dd, ee, aa, bb, cc, X[12], 5), LROT(aa, 10); cc, ee = II(cc, dd, ee, aa, bb, X[ 1], 11), LROT(ee, 10); bb, dd = II(bb, cc, dd, ee, aa, X[ 9], 12), LROT(dd, 10); aa, cc = II(aa, bb, cc, dd, ee, X[11], 14), LROT(cc, 10); ee, bb = II(ee, aa, bb, cc, dd, X[10], 15), LROT(bb, 10); dd, aa = II(dd, ee, aa, bb, cc, X[ 0], 14), LROT(aa, 10); cc, ee = II(cc, dd, ee, aa, bb, X[ 8], 15), LROT(ee, 10); bb, dd = II(bb, cc, dd, ee, aa, X[12], 9), LROT(dd, 10); aa, cc = II(aa, bb, cc, dd, ee, X[ 4], 8), LROT(cc, 10); ee, bb = II(ee, aa, bb, cc, dd, X[13], 9), LROT(bb, 10); dd, aa = II(dd, ee, aa, bb, cc, X[ 3], 14), LROT(aa, 10); cc, ee = II(cc, dd, ee, aa, bb, X[ 7], 5), LROT(ee, 10); bb, dd = II(bb, cc, dd, ee, aa, X[15], 6), LROT(dd, 10); aa, cc = II(aa, bb, cc, dd, ee, X[14], 8), LROT(cc, 10); ee, bb = II(ee, aa, bb, cc, dd, X[ 5], 6), LROT(bb, 10); dd, aa = II(dd, ee, aa, bb, cc, X[ 6], 5), LROT(aa, 10); cc, ee = II(cc, dd, ee, aa, bb, X[ 2], 12), LROT(ee, 10); bb, dd = JJ(bb, cc, dd, ee, aa, X[ 4], 9), LROT(dd, 10); aa, cc = JJ(aa, bb, cc, dd, ee, X[ 0], 15), LROT(cc, 10); ee, bb = JJ(ee, aa, bb, cc, dd, X[ 5], 5), LROT(bb, 10); dd, aa = JJ(dd, ee, aa, bb, cc, X[ 9], 11), LROT(aa, 10); cc, ee = JJ(cc, dd, ee, aa, bb, X[ 7], 6), LROT(ee, 10); bb, dd = JJ(bb, cc, dd, ee, aa, X[12], 8), LROT(dd, 10); aa, cc = JJ(aa, bb, cc, dd, ee, X[ 2], 13), LROT(cc, 10); ee, bb = JJ(ee, aa, bb, cc, dd, X[10], 12), LROT(bb, 10); dd, aa = JJ(dd, ee, aa, bb, cc, X[14], 5), LROT(aa, 10); cc, ee = JJ(cc, dd, ee, aa, bb, X[ 1], 12), LROT(ee, 10); bb, dd = JJ(bb, cc, dd, ee, aa, X[ 3], 13), LROT(dd, 10); aa, cc = JJ(aa, bb, cc, dd, ee, X[ 8], 14), LROT(cc, 10); ee, bb = JJ(ee, aa, bb, cc, dd, X[11], 11), LROT(bb, 10); dd, aa = JJ(dd, ee, aa, bb, cc, X[ 6], 8), LROT(aa, 10); cc, ee = JJ(cc, dd, ee, aa, bb, X[15], 5), LROT(ee, 10); bb, dd = JJ(bb, cc, dd, ee, aa, X[13], 6), LROT(dd, 10); aaa, ccc = JJJ(aaa, bbb, ccc, ddd, eee, X[ 5], 8), LROT(ccc, 10); eee, bbb = JJJ(eee, aaa, bbb, ccc, ddd, X[14], 9), LROT(bbb, 10); ddd, aaa = JJJ(ddd, eee, aaa, bbb, ccc, X[ 7], 9), LROT(aaa, 10); ccc, eee = JJJ(ccc, ddd, eee, aaa, bbb, X[ 0], 11), LROT(eee, 10); bbb, ddd = JJJ(bbb, ccc, ddd, eee, aaa, X[ 9], 13), LROT(ddd, 10); aaa, ccc = JJJ(aaa, bbb, ccc, ddd, eee, X[ 2], 15), LROT(ccc, 10); eee, bbb = JJJ(eee, aaa, bbb, ccc, ddd, X[11], 15), LROT(bbb, 10); ddd, aaa = JJJ(ddd, eee, aaa, bbb, ccc, X[ 4], 5), LROT(aaa, 10); ccc, eee = JJJ(ccc, ddd, eee, aaa, bbb, X[13], 7), LROT(eee, 10); bbb, ddd = JJJ(bbb, ccc, ddd, eee, aaa, X[ 6], 7), LROT(ddd, 10); aaa, ccc = JJJ(aaa, bbb, ccc, ddd, eee, X[15], 8), LROT(ccc, 10); eee, bbb = JJJ(eee, aaa, bbb, ccc, ddd, X[ 8], 11), LROT(bbb, 10); ddd, aaa = JJJ(ddd, eee, aaa, bbb, ccc, X[ 1], 14), LROT(aaa, 10); ccc, eee = JJJ(ccc, ddd, eee, aaa, bbb, X[10], 14), LROT(eee, 10); bbb, ddd = JJJ(bbb, ccc, ddd, eee, aaa, X[ 3], 12), LROT(ddd, 10); aaa, ccc = JJJ(aaa, bbb, ccc, ddd, eee, X[12], 6), LROT(ccc, 10); eee, bbb = III(eee, aaa, bbb, ccc, ddd, X[ 6], 9), LROT(bbb, 10); ddd, aaa = III(ddd, eee, aaa, bbb, ccc, X[11], 13), LROT(aaa, 10); ccc, eee = III(ccc, ddd, eee, aaa, bbb, X[ 3], 15), LROT(eee, 10); bbb, ddd = III(bbb, ccc, ddd, eee, aaa, X[ 7], 7), LROT(ddd, 10); aaa, ccc = III(aaa, bbb, ccc, ddd, eee, X[ 0], 12), LROT(ccc, 10); eee, bbb = III(eee, aaa, bbb, ccc, ddd, X[13], 8), LROT(bbb, 10); ddd, aaa = III(ddd, eee, aaa, bbb, ccc, X[ 5], 9), LROT(aaa, 10); ccc, eee = III(ccc, ddd, eee, aaa, bbb, X[10], 11), LROT(eee, 10); bbb, ddd = III(bbb, ccc, ddd, eee, aaa, X[14], 7), LROT(ddd, 10); aaa, ccc = III(aaa, bbb, ccc, ddd, eee, X[15], 7), LROT(ccc, 10); eee, bbb = III(eee, aaa, bbb, ccc, ddd, X[ 8], 12), LROT(bbb, 10); ddd, aaa = III(ddd, eee, aaa, bbb, ccc, X[12], 7), LROT(aaa, 10); ccc, eee = III(ccc, ddd, eee, aaa, bbb, X[ 4], 6), LROT(eee, 10); bbb, ddd = III(bbb, ccc, ddd, eee, aaa, X[ 9], 15), LROT(ddd, 10); aaa, ccc = III(aaa, bbb, ccc, ddd, eee, X[ 1], 13), LROT(ccc, 10); eee, bbb = III(eee, aaa, bbb, ccc, ddd, X[ 2], 11), LROT(bbb, 10); ddd, aaa = HHH(ddd, eee, aaa, bbb, ccc, X[15], 9), LROT(aaa, 10); ccc, eee = HHH(ccc, ddd, eee, aaa, bbb, X[ 5], 7), LROT(eee, 10); bbb, ddd = HHH(bbb, ccc, ddd, eee, aaa, X[ 1], 15), LROT(ddd, 10); aaa, ccc = HHH(aaa, bbb, ccc, ddd, eee, X[ 3], 11), LROT(ccc, 10); eee, bbb = HHH(eee, aaa, bbb, ccc, ddd, X[ 7], 8), LROT(bbb, 10); ddd, aaa = HHH(ddd, eee, aaa, bbb, ccc, X[14], 6), LROT(aaa, 10); ccc, eee = HHH(ccc, ddd, eee, aaa, bbb, X[ 6], 6), LROT(eee, 10); bbb, ddd = HHH(bbb, ccc, ddd, eee, aaa, X[ 9], 14), LROT(ddd, 10); aaa, ccc = HHH(aaa, bbb, ccc, ddd, eee, X[11], 12), LROT(ccc, 10); eee, bbb = HHH(eee, aaa, bbb, ccc, ddd, X[ 8], 13), LROT(bbb, 10); ddd, aaa = HHH(ddd, eee, aaa, bbb, ccc, X[12], 5), LROT(aaa, 10); ccc, eee = HHH(ccc, ddd, eee, aaa, bbb, X[ 2], 14), LROT(eee, 10); bbb, ddd = HHH(bbb, ccc, ddd, eee, aaa, X[10], 13), LROT(ddd, 10); aaa, ccc = HHH(aaa, bbb, ccc, ddd, eee, X[ 0], 13), LROT(ccc, 10); eee, bbb = HHH(eee, aaa, bbb, ccc, ddd, X[ 4], 7), LROT(bbb, 10); ddd, aaa = HHH(ddd, eee, aaa, bbb, ccc, X[13], 5), LROT(aaa, 10); ccc, eee = GGG(ccc, ddd, eee, aaa, bbb, X[ 8], 15), LROT(eee, 10); bbb, ddd = GGG(bbb, ccc, ddd, eee, aaa, X[ 6], 5), LROT(ddd, 10); aaa, ccc = GGG(aaa, bbb, ccc, ddd, eee, X[ 4], 8), LROT(ccc, 10); eee, bbb = GGG(eee, aaa, bbb, ccc, ddd, X[ 1], 11), LROT(bbb, 10); ddd, aaa = GGG(ddd, eee, aaa, bbb, ccc, X[ 3], 14), LROT(aaa, 10); ccc, eee = GGG(ccc, ddd, eee, aaa, bbb, X[11], 14), LROT(eee, 10); bbb, ddd = GGG(bbb, ccc, ddd, eee, aaa, X[15], 6), LROT(ddd, 10); aaa, ccc = GGG(aaa, bbb, ccc, ddd, eee, X[ 0], 14), LROT(ccc, 10); eee, bbb = GGG(eee, aaa, bbb, ccc, ddd, X[ 5], 6), LROT(bbb, 10); ddd, aaa = GGG(ddd, eee, aaa, bbb, ccc, X[12], 9), LROT(aaa, 10); ccc, eee = GGG(ccc, ddd, eee, aaa, bbb, X[ 2], 12), LROT(eee, 10); bbb, ddd = GGG(bbb, ccc, ddd, eee, aaa, X[13], 9), LROT(ddd, 10); aaa, ccc = GGG(aaa, bbb, ccc, ddd, eee, X[ 9], 12), LROT(ccc, 10); eee, bbb = GGG(eee, aaa, bbb, ccc, ddd, X[ 7], 5), LROT(bbb, 10); ddd, aaa = GGG(ddd, eee, aaa, bbb, ccc, X[10], 15), LROT(aaa, 10); ccc, eee = GGG(ccc, ddd, eee, aaa, bbb, X[14], 8), LROT(eee, 10); bbb, ddd = FFF(bbb, ccc, ddd, eee, aaa, X[12] , 8), LROT(ddd, 10); aaa, ccc = FFF(aaa, bbb, ccc, ddd, eee, X[15] , 5), LROT(ccc, 10); eee, bbb = FFF(eee, aaa, bbb, ccc, ddd, X[10] , 12), LROT(bbb, 10); ddd, aaa = FFF(ddd, eee, aaa, bbb, ccc, X[ 4] , 9), LROT(aaa, 10); ccc, eee = FFF(ccc, ddd, eee, aaa, bbb, X[ 1] , 12), LROT(eee, 10); bbb, ddd = FFF(bbb, ccc, ddd, eee, aaa, X[ 5] , 5), LROT(ddd, 10); aaa, ccc = FFF(aaa, bbb, ccc, ddd, eee, X[ 8] , 14), LROT(ccc, 10); eee, bbb = FFF(eee, aaa, bbb, ccc, ddd, X[ 7] , 6), LROT(bbb, 10); ddd, aaa = FFF(ddd, eee, aaa, bbb, ccc, X[ 6] , 8), LROT(aaa, 10); ccc, eee = FFF(ccc, ddd, eee, aaa, bbb, X[ 2] , 13), LROT(eee, 10); bbb, ddd = FFF(bbb, ccc, ddd, eee, aaa, X[13] , 6), LROT(ddd, 10); aaa, ccc = FFF(aaa, bbb, ccc, ddd, eee, X[14] , 5), LROT(ccc, 10); eee, bbb = FFF(eee, aaa, bbb, ccc, ddd, X[ 0] , 15), LROT(bbb, 10); ddd, aaa = FFF(ddd, eee, aaa, bbb, ccc, X[ 3] , 13), LROT(aaa, 10); ccc, eee = FFF(ccc, ddd, eee, aaa, bbb, X[ 9] , 11), LROT(eee, 10); bbb, ddd = FFF(bbb, ccc, ddd, eee, aaa, X[11] , 11), LROT(ddd, 10); A, B, C, D, E = AND(B + cc + ddd, 0xFFFFFFFF), AND(C + dd + eee, 0xFFFFFFFF), AND(D + ee + aaa, 0xFFFFFFFF), AND(E + aa + bbb, 0xFFFFFFFF), AND(A + bb + ccc, 0xFFFFFFFF); end public.init = function() queue.reset(); A = 0x67452301; B = 0xefcdab89; C = 0x98badcfe; D = 0x10325476; E = 0xc3d2e1f0; return public; end public.update = function(bytes) for b in bytes do queue.push(b); if(queue.size() >= 64) then processBlock(); end end return public; end public.finish = function() local bits = queue.getHead() * 8; queue.push(0x80); while ((queue.size() + 7) % 64) < 63 do queue.push(0x00); end local b0, b1, b2, b3, b4, b5, b6, b7 = dword2bytes(bits); queue.push(b0); queue.push(b1); queue.push(b2); queue.push(b3); queue.push(b4); queue.push(b5); queue.push(b6); queue.push(b7); while queue.size() > 0 do processBlock(); end return public; end public.asBytes = function() local b0, b1, b2, b3 = word2bytes(A); local b4, b5, b6, b7 = word2bytes(B); local b8, b9, b10, b11 = word2bytes(C); local b12, b13, b14, b15 = word2bytes(D); local b16, b17, b18, b19 = word2bytes(E); return { b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19}; end public.asHex = function() local b0, b1, b2, b3 = word2bytes(A); local b4, b5, b6, b7 = word2bytes(B); local b8, b9, b10, b11 = word2bytes(C); local b12, b13, b14, b15 = word2bytes(D); local b16, b17, b18, b19 = word2bytes(E); local fmt = "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"; return String.format(fmt, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19); end return public; end return RIPEMD160;
local Package = game:GetService("ReplicatedStorage").Fusion local New = require(Package.Instances.New) local defaultProps = require(Package.Instances.defaultProps) return function() it("should create a new instance", function() local ins = New "Frame" {} expect(typeof(ins) == "Instance").to.be.ok() expect(ins:IsA("Frame")).to.be.ok() end) it("should throw for non-existent class types", function() expect(function() New "This is not a valid class type" {} end).to.throw("cannotCreateClass") end) it("should apply 'sensible default' properties", function() for className, defaults in pairs(defaultProps) do local ins = New (className) {} for propName, propValue in pairs(defaults) do expect(ins[propName]).to.equal(propValue) end end end) it("should not inhibit garbage collection", function() local ref = setmetatable({}, {__mode = "v"}) do ref[1] = New "Folder" {} end local startTime = os.clock() repeat task.wait() until ref[1] == nil or os.clock() > startTime + 5 expect(ref[1]).to.equal(nil) end) end
local logger = require(".lua.common.logger").new("cfgmgr.lua") local cjson = require "cjson" local _cmgr ={} -- The _cmgr_table is the table that holds the parsed json file -- This is parsed by parts into different tables that can be used throughout -- the lifetime of the Worker. The Parse of Json file and creating the -- individual tables from it is a INIT one time activity. local _cmgr_table = {} --The Sentinel Table Holds the mapping of all the Sentinels and the --Ports for the Redis Cluster. local _sentinel_table={} --The Replication Status Read from the Conf File local replicationStatus = nil --The API Returns a Valid Handle to a Sentinel Table if it Exists, --otherwise it return nil function _cmgr.getreplicationStatus() return tonumber(replicationStatus) end --The API Returns a Valid Handle to a Sentinel Table if it Exists, --otherwise it return nil function _cmgr.getSentinelTable(clusterName) if clusterName == nil then logger:error("Nil Cluster Name Specified, No Valid Sentinel Table") return nil end return _sentinel_table[clusterName] end function _cmgr.loadSentinelTable(sentinelTable) logger:debug("Type is "..tostring(type(sentinelTable))) logger:debug("Table Size is --> "..table.getn(sentinelTable)) --The key value pair received here is as follows:- --"redis-cluster-name" : "table of sentinels" for k,v in pairs (sentinelTable) do logger:info("Sentinel Key Name is --> "..tostring(k)) logger:info("Sentinel Value Name is --> "..tostring(v)) logger:info("Sentinel Key Size is --> "..table.getn(v)) --Add to to The Table under teh config manager _sentinel_table[k] = v end end function _cmgr.loadClusterTable(clusterTable) --Parse the Decode Cluster Table and Update the same under the Config Manager logger:info("Size of Redis Cluster Table is -> "..tostring(tableSize)) for k,v in pairs (clusterTable) do logger:debug("Key Name is --> "..tostring(k)) logger:debug("Type of The Key is --> "..type(k)) logger:debug("String Value Is --> "..tostring(v)) logger:debug("Type of the String is--> "..type(v)) _cmgr.loadSentinelTable(v) end logger:debug("Sentinel Table Size is "..tostring(table.getn(_sentinel_table))) --Debug/Test Code for testing the Table Handles --[[ test = _cmgr.getSentinelTable("redis-cluster-stage") logger:notice("Trying to Dump the Table redis-cluster-stage"..tostring(test)) for idx = 1, table.getn(test) do logger:notice("redis-cluster-stage --> ..Host -->"..tostring(test[idx].host).."Port ..-->"..tostring(test[idx].port)) end test = _cmgr.getSentinelTable("redis-cluster-stage-1") logger:notice("Trying to Dump the Table redis-cluster-stage-1"..tostring(test)) for idx = 1, table.getn(test) do logger:notice("redis-cluster-stage-1 --> ..Host -->"..tostring(test[idx].host).."Port ..-->"..tostring(test[idx].port)) end test = _cmgr.getSentinelTable("redis-cluster-stage-2") logger:notice("Trying to Dump the Table redis-cluster-stage-2"..tostring(test)) if test == nil then logger:notice("No Entry Exists") end ]]-- end --TBD Remove the Hard Coding From Here function _cmgr.load() logger:debug("Inside Config Manager Load") local file = io.open("/etc/nginx/api-gateway-layer/lua/cluster.json", "r") local contents if file then contents = file:read("*a") io.close(file) end _cmgr_table = cjson.decode(contents) for k,v in pairs(_cmgr_table) do logger:debug("Parse Decoded Json ->"..type(k).." "..type(v)) if k == 'REDIS_CLUSTER' then logger:debug("Parse REDIS CLUSTER -->"..type(k).." "..type(v)..tostring(k)) _cmgr.loadClusterTable(v) end if k == 'REPLICATION' then logger:debug("Replication KEY VALUE PAIIR are-->"..tostring(k)..".."..tostring(v)) replicationStatus = v end end end --Currently Called Periodically at 10 seconds interval from the timer context to read the json config --file. Any sentinel chnage can be updated and read. The sentinels would not change very often and this --update should most of the time result in the same config file function _cmgr.readConfig() logger:debug("Disbale Calling Config Read Inside Timer Context") _cmgr.load() end function _cmgr.get_target_ip(cluster_tag, access_key) -- Search the Access Key Table first if this Requires a Customer Routing -- If not Fall back to the DEFAULT ROUTING Table -- Currently this is implemented as a for loop and given that this Customer User -- table intially will be empty it is acceptable at this point of time. -- We need to come up with a HASHMAP implementation of the same or a fast cache lookup -- if this table increase to a considerable size for idx=1,table.getn(_custom_user_table) do if _custom_user_table[idx].KEY == access_key then return _custom_user_table[idx][cluster_tag] end end --A Serach Was UnSuccesfull, return Default Value return _cmgr_table[cluster_tag] end -- Given a Cluster Name, Retrun the Read and Write EndPoints -- Currently this is implemented as a for loop -- Given that the initial Cluster Would Span Not More than 2 / 3. -- As this grows, this need to be replaced with a better efficient way, using -- a hashmap function _cmgr.get_cluster_detail(cluster_name) logger:debug("In Get Cluster Deatils for cluster name --> ".. cluster_name) for idx=1,table.getn(_cluster_table) do --logger:info("In Loop--->".._cluster_table[idx].name) if _cluster_table[idx].name == cluster_name then logger:debug("Match FOund") logger:debug("Found R Endpoints-->".._cluster_table[idx].READ_ENDPOINT) logger:debug("Found W Endpoints-->".._cluster_table[idx].WRITE_ENDPOINT) return _cluster_table[idx].READ_ENDPOINT,_cluster_table[idx].WRITE_ENDPOINT end end --A Search Was Unsuccesfull, return nil. logger:error("Cluster Details Not Updated for Cluster Name --> "..cluster_name) return nil,nil end return _cmgr
function onCreate() end function onBeatHit (...) -- for every beat end function onStupHit (...) -- for every Step end function Update (...) end
context("Sqlite3 API", function() local sqlite3 = require "rspamd_sqlite3" test("Sqlite3 open", function() os.remove('/tmp/rspamd_unit_test_sqlite3.sqlite') local db = sqlite3.open('/tmp/rspamd_unit_test_sqlite3.sqlite') assert_not_nil(db, "should be able to create sqlite3 db") db = sqlite3.open('/non/existent/path/rspamd_unit_test_sqlite3.sqlite') assert_nil(db, "should not be able to create sqlite3 db") os.remove('/tmp/rspamd_unit_test_sqlite3.sqlite') end) test("Sqlite3 query", function() os.remove('/tmp/rspamd_unit_test_sqlite3-1.sqlite') local db = sqlite3.open('/tmp/rspamd_unit_test_sqlite3-1.sqlite') assert_not_nil(db, "should be able to create sqlite3 db") local ret = db:sql([[ CREATE TABLE x (id INT, value TEXT); ]]) assert_true(ret, "should be able to create table") local ret = db:sql([[ INSERT INTO x VALUES (?1, ?2); ]], 1, 'test') assert_true(ret, "should be able to insert row") os.remove('/tmp/rspamd_unit_test_sqlite3-1.sqlite') end) test("Sqlite3 rows", function() os.remove('/tmp/rspamd_unit_test_sqlite3-2.sqlite') local db = sqlite3.open('/tmp/rspamd_unit_test_sqlite3-2.sqlite') assert_not_nil(db, "should be able to create sqlite3 db") local ret = db:sql([[ CREATE TABLE x (id INT, value TEXT); ]]) assert_true(ret, "should be able to create table") local ret = db:sql([[ INSERT INTO x VALUES (?1, ?2); ]], 1, 'test') assert_true(ret, "should be able to insert row") for row in db:rows([[SELECT * FROM x;]]) do assert_equal(row.id, '1') assert_equal(row.value, 'test') end os.remove('/tmp/rspamd_unit_test_sqlite3-2.sqlite') end) end)
sand_king_burrowstrike_lua = class({}) LinkLuaModifier( "modifier_sand_king_burrowstrike_lua", "lua_abilities/sand_king_burrowstrike_lua/modifier_sand_king_burrowstrike_lua", LUA_MODIFIER_MOTION_NONE ) LinkLuaModifier( "modifier_generic_stunned_lua", "lua_abilities/generic/modifier_generic_stunned_lua", LUA_MODIFIER_MOTION_NONE ) LinkLuaModifier( "modifier_generic_knockback_lua", "lua_abilities/generic/modifier_generic_knockback_lua", LUA_MODIFIER_MOTION_BOTH ) -------------------------------------------------------------------------------- -- Custom KV -- function sand_king_burrowstrike_lua:GetCooldown( level ) -- if self:GetCaster():HasScepter() then -- return self:GetSpecialValueFor( "cooldown_scepter" ) -- end -- return self.BaseClass.GetCooldown( self, level ) -- end -------------------------------------------------------------------------------- -- Ability Start function sand_king_burrowstrike_lua:OnSpellStart() -- unit identifier local caster = self:GetCaster() local target = self:GetCursorTarget() local point = self:GetCursorPosition() if target then point = target:GetOrigin() end local origin = caster:GetOrigin() -- load data local anim_time = self:GetSpecialValueFor("burrow_anim_time") -- projectile data local projectile_name = "particles/units/heroes/hero_sandking/sandking_burrowstrike.vpcf" local projectile_start_radius = self:GetSpecialValueFor("burrow_width") local projectile_end_radius = projectile_start_radius local projectile_direction = (point-origin) projectile_direction.z = 0 projectile_direction:Normalized() local projectile_speed = self:GetSpecialValueFor("burrow_speed") local projectile_distance = (point-origin):Length2D() -- create projectile local info = { Source = caster, Ability = self, vSpawnOrigin = caster:GetAbsOrigin(), bDeleteOnHit = false, iUnitTargetTeam = DOTA_UNIT_TARGET_TEAM_ENEMY, iUnitTargetFlags = DOTA_UNIT_TARGET_FLAG_NONE, iUnitTargetType = DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC, EffectName = projectile_name, fDistance = projectile_distance, fStartRadius = projectile_start_radius, fEndRadius =projectile_end_radius, vVelocity = projectile_direction * projectile_speed, } ProjectileManager:CreateLinearProjectile(info) -- add modifier to caster caster:AddNewModifier( caster, -- player source self, -- ability source "modifier_sand_king_burrowstrike_lua", -- modifier name { duration = anim_time, pos_x = point.x, pos_y = point.y, pos_z = point.z, } -- kv ) self:PlayEffects( origin, point ) end -------------------------------------------------------------------------------- -- Projectile function sand_king_burrowstrike_lua:OnProjectileHit( target, location ) if not target then return end -- cancel if linken if target:TriggerSpellAbsorb( self ) then return end -- apply stun local duration = self:GetSpecialValueFor( "burrow_duration" ) target:AddNewModifier( self:GetCaster(), -- player source self, -- ability source "modifier_generic_stunned_lua", -- modifier name { duration = duration } -- kv ) -- apply knockback target:AddNewModifier( self:GetCaster(), -- player source self, -- ability source "modifier_generic_knockback_lua", -- modifier name { duration = 0.52, z = 350, IsStun = true, } -- kv ) -- apply damage local damageTable = { victim = target, attacker = self:GetCaster(), damage = self:GetAbilityDamage(), damage_type = DAMAGE_TYPE_MAGICAL, ability = self, --Optional. } ApplyDamage(damageTable) end -------------------------------------------------------------------------------- function sand_king_burrowstrike_lua:PlayEffects( origin, target ) -- Get Resources local particle_cast = "particles/units/heroes/hero_sandking/sandking_burrowstrike.vpcf" local sound_cast = "Ability.SandKing_BurrowStrike" -- Create Particle local effect_cast = ParticleManager:CreateParticle( particle_cast, PATTACH_WORLDORIGIN, self:GetCaster() ) ParticleManager:SetParticleControl( effect_cast, 0, origin ) ParticleManager:SetParticleControl( effect_cast, 1, target ) ParticleManager:ReleaseParticleIndex( effect_cast ) -- Create Sound EmitSoundOn( sound_cast, self:GetCaster() ) end
return {'iaen'}
require "scripts.core.ability" require "scripts.core.projectile" require "gamemode.Spark.modifiers.modifier_Stun"; local DebugRenderer = Require("debugRenderer") Quasar = class(Ability) local Z_OFFSET = 3 function Quasar:OnCreated () self:RegisterVariable("max_range", 20) self:RegisterVariable("cast_time", 0.1) self:RegisterVariable("cast_point", 0.5) self:RegisterVariable("range", self:GetSpecialValue("range")) self:RegisterVariable("speed", 0.0) self:RegisterVariable("damage", self:GetSpecialValue("damage")) self:SetCastingBehavior(CastingBehavior(CastingBehavior.POINT_TARGET)); end function Quasar:OnSpellStart () local target = self:GetCursorPosition() local caster = self:GetCaster() local origin = self:GetCursorPosition() Debug.Log('Origin is ' .. tostring(origin) .. ' : ' .. tostring(self:GetCaster():GetId()) .. caster:GetName()) Debug.Log('Destination is ' .. tostring(target)) CreateTimer(function() local duration = 15 local thinker = ModifiersHandler:CreateModifierThinker(caster,self,"modifier_empty",{duration=duration,radius=10},origin) AttachParticleSystem(thinker, "heroes.astromage.w_quasar") DebugRenderer.DrawAura(thinker,Color(1,0,0,0.4),duration) end,0.5); --local ps = GameManagerRequestBus.Broadcast.CreateParticleSystem("heroes.astromage.w_quasar") --local pos = TransformBus.Event.GetLocalTranslation(GetId(thinker)) --Debug.Log("\n\n\nthinker pos is "..tostring(pos)) --TransformBus.Event.SetWorldTranslation(ps,origin)--) --local ps = GameManagerRequestBus.Broadcast.CreateParticleSystem("heroes.astromage.w_quasar") --local position = TransformBus.Event.GetWorldTranslation(GetId(caster)) --TransformBus.Event.SetWorldTranslation(ps,origin) --[[local direction = (target - origin) --direction.z = 0 origin.z = origin.z + Z_OFFSET --direction = direction:GetNormalized() --Debug.Log('Direction is ' .. tostring(direction)) --local destination = target --destination.z = destination.z + Z_OFFSET --Debug.Log('Final travel point is ' .. tostring(target)) self.projectile = Projectile({ startingPosition = origin, targetPosition = origin, speed = self:GetValue("speed"), particle = "heroes.astromage.w_quasar", triggerRadius = 10 }); self.projectile:OnEntityEnter(function (entityId) if entityId == self:GetCaster():GetId() then return end self.targetUnit = Unit({ entityId = entityId}) local damage = Damage(); damage.type = Damage.DAMAGE_TYPE_MAGICAL; damage.damage = self:GetValue("damage"); self.targetUnit:ApplyDamage(damage) if self.targetUnit:FindModifierByTypeId("modifier_Stun") then self.targetUnit:Kill() self.targetUnit = nil elseif not self.targetUnit:IsAlive() then self.targetUnit = nil else self.stunModifier = self.targetUnit:AddNewModifier(caster, self, "modifier_Stun", {duration = self:GetSpecialValue("stun_duration")}) end end) self.projectile:OnProjectileHit(function () -- hit the end position without hitting any heroes self.projectile:Release() self.projectile = nil end) self.projectile:Fire()]] end return Quasar
-- https://github.com/rlane/pounce.nvim local M = {} function M.get(spec, config, opts) -- stylua: ignore return { PounceAccept = { fg = spec.bg1, bg = spec.palette.orange:harsh() }, PounceAcceptBest = { fg = spec.bg1, bg = spec.palette.cyan:harsh(), }, PounceMatch = { fg = spec.fg1, bg = spec.sel1 }, PounceGap = { fg = spec.fg1, bg = spec.sel0 }, } end return M
local battle={} -- not used yet local xLoc = 10 local yLoc = 10 function battle.display(state) if state == false then white = Color.new(255, 255, 255) screen:fillRect(xLoc, yLoc, 460, 250, white) elseif state == true then -- dismiss the battle display end end return battle
--[[-------------------------------------------------------------------------- -- -- File: UIPodiumSlot.lua -- Copyright (c) Ubisoft Entertainment. All rights reserved. -- -- Project: Ubitoys.Tag -- Date: August 13, 2010 -- ------------------------------------------------------------------------------ -- -- Description: ... -- ----------------------------------------------------------------------------]] --[[ Dependencies ----------------------------------------------------------]] require "Ui/UIComponent" --[[ Class -----------------------------------------------------------------]] UTClass.UIPodiumSlot(UIComponent) require "Ui/UILeaderboard" -- default UIPodiumSlot.medalIcons = { [1] = "base:texture/ui/ranking_medal_gold.tga", [2] = "base:texture/ui/ranking_medal_silver.tga", [3] = "base:texture/ui/ranking_medal_bronze.tga", } UIPodiumSlot.rankingPictures = { [1] = "base:texture/ui/Rankings_Arrow1.tga", [2] = "base:texture/ui/Rankings_Arrow2.tga", [3] = "base:texture/ui/Rankings_Arrow3.tga", } UIPodiumSlot.rankingPicturesSmall = { [1] = "base:texture/ui/Rankings_SmallArrow1.tga", [2] = "base:texture/ui/Rankings_SmallArrow2.tga", [3] = "base:texture/ui/Rankings_SmallArrow3.tga", } -- __ctor -------------------------------------------------------------------- function UIPodiumSlot:__ctor() self.rankVector = {0, 0} end -- __dtor -------------------------------------------------------------------- function UIPodiumSlot:__dtor() end -- Build --------------------------------------------------------------------- function UIPodiumSlot:Build(challenger, nbChallenger, rank, realRank, teamPosition, teamScore) local timeStart = -0.8 + rank * 0.9 self.positionY = 400 self.nbChallenger = nbChallenger self.height = 140 self.HUDoffset = 0 self.nameOffset = { 105, -40} self.scoreOffset = { 340, -40} SlotHeight = 20 if (MultiColumn) then if (#activity.teams > 2) then SlotHeight = 30 end if (#activity.teams == 2) then SlotWidth = 400 end if (#activity.teams == 3) then SlotWidth = 320 end if (#activity.teams == 4) then SlotWidth = 250 end else -- defaults for more than 4 teams SlotWidth = 400 end if (#activity.teams == 0) then self.challenger = challenger if (self.nbChallenger == 1) then self.positionY = 200 elseif (self.nbChallenger == 2) then self.positionY = 280 else self.positionY = 400 end else self.team = challenger self.teamPosition = teamPosition self.teamScore = teamScore if (MultiColumn and #activity.teams > 2) then self.height = 15 + SlotHeight * math.max (#self.team.players, 3) elseif (#self.team.players > 5) then self.height = 15 + 20 * #self.team.players else self.height = 110 end if (#self.team.players > 5) then self.positionY = 570 - #self.team.players * 30 else self.positionY = 470 end self.scoreOffset = { 360, -68} self.nameOffset = { 110, -32} end self.positionX = 1000 self.rank = rank self.realRank = realRank self.visible = false self.rankVectorX = -100 self.alphaMedal = 0 self.scaleIcon = 1 self.fxs = {} self.fxs[1] = UIManager:AddFx("callback", { timeOffset = timeStart, __function = function() quartz.framework.audio.loadsound("base:audio/ui/ranking.wav") quartz.framework.audio.loadvolume(game.settings.audio["volume:sfx"]) quartz.framework.audio.playsound() self.visible = true end}) if (MultiColumn) then self.fxs[2] = UIManager:AddFx("value", { timeOffset = timeStart, duration = 0.2, __self = self, value = "rankVectorX", from = -100, to = 50 + self.rank * (SlotWidth + 20)}) self.fxs[3] = UIManager:AddFx("value", { timeOffset = timeStart, duration = 0.2, __self = self, value = "positionX", from = 1000, to = -420 + self.rank * (SlotWidth + 60)}) else self.fxs[2] = UIManager:AddFx("value", { timeOffset = timeStart, duration = 0.2, __self = self, value = "rankVectorX", from = -100, to = 50 + self.realRank * 40}) self.fxs[3] = UIManager:AddFx("value", { timeOffset = timeStart, duration = 0.2, __self = self, value = "positionX", from = 1000, to = 350 + self.realRank * 40}) end self.fxs[4] = UIManager:AddFx("value", { timeOffset = timeStart + 0.2, duration = 0.1, __self = self, value = "scaleIcon", from = 0, to = 5, type = "descelerate" }) self.fxs[5] = UIManager:AddFx("value", { timeOffset = timeStart + 0.3, duration = 0.15, __self = self, value = "scaleIcon", from = 5, to = 0, type = "accelerate" }) self.fxs[6] = UIManager:AddFx("value", { timeOffset = timeStart + 0.45, duration = 0.2, __self = self, value = "alphaMedal", from = 0, to = 1 }) if (#activity.teams == 0) then if (self.nbChallenger == 2) then self.fxs[7] = UIManager:AddFx("value", { timeOffset = timeStart + 0.7, duration = 0.3, __self = self, value = "positionY", from = self.positionY, to = self.rank * self.height , type = "accelerate"}) elseif (self.nbChallenger > 2) then self.fxs[7] = UIManager:AddFx("value", { timeOffset = timeStart + 0.7, duration = 0.3, __self = self, value = "positionY", from = self.positionY, to = - 100 + self.rank * self.height , type = "accelerate"}) end else self.fxs[7] = UIManager:AddFx("value", { timeOffset = timeStart + 0.7, duration = 0.3, __self = self, value = "positionY", from = self.positionY, to = self.teamPosition, type = "accelerate"}) end if (MultiColumn) then UIPodiumSlot.rankingPictures = UIPodiumSlot.rankingPicturesSmall end end -- Destroy --------------------------------------------------------------------- function UIPodiumSlot:Destroy() print("UIPodiumSlot:Destroy") for i, fx in ipairs(self.fxs) do UIManager:RemoveFx(fx) end end -- Draw -------------------------------------------------------------------- function UIPodiumSlot:Draw() color = UIComponent.colors.white if (self.challenger) then if (self.realRank < 4) then quartz.system.drawing.loadcolor3f(unpack(color)) quartz.system.drawing.loadtexture(self.rankingPictures[self.realRank]) quartz.system.drawing.drawtexture(self.rankVectorX, self.positionY + 10) quartz.system.drawing.loadalpha(self.alphaMedal) local rectIcon = {-278 + self.positionX + 10 * self.alphaMedal, -5 + self.positionY + 10 * self.alphaMedal, -150 + self.positionX - 10 * self.alphaMedal, self.positionY - 10 * self.alphaMedal + 123} quartz.system.drawing.loadtexture(UIPodiumSlot.medalIcons[self.realRank]) quartz.system.drawing.drawtexture(unpack(rectIcon)) quartz.system.drawing.loadalpha(1) end local rectangleLine = {self.positionX, self.positionY + 40, self.positionX + 400, self.positionY + 80} quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture("base:texture/ui/components/uigridline_background01.tga") quartz.system.drawing.drawtextureh(unpack(rectangleLine)) local rectangle = {self.positionX - 20, self.positionY + 10, self.positionX + 420, self.positionY + 110} quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture("base:texture/ui/components/uipanel05.tga") quartz.system.drawing.drawwindow(unpack(rectangle)) if (self.challenger.rfGunDevice and self.challenger.rfGunDevice.classId) then local rectangleHud = {self.positionX + 35, self.positionY + 30, self.positionX + 99, self.positionY + 94} quartz.system.drawing.loadtexture("base:texture/ui/pictograms/64x/Hud_" .. self.challenger.rfGunDevice.classId .. ".tga") quartz.system.drawing.drawtexture(unpack(rectangleHud)) end local fontJustification = quartz.system.drawing.justification.left + quartz.system.drawing.justification.singlelineverticalcenter quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.darkgray)) quartz.system.drawing.loadfont(UIComponent.fonts.title) quartz.system.drawing.drawtextjustified(self.challenger.profile.name, fontJustification, self.positionX + self.nameOffset[1], self.positionY + self.nameOffset[2], self.positionX + 400 + self.nameOffset[1], self.positionY + 200 + self.nameOffset[2]) if (self.challenger.data and self.challenger.data.baked and self.challenger.data.baked.score and not activity.dontDisplayScore) then fontJustification = quartz.system.drawing.justification.right + quartz.system.drawing.justification.singlelineverticalcenter quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.orange)) quartz.system.drawing.loadfont(UIComponent.fonts.title) quartz.system.drawing.drawtextjustified(self.challenger.data.baked.score, fontJustification, self.positionX + self.scoreOffset[1] - 200, self.positionY + self.scoreOffset[2], self.positionX + 40 + self.scoreOffset[1], self.positionY + 200 + self.scoreOffset[2]) end if (game.settings.UiSettings.teamribbon == 2 and self.challenger.profile.team > 0) then local rectIconbackground = {-125 + self.positionX - 10 * self.scaleIcon, self.positionY - 15 - 10 * self.scaleIcon, self.positionX + 25 + 10 * self.scaleIcon, self.positionY + 135 + 10 * self.scaleIcon} quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture("base:texture/ui/pictograms/48x/Team_" .. self.challenger.profile.team .. "_Circle.tga") quartz.system.drawing.drawtexture(unpack(rectIconbackground)) end local rectIcon = {-140 + self.positionX - 10 * self.scaleIcon, self.positionY - 40 - 10 * self.scaleIcon, self.positionX + 40 + 10 * self.scaleIcon, self.positionY + 160 + 10 * self.scaleIcon} quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture("base:texture/avatars/256x/" .. self.challenger.profile.icon) quartz.system.drawing.drawtexture(unpack(rectIcon)) elseif (self.team) then local numplayers = 0 for i, player in pairs(self.team.players) do if (not player.primary) then numplayers = numplayers + 1 end end local rectangle = {self.positionX - 20, self.positionY + 15, self.positionX + 420, self.positionY + 20 + 20 * numplayers} if (MultiColumn and #activity.teams > 2) then rectangle = {self.positionX - 20, self.positionY + 15, self.positionX + SlotWidth + 20, self.positionY + 20 + SlotHeight * numplayers} end quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture("base:texture/ui/components/uipanel05.tga") quartz.system.drawing.drawwindow(unpack(rectangle)) local fontJustification = quartz.system.drawing.justification.left + quartz.system.drawing.justification.singlelineverticalcenter for i, player in pairs(self.team.players) do if (not player.primary) then local rectangleLine = {self.positionX, self.positionY + 20 * i, self.positionX + 400, self.positionY + 16 + 20 * i} if (MultiColumn and #activity.teams > 2) then rectangleLine = {self.positionX, self.positionY + SlotHeight * i - SlotHeight / 2 + 5, self.positionX + SlotWidth + 10, self.positionY + SlotHeight * i + SlotHeight / 2 - 5} end quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture("base:texture/ui/components/uigridline_background01.tga") quartz.system.drawing.drawwindow(unpack(rectangleLine)) if (game.settings.UiSettings.teamribbon == 2 and player.profile.team > 0) then local rectIconbackground = {rectangleLine[1] + 28, rectangleLine[2] - 5, rectangleLine[1] + 52, rectangleLine[2] + 19} if (MultiColumn and #activity.teams > 2) then rectIconbackground = {rectangleLine[1] + 20, rectangleLine[2] - 5, rectangleLine[1] + 20 + SlotHeight, rectangleLine[4] + 5} end quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture("base:texture/ui/pictograms/48x/Team_" .. player.profile.team .. "_Circle.tga") quartz.system.drawing.drawtexture(unpack(rectIconbackground)) end local rectIcon = {rectangleLine[1] + 25, rectangleLine[2] - 8, rectangleLine[1] + 55, rectangleLine[2] + 22} if (MultiColumn and #activity.teams > 2) then rectIcon = {rectangleLine[1] + 15, rectangleLine[2] - 8, rectangleLine[1] + 15 + SlotHeight + 10, rectangleLine[4] + 8} end quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture("base:texture/avatars/42x/" .. player.profile.icon) quartz.system.drawing.drawtexture(unpack(rectIcon)) if (player.rfGunDevice and player.rfGunDevice.classId) then if (not MultiColumn or #activity.teams <= 3) then local rectangleHud = {rectangleLine[1] + 74, rectangleLine[2] - 6, rectangleLine[1] + 100, rectangleLine[2] + 20} quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture("base:texture/ui/pictograms/64x/hud_" .. player.rfGunDevice.classId .. ".tga") quartz.system.drawing.drawtexture(unpack(rectangleHud)) self.HUDoffset = SlotHeight * 2 end end quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.darkgray)) if (SlotWidth < 250) then quartz.system.drawing.loadfont(UIComponent.fonts.default) else quartz.system.drawing.loadfont(UIComponent.fonts.header) end if (MultiColumn and #activity.teams > 2) then fontJustification = quartz.system.drawing.justification.left + quartz.system.drawing.justification.singlelineverticalcenter quartz.system.drawing.drawtextjustified(player.profile.name, fontJustification, rectangleLine[1] + SlotHeight + 27 + self.HUDoffset, rectangleLine[2], rectangleLine[3], rectangleLine[4]) else quartz.system.drawing.drawtextjustified(player.profile.name, fontJustification, self.positionX + self.nameOffset[1], self.positionY + self.nameOffset[2] - 75 + 20 * i, self.positionX + 400 + self.nameOffset[1], self.positionY + 155 + self.nameOffset[2] + 20 * i) end if (player.data and player.data.baked and player.data.baked.score and not activity.dontDisplayScore) then quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.orange)) quartz.system.drawing.loadfont(UIComponent.fonts.header) if (MultiColumn and #activity.teams > 2) then quartz.system.drawing.drawtextjustified(player.data.baked.score, fontJustification, rectangleLine[3] - 40, rectangleLine[2], self.positionX + 610 + self.nameOffset[1], rectangleLine[4]) else quartz.system.drawing.drawtextjustified(player.data.baked.score, fontJustification, rectangleLine[1] + self.nameOffset[1] + 220, rectangleLine[2] + self.nameOffset[2] - 60, self.positionX + 620 + self.nameOffset[1], rectangleLine[2] + 140 + self.nameOffset[2]) end end end end local leftIconPosition = 0 --if (#self.team.players >= 3) then --leftIconPosition = 15 * #self.team.players --else leftIconPosition = 30 --end if (self.realRank < 4 and (game.settings.UiSettings.finalranking == 0 or MultiColumn)) then quartz.system.drawing.loadcolor3f(unpack(color)) quartz.system.drawing.loadtexture(self.rankingPictures[self.realRank]) quartz.system.drawing.drawtexture(self.positionX - 25, self.positionY - 25, self.positionX + 45, self.positionY + 5) quartz.system.drawing.loadalpha(self.alphaMedal) local rectIcon if (not MultiColumn) then rectIcon = {-278 + self.positionX + 10 * self.alphaMedal, -40 + self.positionY + 10 * self.alphaMedal + leftIconPosition, -150 + self.positionX - 10 * self.alphaMedal, self.positionY + leftIconPosition - 10 * self.alphaMedal + 88} quartz.system.drawing.loadtexture(UIPodiumSlot.medalIcons[self.realRank]) quartz.system.drawing.drawtexture(unpack(rectIcon)) quartz.system.drawing.loadalpha(1) end end local rectScore -- Prints the Team Score at top or side of the Team Panel if (MultiColumn) then rectScore = {self.positionX, self.positionY - 20, self.positionX + SlotWidth + 20, self.positionY} else rectScore = {-115 + self.positionX, self.positionY + SlotHeight + leftIconPosition, -40 + self.positionX, self.positionY + leftIconPosition + 78} end local fontJustificationScore = quartz.system.drawing.justification.right + quartz.system.drawing.justification.singlelineverticalcenter if (self.teamScore and activity.dontDisplayScore == nil) then if (MultiColumn) then quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors[self.team.profile.teamColor])) quartz.system.drawing.loadfont(UIComponent.fonts.title) quartz.system.drawing.drawtextjustified(self.teamScore, fontJustificationScore, rectScore[1], rectScore[2], rectScore[3], rectScore[4]) else quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture("base:texture/ui/Leaderboard_score_bg.tga") quartz.system.drawing.drawtexture(unpack(rectScore)) quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors[self.team.profile.teamColor])) quartz.system.drawing.loadfont(UIComponent.fonts.title) quartz.system.drawing.drawtextjustified(self.teamScore, fontJustificationScore, rectScore[1] - 20, rectScore[2] + 20, rectScore[1] + 65, rectScore[2] + 65) end end local rectIcon -- left team border quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture("base:texture/ui/components/UI" .. self.team.profile.teamColor .. "slot_01.tga")--self.team.profile.icon) quartz.system.drawing.drawtexturev(self.positionX - 25, self.positionY + 15, self.positionX - 5, self.positionY + 15 + SlotHeight * #self.team.players + 5) -- right team border quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture("base:texture/ui/components/UI" .. self.team.profile.teamColor .. "slot_02.tga")--self.team.profile.icon) quartz.system.drawing.drawtexturev(self.positionX + SlotWidth + 16, self.positionY + 15, self.positionX + SlotWidth + 26, self.positionY + 15 + SlotHeight * #self.team.players + 5) -- Positioning the Team Icon - on side for 2 teams, above for 3 and 4 teams if (MultiColumn) then --rectIcon = {self.positionX + SlotWidth/2 - 75, self.positionY - 50, self.positionX + SlotWidth/2 + 75, self.positionY+20} rectIcon = {self.positionX + SlotWidth / 2 - 60, self.positionY - 50, self.positionX + SlotWidth / 2 + 60, self.positionY + 20} else rectIcon = {-150 + self.positionX - 10 * self.scaleIcon, self.positionY - 35 + leftIconPosition - 10 * self.scaleIcon, self.positionX + 18 + 10 * self.scaleIcon, self.positionY + leftIconPosition + 65 + 10 * self.scaleIcon} end quartz.system.drawing.loadcolor3f(unpack(UIComponent.colors.white)) quartz.system.drawing.loadtexture(self.team.profile.icon) quartz.system.drawing.drawtexture(unpack(rectIcon)) end end
local core_utils = require "luacheck.core_utils" local stage = {} stage.warnings = { ["531"] = {message_format = "right side of assignment has more values than left side expects", fields = {}}, ["532"] = {message_format = "right side of assignment has less values than left side expects", fields = {}} } local function is_unpacking(node) return node.tag == "Dots" or node.tag == "Call" or node.tag == "Invoke" end local function check_assignment(chstate, node) local rhs = node[2] if not rhs then return end local lhs = node[1] if #rhs > #lhs then chstate:warn_range("531", node) elseif #rhs < #lhs and node.tag == "Set" and not is_unpacking(rhs[#rhs]) then chstate:warn_range("532", node) end end function stage.run(chstate) core_utils.each_statement(chstate, {"Set", "Local"}, check_assignment) end return stage
function VolumeElementFilterFunc(property) local elem = property.element if elem == nil then elem = 0 end local vm = require("FloatsToFloat")(); vm:Create(property.srcvolume, elem) function volume() return vm:VolumeData() end return { volume = volume } end
vim.g.autosource_conf_names = { '.exrc', '.exrc.lua' }
lp=game.Players.LocalPlayer pl=lp.Character tol=Instance.new("HopperBin",lp.Backpack) tol.Name="Skull_Smasher"--jarredbcv asd=0 Part = function(x,y,z,color,tr,cc,an,parent) local p = Instance.new('Part',parent or Weapon) p.formFactor = 'Custom' p.Size = Vector3.new(x,y,z) p.BrickColor = BrickColor.new(color) p.CanCollide = cc p.Transparency = tr p.Anchored = an p.TopSurface,p.BottomSurface = 0,0 return p end fir = function(n1,n2,n3,n4,n5,n6,hs,fs,parent) local fi = Instance.new('Fire',parent or Weapon) fi.Color=Color3.new(n1,n2,n3) fi.Heat=hs fi.SecondaryColor=Color3.new(n4,n5,n6) fi.Size=fs return fi end wPart = function(x,y,z,color,tr,cc,an,parent) local wp = Instance.new('WedgePart',parent or Weapon) wp.formFactor = 'Custom' wp.Size = Vector3.new(x,y,z) wp.BrickColor = BrickColor.new(color) wp.CanCollide = cc wp.Transparency = tr wp.Anchored = an wp.TopSurface,wp.BottomSurface = 0,0 return wp end Weld = function(p0,p1,x,y,z,rx,ry,rz,par) p0.Position = p1.Position local w = Instance.new('Motor',par or p0) w.Part0 = p0 w.Part1 = p1 w.C1 = CFrame.new(x,y,z)*CFrame.Angles(rx,ry,rz) return w end Mesh = function(par,num,x,y,z) local msh = _ if num == 1 then msh = Instance.new("CylinderMesh",par) elseif num == 2 then msh = Instance.new("SpecialMesh",par) msh.MeshType = 3 elseif num == 3 then msh = Instance.new("BlockMesh",par) elseif type(num) == 'string' then msh = Instance.new("SpecialMesh",par) msh.MeshId = num end msh.Scale = Vector3.new(x,y,z) return msh end function onKeyDown(key) key = key:lower() if key == "e" then --for angle = 45, 95, 10 do fakel.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(angle), math.rad(angle/-1), 0) wait()end end if key == "q" then for angle = 45, 95, 10 do fakel.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(angle), math.rad(0), math.rad(angle/2)) wait()end for angle = 95, 5, -20 do fakel.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(angle), math.rad(0), 1)wait()end for i=1,20 do wait() partz= Part(15,15,15,'Really black',0,true,true,workspace) partz.CFrame= CFrame.new(pl.Torso.Position+Vector3.new(0,0,10)) * CFrame.Angles(math.random()-.5,math.random()-.5,math.random()-.5) + Vector3.new(0,-8,0) + pl.Torso.CFrame.lookVector*(i+5)*3.5 function touch(hit) if hit.Parent:findFirstChild("Humanoid") ~= nil then hit.Parent.Humanoid.Health=hit.Parent.Humanoid.Health-10 end end partz.Touched:connect(touch) game.Debris:AddItem(partz,1) end for angle = 0, 45, 5 do wait()fakel.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(angle), math.rad(angle/2), math.rad(0))end end end function onClicked(mouse) asd=10 for angle = 45, 95, 10 do fakel.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(angle), math.rad(angle/2), 0)wait()end for angle = 95, 5, -20 do fakel.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(angle), math.rad(angle/2), 0)wait()end for angle = 5, 45, 10 do fakel.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(angle), math.rad(angle/angle - 5), 0)wait()end fakel.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(45), math.rad(10), 0) asd=0 end tol.Selected:connect(function(mouse) mouse.Button1Down:connect(function() onClicked(mouse) end) mouse.KeyDown:connect(onKeyDown) mo=Instance.new("Model",pl) bas = Part(1,1,1,'',1,false,false,mo) bas:BreakJoints() pa1= Part(.5,.5,3,'Really black',0,false,false,mo) wl1= Weld(pa1,bas,0,-1.5,0,0,0,0,mo) pa2= Part(.6,.1,1,'Institutional white',0,false,false,mo) wl2= Weld(pa2,pa1,0,.1,-1,0,0,0,mo) pa3= Part(.6,.1,1,'Institutional white',0,false,false,mo) wl3= Weld(pa3,pa1,0,-.1,0,0,0,0,mo) pa4= Part(.6,.1,1,'Institutional white',0,false,false,mo) wl4= Weld(pa4,pa1,0,.1,1,0,0,0,mo) pa5= Part(.1,.6,1,'Institutional white',0,false,false,mo) wl5= Weld(pa5,pa1,.1,0,1,0,0,0,mo) pa6= Part(.1,.6,1,'Institutional white',0,false,false,mo) wl6= Weld(pa6,pa1,-.1,0,0,0,0,0,mo) pa7= Part(.1,.6,1,'Institutional white',0,false,false,mo) wl7= Weld(pa7,pa1,.1,0,-1,0,0,0,mo) pa8= Part(.6,.1,.6,'Institutional white',0,false,false,mo) wl8= Weld(pa8,pa1,0,0,-.6,1,0,0,mo) pa9= Part(.6,.1,.6,'Institutional white',0,false,false,mo) wl9= Weld(pa9,pa1,0,0,.6,-1,0,0,mo) pa10= Part(.75,.75,.75,'Institutional white',0,false,false,mo) wl10= Weld(pa10,pa1,0,0,1.75,1,1,1,mo) pa11= Part(.75,.75,.75,'Really black',0,false,false,mo) wl11= Weld(pa11,pa1,0,0,1.75,2,2,2,mo) pa12= wPart(.5,.5,.5,'Really black',0,false,false,mo) wl12= Weld(pa12,pa1,0,-.5,-1.75,0,0,0,mo) pa13= wPart(.5,.5,.5,'Really black',0,false,false,mo) wl13= Weld(pa13,pa1,0,.5,-1.75,0,0,math.pi/1,mo) pa14= wPart(.5,.5,.5,'Really black',0,false,false,mo) wl14= Weld(pa14,pa1,.5,0,-1.75,0,0,math.pi/2,mo) pa15= wPart(.5,.5,.5,'Really black',0,false,false,mo) wl15= Weld(pa15,pa1,-.5,0,-1.75,0,0,math.pi/-2,mo) pa16= Part(1.1,.1,1.1,'Institutional white',0,false,false,mo) mes1= Mesh(pa16,1,1,1,1) wl16= Weld(pa16,pa1,0,0,-1.5,math.pi/2,0,0,mo) pa17= Part(.75,.75,0,'Really black',0,false,false,mo) wl17= Weld(pa17,pa1,0,0,-1.6,0,0,0,mo) pa18= Part(0,0,0,'Really black',1,false,false,mo) wl18= Weld(pa18,pa1,0,0,-2,0,0,0,mo) firs= fir(1,1,1,1,1,1,0,0,pa18) HAMER= Part(1,1,1,'Really black',0,false,false,mo) mes2= Mesh(HAMER,3,2,3,2) wl19= Weld(HAMER,pa1,0,0,-4,0,0,0,mo) pa20= Part(1,1,1,'Institutional white',.4,false,false,mo) mes3= Mesh(pa20,3,2.3,3.3,2.3) wl20= Weld(pa20,HAMER,0,0,0,0,0,0,mo) pa21= Part(0,0,0,'Institutional white',0,false,false,mo) mes4= Mesh(pa21,'http://www.roblox.com/asset/?id=9982590',.3,.01,.3) wl21= Weld(pa21,HAMER,0,0,1,math.pi/2,0,0,mo) pa22= Part(0,0,0,'Institutional white',0,false,false,mo) mes5= Mesh(pa22,'http://www.roblox.com/asset/?id=9982590',.3,.01,.3) wl22= Weld(pa22,HAMER,0,0,-1,math.pi/2,0,0,mo) pa23= Part(0,0,0,'Institutional white',0,false,false,mo) mes6= Mesh(pa23,'http://www.roblox.com/asset/?id=9982590',.5,.01,.5) wl23= Weld(pa23,HAMER,0,1.5,0,math.pi/1,0,0,mo) pa24= Part(0,0,0,'Institutional white',0,false,false,mo) mes7= Mesh(pa24,'http://www.roblox.com/asset/?id=9982590',.5,.01,.5) wl24= Weld(pa24,HAMER,0,-1.5,0,math.pi/1,0,0,mo) pa24= Part(0,0,0,'Institutional white',0,false,false,mo) mes7= Mesh(pa24,'http://www.roblox.com/asset/?id=9982590',.5,.01,.5) wl24= Weld(pa24,HAMER,0,-1.5,0,math.pi/1,0,0,mo) pa25= Part(0,0,0,'Institutional white',0,false,false,mo) mes8= Mesh(pa25,'http://www.roblox.com/asset/?id=4770583',3,3,.1) wl25= Weld(pa25,HAMER,-1,0,0,math.pi/2,math.pi/2,math.pi/1,mo) pa26= Part(0,0,0,'Institutional white',0,false,false,mo) mes9= Mesh(pa26,'http://www.roblox.com/asset/?id=4770583',3,3,.1) wl26= Weld(pa26,HAMER,1,0,0,math.pi/2,math.pi/-2,math.pi/1,mo) pa27= Part(0,0,0,'Institutional white',0,false,false,mo) mes10= Mesh(pa27,1,3,11,3) wl27= Weld(pa27,HAMER,.5,1,0,math.pi/2,0,0,mo) pa28= Part(0,0,0,'Institutional white',0,false,false,mo) mes11= Mesh(pa28,1,3,11,3) wl28= Weld(pa28,HAMER,-.5,1,0,math.pi/2,0,0,mo) pa29= Part(0,0,0,'Institutional white',0,false,false,mo) mes12= Mesh(pa29,1,3,11,3) wl29= Weld(pa29,HAMER,.5,-1,0,math.pi/2,0,0,mo) pa30= Part(0,0,0,'Institutional white',0,false,false,mo) mes13= Mesh(pa30,1,3,11,3) wl30= Weld(pa30,HAMER,-.5,-1,0,math.pi/2,0,0,mo) pa31= Part(0,0,0,'Institutional white',0,false,false,mo) mes14= Mesh(pa31,1,3,11,3) wl31= Weld(pa31,HAMER,0,1,.5,0,0,math.pi/2,mo) pa32= Part(0,0,0,'Institutional white',0,false,false,mo) mes15= Mesh(pa32,1,3,11,3) wl32= Weld(pa32,HAMER,0,1,-.5,0,0,math.pi/2,mo) pa33= Part(0,0,0,'Institutional white',0,false,false,mo) mes16= Mesh(pa33,1,3,11,3) wl33= Weld(pa33,HAMER,0,-1,-.5,0,0,math.pi/2,mo) pa34= Part(0,0,0,'Institutional white',0,false,false,mo) mes17= Mesh(pa34,1,3,11,3) wl34= Weld(pa34,HAMER,0,-1,.5,0,0,math.pi/2,mo) function touch(hit) if hit.Parent:findFirstChild("Humanoid") ~= nil then hit.Parent.Humanoid.Health=hit.Parent.Humanoid.Health-asd end end HAMER.Touched:connect(touch) fakel = Instance.new("Weld",mo) fakel.Part0 = pl.Torso fakel.Part1 = bas coroutine.wrap(function() for angle = 0, 45, 5 do if fakel == nil then return end fakel.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(math.rad(angle), math.rad(angle/2), math.rad(0)) wait() end end)() welditbro = Instance.new("Weld", mo) welditbro.C0 = CFrame.new(0, 0.5, 0) welditbro.Part0 = pl['Right Arm'] welditbro.Part1 = bas loop=false coroutine.resume(coroutine.create(function(c) local origc1 = wl19.C1 while wait() do if loop == true then break end for i=0,(2*math.pi)-(math.pi/90),math.pi/90 do wait()--omg wl19.C1 = origc1-Vector3.new(0,0,(math.sin(i)*.5)+.4) end end end)) end) tol.Deselected:connect(function(mouse) loop=true mo:remove() end)--nine hours. jarrebcv
--[[ based on Trangenstein for curved space, I'll keep my vectors in covariant form this way the Levi-Civita tensor in teh flux, multiplied by the connection coefficents, when used in a holonomic basis, makes them cancel and when used in a static grid, the g^ij_,t terms vanish, and you get eps0 E_i,t - 1/sqrt(g) g_il 1/mu0 epsBar^ljk B_k,j = -j_i B_i,t + 1/sqrt(g) g_il 1/eps0 epsBar^ljk eps0 E_k,j = 0 so during flux computation, I need to not apply the sqrt det g and after computing the flux vector I need to apply the metric How to add in the D and H fields... I am really tempted to change eps0 E -> E so that I can more freely mess with the aux fields: in fact, in materials, D is a better candidate anyways, since formula are in D,t and B,t, and D = epsilon E, so using eps0 E is a good start D_i,t - 1/sqrt(g) g_il epsBar^ljk 1/mu B_k,j = 1/sqrt(g) g_il epsBar^ljk (1/mu)_,j B_k - J_i B_i,t + 1/sqrt(g) g_il epsBar^ljk 1/eps D_k,j = 1/sqrt(g) g_il epsBar^ljk (1/eps)_,j B_k D_i,t - 1/sqrt(g) g_il epsBar^ljk 1/mu B_k,j = -1/sqrt(g) g_il epsBar^ljk B_j (1/mu)_,k - J_i B_i,t + 1/sqrt(g) g_il epsBar^ljk 1/eps D_k,j = -1/sqrt(g) g_il epsBar^ljk D_j (1/eps)_,k TODO now I need to add source terms of the permittivity and permeability gradients ... that will look like ... D_i,t - 1/sqrt(g) g_il epsBar^ljk (1/mu)_k^l B_l,j = 1/sqrt(g) g_il epsBar^ljk (1/mu)_k^l_,j B_l - J_i B_i,t + 1/sqrt(g) g_il epsBar^ljk (1/eps)_k^l D_l,j = 1/sqrt(g) g_il epsBar^ljk (1/eps)_k^l_,j B_l --]] local ffi = require 'ffi' local class = require 'ext.class' local table = require 'ext.table' local Equation = require 'hydro.eqn.eqn' local Maxwell = class(Equation) Maxwell.name = 'maxwell' Maxwell.roeUseFluxFromCons = true -- don't incorporate the Conn^k_ij E_k terms into the flux Maxwell.weightFluxByGridVolume = false Maxwell.initConds = require 'hydro.init.euler':getList() --[[ args: scalar = 'real' or 'cplx' --]] function Maxwell:init(args) self.scalar = (args and args.scalar) or 'real' self.vec3 = self.scalar..'3' self.mat3x3 = self.scalar..'3x3' -- TODO tensor susceptibilty support ... but that affects the eigendecomposition ... self.susc_t = self.scalar --self.susc_t = self.mat3x3 self.numRealsInScalar = ffi.sizeof(self.scalar) / ffi.sizeof'real' self.numIntStates = 6 * self.numRealsInScalar self.numWaves = 6 * self.numRealsInScalar self.consVars = { {name='D', type=self.vec3, units='C/m^2', variance='l'}, -- D_i {name='B', type=self.vec3, units='kg/(C*s)', variance='l'}, -- B_i {name='phi', type=self.scalar, units='C/m^2'}, {name='psi', type=self.scalar, units='kg/(C*s)'}, {name='rhoCharge', type=self.scalar, units='C/m^3'}, {name='J', type=self.vec3, units='C/(m^2*s)', variance='l'}, {name='sqrt_1_eps', type=self.susc_t, units='(kg*m^3)^.5/(C*s)', variance=''}, {name='sqrt_1_mu', type=self.susc_t, units='C/(kg*m)^.5', variance=''}, } self.eigenVars = table{ {name='sqrt_1_eps', type=self.susc_t, units='(kg*m^3)^.5/(C*s)', variance=''}, {name='sqrt_1_mu', type=self.susc_t, units='C/(kg*m)^.5', variance=''}, } Maxwell.super.init(self, args) --[=[ TODO combine this into the flux and remove this variable from calcDerivFV function self:postComputeFluxCode() return self:template[[ //// MODULE_DEPENDS: <?=coord_sqrt_det_g?> <?=eqn_common?> <? local vec3 = eqn.vec3 ?> //TODO shouldn't I be transforming both the left and right fluxes by the metrics at their respective coordinates? //flux is computed raised via Levi-Civita upper //so here we lower it real const _1_sqrt_det_g = 1. / coord_sqrt_det_g(x); flux.D = <?=vec3?>_real_mul(eqn_coord_lower(flux.D, x), _1_sqrt_det_g); flux.B = <?=vec3?>_real_mul(eqn_coord_lower(flux.B, x), _1_sqrt_det_g); ]] end --]=] local NoDiv = require 'hydro.op.nodiv'{ poissonSolver = require 'hydro.op.poisson_jacobi', } self.solver.ops:insert(NoDiv{ solver = self.solver, scalar = self.scalar, vectorField = 'B', potentialField = 'psi', }) self.solver.ops:insert(NoDiv{ solver = self.solver, scalar = self.scalar, vectorField = 'D', potentialField = 'phi', chargeField = 'rhoCharge', }) end function Maxwell:getSymbolFields() return Maxwell.super.getSymbolFields(self):append{ 'sqrt_2_and_1_2', } end -- don't use default function Maxwell:initCodeModule_fluxFromCons() end Maxwell.solverCodeFile = 'hydro/eqn/maxwell.cl' function Maxwell:getEnv() local scalar = self.scalar local env = Maxwell.super.getEnv(self) env.vec3 = self.vec3 env.susc_t = self.susc_t env.scalar = scalar env.zero = scalar..'_zero' env.inv = scalar..'_inv' env.neg = scalar..'_neg' env.fromreal = scalar..'_from_real' env.add = scalar..'_add' env.sub = scalar..'_sub' env.mul = scalar..'_mul' env.mul3 = scalar..'_mul3' env.real_mul = scalar..'_real_mul' env.sqrt = scalar..'_sqrt' env.abs = scalar..'_abs' return env end function Maxwell:getModuleDepends_displayCode() return table(Maxwell.super.getModuleDepends_displayCode(self)):append{ self.symbols.eqn_common, } end function Maxwell:getModuleDepends_waveCode() return table(Maxwell.super.getModuleDepends_waveCode(self)):append{ self.solver.coord.symbols.coord_sqrt_det_g, } end Maxwell.predefinedDisplayVars = { 'U D', 'U D z', 'U div D', 'U phi', 'U B', 'U B z', 'U div B', 'U psi', } function Maxwell:getDisplayVars() local env = self:getEnv() local vars = Maxwell.super.getDisplayVars(self) vars:append{ {name='E', code=self:template[[ value.v<?=vec3?> = calc_E(U);]], type=env.vec3, units='(kg*m)/(C*s)'}, {name='H', code=self:template[[ value.v<?=vec3?> = calc_H(U);]], type=env.vec3, units='C/(m*s)'}, {name='S', code=self:template[[ value.v<?=vec3?> = <?=vec3?>_cross(calc_E(U), calc_H(U));]], type=env.vec3, units='kg/s^3'}, { name='energy', code=self:template[[ <?=susc_t?> _1_eps = <?=susc_t?>_mul(U->sqrt_1_eps, U->sqrt_1_eps); <?=susc_t?> _1_mu = <?=susc_t?>_mul(U->sqrt_1_mu, U->sqrt_1_mu); value.vreal = <?=real_mul?>(<?=add?>( <?=scalar?>_<?=susc_t?>_mul(eqn_coordLenSq(U->D, x), _1_eps), <?=scalar?>_<?=susc_t?>_mul(eqn_coordLenSq(calc_H(U), x), _1_mu) ), .5); ]], type = scalar, units = 'kg/(m*s^2)', }, } vars:insert(self:createDivDisplayVar{field='D', scalar=env.scalar, units='C/m^3'} or nil) vars:insert(self:createCurlDisplayVar{field='D', scalar=env.scalar, units='C/m^3'} or nil) vars:insert(self:createDivDisplayVar{field='B', scalar=env.scalar, units='kg/(C*m*s)'} or nil) vars:insert(self:createCurlDisplayVar{field='B', scalar=env.scalar, units='kg/(C*m*s)'} or nil) return vars end function Maxwell:eigenWaveCodePrefix(args) --[=[ return self:template([[ <?=scalar?> v_p_abs = <?=mul?>((<?=eig?>)->sqrt_1_eps, (<?=eig?>)->sqrt_1_mu); ]], args) --]=] -- [=[ local code = self:template( [[<?=mul?>(<?=mul?>((<?=eig?>)->sqrt_1_eps, (<?=eig?>)->sqrt_1_mu), 1./coord_sqrt_det_g(<?=pt?>))]], args ) if self.scalar == 'cplx' then local env = self:getEnv() code = env.abs..'('..code..')' end return 'real const '..self.symbolPrefix..'v_p_abs = '..code..';' --]=] end function Maxwell:eigenWaveCode(args) local waveIndex = math.floor(args.waveIndex / self.numRealsInScalar) return ({ '-'..self.symbolPrefix..'v_p_abs', '-'..self.symbolPrefix..'v_p_abs', '0', '0', self.symbolPrefix..'v_p_abs', self.symbolPrefix..'v_p_abs', })[waveIndex+1] or error('got a bad waveIndex: '..waveIndex) end function Maxwell:consWaveCodePrefix(args) local code = self:template( [[<?=mul?>(<?=mul?>((<?=U?>)->sqrt_1_eps, (<?=U?>)->sqrt_1_mu), 1./coord_sqrt_det_g(<?=pt?>))]], args ) if self.scalar == 'cplx' then local env = self:getEnv() code = env.abs..'('..code..')' end return 'real const '..self.symbolPrefix..'v_p_abs = '..code..';' end Maxwell.consWaveCode = Maxwell.eigenWaveCode return Maxwell
--[[ Copyright (C) 2020 Blue Mountains GmbH This program is free software: you can redistribute it and/or modify it under the terms of the Onset Open Source License as published by Blue Mountains GmbH. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Onset Open Source License for more details. You should have received a copy of the Onset Open Source License along with this program. If not, see https://bluemountains.io/Onset_OpenSourceSoftware_License.txt ]]-- local StreamedSounds = { } -- Expose attach types like on the server. if ATTACH_NONE == nil then ATTACH_NONE = 0 end if ATTACH_PLAYER == nil then ATTACH_PLAYER = 1 end if ATTACH_VEHICLE == nil then ATTACH_VEHICLE = 2 end if ATTACH_OBJECT == nil then ATTACH_OBJECT = 3 end if ATTACH_NPC == nil then ATTACH_NPC = 4 end AddEvent("OnPackageStop", function() for k, v in pairs(StreamedSounds) do DestroySound(v.sound) end StreamedSounds = nil end) AddEvent("OnObjectStreamIn", function(object) if StreamedSounds[object] ~= nil then print("ERROR: OnObjectStreamIn("..object..") called where we already have one") return end local _soundStream = GetObjectPropertyValue(object, "_soundStream") if _soundStream ~= nil then StreamedSounds[object] = { } StreamedSounds[object] = _soundStream local ObjectActor = GetObjectActor(object) -- Set the scale to 0 and make it hidden ObjectActor:SetActorScale3D(FVector(0.01, 0.01, 0.01)) ObjectActor:SetActorHiddenInGame(true) -- Alos disable its collision ObjectActor:SetActorEnableCollision(false) local x, y, z if _soundStream.is_attached == false then x, y, z = GetObjectLocation(object) elseif _soundStream.is_attached == true then if _soundStream.attach == ATTACH_VEHICLE then x, y, z = GetVehicleLocation(_soundStream.id) elseif _soundStream.attach == ATTACH_PLAYER then x, y, z = GetPlayerLocation(_soundStream.id) elseif _soundStream.attach == ATTACH_OBJECT then x, y, z = GetObjectLocation(_soundStream.id) elseif _soundStream.attach == ATTACH_NPC then x, y, z = GetNPCLocation(_soundStream.id) end end -- Create the actual sound StreamedSounds[object].sound = CreateSound3D(_soundStream.file, x, y, z, _soundStream.radius, _soundStream.loop) if StreamedSounds[object].sound == false then if IsGameDevMode() then local msg = "WARNING: Attempting to create streamed 3d sound but there already is a maximum number of sounds in this area. Remove some sounds or reduce their radius." AddPlayerChat('<span color="#ff0000bb" style="bold" size="10">'..msg..'</>') print(msg) end StreamedSounds[object] = nil return else SetSoundPitch(StreamedSounds[object].sound, _soundStream.pitch) SetSoundVolume(StreamedSounds[object].sound, _soundStream.volume) end if IsGameDevMode() then AddPlayerChat("STREAMIN: Server Sound3D for Object "..object) end end end) AddEvent("OnObjectStreamOut", function(object) -- When the dummy object is streamed out make sure to destroy the sound if StreamedSounds[object] ~= nil then DestroySound(StreamedSounds[object].sound) if IsGameDevMode() then AddPlayerChat("STREAMOUT: Server Sound3D "..object) end StreamedSounds[object] = nil end end) AddEvent("OnObjectNetworkUpdatePropertyValue", function(object, PropertyName, PropertyValue) if StreamedSounds[object] == nil then return end if PropertyName == "_soundStream" then local CurrentPV = GetObjectPropertyValue(object, PropertyName) if CurrentPV.radius ~= PropertyValue.radius then DestroySound(StreamedSounds[object].sound) local x, y, z = GetObjectLocation(object) StreamedSounds[object].sound = CreateSound3D(StreamedSounds[object].file, x, y, z, PropertyValue.radius, _soundStream.loop) end SetSoundVolume(StreamedSounds[object].sound, PropertyValue.volume) SetSoundPitch(StreamedSounds[object].sound, PropertyValue.pitch) StreamedSounds[object].volume = PropertyValue.volume StreamedSounds[object].pitch = PropertyValue.pitch StreamedSounds[object].radius = PropertyValue.radius end end) AddRemoteEvent("SetStreamedSound3DLocation", function(object, x, y, z) if StreamedSounds[object] == nil then return end SetSound3DLocation(StreamedSounds[object].sound, x, y, z) end) AddEvent("OnGameTick", function(DeltaSeconds) for k, v in pairs(StreamedSounds) do if v.is_attached then local x, y, z if v.attach == ATTACH_VEHICLE then if IsValidVehicle(v.id) then x, y, z = GetVehicleLocation(v.id) end elseif v.attach == ATTACH_PLAYER then if IsValidPlayer(v.id) then x, y, z = GetPlayerLocation(v.id) end elseif v.attach == ATTACH_OBJECT then if IsValidObject(v.id) then x, y, z = GetObjectLocation(v.id) end elseif v.attach == ATTACH_NPC then if IsValidNPC(v.id) then x, y, z = GetNPCLocation(v.id) end end SetSound3DLocation(v.sound, x, y, z) end end end)
TextureManager = { imgPool={}, texPool={} } function TextureManager:loadSprite(fn, w, h, dimX, dimY) local fullFilePath = "assets/image/" .. fn if not MOAIFileSystem.checkFileExists(fullFilePath) then return nil end local image = self.imgPool[fullFilePath] if not image then image = MOAIImage.new() image:load(fullFilePath) self.imgPool[fullFilePath] = image local w, h = image:getSize() print("IMAGE: loading", "[" .. w .. "x" .. h .. "] " .. fn) end if not width or not height then width, height = image:getSize() end local texture = self.texPool[fullFilePath] if not texture then texture = MOAITexture.new() texture:load(image) self.texPool[fullFilePath] = texture end sheet = MOAITileDeck2D.new () sheet:setTexture ( texture ) sheet:setSize ( dimX, dimY ) -- subdivide the texture into dimX*dimY frames sheet:setRect ( -w/2, h/2, w/2, -h/2 ) -- set the world space dimensions of the sprites -- create a sprite and initialize it sprite = MOAIProp2D.new () sprite:setDeck ( sheet ) sprite:setBlendMode(MOAIProp2D.GL_SRC_ALPHA, MOAIProp2D.GL_ONE_MINUS_SRC_ALPHA) sprite:setIndex(1) sprite.sheet = sheet return sprite end function TextureManager:loadTile(fn, w, h, dimX, dimY) local fullFilePath = "assets/image/" .. fn if not MOAIFileSystem.checkFileExists(fullFilePath) then return nil end local image = self.imgPool[fullFilePath] if not image then image = MOAIImage.new() image:load(fullFilePath) self.imgPool[fullFilePath] = image local w, h = image:getSize() print("IMAGE: loading", "[" .. w .. "x" .. h .. "] " .. fn) end if not width or not height then width, height = image:getSize() end local texture = self.texPool[fullFilePath] if not texture then texture = MOAITexture.new() texture:load(image) self.texPool[fullFilePath] = texture end sheet = MOAITileDeck2D.new () sheet:setTexture ( texture ) sheet:setSize ( dimX, dimY ) -- subdivide the texture into dimX*dimY frames sheet:setRect ( -w, 0, 0,-h ) -- set the world space dimensions of the sprites -- create a sprite and initialize it sprite = MOAIProp2D.new () sprite:setDeck ( sheet ) sprite:setBlendMode(MOAIProp2D.GL_SRC_ALPHA, MOAIProp2D.GL_ONE_MINUS_SRC_ALPHA) sprite:setIndex(1) sprite.sheet = sheet return sprite end function TextureManager:loadPureTexture(fn, width, height) local fullFilePath = "assets/image/" .. fn if not MOAIFileSystem.checkFileExists(fullFilePath) then return nil end local image = self.imgPool[fullFilePath] if not image then image = MOAIImage.new() image:load(fullFilePath) self.imgPool[fullFilePath] = image local w, h = image:getSize() print("IMAGE: loading", "[" .. w .. "x" .. h .. "] " .. fn) end if not width or not height then width, height = image:getSize() end local texture = self.texPool[fullFilePath] if not texture then texture = MOAITexture.new() texture:load(image) self.texPool[fullFilePath] = texture end local quad = MOAIGfxQuad2D.new() quad:setTexture(texture) quad:setRect(-width/2, height, width/2, 0) return quad end function TextureManager:loadTexture(fn, width, height) local fullFilePath = "assets/image/" .. fn if not MOAIFileSystem.checkFileExists(fullFilePath) then return nil end local image = self.imgPool[fullFilePath] if not image then image = MOAIImage.new() image:load(fullFilePath) self.imgPool[fullFilePath] = image local w, h = image:getSize() print("IMAGE: loading", "[" .. w .. "x" .. h .. "] " .. fn) end if not width or not height then width, height = image:getSize() end local texture = self.texPool[fullFilePath] if not texture then texture = MOAITexture.new() texture:load(image) self.texPool[fullFilePath] = texture end local quad = MOAIGfxQuad2D.new() quad:setTexture(texture) quad:setRect(-width/2, height, width/2, 0) local image = MOAIProp2D.new() image:setDeck(quad) image:setBlendMode(MOAIProp2D.GL_SRC_ALPHA, MOAIProp2D.GL_ONE_MINUS_SRC_ALPHA) return image end
local pretty = require 'pl.pretty' tb = { 'one','two','three',{1,2,3}, alpha=1,beta=2,gamma=3,['&']=true,[0]=false, _fred = {true,true}, s = [[ hello dolly you're so fine ]] } print(pretty.write(tb))
-- Naturally spawning blocks minetest.register_craft({ output = "darkage:chalk", recipe = { {"darkage:chalk_powder","darkage:chalk_powder"}, {"darkage:chalk_powder","darkage:chalk_powder"}, } }) minetest.register_craft({ output = "darkage:mud", recipe = { {"darkage:mud_lump","darkage:mud_lump"}, {"darkage:mud_lump","darkage:mud_lump"}, } }) minetest.register_craft({ type = "cooking", output = "darkage:shale", recipe = "darkage:mud", }) minetest.register_craft({ output = "darkage:silt 3", recipe = { {"default:sand","default:sand"}, {"default:clay_lump","default:clay_lump"}, } }) minetest.register_craft({ output = "darkage:silt", recipe = { {"darkage:silt_lump","darkage:silt_lump"}, {"darkage:silt_lump","darkage:silt_lump"}, } }) minetest.register_craft({ type = "cooking", output = "darkage:gneiss", recipe = "darkage:schist", }) minetest.register_craft({ type = "cooking", output = "darkage:slate", recipe = "darkage:shale", }) minetest.register_craft({ type = "cooking", output = "darkage:mud 5", recipe = "darkage:silt", }) minetest.register_craft({ type = "cooking", output = "darkage:slate", recipe = "darkage:slate_cobble", }) minetest.register_craft({ output = "darkage:ors 4", recipe = { {"default:sandstone","default:sandstone"}, {"default:iron_lump","default:sandstone"}, } }) minetest.register_craft({ type = "cooking", output = "darkage:ors", recipe = "darkage:ors_cobble", }) minetest.register_craft({ type = "cooking", output = "darkage:gneiss", recipe = "darkage:gneiss_cobble", }) minetest.register_craft({ type = "cooking", output = "darkage:basalt", recipe = "darkage:basalt_cobble", }) -- Cobble -- Other Blocks --if not farming:straw if minetest.get_modpath("farming") == nil then minetest.register_craft({ output = "darkage:straw 2", recipe = { {"default:dry_shrub","default:dry_shrub"}, {"default:dry_shrub","default:dry_shrub"}, } }) minetest.register_craft({ output = "darkage:straw 2", recipe = { {"darkage:dry_leaves","darkage:dry_leaves"}, {"darkage:dry_leaves","darkage:dry_leaves"}, } }) minetest.register_craft({ output = "darkage:straw_bale", recipe = { {"darkage:straw","darkage:straw"}, {"darkage:straw","darkage:straw"}, } }) minetest.register_craft({ output = "darkage:adobe 4", recipe = { {"default:sand","default:sand"}, {"default:clay_lump","darkage:straw"}, } }) else minetest.register_craft({ output = "farming:straw 2", recipe = { {"default:dry_shrub","default:dry_shrub"}, {"default:dry_shrub","default:dry_shrub"}, } }) minetest.register_craft({ output = "farming:straw 2", recipe = { {"darkage:dry_leaves","darkage:dry_leaves"}, {"darkage:dry_leaves","darkage:dry_leaves"}, } }) minetest.register_craft({ output = "darkage:straw_bale", recipe = { {"farming:straw","farming:straw"}, {"farming:straw","farming:straw"}, } }) minetest.register_craft({ output = "darkage:adobe 4", recipe = { {"default:sand","default:sand"}, {"default:clay_lump","farming:straw"}, } }) end minetest.register_craft({ output = "darkage:slate_tile 4", recipe = { {"darkage:slate","darkage:slate"}, {"darkage:slate","darkage:slate"}, {"darkage:adobe","darkage:adobe"}, } }) minetest.register_craft({ output = "darkage:marble_tile 4", recipe = { {"darkage:marble","darkage:marble"}, {"darkage:marble","darkage:marble"}, {"darkage:adobe","darkage:adobe"}, } }) minetest.register_craft({ output = "darkage:stone_brick 9", recipe = { {"default:cobble","default:cobble","default:cobble"}, {"default:cobble","default:cobble","default:cobble"}, {"default:cobble","default:cobble","default:cobble"}, } }) minetest.register_craft({ output = "darkage:reinforced_chalk", recipe = { {"group:stick","","group:stick"}, {"","darkage:chalk",""}, {"group:stick","","group:stick"}, } }) minetest.register_craft({ output = "darkage:lamp", recipe = { {"group:stick","","group:stick"}, {"","default:torch",""}, {"group:stick","","group:stick"}, } }) minetest.register_craft({ output = "darkage:cobble_with_plaster 2", recipe = { {"default:cobble","darkage:chalk_powder"}, {"default:cobble","darkage:chalk_powder"}, } }) minetest.register_craft({ output = "darkage:cobble_with_plaster 2", recipe = { {"darkage:chalk_powder","default:cobble"}, {"darkage:chalk_powder","default:cobble"}, } }) minetest.register_craft({ output = "darkage:darkdirt 4", recipe = { {"default:dirt","default:dirt"}, {"default:gravel","default:gravel"}, } }) minetest.register_craft({ type = "cooking", output = "darkage:dry_leaves", recipe = "default:leaves", }) -- Storage blocks (boxes, shelves, ect.) minetest.register_craft({ output = "darkage:box", recipe = { {"default:wood","","default:wood"}, {"","",""}, {"default:wood","","default:wood"}, } }) minetest.register_craft({ output = "darkage:wood_shelves 2", recipe = { {"darkage:box"}, {"darkage:box"}, } }) -- Glass / Glow Glass minetest.register_craft({ output = "darkage:glass", recipe = { {"darkage:glow_glass"}, } }) minetest.register_craft({ output = "darkage:glass 8", recipe = { {"default:glass", "default:steel_ingot", "default:glass"}, {"default:steel_ingot", "default:glass", "default:steel_ingot"}, {"default:glass", "default:steel_ingot", "default:glass"}, } }) minetest.register_craft({ output = "darkage:glow_glass", recipe = { {"darkage:glass"}, {"default:torch"}, } }) -- Reinforced Wood minetest.register_craft({ output = "darkage:reinforced_wood", recipe = { {"group:stick","group:wood","group:stick"}, {"group:wood","group:wood","group:wood"}, {"group:stick","group:wood","group:stick"}, } }) minetest.register_craft({ output = "darkage:reinforced_wood_left", recipe = { {"default:stick","darkage:reinforced_wood",""}, } }) minetest.register_craft({ output = "darkage:reinforced_wood_right", recipe = { {"","darkage:reinforced_wood","default:stick"}, } }) -- Wood based deco items minetest.register_craft({ output = "darkage:wood_bars 2", recipe = { {"default:stick","","default:stick"}, {"default:stick","","default:stick"}, {"default:stick","","default:stick"}, } }) minetest.register_craft({ output = "darkage:wood_grille 2", recipe = { {"","darkage:wood_bars",""}, {"darkage:wood_bars","","darkage:wood_bars"}, {"","darkage:wood_bars",""}, } }) minetest.register_craft({ output = "darkage:wood_frame", recipe = { {"group:stick","","group:stick"}, {"","group:wood",""}, {"group:stick","","group:stick"}, } }) -- Metal based deco items minetest.register_craft({ output = "darkage:chain 2", recipe = { {"darkage:iron_stick"}, {"darkage:iron_stick"}, {"darkage:iron_stick"}, } }) minetest.register_craft({ output = "darkage:iron_bars 2", recipe = { {"darkage:iron_stick","","darkage:iron_stick"}, {"darkage:iron_stick","","darkage:iron_stick"}, {"darkage:iron_stick","","darkage:iron_stick"}, } }) minetest.register_craft({ output = "darkage:iron_grille 2", recipe = { {"","darkage:iron_bars",""}, {"darkage:iron_bars","","darkage:iron_bars"}, {"","darkage:iron_bars",""}, } }) -- Craft items minetest.register_craft({ output = "darkage:chalk_powder 4", recipe = { {"darkage:chalk"}, } }) minetest.register_craft({ output = "darkage:mud_lump 4", recipe = { {"darkage:mud"}, } }) minetest.register_craft({ output = "darkage:silt_lump 4", recipe = { {"darkage:silt"}, } }) minetest.register_craft({ output = "darkage:iron_stick 3", recipe = { {"default:steel_ingot"}, {"default:steel_ingot"}, {"default:steel_ingot"}, } }) -- Added minetest.register_craft({ output = "darkage:ors_brick 4", --type = "shapeless", recipe = { {"darkage:ors","darkage:ors"}, {"darkage:ors","darkage:ors"}, } }) minetest.register_craft({ output = "darkage:slate_brick 4", --type = "shapeless", recipe = { {"darkage:slate","darkage:slate"}, {"darkage:slate","darkage:slate"}, } }) minetest.register_craft({ output = "darkage:basalt_brick 4", --type = "shapeless", recipe = { {"darkage:basalt","darkage:basalt"}, {"darkage:basalt","darkage:basalt"}, } })
local PLUGIN = PLUGIN; Clockwork.config:AddToSystem("Business hidden", "hide_business", "Whether or not the business panel is hidden."); -- Called when the menu's items should be adjusted. function PLUGIN:MenuItemsAdd(menuItems) local businessName = Clockwork.option:GetKey("name_business"); if ( Clockwork.config:Get("hide_business"):Get() ) then menuItems:Add(businessName, "cwBusiness", Clockwork.option:GetKey("description_business")); end; end; -- Called when the menu's items should be destroyed. function PLUGIN:MenuItemsDestroy(menuItems) local businessName = Clockwork.option:GetKey("name_business"); if ( Clockwork.config:Get("hide_business"):Get() ) then menuItems:Destroy(businessName); end; end;
---- -- @file PhysicsConstraintBuilder ---- Brief description. -- <#Description#> -- @return <#return value description#> function PhysicsConstraintBuilder:calculateSerializeBufferSize() end ---- Brief description. -- @author James Folk, 16-02-11 15:02:08 -- <#Description#> -- @param dataBuffer <#dataBuffer description#> -- @param btSerializer <#btSerializer description#> -- @return function PhysicsConstraintBuilder:serialize(dataBuffer, btSerializer) end ---- Brief description. -- <#Description#> -- @return <#return value description#> function PhysicsConstraintBuilder:getObjectType() end ---- Brief description. -- <#Description#> -- @return <#return value description#> function PhysicsConstraintBuilder:getClassName() end ---- Brief description. -- <#Description#> -- @return <#return value description#> function PhysicsConstraintBuilder:getType() end ---- Brief description. -- <#Description#> -- @param size <#size description#> -- @return <#return value description#> function NJLI.PhysicsConstraintBuilder.createArray(size) end ---- Brief description. -- <#Description#> -- @param array <#array description#> -- @return <#return value description#> function NJLI.PhysicsConstraintBuilder.destroyArray(array) end ---- Brief description. -- <#Description#> -- @return <#return value description#> function NJLI.PhysicsConstraintBuilder.create() end ---- Brief description. -- <#Description#> -- @param object <#object description#> -- @return <#return value description#> function NJLI.PhysicsConstraintBuilder.clone(object) end ---- Brief description. -- <#Description#> -- @param object <#object description#> -- @return <#return value description#> function NJLI.PhysicsConstraintBuilder.destroy(object) end ---- Brief description. -- <#Description#> -- @param object <#object description#> -- @param L <#L description#> -- @param stack_index <#stack_index description#> -- @return <#return value description#> function NJLI.PhysicsConstraintBuilder.load(object, L, stack_index) end ---- Brief description. -- <#Description#> -- @return <#return value description#> function NJLI.PhysicsConstraintBuilder.type() end
local spec_helper = require "spec.spec_helpers" local cassandra = require "cassandra" local constants = require "kong.constants" local DaoError = require "kong.dao.error" local utils = require "kong.tools.utils" local cjson = require "cjson" local uuid = require "uuid" -- Raw session for double-check purposes local session -- Load everything we need from the spec_helper local env = spec_helper.get_env() -- test environment local faker = env.faker local dao_factory = env.dao_factory local configuration = env.configuration configuration.cassandra = configuration.databases_available[configuration.database].properties -- An utility function to apply tests on core collections. local function describe_core_collections(tests_cb) for type, dao in pairs({ api = dao_factory.apis, consumer = dao_factory.consumers }) do local collection = type == "plugin" and "plugins" or type.."s" describe(collection, function() tests_cb(type, collection) end) end end -- An utility function to test if an object is a DaoError. -- Naming is due to luassert extensibility's restrictions local function daoError(state, arguments) local stub_err = DaoError("", "") return getmetatable(stub_err) == getmetatable(arguments[1]) end local say = require("say") say:set("assertion.daoError.positive", "Expected %s\nto be a DaoError") say:set("assertion.daoError.negative", "Expected %s\nto not be a DaoError") assert:register("assertion", "daoError", daoError, "assertion.daoError.positive", "assertion.daoError.negative") -- Let's go describe("Cassandra", function() setup(function() spec_helper.prepare_db() -- Create a parallel session to verify the dao's behaviour session = cassandra:new() session:set_timeout(configuration.cassandra.timeout) local _, err = session:connect(configuration.cassandra.contact_points) assert.falsy(err) local _, err = session:set_keyspace("kong_tests") assert.falsy(err) end) teardown(function() if session then local _, err = session:close() assert.falsy(err) end end) describe("Base DAO", function() describe(":insert()", function() it("should error if called with invalid parameters", function() assert.has_error(function() dao_factory.apis:insert() end, "Cannot insert a nil element") assert.has_error(function() dao_factory.apis:insert("") end, "Entity to insert must be a table") end) it("should insert in DB and let the schema validation add generated values", function() -- API local api_t = faker:fake_entity("api") local api, err = dao_factory.apis:insert(api_t) assert.falsy(err) assert.truthy(api.id) assert.truthy(api.created_at) local apis, err = session:execute("SELECT * FROM apis") assert.falsy(err) assert.True(#apis > 0) assert.equal(api.id, apis[1].id) -- API api, err = dao_factory.apis:insert { inbound_dns = "test.com", upstream_url = "http://mockbin.com" } assert.falsy(err) assert.truthy(api.name) assert.equal("test.com", api.name) -- Consumer local consumer_t = faker:fake_entity("consumer") local consumer, err = dao_factory.consumers:insert(consumer_t) assert.falsy(err) assert.truthy(consumer.id) assert.truthy(consumer.created_at) local consumers, err = session:execute("SELECT * FROM consumers") assert.falsy(err) assert.True(#consumers > 0) assert.equal(consumer.id, consumers[1].id) -- Plugin configuration local plugin_t = {name = "key-auth", api_id = api.id} local plugin, err = dao_factory.plugins:insert(plugin_t) assert.falsy(err) assert.truthy(plugin) local plugins, err = session:execute("SELECT * FROM plugins") assert.falsy(err) assert.True(#plugins > 0) assert.equal(plugin.id, plugins[1].id) end) it("should let the schema validation return errors and not insert", function() -- Without an api_id, it's a schema error local plugin_t = faker:fake_entity("plugin") local plugin, err = dao_factory.plugins:insert(plugin_t) assert.falsy(plugin) assert.truthy(err) assert.is_daoError(err) assert.True(err.schema) assert.are.same("api_id is required", err.message.api_id) end) it("should ensure fields with `unique` are unique", function() local api_t = faker:fake_entity("api") -- Success local _, err = dao_factory.apis:insert(api_t) assert.falsy(err) -- Failure local api, err = dao_factory.apis:insert(api_t) assert.truthy(err) assert.is_daoError(err) assert.True(err.unique) assert.are.same("name already exists with value '"..api_t.name.."'", err.message.name) assert.falsy(api) end) it("should ensure fields with `foreign` are existing", function() -- Plugin configuration local plugin_t = faker:fake_entity("plugin") plugin_t.api_id = uuid() local plugin, err = dao_factory.plugins:insert(plugin_t) assert.falsy(plugin) assert.truthy(err) assert.is_daoError(err) assert.True(err.foreign) assert.are.same("api_id "..plugin_t.api_id.." does not exist", err.message.api_id) end) it("should do insert checks for entities with `self_check`", function() local api, err = dao_factory.apis:insert(faker:fake_entity("api")) assert.falsy(err) assert.truthy(api.id) local plugin_t = faker:fake_entity("plugin") plugin_t.api_id = api.id -- Success: plugin doesn't exist yet local plugin, err = dao_factory.plugins:insert(plugin_t) assert.falsy(err) assert.truthy(plugin) -- Failure: the same plugin is already inserted local plugin, err = dao_factory.plugins:insert(plugin_t) assert.falsy(plugin) assert.truthy(err) assert.is_daoError(err) assert.True(err.unique) assert.are.same("Plugin configuration already exists", err.message) end) end) -- describe :insert() describe(":update()", function() it("should error if called with invalid parameters", function() assert.has_error(function() dao_factory.apis:update() end, "Cannot update a nil element") assert.has_error(function() dao_factory.apis:update("") end, "Entity to update must be a table") end) it("should return nil and no error if no entity was found to update in DB", function() local api_t = faker:fake_entity("api") api_t.id = uuid() -- No entity to update local entity, err = dao_factory.apis:update(api_t) assert.falsy(entity) assert.falsy(err) end) it("should consider no entity to be found if an empty table is given to it", function() local api, err = dao_factory.apis:update({}) assert.falsy(err) assert.falsy(api) end) it("should update specified, non-primary fields in DB", function() -- API local apis, err = session:execute("SELECT * FROM apis") assert.falsy(err) assert.True(#apis > 0) local api_t = apis[1] api_t.name = api_t.name.." updated" local api, err = dao_factory.apis:update(api_t) assert.falsy(err) assert.truthy(api) apis, err = session:execute("SELECT * FROM apis WHERE name = ?", {api_t.name}) assert.falsy(err) assert.equal(1, #apis) assert.equal(api_t.id, apis[1].id) assert.equal(api_t.name, apis[1].name) assert.equal(api_t.inbound_dns, apis[1].inbound_dns) assert.equal(api_t.upstream_url, apis[1].upstream_url) -- Consumer local consumers, err = session:execute("SELECT * FROM consumers") assert.falsy(err) assert.True(#consumers > 0) local consumer_t = consumers[1] consumer_t.custom_id = consumer_t.custom_id.."updated" local consumer, err = dao_factory.consumers:update(consumer_t) assert.falsy(err) assert.truthy(consumer) consumers, err = session:execute("SELECT * FROM consumers WHERE custom_id = ?", {consumer_t.custom_id}) assert.falsy(err) assert.equal(1, #consumers) assert.equal(consumer_t.name, consumers[1].name) -- Plugin Configuration local plugins, err = session:execute("SELECT * FROM plugins") assert.falsy(err) assert.True(#plugins > 0) local plugin_t = plugins[1] plugin_t.config = cjson.decode(plugin_t.config) plugin_t.enabled = false local plugin, err = dao_factory.plugins:update(plugin_t) assert.falsy(err) assert.truthy(plugin) plugins, err = session:execute("SELECT * FROM plugins WHERE id = ?", {cassandra.uuid(plugin_t.id)}) assert.falsy(err) assert.equal(1, #plugins) end) it("should ensure fields with `unique` are unique", function() local apis, err = session:execute("SELECT * FROM apis") assert.falsy(err) assert.True(#apis > 0) local api_t = apis[1] -- Should not work because we're reusing a inbound_dns api_t.inbound_dns = apis[2].inbound_dns local api, err = dao_factory.apis:update(api_t) assert.truthy(err) assert.falsy(api) assert.is_daoError(err) assert.True(err.unique) assert.equal("inbound_dns already exists with value '"..api_t.inbound_dns.."'", err.message.inbound_dns) end) describe("full", function() it("should set to NULL if a field is not specified", function() local api_t = faker:fake_entity("api") api_t.path = "/path" local api, err = dao_factory.apis:insert(api_t) assert.falsy(err) assert.truthy(api_t.path) -- Update api.path = nil api, err = dao_factory.apis:update(api, true) assert.falsy(err) assert.truthy(api) assert.falsy(api.path) -- Check update api, err = session:execute("SELECT * FROM apis WHERE id = ?", {cassandra.uuid(api.id)}) assert.falsy(err) assert.falsy(api.path) end) it("should still check the validity of the schema", function() local api_t = faker:fake_entity("api") local api, err = dao_factory.apis:insert(api_t) assert.falsy(err) assert.truthy(api_t) -- Update api.inbound_dns = nil local nil_api, err = dao_factory.apis:update(api, true) assert.truthy(err) assert.falsy(nil_api) -- Check update failed api, err = session:execute("SELECT * FROM apis WHERE id = ?", {cassandra.uuid(api.id)}) assert.falsy(err) assert.truthy(api[1].name) assert.truthy(api[1].inbound_dns) end) end) end) -- describe :update() describe(":find_by_keys()", function() describe_core_collections(function(type, collection) it("should error if called with invalid parameters", function() assert.has_error(function() dao_factory[collection]:find_by_keys("") end, "where_t must be a table") end) it("should handle empty search fields", function() local results, err = dao_factory[collection]:find_by_keys({}) assert.falsy(err) assert.truthy(results) assert.True(#results > 0) end) it("should handle nil search fields", function() local results, err = dao_factory[collection]:find_by_keys(nil) assert.falsy(err) assert.truthy(results) assert.True(#results > 0) end) end) it("should query an entity from the given fields and return if filtering was needed", function() -- Filtering needed local apis, err = session:execute("SELECT * FROM apis") assert.falsy(err) assert.True(#apis > 0) local api_t = apis[1] local apis, err, needs_filtering = dao_factory.apis:find_by_keys(api_t) assert.falsy(err) assert.same(api_t, apis[1]) assert.True(needs_filtering) -- No Filtering needed apis, err, needs_filtering = dao_factory.apis:find_by_keys {inbound_dns = api_t.inbound_dns} assert.falsy(err) assert.same(api_t, apis[1]) assert.False(needs_filtering) end) end) -- describe :find_by_keys() describe(":find()", function() setup(function() spec_helper.drop_db() spec_helper.seed_db(10) end) describe_core_collections(function(type, collection) it("should find entities", function() local entities, err = session:execute("SELECT * FROM "..collection) assert.falsy(err) assert.truthy(entities) assert.True(#entities > 0) local results, err = dao_factory[collection]:find() assert.falsy(err) assert.truthy(results) assert.same(#entities, #results) end) it("should allow pagination", function() -- 1st page local rows_1, err = dao_factory[collection]:find(2) assert.falsy(err) assert.truthy(rows_1) assert.same(2, #rows_1) assert.truthy(rows_1.next_page) -- 2nd page local rows_2, err = dao_factory[collection]:find(2, rows_1.next_page) assert.falsy(err) assert.truthy(rows_2) assert.same(2, #rows_2) end) end) end) -- describe :find() describe(":find_by_primary_key()", function() describe_core_collections(function(type, collection) it("should error if called with invalid parameters", function() assert.has_error(function() dao_factory[collection]:find_by_primary_key("") end, "where_t must be a table") end) it("should return nil (not found) if where_t is empty", function() local res, err = dao_factory[collection]:find_by_primary_key({}) assert.falsy(err) assert.falsy(res) end) end) it("should find one entity by its primary key", function() local apis, err = session:execute("SELECT * FROM apis") assert.falsy(err) assert.True(#apis > 0) local api, err = dao_factory.apis:find_by_primary_key { id = apis[1].id } assert.falsy(err) assert.truthy(apis) assert.same(apis[1], api) end) it("should handle an invalid uuid value", function() local apis, err = dao_factory.apis:find_by_primary_key { id = "abcd" } assert.falsy(apis) assert.True(err.invalid_type) assert.equal("abcd is an invalid uuid", err.message.id) end) describe("plugins", function() setup(function() local fixtures = spec_helper.seed_db(1) faker:insert_from_table { plugin = { { name = "key-auth", config = {key_names = {"apikey"}}, api_id = fixtures.api[1].id } } } end) it("should unmarshall the `config` field", function() local plugins, err = session:execute("SELECT * FROM plugins") assert.falsy(err) assert.truthy(plugins) assert.True(#plugins> 0) local plugin_t = plugins[1] local plugin, err = dao_factory.plugins:find_by_primary_key { id = plugin_t.id, name = plugin_t.name } assert.falsy(err) assert.truthy(plugin) assert.equal("table", type(plugin.config)) end) end) end) -- describe :find_by_primary_key() describe(":delete()", function() teardown(function() spec_helper.drop_db() end) describe_core_collections(function(type, collection) it("should error if called with invalid parameters", function() assert.has_error(function() dao_factory[collection]:delete("") end, "where_t must be a table") end) it("should return false if entity to delete wasn't found", function() local ok, err = dao_factory[collection]:delete({id = uuid()}) assert.falsy(err) assert.False(ok) end) it("should delete an entity based on its primary key", function() local entities, err = session:execute("SELECT * FROM "..collection) assert.falsy(err) assert.truthy(entities) assert.True(#entities > 0) local ok, err = dao_factory[collection]:delete(entities[1]) assert.falsy(err) assert.True(ok) local entities, err = session:execute("SELECT * FROM "..collection.." WHERE id = ?", {cassandra.uuid(entities[1].id)}) assert.falsy(err) assert.truthy(entities) assert.are.same(0, #entities) end) end) end) -- -- APIs additional behaviour -- describe("APIs", function() setup(function() spec_helper.seed_db(100) end) describe(":find_all()", function() local apis, err = dao_factory.apis:find_all() assert.falsy(err) assert.truthy(apis) assert.equal(100, #apis) end) end) -- -- Plugins configuration additional behaviour -- describe("plugins", function() describe(":find_distinct()", function() it("should find distinct plugins configurations", function() faker:insert_from_table { api = { { name = "tests distinct 1", inbound_dns = "foo.com", upstream_url = "http://mockbin.com" }, { name = "tests distinct 2", inbound_dns = "bar.com", upstream_url = "http://mockbin.com" } }, plugin = { { name = "key-auth", config = {key_names = {"apikey"}, hide_credentials = true}, __api = 1 }, { name = "rate-limiting", config = { minute = 6}, __api = 1 }, { name = "rate-limiting", config = { minute = 6}, __api = 2 }, { name = "file-log", config = { path = "/tmp/spec.log" }, __api = 1 } } } local res, err = dao_factory.plugins:find_distinct() assert.falsy(err) assert.truthy(res) assert.are.same(3, #res) assert.truthy(utils.table_contains(res, "key-auth")) assert.truthy(utils.table_contains(res, "rate-limiting")) assert.truthy(utils.table_contains(res, "file-log")) end) end) describe(":insert()", function() local api_id local inserted_plugin it("should insert a plugin and set the consumer_id to a 'null' uuid if none is specified", function() -- Since we want to specifically select plugins configurations which have _no_ consumer_id sometimes, we cannot rely on using -- NULL (and thus, not inserting the consumer_id column for the row). To fix this, we use a predefined, nullified uuid... -- Create an API local api_t = faker:fake_entity("api") local api, err = dao_factory.apis:insert(api_t) assert.falsy(err) local plugin_t = faker:fake_entity("plugin") plugin_t.api_id = api.id local plugin, err = dao_factory.plugins:insert(plugin_t) assert.falsy(err) assert.truthy(plugin) assert.falsy(plugin.consumer_id) -- for next test api_id = api.id inserted_plugin = plugin inserted_plugin.consumer_id = nil end) it("should select a plugin configuration by 'null' uuid consumer_id and remove the column", function() -- Now we should be able to select this plugin local rows, err = dao_factory.plugins:find_by_keys { api_id = api_id, consumer_id = constants.DATABASE_NULL_ID } assert.falsy(err) assert.truthy(rows[1]) assert.are.same(inserted_plugin, rows[1]) assert.falsy(rows[1].consumer_id) end) end) end) -- describe plugins configurations end) -- describe Base DAO end) -- describe Cassandra
------------------------------------------------------------------------------- -- 64-bit hash insert fields tests ------------------------------------------------------------------------------- hash = box.schema.space.create('tweedledum') tmp = hash:create_index('primary', { type = 'hash', parts = {1, 'unsigned'}, unique = true }) -- Insert valid fields hash:insert{0ULL, 'value1 v1.0', 'value2 v1.0'} hash:insert{1ULL, 'value1 v1.0', 'value2 v1.0'} hash:insert{2ULL, 'value1 v1.0', 'value2 v1.0'} hash:insert{3ULL, 'value1 v1.0', 'value2 v1.0'} -- Insert invalid fields hash:insert{100, 'value1 v1.0', 'value2 v1.0'} hash:insert{101, 'value1 v1.0', 'value2 v1.0'} hash:insert{102, 'value1 v1.0', 'value2 v1.0'} hash:insert{103, 'value1 v1.0', 'value2 v1.0'} hash:insert{'invalid key', 'value1 v1.0', 'value2 v1.0'} hash:drop()
local eq = assert.are.same local tester_function = function() error(7) end describe('busted specs', function() describe('nested', function() it('should work', function() assert(true) end) end) it('should not nest', function() assert(true) end) it('should not fail unless we unpcall this', function() pcall(tester_function) end) pending("other thing pending", function() error() end) end) describe('before each', function() local a = 2 local b = 3 it('is not cleared', function() eq(2, a) eq(3, b) a = a + 1 b = b + 1 end) describe('nested', function() before_each(function() a = 0 end) it('should clear a but not b', function() eq(0, a) eq(4, b) a = a + 1 b = b + 1 end) describe('nested nested', function() before_each(function() b = 0 end) it('should clear b as well', function() eq(0, a) eq(0, b) a = a + 1 b = b + 1 end) end) it('should only clear a', function() eq(0, a) eq(1, b) a = a + 1 b = b + 1 end) end) it('should clear nothing', function() eq(1, a) eq(2, b) end) end) describe('after each', function() local a = 2 local b = 3 it('is not cleared', function() eq(2, a) eq(3, b) a = a + 1 b = b + 1 end) describe('nested', function() after_each(function() a = 0 end) it('should not clear any at this point', function() eq(3, a) eq(4, b) a = a + 1 b = b + 1 end) describe('nested nested', function() after_each(function() b = 0 end) it('should have cleared a', function() eq(0, a) eq(5, b) a = a + 1 b = b + 1 end) end) it('should have cleared a and b', function() eq(0, a) eq(0, b) a = a + 1 b = b + 1 end) end) it('should only have cleared a', function() eq(0, a) eq(1, b) end) end) describe('fourth top level describe test', function() it('should work', function() eq(1, 1) end) end)
if (SERVER) then netstream.Hook("bizBuy", function(client, items) local char = client:getChar() if (!char) then return end if (table.Count(items) < 1) then return end local cost = 0 for k, v in pairs(items) do local itemTable = nut.item.list[k] if (itemTable and hook.Run("CanPlayerUseBusiness", client, k) != false) then local amount = math.Clamp(tonumber(v) or 0, 0, 10) if (amount == 0) then items[k] = nil else cost = cost + (amount * (itemTable.price or 0)) end else items[k] = nil end end if (table.Count(items) < 1) then return end if (char:hasMoney(cost)) then char:takeMoney(cost) local entity = ents.Create("nut_shipment") entity:SetPos(client:getItemDropPos()) entity:Spawn() entity:setItems(items) entity:setNetVar("owner", char:getID()) local shipments = char:getVar("charEnts") or {} table.insert(shipments, entity) char:setVar("charEnts", shipments, true) netstream.Start(client, "bizResp") hook.Run("OnCreateShipment", client, entity) end end) netstream.Hook("shpUse", function(client, uniqueID, drop) local entity = client.nutShipment local itemTable = nut.item.list[uniqueID] if (itemTable and IsValid(entity)) then if (entity:GetPos():Distance(client:GetPos()) > 128) then client.nutShipment = nil return end local amount = entity.items[uniqueID] if (amount and amount > 0) then if (entity.items[uniqueID] <= 0) then entity.items[uniqueID] = nil end if (drop) then nut.item.spawn(uniqueID, entity:GetPos() + Vector(0, 0, 16)) else local status, fault = client:getChar():getInv():add(uniqueID) if (!status) then return client:notifyLocalized("noFit") end --netstream.Hook("updtShp", uniqueID) end hook.Run("OnTakeShipmentItem", client, uniqueID, amount) entity.items[uniqueID] = entity.items[uniqueID] - 1 if (entity:getItemCount() < 1) then entity:GibBreakServer(Vector(0, 0, 0.5)) entity:Remove() end end end end) else netstream.Hook("openShp", function(entity, items) nut.gui.shipment = vgui.Create("nutShipment") nut.gui.shipment:setItems(entity, items) end) netstream.Hook("updtShp", function(entity, items) if (nut.gui.shipment and nut.gui.shipment:IsVisible()) then end end) netstream.Hook("takeShp", function(name, amount) if (nut.gui.shipment and nut.gui.shipment:IsVisible()) then local item = nut.gui.shipment.itemPanel[name] if (item) then item.amount = item.amount - 1 item:Update(item.amount) if (item.amount <= 0) then item:Remove() end end end end) end
helpers = require("helpers") function love.load() local MAX_ROUNDS = 9 SCALE = .5 ROUND_STEP_ENUM = { BASE=1, DRAW=2, PICK=3, HOLD=4, } BLACK = {.196,.184,.16,1} WHITE = {.694,.682,.659,1} FONT_SIZE = 32 SCREEN_WIDTH = 800 SCREEN_HEIGHT = 480 INDEX_COORDS = { {x = 69.5,y = 101}, {x = 69.5,y = 234.5}, {x = 69.5,y = 368}, {x = 167.5,y = 101}, {x = 167.5,y = 234.5}, {x = 167.5,y = 368}, {x = 332.75,y = 265}, {x = 458,y = 265}, {x = 395,y = 206}, } selected_index = 7 final_turn = false currentMessage = {} MESSAGE_WRAP = 310 * SCALE love.window.setMode(SCREEN_WIDTH * SCALE,SCREEN_HEIGHT * SCALE) love.graphics.setFont(love.graphics.newFont(FONT_SIZE * SCALE)) FONT = love.graphics.getFont() images = {} for i, name in ipairs({ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 'card', 'card_face_down','card_filled', 'deck_empty', 'title', 'title_filled', 'message', 'message_filled', "hand", "hand_filled" }) do images[name] = love.graphics.newImage('images/'..name..'.png') end cardWidth = images.card_face_down:getWidth() cardHeight = images.card_face_down:getHeight() love.graphics.setBackgroundColor(WHITE) function takeCard(hand,flipped) if (#deck<1) then -- TODO: Add animation deck = discardPile discardPile = {} end table.insert( hand, table.remove( deck, love.math.random(#deck) ) ) hand[#hand].flipped = flipped or false end function roundIsOver() for i=1,6 do playerBoard[i].flipped = true npcBoard[i].flipped = true end -- TODO: sleep here to give player time to see what happened currentRound = currentRound + 1 table.insert( playerScore, helpers.getScore(playerBoard) ) table.insert( cpuScore, helpers.getScore(npcBoard) ) if (currentRound >= MAX_ROUNDS) then gameOver = true local endMessage totPlayerScore = helpers.sum(playerScore) totCpuScore = helpers.sum(cpuScore) if totPlayerScore < totCpuScore then endMessage = "You won!" elseif totPlayerScore > totCpuScore then endMessage = "CPU won!" else endMessage = "It's a tie!" end endMessage = endMessage .. " Press escape to quit or 'x' to start again" pushTextToMessage(endMessage) else resetRound() end end function resetRound() playerTurn = true roundOver = false round_step = ROUND_STEP_ENUM.BASE; playerBoard = {} npcBoard = {} discardPile = {} drawnCard = {} deck = {} for suitIndex, suit in ipairs({'heart', 'spade', 'club', 'diamond'}) do for rank = 1, 13 do table.insert(deck, {suit = suit, rank = rank, flipped = false}) end end table.insert( deck, { suit = 'joker', rank = 0, flipped = false} ) table.insert( deck, { suit = 'joker', rank = 0, flipped = false} ) for i=1,6 do takeCard(playerBoard) takeCard(npcBoard) end takeCard(discardPile,true) end function resetGame() currentRound = 0 gameOver = false playerScore = {} cpuScore = {} resetRound() end -- Take care of splitting message in displayable chunk on the message function pushTextToMessage(text) local displayText = {} width, wrap = FONT:getWrap(text, MESSAGE_WRAP) while #wrap > 1 do -- TODO: Should add icon to say they have more to read, ... or the key blinking local toInsert = "" toInsert = toInsert.. table.remove(wrap,1) toInsert = toInsert.. table.remove(wrap,1) table.insert(displayText, toInsert) end if #wrap > 0 then table.insert(displayText, wrap[1]) end currentMessage = displayText end function resetMessage() currentMessage = {} end resetGame() end function love.draw() love.graphics.setColor(BLACK) love.graphics.rectangle('fill',0,10 * SCALE,SCREEN_WIDTH * SCALE,10 * SCALE) love.graphics.rectangle('fill',0,25 * SCALE,SCREEN_WIDTH * SCALE,10 * SCALE) love.graphics.rectangle('fill',0,(SCREEN_HEIGHT - 30) * SCALE,SCREEN_WIDTH * SCALE,10 * SCALE) love.graphics.rectangle('fill',0,(SCREEN_HEIGHT - 15) * SCALE,SCREEN_WIDTH * SCALE,10 * SCALE) love.graphics.setColor(WHITE) love.graphics.draw(images.title_filled, 252 * SCALE, 0, 0, SCALE, SCALE) love.graphics.setColor(BLACK) love.graphics.draw(images.title, 252 * SCALE, 0, 0, SCALE, SCALE) local function drawFilledImages(normal, filled, x, y, scale) love.graphics.setColor(WHITE) love.graphics.draw(filled, x, y, 0, scale, scale) love.graphics.setColor(BLACK) love.graphics.draw(normal, x, y, 0, scale, scale) end local function displayMessage(text) if #currentMessage > 0 then messageX = 236 * SCALE messageY = (SCREEN_HEIGHT - 86) * SCALE drawFilledImages(images.message, images.message_filled, messageX, messageY, SCALE) love.graphics.printf(currentMessage[1],messageX + (15 * SCALE), messageY + (10 * SCALE), MESSAGE_WRAP, "left") end end local function drawCard(card, x, y,scale) local scaling = scale or 1 local function drawCorner(image, offset) love.graphics.draw( image, x + offset, y + offset, 0, SCALE * scaling ) love.graphics.draw( image, x + (cardWidth * SCALE * scaling) - offset, y + (cardHeight * SCALE * scaling) - offset, 0, -1 * SCALE * scaling) end if card then if not card.flipped then drawFilledImages(images.card_face_down, images.card_filled, x, y, scaling * SCALE) else drawFilledImages(images.card, images.card_filled, x, y, scaling * SCALE) drawCorner(images[card.rank], 8 * SCALE) end end end local function drawScore(pScore,posX, align, player) local scoreSpacingY = (FONT_SIZE + 4) * SCALE local scoreMarginY = 35 * SCALE love.graphics.setColor(BLACK) for i=1,10 do y = (i * scoreSpacingY + scoreMarginY) if (i == 1) then love.graphics.printf(player or "CPU",posX,y,110 * SCALE, align) else playerS = pScore[i-1] or " " love.graphics.printf(playerS,posX,y,110 * SCALE, align) end end end local function drawCardBoard(board, marginX) local cardSpacingX = (8 + cardWidth) * SCALE local cardSpacingY = (4 + cardHeight) * SCALE local marginY = 43.5 * SCALE for i, card in ipairs(board) do local margeX = marginX * SCALE drawCard( card, (math.floor(i/4) * cardSpacingX) + margeX, (((i-1)%3) * cardSpacingY) + marginY) end end drawCardBoard(playerBoard, 29) drawCardBoard(npcBoard, 582) -- Score drawing local scoreMarginX = 224 drawScore(playerScore, scoreMarginX * SCALE, "left", "YOU") drawScore(cpuScore, (scoreMarginX + 242) * SCALE, "right") -- Pile, Discard and holding card local middleMarginY = 206 * SCALE local deckPosX = 296 * SCALE if #deck > 0 then drawCard( {flipped = false}, deckPosX, middleMarginY) else love.graphics.setColor(BLACK) love.graphics.draw(images.deck_empty, deckPosX, middleMarginY, 0, SCALE, SCALE) end drawCard( discardPile[#discardPile], 417.5 * SCALE, middleMarginY) if (drawnCard[#drawnCard]) then drawCard( drawnCard[#drawnCard], 331.66 * SCALE, 106 * SCALE, 1.61) end -- Hand Selector handX = INDEX_COORDS[selected_index].x * SCALE handY = INDEX_COORDS[selected_index].y * SCALE drawFilledImages(images.hand, images.hand_filled, handX, handY, SCALE) -- Selected element logic if selected_index == 7 then local cardsLeft = #deck love.graphics.printf(cardsLeft,315 * SCALE, 344 * SCALE,50 * SCALE, "center") end displayMessage() end function love.keypressed(key) local function handleCPUTurn() -- TODO: Add sleep between each step -- Gathering information nonFlippedCardsIndexes = helpers.nonFlippedCards(npcBoard) topDiscardPile = discardPile[#discardPile] optimalIndex = helpers.defineBestAction(npcBoard ,topDiscardPile, #nonFlippedCardsIndexes) if (#nonFlippedCardsIndexes <= 1 or roundOver) then -- TODO: If score is much lower than the player, it should end turn if (optimalIndex == -1) then -- The discard pile isn't good takeCard(drawnCard,true) potentialIndex = helpers.defineBestAction(npcBoard ,drawnCard[#drawnCard], 0) indexToFlip = potentialIndex else table.insert( drawnCard, table.remove(discardPile,#discardPile)) indexToFlip = optimalIndex end if (indexToFlip == -1) then -- We have nothing good to flip, should discard draw card and end turn if roundOver then -- Better flip a card than nothing indexToFlip = nonFlippedCardsIndexes[love.math.random(#nonFlippedCardsIndexes)] npcBoard[indexToFlip].flipped = true end table.insert( discardPile , table.remove(drawnCard,#drawnCard)) else -- We have something good to flip npcBoard[indexToFlip].flipped = true table.insert( discardPile , table.remove(npcBoard,indexToFlip)) table.insert( npcBoard, indexToFlip, table.remove(drawnCard,#drawnCard) ) npcBoard[indexToFlip].flipped = true end else if (optimalIndex ~= -1) then indexToFlip = optimalIndex table.insert( drawnCard, table.remove(discardPile,#discardPile)) npcBoard[indexToFlip].flipped = true table.insert( discardPile , table.remove(npcBoard,indexToFlip)) table.insert( npcBoard, indexToFlip, table.remove(drawnCard,#drawnCard) ) else indexToFlip = nonFlippedCardsIndexes[love.math.random(#nonFlippedCardsIndexes)] end npcBoard[indexToFlip].flipped = true end playerTurn = true end local function handlePlayerAction(pKey) if pKey == 'x' then resetMessage() if #drawnCard > 0 then if helpers.hasValue({1,2,3,4,5,6},selected_index) then -- Replacing card on board table.insert( discardPile , table.remove(playerBoard,selected_index)) discardPile[#discardPile].flipped = true table.insert( playerBoard, selected_index, table.remove(drawnCard,#drawnCard) ) else table.insert( discardPile , table.remove(drawnCard,#drawnCard)) end playerTurn = false final_turn = false else -- flipping card on board if helpers.hasValue({1,2,3,4,5,6},selected_index) then if (playerBoard[selected_index].flipped) then pushTextToMessage("Already flipped, pick another card.") else playerBoard[selected_index].flipped = true playerTurn = false final_turn = false end else -- Drawing discard or pile if selected_index == 7 then takeCard(drawnCard,true) else table.insert( drawnCard, table.remove(discardPile,#discardPile)) end pushTextToMessage("Select a card to be replaced by this card, or discard it by clicking it.") end end selected_index = helpers.fixIndex(drawnCard,selected_index) end end local function handleMessageBox(pKey) if pKey == 'z' then if #currentMessage > 0 then table.remove( currentMessage,1 ) end end end handleMessageBox(key) if not gameOver then selected_index = helpers.handleArrowSelection(key, selected_index) if playerTurn then handlePlayerAction(key) end if not (playerTurn or roundOver) then roundOver = helpers.isRoundOver(playerBoard) handleCPUTurn() end if roundOver and not final_turn then roundIsOver() end roundOver = helpers.isRoundOver(npcBoard) if roundOver then if not final_turn and not helpers.isRoundOver(playerBoard) then pushTextToMessage("CPU finished, this is your final turn") end final_turn = true end else if key == "escape" then love.event.quit() elseif key == "x" then resetGame() end end end
function setmetatables(t,mts) --takes a table and a list of metatables return setmetatable(t,{__index = function(self, k) --collisions are resolved in this implementation by simply taking the first one that comes along. for i, mt in ipairs(mts) do local member = mt[k] if member then return member end end end}) end camera = {} mobilephone = {} cameraphone = setemetatables({},{camera,mobilephone})
test_run = require('test_run').new() engine = test_run:get_cfg('engine') box.execute('pragma sql_default_engine=\''..engine..'\'') -- box.cfg() -- create space box.execute("CREATE TABLE zzoobar (c1 NUMBER, c2 INT PRIMARY KEY, c3 TEXT, c4 NUMBER)") box.execute("CREATE UNIQUE INDEX zoobar2 ON zzoobar(c1, c4)") box.execute("CREATE INDEX zoobar3 ON zzoobar(c3)") -- Debug -- box.execute("PRAGMA vdbe_debug=ON ; INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)") -- Dummy entry box.execute("INSERT INTO zzoobar VALUES (111, 222, 'c3', 444)") box.execute("DROP INDEX zoobar2 ON zzoobar") box.execute("DROP INDEX zoobar3 On zzoobar") -- zoobar2 is dropped - should be OK box.execute("INSERT INTO zzoobar VALUES (111, 223, 'c3', 444)") -- zoobar2 was dropped. Re-creation should be OK box.execute("CREATE INDEX zoobar2 ON zzoobar(c3)") -- Cleanup box.execute("DROP INDEX zoobar2 ON zzoobar") box.execute("DROP TABLE zzoobar") -- Debug -- require("console").start()
-- Writer lock release script. -- This scripts checks if the lock was acquired by the same owner and then releases it. -- KEYS = [GLOB_LOCK_KEY] -- ARGV = [TOKEN] -- check that global lock is ours if redis.call("GET", KEYS[1]) == ARGV[1] then -- release global lock redis.call("DEL", KEYS[1]) -- success return 1 else -- failed to release global lock return 0 end
-- RP Tags -- by Oraibi, Moon Guard (US) server -- ------------------------------------------------------------------------------ -- This work is licensed under the Creative Commons Attribution 4.0 International -- (CC BY 4.0) license. local RPTAGS = RPTAGS; RPTAGS.queue:WaitUntil("UTILS_MODULES", function(self, event, ...) RPTAGS.cache.Plugins = RPTAGS.cache.Plugins or {}; local function addOptions(addOnName, location, options) local pluginsCache = RPTAGS.cache.Plugins; pluginsCache[location] = pluginsCache[location] or {}; pluginsCache[location][addOnName] = CopyTable(options); end; local function applyOptionsPlugins(optionsTable, pluginsCache) local function walk(otable, path) local curr; if type(path) == "string" then curr, path = path, nil; else curr = table.remove(path, 1); end; if not (otable and otable.args and otable.args[curr]) then return nil elseif not path or #path == 0 then return otable.args[curr] else return walk(otable.args[curr], path) end; end; pluginsCache = pluginsCache or RPTAGS.cache.Plugins; for location, plugins in pairs(pluginsCache) do local mountPoint = walk(optionsTable, { strsplit("%.", location) }) ; if mountPoint then mountPoint.plugins = plugins; end; end; return optionsTable; end; local function addOptionsPanel(panel, optionsTable) local order = RPTAGS.cache.options.optionsOrder; local insertPoint = RPTAGS.cache.options.optionsModulesInsert; table.insert(order, insertPoint, panel); RPTAGS.options[panel] = optionsTable; RPTAGS.cache.options.optionsModulesInsert = insertPoint + 1; end; local function getAddOnData(str) if type(str) ~= "string" then return nil, nil end; for category, categoryData in pairs(RPTAGS.cache.addOns) do if categoryData[str] then return categoryData[str], category end; end; return nil, nil end; local function registerAddOnFunction(addOn, funcType, func) local knownAddOn = type(addOn) == "string" and getAddOnData(addOn) or addOn; if not knownAddOn or type(knownAddOn) ~= "table" then print("[|cffff0000registerAddOnFunction|r] Unknown AddOn: " .. addon or "nil"); else knownAddOn.func = knownAddOn.func or {}; knownAddOn.func[funcType] = func; end; end; local function getAddOnFunction(addOn, funcName) if type(addOn) == "string" then addOn = getAddOnData(addOn); end; if addOn and addOn.func and addOn.func[funcName] and type(addOn.func[funcName]) == "function" then return addOn.func[funcName]; else return nil; end; end; local function runAddOnFunction(addOn, funcName, ...) local func = getAddOnFunction(addOn, funcName) if func then func(...) return true end; end; local function extendUtility(oldFuncList) for oldFuncName, newFunc in pairs(oldFuncList) do local category, funcName = strsplit("[%./]", oldFuncName); local oldFunc = RPTAGS.utils[category][funcName]; RPTAGS.utils[category][funcName] = function(...) return newFunc(unpack( { oldFunc(...) } )); -- ^ these ^ curly braces are necessary end; end; end; local function addSlashAlias(aka, param) -- This isn't a general add-a-slash-command function; it creates an -- alias for the RPTAGS slash command, such as if RP_UnitFrames wants -- its own command or something. -- local num = 1; -- find the next available slash command while _G["SLASH_RPTAGS" .. num] do num = num + 1 end; if type(param) == "string" then _G["SLASH_RPTAGS" .. num] = function(a) SlashCmdList["SLASH_RPTAGS"]("open " .. param .. "?" .. a) end; elseif type(param) == "function" then _G["SLASH_RPTAGS" .. num] = function(a) SlashCmdList["SLASH_RPTAGS"](param(a)) end; end; end; local function insertTagGroup(tagGroup, location) location = location or "before OUF"; local when, where = strsplit(" ", location); if not where then where = when; when = "after"; end; local data = RPTAGS.CONST.TAG_DATA; local position; for i, group in pairs(data) do if group.key == where then position = i; break; end; end; if position then table.insert(data, position + (when == "after" and 1 or 0), tagGroup) else data[position + 1] = tagGroup; end; end; RPTAGS.utils.modules = RPTAGS.utils.modules or {}; RPTAGS.utils.modules.registerFunction = registerAddOnFunction; RPTAGS.utils.modules.getFunction = getAddOnFunction; RPTAGS.utils.modules.runFunction = runAddOnFunction; RPTAGS.utils.modules.extend = extendUtility; RPTAGS.utils.modules.addOptions = addOptions; RPTAGS.utils.modules.addOptionsPanel = addOptionsPanel; RPTAGS.utils.modules.addSlashAlias = addSlashAlias; RPTAGS.utils.modules.getAddOn = getAddOnData; RPTAGS.utils.modules.plugOptions = applyOptionsPlugins; RPTAGS.utils.modules.insertTagGroup = insertTagGroup; end);
local oop = require 'src/oop' local lg = love.graphics local menu = oop.class() -- make a new menu function menu.manual_init (name, ...) local self = love.filesystem.load('menus/' .. name .. '.lua')() if self.init then self:init(...) end setmetatable(self, {__index = menu}) if self.bg_img then self.bg_image = lg.newImage('menus/' .. self.bg_img .. '.png') self.bg_img = nil end self.sel = 1 return self end function menu:update () local entry = self[self.sel] for _,button in ipairs(GAME.input.keys) do if GAME.input:hit(button) and entry[button] then entry[button](entry) return end end if GAME.input:hit'dd' then self.sel = self.sel % #self + 1 elseif GAME.input:hit'du' then self.sel = (self.sel-2) % #self + 1 end end function menu:draw () if self.bg_image then lg.draw(self.bg_image) else lg.clear(0,0,0) end for i,v in ipairs(self) do local y = self.y + i * self.spacing local drawtext = function () love.graphics.printf(v.text, 0, y, GAME.size.x, 'center') end if self.sel==i then lg.setColor(1.0, 100/256.0, 100/256.0) drawtext() lg.setColor(1.0, 1.0, 1.0) else drawtext() end end end return menu
local entity_meta = global_metatable( "entity" ) function GetEntityHandle( e ) if IsEntity( e ) then return e.handle end return e end function IsValid( e ) if type( e ) == "table" and e.IsValid then return e:IsValid() end return false end function IsEntity( e ) return type( e ) == "table" and type( e.handle ) == "number" end function Entity( handle ) if handle > 0 then return setmetatable( { handle = handle, type = "unknown" }, entity_meta ) end end function entity_meta:__unserialize( data ) self.handle = tonumber( data ) return self end function entity_meta:__serialize() return tostring( self.handle ) end function entity_meta:__tostring() return string.format( "Entity[%d]", self.handle ) end function entity_meta:GetType() return self.type end local IsHandleValid = IsHandleValid function entity_meta:IsValid() return IsHandleValid( self.handle ) end local SetTag = SetTag function entity_meta:SetTag( tag, value ) assert( self:IsValid() ) return SetTag( self.handle, tag, value ) end local RemoveTag = RemoveTag function entity_meta:RemoveTag( tag ) assert( self:IsValid() ) return RemoveTag( self.handle, tag ) end local HasTag = HasTag function entity_meta:HasTag( tag ) assert( self:IsValid() ) return HasTag( self.handle, tag ) end local GetTagValue = GetTagValue function entity_meta:GetTagValue( tag ) assert( self:IsValid() ) return GetTagValue( self.handle, tag ) end local GetDescription = GetDescription function entity_meta:GetDescription() assert( self:IsValid() ) return GetDescription( self.handle ) end local Delete = Delete function entity_meta:Delete() return Delete( self.handle ) end
--[[--ldoc desc @module LoginCtr @author %s Date %s ]] local ViewCtr = require("framework.scenes.ViewCtr"); local LoginCtr = class("LoginCtr",ViewCtr); ---配置事件监听函数 LoginCtr.s_eventFuncMap = { [g_CustomEvent.LOGIN_REGISTER] = "reqRegister"; [g_CustomEvent.LOGIN_LOGIN] = "reqLogin"; [g_CustomEvent.LOGIN_RPS_LOGIN] = "onLoginRps"; [g_CustomEvent.LOGIN_RPS_REGISTER] = "onRegisterRps" } function LoginCtr:ctor(scene) ViewCtr.ctor(self, scene); end function LoginCtr:reqRegister(data) local param = { Name = data[1], Password = data[2] } g_NetManager.getInstance():sendSocketMsg(g_GamePb.method.ReqRegister, param) end function LoginCtr:reqLogin(data) local param = { Name = data[1], Password = data[2] } g_NetManager.getInstance():sendSocketMsg(g_GamePb.method.ReqLogin, param) end function LoginCtr:onLoginRps(data) local result = getNumFromTable(data,"Result",g_ServerConfig.LOGIN_ERR.ERRLOGIN) if result == g_ServerConfig.LOGIN_ERR.LGOINSUCC then g_AccountInfo.getInstance():init(data) self:toHall() else self:processErr(result) end end function LoginCtr:onRegisterRps(data) local result = getNumFromTable(data,"Result",g_ServerConfig.LOGIN_ERR.ERRLOGIN) if result == g_ServerConfig.LOGIN_ERR.REGISTERSUCC then g_AccountInfo.getInstance():init(data) self:toHall() else self:processErr(result) end end function LoginCtr:processErr(err) if err == g_ServerConfig.LOGIN_ERR.ERRNULL then g_NoticePop.getInstance():setContent(GameString.get("str_noitce_title1"), GameString.get("str_login_error1")):show() elseif err == g_ServerConfig.LOGIN_ERR.ERRNOUSER or err == g_ServerConfig.LOGIN_ERR.ERRLOGIN then g_NoticePop.getInstance():setContent(GameString.get("str_noitce_title1"), GameString.get("str_login_error2")):show() elseif err == g_ServerConfig.LOGIN_ERR.ERRHAVEUSER then g_NoticePop.getInstance():setContent(GameString.get("str_noitce_title1"), GameString.get("str_login_error3")):show() elseif err == g_ServerConfig.LOGIN_ERR.ERRFORBID then g_NoticePop.getInstance():setContent(GameString.get("str_noitce_title1"), GameString.get("str_login_error6")):show() elseif err == g_ServerConfig.LOGIN_ERR.ERRSHORT then g_NoticePop.getInstance():setContent(GameString.get("str_noitce_title1"), GameString.get("str_login_error5")):show() end end function LoginCtr:toHall() local hallScene = require("app.scenes.hall.HallScene") cc.Director:getInstance():replaceScene(hallScene:create()) end function LoginCtr:onEnter() g_NetManager.getInstance():openGameSocket() end function LoginCtr:onExit() -- do something --[[ 退出当前场景时会被调用 和onEnter方法相对应 该方法可以理解为公司引擎:pause方法 不用可删除 ]] end function LoginCtr:onCleanup() -- 如果子类复写父类onCleanup()方法且不调用ViewCtr.onCleanup(self)请加上这个变量赋值,用于网络请求判断该对象是否还需要回调 -- self._isCleanup = true ViewCtr.onCleanup(self); --[[ 场景销毁前会被调用 资源销毁相关代码可以放置于该方法内。 不用可删除 ]] end return LoginCtr;
--[[ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth <steven@midlink.org> Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 $Id$ ]]-- local dpt = require "luci.dispatcher" local product = require "luci.product" local section_cfg = {} local loop = 1 if product.verifyFeature('SYSTEM_MGMT', 'INTERFACE') then section_cfg[loop] = {name="interface", tag="Interface", note="", multiple=false, addremove=false} loop = loop + 1 end if product.verifyFeature('SYSTEM_MGMT', 'INTERFACE_LIST') then section_cfg[loop] = {name="interface-list", tag="Interfaces", note="", multiple=true, addremove=false} loop = loop + 1 end if product.verifyFeature('SYSTEM_MGMT', 'CLI_SESSION') then section_cfg[loop] = {name=ROOTNODE, tag="CLI Session", note="", multiple=false, addremove=false} loop = loop + 1 else section_cfg[loop] = {name=ROOTNODE, tag="", note="", multiple=false, addremove=false} loop = loop + 1 end if product.verifyFeature('SYSTEM_MGMT', 'PERMIT_LIST') then section_cfg[loop] = {name="permit-list", tag="Permitted IP List", note="", multiple=true, addremove=true} loop = loop + 1 end if product.verifyFeature('SYSTEM_MGMT', 'VRF_LIST') then section_cfg[loop] = {name="vrf-list", tag="VRF List", note="", multiple=true, addremove=true} loop = loop + 1 end if product.verifyFeature('SYSTEM_MGMT', 'VRF_PROCESS_LIST') then section_cfg[loop] = {name="vrf-process-list", tag="VRF Process List", note="", multiple=true, addremove=true} loop = loop + 1 end if product.verifyFeature('SYSTEM_MGMT', 'ROUTE_LIST') then section_cfg[loop] = {name="route-list", tag="Route List", note="", multiple=true, addremove=true} loop = loop + 1 end if product.verifyFeature('SYSTEM_MGMT', 'ADDRESS_LIST') then section_cfg[loop] = {name="address-list", tag="Address List", note="", multiple=true, addremove=true} loop = loop + 1 end if product.verifyFeature('SYSTEM_MGMT', 'DNS') then section_cfg[loop] = {name="dns", tag="DNS Server", note="", multiple=true, addremove=true} loop = loop + 1 end --[[ initial mdForm ]]-- mdForm = MdForm("mgmt", "/config/system/mgmt", PRIVILEGE_SUPER, section_cfg, translate("Management Interface Configuration")) mdForm:prepare_all() --[[ interface config ]]-- if product.verifyFeature('SYSTEM_MGMT', 'INTERFACE') then interfaceConfig = mdForm:get_section_obj("interface") interfaceConfig:option(TfFlag, "state", translate("Enabled")) interfaceConfig:option(DummyValue, "mac", translate("MAC address")) ip = interfaceConfig:option(Value, "ip-address", translate("IP Address")) ip.datatype = 'ip4addr' ip:depends({state="true"}) mask = interfaceConfig:option(Value, "ip-mask", translate("Mask")) mask.datatype = 'ip4addr' mask:depends({state="true"}) gw = interfaceConfig:option(Value, "ip-default-gateway", translate("Gateway")) gw.datatype = 'ip4addr' gw:depends({state="true"}) end --[[ permit state and session-timeout ]]-- rootConfig = mdForm:get_section_obj(ROOTNODE) if product.verifyFeature('SYSTEM_MGMT', 'CLI_SESSION') then rootConfig:option(Value, "session-exp-time", translate("CLI Session Timeout"), translate("sec, 0 means disable")).datatype = 'uinteger' end if product.verifyFeature('SYSTEM_MGMT', 'PERMIT_LIST') then rootConfig:option(TfFlag, "permit-enabled", translate("Permitted IP")) --[[ permit list ]]-- permitList = mdForm:get_section_obj("permit-list") permitList.template = "cbi/tblsection" permitList.sectionhead = translate("IP") permitList.keydesc = translate("IP: IPv4 Address") permitList.keydatatype = "ip4addr" mask = permitList:option(Value, "mask", translate("Mask")) mask.datatype = "ip4addr" mask.default = "255.255.255.255" end if product.verifyFeature('SYSTEM_MGMT', 'INTERFACE_LIST') then interfaceList = mdForm:get_section_obj("interface-list") interfaceList.template = "cbi/tsection" interfaceList.sectionhead = translate("Interface") interfaceList:option(Value, 'desc', translate("Interface Description")) interfaceList:option(TfFlag, 'state', translate("Current State")) local vrf_ret, vrf_list = mgmtdclient.query_child("/config/system/mgmt/vrf-list") masterList = interfaceList:option(ListValue, 'master', translate("Master")) masterList:value('', '--') if vrf_ret == 'OK' then if vrf_list ~= nil then if type(vrf_list) == 'table' then for v in pairs(vrf_list) do masterList:value(v, v) end end end end interfaceList:option(Value, 'mtu', translate("Interface MTU")) interfaceList:option(Value, 'vlan', translate("VLAN")) interfaceList:option(TfFlag, 'dhcp-sendname', translate("DHCP Send Hostname")) interfaceList:option(TfFlag, 'ipv4-enabled', translate("IPv4 Enabled")) originIpv4 = interfaceList:option(ListValue, 'ipv4-origin', translate("IPv4 Origin")) originIpv4:value('static', 'Static IP') originIpv4:value('dhcp', 'DHCP') addressIpv4 = interfaceList:option(Value, 'ipv4-address', translate("IPv4 Address")) addressIpv4:depends({["ipv4-origin"] = "static"}) prefixIpv4 = interfaceList:option(Value, 'ipv4-prefix', translate("IPv4 Prefix")) prefixIpv4:depends({["ipv4-origin"] = "static"}) --gatewayIpv4 = interfaceList:option(Value, 'ipv4-default-gateway', translate("IPv4 Gateway")) --gatewayIpv4:depends({["ipv4-origin"] = "static"}) --dhcpnameIpv4 = interfaceList:option(Value, 'ipv4-dhcpname', translate("IPv4 DHCP")) --dhcpnameIpv4:depends({["ipv4-origin"] = "dhcp"}) interfaceList:option(TfFlag, 'ipv6-enabled', translate("IPv6 Enabled")) originIpv6 = interfaceList:option(ListValue, 'ipv6-origin', translate("IPv6 Origin")) originIpv6:value('static', 'Static IP') originIpv6:value('dhcp', 'DHCP') addressIpv6 = interfaceList:option(Value, 'ipv6-address', translate("IPv6 Address")) --addressIpv6.datatype = 'ipv6addr' addressIpv6:depends({["ipv6-origin"] = "static"}) prefixIpv6 = interfaceList:option(Value, 'ipv6-prefix', translate("IPv6 Prefix")) prefixIpv6:depends({["ipv6-origin"] = "static"}) end --gatewayIpv6 = interfaceList:option(Value, 'ipv6-default-gateway', translate("IPv6 Gateway")) --gatewayIpv6.datatype = 'ipv6addr' --gatewayIpv6:depends({["ipv6-origin"] = "static"}) --dhcpnameIpv6 = interfaceList:option(Value, 'ipv6-dhcpname', translate("IPv6 DHCP")) --dhcpnameIpv6:depends({["ipv6-origin"] = "dhcp"}) --[[ permit state and session-timeout rootConfig = mdForm:get_section_obj(ROOTNODE) rootConfig:option(Value, "session-exp-time", translate("CLI Session Timeout"), translate("sec, 0 means disable")).datatype = 'uinteger' ]]-- if product.verifyFeature('SYSTEM_MGMT', 'VRF_LIST') then vrf = mdForm:get_section_obj("vrf-list") vrf.template = "cbi/tblsection" vrf.sectionhead = translate("VRF Name") vrf:option(Value, 'table', translate("Table")).datatype = "uinteger" vrfState = vrf:option(TfFlag, 'state', translate("State")) vrfState.readonly = true vrfState.default = "true" local vrf_list = {} local base = 0 for seg, seg_v in pairs(mdForm.curr_data["vrf-list"]) do vrf_list[seg] = seg_v base = base + 1 end routeList = mdForm:section(Table, vrf_list, translate("")) routeList.config = 'vrf-id' end if product.verifyFeature('SYSTEM_MGMT', 'VRF_PROCESS_LIST') then vrfprocess = mdForm:get_section_obj("vrf-process-list") vrfprocess.template = "cbi/tblsection" vrfprocess.sectionhead = translate("VRF Process Name") process = vrfprocess:option(ListValue, 'process', translate("Process")) process:value('ipsec', 'ipsec') process:value('netconf', 'netconf') process:value('ssh', 'ssh') process:value('web', 'web') process:value('dying-gasp', 'dying-gasp') process:value('ntp', 'ntp') process:value('syslog', 'syslog') process:value('phonehome', 'phonehome') local vrf_ret, vrf_list = mgmtdclient.query_child("/config/system/mgmt/vrf-list") vrfList = vrfprocess:option(ListValue, 'vrf', translate("VRF")) vrfList:value('', '--') if vrf_ret == 'OK' then if vrf_list ~= nil then if type(vrf_list) == 'table' then for v in pairs(vrf_list) do vrfList:value(v, v) end end end end end --vrfprocess:option(Value, 'binding-address', translate("Binding Address")) if product.verifyFeature('SYSTEM_MGMT', 'ROUTE_LIST') then route = mdForm:get_section_obj("route-list") route.template = "cbi/tblsection" route.sectionhead = translate("Route Name") route:option(Value, 'dest', translate("Destination")) route:option(Value, 'via', translate("Via Address")) route:option(Value, 'table', translate("Table")) route:option(Value, 'dev', translate("Device")) local route_list = {} local base = 0 for seg, seg_v in pairs(mdForm.curr_data["route-list"]) do route_list[seg] = seg_v base = base + 1 end routeList = mdForm:section(Table, route_list, translate("")) routeList.config = 'route-id' end if product.verifyFeature('SYSTEM_MGMT', 'ADDRESS_LIST') then address = mdForm:get_section_obj("address-list") address.template = "cbi/tblsection" address.sectionhead = translate("Address Name") address:option(Value, 'address', translate("IP address")).datatype = 'ip4addr' address:option(Value, 'prefix', translate("Prefix length")) address:option(Value, 'interface', translate("Interface name")) local address_list = {} local base = 0 for seg, seg_v in pairs(mdForm.curr_data["address-list"]) do address_list[seg] = seg_v base = base + 1 end addressList = mdForm:section(Table, address_list, translate("")) addressList.config = 'address-id' end --[[ DNS server ]]-- if product.verifyFeature('SYSTEM_MGMT', 'DNS') then dns = mdForm:get_section_obj("dns") dns.template = "cbi/tblsection" dns.sectionhead = translate("IP") dns.keydesc = translate("IP: IPv4 Address") dns.keydatatype = "ip4addr" end mdForm.template = "admin/system_mgmt_mdform" return mdForm
local pin1 = 1 local pin2 = 2 local pin3 = 5 local pin4 = 6 local pin5 = 7 gpio.mode(pin1, gpio.INPUT) gpio.mode(pin2, gpio.INPUT) gpio.mode(pin3, gpio.INPUT) gpio.mode(pin4, gpio.INPUT) gpio.mode(pin5, gpio.INPUT) tmr.alarm(1,1000,1,function() print('1 ft:') print(gpio.read(pin1)) print('2 ft:') print(gpio.read(pin2)) print('3 ft:') print(gpio.read(pin3)) print('4 ft:') print(gpio.read(pin4)) print('5 ft:') print(gpio.read(pin5)) end)
require "oil" local function returnexception(proxy, exception, operation) if operation.name == "read" and exception[1] == "IDL:Control/AccessError:1.0" then return nil, exception.reason end error(exception) end oil.main(function() local orb = oil.init() local Server local success, exception = oil.pcall(function() Server = orb:newproxy(oil.readfrom("ref.ior")) print("Value of 'a_number' is ", Server:read("a_number")._anyval) Server:write("a_number", "bad value") end) if not success then if exception[1] == "IDL:Control/AccessError:1.0" then print(string.format("Got error: %s '%s'", exception.reason, exception.tagname)) else print("Got unkown exception:", exception[1]) end end orb:setexcatch(returnexception, "Control::Server") local success, exception = oil.pcall(function() local value, errmsg = Server:read("unknown") if value then print("Value of 'unknown' is ", value._anyval) else print("Error on 'unknown' access:", errmsg) end Server:write("unknown", 1234) end) if not success then if exception[1] == "IDL:Control/AccessError:1.0" then print(string.format("Got error: %s '%s'", exception.reason, exception.tagname)) else print("Got unkown exception:", exception[1]) end end end)
local a, b, c c = false -- boolean c = {1, 2, 3} -- table c = "hello" -- string a = 3.14 -- number b = a print(type(nil)) --> nil print(type(true)) --> boolean print(type(3.14)) --> number print(type("Hello world")) --> string print(type({})) --> table print(type(print)) --> function print(type(coroutine.create(print))) --> thread print(type(io.stdin)) --> userdata
--{nodes = {{frames = {{{0,1.0},{1,2.0},{2,3.0},{3,4.0},{4,10.0}},{{0,10.9},{1,13.0},{2,2.8}},{{0,20.8},{1,24.0},{2,2.6}},{{0,30.7},{1,35.0},{2,2.4}},{{0,40.6},{1,46.0},{2,2.2}},{{0,50.5},{1,57.0},{2,2.0}},{{0,60.4},{1,68.0},{2,1.8}},{{0,70.3},{1,79.0},{2,1.6}},{{0,80.2},{1,90.0},{2,1.4}},{{0,90.1},{1,101.0},{2,1.2}},{{0,100.0},{1,112.0},{2,1.0}},{{0,92.0},{1,123.0}},{{0,84.0},{1,134.0}},{{0,76.0},{1,145.0}},{{0,68.0},{1,156.0}},{{0,60.0},{1,167.0}},{{0,52.0},{1,178.0}},{{0,44.0},{1,189.0}},{{0,36.0},{1,200.0}},{{0,28.0},{1,211.0}}},type = "atl_node",idx = 1.0}},t = 10,name = "내애니메이션"} require("PiniAPI") local AnimMgr = { } if OnPreview then else local Utils = require("plua.utils") function FAL_REGIST(json) return Utils.FAL_registAnimation(json) end function FAL_GETFRAME(idx,node,frame,nodename,hash) return Utils.FAL_getFrame(idx,node,frame,nodename,hash) end function FAL_GETVALUE(frame,key) return Utils.FAL_getNumberVal(frame,key) end function FAL_GETSTRVALUE(frame,key) return Utils.FAL_getStringVal(frame,key) end function FAL_ISVALUE(frame,key) return Utils.FAL_isValue(frame,key) end function FAL_DELETEFRAME(frame) return Utils.FAL_deleteFrame(frame) end function FAL_MAXFRAME(idx,node) return Utils.FAL_getMaxFrame(idx,node) end function FAL_ISEXISTS(idx) return Utils.FAL_isExists(idx) end function FAL_NUMNODE(idx) return Utils.FAL_numNode(idx) end function FAL_REGISTSTRINGVALUE(node,idx,value) return Utils.FAL_registStringValue(node,idx,value) end function FAL_REGISTNUMBERVALUE(node,idx,value) return Utils.FAL_registNumberValue(node,idx,value) end function FAL_DELETENODEVALUE(node) return Utils.FAL_deleteNodeValue(node) end function FAL_CLEARFRAME() return Utils.FAL_clearFrame() end end --[[ "위치X", 0 "위치Y", 1 "크기X", 2 "크기Y", 3 "회전", 4 "색상R", 5 "색상G", 6 "색상B", 7 "색상A", 8 "매크로", 9 "루아", 10 "이미지", 11 ]] function AnimMgr:init(xvm) self.XVM = xvm end function AnimMgr:clear() --self.anims={} end function AnimMgr:registAnimation(animation) FAL_REGIST(animation["json"]) end function AnimMgr:interpolation(t,o1,o2) return ( 1 - t )*o1 + t*o2,2 end AnimMgr.animUpdate = function(t) if AnimMgr == nil then AnimMgr = _G.AnimMgr end local per = 1 local delta = t.userdata.delta local curFrame = t.userdata.curFrame local loopCnt = t.userdata.loopCnt local dt = t.userdata.dt local i = t.userdata.i local max = t.userdata.max local node = pini:FindNode(t.userdata.nodeId) local default = t.userdata.default local name = t.userdata.name local args = t.userdata.args local isSkipCurrentFrame = false if node == nil then FAL_DELETENODEVALUE(t.userdata.nodeId) t:stop() return end delta = delta + t.dt if dt ~= 0 then per = delta / dt if per > 1 then per = 1 end end AnimMgr:adjustFrame(name,i,curFrame,per,node,default,args,false) if delta >= dt then AnimMgr:adjustFrame(name,i,curFrame,1,node,default,args,true) delta = delta - dt curFrame = curFrame+1 if curFrame >= max then if loopCnt then loopCnt = loopCnt - 1 if loopCnt <= 0 then FAL_DELETENODEVALUE(t.userdata.nodeId) t:stop() if t.userdata.callback then t.userdata.callback() end return else isSkipCurrentFrame = true end else isSkipCurrentFrame = true end curFrame = 0 delta = 0 AnimMgr:adjustFrame(name,i,max,1,node,default,args,true) end end t.userdata.delta = delta t.userdata.curFrame = curFrame t.userdata.loopCnt = loopCnt if isSkipCurrentFrame then t.userdata.delta = t.userdata.delta + dt AnimMgr.animUpdate(t) end end function AnimMgr:run(name,i,start,_end,dt,loopCnt,node,args,callback) -- name : idx -- i : key if node then x,y = node:position() local default = { x = x, y = y } local max if _end == nil then max = FAL_MAXFRAME(name,i) else max = _end end if OnPreview then local frames = FAL_MARKEDFRAMES(name,i); AnimMgr:adjustFrame(name,i,start,1,node,default,args,false) for k,v in python.enumerate(frames) do if v > start then AnimMgr:adjustFrame(name,i,v,1,node,default,args,false) end end FAL_DELETENODEVALUE(node.id) else local userdata = { curFrame=start, delta=0, dt=dt, i=i, max=max, nodeId=node.id, default=default, loopCnt=loopCnt, name = name, args = args, callback = callback } local timer = pini:FindTimer(node.id.."_ATL_TIMER") if timer then timer:stop(); end AnimMgr.animUpdate({dt=0,userdata=userdata}) pini.Timer(node.id.."_ATL_TIMER",0,AnimMgr.animUpdate,true,nil,userdata):run() node:registOnExit("PINI_ANIM_MGR",function(n) local timer = pini:FindTimer(n.id.."_ATL_TIMER") if timer then FAL_DELETENODEVALUE(n.id) timer:stop() end end) end end end function AnimMgr:adjustFrame(idx,key,fn,persent,node,default,args,justInterval) -- idx = animation name -- key = node number if node.isDestroyed then return end local propMax = 11 if justInterval == true then propMax = propMax-3 end local fd1 = FAL_GETFRAME(idx,key,fn-1,node.id,args) local fd2 = FAL_GETFRAME(idx,key,fn,node.id,args) for i=0,propMax,1 do if FAL_ISVALUE(fd2,i) then local value = nil local values = nil local valuel = nil if i < 9 then local value2, value2s, value2l = FAL_GETVALUE(fd2,i) if OnPreview then value2, value2s, value2l = value2[0], value2[1], value2[2] end local value1, value1s, value1l = value2, value2s, value1l if FAL_ISVALUE(fd1,i) then value1, value1s, value1l = FAL_GETVALUE(fd1,i) if OnPreview then value1, value1s, value1l = value1[0], value1[1], value1[2] end end value = self:interpolation(persent,value1,value2) values = self:interpolation(persent,value1s,value2s) valuel = self:interpolation(persent,value1l,value2l) else if persent >= 1 then value = FAL_GETSTRVALUE(fd2,i) end end if value then if i == 0 then node:setPositionX(default.x * valuel + value + values) elseif i == 1 then node:setPositionY(default.y * valuel + value + values) elseif i == 2 then node:setScaleX(value) elseif i == 3 then node:setScaleY(value) elseif i == 4 then node:setRotate(value) elseif i == 5 then local c = node:getColor() node:setColor(value,c[2],c[3]) elseif i == 6 then local c = node:getColor() node:setColor(c[1],value,c[3]) elseif i == 7 then local c = node:getColor() node:setColor(c[1],c[2],value) elseif i == 8 then node:setOpacity(value) elseif i == 9 then --macro if persent >= 1 then _LNXG["FAL.노드이름"] = node.id if not OnPreview and value ~= "" then self.XVM:call(value) end end elseif i == 10 then --lua if persent >= 1 then _G[value]() end elseif i == 11 then --image if persent >= 1 then if node.type == "Sprite" then node:setSprite(value) end end end end end end end function AnimMgr:maxFrame(idx,key) return FAL_MAXFRAME(idx,key) end function AnimMgr:isAnim(idx) return FAL_ISEXISTS(idx) end function AnimMgr:numNode(idx) return FAL_NUMNODE(idx) end function AnimMgr:forceFinalNodeAndStop(node) local t = pini:FindTimer(node.id.."_ATL_TIMER") if t then local curFrame = t.userdata.curFrame local i = t.userdata.i local max = t.userdata.max local default = t.userdata.default local name = t.userdata.name local args = t.userdata.args t:stop() while curFrame <= max do AnimMgr:adjustFrame(name,i,curFrame,1,node,default,args,false) curFrame = curFrame + 1 end if t.userdata.callback then t.userdata.callback() end node:unregistOnExit("PINI_ANIM_MGR") end end function AnimMgr:stop(node) local t = pini:FindTimer(node.id.."_ATL_TIMER") if t then t:stop() node:unregistOnExit("PINI_ANIM_MGR") end end function AnimMgr:registArgument(node,idx,value) if type(value) == "number" then return FAL_REGISTNUMBERVALUE(node,idx,value) else return FAL_REGISTSTRINGVALUE(node,idx,value) end end return AnimMgr
local vdom = require('vdom') function pick(src, ...) local rv = {} for _,k in ipairs({...}) do rv[k] = src[k] end return rv end return function(props) local panelprops = pick(props, 'height', 'width', 'left', 'right', 'bottom', 'top', 'halign', 'valign') panelprops.on_click = vdom.useCallback(function(widget, pos) focus_widget(widget) end, {}) panelprops.on_textinput = vdom.useCallback(function(widget, text) props.on_change(props.value .. text) end, { props.on_change, props.value }) panelprops.on_keydown = vdom.useCallback(function(widget, keyname) if keyname == 'Backspace' then props.on_change(string.sub(props.value, 1, -2)) return true end return false end, { props.on_change, props.value }) return vdom.create_element('panel', panelprops, vdom.create_element('label', { height=props.height, text=props.value }) ) end
-- Copyright (c) 2011-2015 Rob Hoelz <rob@hoelz.ro> -- -- Permission is hereby granted, free of charge, to any person obtaining a copy of -- this software and associated documentation files (the "Software"), to deal in -- the Software without restriction, including without limitation the rights to -- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -- the Software, and to permit persons to whom the Software is furnished to do so, -- subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- A plugin that runs code in $HOME/.rep.lua before the REPL starts local setfenv = require('repl.utils').setfenv local function readable(filename) local f = io.open(filename, 'r') if not f then return false end f:close() return true end local function init() local home = os.getenv 'HOME' if not home then return end local rcfile = home .. '/.rep.lua' if not readable(rcfile) then return end local chunk = assert(loadfile(rcfile)) local env = setmetatable({ repl = repl }, { __index = _G, __newindex = _G }) setfenv(chunk, env) chunk() return true end return init()
local E, L, DF = unpack(ElvUI) if E.db["euiscript"].priestpet ~= true then return end if E.myclass ~= "PRIEST" then return end local CUSTOM_CLASS_COLORS, RAID_CLASS_COLORS = CUSTOM_CLASS_COLORS, RAID_CLASS_COLORS local GetSpellInfo = GetSpellInfo local spellname = GetSpellInfo(34433) local spellname2 = GetSpellInfo(123040) local sformat = string.format local floor = math.floor local timer = 0 local bars = {} local addon = CreateFrame("Frame", "EuiPriestPet", E.UIParent) local PRIESTAnchor = CreateFrame("Frame", "PRIESTAnchor", E.UIParent) PRIESTAnchor:Point("TOPLEFT", Minimap, "BOTTOMLEFT", 0, -68) PRIESTAnchor:SetSize(E.db["euiscript"].priestpet_width, E.db["euiscript"].priestpet_height) E:CreateMover(PRIESTAnchor, "PRIESTAnchorMover", spellname, nil, nil, nil, "ALL,EUI", nil, "euiscript") local FormatTime = function(time) if time >= 60 then return sformat("%.2d:%.2d", floor(time / 60), time % 60) else return sformat("%.2d", time) end end local CreateFS = function(frame, fsize, fstyle) local fstring = frame:CreateFontString(nil, "OVERLAY") fstring:FontTemplate(nil, E.db.general.fontSize, 'OUTLINE') return fstring end local StopTimer = function(bar) bar:SetScript("OnUpdate", nil) bar:Hide() tremove(bars, bar.id) end local BarUpdate = function(self, elapsed) local curTime = GetTime() if self.endTime < curTime then StopTimer(self) return end self:SetValue(100 - (curTime - self.startTime) / (self.endTime - self.startTime) * 100) self.right:SetText(FormatTime(self.endTime - curTime)) end local OnMouseDown = function(self, button) if button == "RightButton" then StopTimer(self) end end local CreateBar = function() local bar = CreateFrame("Statusbar", nil, E.UIParent) bar:SetFrameStrata("LOW") bar:Size(E.db["euiscript"].priestpet_width - E.db["euiscript"].priestpet_height - 6, E.db["euiscript"].priestpet_height) bar:SetStatusBarTexture(E["media"].normTex) bar:SetMinMaxValues(0, 100) bar.backdrop = CreateFrame("Frame", nil, bar) bar.backdrop:Point("TOPLEFT", -2, 2) bar.backdrop:Point("BOTTOMRIGHT", 2, -2) bar.backdrop:SetTemplate() bar.backdrop:SetFrameStrata("BACKGROUND") if E.db.general.transparent and E.db.general.transparentStyle == 1 then bar.backdrop:SetAlpha(E.db.general.backdropfadecolor.a or 0.4) end bar.bg = bar:CreateTexture(nil, "BACKGROUND") bar.bg:SetAllPoints(bar) bar.bg:SetTexture(E["media"].glossTex) bar.left = CreateFS(bar) bar.left:Point("LEFT", 2, 0) bar.left:SetJustifyH("LEFT") bar.left:Size(E.db["euiscript"].priestpet_width - E.db["euiscript"].priestpet_height, E.db["euiscript"].priestpet_height) bar.right = CreateFS(bar) bar.right:Point("RIGHT", 1, 0) bar.right:SetJustifyH("RIGHT") bar.icon = CreateFrame("Button", nil, bar) bar.icon:Size(E.db["euiscript"].priestpet_height) bar.icon:Point("BOTTOMRIGHT", bar, "BOTTOMLEFT", -6, 0) bar.icon.backdrop = CreateFrame("Frame", nil, bar.icon) bar.icon.backdrop:Point("TOPLEFT", -2, 2) bar.icon.backdrop:Point("BOTTOMRIGHT", 2, -2) bar.icon.backdrop:SetTemplate() bar.icon.backdrop:SetFrameStrata("BACKGROUND") return bar end local StartTimer = function(name, spellId) local bar = CreateBar() local spell = GetSpellInfo(spellId) local icon = GetSpellTexture(spellId) local dtime = 12 + (4.5 * E.db.euiscript.priestpet_lv) if spellId == 132604 then dtime = 15 + (1.5 * E.db.euiscript.priestpet_lv) end bar.endTime = GetTime() + dtime bar.startTime = GetTime() bar.left:SetText(name) bar.right:SetText(FormatTime(dtime)) bar.icon:SetNormalTexture(icon) bar.icon:GetNormalTexture():SetTexCoord(0.1, 0.9, 0.1, 0.9) bar.spell = spell bar:Show() local color = (CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass]) if color then bar:SetStatusBarColor(color.r, color.g, color.b) bar.bg:SetVertexColor(color.r, color.g, color.b, 0.25) else bar:SetStatusBarColor(0.3, 0.7, 0.3) bar.bg:SetVertexColor(0.3, 0.7, 0.3, 0.25) end bar:SetScript("OnUpdate", BarUpdate) bar:EnableMouse(true) bar:SetScript("OnMouseDown", OnMouseDown) tinsert(bars, bar) bar:SetAllPoints(PRIESTAnchor); end addon:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") addon:SetScript("OnEvent", function(self, ...) local _, eventType, _, _, sourceName, sourceFlags, _, _, spellName, _, _, spellId = CombatLogGetCurrentEventInfo() if sourceName ~= E.myname then return; end if eventType == "SPELL_SUMMON" and (spellName == spellname or spellName == spellname2) then StartTimer(spellName, spellId); end end)
local comb = require "snippy.parser.comb" local lazy = comb.lazy local many = comb.many local map = comb.map local one = comb.one local opt = comb.opt local pattern = comb.pattern local seq = comb.seq local skip = comb.skip local token = comb.token describe("Combinator tests", function () it("Should parse text", function () local text = skip('%.', '') local ok, result, pos = text('this is just text.', 1) assert.is_same( {ok, result, pos}, {true, {'this is just text', 'this is just text'}, 18} ) end) it("Should parse escaped text", function () local text = skip('[{}]', '') local ok, result, pos = text('my \\$var = 1', 1) assert.is_same( {ok, result, pos}, {true, {'my \\$var = 1', 'my $var = 1'}, 13} ) end) it("Should parse single caracter", function () local text = skip('[{}]', '') local ok, result, pos = text('x', 1) assert.is_same( {ok, result, pos}, {true, {'x', 'x'}, 2} ) end) it("Basic token", function () local tok = token('foo') local ok, result, pos = tok('foo', 1) assert.is_same({ok, result, pos}, {true, 'foo', 4}) end) it("Symbol token", function () local tok = token('$') local ok, result, pos = tok('${1}', 1) assert.is_same({ok, result, pos}, {true, '$', 2}) end) it("Invalid token", function () local tok = token('$') local ok, result, pos = tok('foo', 1) assert.is_same({ok, result, pos}, {false, nil, 1}) end) it("Map token", function () local tok = map(token('$'), function (value) return {token = value} end) local ok, result, pos = tok('$', 1) assert.is_same({ok, result, pos}, {true, {token = '$'}, 2}) end) it("Should parse a sequence of tokens and text", function () local parser = map(seq(skip('%$', ''), token('$')), function (value) return {text = value[1][2], token = value[2]} end) local ok, result, pos = parser('foo $', 1) assert.is_same({ok, result, pos}, {true, {text = 'foo ', token = '$'}, 6}) end) it("Should parse many of one", function () local parser = many(one(token('$'), token('foo'))) local ok, result, pos = parser('foo', 1) assert.is_same({ok, result, pos}, {true, {'foo'}, 4}) end) it("Optional value should be ok", function () local parser = opt(token('$')) local ok, result, pos = parser('', 1) assert.is_same({ok, result, pos}, {true, nil, 1}) end) it("Should parse a lazy pattern", function () local parser = lazy(function() return pattern("%d+") end) local ok, result, pos = parser('888', 1) assert.is_same({ok, result, pos}, {true, '888', 4}) end) end)
RegisterCommand("change-npc", function(source, args, user) TriggerClientEvent('npcvaihto', source, args, user, {}) end)
ESX = nil TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) AddEventHandler('esx:playerLoaded', function(playerId) local xPlayer = ESX.GetPlayerFromId(playerId) MySQL.Async.fetchScalar("SELECT armour FROM users WHERE identifier = @identifier", { ['@identifier'] = xPlayer.getIdentifier() }, function(data) if (data ~= nil) then TriggerClientEvent('Frost-Armor:Client:UstawArmor', playerId, data) end end) end) AddEventHandler('esx:playerLoaded', function(playerId) local xPlayer = ESX.GetPlayerFromId(playerId) MySQL.Async.fetchScalar("SELECT health FROM users WHERE identifier = @identifier", { ['@identifier'] = xPlayer.getIdentifier() }, function(data) if (data ~= nil) then TriggerClientEvent('Frost-Zycie:Client:UstawZycie', playerId, data) end end) end) RegisterServerEvent('Frost-Armor:Server:OdswiezArmor') AddEventHandler('Frost-Armor:Server:OdswiezArmor', function(updateArmour) local src = source local xPlayer = ESX.GetPlayerFromId(src) MySQL.Async.execute("UPDATE users SET armour = @armour WHERE identifier = @identifier", { ['@identifier'] = xPlayer.getIdentifier(), ['@armour'] = tonumber(updateArmour) }) end) RegisterServerEvent('Frost-Zycie:Server:OdswiezZycie') AddEventHandler('Frost-Zycie:Server:OdswiezZycie', function(updateHealth) local src = source local xPlayer = ESX.GetPlayerFromId(src) MySQL.Async.execute("UPDATE users SET health = @health WHERE identifier = @identifier", { ['@identifier'] = xPlayer.getIdentifier(), ['@health'] = tonumber(updateHealth) }) end) ESX.RegisterServerCallback('loaddatatostats', function (source, cb) local xPlayer = ESX.GetPlayerFromId(source) MySQL.Async.fetchAll("SELECT * FROM users WHERE identifier = @identifier", { ['@identifier'] = xPlayer.getIdentifier() }, function(result) cb(result) end) end) ESX.RegisterServerCallback('loaddatatostatsv2', function (source, cb) local xPlayer = ESX.GetPlayerFromId(source) MySQL.Async.fetchAll("SELECT * FROM statystyki WHERE identifier = @identifier", { ['@identifier'] = xPlayer.getIdentifier() }, function(result) cb(result) end) end) AddEventHandler('esx:playerLoaded', function(playerId) local xPlayer = ESX.GetPlayerFromId(playerId) MySQL.Async.fetchAll("SELECT * FROM statystyki WHERE identifier = @identifier", { ['@identifier'] = xPlayer.getIdentifier() }, function(result) if result[1] then TriggerClientEvent('crp_statystyki:setdata', result) else MySQL.Async.execute('INSERT INTO statystyki (identifier, stamina, sila, pp, zj, zl, zs) VALUES (@x, 0, 0, 0, 0, 0, 0)', { ['x'] = xPlayer.getIdentifier() }, function(affectedRows) print("Nowy Gracz Zapisany") end) end end) end) RegisterServerEvent('updatebaza123') AddEventHandler('updatebaza123', function(typ) local xPlayer = ESX.GetPlayerFromId(source) MySQL.Async.fetchAll("SELECT * FROM statystyki WHERE identifier = @identifier", { ['@identifier'] = xPlayer.getIdentifier() }, function(result) if result[1] then if typ == 'stamina' then asd = result[1].stamina elseif typ == 'sila' then asd = result[1].sila elseif typ == 'pp' then asd = result[1].pp elseif typ == 'zj' then asd = result[1].zj elseif typ == 'zl' then asd = result[1].zl elseif typ == 'zs' then asd = result[1].zs end MySQL.Async.execute("UPDATE statystyki SET ".. typ .." = @ile WHERE identifier = @identifier", { ['@identifier'] = xPlayer.getIdentifier(), ['@ile'] = asd + 1 }) TriggerClientEvent('crp_statystyki:setdata', result) end end) end)
local world = require('world') local powerup = {} powerup.category = tonumber('0010', 2) powerup.mask = tonumber('1001', 2) powerup.group = 0 powerup.body = love.physics.newBody(world, 340, 400, 'dynamic') powerup.body:setFixedRotation(true) powerup.body:setMass(20) powerup.shape = love.physics.newPolygonShape(20, 12, 40, 12, 45, 16, 45, 20, 30, 36, 15, 20, 15, 16) powerup.fixture = love.physics.newFixture(powerup.body, powerup.shape) powerup.fixture:setFilterData(powerup.category, powerup.mask, powerup.group) powerup.fixture:setFriction(10) powerup.fixture:setUserData(powerup) -- Custom entity properties powerup.color = {0, 1, 0, 1} powerup.taken = false powerup.draw = function(self) if self.taken == false then love.graphics.setColor(self.color) love.graphics.polygon('fill', self.body:getWorldPoints(self.shape:getPoints())) end end powerup.begin_contact = function(self, other_entity) -- Only care about contact with players and not contact with the floor if other_entity.jump_impulse then self.taken = true self.fixture:destroy() other_entity.color = {0, 0.9, 0, 1} other_entity.jump_impulse = 3000 end end return powerup
local suite = yatm_autotest.att:new_suite("YATM Brewery")
local Const = require("api.Const") local Enum = require("api.Enum") local Action = require("api.Action") local Draw = require("api.Draw") local Gui = require("api.Gui") local I18N = require("api.I18N") local Ui = require("api.Ui") local EquipRules = require("api.chara.EquipRules") local ICharaEquipStyle = require("api.chara.aspect.ICharaEquipStyle") local ResistanceLayout = require("api.gui.menu.inv.ResistanceLayout") local IInventoryMenuDetailView = require("api.gui.menu.inv.IInventoryMenuDetailView") local IInput = require("api.gui.IInput") local IPaged = require("api.gui.IPaged") local IUiLayer = require("api.gui.IUiLayer") local Input = require("api.Input") local InputHandler = require("api.gui.InputHandler") local ItemDescriptionMenu = require("api.gui.menu.ItemDescriptionMenu") local MapObjectBatch = require("api.draw.MapObjectBatch") local UiList = require("api.gui.UiList") local UiTheme = require("api.gui.UiTheme") local UiWindow = require("api.gui.UiWindow") local EquipmentMenu = class.class("EquipmentMenu", {IUiLayer, IPaged}) EquipmentMenu:delegate("input", IInput) EquipmentMenu:delegate("pages", IPaged) local UiListExt = function(equipment_menu) local E = {} function E:get_item_text(entry) return entry.name end function E:get_item_color(entry) return entry.color end function E:draw_select_key(entry, i, key_name, x, y) if (i - 1) % 2 == 0 then Draw.filled_rect(x, y, 558, 18, {12, 14, 16, 16}) end UiList.draw_select_key(self, entry, i, key_name, x, y) Draw.set_color(255, 255, 255) local icon = entry.body_part.icon or 1 equipment_menu.t.base.body_part_icons:draw_region(icon, x - 66, y - 2) -- wx + 88 - 66 = wx + 22 Draw.set_font(12, "bold") -- 12 + sizefix - en * 2 Draw.text(entry.body_part_text, x - 42, y + 3, {0, 0, 0}) -- wx + 88 - y = wx + 46 end function E:draw_item_text(item_name, entry, i, x, y, x_offset, color) local subtext = entry.subtext if entry.item then equipment_menu.map_object_batch:add(entry.item, x + 12, y + 10, nil, nil, nil, true) if equipment_menu.detail_view then equipment_menu.detail_view:draw_row(entry, i, x + 20, y) item_name = utf8.wide_sub(item_name, 0, 22) end end UiList.draw_item_text(self, item_name, entry, i, x, y, 30, color) Draw.text(subtext, x + 530 - Draw.text_width(subtext), y + 2, color) end function E:draw() UiList.draw(self) equipment_menu.map_object_batch:draw() equipment_menu.map_object_batch:clear() end return E end function EquipmentMenu:init(chara) self.width = 690 self.height = 428 self.chara = chara self.pages = UiList:new_paged({}, 14) table.merge(self.pages, UiListExt(self)) self.detail_view = nil local key_hints = self:make_key_hints() self.win = UiWindow:new("ui.equip.title", true, key_hints) self.input = InputHandler:new() self.input:forward_to(self.pages) self.input:bind_keys(self:make_keymap()) self.text_equip_stats = "" self.stats = {} self.changed_equipment = false self.map_object_batch = nil self:update_from_chara() end function EquipmentMenu:make_keymap() return { identify = function() self:show_item_description() end, -- >>>>>>>> shade2/command.hsp:3179 if key=key_mode{ ... mode = function() Gui.play_sound("base.pop1") if self.detail_view then self:set_detail_view(nil) else self:set_detail_view(ResistanceLayout:new()) end end, -- <<<<<<<< shade2/command.hsp:3182 } .. cancel = function() self.canceled = true end, escape = function() self.canceled = true end, } end function EquipmentMenu:make_key_hints() return { { action = "ui.key_hint.action.known_info" , keys = "identify" }, { action = "ui.key_hint.action.mode", keys = "mode" }, { action = "ui.key_hint.action.close", keys = { "cancel", "escape" } } } end function EquipmentMenu:on_hotload_layer() table.merge(self.pages, UiListExt(self)) end function EquipmentMenu:selected_item_object() local selected = self.pages:selected_item() if selected == nil then return nil end return selected.item end function EquipmentMenu:show_item_description() local item = self:selected_item_object() if item == nil then return end local rest = self.pages:iter_all_pages():extract("item"):to_list() local index = ItemDescriptionMenu:new(item, rest):query() item = rest[index] if item then for i, other in self.pages:iter() do if item == other.item then self.pages:select(i) break end end end end function EquipmentMenu.build_list(chara) local list = {} for _, i in chara:iter_all_body_parts() do local entry = {} entry.body_part = i.body_part entry.body_part_text = I18N.localize("base.body_part", i.body_part._id, "name") entry.item = nil entry.color = {10, 10, 10} entry.name = "- " entry.subtext = "-" if i.equipped then entry.item = i.equipped entry.color = i.equipped:calc_ui_color() entry.name = i.equipped:build_name() entry.subtext = Ui.display_weight(i.equipped:calc("weight")) end list[#list + 1] = entry end return list end function EquipmentMenu:update_from_chara() local list = EquipmentMenu.build_list(self.chara) self.pages:set_data(list) self.win:set_pages(self.pages) local dv = self.chara:calc("dv") local pv = self.chara:calc("pv") local weight = self.chara:calc("equipment_weight") local hit_bonus = self.chara:calc("hit_bonus") local damage_bonus = self.chara:calc("damage_bonus") self.text_equip_stats = ("%s: %s%s %s:%d %s:%d DV/PV:%d/%d") :format(I18N.get("ui.equip.equip_weight"), Ui.display_weight(weight), Ui.display_armor_class(weight), I18N.get("ui.equip.hit_bonus"), hit_bonus, I18N.get("ui.equip.damage_bonus"), damage_bonus, dv, pv) Gui.refresh_hud() end function EquipmentMenu:on_query() Gui.play_sound("base.wear"); end function EquipmentMenu:relayout() self.x, self.y, self.width, self.height = Ui.params_centered(self.width, self.height) self.t = UiTheme.load(self) self.map_object_batch = MapObjectBatch:new() self.win:relayout(self.x, self.y, self.width, self.height) self.pages:relayout(self.x + 88, self.y + 60, self.width, self.height) self.win:set_pages(self.pages) if self.detail_view then self.detail_view:relayout() end end function EquipmentMenu:set_detail_view(detail_view) if detail_view then class.assert_is_an(IInventoryMenuDetailView, detail_view) else detail_view = nil end self.detail_view = detail_view if self.detail_view then self.detail_view:on_page_changed(self) self.detail_view:relayout() end end function EquipmentMenu:draw() self.win:draw() Ui.draw_topic("ui.equip.category_name", self.x + 28, self.y + 30) if self.detail_view == nil then Ui.draw_topic("ui.equip.weight", self.x + 524 + 50, self.y + 30) end Draw.set_color(255, 255, 255) self.t.base.inventory_icons:draw_region(10, self.x + 46, self.y - 16) self.t.base.deco_wear_a:draw(self.x + self.width - 106, self.y) self.t.base.deco_wear_b:draw(self.x, self.y + self.height - 164) if self.detail_view then self.detail_view:draw_header(self.x + 50, self.y + 40) end Ui.draw_note(self.text_equip_stats, self.x, self.y, self.width, self.height, 0) self.pages:draw() end function EquipmentMenu.message_weapon_stats(chara) -- >>>>>>>> shade2/command.hsp:3052 *show_weaponStat .. local attack_count = 0 for _, part in chara:iter_equipped_body_parts() do if part.body_part._id == "elona.hand" then local equipped = assert(part.equipped) local weight = equipped:calc("weight") if EquipRules.is_melee_weapon(equipped) then attack_count = attack_count + 1 local style = chara:get_aspect(ICharaEquipStyle) if style:calc(chara, "is_wielding_two_handed") and weight >= Const.WEAPON_WEIGHT_HEAVY then Gui.mes("action.equip.two_handed.fits_well", equipped:build_name()) end if style:calc(chara, "is_dual_wielding") then if attack_count == 1 then if weight >= Const.WEAPON_WEIGHT_HEAVY then Gui.mes("action.equip.two_handed.too_heavy", equipped:build_name()) end else if weight > Const.WEAPON_WEIGHT_LIGHT then Gui.mes("action.equip.two_handed.too_heavy_other_hand", equipped:build_name()) end end end -- TODO riding if chara:is_player() then end end end end -- <<<<<<<< shade2/command.hsp:3074 return .. end function EquipmentMenu:on_exit_result() if self.changed_equipment then Gui.mes("action.equip.you_change") return "turn_end" end return "player_turn_query" end function EquipmentMenu:update(dt) local canceled = self.canceled local chosen = self.pages.chosen local changed_page = self.pages.changed_page self.canceled = false self.win:update(dt) self.pages:update(dt) if self.detail_view then self.detail_view:update(dt) end if canceled then return nil, "canceled" end if chosen then local slot = self.pages.selected local entry = self.pages:selected_item() if entry.item then local success, err = Action.unequip(self.chara, entry.item) self.changed_equipment = true if success then self:update_from_chara() else if err == "is_cursed" then Gui.mes("ui.equip.cannot_be_taken_off", entry.item) else Gui.mes("ui.equip.cannot_be_taken_off", entry.item) end end else local result, query_canceled = Input.query_item(self.chara, "elona.inv_equip", { params = {body_part_id = entry.body_part._id} }) if not query_canceled then local selected_item = result.result:separate() assert(Action.equip(self.chara, selected_item, slot)) -- >>>>>>>> shade2/command.hsp:3743 snd seEquip .. Gui.play_sound("base.equip1") Gui.mes_newline() Gui.mes("ui.inv.equip.you_equip", selected_item:build_name()) self.changed_equipment = true local curse = selected_item:calc("curse_state") if curse == Enum.CurseState.Cursed then Gui.mes("ui.inv.equip.cursed", self.chara) elseif curse == Enum.CurseState.Doomed then Gui.mes("ui.inv.equip.doomed", self.chara) elseif curse == Enum.CurseState.Blessed then Gui.mes("ui.inv.equip.blessed", self.chara) end if entry.body_part._id == "elona.hand" then EquipmentMenu.message_weapon_stats(self.chara) end -- <<<<<<<< shade2/command.hsp:3749 if (cData(body,cc)/extBody)=bodyHand : gosub *s .. self:update_from_chara() end end end if changed_page then self.win:set_pages(self) end end function EquipmentMenu:release() self.map_object_batch:release() end return EquipmentMenu
--[[ © 2020 TERRANOVA do not share, re-distribute or modify without permission of its author. --]] ITEM.name = "Sandwich"; ITEM.model = "models/foodnhouseholditems/sandwich.mdl"; ITEM.width = 1; ITEM.height = 1; ITEM.description = "A mouth-watering sandwich with various meat slices, fresh crispy tomato slices, and beautifully vibrant green lettuce leaves."; ITEM.permit = "consumables"; ITEM.category = "Bread"; ITEM.price = 10 ITEM.restoreHealth = 10 ITEM.flag = "b" ITEM.iconCam = { pos = Vector(193.26995849609, 160.39869689941, 119), ang = Angle(25, 220, 0), fov = 1.7647058823529, }
return { entities = { {"stack-inserter", {x = -0.5, y = -2.5}, {dir = "west", dmg = {dmg = {type = "random", min = 1, max = 75}}, dead = 0.2}}, {"steel-chest", {x = -1.5, y = -2.5}, {dmg = {dmg = {type = "random", min = 1, max = 75}}, dead = 0.2}}, {"medium-electric-pole-remnants", {x = 1.5, y = -3.5}, {}}, {"stack-inserter", {x = 2.5, y = -3.5}, {dir = "south", dmg = {dmg = {type = "random", min = 1, max = 75}}, dead = 0.2}}, {"stack-inserter", {x = 3.5, y = -2.5}, {dir = "east", dmg = {dmg = {type = "random", min = 1, max = 75}}, dead = 0.2}}, {"beacon-remnants", {x = -2.5, y = -0.5}, {}}, {"assembling-machine-3", {x = 1.5, y = -1.5}, {dmg = {dmg = {type = "random", min = 20, max = 125}}}}, {"beacon-remnants", {x = -2.5, y = 2.5}, {}}, {"beacon-remnants", {x = 0.5, y = 2.5}, {}}, }, }
--[[ CORE Overwrite -- A lightweight and modular userdata wrapper. Inspired from a library by and written with minor help from Eir#8327 https://github.com/DimitriBarronmore/cyf-core-labs © 2021 Dimitri Barronmore --]] -- Define a metatable to mimick the properties of userdata. local function err_compare(lhs, rhs) error("attempt to compare " .. type(lhs) .. " with " .. type(rhs), 2) end local function err_arithmetic() error("attempt to perform arithmetic on a userdata value", 2) end local userdata_metatable = { __type = "userdata", __call = function() error("attempt to call a userdata value", 2) end, __len = function() error("attempt to get length of a userdata value", 2) end, __pairs = function() error("bad argument #1 to 'next' (table expected, got userdata)", 2) end, __ipairs = function(_, k) error("bad argument #1 to '!!next_i!!' (table expected, got userdata)", 2) end, __eq = function(lhs, rhs) return (pcall(function() return lhs.userdata end) and lhs.userdata or lhs) == (pcall(function() return rhs.userdata end) and rhs.userdata or rhs) end, __lt = err_compare, __le = err_compare, __add = err_arithmetic, __sub = err_arithmetic, __mul = err_arithmetic, __div = err_arithmetic, __mod = err_arithmetic, __pow = err_arithmetic } local function accesserr() error("attempted to assign to a readonly value", 3) end local special_set_bullets = { x = function(t,v) t.userdata.x = v end, y = function(t,v) t.userdata.y = v end, absx = function(t,v) t.userdata.absx = v end, absy = function(t,v) t.userdata.absy = v end, ppcollision = function(t,v) t.userdata.ppcollision = v end, --b ppchanged = function(t,v) t.userdata.ppchanged = v end, --b isactive = accesserr, --readonly layer = function(t,v) t.userdata.layer = v end, isPersistent = function(t,v) t.userdata.isPersistent = v end --b } local special_set_sprites = { spritename = function(t,v) t.userdata.spritename = v end, x = function(t,v) t.userdata.x = v end, y = function(t,v) t.userdata.y = v end, absx = function(t,v) t.userdata.absx = v end, absy = function(t,v) t.userdata.absy = v end, xscale = function(t,v) t.userdata.xscale = v end, yscale = function(t,v) t.userdata.yscale = v end, isactive = accesserr, --readonly width = accesserr, --readonly height = accesserr, --readonly xpivot = function(t,v) t.userdata.xpivot = v end, ypivot = function(t,v) t.userdata.ypivot = v end, animcomplete = accesserr, --readonly currentframe = function(t,v) t.userdata.currentframe = v end, currenttime = function(t,v) t.userdata.currenttime = v end, animationspeed = function(t,v) t.userdata.animationspeed = v end, animationpaused = function(t,v) t.userdata.animationpaused = v end, loopmode = function(t,v) t.userdata.loopmode = v end, color = function(t,v) t.userdata.color = v end, color32 = function(t,v) t.userdata.color32 = v end, alpha = function(t,v) t.userdata.alpha = v end, alpha32 = function(t,v) t.userdata.alpha32 = v end, rotation = function(t,v) t.userdata.rotation = v end, layer = function(t,v) t.userdata.layer = v end, shader = function(t,v) t.userdata.shader = v end } local special_get_bullets = { x = function(t) return t.userdata.x end, y = function(t) return t.userdata.y end, absx = function(t) return t.userdata.absx end, absy = function(t) return t.userdata.absy end, ppcollision = function(t) return t.userdata.ppcollision end, --b ppchanged = function(t) return t.userdata.ppchanged end, --b xscale = function(t) return t.userdata.xscale end, isactive = function(t) return t.userdata.isactive end, --readonly layer = function(t) return t.userdata.layer end, isPersistent = function(t) return t.userdata.isPersistent end } local special_get_sprites = { spritename = function(t) return t.userdata.spritename end, x = function(t) return t.userdata.x end, y = function(t) return t.userdata.y end, absx = function(t) return t.userdata.absx end, absy = function(t) return t.userdata.absy end, xscale = function(t) return t.userdata.xscale end, yscale = function(t) return t.userdata.yscale end, isactive = function(t) return t.userdata.isactive end, --readonly width = function(t) return t.userdata.width end, --readonly height = function(t) return t.userdata.height end, --readonly xpivot = function(t) return t.userdata.xpivot end, ypivot = function(t) return t.userdata.ypivot end, animcomplete = function(t) return t.userdata.animcomplete end, --readonly currentframe = function(t) return t.userdata.currentframe end, currenttime = function(t) return t.userdata.currenttime end, animationspeed = function(t) return t.userdata.animationspeed end, animationpaused = function(t) return t.userdata.animationpaused end, loopmode = function(t) return t.userdata.loopmode end, color = function(t) return t.userdata.color end, color32 = function(t) return t.userdata.color32 end, alpha = function(t) return t.userdata.alpha end, alpha32 = function(t) return t.userdata.alpha32 end, rotation = function(t) return t.userdata.rotation end, layer = function(t) return t.userdata.layer end } local function setupAudio(input) input.Play = input.userdata.Play input.Stop = input.userdata.Stop input.Pause = input.userdata.Pause input.Unpause = input.userdata.Unpause input.Volume = input.userdata.Volume input.Pitch = input.userdata.Pitch input.LoadFile = input.userdata.LoadFile input.PlaySound = input.userdata.PlaySound input.StopAll = input.userdata.StopAll input.PauseAll = input.userdata.PauseAll input.UnpauseAll = input.userdata.UnpauseAll input.SetSoundDictionary = input.userdata.SetSoundDictionary input.GetSoundDictionary = input.userdata.GetSoundDictionary input._get.playtime = function(t) return t.userdata.playtime end input._set.playtime = function(t,v) t.userdata.playtime = v end input._get.totaltime = function(t) return t.userdata.totaltime end input._set.totaltime = accesserr end local function setupBullet(input) input.Move = input.userdata.Move --static, b, s input.MoveTo = input.userdata.MoveTo --static, b, s input.MoveToAbs = input.userdata.MoveToAbs --static, b, s input.SendToTop = input.userdata.SendToTop --static input.SendToBottom = input.userdata.SendToBottom --static input.Remove = input.userdata.Remove --static input.SetVar = input.userdata.SetVar --static input.GetVar = input.userdata.GetVar --static for k,v in pairs(special_set_bullets) do input._set[k] = v end for k,v in pairs(special_get_bullets) do input._get[k] = v end input.ResetCollisionSystem = input.userdata.ResetCollisionSystem --static, b input.isColliding = input.userdata.isColliding --static, b input.isPersistent = input.userdata.isPersistent --b input.sprite = input.userdata.sprite end local function setupSprite(input) --shared input.Move = input.userdata.Move --static, b, s input.MoveTo = input.userdata.MoveTo --static, b, s input.MoveToAbs = input.userdata.MoveToAbs --static, b, s input.SendToTop = input.userdata.SendToTop --static input.SendToBottom = input.userdata.SendToBottom --static input.Remove = input.userdata.Remove --static input.SetVar = input.userdata.SetVar --static input.GetVar = input.userdata.GetVar --static for k,v in pairs(special_set_sprites) do input._set[k] = v end for k,v in pairs(special_get_sprites) do input._get[k] = v end input.Set = input.userdata.Set --static input.SetParent = input.userdata.SetParent --static input.Mask = input.userdata.Mask --static input.shader = input.userdata.shader input.SetPivot = input.userdata.SetPivot --static input.SetAnchor = input.userdata.SetAnchor --static input.Scale = input.userdata.Scale --static input.SetAnimation = input.userdata.SetAnimation --static input.StopAnimation = input.userdata.StopAnimation --static input.MoveBelow = input.userdata.MoveBelow --static input.Dust = input.userdata.Dust end local listener_newindex = function(t,k,v) if t._set[k] == nil then t.userdata[k] = v return end local keytype = type(t._set[k]) if keytype == "function" then t._set[k](t, v) else error("this wrapped userdata has a ._set field, " .. k .. ", which is not a function",2) end end local listener_index = function(t,k) if t._get[k] == nil then return t.userdata[k] end local keytype = type(t._get[k]) if keytype == "function" then return t._get[k](t) else return t._get[k] end end -- Take a userdata object as input and spit out a replica. -- Requires my custom __type metamethod to output as type <userdata>. -- Values can be added/replaced using rawset() or Userdata.SetRaw() -- The original object is stored at the field ["userdata"] -- ._get and ._set are used like metamethods to perform actions or -- redirect values when a variable is accessed -- This causes odd behavior in sprites, bullets, and the audio object -- All fresh references will end up going through Get/SetVar or Get/SetSoundDictionary function GetIsWrapped(udata) res, err = pcall(function() return udata.userdata end) --DEBUG(err) return res end function WrapUserdata(usrdata) if type(usrdata) ~= "userdata" then error("tried to wrap object of type " .. type(usrdata),2) end local new_object = {} new_object.userdata = usrdata new_object._get = {} new_object._set = {} local __tostring = tostring(new_object.userdata) local userdata_mt = { __index = listener_index, __newindex = listener_newindex, __tostring = function() return __tostring end, } for k,v in pairs(userdata_metatable) do userdata_mt[k] = v end -- Convenience functions. -- You don't really need these, but if you want them, they're there. function new_object.SetRaw(var, value) rawset(new_object, var, value) end function new_object.GetRaw(var) rawget(new_object, var) end if __tostring == "LuaSpriteController" then setupSprite(new_object) elseif __tostring == "ProjectileController" then setupBullet(new_object) elseif __tostring == "MusicManager" then setupAudio(new_object) end setmetatable(new_object, userdata_mt) return new_object end
ATTRIBUTE.name = "Dextery" ATTRIBUTE.description = "Skill in performing tasks, especially with the hands."
local SLDataText = LibStub("AceAddon-3.0"):GetAddon("SLDataText") local L = LibStub("AceLocale-3.0"):GetLocale("SLDataText") local media = LibStub("LibSharedMedia-3.0") local justTable, strataTable, pointTable = SLDataText.just, SLDataText.strata, SLDataText.point local db local realmName = GetCVar("realmName") local MODNAME = "Clock" local Clock = SLDataText:NewModule(MODNAME, "AceEvent-3.0") local optGetter, optSetter do function optGetter(info) local key = info[#info] return db[key] end function optSetter(info, value) local key = info[#info] db[key] = value SLDataText:RefreshModule(Clock) end end local options local function getOptions() if not options then options = { type = "group", name = L["Clock"], arg = MODNAME, get = optGetter, set = optSetter, args = { genHeader = { type = "header", name = L["GenClkSet"], order = 1, }, enabled = { type = "toggle", name = L["Enabled"], desc = L["EnabledDesc"], get = function() return SLDataText:GetModuleEnabled(MODNAME) end, set = function(info, value) SLDataText:SetModuleEnabled(MODNAME, value) if ( SLDataText:GetModuleEnabled(MODNAME) ) then Clock:PLAYER_ENTERING_WORLD() end end, order = 25, }, hideGameTime = { type = "toggle", name = L["HideGT"], desc = L["HideGTDesc"], order = 50, }, isServerTime = { type = "toggle", name = L["SST"], desc = L["SSTDesc"], order = 75, }, s24Hour = { type = "toggle", name = L["ST24Hour"], desc = L["ST24HourDesc"], order = 100, }, hideTooltip = { type = "toggle", name = L["HideTT"], desc = L["HideTTDesc"], order = 125, }, noCombatHide = { type = "toggle", name = L["SIC"], desc = L["SICDesc"], order = 150, }, clkFormDesc = { type = "description", name = L["ClkFormDescLong"], width = "double", order = 175, }, clockFormat = { type = "input", name = L["ClkFormat"], desc = L["ClkFormatDesc"], width = "double", order = 200, }, showMeridiem = { type = "toggle", name = L["Meridiem"], desc = L["MeridiemDesc"], order = 225, }, pulse = { type = "toggle", name = L["InvPulse"], desc = L["InvPulseDesc"], order = 250, }, dispHeader = { type = "header", name = L["DispSet"], order = 275, }, useGlobalFont = { type = "toggle", name = L["UseGblFont"], desc = L["UseGblFontDesc"], order = 300, }, useGlobalFontSize = { type = "toggle", name = L["UseGblFSize"], desc = L["UseGblFSizeDesc"], order = 350, }, fontFace = { type = "select", name = L["Font"], desc = L["FontDesc"], disabled = function() local isTrue if ( db.useGlobalFont ) then isTrue = true else isTrue = false end return isTrue end, values = media:List("font"), get = function() for k, v in pairs(media:List("font")) do if db.fontFace == v then return k end end end, set = function(_, font) local list = media:List("font") db.fontFace = list[font] SLDataText:RefreshModule(Clock) end, width = "double", order = 600, }, fontSize = { type = "range", name = L["FontSize"], desc = L["FontSizeDesc"], disabled = function() local isTrue if ( db.useGlobalFontSize ) then isTrue = true else isTrue = false end return isTrue end, min = 6, max = 36, step = 1, width = "double", order = 650, }, posHeader = { type = "header", name = L["LaySet"], order = 700, }, justify = { type = "select", name = L["TextJust"], desc = L["TextJustDesc"], values = justTable, width = "double", order = 750, }, anchor = { type = "input", name = L["ParFrm"], desc = L["ParFrmDesc"], get = function() return db.anchor end, width = "double", order = 800, }, anchorFrom = { type = "select", name = L["AnchFrom"], desc = L["AnchFromDesc"], values = pointTable, get = function() return db.anchorFrom end, width = "double", order = 900, }, offX = { type = "input", name = L["XOff"], desc = L["XOffDesc"], get = function() return tostring(db.offX) end, width = "double", order = 1000, }, offY = { type = "input", name = L["YOff"], desc = L["YOffDesc"], get = function() return tostring(db.offY) end, width = "double", order = 1100, }, strata = { type = "select", name = L["Strata"], desc = L["StrataDesc"], values = strataTable, width = "double", order = 1600, }, }, } end return options end local int = 1 local f local function buildModule(self) if ( not f ) then f = CreateFrame("Frame") end if ( not self.frame ) then self.frame = CreateFrame("Frame", "SLDT_Clock", UIParent, BackdropTemplateMixin and "BackdropTemplate") end if ( not self.button ) then self.button = CreateFrame("Button", nil, self.frame, BackdropTemplateMixin and "BackdropTemplate") end if ( not self.pulse ) then self.pulse = CreateFrame("Frame", nil, self.frame, BackdropTemplateMixin and "BackdropTemplate") end if ( not self.string ) then self.string = self.frame:CreateFontString(nil, "OVERLAY") end f:SetScript("OnUpdate", function(self, elapsed) int = int - elapsed if ( int <= 0 ) then Clock:Refresh() int = 1 end end) self.button:SetScript("OnClick", function() if ( IsShiftKeyDown() ) then ToggleCalendar() else ToggleTimeManager() end end) SLDataText:RefreshModule(self) end function Clock:PLAYER_ENTERING_WORLD() local enabled = SLDataText:GetModuleEnabled(MODNAME) if ( enabled ) then if ( TimeManagerClockButton and TimeManagerClockButton:IsShown() ) then TimeManagerClockButton:Hide() end if ( db.hideGameTime ) then if ( GameTimeFrame and GameTimeFrame:IsShown() ) then GameTimeFrame:Hide() end end end self:UnregisterEvent("PLAYER_ENTERING_WORLD") end function Clock:OnInitialize() self.db = SLDataText.db:RegisterNamespace(MODNAME) self.db:RegisterDefaults({ profile = { pulse = false, hideGameTime = false, clockFormat = "%I:%M", showMeridiem = true, isServerTime = false, s24Hour = false, hideTooltip = false, noCombatHide = false, fontFace = "Arial Narrow", useGlobalFont = true, fontSize = 12, useGlobalFontSize = true, justify = "CENTER", anchorPoint = "CENTER", anchor = "Minimap", anchorFrom = "BOTTOM", offX = 0, offY = -14, strata = "BACKGROUND", }, }) db = self.db.profile if ( not self.isMoving ) then self.isMoving = false end self:SetEnabledState(SLDataText:GetModuleEnabled(MODNAME)) SLDataText:RegisterModuleOptions(MODNAME, getOptions) self:RegisterEvent("PLAYER_ENTERING_WORLD") end function Clock:OnEnable() if ( TimeManagerClockButton and TimeManagerClockButton:IsShown() ) then TimeManagerClockButton:Hide() end if ( db.hideGameTime ) then if ( GameTimeFrame and GameTimeFrame:IsShown() ) then GameTimeFrame:Hide() end end buildModule(self) if ( not self.frame:IsShown() ) then self.frame:Show() end end function Clock:OnDisable() self:UnregisterEvent("PLAYER_ENTERING_WORLD") f:SetScript("OnUpdate", nil) self.button:SetScript("OnClick", nil) if ( TimeManagerClockButton and not TimeManagerClockButton:IsShown() ) then TimeManagerClockButton:Show() end if ( db.hideGameTime ) then if ( GameTimeFrame and not GameTimeFrame:IsShown() ) then GameTimeFrame:Show() end end if ( self.frame:IsShown() ) then self.frame:Hide() end end local function getGameTime() local serTime, serAMPM local hour, min = GetGameTime() if ( db.s24Hour ) then if ( min < 10 ) then min = format("%s%s", "0", min) end serAMPM = "" serTime = format("%s:%s", hour, min) else if ( min < 10 ) then min = format("%s%s", "0", min) end if ( tonumber(hour) > 11 ) then serAMPM = "pm" else serAMPM = "am" end if ( tonumber(hour) == 0 ) then hour = hour + 12 elseif ( tonumber(hour) > 12 ) then hour = hour - 12 end serTime = format("%s:%s", hour, min) end return serTime, serAMPM end local function convertSecondstoTime(value) local hours, minues, seconds hours = floor(value/3600) minutes = floor((value-(hours*3600))/60) seconds = floor(value - ((hours * 3600) + (minutes * 60))) if ( hours > 0 ) then if ( minutes < 10 ) then minutes = format("0%d", minutes) end if ( seconds < 10 ) then seconds = format("0%d", seconds) end return format("%s:%s:%s", hours, minutes, seconds) elseif ( minutes > 0 ) then if ( minutes < 10 ) then minutes = format("0%d", minutes) end if ( seconds < 10 ) then seconds = format("0%d", seconds) end return format("%s:%s", minutes, seconds) else if ( seconds < 10 ) then seconds = format("0%d", seconds) end return format("%s", seconds) end end local pulseDown = true local function invitePulse(self, invites) self.pulse:SetBackdrop({ bgFile = "Interface\\Addons\\SLDataText\\Media\\Pulse.tga", tile = false, insets = { left = 0, top = 0, right = 0, bottom = 0 }, }) self.pulse:SetAllPoints(self.frame) if ( invites == 0 ) then if ( self.pulse:IsShown() ) then self.pulse:Hide() end self.pulse:SetScript("OnUpdate", nil) else if ( not self.pulse:IsShown() ) then self.pulse:Show() end self.pulse:SetFrameLevel(0) self.pulse:SetScript("OnUpdate", function(self, elapsed) local step = abs(1/30) if ( self:GetAlpha() == 1 ) then pulseDown = true self:SetAlpha(self:GetAlpha()-step) elseif ( self:GetAlpha() == 0 ) then pulseDown = false self:SetAlpha(self:GetAlpha()+step) else if ( pulseDown ) then self:SetAlpha(self:GetAlpha()-step) else self:SetAlpha(self:GetAlpha()+step) end end end) end end function Clock:Refresh() local locTime, locAMPM = date(db.clockFormat), date("%p") local serTime, serAMPM = getGameTime() if ( not db.showMeridiem ) then locAMPM = "" else locAMPM = string.lower(locAMPM) end local caltext = date("%b %d (%a)") local WGTime = select(5, GetWorldPVPAreaInfo(1)) or nil if ( WGTime ~= nil ) then WGTime = convertSecondstoTime(WGTime) else WGTime = L["No Wintergrasp Time Available"] end local TBTime = select(5, GetWorldPVPAreaInfo(2)) or nil if ( TBTime ~= nil ) then TBTime = convertSecondstoTime(TBTime) else TBTime = L["No Tol Barad Time Available"] end if ( db.pulse ) then local invites = C_Calendar.GetNumPendingInvites() invitePulse(self, invites) end if ( SLDataText.db.profile.locked and not db.hideTooltip ) then self.button:EnableMouse(true) self.button:SetScript("OnEnter", function(this) GameTooltip:SetOwner(this, "ANCHOR_CURSOR") GameTooltip:AddLine(format("|cff%s%s|r", SLDataText.ttColors["HEADER"], L["Time Info"])) GameTooltip:AddLine(" ") GameTooltip:AddDoubleLine(format("|cff%s%s|r", SLDataText.ttColors["LINEHEAD"], L["Realm Time:"]), format("%s%s", serTime, serAMPM), 1, 1, 1, 1, 1, 1) GameTooltip:AddDoubleLine(format("|cff%s%s|r", SLDataText.ttColors["LINEHEAD"], L["Local Time:"]), format("%s%s", locTime, locAMPM), 1, 1, 1, 1, 1, 1) GameTooltip:AddDoubleLine(format("|cff%s%s|r", SLDataText.ttColors["LINEHEAD"], L["Date:"]), caltext, 1, 1, 1, 1, 1, 1) GameTooltip:AddLine(" ") if ( WGTime ~= nil ) then GameTooltip:AddDoubleLine(format("|cff%s%s|r", SLDataText.ttColors["LINEHEAD"], L["WGTimer:"]), format("%s", WGTime), 1, 1, 1, 1, 1, 1) else GameTooltip:AddLine(format("|cff%s%s|r", SLDataText.ttColors["LINEHEAD"], L["No Wintergrasp Time Available"])) end if ( TBTime ~= nil ) then GameTooltip:AddDoubleLine(format("|cff%s%s|r", SLDataText.ttColors["LINEHEAD"], L["TBTimer:"]), format("%s", TBTime), 1, 1, 1, 1, 1, 1) else GameTooltip:AddLine(format("|cff%s%s|r", SLDataText.ttColors["LINEHEAD"], L["No Tol Barad Time Available"])) end GameTooltip:AddLine(" ") GameTooltip:AddLine(L["ClkHint1"]) GameTooltip:AddLine(L["ClkHint2"]) GameTooltip:Show() end) self.button:SetScript("OnLeave", function() if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end end) else self.button:EnableMouse(false) self.button:SetScript("OnEnter", nil) self.button:SetScript("OnLeave", nil) end local color = SLDataText:GetColor() if ( db.isServerTime ) then self.string:SetFormattedText("%s|cff%s%s|r", serTime, color, serAMPM) else self.string:SetFormattedText("%s|cff%s%s|r", locTime, color, locAMPM) end SLDataText:UpdateModule(self) end --[[ WORKING TIME ESCAPES %a abbreviated weekday name (e.g., Wed) %A full weekday name (e.g., Wednesday) %b abbreviated month name (e.g., Sep) %B full month name (e.g., September) %c date and time (e.g., 09/16/98 23:48:10) %d day of the month (16) [01-31] %H hour, using a 24-hour clock (23) [00-23] %I hour, using a 12-hour clock (11) [01-12] %M minute (48) [00-59] %m month (09) [01-12] %p either "am" or "pm" (pm) %S second (10) [00-61] %w weekday (3) [0-6 = Sunday-Saturday] %x date (e.g., 09/16/98) %X time (e.g., 23:48:10) %Y full year (1998) %y two-digit year (98) [00-99] %% the character `%´ ]]
--region geometricconf.lua --Author : OWenT --Date : 2014/10/22 --全局配置 return { LOG_LEVEL = { DISABLED = 0, FATAL = 1, ERROR = 2, WARNING = 3, INFO = 4, NOTICE = 5, DEBUG = 6, }, log_min_level = 1, log_max_level = 6, debug_mode = true, app_setting = { } } --endregion
data:extend( { { type = "item", name = "cobalt-steel-alloy", icon = "__Engineersvsenvironmentalist__/graphics/icons/metalworking/alloys/cobalt-steel-plate.png", flags = {"goes-to-main-inventory"}, subgroup = "alloy-processing", order = "cobalt", stack_size = 200 }, { type = "recipe", name = "cobalt-steel-alloy", enabled = false, category = "mixing-furnace", subgroup = "cobalt-processing", order="a-4", energy_required = 35, ingredients = { {type="item", name="steel-plate", amount=5}, {type="item", name="cobalt-plate", amount=1}, }, result = "cobalt-steel-alloy", result_count = 10, }, } )
----------------------------------------------------------------------------------- -- File: init.lua -- Author: Joaquín Cuitiño -- License: MIT ----------------------------------------------------------------------------------- local grid = require("grid") local hyper = require("hyper") local windowManager = require("window-manager") local doubleShift = require("double-shift") hyper.install("F18") hyper.bindKey("r", hs.reload) hyper.bindKey("`", hs.caffeinate.systemSleep) hyper.remapKey("h", "left") hyper.remapKey("j", "down") hyper.remapKey("k", "up") hyper.remapKey("l", "right") hyper.remapKey("delete", "forwarddelete") hyper.remap({}, "s", {"control", "shift", "cmd"}, "4") -- Screenshot area to clipboard hyper.remap({"shift"}, "s", {"shift", "cmd"}, "4") -- Screenshot area to desktop hyper.remap({"option"}, "s", {"shift", "cmd"}, "5") -- Screenshot/recording tool -- Arrange windows for Chill configuration (dual display). function chill() apps = { ["Code"] = { screen = 1, space = 1, position = grid.max }, ["WhatsApp"] = { screen = 2, space = 1, position = grid.bottomLeft }, ["Spotify"] = { screen = 2, space = 1, position = grid.topLeft }, ["Safari"] = { screen = 2, space = 1, position = grid.right }, } windowManager.arrange(apps) end hyper.bindKey("c", chill) -- Arrange windows for Desktop configuration (dual display). function desktop() apps = { ["Code"] = { screen = 1, space = 1, position = grid.max }, ["WebStorm"] = { screen = 1, space = 2, position = grid.max }, ["PhpStorm"] = { screen = 1, space = 2, position = grid.max }, ["Trello"] = { screen = 1, space = 3, position = grid.five_1 }, ["Toggl Track"] = { screen = 1, space = 3, position = grid.one_6 }, ["Safari"] = { screen = 2, space = 1, position = grid.right }, ["iTerm2"] = { screen = 2, space = 1, position = grid.topLeft }, ["Firefox"] = { screen = 2, space = 1, position = grid.right }, ["Google Chrome"] = { screen = 2, space = 1, position = grid.bottomLeft }, ["Postman"] = { screen = 2, space = 1, position = grid.bottomLeft }, ["Messages"] = { screen = 2, space = 2, position = grid.topLeft }, ["WhatsApp"] = { screen = 2, space = 2, position = grid.topLeft }, ["Slack"] = { screen = 2, space = 2, position = grid.topRight }, ["Spotify"] = { screen = 2, space = 2, position = grid.bottomRight }, ["GitKraken"] = { screen = 2, space = 2, position = grid.bottomLeft } } windowManager.arrange(apps) end hyper.bindKey("d", desktop) function launchDesktop() hs.application.launchOrFocus("PhpStorm") hs.application.launchOrFocus("Code") hs.application.launchOrFocus("Slack") hs.application.launchOrFocus("WhatsApp") hs.application.launchOrFocus("GitKraken") hs.application.launchOrFocus("Toggl Track") hs.application.launchOrFocus("Google Chrome") hs.application.launchOrFocus("iTerm2") hs.application.launchOrFocus("Spotify") hs.application.launchOrFocus("Trello") end hyper.bindKey("l", launchDesktop) -- Arrange windows for Game Dev configuration (dual display). function gameDev() apps = { ["Discord"] = { screen = 2, space = 2, position = grid.topRight }, ["WhatsApp"] = { screen = 2, space = 2, position = grid.topLeft }, ["Spotify"] = { screen = 2, space = 2, position = grid.bottomRight }, ["GitKraken"] = { screen = 2, space = 2, position = grid.bottomLeft }, ["Code"] = { screen = 1, space = 1, position = grid.max }, ["Rider"] = { screen = 1, space = 1, position = grid.max }, ["Safari"] = { screen = 1, space = 2, position = grid.max }, ["Firefox"] = { screen = 1, space = 2, position = grid.max }, ["Unity"] = { screen = 2, space = 1, position = grid.max } } windowManager.arrange(apps) end hyper.bindKey("g", gameDev) -- Arrange windows for on-the-go configuration (single display). function mobile() apps = { ["Trello"] = { screen = 1, space = 6, position = grid.max }, ["Messages"] = { screen = 1, space = 5, position = grid.left }, ["WhatsApp"] = { screen = 1, space = 5, position = grid.left }, ["Slack"] = { screen = 1, space = 5, position = grid.right }, ["Spotify"] = { screen = 1, space = 5, position = grid.right }, ["Music"] = { screen = 1, space = 5, position = grid.right }, ["Postman"] = { screen = 1, space = 3, position = grid.max }, ["GitKraken"] = { screen = 1, space = 4, position = grid.four_1 }, ["iTerm2"] = { screen = 1, space = 4, position = grid.two_5 }, ["Toggl Track"] = { screen = 1, space = 4, position = grid.one_6 }, ["Code"] = { screen = 1, space = 2, position = grid.max }, ["Safari"] = { screen = 1, space = 1, position = grid.max }, ["Firefox"] = { screen = 1, space = 1, position = grid.max } } windowManager.arrange(apps) end hyper.bindKey("e", mobile) -- Kill front application. Press Hyper+F to pay respects. function F() local app = hs.application.frontmostApplication() app:kill9() end hyper.bindKey("f", F)
require("torch") require("utils") local class = require("class") local MemoryGame = class("MemoryGame") -- Static function that transforms a number to a printable symbol function MemoryGame.getSymbol(n) assert(n > 0 and n < 27, "Out of range" .. n) return string.char(n + 64) end -- Initialize game function MemoryGame:__init(opt) opt = opt or {} self.width = opt.width or 4 -- Configure board size -- assert(self.width % 2, "Board width should be even!") self.size = self.width * self.width self.hidden = torch.zeros(self.size):int() -- These are the symbols local sizeUsed if self.width % 2 == 1 then sizeUsed = self.width * self.width - 1 else sizeUsed = self.width * self.width end order = torch.randperm(sizeUsed) for idx = 1, sizeUsed do self.hidden[order[idx]] = math.ceil(idx/2) end if self.width % 2 == 1 then self.hidden[self.size] = math.ceil((self.size + 1) / 2) end self.solved = torch.zeros(self.size):int() if self.width % 2 == 1 then self.solved[self.size] = 1 end self.lastAction = nil self.lastReward = nil self.score = 0 self.crtStep = 0 local pairsNo if self.width % 2 == 0 then pairsNo = self.size / 2 else pairsNo = (self.size - 1) / 2 end -- self.GUESS_REWARD = 1.0 -- self.WIN_REWARD = 0.0 -- self.ACTION_PENALTY = self.GUESS_REWARD * pairsNo / (self.maxSteps) -- -- self.LOSE_REWARD = -10.0 -- self.GUESS_REWARD = 0 -- self.WIN_REWARD = 1.0 -- self.ACTION_PENALTY = - 1.0 / (pairsNo * pairsNo) -- self.LOSE_REWARD = 0 self.GUESS_REWARD = 1.0 / pairsNo self.WIN_REWARD = 0 self.ACTION_PENALTY = - 1.0 / (pairsNo * pairsNo) self.LOSE_REWARD = 0 self.maxSteps = 8 * pairsNo * pairsNo end function MemoryGame:isOver() return (self.solved:sum() == self.size) or (self.crtStep >= self.maxSteps) end function MemoryGame:display(displayLastAction) local fst, snd, line, border, fill print("") if self.lastAction and displayLastAction then fst, snd = getNumbers(self.lastAction) end border = "+" fill = "|" for i = 1, self.width do border = border .. "---+" fill = fill .. " |" end print(border) local idx = 1 for i = 1, self.width do print(fill) line = "|" for j = 1, self.width do -- print(idx) if fst == idx or snd == idx then line = line .. ">" .. MemoryGame.getSymbol(self.hidden[idx]) .. "<|" elseif self.solved[idx] > 0.5 then line = line .. " " .. MemoryGame.getSymbol(self.hidden[idx]) .. " |" else line = line .. " |" end idx = idx + 1 end print(line); print(fill); print(border) end -- Print info about last reward and total score if self.lastReward then print("Last reward: " .. self.lastReward) end print(string.format("TOTAL SCORE: %2.4f", self.score)) print("") end function MemoryGame:serialize(fst, snd) local state = "" for i = 1, self.size do if self.solved[i] > 0.5 or fst == i or snd == i then state = state .. MemoryGame.getSymbol(self.hidden[i]) else state = state .. " " end end self.display(state) return state end function MemoryGame:getAvailableActions() local actions = {} for first = 1, self.size do if self.solved[first] < 0.5 then for second = first + 1, self.size do if self.solved[second] < 0.5 then actions[#actions + 1] = getString(first, second) end end end end return actions end function MemoryGame:applyAction(action) self.lastAction = action -- remember action local first, second = getNumbers(action) -- parse action string assert(first > 0 and first <= self.size and second > 0 and second <= self.size) self.crtStep = self.crtStep + 1 local reward = self.ACTION_PENALTY if self.hidden[first] == self.hidden[second] and self.solved[first] == 0 then self.solved[first] = 1 self.solved[second] = 1 reward = reward + self.GUESS_REWARD end if self.solved:sum() == self.size then reward = reward + self.WIN_REWARD elseif self.crtStep == self.maxSteps then reward = reward + self.LOSE_REWARD end self.lastReward = reward self.score = self.score + reward return self:serialize(first, second), reward end -- function MemoryGame:display(displayLastAction) -- local fst, snd, line, border, fill -- print("") -- if self.lastAction and displayLastAction then -- fst, snd = getNumbers(self.lastAction) -- end -- border = "+" -- fill = "|" -- for i = 1, self.width do -- border = border .. "---+" -- fill = fill .. " |" -- end -- print(border) -- local idx = 1 -- for i = 1, self.width do -- print(fill) -- line = "|" -- for j = 1, self.width do -- -- print(idx) -- if fst == idx or snd == idx then -- line = line .. ">" .. MemoryGame.getSymbol(self.hidden[idx]) .. "<|" -- elseif self.solved[idx] > 0.5 then -- line = line .. " " .. MemoryGame.getSymbol(self.hidden[idx]) .. " |" -- else -- line = line .. " |" -- end -- idx = idx + 1 -- end -- print(line); print(fill); print(border) -- end -- -- Print info about last reward and total score -- if self.lastReward then print("Last reward: " .. self.lastReward) end -- print(string.format("TOTAL SCORE: %2.4f", self.score)) -- print("") -- end return MemoryGame
local argv = {...} local options local loglevel = 1 local ocData = { baseDir = "/var/lib/mpt/mpt.db", configDir = "/var/lib/mpt/config.db", dir = "/var/lib/mpt/" } local function split(text,splitter) local rt = {} local act = "" local x = 1 while x <= #text do if text:sub(x,x+#splitter-1) == splitter then if act ~= "" then rt[#rt+1] = act end x = x + #splitter act="" else act = act .. text:sub(x,x) x = x + 1 end end if act ~= "" then rt[#rt+1] = act end return rt; end local function slice(a,i,j) local b = {} for x = i,j do b[x-i+1] = a[x] end return b end local function keys(t) local r = {} for k, _ in pairs(t) do r[#r + 1] = k end return r end local base, config, backend local core local frontends local ocBackend ocBackend = { --MAIN FLOW init = function() ocData.io = require("io") ocData.fs = require("filesystem") ocData.serialization = require("serialization") ocData.component = require("component") ocData.filesystem = require("filesystem") ocData.internet = require("internet") ocData.term = require("term") ocData.shell = require("shell") ocData.wget = loadfile("/bin/wget.lua") local a a, options = ocData.shell.parse(table.unpack(argv)) if options.root then core.rootDir = options.root core.log(1, "OC ","Using custom root directory: "..core.rootDir) end if not ocData.fs.exists(core.rootDir..ocData.dir) then ocData.fs.makeDirectory(core.rootDir..ocData.dir) end end, run = function() if #argv < 1 then error("Missing options, see 'mpt -h'") end local args, options = ocData.shell.parse(table.unpack(argv)) if options.h or options.help then print("Usage: mpt [-hRSUuy] [packages]") print(" -S, --sync") print(" Synchronize packages. Packages are installed directly") print(" from the remote repositories, including all dependencies") print(" required to run the packages. For example, pacman -S qt") print(" will download and install qt and all the packages it depends on.") print(" -R, --remove") print(" Remove package(s) from the system.") --print(" -U, --upgrade") --print(" Upgrade or add package(s) to the system and install the required") --print(" dependencies from sync repositories. Either a URL or file path can be") --print(" specified. This is a “remove-then-add” process.") print(" -y, --update") print(" Update package lists for backends that require such action") print(" -u, --upgrades") print(" Upgrade all packages that are out-of-date on the") print(" local system. Only package versions are used to find outdated packages;") print(" replacements are not checked here. This is a “remove-then-add” process.") print(" -f, --force") print(" Force operation, in case of upgrade it redownloads all packages") print(" --root='/some/dir'") print(" Set alternative root directory") print(" -v") print(" More output") print(" -Y") print(" Don't ask any questions, answer automatically") print(" -r, --reboot") print(" reboot after operation") return end if options.v then loglevel = 0 end if options.f or options.force then core.data.force = true end if options.S or options.sync then for _, pack in ipairs(args) do core.install(pack) end end if options.R or options.remove then if options.S or options.sync then error("Illegal parameters!") end for _, pack in ipairs(args) do core.remove(pack) end end if options.u or options.upgrades then core.upgrade() end if options.y or options.update then core.update() end if options.Y then ocBackend.prompt = function()return true end end core.reboot = optionsr or options.reboot core.doWork() end, ----FILESYSTEM concat = function(...)return ocData.fs.concat(...)end, isDirectory = function(...)return ocData.fs.isDirectory(...)end, readConfig = function() if ocData.fs.exists(core.rootDir..ocData.configDir) then local f = ocData.io.open(core.rootDir..ocData.configDir, "r") local conf = ocData.serialization.unserialize(f:read("*all")) f:close() return conf else core.log(1, "OC ","No config, will generate") return core.newConfig() end end, readBase = function(root) if ocData.fs.exists((root or core.rootDir)..ocData.baseDir) then local f = ocData.io.open((root or core.rootDir)..ocData.baseDir, "r") local db = ocData.serialization.unserialize(f:read("*all")) f:close() return db else core.log(1, "OC", "No database, will generate") return core.newBase() end end, saveConfig = function() local f = ocData.io.open(core.rootDir..ocData.configDir, "w") f:write(ocData.serialization.serialize(config)) f:close() end, saveBase = function() local f = ocData.io.open(core.rootDir..ocData.baseDir, "w") f:write(ocData.serialization.serialize(base)) f:close() end, ensureParrentDirectory = function(dir) if ocData.fs.exists(core.rootDir..dir) and not ocData.fs.isDirectory(core.rootDir..dir) then error("Illegal location(already exists): "..core.rootDir..dir) elseif not ocData.fs.exists(core.rootDir..dir) then ocData.fs.makeDirectory(core.rootDir..dir) ocData.fs.remove(core.rootDir..dir) end end, fileExists = function(file, root) return ocData.filesystem.exists((root or core.rootDir)..file) end, copyFile = function(from, to, fromRoot) core.log(0, "OC", "COPY "..(fromRoot or core.rootDir)..from.." -> "..core.rootDir..to) ocBackend.ensureParrentDirectory(to) return ocData.filesystem.copy((fromRoot or core.rootDir)..from, core.rootDir..to) end, removeFile = function(file) core.log(0, "OC", "REMOVE "..core.rootDir..file) ocData.fs.remove(core.rootDir..file) end, ----NETWORK getFile = function(url, location) core.log(0, "OC", "Get "..url) ocBackend.ensureParrentDirectory(location) os.sleep(0) return ocData.wget("-q", url, core.rootDir..location) end, getText = function(url, post) core.log(0, "OC", "Get "..url) local sContent = "" local result, response = pcall(ocData.internet.request, url, post) if not result then return nil end pcall(function() for chunk in response do sContent = sContent..chunk end end) os.sleep(0) return sContent end, getData = function(url, post) local data = backend.getText(url, post) if data then local t = load("return "..data, nil, nil, {})() return t end end, ----USER INTERACTION log = print, prompt = function(message) io.write(message) local p = ocData.term.read(nil,nil,nil,nil,"^[Yyn]$") if p:sub(1,1):upper() ~= "Y" then error("User stopped") end end, reboot = function()computer.shutdown(true) end } local mptFrontend mptFrontend = { name = "MPT", findPackage = function(name) local data = backend.getText(config.frontend.mpt.api.."package/"..name) if data then local pack = load("return "..data)() if not pack then return end return true, pack.dependencies, pack end end, getFilesIntoCache = function(data) for _, file in ipairs(data.files) do if not backend.fileExists(config.cacheDir.."mpt/"..data.name.."/".. data.checksum ..file) then backend.getFile(config.frontend.mpt.api.."file/"..data.name..file, config.cacheDir.."mpt/"..data.name.."/".. data.checksum ..file) end end return data.files end, installFiles = function(data) for _, file in ipairs(data.files) do backend.copyFile(config.cacheDir.."mpt/"..data.name.."/".. data.checksum ..file, file) end backend.removeFile(config.cacheDir.."mpt/"..data.name.."/".. data.checksum) end, removePackage = function(package) for _, file in ipairs(base.installed[package].data.files) do backend.removeFile(file) end end, checkUpdate = function() local toCheck = {} for pack, data in pairs(base.installed) do if data.frontend == mptFrontend.name then toCheck[pack] = base.installed[pack].data.checksum .. (core.data.force and "WAT" or "") end end local updateResp = backend.getText(config.frontend.mpt.api.."update", toCheck) if updateResp then local upd, err = load("return "..updateResp) if not upd then print("Update error: " .. tostring(err)) print("Data: " .. tostring(updateResp)) os.exit(1) end local updateList = upd() or {} local res = {} for _, entry in ipairs(updateList) do res[entry.package] = {checksum = entry.checksum} end return res end end, isOffline = false } local mirrorFrontend mirrorFrontend = { name = "Mirror", start = function() if options.mirror then mirrorFrontend.base = backend.readBase(options.mirror) end end, findPackage = function(name) if mirrorFrontend.base and mirrorFrontend.base.installed[name] then return true, mirrorFrontend.base.installed[name].deps, mirrorFrontend.base.installed[name].data end end, getFilesIntoCache = function(data) for _, file in ipairs(data.files) do if not backend.fileExists(config.cacheDir.."mpt/"..data.name.."/".. data.checksum ..file) then --backend.getFile(config.frontend.mpt.api.."file/"..data.name..file, config.cacheDir.."mpt/"..data.name.."/".. data.checksum ..file) backend.copyFile(file, config.cacheDir.."mpt/"..data.name.."/".. data.checksum ..file, options.mirror) end end return data.files end, installFiles = function(data) for _, file in ipairs(data.files) do backend.copyFile(config.cacheDir.."mpt/"..data.name.."/".. data.checksum ..file, file) end backend.removeFile(config.cacheDir.."mpt/"..data.name.."/".. data.checksum) end, removePackage = function(package) for _, file in ipairs(base.installed[package].data.files) do backend.removeFile(file) end end, checkUpdate = function() local todo = {} for pack, data in pairs(base.installed) do if data.frontend == mirrorFrontend.name then if mirrorFrontend.base and mirrorFrontend.base.installed[pack] and mirrorFrontend.base.installed[pack].data.checksum ~= base.installed[pack].data.checksum .. (core.data.force and "WAT" or "") then todo[pack] = {} end end end return todo end, action = function()end, isOffline = true } local oppmInstallRoot = "/usr" local function expandOppmFiles(files) for url, file in pairs(files) do local uprt = split(url, "/") local fprt = split(file, "/") local fileisfile = fprt[#fprt] and fprt[#fprt]:match("%.") --rc.d wtf.d? if file:sub(1,2) == "//" then local append = not (fileisfile and not backend.isDirectory(file:sub(2))) files[url] = backend.concat(file:sub(2), append and uprt[#uprt]) else local append = not (fileisfile and not backend.isDirectory(backend.concat(oppmInstallRoot, file))) files[url] = backend.concat(oppmInstallRoot, file, append and uprt[#uprt]) end end return files end local oppmFrontend oppmFrontend = { name = "OPPM", start = function() oppmFrontend.repos = options.oppmRepos or "https://raw.githubusercontent.com/OpenPrograms/openprograms.github.io/master/repos.cfg" base.oppm = base.oppm or {repos = {}, packages = {}} end, updateLists = function() base.oppm.packages = {} base.oppm.repos = {} local repos = backend.getData(oppmFrontend.repos) for _, repo in pairs(repos) do if repo.repo then local repoid = #base.oppm.repos + 1 base.oppm.repos[repoid] = repo.repo local packages = backend.getData("https://raw.githubusercontent.com/"..repo.repo.."/master/programs.cfg") if packages then for name, package in pairs(packages) do local metadata = { files = expandOppmFiles(package.files or {}), dependencies = keys(package.dependencies or {}), repo = repoid, version = package.version } base.oppm.packages[name] = metadata end else core.log(2, "OPPM-upd", "No programs.cfg for " .. repo.repo) end end end end, findPackage = function(name) if base.oppm.packages[name] then return true, base.oppm.packages[name].dependencies, { files = base.oppm.packages[name].files, repo = base.oppm.repos[base.oppm.packages[name].repo], name = name, version = base.oppm.packages[name].version } end end, getFilesIntoCache = function(data) for url, file in pairs(data.files) do if not backend.fileExists(config.cacheDir.."oppm/"..data.name.."/"..file) then backend.getFile("https://raw.githubusercontent.com/" .. data.repo .. "/" .. url, config.cacheDir .. "oppm/" .. data.name .. "/" .. file) end end return data.files end, installFiles = function(data) for _, file in pairs(data.files) do backend.copyFile(config.cacheDir.."oppm/"..data.name ..file, file) end backend.removeFile(config.cacheDir.."oppm/"..data.name) end, removePackage = function(package) for _, file in pairs(base.installed[package].data.files) do backend.removeFile(file) end end, checkUpdate = function() --https://github.com/OpenPrograms/Magik6k-Programs.git/info/refs?service=git-upload-pack --https://github.com/schacon/igithub/blob/master/http-protocol.txt local todo = {} for pack, data in pairs(base.installed) do if data.frontend == oppmFrontend.name and base.oppm.packages[pack] then if base.installed[pack].data.version ~= base.oppm.packages[pack].version then todo[pack] = {} end end end return todo end, action = function()end, isOffline = false } backend = ocBackend frontends = {mptFrontend, oppmFrontend, mirrorFrontend} core = { rootDir = "/", init = function() backend.init() base = backend.readBase() config = backend.readConfig() local usedFrontends = {} for _, frontend in ipairs(frontends) do if not options.offline or frontend.isOffline then usedFrontends[#usedFrontends + 1] = frontend if frontend.start then frontend.start() end end end frontends = usedFrontends end, finalize = function() backend.saveBase(base) backend.saveConfig(config) end, newBase = function() return {installed = {}} end, newConfig = function() return {cacheDir="/var/lib/mpt/cache/", database="/var/lib/mpt/base.db", frontend={mpt={api="http://mpt.magik6k.net/api/"}}} end, log = function(level, from, ...) if level >= loglevel then -- 4:WTF, 3:ERROR, 2:NOTICE, 1:INFO, 0:DEBUG backend.log("[ "..tostring(from)..((" "):sub(#tostring(from))), "] ", ...) end end, safeCall = pcall, ------------------------------------ --- ACTUAL TASKS data = { install = false, upgrade = false, remove = false, update = false, force = false, --User requested packages userInstall = {}, --List of requested packages as refs installList = {}, --List of outdated packages oldPackages = {}, upgradeList = {}, removeList = {} }, --PACKAGE: -- frontend -> frontend reference --optional: deps -> string list --optional: data -> data for frontend upgrade = function() core.data.upgrade = true core.data.install = true end, update = function() core.data.update = true end, --[[ Adds package installation task queue ]] install = function(name) if not base.installed[name] then core.data.install = true core.data.userInstall[#core.data.userInstall+1] = name end end, remove = function(name) core.data.remove = true if not base.installed[name] then error("Package "..name.." is not installed!") end core.data.removeList[#core.data.removeList+1] = name end, updateLists = function() for _, f in ipairs(frontends) do if f.updateLists then f.updateLists() end end end, checkPackage = function(name) for _, f in ipairs(frontends) do local exists, deps, data_ = f.findPackage(name) if exists then return {frontend = f, deps = deps, data = data_} end end end, --Get package indexes getPackages = function() for _, pack in pairs(core.data.userInstall)do local package = core.checkPackage(pack) if package then if not core.data.installList[pack] then core.data.installList[pack] = package end else error("Package "..pack.." not found! Try mpt -Sy") end end end, --checks if packages are up-to-date checkUpdate = function() for _, f in ipairs(frontends) do local updates = f.checkUpdate() if updates then for pack, data in pairs(updates) do core.data.oldPackages[pack] = {frontend = f, data = data} end end end end, countDeps = function(package) local toCheck = package.deps or {} for _, check in pairs(toCheck) do if not core.data.installList[check] and not base.installed[check] then local dep = core.checkPackage(check) if dep then core.data.installList[check] = dep core.countDeps(dep) end end end end, promptUser = function(msg) if core.data.remove then backend.log(">> Will remove:") for _, packName in pairs(core.data.removeList) do backend.log(packName) end end if core.data.upgrade then backend.log(">> Will upgrade:") for packName in pairs(core.data.oldPackages) do backend.log(packName) end end if core.data.install then backend.log(">> Will install:") for packName in pairs(core.data.installList) do backend.log(packName) end end backend.prompt(msg) end, doWork = function() if core.data.update then core.log(1, "Update", "Downloading package lists") core.updateLists() end if core.data.install then core.log(1, "Install", "Checking requested packages") core.getPackages() core.log(1, "Install", "Checking dependencies") for _, package in pairs(core.data.installList)do core.countDeps(package) end end if core.data.upgrade then core.log(1, "Upgrade", "Looking for old packages") core.checkUpdate() core.log(1, "Upgrade", "Getting update details") for name, package in pairs(core.data.oldPackages)do local exists, deps, data = package.frontend.findPackage(name) if exists then core.data.upgradeList[name] = {frontend = package.frontend, deps = deps, data = data} end end core.log(1, "Upgrade", "Checking dependencies") for _, package in pairs(core.data.upgradeList)do core.countDeps(package) end end core.promptUser("Do you want to continue?[y/N] ") if core.data.remove then core.log(1, "Core", "Removing packages") for _, package in pairs(core.data.removeList)do core.log(0, "Core", "Remove "..package) core.frontendForName(base.installed[package].frontend).removePackage(package) base.installed[package] = nil end end if core.data.install or core.data.upgrade then core.log(1, "Core", "Downloading files") local oldloglevel = loglevel loglevel = 0 local filelist = {} for _, package in pairs(core.data.installList)do local got = package.frontend.getFilesIntoCache(package.data) for _, file in ipairs(got)do if not filelist[file] then filelist[file] = true else error("File conflict detected!("..file..")") end end end for _, package in pairs(core.data.upgradeList)do package.files = package.frontend.getFilesIntoCache(package.data) end loglevel = oldloglevel if core.data.upgrade then core.log(1, "Upgrade", "Removing outdated packages") for name, package in pairs(core.data.upgradeList)do core.log(0, "Core", "Remove "..name) core.frontendForName(base.installed[name].frontend).removePackage(name) base.installed[name] = nil end for _, package in pairs(core.data.upgradeList)do for _, file in ipairs(package.files)do if not filelist[file] then filelist[file] = true else error("File conflict detected!("..file..").. It is really bad now :(") --...because files already got removed (: end end end end core.log(1, "Install", "Looking for file conflicts") for file in pairs(filelist)do if backend.fileExists(file) then error("File conflict detected!("..file.."), If this package was upgraded, it's uninstalled now") end end core.log(1, "Core", "Installing packages") for name, package in pairs(core.data.upgradeList)do package.frontend.installFiles(package.data) base.installed[name] = {frontend = package.frontend.name, deps=package.deps, data=package.data} end for name, package in pairs(core.data.installList)do package.frontend.installFiles(package.data) base.installed[name] = {frontend = package.frontend.name, deps=package.deps, data=package.data} end end end, frontendForName = function(name) for _, f in ipairs(frontends) do if f.name == name then return f end end end } -------- core.log(1, "Main", "> Loading settings") core.init() local state, reason = pcall(backend.run) if not state then io.stderr:write(reason .. "\n") end core.log(1, "Main", "> Saving settings") core.finalize() if core.reboot then backend.reboot() end
require("scripts.embeddablecallbackhack") local Ancient = RegisterMod("The Ancient",1) local game = Game() local ModRNG = RNG() local playerType = Isaac.GetPlayerTypeByName("The Ancient") local TheAncientInitPool = { [1] = { --GOLD DAMAGE = 4.5, SPEED = 0, TEARS = -3, SHOTSPEED = 5, TEARHEIGHT = 1, TEARFALLINGSPEED = 0, LUCK = 0, TEARFLAG = 0, ItemPool= { 429, 109 , 18, 380}, TrinketPool= { 83} }, [2] = { --MultiTears DAMAGE = -0.7, SPEED = 0.3, TEARS = 2, SHOTSPEED = -0.2, TEARHEIGHT = 0, TEARFALLINGSPEED = 0, LUCK = 0, TEARFLAG = 0, ItemPool= { 153, 245 , 424, 2}, TrinketPool= { 77} }, [3] = { --Bartolomé DAMAGE = -1, SPEED = 1, TEARS = 4, SHOTSPEED = 3, TEARHEIGHT = 2, TEARFALLINGSPEED = -3, LUCK = 3.5, TEARFLAG = 1, ItemPool= { 528, 512 , 529, 173}, TrinketPool= { 77} }, [4] = { --Bartolomé DAMAGE = 2.2, SPEED = -0.2, TEARS = -12, SHOTSPEED = -0.1, TEARHEIGHT = 0, TEARFALLINGSPEED = 0, LUCK = 7, TEARFLAG = 1, ItemPool= { 247, 8 , 67, 293}, TrinketPool= { 6} }, } --[[ Ancient:AddCallback(ModCallbacksMC_POST_CURSE_EVAL,function() game:GetLevel():AddCurse(2,true) end) ]] Ancient:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, function(_, fromSave) ModRNG:SetSeed(game:GetSeeds():GetStartSeed(), 35) -- Seed the rng for the run. local player = Isaac.GetPlayer(0) local data = player:GetData() data.QtyRoomCleared = 0 data.TakenHit = 0 end) Ancient:AddCallback(ModCallbacks.MC_POST_PLAYER_INIT, function(_, player) player:GetData().RandomStarterPack = ModRNG:RandomInt(#TheAncientInitPool) + 1 end) Ancient:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, function(_, player, cacheFlag) if player:GetName() == "The Ancient" then if not player:GetPlayerType() == playerType then return end if cacheFlag == CacheFlag.CACHE_DAMAGE then player.Damage = player.Damage + TheAncientInitPool[player:GetData().RandomStarterPack].DAMAGE elseif cacheFlag == CacheFlag.CACHE_MOVESPEED then player.MoveSpeed = player.MoveSpeed - TheAncientInitPool[player:GetData().RandomStarterPack].SPEED elseif cacheFlag == CacheFlag.CACHE_FIREDELAY then player.MaxFireDelay = player.MaxFireDelay - TheAncientInitPool[player:GetData().RandomStarterPack].TEARS elseif cacheFlag == CacheFlag.CACHE_SHOTSPEED then player.ShotSpeed = player.ShotSpeed - TheAncientInitPool[player:GetData().RandomStarterPack].SHOTSPEED elseif cacheFlag == CacheFlag.CACHE_TEARHEIGHT then player.TearHeight = player.TearHeight - TheAncientInitPool[player:GetData().RandomStarterPack].TEARHEIGHT elseif cacheFlag == CacheFlag.CACHE_TEARFALLINGSPEED then player.TearFallingSpeed = player.TearFallingSpeed - TheAncientInitPool[player:GetData().RandomStarterPack].TEARFALLINGSPEED elseif cacheFlag == CacheFlag.CACHE_LUCK then player.Luck = player.Luck + TheAncientInitPool[player:GetData().RandomStarterPack].LUCK elseif cacheFlag == CacheFlag.CACHE_TEARFLAG then player.TearFlags = player.TearFlags + TheAncientInitPool[player:GetData().RandomStarterPack].TEARFLAG end end end) local function TakeHit(_, player) local data = player:GetData() if not data.TakenHit then data.TakenHit = 0 end if not data.NewRoom then data.TakenHit = data.TakenHit + 1 else data.TakenHit = 0 end end Ancient:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, TakeHit, EntityType.ENTITY_PLAYER) Ancient:AddCallback(ModCallbacks.MC_PRE_SPAWN_CLEAN_AWARD, function() local player = Isaac.GetPlayer(0) local data = player:GetData() if player:GetName() == "The Ancient" then local room = game:GetRoom() player:GetData().QtyItemInList = 4 player:GetData().QtyTrinketInList = 1 if room:IsFirstVisit() then -- Game():GetRoom():SetFloorColor(Color(1,1,1,1,25,0,0)) --turn the ground into red color if room:IsClear() and data.TakenHit < 1 then player:GetData().QtyRoomCleared = player:GetData().QtyRoomCleared + 1 -- print(player:GetData().QtyRoomCleared) if player:GetData().QtyRoomCleared % 4 == 0 and player:GetData().QtyItemInList ~= 0 then local StartItemPos = room:FindFreePickupSpawnPosition(player.Position + Vector(0,-100), 0.0, true) local ItemPoolTemp = TheAncientInitPool[player:GetData().RandomStarterPack].ItemPool local itemIndex = math.random(#TheAncientInitPool) local randomItem = ItemPoolTemp[itemIndex ] Isaac.Spawn(5, 100, randomItem, StartItemPos, Vector(0,0), nil) data.QtyItemInList = data.QtyItemInList - 1 --[[ elseif data.QtyTrinketInListketQty ~= 0 then local StartTrinketPos = room:FindFreePickupSpawnPosition(player.Position + Vector(0,-100), 0.0, true) local TrinketPoolTemp = TheAncientInitPool[data.RandomStarterPack].TrinketPool local TrinketIndex = math.random(#TheAncientInitPool) local randomTrinket = TrinketPoolTemp[TrinketIndex ] Isaac.Spawn(5, 100, randomTrinket, StartTrinketPos, Vector(0,0), nil) data.QtyTrinketInList = data.QtyTrinketInList - 1 ]] end end end end end)
require('plugins') require('theme') require('mappings') require('commands') require('tabs')
local steamIds = { ["steam:11000013218ef32"] = true, --syd ["steam:1100001113b37ba"] = true, --syd } RegisterServerEvent('npc-doors:alterlockstate2') AddEventHandler('npc-doors:alterlockstate2', function() NPC.DoorCoords[10]["lock"] = 0 NPC.DoorCoords[11]["lock"] = 0 NPC.DoorCoords[12]["lock"] = 0 NPC.DoorCoords[39]["lock"] = 0 NPC.DoorCoords[40]["lock"] = 0 NPC.DoorCoords[41]["lock"] = 0 NPC.DoorCoords[42]["lock"] = 0 NPC.DoorCoords[44]["lock"] = 0 NPC.DoorCoords[45]["lock"] = 0 NPC.DoorCoords[46]["lock"] = 0 NPC.DoorCoords[47]["lock"] = 0 NPC.DoorCoords[48]["lock"] = 0 NPC.DoorCoords[49]["lock"] = 0 NPC.DoorCoords[50]["lock"] = 0 NPC.DoorCoords[51]["lock"] = 0 NPC.DoorCoords[52]["lock"] = 0 NPC.DoorCoords[53]["lock"] = 0 NPC.DoorCoords[54]["lock"] = 0 NPC.DoorCoords[55]["lock"] = 0 NPC.DoorCoords[56]["lock"] = 0 TriggerClientEvent('npc-doors:alterlockstateclient', source, NPC.DoorCoords) end) RegisterServerEvent('npc-doors:alterlockstate') AddEventHandler('npc-doors:alterlockstate', function(alterNum) NPC.alterState(alterNum) end) RegisterServerEvent('npc-doors:ForceLockState') AddEventHandler('npc-doors:ForceLockState', function(alterNum, state) NPC.DoorCoords[alterNum]["lock"] = state TriggerClientEvent('NPC:Door:alterState', -1, alterNum, state) end) RegisterServerEvent('npc-doors:requestlatest') AddEventHandler('npc-doors:requestlatest', function() local src = source local steamcheck = GetPlayerIdentifiers(source)[1] if steamIds[steamcheck] then TriggerClientEvent('doors:HasKeys',src,true) end TriggerClientEvent('npc-doors:alterlockstateclient', source,NPC.DoorCoords) end) function isDoorLocked(door) if NPC.DoorCoords[door].lock == 1 then return true else return false end end
o = Game.Players.LocalPlayer o.Character.Humanoid.PlatformStand = true bv = Instance.new("BodyAngularVelocity") bv.Parent = o.Character.Torso bv.angularvelocity = Vector3.new(0, 500, 0) bv.maxTorque = Vector3.new(math.huge, math.huge, math.huge) bg = Instance.new("BodyGyro") bg.Parent = o.Character.Torso bg.maxTorque = Vector3.new(0, 0, 0) wait(10) bv:Remove() bg:remove() o.Character.Humanoid.PlatformStand = false script:remove()
::foo:: do do ::my_label:: end goto foo end
local lure = require(select('1', ...):match(".-lure%.")..'init') -- -- Define class -- local class = lure.lib.upperclass:define('lure.dom.Document', lure.dom.Node) -- -- Specifies whether downloading of an XML file should be handled asynchronously or not -- class.public : async { default=false; type='boolean'; } -- -- Indicates if the document is closed for writing -- class.private : closed { default=true; type='boolean'; } -- -- Returns the Document Type Declaration associated with the document -- class.public : doctype { setter='private'; type='any'; } -- -- Returns the root node of the document -- class.public : documentElement { setter='protected'; type='any'; } -- -- Sets or returns the location of the document -- class.public : documentURI { type='string'; } -- -- Returns the configuration used when normalizeDocument() is invoked -- class.public : domConfig { setter='private'; type='any'; } -- -- Document's private domParser -- class.private : domParser { type='DOMParser'; } -- -- Returns the DOMImplementation object that handles this document -- class.public : implementation { setter='private'; type='any'; } -- -- Returns the encoding used for the document (when parsing) -- class.public : inputEncoding { setter='private'; type='any'; } -- -- Sets or returns whether error-checking is enforced or not -- class.public : strictErrorChecking { default=true; type='boolean'; } -- -- Returns the XML encoding of the document -- class.public : xmlEncoding { type='string'; } -- -- Sets or returns whether the document is standalone -- class.public : xmlStandalone { type='string' } -- -- Sets or returns the XML version of the document -- class.public : xmlVersion { type='string'; } -- -- Class constructor -- function class.public:init() lure.dom.Node.init(self, 9) -- Set the node name self.nodeName = "#document" -- Set the ownerDocument to self self.ownerDocument = self end -- -- appends a new child node to the end of the list of children of a node -- shadows Node:appendChild -- function class.public:appendChild(NODE) -- Call append child of base Node lure.dom.Node.appendChild(self, NODE) -- Set documentElement if NODE.nodeType == 1 and self.documentElement == nil then self.documentElement = NODE end return NODE end -- -- Adopts a node from another document to this document, and returns the adopted node -- function class.public:adoptNode(SOURCENODE) error("Method Not Yet Implimented") end -- -- finishes writing to a document, opened with document.open(). -- function class.public:close() if self.closed then error("Cannot close an already closed document") else self.closed = true end end -- -- Creates an attribute node with the specified name, and returns the new Attr object -- function class.public:createAttribute(NAME) return DOMAttribute(NAME) end -- -- Creates an attribute node with the specified name and namespace, and returns the new Attr object -- function class.public:createAttributeNS(URI, NAME) error("Method Not Yet Implimented") end -- -- Creates a CDATA section node -- function class.public:createCDATASection(DATA) return DOMCDATA(DATA) end -- -- Creates a comment node -- function class.public:createComment(DATA) return DOMComment(DATA) end -- -- Creates an empty DocumentFragment object, and returns it -- function class.public:createDocumentFragment() error("Method Not Yet Implimented") end -- -- Creates an element node -- function class.public:createElement(TAGNAME) lure.lib.upperclass:expect(TAGNAME):type('string'):ne(''):throw() return lure.dom.Element(TAGNAME) end -- -- Creates an element node with a specified namespace -- function class.public:createElementNS() error("Method Not Yet Implimented") end -- -- Creates an EntityReference object, and returns it -- function class.public:createEntityReference(NAME) error("Method Not Yet Implimented") end -- -- Creates a ProcessingInstruction object, and returns it -- function class.public:createProcessingInstruction(TARGET, DATA) error("Method Not Yet Implimented") end -- -- Creates a text node -- function class.public:createTextNode(TEXT) return DOMText(TEXT) end -- -- Imports a node from another document to this document. This method creates a new copy of the source node. If the deep parameter is set to true, it imports all children of the specified node. If set to false, it imports only the node itself. This method returns the imported node -- function class.public:importNode(NODE, DEEP) error("Method Not Yet Implimented") end -- -- normalizeDocument() -- function class.public:normalizeDocument() error("Method Not Yet Implimented") end -- -- opens a document for writing. -- function class.public:open() if self.closed == false then error("Cannot open an already opened document") end self.closed = false self.childNodes = lure.dom.NodeList() self.domParser = lure.dom.DOMParser(self) end -- -- Renames an element or attribute node -- function class.public:renameNode() error("Method Not Yet Implimented") end -- -- Writes a string of text to a document stream opened by document.open() -- function class.public:write(markup) lure.lib.upperclass:expect(markup):type('string'):ne(''):throw() if self.closed then self:open() end self.domParser:parseFromString(markup) end -- -- Compile Class -- return lure.lib.upperclass:compile(class)
--!A cross-platform build utility based on Lua -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- Copyright (C) 2015-present, TBOOX Open Source Group. -- -- @author ruki -- @file global.lua -- -- define module local sandbox_core_base_global = sandbox_core_base_global or {} -- load modules local os = require("base/os") local table = require("base/table") local global = require("base/global") local platform = require("platform/platform") local raise = require("sandbox/modules/raise") -- export some readonly interfaces sandbox_core_base_global.get = global.get sandbox_core_base_global.set = global.set sandbox_core_base_global.readonly = global.readonly sandbox_core_base_global.dump = global.dump sandbox_core_base_global.clear = global.clear sandbox_core_base_global.options = global.options sandbox_core_base_global.filepath = global.filepath sandbox_core_base_global.directory = global.directory sandbox_core_base_global.cachedir = global.cachedir -- save the configure function sandbox_core_base_global.save() local ok, errors = global.save() if not ok then raise(errors) end end -- return module return sandbox_core_base_global
local M = {} M.config = {} local default_cfg = { keymaps = { blame = "<Leader>gb", quit_blame = "q", blame_commit = "<CR>", browse = "<Leader>go", open_pull_request = "<Leader>gp", create_pull_request = "<Leader>gn", }, target_branch = "master", } function M.setup(cfg) if cfg == nil then cfg = {} end for k, v in pairs(default_cfg) do if cfg[k] ~= nil then if type(v) == "table" then M.config[k] = vim.tbl_extend("force", v, cfg[k]) else M.config[k] = cfg[k] end else M.config[k] = default_cfg[k] end end end return M
--[[ Copyright 2014 The Luvit Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --]] --[[ --Observable is a stream that can be observed outside the pipeline. observe() --returns a new Readable stream that emits all data that passes through this --stream. Streams created by observe() do not affect back-pressure. --]] local Transform = require('./stream_transform').Transform local Readable = require('./stream_readable').Readable local Observable = Transform:extend() function Observable:initialize(options) --[[ if (!(this instanceof PassThrough)) return new PassThrough(options) --]] Transform.initialize(self, options) self.options = options self.observers = {} end function Observable:_transform(chunk, cb) for _,v in pairs(self.observers) do v:push(chunk) end cb(nil, chunk) end function Observable:observe() local obs = Readable:new(self.options) obs._read = function() end table.insert(self.observers, obs) return obs end return { Observable = Observable }
return {'ciel','ciere','cieremans','ciels'}
screwdriver = screwdriver or {} local S = minetest.get_translator("xdecor") local FS = function(...) return minetest.formspec_escape(S(...)) end local ceil, abs, random = math.ceil, math.abs, math.random local reg_tools = minetest.registered_tools local allowed_tools = {} -- Cost in Mese crystal(s) for enchanting. local mese_cost = 1 -- Force of the enchantments. local enchanting = { uses = 1.2, -- Durability times = 0.1, -- Efficiency damages = 1, -- Sharpness } local function cap(str) return str:gsub("^%l", string.upper) end local function to_percent(orig_value, final_value) return abs(ceil(((final_value - orig_value) / orig_value) * 100)) end function enchanting:get_tooltip(enchant, orig_caps, fleshy) local bonus = {durable = 0, efficiency = 0, damages = 0, silktouch = 0} if orig_caps then bonus.durable = to_percent(orig_caps.uses, orig_caps.uses * enchanting.uses) local sum_caps_times = 0 for i=1, #orig_caps.times do sum_caps_times = sum_caps_times + orig_caps.times[i] end local average_caps_time = sum_caps_times / #orig_caps.times bonus.efficiency = to_percent(average_caps_time, average_caps_time - enchanting.times) end if fleshy then bonus.damages = to_percent(fleshy, fleshy + enchanting.damages) end local specs = { -- not finished, to complete durable = {"#00baff", " (+" .. bonus.durable .. "%)"}, fast = {"#74ff49", " (+" .. bonus.efficiency .. "%)"}, sharp = {"#ffff00", " (+" .. bonus.damages .. "%)"}, silktouch = {"#ffff00", " "} } local enchant_loc = { fast = S("Efficiency"), durable = S("Durability"), sharp = S("Sharpness"), silktouch = S("Silk Touch") } return minetest.colorize and minetest.colorize(specs[enchant][1], "\n" .. enchant_loc[enchant] .. specs[enchant][2]) or "\n" .. enchant_loc[enchant] .. specs[enchant][2] end local enchantments = { fast = "Efficiency", durable = "Durability", silktouch = "Silk Touch", sharp = "Sharpness" } local enchant_buttons = {"3.9,0.65;4,0.92", "3.9,1.6;4,1.12", "3.9,2.75;4,0.92"} function enchanting.formspec(pos, enchants) local meta = minetest.get_meta(pos) local formspec = [[ size[9,8.6;] no_prepend[] bgcolor[#080808BB;true] listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] background9[0,0;9,9;ench_ui.png;6] list[context;tool;0.9,2.9;1,1;] list[context;mese;2,2.9;1,1;] list[current_player;main;0.55,4.5;8,4;] listring[current_player;main] listring[context;tool] listring[current_player;main] listring[context;mese] image[2,2.9;1,1;mese_layout.png] ]] .."tooltip[sharp;"..FS("Your weapon inflicts more damages").."]" .."tooltip[durable;"..FS("Your tool last longer").."]" .."tooltip[fast;"..FS("Your tool digs faster").."]" .."tooltip[silktouch;"..FS("Your tool has Silk Touch").."]" ..default.gui_slots .. default.get_hotbar_bg(0.55, 4.5) -- formspec = formspec .. (enchant_buttons[num] or "") if enchants then local cur_button = 1 for enchant in enchants:gmatch("[%w_]+") do if enchant_buttons[cur_button] then formspec = formspec .. "image_button[" .. enchant_buttons[cur_button] .. ";bg_btn.png;" .. enchant ..";" .. FS(enchantments[enchant]) .."]" cur_button = cur_button + 1 end end end meta:set_string("formspec", formspec) end function enchanting.on_put(pos, listname, _, stack) if listname == "tool" then enchanting.formspec(pos, allowed_tools[stack:get_name()].enchants) end end function enchanting.fields(pos, _, fields, sender) if not next(fields) or fields.quit then return end if minetest.is_protected(pos, sender:get_player_name()) then return end local inv = minetest.get_meta(pos):get_inventory() local tool = inv:get_stack("tool", 1) local mese = inv:get_stack("mese", 1) local orig_wear = tool:get_wear() if tool and tool:get_name() and allowed_tools[tool:get_name()] then local mod, name = allowed_tools[tool:get_name()].template:match("(.*):(.*)") local enchanted_tool = (mod or "") .. ":enchanted_" .. (name or "") .. "_" .. next(fields) if mese:get_count() >= mese_cost and reg_tools[enchanted_tool] then minetest.sound_play("xdecor_enchanting", { to_player = sender:get_player_name(), gain = 0.8 }) tool:replace(enchanted_tool) tool:add_wear(orig_wear) mese:take_item(mese_cost) inv:set_stack("mese", 1, mese) inv:set_stack("tool", 1, tool) enchanting.formspec(pos) end end end function enchanting.dig(pos) local inv = minetest.get_meta(pos):get_inventory() return inv:is_empty("tool") and inv:is_empty("mese") end function enchanting.put(pos, listname, _, stack, player) if minetest.is_protected(pos, player:get_player_name()) then return 0 end local stackname = stack:get_name() if listname == "mese" and (stackname == "default:mese_crystal" or stackname == "imese:industrial_mese_crystal") then return stack:get_count() elseif listname == "tool" and allowed_tools[stack:get_name()] then return 1 end return 0 end function enchanting.on_take(pos, listname) if listname == "tool" then enchanting.formspec(pos) end end function enchanting.construct(pos) local meta = minetest.get_meta(pos) meta:set_string("infotext", S("Enchantment Table")) enchanting.formspec(pos) local inv = meta:get_inventory() inv:set_size("tool", 1) inv:set_size("mese", 1) minetest.add_entity({x = pos.x, y = pos.y + 0.85, z = pos.z}, "xdecor:book_open") local timer = minetest.get_node_timer(pos) timer:start(0.5) end function enchanting.destruct(pos) for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0.9)) do if obj and obj:get_luaentity() and obj:get_luaentity().name == "xdecor:book_open" then obj:remove() break end end end function enchanting.timer(pos) local num = #minetest.get_objects_inside_radius(pos, 0.9) if num == 0 then minetest.add_entity({x = pos.x, y = pos.y + 0.85, z = pos.z}, "xdecor:book_open") end local minp = {x = pos.x - 2, y = pos.y, z = pos.z - 2} local maxp = {x = pos.x + 2, y = pos.y + 1, z = pos.z + 2} local bookshelves = minetest.find_nodes_in_area(minp, maxp, "default:bookshelf") if #bookshelves == 0 then return true end local bookshelf_pos = bookshelves[random(1, #bookshelves)] local x = pos.x - bookshelf_pos.x local y = bookshelf_pos.y - pos.y local z = pos.z - bookshelf_pos.z if tostring(x .. z):find(2) then minetest.add_particle({ pos = bookshelf_pos, velocity = {x = x, y = 2 - y, z = z}, acceleration = {x = 0, y = -2.2, z = 0}, expirationtime = 1, size = 1.5, glow = 5, texture = "xdecor_glyph" .. random(1,18) .. ".png" }) end return true end xdecor.register("enchantment_table", { description = S("Enchantment Table"), tiles = { "xdecor_enchantment_top.png", "xdecor_enchantment_bottom.png", "xdecor_enchantment_side.png", "xdecor_enchantment_side.png", "xdecor_enchantment_side.png", "xdecor_enchantment_side.png" }, groups = {cracky = 1, level = 1}, light_source = 6, sounds = default.node_sound_stone_defaults(), on_rotate = screwdriver.rotate_simple, can_dig = enchanting.dig, on_timer = enchanting.timer, on_construct = enchanting.construct, on_destruct = enchanting.destruct, on_receive_fields = enchanting.fields, on_metadata_inventory_put = enchanting.on_put, on_metadata_inventory_take = enchanting.on_take, allow_metadata_inventory_put = enchanting.put, allow_metadata_inventory_move = function() return 0 end, allow_metadata_inventory_take = function(pos, _, _, stack, player) if minetest.is_protected(pos, player:get_player_name()) then return 0 else return stack:get_count() end end, }) minetest.register_entity("xdecor:book_open", { visual = "sprite", visual_size = {x=0.75, y=0.75}, collisionbox = {0}, physical = false, textures = {"xdecor_book_open.png"}, on_activate = function(self) local pos = self.object:get_pos() local pos_under = {x = pos.x, y = pos.y - 1, z = pos.z} if minetest.get_node(pos_under).name ~= "xdecor:enchantment_table" then self.object:remove() end end }) --[[ Due to the way this is hacked together, any mod with multiple materials and using non-standard naming convention will need to call register tools separately for each material and use the 'name = ""' code for each item ]]-- function enchanting:register_tools(mod, def) for tool, dt in pairs(def.tools) do for material in def.materials:gmatch("[%w_]+") do local tname = dt.name or mod .. ":" .. tool .. "_" .. material allowed_tools[tname] = { template = mod .. ":" .. tool .. "_" .. material, enchants = dt.enchants } for enchant in dt.enchants:gmatch("[%w_]+") do local original_tool = reg_tools[(tname)] if not original_tool then break end local original_toolcaps = original_tool.tool_capabilities if original_toolcaps then local original_damage_groups = original_toolcaps.damage_groups local original_groupcaps = original_toolcaps.groupcaps local groupcaps = table.copy(original_groupcaps) local fleshy = original_damage_groups.fleshy local full_punch_interval = original_toolcaps.full_punch_interval local max_drop_level = original_toolcaps.max_drop_level local group = next(original_groupcaps) local silktouch = 0 if enchant == "durable" then groupcaps[group].uses = ceil(original_groupcaps[group].uses * enchanting.uses) elseif enchant == "fast" then for i, time in pairs(original_groupcaps[group].times) do groupcaps[group].times[i] = time - enchanting.times end elseif enchant == "sharp" then fleshy = fleshy + enchanting.damages elseif enchant == "silktouch" then silktouch = 1 end minetest.register_tool(":" .. mod .. ":enchanted_" .. tool .. "_" .. material .. "_" .. enchant, { description = S("Enchanted @1 @2 @3", def.material_desc[material] or cap(material), dt.desc or cap(tool), self:get_tooltip(enchant, original_groupcaps[group], fleshy)), inventory_image = original_tool.inventory_image .. "^[colorize:violet:50", wield_image = original_tool.wield_image, groups = {not_in_creative_inventory = 1, silktouch = silktouch}, tool_capabilities = { groupcaps = groupcaps, damage_groups = {fleshy = fleshy}, full_punch_interval = full_punch_interval, max_drop_level = max_drop_level }, }) end end end end end enchanting:register_tools("default", { materials = "steel, bronze, mese, diamond", material_desc = {steel = S("Steel"), bronze = S("Bronze"), mese = S("Mese"), diamond = S("Diamond")}, tools = { axe = {enchants = "durable, fast, silktouch", desc = S("Axe")}, pick = {enchants = "durable, fast, silktouch", desc = S("Pickaxe")}, shovel = {enchants = "durable, fast, silktouch", desc = S("Shovel")}, sword = {enchants = "sharp", desc = S("Sword")} } }) if minetest.get_modpath("ethereal") then enchanting:register_tools("ethereal", { materials = "crystal", material_desc = {crystal = S("Crystal")}, tools = { axe = {enchants = "durable, fast, silktouch", desc = S("Axe")}, pick = {enchants = "durable, fast, silktouch", desc = S("Pickaxe")}, shovel = {enchants = "durable, fast", desc = S("Shovel")}, sword = {enchants = "sharp", desc = S("Sword")} } }) end if minetest.get_modpath("moreores") then enchanting:register_tools("moreores", { materials = "tin, silver, mithril", material_desc = {tin = S("Tin"), silver = S("Silver"), mithril = S("Mithril")}, tools = { axe = {enchants = "durable, fast, silktouch", desc = S("Axe")}, pick = {enchants = "durable, fast, silktouch", desc = S("Pickaxe")}, shovel = {enchants = "durable, fast, silktouch", desc = S("Shovel")}, sword = {enchants = "sharp", desc = S("Sword")} } }) end if minetest.get_modpath("nether") then enchanting:register_tools("nether", { materials = "nether", material_desc = {nether = S("Nether")}, tools = { axe = {enchants = "durable, fast, silktouch", desc = S("Axe")}, pick = {enchants = "durable, fast, silktouch", desc = S("Pickaxe")}, shovel = {enchants = "durable, fast, silktouch", desc = S("Shovel")}, sword = {enchants = "sharp", desc = S("Sword")} } }) end for _,name in ipairs({"Amethyst", "Emerald", "Ruby", "Sapphire"}) do gem = string.lower(name) if minetest.get_modpath("gs_" .. gem) then enchanting:register_tools("gs_" .. gem, { materials = "gs_" .. gem, material_desc = {["gs_" .. gem] = S(name)}, tools = { axe = {enchants = "durable, fast, silktouch", desc = S("Axe"), name = "gs_" .. gem .. ":" .. gem .. "_axe"}, pick = {enchants = "durable, fast, silktouch", desc = S("Pickaxe"), name = "gs_" .. gem .. ":" .. gem .. "_pickaxe"}, shovel = {enchants = "durable, fast, silktouch", desc = S("Shovel"), name = "gs_" .. gem .. ":" .. gem .. "_shovel"}, sword = {enchants = "sharp", desc = S("Sword"), name = "gs_" .. gem .. ":" .. gem .. "_sword"} } }) end end if minetest.get_modpath("rainbow_ore") then enchanting:register_tools("rainbow_ore", { materials = "rainbow_ore", material_desc = {rainbow_ore = S("Rainbow")}, tools = { axe = {enchants = "durable, fast, silktouch", desc = S("Axe"), name = "rainbow_ore:rainbow_ore_axe"}, pick = {enchants = "durable, fast, silktouch", desc = S("Pickaxe"), name = "rainbow_ore:rainbow_ore_pickaxe"}, shovel = {enchants = "durable, fast, silktouch", desc = S("Shovel"), name = "rainbow_ore:rainbow_ore_shovel"}, sword = {enchants = "sharp", desc = S("Sword"), name = "rainbow_ore:rainbow_ore_sword"} } }) end if minetest.get_modpath("lavastuff") then enchanting:register_tools("lavastuff", { materials = "lavastuff", material_desc = {lavastuff = S("Lava")}, tools = { axe = {enchants = "durable, fast, silktouch", desc = S("Axe"), name = "lavastuff:axe"}, pick = {enchants = "durable, fast", desc = S("Pickaxe"), name = "lavastuff:pick"}, shovel = {enchants = "durable, fast, silktouch", desc = S("Shovel"), name = "lavastuff:shovel"}, sword = {enchants = "sharp", desc = S("Sword"), name = "lavastuff:sword"} } }) end if minetest.get_modpath("tools_obsidian") then enchanting:register_tools("tools_obsidian", { materials = "tools_obsidian", material_desc = {tools_obsidian = S("Obsidian")}, tools = { axe = {enchants = "durable, fast, silktouch", desc = S("Axe"), name = "tools_obsidian:axe_obsidian"}, pick = {enchants = "durable, fast, silktouch", desc = S("Pickaxe"), name = "tools_obsidian:pick_obsidian"}, shovel = {enchants = "durable, fast, silktouch", desc = S("Shovel"), name = "tools_obsidian:shovel_obsidian"}, sword = {enchants = "sharp", desc = S("Sword"), name = "tools_obsidian:sword_obsidian"}, longsword = {enchants = "sharp", desc = S("Longsword"), name = "tools_obsidian:longsword_obsidian"} } }) end if minetest.get_modpath("obsidianmese") then enchanting:register_tools("obsidianmese", { materials = "obsidianmese", material_desc = {obsidianmese = S("Obsidian Mese")}, tools = { axe = {enchants = "durable, fast", desc = S("Axe"), name = "obsidianmese:axe"}, pick = {enchants = "durable, fast, silktouch", desc = S("Pickaxe"), name = "obsidianmese:pick"}, shovel = {enchants = "durable, fast", desc = S("Shovel"), name = "obsidianmese:shovel"}, sword = {enchants = "sharp", desc = S("Sword"), name = "obsidianmese:sword"}, } }) end -- Recipes minetest.register_craft({ output = "xdecor:enchantment_table", recipe = { {"", "default:book", ""}, {"default:diamond", "default:obsidian", "default:diamond"}, {"default:obsidian", "default:obsidian", "default:obsidian"} } }) local mt_hnd = minetest.handle_node_drops function minetest.handle_node_drops(pos, drops, digger) if digger then if minetest.get_item_group(digger:get_wielded_item():get_name(), "silktouch") == 1 then return mt_hnd(pos, {ItemStack(minetest.get_node(pos).name)}, digger) end end return mt_hnd(pos, drops, digger) end
local RAYCAST_CUSHION = 2 local CharacterState = require(script.Parent.Parent.CharacterState) return function(self) local luanoid = self.Luanoid local rootPart = luanoid.RootPart local curState = luanoid.State local groundDistanceGoal = luanoid.HipHeight + rootPart.Size.Y / 2 + RAYCAST_CUSHION local currentVelocityY = rootPart.AssemblyLinearVelocity.Y local raycastResult = self.RaycastResult local newState if luanoid.Health <= 0 then newState = CharacterState.Dead else if rootPart:GetRootPart() == rootPart then if curState == CharacterState.Jumping then if currentVelocityY < 0 then -- We passed the peak of the jump and are now falling downward newState = CharacterState.Falling luanoid.Floor = nil end else if raycastResult and (rootPart.Position - raycastResult.Position).Magnitude < groundDistanceGoal then -- We are grounded if luanoid.Jump then newState = CharacterState.Jumping else if luanoid.MoveDirection.Magnitude > 0 then newState = CharacterState.Walking else newState = CharacterState.Idling end end luanoid.Floor = raycastResult.Instance else newState = CharacterState.Falling luanoid.Floor = nil end end else -- HRP isn't RootPart so Character is likely welded to something newState = CharacterState.Physics luanoid.Floor = nil end end luanoid.Jump = false return newState or curState end
--- The DragonBonesCPP Sample -- @author zrong(zengrong.net) -- Creation 2014-04-28 local DragonBonesDemo = class("DragonBonesDemo", function() return display.newScene("DragonBonesDemo") end) function DragonBonesDemo:ctor(nextHandler, prevHandler, resetHandler, closeHandler) self._onNext = nextHandler self._onPrev = prevHandler self._onReset = resetHandler self._onClose = closeHandler self:_addUI() self:_showTitles() end function DragonBonesDemo:_addUI() cc.ui.UIPushButton.new("close.png") :align(display.RIGHT_BOTTOM, display.width, display.bottom) :addTo(self, 0) :onButtonClicked(self._onClose) self._prevBtn = cc.ui.UIPushButton.new({normal="b1.png",pressed="b2.png"}) :align(display.BOTTOM_CENTER, display.cx-100, display.bottom) :addTo(self, 0) :onButtonClicked(self._onPrev) self._resetBtn = cc.ui.UIPushButton.new({normal="r1.png",pressed="r2.png"}) :align(display.BOTTOM_CENTER, display.cx, display.bottom) :addTo(self, 0) :onButtonClicked(self._onReset) self._nextBtn = cc.ui.UIPushButton.new({normal="f1.png",pressed="f2.png"}) :align(display.BOTTOM_CENTER, display.cx+100, display.bottom) :addTo(self, 0) :onButtonClicked(self._onNext) self._title = ui.newTTFLabel({ text="DragonBonesCPP for quick-cocos2d-x", }) :align(display.CENTER, display.cx, display.top-20) :addTo(self, 0) end function DragonBonesDemo:_showTitles() print("DragonBonesDemo:", self.mainTitle) if self.mainTitle then ui.newTTFLabel({text=self.mainTitle}) :addTo(self, 0) :pos(display.cx, display.top-50) end if self.subTitle then ui.newTTFLabel({text=self.subTitle}) :addTo(self, 0) :pos(display.cx, display.top-80) end end function DragonBonesDemo:onExit() print("DragonBonesDemo exit") self._onNext = nil self._onPrev = nil self._onReset = nil self._onClose = nil end return DragonBonesDemo
object_tangible_collection_col_gcw_city_imp_3 = object_tangible_collection_shared_col_gcw_city_imp_3:new { gameObjectType = 8211,} ObjectTemplates:addTemplate(object_tangible_collection_col_gcw_city_imp_3, "object/tangible/collection/col_gcw_city_imp_3.iff")
require('dialogue') local d = Dialogue:new() d:seq{ start=true, name="test", next="testFunc", {text="This is a sample dialogue"}, {text="This is some more interesting text"}, {text="This conversation is over!"} } -- d:add{name="a", text="This is a sample dialogue", next="b", start=true} -- d:add{name="b", text="This is some more interesting text", next="c"} -- d:add{name="c", text="This conversation is over!"} -- Second Dialogue - Choice and Function nodes d:add{ start=true, package="second", name="choice", text="What do you want to say?", choices={ {text="Say Hello", next="saidHello"}, {text="Say Goodbye", next="saidGoodbye"} } } d:add{package="second", name="saidHello", text="You said hello!", next="f"} d:add{package="second", name="saidGoodbye", text="You said goodbye!", next="f"} d:func({package="second", name="f", next="complete"}, function(d) print("testFunc() called!") end) d:add{package="second", name="complete", text="And now it's complete!"} -- Third Dialog d:add{package="third", name="a", text="And this is yet another dialogue", next="b", start=true} d:add{package="third", name="b", text="Because we have so much to say", next="c"} d:add{package="third", name="c", text="But not anymore"} return d
local OverlayColors = { electricity = { 0, RGBA(12 , 94 , 248, 80 ), RGBA(12 , 13 , 248, 120), RGBA(255, 23 , 255, 120), RGBA(253, 11 , 13 , 120), RGBA(255, 244, 11 , 120), RGBA(26 , 203, 9 , 120), RGBA(10 , 203, 192, 180), RGBA(240, 240, 240, 80 ), }, water = { 0, RGBA(12 , 94 , 248, 80 ), RGBA(12 , 13 , 248, 120), RGBA(255, 23 , 255, 120), RGBA(253, 11 , 13 , 120), RGBA(255, 244, 11 , 120), RGBA(26 , 203, 9 , 120), RGBA(10 , 203, 192, 180), RGBA(240, 240, 240, 80 ), }, } GlobalVar("OverlaySupplyPallettes", false) function OnMsg.NewGame() OverlaySupplyPallettes = { electricity = false, water = false, custom = false, } end function GetGridOverlayIndex(grid) return grid.overlay_id end function Lua_BuildOverlaySupplyGrid() local game_map = ActiveGameMap local supply_connection_grid = game_map.supply_connection_grid local supply_overlay_grid = game_map.supply_overlay_grid BuildOverlaySupplyGrid(supply_overlay_grid, supply_connection_grid.electricity, supply_connection_grid.water) end function RebuildOverlaySupplyPalettes() OverlaySupplyPallettes.electricity = {} local e = OverlaySupplyPallettes.electricity local ce = OverlayColors.electricity OverlaySupplyPallettes.water = {} local w = OverlaySupplyPallettes.water local cw = OverlayColors.water --[[ OverlaySupplyPallettes.all = {} local a = OverlaySupplyPallettes.all local function MixRGBA(col_1, col_2) local r1, g1, b1, a1 = GetRGBA(col_1) local r2, g2, b2, a2 = GetRGBA(col_2) return RGBA((r1 + r2) / 2, (g1 + g2) / 2, (b1 + b2) / 2, (a1 + a2) / 2) end ]] for i = 1, 256 do e[i] = ce[band(i - 1, 15) % #ce + 1] w[i] = cw[shift(i - 1, -4) % #cw + 1] --a[i] = MixRGBA(e[i], w[i]) end end function GetOverlaySupplyGridValAtTerrainCursor() local p = GetTerrainCursor() local q, r = WorldToHex(p:x(), p:y()) local supply_overlay_grid = ActiveGameMap.supply_overlay_grid return supply_overlay_grid:get(q+r/2, r) end show_overlay = false local overlay_grid_dirty = false function GetOverlayPalette() return show_overlay == "water" and OverlaySupplyPallettes.water or show_overlay == "custom_supply" and OverlaySupplyPallettes.custom or show_overlay == "electricity" and OverlaySupplyPallettes.electricity or empty_table end function GetOverlayGrid() local supply_overlay_grid = ActiveGameMap.supply_overlay_grid return (show_overlay == "water" or show_overlay == "custom_supply" or show_overlay == "electricity") and supply_overlay_grid end function GetOverlayTransform() return 0, 1 end function GetOverlayBorder() return RGBA(255, 255, 255, 255) end function RefreshSupplyGridOverlay_Exec() if show_overlay then if overlay_grid_dirty then local grid = GetOverlayGrid() local border = GetOverlayBorder() if type(overlay_grid_dirty) == "boolean" or overlay_grid_dirty == grid then local offset, scale = GetOverlayTransform() SetOverlayGrid(GetOverlayPalette(), grid, border, offset, scale) end end if hr.RenderOverlayGrid == 0 then hr.RenderOverlayGrid = 1 end elseif hr.RenderOverlayGrid == 1 then hr.RenderOverlayGrid = 0 end overlay_grid_dirty = false end function RefreshSupplyGridOverlay(grid) overlay_grid_dirty = not overlay_grid_dirty and grid or true DelayedCall(0, RefreshSupplyGridOverlay_Exec) end function ShowWaterOverlay() show_overlay = "water" local supply_overlay_grid = ActiveGameMap.supply_overlay_grid RefreshSupplyGridOverlay(supply_overlay_grid) end function HideOverlay() show_overlay = false DelayedCall(0, RefreshSupplyGridOverlay_Exec) end HideAllSupplyOverlays = HideOverlay function ShowElectricityOverlay() show_overlay = "electricity" local supply_overlay_grid = ActiveGameMap.supply_overlay_grid RefreshSupplyGridOverlay(supply_overlay_grid) end function CycleElectricityOverlay() local realm = GetRealmByID(ActiveMapID) local electricity_grids = GetCommandCenterPowerGrids() CycleGrids(electricity_grids) ShowElectricityOverlay() end local last_sel_obj = false local last_seen_grid = 0 function CycleGrids(grids) local idx = last_seen_grid + 1 if idx > #grids then idx = 1 end last_seen_grid = idx local grid = grids[idx] if grid then local root = CommandCenterChooseGridBuilding(grid) ViewAndSelectObject(root) last_sel_obj = root end end function CycleWaterOverlay() local lifesupport_grids = GetCommandCenterLifeSupportGrids() local water_grids = table.map(lifesupport_grids, "water") CycleGrids(water_grids) ShowWaterOverlay() end function OnMsg.OverlaySupplyGridChanged() local supply_overlay_grid = ActiveGameMap.supply_overlay_grid RefreshSupplyGridOverlay(supply_overlay_grid) end function OnMsg.SwitchMap() RebuildOverlaySupplyPalettes() HideAllSupplyOverlays() end local function ClearLastSelObj() last_sel_obj = false end function OnMsg.SelectionChange() if hr.RenderOverlayGrid then if SelectedObj and SelectedObj ~= last_sel_obj then last_sel_obj = SelectedObj HideAllSupplyOverlays() elseif not SelectedObj then DelayedCall(1000, ClearLastSelObj) end end end function AssignOverlayIDsToAllGrids() local c = UICity.electricity for i = 1, #c do c[i]:AssignOverlayID() end c = UICity.water for i = 1, #c do c[i]:AssignOverlayID() end end function SavegameFixups.BuildOverlayGridsFromScratch() RebuildOverlaySupplyPalettes() AssignOverlayIDsToAllGrids() Lua_BuildOverlaySupplyGrid() end local last_custom_grid = false function ShowOverlayForSupplyGrid(supply_type, overlay_id, color) local arg_hash = xxhash64(supply_type, overlay_id, color) if last_custom_grid ~= arg_hash then OverlaySupplyPallettes.custom = {} local c = OverlaySupplyPallettes.custom for i = 1, 256 do c[i] = 0 end overlay_id = supply_type == "water" and shift(overlay_id, 4) or overlay_id local sft = supply_type == "water" and 0 or 4 for i = 0, 8 do c[bor(overlay_id, shift(i, sft)) + 1] = color end last_custom_grid = arg_hash end show_overlay = "custom_supply" local supply_overlay_grid = ActiveGameMap.supply_overlay_grid RefreshSupplyGridOverlay(supply_overlay_grid) end
ikopi_stag = Creature:new { objectName = "@mob/creature_names:ikopi_stag", socialGroup = "self", faction = "", level = 30, chanceHit = 0.39, damageMin = 290, damageMax = 300, baseXp = 3005, baseHAM = 8400, baseHAMmax = 10300, armor = 0, resists = {130,130,20,20,20,-1,-1,-1,-1}, meatType = "meat_wild", meatAmount = 100, hideType = "hide_bristley", hideAmount = 75, boneType = "bone_mammal", boneAmount = 75, milk = 0, tamingChance = 0.25, ferocity = 3, pvpBitmask = ATTACKABLE, creatureBitmask = PACK, optionsBitmask = AIENABLED, diet = CARNIVORE, templates = {"object/mobile/ikopi_hue.iff"}, hues = { 0, 1, 2, 3, 4, 5, 6, 7 }, scale = 1.25, lootGroups = {}, weapons = {}, conversationTemplate = "", attacks = { {"stunattack",""} } } CreatureTemplates:addCreatureTemplate(ikopi_stag, "ikopi_stag")
--[[ LuCI - Lua Configuration Interface Copyright 2019 lisaac <https://github.com/lisaac/luci-app-dockerman> ]]-- require "luci.util" local uci = luci.model.uci.cursor() local docker = require "luci.model.docker" local dk = docker.new() local containers, images local res = dk.images:list() if res.code <300 then images = res.body else return end res = dk.containers:list({query = {all=true}}) if res.code <300 then containers = res.body else return end function get_images() local data = {} for i, v in ipairs(images) do local index = v.Created .. v.Id data[index]={} data[index]["_selected"] = 0 data[index]["_id"] = v.Id:sub(8,20) if v.RepoTags then for i, v1 in ipairs(v.RepoTags) do data[index]["_tags"] =(data[index]["_tags"] and ( data[index]["_tags"] .. "<br\>" )or "") .. v1 end else _,_, data[index]["_tags"] = v.RepoDigests[1]:find("^(.-)@.+") data[index]["_tags"]=data[index]["_tags"]..":none" end for ci,cv in ipairs(containers) do if v.Id == cv.ImageID then data[index]["_containers"] = (data[index]["_containers"] and (data[index]["_containers"] .. " | ") or "").. "<a href=/cgi-bin/luci/admin/services/docker/container/"..cv.Id.." >".. cv.Names[1]:sub(2).."</a>" end end data[index]["_size"] = string.format("%.2f", tostring(v.Size/1024/1024)).."MB" data[index]["_created"] = os.date("%Y/%m/%d %H:%M:%S",v.Created) end return data end local image_list = get_images() -- m = Map("docker", translate("Docker")) m = SimpleForm("docker", translate("Docker")) m.template = "dockerman/cbi/xsimpleform" m.submit=false m.reset=false local pull_value={{_image_tag_name="", _registry="index.docker.io"}} local pull_section = m:section(Table,pull_value, translate("Pull Image")) pull_section.template="cbi/nullsection" local tag_name = pull_section:option(Value, "_image_tag_name") tag_name.template = "dockerman/cbi/inlinevalue" tag_name.placeholder="hello-world:latest" local registry = pull_section:option(Value, "_registry") registry.template = "dockerman/cbi/inlinevalue" registry:value("index.docker.io", "Docker Hub") registry:value("hub-mirror.c.163.com", "163 Mirror") registry:value("mirror.ccs.tencentyun.com", "Tencent Mirror") registry:value("docker.mirrors.ustc.edu.cn", "USTC Mirror") local action_pull = pull_section:option(Button, "_pull") action_pull.inputtitle= translate("Pull") action_pull.template = "dockerman/cbi/inlinebutton" action_pull.inputstyle = "add" tag_name.write = function(self, section,value) local hastag = value:find(":") if not hastag then value = value .. ":latest" end pull_value[section]["_image_tag_name"] = value end registry.write = function(self, section,value) pull_value[section]["_registry"] = value end action_pull.write = function(self, section) local tag = pull_value[section]["_image_tag_name"] local server = pull_value[section]["_registry"] --去掉协议前缀和后缀 local _,_,tmp = server:find(".-://([%.%w%-%_]+)") if not tmp then _,_,server = server:find("([%.%w%-%_]+)") end local json_stringify = luci.jsonc and luci.jsonc.stringify if tag and tag ~= "" then docker:clear_status() docker:append_status("Images: " .. "pulling" .. " " .. tag .. "...") local x_auth = nixio.bin.b64encode(json_stringify({serveraddress= server})) local res = dk.images:create({query = {fromImage=tag}, header={["X-Registry-Auth"] = x_auth}}) if res and res.code >=300 then docker:append_status("fail code:" .. res.code.." ".. (res.body.message and res.body.message or res.message).. "<br>") else docker:append_status("done<br>") end else docker:append_status("fail code: 400 please input the name of image name!") end luci.http.redirect(luci.dispatcher.build_url("admin/services/docker/images")) end image_table = m:section(Table, image_list, translate("Images")) image_selecter = image_table:option(Flag, "_selected","") image_selecter.disabled = 0 image_selecter.enabled = 1 image_selecter.default = 0 image_id = image_table:option(DummyValue, "_id", translate("ID")) image_table:option(DummyValue, "_tags", translate("RepoTags")).rawhtml = true image_table:option(DummyValue, "_containers", translate("Containers")).rawhtml = true image_table:option(DummyValue, "_size", translate("Size")) image_table:option(DummyValue, "_created", translate("Created")) image_selecter.write = function(self, section, value) image_list[section]._selected = value end local remove_action = function(force) local image_selected = {} -- 遍历table中sectionid local image_table_sids = image_table:cfgsections() for _, image_table_sid in ipairs(image_table_sids) do -- 得到选中项的名字 if image_list[image_table_sid]._selected == 1 then image_selected[#image_selected+1] = image_id:cfgvalue(image_table_sid) end end if next(image_selected) ~= nil then local success = true docker:clear_status() for _,img in ipairs(image_selected) do docker:append_status("Images: " .. "remove" .. " " .. img .. "...") local query if force then query = {force = true} end local msg = dk.images:remove({id = img, query = query}) if msg.code ~= 200 then docker:append_status("fail code:" .. msg.code.." ".. (msg.body.message and msg.body.message or msg.message).. "<br>") success = false else docker:append_status("done<br>") end end if success then docker:clear_status() end luci.http.redirect(luci.dispatcher.build_url("admin/services/docker/images")) end end docker_status = m:section(SimpleSection) docker_status.template = "dockerman/apply_widget" docker_status.err=nixio.fs.readfile(dk.options.status_path) if docker_status.err then docker:clear_status() end action = m:section(Table,{{}}) action.notitle=true action.rowcolors=false action.template="cbi/nullsection" btnremove = action:option(Button, "remove") btnremove.inputtitle= translate("Remove") btnremove.template = "dockerman/cbi/inlinebutton" btnremove.inputstyle = "remove" btnremove.forcewrite = true btnremove.write = function(self, section) remove_action() end btnforceremove = action:option(Button, "forceremove") btnforceremove.inputtitle= translate("Force Remove") btnforceremove.template = "dockerman/cbi/inlinebutton" btnforceremove.inputstyle = "remove" btnforceremove.forcewrite = true btnforceremove.write = function(self, section) remove_action(true) end return m
return { pairs = { {"number", "multiply",}, }, }
------------------------------ ----- INSTALL FORMATTERS ----- ------------------------------ -- prettierd -- npm i -g @fsouza/prettierd ------------------------------ --stylua (better than luafmt&luaformatter) -- installed binary to my ~/.formatters path -- from here: https://github.com/JohnnyMorganz/StyLua/releases -- option to add stylua.toml ------------------------------ local null_ls = require('null-ls') local b = null_ls.builtins null_ls.config({ sources = { --FORMATTERS -- b.formatting.trim_whitespace.with({ filetypes = { "tmux", "teal", "zsh" } }), b.formatting.scalafmt, -- scala b.formatting.autopep8, -- python b.formatting.rustfmt, -- rust b.formatting.uncrustify, -- c, cpp, cs, java b.formatting.shfmt, -- bash b.formatting.prettierd, -- javascript, javascriptreact, typescript, typescriptreact, vue, svelte, css, scss, html, json, yaml, markdown b.formatting.clang_format, --filetypes = { "c", "cpp", "cs", "java" } b.formatting.stylua, --lua -- if we want to only use stylua etc when stylua.toml file is in project etc. --[[ b.formatting.stylua.with({ condition = function(utils) return utils.root_has_file("stylua.toml") end, }), ]] --SPELL CHECK b.diagnostics.misspell, b.diagnostics.codespell, b.diagnostics.cspell, b.diagnostics.shellcheck, --LINTERS require('null-ls.helpers').conditional(function(utils) --uses eslint fallback to prettier otherwise return utils.root_has_file('.eslintrc.js') and b.formatting.eslint_d or b.formatting.prettier end), -- b.diagnostics.write_good, -- b.diagnostics.markdownlint, -- b.diagnostics.teal, -- b.code_actions.gitsigns, } }) -- Must be setup after config require("lspconfig")["null-ls"].setup({})
msg_frac = "Разломак" msg_dec = "Децимални број" msg_per = "Проценат %"
local CrossEntropyCriterion, Criterion = torch.class('nn.CrossEntropyCriterion', 'nn.Criterion') function CrossEntropyCriterion:__init(weights) Criterion.__init(self) self.lsm = nn.LogSoftMax() self.nll = nn.ClassNLLCriterion(weights) end function CrossEntropyCriterion:updateOutput(input, target) input = input:squeeze() target = type(target) == 'number' and target or target:squeeze() self.lsm:updateOutput(input) self.nll:updateOutput(self.lsm.output, target) self.output = self.nll.output return self.output end function CrossEntropyCriterion:updateGradInput(input, target) local size = input:size() input = input:squeeze() target = type(target) == 'number' and target or target:squeeze() self.nll:updateGradInput(self.lsm.output, target) self.lsm:updateGradInput(input, self.nll.gradInput) self.gradInput:view(self.lsm.gradInput, size) return self.gradInput end return nn.CrossEntropyCriterion
Search = { anims = { normal = { Dict = "missexile3", Name = "ex03_dingy_search_case_a_michael", Flag = 48, Disarm = true, Duration = 8000 }, frisk = { Dict = "anim@gangops@facility@servers@bodysearch@", Name = "player_search", Flag = 48, Disarm = true, Duration = 1000 }, }, } --[[ Options ]]-- Main:AddOption({ id = "playerSearch", text = "Search", icon = "search", }, function(player, playerPed, dist, serverId) return Search:CanSearch(player) end, function(player, playerPed, serverId) Search:Begin(player) end) Main:AddOption({ id = "playerFrisk", text = "Frisk", icon = "waving_hand", }, function(player, playerPed, dist, serverId) return Search:CanSearch(player) end, function(player, playerPed, serverId) Search:Begin(player, true) end) --[[ Functions ]]-- function Search:CanSearch(player) local localState = LocalPlayer.state if not localState or localState.restrained or localState.immobile then return false end local serverId = GetPlayerServerId(player) local playerState = Player(serverId).state if not playerState then return false end return playerState.handsup or playerState.immobile or playerState.restrained end function Search:Begin(player, frisk) local anim = frisk and Search.anims.frisk or Search.anims.normal local emote = exports.emotes:Play(anim) local startTime = GetGameTimer() while GetGameTimer() - startTime < anim.Duration do Citizen.Wait(50) if not NetworkIsPlayerActive(player) or not Search:CanSearch(player) or not exports.emotes:IsPlaying(emote) then print("no search") return end local playerPed = GetPlayerPed(player) local dist = #(GetEntityCoords(playerPed) - GetEntityCoords(PlayerPedId())) if dist > Config.MaxDist then exports.emotes:Stop(emote) print("too far") return end end print("search") TriggerServerEvent("players:search", GetPlayerServerId(player), frisk) end --[[ Events ]]-- AddEventHandler("players:navigate", function(value) -- Remove option. if not value then if Search.value then Main:RemoveOption("playerSearch") Main:RemoveOption("playerFrisk") Search.value = nil end return end local state = (LocalPlayer or {}).state if not state then return end Search.value = true Main:AddOption({ id = "playerSearch", text = "Search", icon = "search", }) Main:AddOption({ id = "playerFrisk", text = "handshake", icon = "", }) end)
-- Lose Face - An open source face recognition project -- Copyright (C) 2008-2010 David Capello -- All rights reserved. -- -- Description: -- Creates an images-matrix from the ORL faces database. The -- images must be located in the "orl_faces" folder. -- You can run the "orl_faces\download_faces.bat" file to -- get the ORL images. -- -- Usage: -- You cannot use this script directly, it should be included -- in another script to have load_orl_images_matrix() function available. -- load_orl_images_matrix: -- Returns an images-matrix reading all pictures of the ORL -- database. This images-matrix can be used as argument -- with divide_images_matrix function. -- function load_orl_images_matrix() -- Get an ordered list of folders s1, s2, s3, ..., s40 (subjects) local folders = {} for file in lfs.dir("orl_faces") do local num = string.match(file, "^s([0-9]+)") if num then table.insert(folders, { tonumber(num), file }) end end table.sort(folders, function (a, b) return a[1] < b[1] end ) -- Add the list of pictures of each folder/subject for i = 1,#folders do local images_files = {} for file in lfs.dir("orl_faces/"..folders[i][2]) do num = string.match(file, "^([0-9]+)\.pgm") if num then table.insert(images_files, { tonumber(num), file }) end end table.sort(images_files, function (a, b) return a[1] < b[1] end ) table.insert(folders[i], images_files) end -- Load all images local images_matrix = {} for i = 1,#folders do local images = {} for j = 1,#folders[i][3] do file = "orl_faces/"..folders[i][2].."/"..folders[i][3][j][2] print("Loading "..file.."...") io.flush() image = img.Image() image:load(file) table.insert(images, image) end table.insert(images_matrix, images) end return images_matrix end