content
stringlengths
5
1.05M
----------------------------------- -- Area: Windurst Waters (S) -- NPC: Kocco Ehllek -- Type: Quest Giver -- !pos -41.465 -2.125 -163.018 94 ----------------------------------- function onTrade(player, npc, trade) end function onTrigger(player, npc) player:startEvent(140) end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) end
local r = { left = 10, top = 10, right = 100, bottom = 80 } local x = 0; local paint = Sk.newPaint(); paint:setAntiAlias(true); local image -- = Sk.loadImage('/skia/sailboat.jpg'); function setImageFilename(filename) image = Sk.loadImage(filename) end local color = {a = 1, r = 1, g = 0, b = 0}; function rnd(range) return math.random() * range; end rndX = function () return rnd(640) end rndY = function () return rnd(480) end function draw_rand_path(canvas); if not path_paint then path_paint = Sk.newPaint(); path_paint:setAntiAlias(true); end path_paint:setColor({a = 1, r = math.random(), g = math.random(), b = math.random() }); local path = Sk.newPath(); path:moveTo(rndX(), rndY()); for i = 0, 50 do path:quadTo(rndX(), rndY(), rndX(), rndY()); end canvas:drawPath(path, path_paint); paint:setColor{a=1,r=0,g=0,b=1}; local align = { 'left', 'center', 'right' }; paint:setTextSize(30); for k, v in next, align do paint:setTextAlign(v); canvas:drawText('Hamburgefons', 320, 200 + 30*k, paint); end end function onStartup() local paint = Sk.newPaint(); paint:setColor{a=1, r=1, g=0, b=0}; if false then local doc = Sk.newDocumentPDF('out/test.pdf'); local canvas = doc:beginPage(72*8.5, 72*11); canvas:drawText('Hello Lua', 300, 300, paint); doc:close(); doc = nil; end end function onDrawContent(canvas) draw_rand_path(canvas); color.g = x / 100; paint:setColor(color) canvas:translate(x, 0); canvas:drawOval(r, paint) x = x + 1; local r2 = {} r2.left = x; r2.top = r.bottom + 50; r2.right = r2.left + image:width() * 1; r2.bottom = r2.top + image:height() * 1; canvas:drawImageRect(image, nil, r2, 0.75); if x > 200 then x = 0 end; return true -- so we can animate end onStartup()
--[[------------------------------------------------ -- Love Frames - A GUI library for LOVE -- -- Copyright (c) 2012-2014 Kenny Shields -- --]]------------------------------------------------ return function(loveframes) ---------- module start ---------- -- grid object local newobject = loveframes.NewObject("grid", "loveframes_object_grid", true) --[[--------------------------------------------------------- - func: initialize() - desc: initializes the object --]]--------------------------------------------------------- function newobject:initialize() self.type = "grid" self.width = 100 self.height = 100 self.prevwidth = 100 self.prevheight = 100 self.rows = 0 self.columns = 0 self.cellwidth = 25 self.cellheight = 25 self.cellpadding = 5 self.itemautosize = false self.children = {} self.OnSizeChanged = nil self.rowspans = {} self.colspans = {} self:SetDrawFunc() end --[[--------------------------------------------------------- - func: update(deltatime) - desc: updates the object --]]--------------------------------------------------------- function newobject:update(dt) local state = loveframes.state local selfstate = self.state if state ~= selfstate then return end local visible = self.visible local alwaysupdate = self.alwaysupdate if not visible then if not alwaysupdate then return end end self:CheckHover() local parent = self.parent local children = self.children local base = loveframes.base -- move to parent if there is a parent if parent ~= base then self.x = self.parent.x + self.staticx - (parent.offsetx or 0) self.y = self.parent.y + self.staticy - (parent.offsety or 0) end local prevwidth = self.prevwidth local prevheight = self.prevheight self.width = (self.columns * self.cellwidth) + (self.columns * (self.cellpadding * 2)) self.height = (self.rows * self.cellheight) + (self.rows * (self.cellpadding * 2)) if self.width ~= prevwidth or self.height ~= prevheight then local onsizechanged = self.OnSizeChanged self.prevwidth = self.width self.prevheight = self.height self:_update_children_position() if onsizechanged then onsizechanged(self) end end for k, v in ipairs(children) do v:update(dt) end local update = self.Update if update then update(self, dt) end end function newobject:_update_children_position() for k, v in ipairs(self.children) do local rs, cs = self:GetCellSpanSize(v.gridrow, v.gridcolumn) local csw = cs * self.cellwidth + (cs * self.cellpadding * 2) local csh = rs * self.cellheight + (rs * self.cellpadding * 2) local cw = self.cellwidth + (self.cellpadding * 2) local ch = self.cellheight + (self.cellpadding * 2) local x local y = ((ch * v.gridrow) - ch) + (csh/2 - v.height/2) if v.align == 'center' then x = (cw * (v.gridcolumn - 1)) + (csw/2 - v.width/2) elseif v.align == 'right' then x = (cw * (v.gridcolumn - 1)) + (csw - v.width) - self.cellpadding elseif v.align == 'left' then x = self.cellpadding + (cw * (v.gridcolumn - 1)) end v.staticx = x v.staticy = y end end --[[--------------------------------------------------------- - func: mousepressed(x, y, button) - desc: called when the player presses a mouse button --]]--------------------------------------------------------- function newobject:mousepressed(x, y, button) local state = loveframes.state local selfstate = self.state if state ~= selfstate then return end local visible = self.visible if not visible then return end local children = self.children local hover = self.hover if hover and button == 1 then local baseparent = self:GetBaseParent() if baseparent and baseparent.type == "frame" then baseparent:MakeTop() end end for k, v in ipairs(children) do v:mousepressed(x, y, button) end end --[[--------------------------------------------------------- - func: mousereleased(x, y, button) - desc: called when the player releases a mouse button --]]--------------------------------------------------------- function newobject:mousereleased(x, y, button) local state = loveframes.state local selfstate = self.state if state ~= selfstate then return end local visible = self.visible local children = self.children if not visible then return end for k, v in ipairs(children) do v:mousereleased(x, y, button) end end --[[--------------------------------------------------------- - func: RowSpanAt(row, col, size) - desc: expands the size of the row at position --]]--------------------------------------------------------- function newobject:RowSpanAt(row, col, size) self.colspans[col] = self.colspans[col] or {} local colsize = self.colspans[col][row] local s = colsize or 1 for i = col, col + s - 1 do for j = row, row + size - 1 do self.rowspans[i] = self.rowspans[i] or {} self.colspans[i] = self.colspans[i] or {} self.rowspans[i][j] = -1 self.colspans[i][j] = -1 end end self.rowspans[col][row] = size self.colspans[col][row] = colsize return self end --[[--------------------------------------------------------- - func: ColSpanAt(row, col, size) - desc: expands the size of the column at position --]]--------------------------------------------------------- function newobject:ColSpanAt(row, col, size) self.rowspans[col] = self.rowspans[col] or {} local rowsize = self.rowspans[col][row] local s = rowsize or 1 for i = col, col + size - 1 do for j = row, row + s - 1 do self.rowspans[i] = self.rowspans[i] or {} self.colspans[i] = self.colspans[i] or {} self.rowspans[i][j] = -1 self.colspans[i][j] = -1 end end self.rowspans[col][row] = rowsize self.colspans[col][row] = size return self end --[[--------------------------------------------------------- - func: GetCellSpanSize(row, col, size) - desc: get span size of cell --]]--------------------------------------------------------- function newobject:GetCellSpanSize(row, col) self.rowspans[col] = self.rowspans[col] or {} local rs = self.rowspans[col][row] or 1 self.colspans[col] = self.colspans[col] or {} local cs = self.colspans[col][row] or 1 return rs, cs end --[[--------------------------------------------------------- - func: AddItem(object, row, column) - desc: adds and item to the object --]]--------------------------------------------------------- function newobject:AddItem(object, row, col, align) local itemautosize = self.itemautosize local children = self.children object:Remove() table.insert(children, object) object.parent = self object.gridrow = row object.gridcolumn = col object.align = align or 'center' if itemautosize then if object.type == 'text' or object.type == 'checkbox' then return self end local rs, cs = self:GetCellSpanSize(row, col) local cw = cs * self.cellwidth + (self.cellpadding * 2) local ch = rs * self.cellheight + (self.cellpadding * 2) object.width = cw - (self.cellpadding * 2) object.height = ch - (self.cellpadding * 2) if object.CalculateSize then object:CalculateSize() end if object.RedoLayout then object:RedoLayout() end end return self end --[[--------------------------------------------------------- - func: GetItem(row, column) - desc: gets an item from the object at the specified row and column --]]--------------------------------------------------------- function newobject:GetItem(row, column) local children = self.children for k, v in ipairs(children) do if v.gridrow == row and v.gridcolumn == column then return v end end return false end --[[--------------------------------------------------------- - func: SetItemAutoSize(bool) - desc: sets whether or not the object should auto-size its items --]]--------------------------------------------------------- function newobject:SetItemAutoSize(bool) self.itemautosize = bool return self end --[[--------------------------------------------------------- - func: GetItemAutoSize() - desc: gets whether or not the object should auto-size its items --]]--------------------------------------------------------- function newobject:GetItemAutoSize() return self.itemautosize end --[[--------------------------------------------------------- - func: SetRows(rows) - desc: sets the number of rows the object should have --]]--------------------------------------------------------- function newobject:SetRows(rows) self.rows = rows return self end --[[--------------------------------------------------------- - func: SetRows(rows) - desc: gets the number of rows the object has --]]--------------------------------------------------------- function newobject:GetRows() return self.rows end --[[--------------------------------------------------------- - func: SetColumns(columns) - desc: sets the number of columns the object should have --]]--------------------------------------------------------- function newobject:SetColumns(columns) self.columns = columns return self end --[[--------------------------------------------------------- - func: GetColumns() - desc: gets the number of columns the object has --]]--------------------------------------------------------- function newobject:GetColumns() return self.columns end --[[--------------------------------------------------------- - func: SetCellWidth(width) - desc: sets the width of the object's cells --]]--------------------------------------------------------- function newobject:SetCellWidth(width) self.cellwidth = width return self end --[[--------------------------------------------------------- - func: GetCellWidth() - desc: gets the width of the object's cells --]]--------------------------------------------------------- function newobject:GetCellWidth() return self.cellwidth end --[[--------------------------------------------------------- - func: SetCellHeight(height) - desc: sets the height of the object's cells --]]--------------------------------------------------------- function newobject:SetCellHeight(height) self.cellheight = height return self end --[[--------------------------------------------------------- - func: GetCellHeight() - desc: gets the height of the object's cells --]]--------------------------------------------------------- function newobject:GetCellHeight() return self.cellheight end --[[--------------------------------------------------------- - func: SetCellSize(width, height) - desc: sets the size of the object's cells --]]--------------------------------------------------------- function newobject:SetCellSize(width, height) self.cellwidth = width self.cellheight = height return self end --[[--------------------------------------------------------- - func: GetCellSize() - desc: gets the size of the object's cells --]]--------------------------------------------------------- function newobject:GetCellSize() return self.cellwidth, self.cellheight end --[[--------------------------------------------------------- - func: SetCellPadding(padding) - desc: sets the padding of the object's cells --]]--------------------------------------------------------- function newobject:SetCellPadding(padding) self.cellpadding = padding return self end --[[--------------------------------------------------------- - func: GetCellPadding - desc: gets the padding of the object's cells --]]--------------------------------------------------------- function newobject:GetCellPadding() return self.cellpadding end ---------- module end ---------- end
---@class MenuState : BaseState MenuState = Class {__includes = BaseState} function MenuState:init() self._titleText = love.graphics.newText(gFont, "Press ENTER To Continue") self._titleMaxTimer = 2 self._titleTimer = self._titleMaxTimer gSounds.theme:play() gSounds.theme:setLooping(true) end function MenuState:render() love.graphics.draw( gTextures.backgrounds[1], 0, 0, 0, WINDOW_WIDTH / (gTextures.backgrounds[1]:getWidth() - 1), WINDOW_HEIGHT / (gTextures.backgrounds[1]:getHeight() - 1) ) love.graphics.draw(gTextures.logo, WINDOW_WIDTH / 2 - gTextures.logo:getWidth() / 2, WINDOW_HEIGHT / 2 - 100) if (self._titleTimer <= 1.2) then love.graphics.draw(self._titleText, WINDOW_WIDTH / 2 - self._titleText:getWidth() / 2, WINDOW_HEIGHT / 2 + 100) end end function MenuState:update(dt) if (love.keyboard.wasPressed("return")) then gStateMachine:change("play") end if (self._titleTimer > 0) then self._titleTimer = math.max(0, self._titleTimer - dt) else self._titleTimer = self._titleMaxTimer end end function MenuState:exit() gSounds.theme:pause() end
function EFFECT:Init( data ) local vOffset = data:GetOrigin() -- + Vector( 0, 0, 0.2 ) -- local vAngle = data:GetAngles() local emitter = ParticleEmitter( vOffset ) -- there was false for i=0, 5 do local particle = emitter:Add( "particle/particle_smokegrenade", vOffset ) if particle then -- particle:SetAngles( vAngle ) particle:SetVelocity( math.random(12,16) * math.sqrt(i) * data:GetNormal() * 3 + 2 * VectorRand() ) particle:SetColor( 135, 135, 135 ) particle:SetLifeTime( 0 ) particle:SetDieTime( math.Rand( 0.5, 1.5 ) ) particle:SetStartAlpha( 255 ) particle:SetEndAlpha( 0 ) particle:SetStartSize( math.Rand( 5, 8 ) *math.Clamp(i,1,4) * 0.166 ) --particle:SetStartLength( 1 ) particle:SetEndSize( math.Rand( 16, 24 ) * math.sqrt(math.Clamp(i,1,4)) * 0.166 ) --particle:SetEndLength( 4 ) particle:SetRoll( math.Rand( -25, 25 ) ) particle:SetRollDelta( math.Rand( -0.05, 0.05 ) ) end end emitter:Finish() end function EFFECT:Think() return false end function EFFECT:Render() end
-- SML lexer. local l = require('lexer') local token, word_match = l.token, l.word_match local P, R, S = lpeg.P, lpeg.R, lpeg.S local M = {_NAME = 'sml'} -- Whitespace. local ws = token(l.WHITESPACE, l.space^1) local keywords = token(l.KEYWORD, word_match{ "abstype", "and", "andalso", "as", "case", "datatype", "do", "else", "end", "exception", "fn", "fun", "handle", "if", "in", "infix", "infixr", "let", "local", "nonfix", "of", "op", "open", "orelse", "raise", "rec", "then", "type", "val", "with", "withtype", "while", "eqtype", "functor", "include", "sharing", "sig", "signature", "struct", "structure", "where", ":>" }) local operators = token(l.OPERATOR, S('()[]{},:;._|=>-#')) local integerConstant = l.digit * (P('_')^0 * l.digit)^0 local hexIntegerConstant = P('0x') * l.xdigit * (P('_')^0 * l.xdigit)^0 local wordConstant = P('0w') * l.digit * (P('_')^0 * l.digit)^0 local hexWordConstant = P('0wx') * l.xdigit * (P('_')^0 * l.xdigit)^0 local binWordConstant = P('0wb') * S('01') * (P('_')^0 * S('01'))^0 local realConstant = integerConstant * P('.') * integerConstant * (S('Ee') * integerConstant)^-1 local number = token(l.NUMBER, hexIntegerConstant + wordConstant + hexWordConstant + binWordConstant + realConstant + integerConstant) local singleLineComment = P('(*)') * l.nonnewline_esc^0 local blockComment = l.nested_pair('(*', '*)') local comment = token(l.COMMENT, singleLineComment + blockComment) local alphanumIdentifier = ('`' + l.alpha) * (S('`_') + l.alnum)^0 local symbolicIdentifier = S('!%&$#+-/:<=>?@\\~`^|*') local identifier = token(l.IDENTIFIER, l.word + symbolicIdentifier) M._rules = { {'whitespace', ws}, {'comment', comment}, {'number', number}, {'keyword', keywords}, {'operator', operators}, {'identifier', identifier} } M._tokenstyles = { } return M
-- Look into -- https://github.com/lervag/wiki.vim -- https://github.com/ihsanturk/neuron.vim -- https://github.com/kdheepak/lazygit.nvim -- https://github.com/johannesthyssen/vim-signit -- https://github.com/kyazdani42/nvim-tree.lua -- https://github.com/mkitt/tabline.vim local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/opt/packer.nvim" if vim.fn.empty(vim.fn.glob(install_path)) > 0 then vim.cmd("!git clone https://github.com/wbthomason/packer.nvim " .. install_path) vim.cmd("packadd packer.nvim") end vim.cmd [[packadd packer.nvim]] local packer_ok, packer = pcall(require, "packer") if packer_ok then local use = packer.use local local_use = function(first, second) local plug_path local home if second == nil then plug_path = first home = "polarmutex" else plug_path = second home = first end if vim.fn.isdirectory(vim.fn.expand("~/repos/" .. plug_path)) == 1 then use("~/repos/" .. plug_path) elseif vim.fn.isdirectory(vim.fn.expand("~/dev/" .. plug_path)) == 1 then use("~/dev/" .. plug_path) else use(string.format("%s/%s", home, plug_path)) end end packer.init {display = {open_fn = require("packer.util").float}} local plugins = function() -- Packer can manage itself as an optional plugin use { "wbthomason/packer.nvim", opt = true, run = function() vim.cmd([[PackerCompile]]) end, } -- LSP use("neovim/nvim-lspconfig") use { "hrsh7th/nvim-compe", config = function() require("polarmutex.plugins.completion") end } use("nvim-lua/lsp-status.nvim") use { "glepnir/lspsaga.nvim", config = function() require("polarmutex.plugins.lspsaga") end } use {"lspcontainers/lspcontainers.nvim"} use("onsails/lspkind-nvim") use("kosayoda/nvim-lightbulb") use("tjdevries/nlua.nvim") -- Tree-Sitter use({ "nvim-treesitter/nvim-treesitter", run = function() vim.cmd([[TSUpdate]]) end, config = function() require("polarmutex.plugins.treesitter") end }) -- local_use('polarmutex','nvim-treesitter') use("nvim-treesitter/playground") -- use 'nvim-treesitter/completion-treesitter' local_use("polarmutex", "beancount.nvim") local_use("polarmutex", "contextprint.nvim") -- haringsrob/nvim_context_vt -- Telescope (fuzzy finder) use { "nvim-telescope/telescope.nvim", requires = { {"nvim-lua/popup.nvim"}, {"nvim-telescope/telescope-fzy-native.nvim"}, {"nvim-telescope/telescope-fzf-writer.nvim"}, {"nvim-telescope/telescope-packer.nvim"}, {"nvim-telescope/telescope-github.nvim"}, {"nvim-telescope/telescope-packer.nvim"} }, config = function() require("polarmutex.plugins.telescope.config") end } use("kyazdani42/nvim-web-devicons") use("phaazon/hop.nvim") -- Debug adapter protocol use { "mfussenegger/nvim-dap", config = function() require("polarmutex.plugins.dap") end } use("mfussenegger/nvim-dap-python") use("mfussenegger/nvim-lua-debugger") use("theHamsta/nvim-dap-virtual-text") use("nvim-telescope/telescope-dap.nvim") -- Terminal / File Nav use { "ThePrimeagen/harpoon", config = function() require("polarmutex.plugins.harpoon") end } use { "norcalli/nvim-terminal.lua", config = function() require("polarmutex.plugins.nvim-terminal") end } -- Git use { "TimUntersberger/neogit", config = function() require("polarmutex.plugins.neogit") end } use { "lewis6991/gitsigns.nvim", config = function() require("polarmutex.plugins.gitsigns") end } use("pwntester/octo.nvim") use("ThePrimeagen/git-worktree.nvim") -- use("~/repos/git-worktree.nvim.git/master") use({"ruifm/gitlinker.nvim"}) -- plenary use {"nvim-lua/plenary.nvim"} -- keymaps use { "folke/which-key.nvim", config = function() require("polarmutex.plugins.which-key") end } -- Increment / Decrement use { "monaqa/dial.nvim", config = function() require("polarmutex.plugins.dial") end } -- text maniuplation use("tpope/vim-surround") -- Surround text objects easily use("tpope/vim-commentary") -- Easily comment out lines or objects -- use 'tpope/vim-repeat' -- Repeat actions better use("tpope/vim-abolish") -- Cool things with words! -- Convert binary, hex, etc.. use("glts/vim-radical") -- Add some color use { "norcalli/nvim-colorizer.lua", opt = false, config = function() require("polarmutex.plugins.colorizer") end } -- :Messages <- view messages in quickfix list -- :Verbose <- view verbose output in preview window. -- :Time <- measure how long it takes to run some stuff. use("tpope/vim-scriptease") -- Quickfix enhancements. See :help vim-qf -- use 'romainl/vim-qf' -- Better profiling output for startup. use("tweekmonster/startuptime.vim") -- Neovim in the browser use({ "glacambre/firenvim", run = function() vim.fn["firenvim#install"](0) end }) -- Whitespace -- do I still want this? -- use 'ntpeters/vim-better-whitespace' use("RRethy/vim-illuminate") -- highlight current word -- Undo use("mbbill/undotree") -- Test use("vim-test/vim-test") -- Games/ Utils use("takac/vim-hardtime") use("ThePrimeagen/vim-be-good") -- use_local 'vim-be-good' -- use 'ThePrimeagen/vim-apm' -- local_use('polarmutex','vim-apm') -- tasks local_use("polarmutex", "tasks.nvim") end packer.startup(plugins) end
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Resources = require(ReplicatedStorage:WaitForChild("Resources")) local Aurora = Resources:LoadLibrary("Aurora") local function hookCharacter(character) character:WaitForChild("Humanoid") repeat wait() until character.Parent while character.Parent and character:FindFirstChild("Humanoid") do local humanoid = character.Humanoid local agent = Aurora.GetAgent(humanoid) wait(2) agent:Apply("TestAuraStackable", { Status = { Duration = 2; } }) wait(2) end end local function hookPlayer(player) player.CharacterAdded:Connect(hookCharacter) if player.Character then hookCharacter(player.Character) end end game.Players.PlayerAdded:Connect(hookPlayer) for _, player in ipairs(game.Players:GetPlayers()) do hookPlayer(player) end local wAgent = Aurora.GetAgent(workspace) wAgent:Apply("TestAuraStackable", { Name = ":TestAuraStackable"; Effects = {}; Status = { Duration = math.huge; }; Params = { Text = "Hello there"; }; })
pg = pg or {} pg.activity_random_award_template = { { resource_category = 1, activity = 76, resource_type = 105, id = 1, resource_num = 60, item_list = { { 100012, 1 }, { 100013, 1 }, { 100014, 1 }, { 100015, 1 }, { 100016, 1 }, { 29, 1 }, { 32, 1 }, { 35, 1 }, { 52, 1 }, { 55, 1 }, { 58, 1 }, { 61, 1 }, { 65, 3 }, { 70, 3 }, { 75, 3 }, { 80, 3 }, { 28, 3 }, { 31, 3 }, { 34, 3 }, { 38, 3 }, { 41, 3 }, { 44, 3 }, { 47, 3 }, { 50, 3 }, { 51, 3 }, { 54, 3 }, { 57, 3 }, { 60, 3 }, { 37, 5 }, { 40, 5 }, { 43, 5 }, { 46, 5 }, { 49, 5 }, { 23, 3 }, { 11, 9 }, { 8, 2 }, { 5, 6 }, { 2, 15 } }, main_item = { 100012, 100013 } }, { resource_category = 1, activity = 76, resource_type = 105, id = 2, resource_num = 60, item_list = { { 100017, 1 }, { 84, 1 }, { 53, 3 }, { 29, 2 }, { 32, 2 }, { 35, 2 }, { 52, 2 }, { 55, 2 }, { 58, 2 }, { 61, 2 }, { 65, 5 }, { 70, 5 }, { 75, 5 }, { 80, 5 }, { 28, 5 }, { 31, 5 }, { 34, 5 }, { 38, 5 }, { 41, 5 }, { 44, 5 }, { 47, 5 }, { 50, 5 }, { 51, 5 }, { 54, 5 }, { 57, 5 }, { 60, 5 }, { 37, 9 }, { 40, 9 }, { 43, 9 }, { 46, 9 }, { 49, 9 }, { 23, 5 }, { 11, 15 }, { 8, 5 }, { 5, 10 }, { 2, 21 } }, main_item = { 100017 } }, { resource_category = 1, activity = 76, resource_type = 105, id = 3, resource_num = 60, item_list = { { 100018, 1 }, { 100019, 1 }, { 100020, 1 }, { 100021, 2 }, { 29, 3 }, { 32, 3 }, { 35, 3 }, { 52, 3 }, { 55, 3 }, { 58, 3 }, { 61, 3 }, { 65, 7 }, { 70, 7 }, { 75, 7 }, { 80, 7 }, { 28, 7 }, { 31, 7 }, { 34, 7 }, { 38, 7 }, { 41, 7 }, { 44, 7 }, { 47, 7 }, { 50, 7 }, { 51, 7 }, { 54, 7 }, { 57, 7 }, { 60, 7 }, { 37, 13 }, { 40, 13 }, { 43, 13 }, { 46, 13 }, { 49, 13 }, { 23, 7 }, { 11, 21 }, { 8, 8 }, { 5, 14 }, { 2, 27 } }, main_item = { 100018, 100019 } }, { resource_category = 1, activity = 76, resource_type = 105, id = 4, resource_num = 60, item_list = { { 83, 1 }, { 84, 1 }, { 85, 8 }, { 29, 2 }, { 32, 2 }, { 35, 2 }, { 52, 2 }, { 55, 2 }, { 58, 2 }, { 61, 2 }, { 65, 6 }, { 70, 6 }, { 75, 6 }, { 80, 6 }, { 28, 8 }, { 31, 8 }, { 34, 8 }, { 38, 5 }, { 41, 5 }, { 44, 5 }, { 47, 5 }, { 50, 5 }, { 51, 8 }, { 54, 8 }, { 57, 8 }, { 60, 8 }, { 37, 15 }, { 40, 15 }, { 43, 15 }, { 46, 15 }, { 49, 15 }, { 23, 6 }, { 11, 20 }, { 8, 5 }, { 5, 15 }, { 2, 30 } }, main_item = { 84, 83 } }, [9] = { resource_category = 1, activity = 176, resource_type = 114, id = 9, resource_num = 15, item_list = { { 100006, 1 }, { 100026, 1 }, { 83, 1 }, { 91, 20 }, { 90, 50 }, { 87, 2 }, { 88, 4 }, { 86, 10 }, { 92, 2 }, { 23, 15 }, { 22, 10 }, { 21, 5 }, { 38, 15 }, { 41, 5 }, { 44, 5 }, { 47, 5 }, { 50, 5 }, { 37, 8 }, { 40, 4 }, { 43, 4 }, { 46, 4 }, { 49, 4 }, { 70, 5 }, { 65, 5 }, { 75, 5 }, { 80, 5 } }, main_item = { 100006, 100026 } }, [10] = { resource_category = 1, activity = 176, resource_type = 114, id = 10, resource_num = 15, item_list = { { 100022, 1 }, { 100024, 1 }, { 100001, 1 }, { 100008, 1 }, { 100010, 1 }, { 91, 20 }, { 90, 50 }, { 87, 1 }, { 88, 4 }, { 86, 30 }, { 92, 4 }, { 23, 10 }, { 22, 20 }, { 21, 20 }, { 52, 2 }, { 55, 2 }, { 58, 2 }, { 61, 2 }, { 51, 5 }, { 54, 5 }, { 57, 5 }, { 60, 5 }, { 38, 15 }, { 41, 10 }, { 44, 10 }, { 47, 10 }, { 50, 10 }, { 37, 10 }, { 40, 5 }, { 43, 5 }, { 46, 5 }, { 49, 5 }, { 36, 4 }, { 39, 4 }, { 42, 4 }, { 45, 4 }, { 48, 4 }, { 71, 2 }, { 66, 2 }, { 76, 2 }, { 81, 2 }, { 69, 20 }, { 64, 20 }, { 74, 20 }, { 79, 20 }, { 29, 3 }, { 32, 3 }, { 35, 3 }, { 28, 2 }, { 31, 2 }, { 34, 2 } }, main_item = { 100022, 100024 } }, [11] = { resource_category = 1, activity = 176, resource_type = 114, id = 11, resource_num = 15, item_list = { { 100011, 1 }, { 100007, 1 }, { 84, 1 }, { 100027, 1 }, { 100002, 1 }, { 100003, 1 }, { 100004, 1 }, { 100005, 1 }, { 100009, 1 }, { 91, 90 }, { 90, 210 }, { 87, 4 }, { 88, 2 }, { 86, 80 }, { 92, 4 }, { 23, 10 }, { 22, 30 }, { 52, 5 }, { 55, 5 }, { 58, 5 }, { 61, 5 }, { 38, 20 }, { 41, 10 }, { 44, 10 }, { 47, 10 }, { 50, 10 }, { 37, 20 }, { 40, 10 }, { 49, 10 }, { 71, 3 }, { 66, 3 }, { 76, 3 }, { 81, 3 }, { 70, 5 }, { 65, 5 }, { 75, 5 }, { 80, 5 }, { 28, 3 }, { 31, 3 }, { 34, 3 } }, main_item = { 100011, 100007 } }, [12] = { resource_category = 1, activity = 176, resource_type = 114, id = 12, resource_num = 15, item_list = { { 84, 1 }, { 83, 1 }, { 91, 120 }, { 90, 190 }, { 87, 4 }, { 86, 80 }, { 23, 30 }, { 22, 50 }, { 21, 85 }, { 52, 5 }, { 55, 5 }, { 58, 5 }, { 61, 5 }, { 51, 15 }, { 54, 15 }, { 57, 15 }, { 60, 15 }, { 38, 10 }, { 41, 5 }, { 44, 5 }, { 47, 5 }, { 50, 5 }, { 37, 50 }, { 40, 25 }, { 43, 25 }, { 46, 25 }, { 49, 25 }, { 36, 26 }, { 39, 26 }, { 42, 26 }, { 45, 26 }, { 48, 26 }, { 70, 10 }, { 65, 10 }, { 75, 10 }, { 80, 10 }, { 69, 80 }, { 64, 80 }, { 74, 80 }, { 79, 80 }, { 29, 3 }, { 32, 3 }, { 35, 3 }, { 27, 60 }, { 30, 60 }, { 33, 60 } }, main_item = { 84, 83 } }, [13] = { resource_category = 1, activity = 230, resource_type = 119, id = 13, resource_num = 15, item_list = { { 100012, 1 }, { 100013, 1 }, { 83, 1 }, { 91, 20 }, { 90, 50 }, { 87, 2 }, { 88, 4 }, { 86, 10 }, { 92, 2 }, { 23, 15 }, { 22, 10 }, { 21, 5 }, { 38, 15 }, { 41, 5 }, { 44, 5 }, { 47, 5 }, { 50, 5 }, { 37, 8 }, { 40, 4 }, { 43, 4 }, { 46, 4 }, { 49, 4 }, { 70, 5 }, { 65, 5 }, { 75, 5 }, { 80, 5 } }, main_item = { 100012, 100013 } }, [14] = { resource_category = 1, activity = 230, resource_type = 119, id = 14, resource_num = 15, item_list = { { 100028, 1 }, { 100020, 1 }, { 100024, 1 }, { 100015, 1 }, { 100016, 1 }, { 91, 20 }, { 90, 50 }, { 87, 1 }, { 88, 4 }, { 86, 30 }, { 92, 4 }, { 23, 10 }, { 22, 20 }, { 21, 20 }, { 52, 2 }, { 55, 2 }, { 58, 2 }, { 61, 2 }, { 51, 5 }, { 54, 5 }, { 57, 5 }, { 60, 5 }, { 38, 15 }, { 41, 10 }, { 44, 10 }, { 47, 10 }, { 50, 10 }, { 37, 10 }, { 40, 5 }, { 43, 5 }, { 46, 5 }, { 49, 5 }, { 36, 4 }, { 39, 4 }, { 42, 4 }, { 45, 4 }, { 48, 4 }, { 71, 2 }, { 66, 2 }, { 76, 2 }, { 81, 2 }, { 69, 20 }, { 64, 20 }, { 74, 20 }, { 79, 20 }, { 29, 3 }, { 32, 3 }, { 35, 3 }, { 28, 2 }, { 31, 2 }, { 34, 2 } }, main_item = { 100028, 100024 } }, [15] = { resource_category = 1, activity = 230, resource_type = 119, id = 15, resource_num = 15, item_list = { { 100017, 1 }, { 100014, 1 }, { 84, 1 }, { 100027, 1 }, { 100029, 1 }, { 100030, 1 }, { 100018, 1 }, { 100019, 1 }, { 100021, 1 }, { 91, 90 }, { 90, 210 }, { 87, 4 }, { 88, 2 }, { 86, 80 }, { 92, 4 }, { 23, 10 }, { 22, 30 }, { 52, 5 }, { 55, 5 }, { 58, 5 }, { 61, 5 }, { 38, 20 }, { 41, 10 }, { 44, 10 }, { 47, 10 }, { 50, 10 }, { 37, 20 }, { 40, 10 }, { 49, 10 }, { 71, 3 }, { 66, 3 }, { 76, 3 }, { 81, 3 }, { 70, 5 }, { 65, 5 }, { 75, 5 }, { 80, 5 }, { 28, 3 }, { 31, 3 }, { 34, 3 } }, main_item = { 100017, 100014 } }, [16] = { resource_category = 1, activity = 230, resource_type = 119, id = 16, resource_num = 15, item_list = { { 84, 1 }, { 83, 1 }, { 91, 120 }, { 90, 190 }, { 87, 4 }, { 86, 80 }, { 23, 30 }, { 22, 50 }, { 21, 85 }, { 52, 5 }, { 55, 5 }, { 58, 5 }, { 61, 5 }, { 51, 15 }, { 54, 15 }, { 57, 15 }, { 60, 15 }, { 38, 10 }, { 41, 5 }, { 44, 5 }, { 47, 5 }, { 50, 5 }, { 37, 50 }, { 40, 25 }, { 43, 25 }, { 46, 25 }, { 49, 25 }, { 36, 26 }, { 39, 26 }, { 42, 26 }, { 45, 26 }, { 48, 26 }, { 70, 10 }, { 65, 10 }, { 75, 10 }, { 80, 10 }, { 69, 80 }, { 64, 80 }, { 74, 80 }, { 79, 80 }, { 29, 3 }, { 32, 3 }, { 35, 3 }, { 27, 60 }, { 30, 60 }, { 33, 60 } }, main_item = { 84, 83 } }, all = { 1, 2, 3, 4, 9, 10, 11, 12, 13, 14, 15, 16 } } return
return PlaceObj("ModDef", { "title", "Stop Death Failure", "id", "ChoGGi_StopColonistDeathFailure", "steam_id", "1526828043", "pops_any_uuid", "3f3e485a-18d3-4e84-94ce-4e188fb7f3e8", "lua_revision", 1007000, -- Picard "version", 2, "version_major", 0, "version_minor", 2, "image", "Preview.jpg", "author", "ChoGGi", "code", { "Code/Script.lua", }, "description", [[ Allows you to keep your game going even if you turn out to be a mass murderer. This stops the failures from the last colonist leaving Mars and you offing too many of them with your incompetence. Works with new and saved games, you can also disable it at anytime. Requested by Martin. ]], })
collectibles = { {"mi_firstguardianheart", 1}, {"mi_ironore", 10} } markers = { { map = "res/map/gandria/gandria.tmx", position = {350, 1950}, step = 0 }, { map = "res/map/gandria/gandria.tmx", position = {200, 2550}, npc = "npc_harek", step = -1 } }
AddCSLuaFile() DEFINE_BASECLASS( "base_anim" ) ENT.PrintName = "Prop Entity" ENT.Author = "Wolvindra-Vinzuerio" ENT.Information = "A prop entity for Prop Hunt: Enhanced" ENT.Category = "" ENT.Editable = true ENT.Spawnable = true ENT.AdminOnly = false ENT.RenderGroup = RENDERGROUP_BOTH function ENT:SetupDataTables() end function ENT:Initialize() if SERVER then self:SetModel("models/player/kleiner.mdl") self:SetLagCompensated(true) self:SetMoveType(MOVETYPE_NONE) self.health = 100 else end end if CLIENT then function ENT:Draw() self:DrawModel() end end -- Prop Movement and Rotation (CLIENT) function ENT:Think() if CLIENT then local pl = self:GetOwner() if IsValid(pl) && pl:Alive() && pl == LocalPlayer() then local me = LocalPlayer() local pos = me:GetPos() local ang = me:GetAngles() local lockstate = pl:GetPlayerLockedRot() if self:GetModel() == "models/player/kleiner.mdl" || self:GetModel() == player_manager.TranslatePlayerModel(GetConVar("cl_playermodel"):GetString()) then self:SetPos(pos) else self:SetPos(pos - Vector(0, 0, self:OBBMins().z)) end if !lockstate then self:SetAngles(Angle(0,ang.y,0)) end end end end if SERVER then -- Transmit update function ENT:UpdateTransmitState() return TRANSMIT_ALWAYS end -- Main Function function ENT:OnTakeDamage(dmg) local pl = self:GetOwner() local attacker = dmg:GetAttacker() local inflictor = dmg:GetInflictor() -- Health if GAMEMODE:InRound() && IsValid(pl) && pl:Alive() && pl:IsPlayer() && attacker:IsPlayer() && dmg:GetDamage() > 0 then if pl:Armor() >= 10 then self.health = self.health - (math.Round(dmg:GetDamage()/2)) pl:SetArmor(pl:Armor() - 20) else self.health = self.health - dmg:GetDamage() end pl:SetHealth(self.health) if self.health <= 0 then pl:KillSilent() pl:SetArmor(0) if inflictor && inflictor == attacker && inflictor:IsPlayer() then inflictor = inflictor:GetActiveWeapon() if !inflictor || inflictor == NULL then inflictor = attacker end end net.Start( "PlayerKilledByPlayer" ) net.WriteEntity( pl ) net.WriteString( inflictor:GetClass() ) net.WriteEntity( attacker ) net.Broadcast() MsgAll(attacker:Name() .. " found and killed " .. pl:Name() .. "\n") if PHX.CVAR.FreezeCamera:GetBool() then if pl:GetNWBool("InFreezeCam", false) then pl:PrintMessage(HUD_PRINTCONSOLE, "!! WARNING: Something went wrong with the Freeze Camera, but it's still enabled!") else timer.Simple(0.5, function() if !pl:GetNWBool("InFreezeCam", false) then -- Play the good old Freeze Cam sound net.Start("PlayFreezeCamSound") net.Send(pl) pl:SetNWEntity("PlayerKilledByPlayerEntity", attacker) pl:SetNWBool("InFreezeCam", true) pl:SpectateEntity( attacker ) pl:Spectate( OBS_MODE_FREEZECAM ) end end) timer.Simple(4.5, function() if pl:GetNWBool("InFreezeCam", false) then pl:SetNWBool("InFreezeCam", false) pl:Spectate( OBS_MODE_CHASE ) pl:SpectateEntity( nil ) end end) end end attacker:AddFrags(1) pl:AddDeaths(1) attacker:SetHealth(math.Clamp(attacker:Health() + GetConVarNumber("ph_hunter_kill_bonus"), 1, 100)) hook.Call("PH_OnPropKilled", nil, pl, attacker) pl:RemoveProp() end end end end
bakedanuki_tricksters_insight = class({}) LinkLuaModifier( "modifier_bakedanuki_tricksters_insight", "custom_abilities/bakedanuki_tricksters_insight/modifier_bakedanuki_tricksters_insight", LUA_MODIFIER_MOTION_NONE ) LinkLuaModifier( "modifier_bakedanuki_tricksters_insight_passive", "custom_abilities/bakedanuki_tricksters_insight/modifier_bakedanuki_tricksters_insight_passive", LUA_MODIFIER_MOTION_NONE ) -------------------------------------------------------------------------------- -- Ability Start function bakedanuki_tricksters_insight:OnSpellStart() -- unit identifier local caster = self:GetCaster() local target = self:GetCursorTarget() if target:TriggerSpellAbsorb( self ) then return end -- load data local bDuration = self:GetSpecialValueFor("crit_duration") -- Add modifier caster:AddNewModifier( caster, -- player source self, -- ability source "modifier_bakedanuki_tricksters_insight_passive", -- modifier name { duration = bDuration } -- kv ) target:AddNewModifier( caster, -- player source self, -- ability source "modifier_bakedanuki_tricksters_insight", -- modifier name { duration = bDuration } -- kv ) self:PlayEffects( target ) end -------------------------------------------------------------------------------- -- Ability Considerations function bakedanuki_tricksters_insight:AbilityConsiderations() -- Scepter local bScepter = caster:HasScepter() -- Linken & Lotus local bBlocked = target:TriggerSpellAbsorb( self ) -- Break local bBroken = caster:PassivesDisabled() -- Advanced Status local bInvulnerable = target:IsInvulnerable() local bInvisible = target:IsInvisible() local bHexed = target:IsHexed() local bMagicImmune = target:IsMagicImmune() -- Illusion Copy local bIllusion = target:IsIllusion() end -------------------------------------------------------------------------------- function bakedanuki_tricksters_insight:PlayEffects( target ) -- Get Resources local sound_cast = "Hero_DarkWillow.Shadow_Realm.Damage" EmitSoundOn( sound_cast, target ) end
local M = {}; local ElementObject = require("src.Lib.Element"); local XMLObject = require("src.Lib.XMLObject"); -- Converts XML file to string, or string to string local function ToString(arg) if (type(arg) == "userdata") then local list = {}; for l in arg:lines() do list[#list+1] = l; end return table.concat(list); elseif (type(arg) == "string") then return tostring(arg); end end -- Splits string at desired character local function Split(s, spliter) local list = {}; local str = ""; for char in string.gmatch(s, '.') do if (char ~= spliter) then str = str..char; else list[#list+1] = str; str = ""; end end if (str ~= "") then list[#list+1] = str; end return list; end -- Recurses through element's children function M.Recurse(element) local result = {}; for _, child in next, element.Children do result[#result+1] = child; for _, sub in next, M.Recurse(child) do result[#result+1] = sub; end end return result; end -- Get all XML data from source function M.GetXML(source, reference, parent, xmlParent) reference = reference or {}; parent = parent or nil; -- Optimize XML source = source:gsub("<([%w_%-?:?%w_%-?]+)([^>]*)/>", "<%1%2></%1>"); -- Create XML Object local result = xmlParent or XMLObject.new(nil, source); -- Read and remove comments for comment in source:gmatch("<!--(.-)*-->") do result.Object.Comments[#result.Object.Comments+1] = comment:sub(2, comment:len()-1); end source = source:gsub("<!--(.-)*-->", "") -- Read and remove DOCTYPE result.Object.DOCTYPE = ElementObject.newDoctype(source:match("<!DOCTYPE([^>]*)>")); source = source:gsub("<!DOCTYPE([^>]*)>", ""); -- Read and remove CData for data in source:gmatch("<!%[CDATA%[(.*)%]%]>") do result.Object.CDATA[#result.Object.CDATA+1] = ElementObject.newCData(data); end source = source:gsub("<!%[CDATA%[(.*)%]%]>", ""); local function GetProcessor(source, result, reference, parent) -- Read and remove processor for name, attrib in source:gmatch("<%?([%w_%-?:?%w_%-?]+)([^>]*)%?>") do local attributes = {}; local ref = {}; local raw_name = name; local raw_attributes = {}; -- Read attributes for key, value in attrib:gmatch("([%w_%-:?%w_%-]+)=\'?\"?([^>\"\']*)\'?\"?") do raw_attributes[key] = tonumber(value) or value; -- Find references local shkey, shname = key:match("([%w_%-]+):([%w_%-]+)"); if (shkey and shname) then ref = { Key = shkey, Name = shname, Value = value; }; reference[#reference+1] = ref; for _, refer in next, reference do if (refer.Value:match("https?://(.-)/(.*)")) then if (ref.Key == refer.Name) then key = '[' .. refer.Value .. ']' .. shname; end end end if not (key:match('%[(.-)%](.*)')) then key = '[' .. value .. ']' .. shname; end end attributes[key] = tonumber(value) or value; end -- Find reference in line local refer = {}; if (name:match("([%w_%-]+):([%w_%-]+)")) then local key, tag = name:match('([%w_%-]+):([%w_%-]+)'); for i, reft in next, reference do if (reft.Value:match("https?://(.-)/(.*)")) then if (key == reft.Name) then name = ('[' .. reft.Value .. ']') .. tag; refer = reft; end end end end result.Object.Processing[#result.Object.Processing+1] = ElementObject.newElement { Tag = name; Attributes = attributes; Data = {}; RawAttributes = raw_attributes; RawTag = raw_name; Processor = true; Children = {}; Reference = refer; ParentPath = parent and parent:GetFullPath() or ""; Parent = parent; }; end end local function GetData(source, result, reference, parent) for name, attrib, data in source:gmatch('<([%w_%-:?%w_%-]+)([^>]*)>(.-)</%1>') do local attributes = {}; local ref = {}; local raw_name = name; local raw_attributes = {}; -- Read attributes for key, value in attrib:gmatch("([%w_%-:?%w_%-]+)=\'?\"?([^>\"\']*)\'?\"?") do raw_attributes[key] = tonumber(value) or value; -- Find references local shkey, shname = key:match("([%w_%-]+):([%w_%-]+)"); if (shkey and shname) then ref = { Key = shkey, Name = shname, Value = value; }; reference[#reference+1] = ref; for _, refer in next, reference do if (refer.Value:match("https?://(.-)/(.*)")) then if (ref.Key == refer.Name) then key = '[' .. refer.Value .. ']' .. shname; end end end if not (key:match('%[(.-)%](.*)')) then key = '[' .. value .. ']' .. shname; end end attributes[key] = tonumber(value) or value; end -- Find reference in line local refer = {}; if (name:match("([%w_%-]+):([%w_%-]+)")) then local key, tag = name:match('([%w_%-]+):([%w_%-]+)'); for i, reft in next, reference do if (reft.Value:match("https?://(.-)/(.*)")) then if (key == reft.Name) then name = ('[' .. reft.Value .. ']') .. tag; refer = reft; end end end end result.Object.Data[#result.Object.Data+1] = ElementObject.newElement { Tag = name; Attributes = attributes; Data = data; RawAttributes = raw_attributes; RawTag = raw_name; Processor = false; Children = {}; Reference = refer; ParentPath = parent and parent:GetFullPath() or ""; Parent = parent; }; end end GetProcessor(source, result, reference, parent); GetData(source, result, reference, parent); return result, reference; end -- Reads XML, if there is a function then it will be called after every iteration local function ReadXml(arg, xml, parent) xml = xml or XMLObject.new(nil, arg); --local function IterElement(e, r, f, p) local function IterElement(element, reference, parent) local result = {}; for _, child in next, M.GetXML(element.Data, reference, parent).Object.Data do --f(element); result[#result+1] = child; for i, v in next, IterElement(child, reference, child) do if (result[#result]['Children']) then result[#result]['Children'][#result[#result]['Children']+1] = v; else result[#result+1] = v; end end parent = child.Parent; end return result; end local function Do(source) local result, schemas = M.GetXML(source, nil, parent, xml); local schemahash = {}; local schemares = {}; for i, v in next, schemas do if (not schemahash[v]) then schemares[#schemares+1] = v; schemahash[v]=true; end end result.Object.Schemas = schemares; for _, element in next, result.Object.Data do element.Children = IterElement(element, schemares, element); end return result; end return Do(arg); end -- Main function for external use of reading xml function M.Read(arg) return ReadXml(ToString(arg)); end return M;
PlacedObjects = {} InitTable("placed_items", { uuid = { type = 'char', length = 36, unique = true }, item = { type = 'char', length = 24 }, location = { type = 'json' }, rotation = { type = 'json' }, storage = { type = 'json' }, steamid = { type = 'char', length = 17, }, }, false) -- true to recreate table AddEvent("OnPackageStart", function() log.info("Creating placed items....") SelectRows("placed_items", "*", nil, onLoadPlacedItems) end) function onLoadPlacedItems() for i=1, mariadb_get_row_count() do local row = mariadb_get_assoc(i) local item = row['item'] local loc = json_decode(row['location']) local object = CreateObject(ItemConfig[item].modelid, loc.x, loc.y, loc.z) if not object then log.error("Cannot create placed item: "..item) return end SetObjectPropertyValue(object, "item", item) SetObjectPropertyValue(object, "placeable", true) SetObjectPropertyValue(object, "steamid", row['steamid']) SetObjectPropertyValue(object, "prop", ItemConfig[item].prop) -- rotation local rot = json_decode(row['rotation']) SetObjectRotation(object, rot.x, rot.y, rot.z) -- setup items in storage local storage = json_decode(row['storage']) for i, item in ipairs(storage) do SetItemInstance(item.uuid, item.item) end SetObjectPropertyValue(object, "storage", storage) PlacedObjects[object] = { uuid = row['uuid'], item = row['item'] } -- todo: particles, components, etc log.debug("Spawned placed object " .. object .. " item " .. item .. " uuid " .. row['uuid']) end end AddEvent("OnPackageStop", function() log.info("Destroying all placed objects...") for object in pairs(PlacedObjects) do --log.debug("Destroying placed object " .. object) PlacedObjects[object] = nil DestroyObject(object) end end) AddRemoteEvent("PlaceItem", function(player, uuid, loc) local item = GetItemInstance(uuid) if not ItemConfig[item] or ItemConfig[item].type ~= "placeable" then log.error("Cannot place invalid or non-placeable item!") return end UnequipItem(player, uuid) RemoveFromInventory(player, uuid) local object = CreateObject(ItemConfig[item].modelid, loc.x, loc.y, loc.z) if not object then return end local steamid = tostring(GetPlayerSteamId(player)) SetObjectPropertyValue(object, "item", item) SetObjectPropertyValue(object, "placeable", true) SetObjectPropertyValue(object, "steamid", steamid) if ItemConfig[item].prop then SetObjectPropertyValue(object, "prop", ItemConfig[item].prop) end -- generate new uuid for each placed object local object_uuid = generate_uuid() PlacedObjects[object] = { uuid = object_uuid, item = item } log.debug(GetPlayerName(player) .. " placed object " .. object .. " item " .. item) CallRemoteEvent(player, "ObjectPlaced", object) CallEvent("items:" .. item .. ":placed", player, object) local rx, ry, rz = GetObjectRotation(object) InsertRow("placed_items", { uuid = object_uuid, item = item, location = { x = loc.x, y = loc.y, z = loc.z }, rotation = { x = rx, y = ry, z = rz }, storage = {}, -- todo steamid = steamid, }) end) AddRemoteEvent("UpdateObjectPlacement", function(player, object, x, y, z, rx, ry, rz) local item = GetObjectPropertyValue(object, "item") if not ItemConfig[item] or ItemConfig[item].type ~= "placeable" then log.error "Cannot place non-placeable objects" return end local po = PlacedObjects[object] if not po.uuid then log.error "Cannot place unknown item" return end SetObjectPropertyValue(object, "steamid", GetPlayerSteamId(player)) UpdateRows("placed_items", { location = { x = x, y = y, z = z }, rotation = { x = rx, y = ry, z = rz } }, { uuid = po.uuid }) log.debug(GetPlayerName(player) .. " placed object " .. object) end) AddRemoteEvent("UnplaceItem", function(player, object) local item = GetObjectPropertyValue(object, "item") if not ItemConfig[item] or ItemConfig[item].type ~= "placeable" then log.error "Cannot pick up non-placeable objects" return end -- ownership check? --[[ local steamid = GetObjectPropertyValue(object, "steamid") if not steamid or steamid ~= tostring(GetPlayerSteamId(player)) then CallRemoteEvent(player, "ShowError", "Cannot pick this up!") return end ]] RemovePlacedObject(object) local uuid = RegisterNewItem(item) AddItemInstanceToInventory(player, uuid) CallRemoteEvent(player, "ShowMessage", ItemConfig[item].name .. " has been added to your inventory.") log.debug(GetPlayerName(player) .. " unplaced object " .. object .. " item " .. item .. " new uuid: " .. uuid) end) function GetPlacedObjectsByName(item) local placed_objects = {} for object,p in pairs(PlacedObjects) do if p.item == item then table.insert(placed_objects, object) end end return placed_objects end function GetPlacedObjectsCount() return #table.keys(PlacedObjects) end function RemovePlacedObject(object) placed = PlacedObjects[object] if not placed then return end PlacedObjects[object] = nil DestroyObject(object) DeleteRow("placed_items", { uuid = placed.uuid }) end
-- ========== THIS IS AN AUTOMATICALLY GENERATED FILE! ========== PlaceObj('XTemplate', { group = "InGame", id = "ResearchDlg", PlaceObj('XTemplateWindow', { '__class', "XDialog", }, { PlaceObj('XTemplateFunc', { 'comment', "Disable hint", 'name', "OnDelete(self)", 'func', function (self) ContextAwareHintShow("HintResearch", false) local hintdlg = GetOnScreenHintDlg() if HintsEnabled and hintdlg then hintdlg:SetParent(GetInGameInterface()) hintdlg:SetHiddenMinimized(false) end end, }), PlaceObj('XTemplateWindow', { 'Margins', box(0, 0, -90, 0), 'Background', RGBA(0, 0, 0, 255), }, { PlaceObj('XTemplateWindow', { '__class', "XFrame", 'Image', "UI/Icons/Research/rm_background.tga", }), PlaceObj('XTemplateWindow', { '__class', "XFrame", 'Margins', box(0, 0, -2000, -2000), 'Image', "UI/Icons/Research/rm_mist.tga", 'ImageScale', point(1500, 1500), 'TileFrame', true, }, { PlaceObj('XTemplateCode', { 'comment', "mist scroll", 'run', function (self, parent, context) parent:AddInterpolation{ type = const.intRect, duration = 120000, startRect = box(0, 0, 10, 10), endRect = box(0, 0, 10, 10) + point(-500, -200), --easing = const.Easing.SinInOut, flags = const.intfPingPong + const.intfLooping, } end, }), }), PlaceObj('XTemplateWindow', { 'Margins', box(0, 40, 0, 40), }, { PlaceObj('XTemplateFunc', { 'name', "Open", 'func', function (self, ...) XWindow.Open(self, ...) self:SetMargins(GetSafeMargins(self:GetMargins())) end, }), PlaceObj('XTemplateWindow', { '__class', "XFitContent", 'IdNode', false, 'Fit', "height", }, { PlaceObj('XTemplateWindow', { '__class', "XScrollArea", 'Id', "idArea", 'LayoutMethod', "VList", 'Clip', false, 'HScroll', "idHScroll", 'MouseScroll', false, }, { PlaceObj('XTemplateWindow', { '__class', "XScroll", 'Id', "idHScroll", 'Dock', "ignore", 'Visible', false, }), PlaceObj('XTemplateCode', { 'comment', "scroll", 'run', function (self, parent, context) if GetUIStyleGamepad() then return end parent:CreateThread(function () while true do Sleep(8) local win = parent if win.desktop.last_mouse_pos then local x, y = win.desktop.last_mouse_pos:xy() local max_x, max_y = win.desktop.content_box:maxxyz() local dx if x < 100 then dx = - 10 end if x > max_x - 100 then dx = 10 end if not dx and g_ResearchDlgPendingScrollOffsetX ~= 0 then dx = g_ResearchDlgPendingScrollOffsetX end if dx then local new_offset = Clamp(win.OffsetX + dx, 0, win.scroll_range_x - win.content_box:sizex() + 100) win:ScrollTo(new_offset, win.OffsetY, true) win.desktop:UpdateMouseTarget() g_ResearchDlgPendingScrollOffsetX = 0 end end end end) end, }), PlaceObj('XTemplateForEach', { 'comment', "field", 'array', function (parent, context) return TechTree end, 'condition', function (parent, context, item, i) return item.show_in_field == "" end, '__context', function (parent, context, item, i, n) return item end, }, { PlaceObj('XTemplateWindow', { 'IdNode', true, 'MinHeight', 236, 'MaxHeight', 236, 'RolloverOnFocus', true, }, { PlaceObj('XTemplateFunc', { 'name', "OnSetRollover(self, rollover)", 'func', function (self, rollover) self.idFieldName:SetRollover(self.rollover) for _, win in ipairs(self.idFieldTech) do win.idContent:AddInterpolation{ id = "zoom-field", type = const.intRect, duration = 200, startRect = win.idContent:CalcZoomedBox(1000), startRectAutoZoom = 1000, endRect = win.idContent:CalcZoomedBox(1050), endRectAutoZoom = 1050, flags = not self.rollover and const.intfInverse or nil, autoremove = not self.rollover or nil, } end if self.rollover then self.idFieldTech:RemoveModifier("desat") else self.idFieldTech:AddInterpolation{id = "desat", type = const.intDesaturation, startValue = 140} end PlayFX("TechFieldMouseIn", self.rollover and "start" or "end") end, }), PlaceObj('XTemplateWindow', { 'Margins', box(-20, 0, -300, 0), 'Dock', "box", 'LayoutMethod', "VList", 'HandleMouse', true, }, { PlaceObj('XTemplateWindow', { 'comment', "upper line", '__class', "XFrame", 'Dock', "top", 'MinHeight', 84, 'Image', "UI/Common/bm_pad.tga", 'FrameBox', box(300, 10, 300, 0), 'FlipY', true, }), PlaceObj('XTemplateWindow', { 'comment', "lower line", '__class', "XFrame", 'Dock', "bottom", 'MinHeight', 84, 'Image', "UI/Common/bm_pad.tga", 'FrameBox', box(300, 10, 300, 0), }), }), PlaceObj('XTemplateWindow', { 'comment', "field name", '__class', "XLabel", 'Id', "idFieldName", 'Padding', box(80, 2, 2, 2), 'Dock', "left", 'VAlign', "center", 'MinWidth', 260, 'TextFont', "MarsMenuItemButton", 'TextColor', RGBA(119, 198, 255, 255), 'RolloverTextColor', RGBA(255, 255, 255, 255), 'Translate', true, 'Text', T{135513074411, --[[XTemplate ResearchDlg Text]] "<display_name>"}, }), PlaceObj('XTemplateWindow', { 'Id', "idFieldTech", 'IdNode', true, 'MinHeight', 236, 'LayoutMethod', "HList", 'LayoutHSpacing', -50, 'HandleMouse', true, }, { PlaceObj('XTemplateCode', { 'comment', "inactive desat", 'run', function (self, parent, context) parent:AddInterpolation{id = "desat", type = const.intDesaturation, startValue = 140} end, }), PlaceObj('XTemplateForEach', { 'comment', "tech", 'array', function (parent, context) return UICity:UITechField(context.id) end, 'map', function (parent, context, array, i) return TechDef[array[i]] end, '__context', function (parent, context, item, i, n) return item end, }, { PlaceObj('XTemplateWindow', { '__class', "XTechControl", }), }), }), }), }), }), }), }), }), PlaceObj('XTemplateFunc', { 'comment', "controller LS/RS", 'name', "OnShortcut(self, shortcut, source)", 'func', function (self, shortcut, source) return ResearchDlgOnShortcut(self, shortcut, source) end, }), PlaceObj('XTemplateAction', { 'RolloverTemplate', "RolloverConst", 'RolloverText', T{942201510325, --[[XTemplate ResearchDlg RolloverText]] "In exchange for <funding(OutsourceResearchCost)> Funding, outsourced researchers will contribute <ResearchPoints(OutsourceResearch)> in the next <time(OutsourceResearchTime)>."}, 'ActionId', "outsource", 'ActionName', T{889032422791, --[[XTemplate ResearchDlg ActionName]] "OUTSOURCE"}, 'ActionToolbar', "ActionBar", 'ActionGamepad', "ButtonY", 'ActionState', function (self, host) if (g_Consts.OutsourceDisabled or 0) > 0 then return "disabled" end end, 'OnAction', function (self, host, source, toggled) if host:IsThreadRunning("outsource") then host:DeleteThread("outsource") end host:CreateThread("outsource", function() local funding = UICity:GetFunding() if funding >= g_Consts.OutsourceResearchCost then local multiplier = 10 local has_money = funding >= g_Consts.OutsourceResearchCost * multiplier local params = { title = T{6882, "Warning"}, text = T{7876, "Are you sure you want to outsource research to Earth?"}, choice1 = T{7877, "Outsource <ResearchPoints(points)> for <funding(price)> in the next <time(sols)>", points = g_Consts.OutsourceResearch, price = g_Consts.OutsourceResearchCost, sols = g_Consts.OutsourceResearchTime}, choice2 = has_money and T{7877, "Outsource <ResearchPoints(points)> for <funding(price)> in the next <time(sols)>", points = g_Consts.OutsourceResearch * multiplier, price = g_Consts.OutsourceResearchCost * multiplier, sols = g_Consts.OutsourceResearchTime} or nil, image = "UI/Messages/outsource.tga", } if has_money then params.choice3 = T{1139, "No"} else params.choice2 = T{1139, "No"} end local res = WaitPopupNotification(false, params, false, host) if res == 1 or (has_money and res == 2) then multiplier = (res == 1) and 1 or multiplier UICity:ChangeFunding(-g_Consts.OutsourceResearchCost * multiplier) UICity:OutsourceResearch(g_Consts.OutsourceResearch * multiplier, g_Consts.OutsourceResearchTime) end else CreateMarsMessageBox(T{6902, "Warning"}, T{7562, "Insufficient funding! <funding(price)> required for outsourcing!", price = g_Consts.OutsourceResearchCost}, T{1000136, "OK"}, host) end end) end, 'FXMouseIn', "OutsourceButtonHover", 'FXPress', "OutsourceButtonClick", }), PlaceObj('XTemplateAction', { 'ActionId', "close", 'ActionName', T{4523, --[[XTemplate ResearchDlg ActionName]] "CLOSE"}, 'ActionToolbar', "ActionBar", 'ActionShortcut', "Escape", 'ActionGamepad', "ButtonB", 'OnActionEffect', "close", }), PlaceObj('XTemplateFunc', { 'comment', "focus the first tech with gamepad", 'name', "Open", 'func', function (self, ...) XDialog.Open(self, ...) self.idArea:ScrollTo(g_ResearchScroll) if GetUIStyleGamepad() then CreateRealTimeThread(function(self) local first_tech = self:GetRelativeFocus(point(1, 1), "exact") if first_tech then first_tech:SetFocus(true) end end, self) end ----- Trigger hint local hintdlg = GetOnScreenHintDlg() if HintsEnabled and hintdlg then ContextAwareHintShow("HintResearch", true) hintdlg:SetParent(self) hintdlg:SetHiddenMinimized(true) end end, }), PlaceObj('XTemplateFunc', { 'comment', "focus the first tech with gamepad", 'name', "OnDelete", 'func', function (self, ...) g_ResearchScroll = self.idArea.OffsetX end, }), PlaceObj('XTemplateTemplate', { '__context', function (parent, context) return UICity end, '__template', "OverlayDlg", 'HostInParent', true, 'FocusOnOpen', "", 'Transparent', false, 'Vertical', true, }, { PlaceObj('XTemplateWindow', { 'Dock', "top", 'LayoutMethod', "VList", }, { PlaceObj('XTemplateWindow', { '__class', "XLabel", 'HAlign', "right", 'TextFont', "PGModTitle", 'TextColor', RGBA(119, 198, 255, 255), 'Translate', true, 'Text', T{4530, --[[XTemplate ResearchDlg Text]] "RESEARCH"}, }), PlaceObj('XTemplateWindow', { '__class', "XText", 'HAlign', "right", 'HandleMouse', false, 'TextFont', "PGModAuthorDate", 'TextColor', RGBA(119, 198, 255, 255), 'Translate', true, 'Text', T{4531, --[[XTemplate ResearchDlg Text]] "Available Funding <white><funding(Funding)>"}, }), PlaceObj('XTemplateWindow', { '__class', "XText", 'HAlign', "right", 'HandleMouse', false, 'TextFont', "PGModAuthorDate", 'TextColor', RGBA(119, 198, 255, 255), 'Translate', true, 'Text', T{4532, --[[XTemplate ResearchDlg Text]] "Research per Sol <white><ResearchPoints(EstimatedRP)>"}, }), PlaceObj('XTemplateWindow', { '__class', "XFrame", 'Margins', box(-80, 6, -160, -100), 'VAlign', "top", 'Image', "UI/Common/bm_pad_small.tga", 'FrameBox', box(170, 0, 170, 0), 'SqueezeY', false, }), PlaceObj('XTemplateTemplate', { '__template', "InfopanelText", 'Text', T{4533, --[[XTemplate ResearchDlg Text]] "Sponsor<right><ResearchPoints(EstimatedRP_Sponsor)>"}, }), PlaceObj('XTemplateTemplate', { '__template', "InfopanelText", 'Text', T{4534, --[[XTemplate ResearchDlg Text]] "Outsourcing<right><ResearchPoints(EstimatedRP_Outsource)>"}, }), PlaceObj('XTemplateTemplate', { '__template', "InfopanelText", 'Text', T{4535, --[[XTemplate ResearchDlg Text]] "Research Labs<right><ResearchPoints(EstimatedRP_ResearchLab)>"}, }), PlaceObj('XTemplateTemplate', { '__template', "InfopanelText", 'Text', T{4536, --[[XTemplate ResearchDlg Text]] "Hawking Institutes<right><ResearchPoints(EstimatedRP_ScienceInstitute)>"}, }), PlaceObj('XTemplateTemplate', { '__template', "InfopanelText", 'Text', T{4537, --[[XTemplate ResearchDlg Text]] "Genius Colonists<right><ResearchPoints(EstimatedRP_Genius)>"}, }), PlaceObj('XTemplateTemplate', { '__condition', function (parent, context) return context:IsTechResearched("ExplorerAI") end, '__template', "InfopanelText", 'Text', T{4538, --[[XTemplate ResearchDlg Text]] "Explorers<right><ResearchPoints(EstimatedRP_Explorer)>"}, }), PlaceObj('XTemplateTemplate', { '__condition', function (parent, context) return g_Consts.ElectricityForResearchPoint ~= 0 end, '__template', "InfopanelText", 'Text', T{4539, --[[XTemplate ResearchDlg Text]] "Excess Power<right><ResearchPoints(EstimatedRP_SuperconductingComputing)>"}, }), PlaceObj('XTemplateTemplate', { '__context', function (parent, context) return GetOmegaTelescope() end, '__condition', function (parent, context) return context end, '__template', "InfopanelText", 'Text', T{556459376226, --[[XTemplate ResearchDlg Text]] "<display_name><right><em><ResearchBoostPercent>%"}, }), PlaceObj('XTemplateWindow', { 'Margins', box(0, 40, 0, 20), }, { PlaceObj('XTemplateWindow', { '__condition', function (parent, context) return GetUIStyleGamepad() end, '__class', "XText", 'HAlign', "right", 'VAlign', "center", 'Translate', true, 'Text', T{634036540793, --[[XTemplate ResearchDlg Text]] "<RB>"}, }), PlaceObj('XTemplateWindow', { '__class', "XLabel", 'Dock', "right", 'TextFont', "PGModTitle", 'TextColor', RGBA(119, 198, 255, 255), 'Translate', true, 'Text', T{4540, --[[XTemplate ResearchDlg Text]] "RESEARCH QUEUE"}, }), }), }), PlaceObj('XTemplateWindow', { 'comment', "queue", '__context', function (parent, context) return UICity:GetResearchQueue() end, '__class', "XContentTemplateList", 'Margins', box(-60, 0, 0, 0), 'BorderWidth', 0, 'Clip', false, 'Background', RGBA(0, 0, 0, 0), 'RelativeFocusOrder', "skip", 'FocusedBackground', RGBA(0, 0, 0, 0), 'ShowPartialItems', false, }, { PlaceObj('XTemplateFunc', { 'name', "OnShortcut(self, shortcut, source)", 'func', function (self, shortcut, source) return XActionsHost.OnShortcut(self, shortcut, source) end, }), PlaceObj('XTemplateForEach', { 'comment', "research queue", 'array', function (parent, context) return UICity:GetResearchQueue(), 1, const.ResearchQueueSize+1 end, 'map', function (parent, context, array, i) return TechDef[array[i]] end, '__context', function (parent, context, item, i, n) return item end, 'run_after', function (child, context, item, i, n) if item then child:SetIcon(item.icon) if n == 1 then child.idIcon:SetScaleModifier(point(2000,2000)) child.idIcon:SetMargins(box(-22,-2,0,0)) child:SetRolloverTitle(T{7609, "<display_name> (<FieldDisplayName>) <percent(p)>", p = UICity:GetResearchProgress()}) end local cost = item:ResearchQueueCost(n) child.idTechText:SetText(T{4543, "<FieldDisplayName><right><ResearchPoints(cost)>", cost = cost}) end child:SetFocusOrder(point(1000, n)) end, }, { PlaceObj('XTemplateTemplate', { '__condition', function (parent, context) return context end, '__template', "InfopanelSection", 'RolloverTemplate', "Rollover", 'RolloverText', T{3921, --[[XTemplate ResearchDlg RolloverText]] "<description><newline><newline>Research cost<right><ResearchPoints(cost)>"}, 'RolloverTitle', T{3917, --[[XTemplate ResearchDlg RolloverTitle]] "<display_name> (<FieldDisplayName>)"}, 'RolloverHint', T{3922, --[[XTemplate ResearchDlg RolloverHint]] "<right_click> Remove from Research queue"}, 'RolloverHintGamepad', T{3924, --[[XTemplate ResearchDlg RolloverHintGamepad]] "<ButtonX> Remove from research queue"}, 'FoldWhenHidden', false, 'InternalLeftRightNav', false, 'Title', T{460245435559, --[[XTemplate ResearchDlg Title]] "<display_name>"}, 'TitleHAlign', "left", }, { PlaceObj('XTemplateTemplate', { '__template', "InfopanelText", 'Id', "idTechText", }), PlaceObj('XTemplateFunc', { 'name', "OnActivate(self, context)", 'parent', function (parent, context) return parent.parent end, 'func', function (self, context) if UICity:DequeueResearch(context.id) then PlayFX("DequeueResearch", "start") end end, }, { PlaceObj('XTemplateFunc', { 'name', "OnAltActivate(self, context)", 'func', function (self, context) self:OnActivate(context) end, }), }), }), PlaceObj('XTemplateTemplate', { '__condition', function (parent, context) return not context end, '__template', "InfopanelSection", 'FoldWhenHidden', false, 'Title', T{385959075356, --[[XTemplate ResearchDlg Title]] "Empty slot"}, 'Icon', "UI/Icons/Research/rm_unknown.tga", 'TitleHAlign', "left", }, { PlaceObj('XTemplateFunc', { 'name', "OnActivate(self, context)", 'parent', function (parent, context) return parent.parent end, 'func', function (self, context) PlayFX("UIDisabledButtonPressed", "start") end, }, { PlaceObj('XTemplateCode', { 'run', function (self, parent, context) parent.idSectionTitle:SetTextColor(RGB(96, 135, 185)) parent.idSectionTitle:SetRolloverTextColor(RGB(96, 135, 185)) end, }), }), }), }), PlaceObj('XTemplateTemplate', { '__context', function (parent, context) return UICity end, '__parent', function (parent, context) return parent[1].idContent end, '__condition', function (parent, context) return UICity:GetResearchQueue()[1] end, '__template', "SimpleProgress", 'Id', "idProgress", 'Margins', box(0, 4, 0, 4), 'MinWidth', 260, 'MaxWidth', 260, 'BindTo', "ResearchProgress", }), }), }), }), })
-- See LICENSE for terms local mod_EnableMod local mod_RevealDarkness local function StartupCode() if not mod_EnableMod then return end if RevealDarkness then hr.RenderRevealDarkness = 0 else hr.RenderRevealDarkness = 1 end UIColony:RevealUndergroundDarkness() end local function ModOptions(id) -- id is from ApplyModOptions if id and id ~= CurrentModId then return end mod_EnableMod = CurrentModOptions:GetProperty("EnableMod") mod_RevealDarkness = CurrentModOptions:GetProperty("RevealDarkness") -- make sure we're in-game if not UIColony then return end StartupCode() end -- load default/saved settings OnMsg.ModsReloaded = ModOptions -- fired when Mod Options>Apply button is clicked OnMsg.ApplyModOptions = ModOptions -- check for being fired early with UICity --~ OnMsg.ChangeMapDone = StartupCode OnMsg.CityStart = StartupCode OnMsg.LoadGame = StartupCode -- switch between different maps OnMsg.ChangeMapDone = StartupCode
About = Object:extend() function About:new() self.area = Area(self) mediumFont = love.graphics.newFont("font/GothamBook.ttf", 14) largeFont = love.graphics.newFont("font/GothamBook.ttf", 24) mediumFont:setFilter("nearest", "nearest") largeFont:setFilter("nearest", "nearest") -- bind 'esc' button to change the room Input():bind("escape", function() gotoRoom("Menu") end) end function About:update(dt) local blockWidth = screenX - 100 local blockHeight = screenY / 8 Suit.layout:reset((screenX / 2) - blockWidth / 2, 0) Suit.Label("About", {font = largeFont}, Suit.layout:row(blockWidth, blockHeight)) Suit.Label("The framework 'LÖVE' was my aspiration to write the 'game' you see now. Unfortunately, some of the ideas weren't implemented in the game, mostly because of my lack of experience with the Lua and framework of course. Still, the game even with bugs and glitch is finished; which I think is great!", {font = mediumFont, align = "left"}, Suit.layout:row()) Suit.Label("The framework experience I have was written in my web-page: https://mikhailadamenko.design in a form of tutorials, fill free to read and gave comments!", {font = mediumFont, align = "left"}, Suit.layout:row()) Suit.Label("License", {font = largeFont}, Suit.layout:row()) Suit.Label("The code of the following program: https://github.com/A-Mikhail/Love-GameOfLife you may use as you want, feel free to change, delete, and do what you want with it.", {font = mediumFont, align = "left"}, Suit.layout:row()) Suit.Label("Info", {font = largeFont}, Suit.layout:row()) Suit.Label("Mikhail Adamenko, 2018, mikhail.adamenko@protonmail.com", {font = mediumFont, align = "center"}, Suit.layout:row()) if Suit.Button("Back to menu", {font = mediumFont}, Suit.layout:row(200, 40)).hit then gotoRoom("Menu") end end function About:draw() love.graphics.setBackgroundColor(1, 1, 1) end function About:resize() -- do nothing end function About:destroy() self.area:destroy() end
--[[ * Natural Selection 2 - Combat++ Mod * Authors: * WhiteWizard * * Hooks the base game files with the new Combat++ files. ]] ModLoader.SetupFileHook( "lua/NS2Gamerules.lua", "lua/CPPGameRules.lua", "post" ) ModLoader.SetupFileHook( "lua/Balance.lua", "lua/CPPBalance.lua", "post" ) ModLoader.SetupFileHook( "lua/Globals.lua", "lua/CPPGlobals.lua", "post" ) ModLoader.SetupFileHook( "lua/ClientUI.lua", "lua/CPPClientUI.lua", "post" ) ModLoader.SetupFileHook( "lua/Hud/Commander/GhostModel.lua", "lua/Hud/Commander/CPPGhostModel.lua", "post" ) ModLoader.SetupFileHook( "lua/Hud/Marine/GUIMarineHUD.lua", "lua/Hud/Marine/CPPGUIMarineHud.lua", "post" ) ModLoader.SetupFileHook( "lua/GUIAlienHUD.lua", "lua/CPPGUIAlienHUD.lua", "post" ) ModLoader.SetupFileHook( "lua/GUINotifications.lua", "lua/CPPGUINotifications.lua", "post" ) ModLoader.SetupFileHook( "lua/GUIWorldText.lua", "lua/CPPGUIWorldText.lua", "post" ) ModLoader.SetupFileHook( "lua/Player.lua", "lua/CPPPlayer.lua", "post" ) ModLoader.SetupFileHook( "lua/Player_Server.lua", "lua/CPPPlayer_Server.lua", "post" ) ModLoader.SetupFileHook( "lua/Player_Client.lua", "lua/CPPPlayer_Client.lua", "post" ) ModLoader.SetupFileHook( "lua/Marine.lua", "lua/CPPMarine.lua", "post" ) ModLoader.SetupFileHook( "lua/Marine_Client.lua", "lua/CPPMarine_Client.lua", "post" ) ModLoader.SetupFileHook( "lua/Marine_Server.lua", "lua/CPPMarine_Server.lua", "post" ) ModLoader.SetupFileHook( "lua/Exo.lua", "lua/CPPExo.lua", "post" ) ModLoader.SetupFileHook( "lua/Alien_Client.lua", "lua/CPPAlien_Client.lua", "post" ) ModLoader.SetupFileHook( "lua/MarineActionFinderMixin.lua", "lua/CPPMarineActionFinderMixin.lua", "post" ) ModLoader.SetupFileHook( "lua/Hud/Marine/GUIMarineHUD.lua", "lua/CPPGUIMarineHud.lua", "post" ) ModLoader.SetupFileHook( "lua/TechPoint_Server.lua", "lua/CPPTechPoint_Server.lua", "post" ) ModLoader.SetupFileHook( "lua/Armory_Client.lua", "lua/CPPArmory_Client.lua", "post" ) ModLoader.SetupFileHook( "lua/PowerPoint.lua", "lua/CPPPowerPoint.lua", "post" ) ModLoader.SetupFileHook( "lua/Sentry.lua", "lua/CPPSentry.lua", "post" ) ModLoader.SetupFileHook( "lua/CommandStructure.lua", "lua/CPPCommandStructure.lua", "post" ) ModLoader.SetupFileHook( "lua/CommandStructure_Server.lua", "lua/CPPCommandStructure_Server.lua", "post" ) ModLoader.SetupFileHook( "lua/Hive.lua", "lua/CPPHive.lua", "post" ) ModLoader.SetupFileHook( "lua/Hive_Server.lua", "lua/CPPHive_Server.lua", "post" ) ModLoader.SetupFileHook( "lua/PlayingTeam.lua", "lua/CPPPlayingTeam.lua", "post" ) ModLoader.SetupFileHook( "lua/MarineTeam.lua", "lua/CPPMarineTeam.lua", "post" ) ModLoader.SetupFileHook( "lua/AlienTeam.lua", "lua/CPPAlienTeam.lua", "post" ) ModLoader.SetupFileHook( "lua/ScoringMixin.lua", "lua/CPPScoringMixin.lua", "post" ) ModLoader.SetupFileHook( "lua/PointGiverMixin.lua", "lua/CPPPointGiverMixin.lua", "post" ) ModLoader.SetupFileHook( "lua/WeldableMixin.lua", "lua/CPPWeldableMixin.lua", "post" ) ModLoader.SetupFileHook( "lua/Weapons/Marine/Builder.lua", "lua/Weapon/Marine/CPPBuilder.lua", "post" ) ModLoader.SetupFileHook( "lua/CommAbilities/Marine/Scan.lua", "lua/Abilities/CPPScan.lua", "post" ) ModLoader.SetupFileHook( "lua/NetworkMessages.lua", "lua/CPPNetworkMessages.lua", "post" ) ModLoader.SetupFileHook( "lua/NetworkMessages_Client.lua", "lua/CPPNetworkMessages_Client.lua", "post" ) ModLoader.SetupFileHook( "lua/NetworkMessages_Server.lua", "lua/CPPNetworkMessages_Server.lua", "post" )
--[[ @Class Database - Database management ---- Functions ------ CDatabase:excec(sQuery [, ...args]) Excecutes a Query without any result or callback. Use for one-way Querys. CDatabase:query(sQuery [, ...args]) Excecutes a SQL-Query. You will get a Table as result. ]] CDatabase = {} function CDatabase:constructor(sType, sHost, sUser, sPass, sDBName, iPort) self.sType = sType self.sHost = sHost self.sUser = sUser self.sPass = sPass self.sDBName = sDBName self.iPort = iPort if (self.sType == "mysql") then self.hCon = dbConnect(self.sType, "dbname="..self.sDBName..";host="..self.sHost..";port="..iPort, self.sUser, self.sPass) if ((self.hCon ~= false) and (self.hCon)) then outputServerLog("Datenbankverbindung hergestellt!") self.tStundenTimer = bind(CDatabase.stundenTimer, self) else outputServerLog("Datenbankverbindung konnte nicht hergestellt werden!") stopResource(getThisResource()) end else outputServerLog("Please add specific Database Connection!") stopResource(getThisResource()) end end function CDatabase:destructor() self.sType = nil self.sHost = nil self.sUser = nil self.sPass = nil self.sDBName = nil self.iPort = nil destroyElement(self.hCon) end function CDatabase:query(sQuery, ...) local qHandler = dbQuery(self.hCon,sQuery, ...) local result, iRows, sError = dbPoll ( qHandler, 20) if (result == nil) then local result, iRows, sError = dbPoll ( qHandler, 60) if(result == nil) then dbFree(qHandler) return false end end if (result == false) then outputDebugString("Error Excecuting Query: "..sQuery.." ||"..iRows.."| "..sError) return false end return result, iRows end function CDatabase:exec(sQuery, ...) return dbExec(self.hCon, sQuery, ...) end function CDatabase:savePlayer(thePlayer) thePlayer:save() end function CDatabase:saveAllPlayers() local players = getElementsByType("player") if (#players > 0) then for i,thePlayer in ipairs(players) do if (thePlayer.LoggedIn == true) then thePlayer:save() end end end end function CDatabase:stundenTimer() saveAllPlayers() end DB = new(CDatabase,"mysql", "127.0.0.1", "root", "", "accountsystem", 3306)
-- CONTINUOUSLY AWAIT USER INPUT AND PLACE IN TABLE while true do table.insert(state.user_input, read()) end
if AkDebugLoad then print("Loading ak.data.TrainDetection ...") end local TrainRegistry = require("ak.train.TrainRegistry") local RuntimeRegistry = require("ak.util.RuntimeRegistry") local TrackDetection = require("ak.data.TrackDetection") local RollingStockRegistry = require("ak.train.RollingStockRegistry") local TrainDetection = {} TrainDetection.debug = AkStartWithDebug or false -- trackCollectors will dectect trains by using their RegisteredFunctions local trackTypes = {"auxiliary", "control", "road", "rail", "tram"} ---@type table<string, TrackDetection> local trackCollectors = {} do for _, trackType in ipairs(trackTypes) do trackCollectors[trackType] = TrackDetection:new(trackType) end end ---@type table<string, boolean> local movedTrainNames = {} ---@type table<string, boolean> local dirtyTrainNames = {} local function removeTrain(trainName) TrainRegistry.trainDisappeared(trainName) for _, rsName in pairs(TrainRegistry.allRollingStockNamesOf(trainName)) do local ok = EEPRollingstockGetTrainName(rsName) if not ok then RollingStockRegistry.rollingStockDisappeared(rsName) end end end ---Fills the trackinformation from a train ---@param train Train ---@param info TrainUpdateInfo local function fillTrackInfoFromTrain(train, info) local firstRollingStock = TrainRegistry.rollingStockNameInTrain(train.name, 0) local ok, trackId, _, _, trackTypeId = EEPRollingstockGetTrack(firstRollingStock) assert(ok, "Rollingstock not found: " .. firstRollingStock) local trackType = "control" if trackTypeId == 1 then trackType = "rail" end if trackTypeId == 2 then trackType = "tram" end if trackTypeId == 3 then trackType = "road" end if trackTypeId == 4 then trackType = "auxiliary" end info.tracks = {[tostring(trackId)] = trackId} info.trackType = trackType if (TrainDetection.debug) then print("ZUG GEFUNDEN: " .. trackType .. " -> " .. trackTypeId) end end ---This will register callbacks to get informed, e.g. if a train has been coupled or lost coupling function TrainDetection.registerForTrainDetection() -- React to train changes from EEP local _EEPOnTrainCoupling = EEPOnTrainCoupling or function() -- EEP 14 Plug-In 1 end EEPOnTrainCoupling = function(trainA, trainB, trainNew) -- Mark these trains as dirty, i.e. refresh their data dirtyTrainNames[trainA] = true dirtyTrainNames[trainB] = true dirtyTrainNames[trainNew] = true if TrainDetection.debug then print(string.format("%s and %s were coupled to %s", trainA, trainB, trainNew)) end -- Call the original function return _EEPOnTrainCoupling(trainA, trainB, trainNew) end local _EEPOnTrainLooseCoupling = EEPOnTrainLooseCoupling or function() -- EEP 14 Plug-In 1 end EEPOnTrainLooseCoupling = function(trainA, trainB, trainOld) -- Mark these trains as dirty, i.e. refresh their data dirtyTrainNames[trainA] = true dirtyTrainNames[trainB] = true dirtyTrainNames[trainOld] = true if TrainDetection.debug then print(string.format("%s lost coupling and got to %s and %s", trainOld, trainA, trainB)) end -- Call the original function return _EEPOnTrainLooseCoupling(trainA, trainB, trainOld) end local _EEPOnTrainExitTrainyard = EEPOnTrainExitTrainyard or function() -- EEP 14 Plug-In 1 end EEPOnTrainExitTrainyard = function(depotId, trainName) movedTrainNames[trainName] = true return _EEPOnTrainExitTrainyard(depotId, trainName) end end ---Update all the given trains by their name ---@param allKnownTrains table<string, TrainUpdateInfo> function TrainDetection.refreshTrainInfos(allKnownTrains) assert(type(allKnownTrains) == "table", "Need allKnownTrains as table") for trainName, info in pairs(allKnownTrains) do if TrainDetection.debug then print(string.format("Updating %s", trainName)) end ---@type Train local train = TrainRegistry.forName(trainName) if info.dirty or info.moved or info.created then if info.dirty then TrainRegistry.initRollingStock(train) end if not train:getTrackType() and not info.tracks or not info.trackType then fillTrackInfoFromTrain(train, info) end local start1 = os.clock() train:setSpeed(info.speed); train:setOnTrack(info.tracks) train:setTrackType(info.trackType) RuntimeRegistry.storeRunTime("updateTrain-dynamic+static", os.clock() - start1) local start2 = os.clock() -- set rollingStockData for positionInTrain = 0, train:getRollingStockCount() - 1, 1 do local rs = RollingStockRegistry.forName(TrainRegistry.rollingStockNameInTrain(train.name, positionInTrain)) if info.dirty then rs:setPositionInTrain(positionInTrain) rs:setTrainName(train.name) rs:setTrackType(train.trackType) end if info.dirty or info.moved then local _, trackId, trackDistance, trackDirection, trackSystem = EEPRollingstockGetTrack( rs.rollingStockName) -- EEP 14.2 local rollingStockMoved = trackId ~= rs:getTrackId() or trackDistance ~= rs:getTrackDistance() rs:setTrack(trackId, trackDistance, trackDirection, trackSystem) if rollingStockMoved then local hasPos, PosX, PosY, PosZ = EEPRollingstockGetPosition(rs.rollingStockName) -- EEP 16.1 local hasMileage, mileage = EEPRollingstockGetMileage(rs.rollingStockName) -- EEP 16.1 if hasPos then rs:setPosition(hasPos and tonumber(PosX) or -1, hasPos and tonumber(PosY) or -1, hasPos and tonumber(PosZ) or -1) end if hasMileage then rs:setMileage(mileage) end end end end RuntimeRegistry.storeRunTime("updateRollingStock", os.clock() - start2) else RuntimeRegistry.storeRunTime("updateTrain-skipped", 0) end end end ---Combine all information about given detected trains ---@param detected table<string, boolean> map of trainName -> boolean ---@param dirtyTrains table<string, boolean> map of trainName -> boolean ---@param movedTrains table<string, boolean> map of trainName -> boolean ---@param trainTracks table<string,table<string,table<string,number>>> map of trackType -> trainName -> trackId -> nr ---@return table<string, TrainUpdateInfo> function TrainDetection.trainInfosForAllTrains(detected, dirtyTrains, movedTrains, trainTracks) assert(type(detected) == "table", "Need detected as table") assert(type(dirtyTrains) == "table", "Need dirtyTrains as table") assert(type(movedTrains) == "table", "Need movedTrains as table") assert(type(trainTracks) == "table", "Need trainTracks as table") ---@type table<string, TrainUpdateInfo> local currentTrainInfos = {} local _ = trainTracks -- Check train speed and add train to moved or dirty list for trainName in pairs(detected) do local trainOnMap, speed = EEPGetTrainSpeed(trainName) -- EEP 11.0 if trainOnMap then local train, created = TrainRegistry.forName(trainName) local dirty = created or (dirtyTrains[trainName] and true or false) local moved = created or dirty or train:getSpeed() ~= 0 or speed ~= 0 or (movedTrains[trainName] and true or false) ---@class TrainUpdateInfo ---@field name string ---@field trackType string ---@field tracks table<string,number> ---@field speed number ---@field dirty boolean ---@field created boolean ---@field moved boolean local info = {name = trainName, speed = speed, created = created, dirty = dirty, moved = moved} currentTrainInfos[trainName] = info if created then TrainRegistry.trainAppeared(train) end else removeTrain(trainName) end end -- Add tracktype and tracks to knownTrains for trackType, tt in pairs(trainTracks) do for trainName, tracks in pairs(tt) do local info = currentTrainInfos[trainName] if info then info.tracks = tracks info.trackType = trackType end end end return currentTrainInfos end TrainDetection.registerForTrainDetection() ---Called once for initialization function TrainDetection.initialize() -- init once for _, trackDetection in pairs(trackCollectors) do trackDetection:initialize() end end ---Called after initialization and in each data detection cycle function TrainDetection.update() local time = os.clock() ---@type table<string, boolean> local dirty = dirtyTrainNames local moved = movedTrainNames local detected = {} local trainTracks = {} for trainName in pairs(TrainRegistry.getAllTrainNames()) do detected[trainName] = true end for trainName in pairs(dirty) do detected[trainName] = true end for trainName in pairs(moved) do detected[trainName] = true end for trackType, trackDetection in pairs(trackCollectors) do local trainsOnTracks = trackDetection:findTrainsOnTrack() for trainName in pairs(trainsOnTracks) do detected[trainName] = true end trainTracks[trackType] = trainsOnTracks end RuntimeRegistry.storeRunTime("TrainDetection.findTrainsOnTrack", os.clock() - time) -- Gather all information for the detected train names time = os.clock() local allKnownTrains = TrainDetection.trainInfosForAllTrains(detected, dirty, moved, trainTracks); RuntimeRegistry.storeRunTime("TrainDetection.trainInfosForAllTrains", os.clock() - time) -- Update all known trains by their information time = os.clock() TrainDetection.refreshTrainInfos(allKnownTrains); RuntimeRegistry.storeRunTime("TrainDetection.updateKnownTrains", os.clock() - time) -- Wipe all moved and dirty trains before for the next update dirtyTrainNames = {} movedTrainNames = {} end return TrainDetection
-- -- Created by IntelliJ IDEA. Copyright (C) 2017 Hanks -- User: hanks -- Date: 2017/5/12 -- Time: 13:59 -- return { RelativeLayout, layout_width="fill", { TextView, id="tv_left", layout_width=100, textSize="20sp", textColor="#0000ff", text="left", background="#22ff0000" }, { TextView, id="tv_right", layout_width=100, text="right", background="#2200ff00", layout_alignParentRight=true }, { LinearLayout, layout_width="fill", layout_height="wrap", orientation="vertical", layout_toRightOf="tv_left", layout_toLeftOf="tv_right", { Button, id="btn_1", layout_width="fill", text="按钮1", }, { Button, layout_width="fill", text="按钮2", background="#220000ff", }, { ProgressBar, }, { TextView, text = "用户名" }, { EditText, id = "luaPath", textSize="12sp", hint = "手机号/邮箱", layout_width = "fill", singleLine = true }, { TextView, text = "密码" }, { EditText, id = "packageName", hint="6-20位数字或字母", layout_width = "fill", singleLine = true, textSize="12sp", inputType="textPassword" }, { TextView, text = "程序名称" }, { EditText, id = "appName", textSize="12sp", layout_width = "fill", singleLine = true }, } }
-- Lua implement of MySpp local chr = string.char local rep = string.rep local find = string.find local format = string.format local insert = table.insert local reverse = string.reverse local itos = tostring local lower = string.lower local now = os.time local ord = string.byte local remove = table.remove local rename = os.rename local replace = string.gsub local substr = string.sub local toint = tonumber local tostr = table.concat local upper = string.upper local FOF = chr(0) local EIN = chr(1) local OUT = chr(2) local QSTR = chr(3) local FAIL = chr(0) local PASS = chr(1) function error(x) print(x); os.exit() end function osargs() local osArgs = {} for i, v in pairs(arg) do if i > 0 then insert(osArgs, v) end end return osArgs end function readline() return io.read("*l") end function first(x) return substr(x,1,1) end function second(x) return substr(x,2,2) end function tochar(hexstr) return chr(tonumber("0x" .. hexstr)) end function tail(x) return substr(x, #x) end function rest(x) return substr(x, 2) end function include(_str,_char) if find(_str,_char,1,true) == nil then return false end return true end function trim(_str) local _lstr = replace(_str, "^%s+", '') return replace(_lstr, "%s+$", '') end function charat(_str, _at) local off = _at + 1 return substr(_str, off, off) end function arrayat(_arr, _at) local off = _at + 1 return _arr[off] end function chars(_str) local _chars = {} for i=1, #_str do local _char = substr(_str,i,i) insert(_chars, _char) end return _chars end function split(_str,_sep) local _strs = {} local _chars = {} for _, _char in ipairs(chars(_str)) do if _char == _sep then insert(_strs, tostr(_chars)) _chars = {} else insert(_chars, _char) end end insert(_strs, tostr(_chars)) return _strs end function join(_table,_sep) return table.concat(_table, _sep) end function startwith(_str, _sub_str) local _len = #_sub_str if substr(_str, 0, _len) == _sub_str then return true end return false end function endwith(_str,_end) local r_str = reverse(_str) local r_end = reverse(_end) return startwith(r_str,r_end) end function map(_arr,_fn) local _map_arr = {} for _, _value in ipairs(_arr) do insert(_map_arr, _fn(_value)) end return _map_arr end function restat(x,i) return substr(x,i+1) end function chop(s) return substr(s,1,-2) end function cut(s) return substr(s,2,-2) end function isin(_elem, _arr) for _, v in ipairs(_arr) do if v == _elem then return true end end return false end function restStrs(x) local rest_t = {} for i=2, #x do insert(rest_t, x[i]) end return rest_t end function shift(_arr) return remove(_arr,1) end function has(_hash, _key) if _hash[_key] == nil then return false end return true end function toend(_str) if #_str < 50 then return _str end return substr(_str,0,50) end function getline(_str, _off) local _s = substr(_str,0,_off) local count = 0 for _, ch in ipairs(chars(_s)) do if ch == "\n" then count = count + 1 end end return itos(count) end function flat(_arr) return table.unpack(_arr) end function readfile(fname) local fh = assert(io.open(fname, 'r')) local my_text = fh:read('*all') fh:close() return my_text end function writefile(fname, text) local fh = assert(io.open(fname, 'w')) fh:write(text) fh:flush() fh:close() end function copy(from_file,to_file) writefile(to_file,readfile(from_file)) end function isfile(_file) local f = io.open(_file,"r") if f == nil then return false end io.close(f) return true end function isupper(sc) if sc >= 'A' then if sc <= 'Z' then return true end end return false end function isvspace(sc) if sc == '\n' then return true end if sc == '\r' then return true end return false end function ishspace(sc) if sc == ' ' then return true end if sc == '\t' then return true end return false end function isspace(sc) if isvspace(sc) then return true end if ishspace(sc) then return true end return false end function isdigit(sc) if sc < '0' then return false end if sc > '9' then return false end return true end function islower(sc) if sc >= 'a' then if sc <= 'z' then return true end end return false end function isalpha(sc) if islower(sc) then return true end if isupper(sc) then return true end return false end function iswords(sc) if isalpha(sc) then return true end if isdigit(sc) then return true end if sc == '-' then return true end if sc == '_' then return true end return false end function isxdigit(sc) if isdigit(sc) then return true end if sc >= 'A' then if sc <= 'F' then return true end end if sc >= 'a' then if sc <= 'f' then return true end end return false end function isodigit(sc) if sc < '0' then return false end if sc > '7' then return false end return true end
Game = {} function Game.EndIf() Output("}") end local function AddCommand(Command) assert(#Command >= 3, "A command table must have at least Name, Min Args and Max Args.") local Name = Command[1] local MinArgs = Command[2] local MaxArgs = Command[3] local Conditional = Command[4] Game[Name] = function(...) local args = {...} assert(#args >= MinArgs, Name .. " requires at least " .. MinArgs .. " arguments.") assert(#args <= MaxArgs, Name .. " has a maximum of " .. MaxArgs .. " arguments.") Output(Name) Output("(") if #args > 0 then Output("\"") Output(table.concat(args, "\",\"")) Output("\"") end Output(")") Output(Conditional and "{" or ";") end end -- { "CommandName", MinArgs, MaxArgs } OR { "CommandName", MinArgs, MaxArgs, Conditional } local DefaultCommands = { { "ActivateTrigger", 1, 1 }, { "ActivateVehicle", 3, 4 }, { "AddAmbientCharacter", 2, 3 }, { "AddAmbientNPCWaypoint", 2, 2 }, { "AddAmbientNpcAnimation", 1, 2 }, { "AddAmbientPcAnimation", 1, 2 }, { "AddBehaviour", 2, 7 }, { "AddBonusMission", 1, 1 }, { "AddBonusMissionNPCWaypoint", 2, 2 }, { "AddBonusObjective", 1, 2 }, { "AddCharacter", 2, 2 }, { "AddCollectible", 1, 4 }, { "AddCollectibleStateProp", 3, 3 }, { "AddCondition", 1, 2 }, { "AddDriver", 2, 2 }, { "AddFlyingActor", 5, 5 }, { "AddFlyingActorByLocator", 3, 4 }, { "AddGagBinding", 5, 5 }, { "AddGlobalProp", 1, 1 }, { "AddMission", 1, 1 }, { "AddNPC", 2, 3 }, { "AddNPCCharacterBonusMission", 7, 8 }, { "AddObjective", 1, 3 }, { "AddObjectiveNPCWaypoint", 2, 2 }, { "AddPed", 2, 2 }, { "AddPurchaseCarNPCWaypoint", 2, 2 }, { "AddPurchaseCarReward", 5, 6 }, { "AddSafeZone", 2, 2 }, { "AddShield", 2, 2 }, { "AddSpawnPoint", 8, 8 }, { "AddSpawnPointByLocatorScript", 6, 6 }, { "AddStage", 0, 7 }, { "AddStageCharacter", 3, 5 }, { "AddStageMusicChange", 0, 0 }, { "AddStageTime", 1, 1 }, { "AddStageVehicle", 3, 5 }, { "AddStageWaypoint", 1, 1 }, { "AddTeleportDest", 3, 5 }, { "AddToCountdownSequence", 1, 2 }, { "AddTrafficModel", 2, 3 }, { "AddVehicleSelectInfo", 3, 3 }, { "AllowMissionAbort", 1, 1 }, { "AllowRockOut", 0, 0 }, { "AllowUserDump", 0, 0 }, { "AmbientAnimationRandomize", 2, 2 }, { "AttachStatePropCollectible", 2, 2 }, { "BindCollectibleTo", 2, 2 }, { "BindReward", 5, 7 }, { "CharacterIsChild", 1, 1 }, { "ClearAmbientAnimations", 1, 1 }, { "ClearGagBindings", 0, 0 }, { "ClearTrafficForStage", 0, 0 }, { "ClearVehicleSelectInfo", 0, 0 }, { "CloseCondition", 0, 0 }, { "CloseMission", 0, 0 }, { "CloseObjective", 0, 0 }, { "ClosePedGroup", 0, 0 }, { "CloseStage", 0, 0 }, { "CloseTrafficGroup", 0, 0 }, { "CreateActionEventTrigger", 5, 5 }, { "CreateAnimPhysObject", 2, 2 }, { "CreateChaseManager", 3, 3 }, { "CreatePedGroup", 1, 1 }, { "CreateTrafficGroup", 1, 1 }, { "DeactivateTrigger", 1, 1 }, { "DebugBreak", 0, 0 }, { "DisableHitAndRun", 0, 0 }, { "EnableHitAndRun", 0, 0 }, { "EnableTutorialMode", 1, 1 }, { "GagBegin", 1, 1 }, { "GagCheckCollCards", 5, 5 }, { "GagCheckMovie", 4, 4 }, { "GagEnd", 0, 0 }, { "GagPlayFMV", 1, 1 }, { "GagSetAnimCollision", 1, 1 }, { "GagSetCameraShake", 2, 3 }, { "GagSetCoins", 1, 2 }, { "GagSetCycle", 1, 1 }, { "GagSetInterior", 1, 1 }, { "GagSetIntro", 1, 1 }, { "GagSetLoadDistances", 2, 2 }, { "GagSetOutro", 1, 1 }, { "GagSetPersist", 1, 1 }, { "GagSetPosition", 1, 3 }, { "GagSetRandom", 1, 1 }, { "GagSetSound", 1, 1 }, { "GagSetSoundLoadDistances", 2, 2 }, { "GagSetSparkle", 1, 1 }, { "GagSetTrigger", 3, 5 }, { "GagSetWeight", 1, 1 }, { "GoToPsScreenWhenDone", 0, 0 }, { "InitLevelPlayerVehicle", 3, 4 }, { "KillAllChaseAI", 1, 1 }, { "LinkActionToObject", 5, 5 }, { "LinkActionToObjectJoint", 5, 5 }, { "LoadDisposableCar", 3, 3 }, { "LoadP3DFile", 1, 3 }, { "LucasTest", 0, 16 }, { "MoveStageVehicle", 3, 3 }, { "MustActionTrigger", 0, 0 }, { "NoTrafficForStage", 0, 0 }, { "PlacePlayerAtLocatorName", 1, 1 }, { "PlacePlayerCar", 2, 2 }, { "PreallocateActors", 2, 2 }, { "PutMFPlayerInCar", 0, 0 }, { "RESET_TO_HERE", 0, 0 }, { "RemoveDriver", 1, 1 }, { "RemoveNPC", 1, 1 }, { "ResetCharacter", 2, 2 }, { "ResetHitAndRun", 0, 0 }, { "SelectMission", 1, 1 }, { "SetActorRotationSpeed", 2, 2 }, { "SetAllowSeatSlide", 1, 1 }, { "SetAnimCamMulticontName", 1, 1 }, { "SetAnimatedCameraName", 1, 1 }, { "SetBonusMissionDialoguePos", 3, 4 }, { "SetBonusMissionStart", 0, 0 }, { "SetBrakeScale", 1, 1 }, { "SetBurnoutRange", 1, 1 }, { "SetCMOffsetX", 1, 1 }, { "SetCMOffsetY", 1, 1 }, { "SetCMOffsetZ", 1, 1 }, { "SetCamBestSide", 1, 2 }, { "SetCarAttributes", 5, 5 }, { "SetCarStartCamera", 1, 1 }, { "SetCharacterPosition", 3, 3 }, { "SetCharacterScale", 1, 1 }, { "SetCharacterToHide", 1, 1 }, { "SetCharactersVisible", 1, 1 }, { "SetChaseSpawnRate", 2, 2 }, { "SetCoinDrawable", 1, 1 }, { "SetCoinFee", 1, 1 }, { "SetCollectibleEffect", 1, 1 }, { "SetCollisionAttributes", 4, 4 }, { "SetCompletionDialog", 1, 2 }, { "SetCondMinHealth", 1, 1 }, { "SetCondTargetVehicle", 1, 1 }, { "SetCondTime", 1, 1 }, { "SetConditionPosition", 1, 1 }, { "SetConversationCam", 2, 3 }, { "SetConversationCamDistance", 2, 2 }, { "SetConversationCamName", 1, 1 }, { "SetConversationCamNpcName", 1, 1 }, { "SetConversationCamPcName", 1, 1 }, { "SetDamperC", 1, 1 }, { "SetDemoLoopTime", 1, 1 }, { "SetDestination", 1, 3 }, { "SetDialogueInfo", 4, 4 }, { "SetDialoguePositions", 2, 4 }, { "SetDonutTorque", 1, 1 }, { "SetDriver", 1, 1 }, { "SetDurationTime", 1, 1 }, { "SetDynaLoadData", 1, 2 }, { "SetEBrakeEffect", 1, 1 }, { "SetFMVInfo", 1, 2 }, { "SetFadeOut", 1, 1 }, { "SetFollowDistances", 2, 2 }, { "SetForcedCar", 0, 0 }, { "SetGamblingOdds", 1, 1 }, { "SetGameOver", 0, 0 }, { "SetGasScale", 1, 1 }, { "SetGasScaleSpeedThreshold", 1, 1 }, { "SetHUDIcon", 1, 1 }, { "SetHasDoors", 1, 1 }, { "SetHighRoof", 1, 1 }, { "SetHighSpeedGasScale", 1, 1 }, { "SetHighSpeedSteeringDrop", 1, 1 }, { "SetHitAndRunDecay", 1, 1 }, { "SetHitAndRunDecayInterior", 1, 1 }, { "SetHitAndRunMeter", 1, 1 }, { "SetHitNRun", 0, 0 }, { "SetHitPoints", 1, 1 }, { "SetInitialWalk", 1, 1 }, { "SetIrisTransition", 1, 1 }, { "SetIrisWipe", 1, 1 }, { "SetLevelOver", 0, 0 }, { "SetMass", 1, 1 }, { "SetMaxSpeedBurstTime", 1, 1 }, { "SetMaxTraffic", 1, 1 }, { "SetMaxWheelTurnAngle", 1, 1 }, { "SetMissionNameIndex", 1, 1 }, { "SetMissionResetPlayerInCar", 1, 1 }, { "SetMissionResetPlayerOutCar", 2, 2 }, { "SetMissionStartCameraName", 1, 1 }, { "SetMissionStartMulticontName", 1, 1 }, { "SetMusicState", 2, 2 }, { "SetNormalSteering", 1, 1 }, { "SetNumChaseCars", 1, 1 }, { "SetNumValidFailureHints", 1, 1 }, { "SetObjDistance", 1, 1 }, { "SetObjTargetBoss", 1, 1 }, { "SetObjTargetVehicle", 1, 1 }, { "SetParTime", 1, 1 }, { "SetParticleTexture", 2, 2 }, { "SetPickupTarget", 1, 1 }, { "SetPlayerCarName", 2, 2 }, { "SetPostLevelFMV", 1, 1 }, { "SetPresentationBitmap", 1, 1 }, { "SetProjectileStats", 3, 3 }, { "SetRaceEnteryFee", 1, 1 }, { "SetRaceLaps", 1, 1 }, { "SetRespawnRate", 2, 2 }, { "SetShadowAdjustments", 8, 8 }, { "SetShininess", 1, 1 }, { "SetSlipEffectNoEBrake", 1, 1 }, { "SetSlipGasScale", 1, 1 }, { "SetSlipSteering", 1, 1 }, { "SetSlipSteeringNoEBrake", 1, 1 }, { "SetSpringK", 1, 1 }, { "SetStageAIEvadeCatchupParams", 3, 3 }, { "SetStageAIRaceCatchupParams", 5, 5 }, { "SetStageAITargetCatchupParams", 3, 3 }, { "SetStageCamera", 3, 3 }, { "SetStageMessageIndex", 1, 2 }, { "SetStageMusicAlwaysOn", 0, 0 }, { "SetStageTime", 1, 1 }, { "SetStatepropShadow", 2, 2 }, { "SetSuspensionLimit", 1, 1 }, { "SetSuspensionYOffset", 1, 1 }, { "SetSwapDefaultCarLocator", 1, 1 }, { "SetSwapForcedCarLocator", 1, 1 }, { "SetSwapPlayerLocator", 1, 1 }, { "SetTalkToTarget", 1, 4 }, { "SetTireGrip", 1, 1 }, { "SetTopSpeedKmh", 1, 1 }, { "SetTotalGags", 2, 2 }, { "SetTotalWasps", 2, 2 }, { "SetVehicleAIParams", 3, 3 }, { "SetVehicleToLoad", 3, 3 }, { "SetWeebleOffset", 1, 1 }, { "SetWheelieOffsetY", 1, 1 }, { "SetWheelieOffsetZ", 1, 1 }, { "SetWheelieRange", 1, 1 }, { "ShowHUD", 1, 1 }, { "ShowStageComplete", 0, 0 }, { "Sleep", 1, 1 }, { "StageStartMusicEvent", 1, 1 }, { "StartCountdown", 1, 2 }, { "StayInBlack", 0, 0 }, { "StreetRacePropsLoad", 1, 1 }, { "StreetRacePropsUnload", 1, 1 }, { "SuppressDriver", 1, 1 }, { "SwapInDefaultCar", 0, 0 }, { "TaskMessage", 3, 4 }, { "TurnGotoDialogOff", 0, 0 }, { "UseElapsedTime", 0, 0 }, { "UsePedGroup", 1, 1 }, { "msPlacePlayerCarAtLocatorName", 1, 1 }, } local ASFCommands = { { "AddCondTargetModel", 1, 1 }, { "AddObjTargetModel", 1, 1 }, { "AddParkedCar", 1, 1 }, { "AddStageVehicleCharacter", 2, 4 }, { "AddVehicleCharacter", 1, 3 }, { "AddVehicleCharacterSuppressionCharacter", 2, 2 }, { "CHECKPOINT_HERE", 0, 0 }, { "DisableTrigger", 1, 1 }, { "IfCurrentCheckpoint", 0, 0, true }, { "RemoveStageVehicleCharacter", 2, 2 }, { "ResetStageHitAndRun", 0, 0 }, { "ResetStageVehicleAbductable", 1, 1 }, { "SetCarChangeHitAndRunChange", 1, 1 }, { "SetCheckpointDynaLoadData", 1, 2 }, { "SetCheckpointPedGroup", 1, 1 }, { "SetCheckpointResetPlayerInCar", 1, 1 }, { "SetCheckpointResetPlayerOutCar", 2, 2 }, { "SetCheckpointTrafficGroup", 1, 1 }, { "SetCollectibleSoundEffect", 1, 1 }, { "SetCondDecay", 1, 2 }, { "SetCondDelay", 1, 1 }, { "SetCondDisplay", 1, 1 }, { "SetCondMessageIndex", 1, 1 }, { "SetCondSound", 1, 4 }, { "SetCondSpeedRangeKMH", 2, 2 }, { "SetCondThreshold", 1, 1 }, { "SetCondTotal", 1, 1 }, { "SetCondTrigger", 1, 1 }, { "SetConditionalParameter", 3, 5 }, { "SetHUDMapDrawable", 1, 1 }, { "SetHitAndRunDecayHitAndRun", 1, 1 }, { "SetHitAndRunFine", 1, 1 }, { "SetNoHitAndRunMusicForStage", 0, 0 }, { "SetObjCameraName", 1, 1 }, { "SetObjCanSkip", 1, 1 }, { "SetObjDecay", 1, 2 }, { "SetObjExplosion", 2, 3 }, { "SetObjMessageIndex", 1, 1 }, { "SetObjMulticontName", 1, 1 }, { "SetObjNoLetterbox", 1, 1 }, { "SetObjSound", 1, 4 }, { "SetObjSpeedKMH", 1, 1 }, { "SetObjThreshold", 1, 1 }, { "SetObjTotal", 1, 1 }, { "SetObjTrigger", 1, 1 }, { "SetObjUseCameraPosition", 1, 1 }, { "SetParkedCarsEnabled", 1, 1 }, { "SetPedsEnabled", 1, 1 }, { "SetStageAllowMissionCancel", 1, 1 }, { "SetStageCarChangeHitAndRunChange", 1, 1 }, { "SetStageCharacterModel", 1, 2 }, { "SetStageHitAndRun", 1, 1 }, { "SetStageHitAndRunDecay", 1, 1 }, { "SetStageHitAndRunDecayHitAndRun", 1, 1 }, { "SetStageHitAndRunDecayInterior", 1, 1 }, { "SetStageHitAndRunFine", 1, 1 }, { "SetStageNumChaseCars", 1, 1 }, { "SetStagePayout", 1, 1 }, { "SetStageVehicleAbductable", 2, 2 }, { "SetStageVehicleAllowSeatSlide", 2, 2 }, { "SetStageVehicleCharacterAnimation", 3, 4 }, { "SetStageVehicleCharacterJumpOut", 2, 3 }, { "SetStageVehicleCharacterScale", 3, 3 }, { "SetStageVehicleCharacterVisible", 2, 2 }, { "SetStageVehicleNoDestroyedJumpOut", 1, 1 }, { "SetStageVehicleReset", 2, 2 }, { "SetVehicleCharacterAnimation", 2, 3 }, { "SetVehicleCharacterJumpOut", 1, 2 }, { "SetVehicleCharacterScale", 2, 2 }, { "SetVehicleCharacterVisible", 1, 1 }, { "SetWheelieOffsetX", 1, 1 }, { "UseTrafficGroup", 1, 1 }, } local StartTime = GetTime() for i=1,#DefaultCommands do AddCommand(DefaultCommands[i]) end local EndTime = GetTime() print("Game.lua", "Loaded " .. #DefaultCommands .. " default commands in " .. (EndTime - StartTime) * 1000 .. "ms.") if IsHackLoaded("AdditionalScriptFunctionality") then StartTime = GetTime() for i=1,#ASFCommands do AddCommand(ASFCommands[i]) end EndTime = GetTime() print("Game.lua", "Loaded " .. #ASFCommands .. " ASF commands in " .. (EndTime - StartTime) * 1000 .. "ms.") end return Game
-- * Metronome IM * -- -- This file is part of the Metronome XMPP server and is released under the -- ISC License, please see the LICENSE file in this source package for more -- information about copyright and licensing. module:depends("mam"); local http_event = require "net.http.server".fire_server_event; local ipairs, pairs, open, setmetatable, tonumber, tostring = ipairs, pairs, io.open, setmetatable, tonumber, tostring; local jid_join = require "util.jid".join; local urldecode = require "net.http".urldecode; local generate = require "util.auxiliary".generate_secret; local test_password = require "core.usermanager".test_password; local dt = require "util.datetime".datetime; module:depends("http"); authenticated_tokens = {}; params_cache = setmetatable({}, { __mode = "v" }); local hosts = metronome.hosts; local base_path = module:get_option_string("mam_browser_base", "mam"); local http_host = module:get_option_string("mam_browser_host"); if not base_path:match(".*/$") then base_path = base_path:gsub("^[/]+", "/") .. "/"; end base_url = module:http_url(nil, base_path:gsub("[^%w][/\\]+[^/\\]*$", "/"), http_host); local files_base = module.path:gsub("[/\\][^/\\]*$","") .. "/template/"; local valid_files = { ["css/style.css"] = files_base.."css/style.css", ["images/tile.png"] = files_base.."images/tile.png", ["images/header.png"] = files_base.."images/header.png" }; local mime_types = { css = "text/css", png = "image/png" }; -- Utility functions local function generate_secret() local secret = generate(18); if secret then return secret; else module:log("warn", "Failed to generate the authentication cookie"); return nil; end end local function open_file(file) local f, err = open(file, "rb"); if not f then return nil; end local data = f:read("*a"); f:close(); return data; end local function http_error_reply(event, code, message, headers) local response = event.response; if headers then for header, data in pairs(headers) do response.headers[header] = data; end end response.status_code = code; response:send(http_event("http-error", { code = code, message = message, response = response })); return true; end local form = { header = "<form action='%sbrowser' method='post' accept-charset='UTF-8' id='browser'>\n", options_label = " <div><label for='with_jid'>Select a recipient:</label><br /></div>\n", options_header = " <div><select name='with_jid'>\n", options_el = " <option value='%s'>%s</option>\n", options_el_selected = " <option value='%s' selected>%s</option>\n", options_fin = " </select></div>\n", index_label = " <div><label for='index'>Choose index (0 for start):</label><br /></div>\n", index_input = " <div><input type='number' name='index' id='index' value='%d' /></div>\n", search_label = " <div><label for='search'>Search for a specific word (Lua patterns are allowed):</label><br /></div>\n", search_input = " <div><input type='text' name='search' id='search' value='%s' /></div>\n", send_input = " <div><br /><input type='submit' id='get' value='Retrieve messages' class='btn' /></div>\n", fin = "</form>\n" }; local entry = "(%s) <strong>%s</strong> to <strong>%s</strong>: %s<br />\n"; local function r_template(event, type, params) local data = open_file(files_base..type..".html"); if data then local base = not base_path:find("^/") and "/" .. base_path or base_path; event.response.headers["Content-Type"] = "text/html"; if type == "login" then data = data:gsub("%%HOST", "<strong>"..module.host.."</strong>"); data = data:gsub("%%LOGIN%-URL", base); elseif type == "browser" then local logs_amount = #params.logs; data = data:gsub("%%CAPTION", logs_amount > 0 and "Please select the conversation recipient and the eventual message index" or "Archive is empty" ); data = data:gsub("%%LOGOUT%-URL", base.."logout"); if logs_amount > 0 then local index, last_jid, search = params.last.threshold or 0, params.last.with, params.last.search; if index < 0 then index = 0; end if search == "" then search = nil; elseif search ~= nil then search = search:gsub("%%", "%%%%"); end local str = form.header:format(base) .. form.options_label .. form.options_header; for jid in pairs(params.users) do str = str .. (params.last.with == jid and form.options_el_selected:format(jid, jid) or form.options_el:format(jid, jid)); end str = str .. form.options_fin .. form.index_label .. form.index_input:format(index) .. form.search_label .. form.search_input:format(search or "") .. form.send_input .. form.fin; data = data:gsub("%%FORM", str); if not last_jid then data = data:gsub("%%FL", ""); data = data:gsub("%%ENTRIES", ""); else local count, entries, last_body, last_id, trunked = 0, ""; for i, _entry in ipairs(params.logs) do local negate; if not _entry.body or (search and not _entry.body:find(search)) then negate = true; elseif last_body == _entry.body and last_id == _entry.id then negate = true; end if not negate and (_entry.bare_to == last_jid or _entry.bare_from == last_jid) then count = count + 1; if not trunked and count - index >= 301 then trunked = count - 1; end if not trunked and count >= index then entries = entries .. entry:format(dt(_entry.timestamp), _entry.from, _entry.to, _entry.body); end last_body, last_id = _entry.body, _entry.id; end end entries = entries:gsub("%%", "%%%%"); if entries == "" then data = data:gsub("%%FL", "No entries to show."); data = data:gsub("%%ENTRIES", ""); else data = data:gsub("%%FL", "Returning archive entries from " .. (index == 0 and "the beginning" or "message number "..tostring(index)) .. (not trunked and "" or " to message number "..tostring(trunked)) .. " (" .. tostring(count) .. " total messages)." ); data = data:gsub("%%ENTRIES", entries); end end end end return data; else return http_error_reply(event, 500, "Failed to obtain template."); end end local function http_file_get(event, path) if valid_files[path] then local data = open_file(valid_files[path]); if data then event.response.headers["Content-Type"] = mime_types[path:match("%.([^%.]*)$")]; return data; else return http_error_reply(event, 404, "Not found."); end end end local function redirect_to(event, path) event.response.headers["Cache-Control"] = "no-store"; event.response.headers["Location"] = "/" .. base_path .. (path or ""); return 302; end local function initialize_params_cache(user) local jid = jid_join(user, module.host); local archive = module:fire_event("mam-get-store", user); local params = { users = {}, logs = archive.logs, last = {}, myself = jid }; for i, entry in ipairs(archive.logs) do if entry.bare_from ~= jid and not params.users[entry.bare_from] then params.users[entry.bare_from] = true; end end params_cache[user] = params; return params; end -- HTTP Handlers local function handle_request(event, path) local request, response = event.request, event.response; local body = request.body; local ip = request.conn:ip(); if not request.secure and (path == "" or path == "browser") then return r_template(event, "unsecure"); end local cookie, token = request.headers.cookie; if cookie then token = cookie:match("^MAM_SESSID=([%w/%+]+[^;])"); end if request.method == "GET" then if path == "" then -- login if authenticated_tokens[token] then return redirect_to(event, "browser"); else return r_template(event, "login"); end elseif path == "logout" then -- logout if token then authenticated_tokens[token] = nil; response.headers["Set-Cookie"] = "MAM_SESSID="..token.."; Path=/"..base_path.."; Expires=Thu, 01 Jan 1970 00:00:00 GMT" end return redirect_to(event); elseif path == "browser" then -- browser if authenticated_tokens[token] then local username = authenticated_tokens[token]; local params = params_cache[username] or initialize_params_cache(username); return r_template(event, "browser", params); else return redirect_to(event); end else return http_file_get(event, path); end elseif request.method == "POST" then if path == "" then if not body then return http_error_reply(event, 400, "Bad Request."); end local username, password = body:match("^username=(.*)&password=(.*)$"); if username and password then username, password = urldecode(username), urldecode(password); if test_password(username, module.host, password) then local token = generate_secret(); if token then response.headers["Set-Cookie"] = "MAM_SESSID="..token.."; Path=/"..base_path.."; Max-Age=600; SameSite=Strict; Secure; HttpOnly" authenticated_tokens[token] = username; module:add_timer(600, function() authenticated_tokens[token] = nil; end); return redirect_to(event, "browser"); else return http_error_reply(event, 500, "Failed to generate cookie authentication token."); end else return r_template(event, "fail"); end else return http_error_reply(event, 400, "Invalid Request."); end elseif path == "browser" then if not body then return http_error_reply(event, 400, "Bad Request."); end local username = authenticated_tokens[token]; if username then local with_jid, threshold, search = body:match("^with_jid=(.*)&index=(.*)&search=(.*)$"); with_jid, threshold, search = urldecode(with_jid), urldecode(threshold), urldecode(search); threshold = tonumber(threshold); local params = params_cache[username] or initialize_params_cache(username); params.last.with, params.last.threshold, params.last.search = with_jid, threshold, search; return r_template(event, "browser", params); else return redirect_to(event); end end else return http_error_reply(event, 405, "Invalid method."); end end -- Set it up! module:provides("http", { default_path = base_path, route = { ["GET /*"] = handle_request, ["POST /*"] = handle_request } }); -- Reloadability module.save = function() return { authenticated_tokens = authenticated_tokens }; end module.restore = function(data) authenticated_tokens = data.authenticated_tokens or {}; end
--[[ GD50 Legend of Zelda Author: Colton Ogden cogden@cs50.harvard.edu ]] PlayerPotIdleState = Class{__includes = EntityIdleState} function PlayerPotIdleState:enter(params) print("Entering pot idle state") self.entity:changeAnimation('pot-idle-' .. self.entity.direction) -- render offset for spaced character sprite (negated in render function of state) self.entity.offsetY = 5 self.entity.offsetX = 0 self.entity.pot.x = self.entity.x self.entity.pot.y = self.entity.y - self.entity.pot.height + 5 end function PlayerPotIdleState:update(dt) if love.keyboard.isDown('left') or love.keyboard.isDown('right') or love.keyboard.isDown('up') or love.keyboard.isDown('down') then self.entity:changeState('pot-walk') end if love.keyboard.wasPressed('return') then throwPot(self.entity) end end
local naughty = require('naughty') local beautiful = require('beautiful') local battery = {} local function get_file(file) local f = io.open(file) if not f then return nil end local res = f:read() f:close() return res end function battery.get_widget(wibox, adapter) local battery_widget = wibox.widget.textbox() battery_widget:set_align("right") local function battery_info(adapter) local cur = get_file("/sys/class/power_supply/"..adapter.."/energy_now") local cap = get_file("/sys/class/power_supply/"..adapter.."/energy_full") local sta = get_file("/sys/class/power_supply/"..adapter.."/status") if not cur or not cap or not sta then return nil end local battery = math.floor(cur * 100 / cap) local function show_info(color, dir) battery_widget:set_markup('<span color="' .. color .. '">' .. ' Bat: ' .. dir .. battery .. '%' .. dir .. ' </span>') end if sta:match("Discharging") then if battery < 10 then naughty.notify { title = "Battery Warning" , text = "Battery low! " .. battery .. "% left!" , timeout = 5 , position = "top_right" , fg = beautiful.fg_focus , bg = beautiful.bg_focus } end show_info(battery < 15 and 'red' or 'orange', "↓") elseif sta:match("Charging") then show_info('lightgreen', "↑") else battery_widget:set_markup("") end end battery_info(adapter) local battery_timer = timer{timeout = 20} battery_timer:connect_signal("timeout", function() battery_info(adapter) end) battery_timer:start() return battery_widget end return battery
CVars.HumanSpeed = CreateConVar( "ze_human_speed", 250, {FCVAR_REPLICATED}, "Speed at which the humans move in units/sec." ) CVars.Ammo = CreateConVar( "ze_ammo", 800, {FCVAR_REPLICATED}, "Amount of ammo to give humans." ) CVars.Buyzone = CreateConVar( "ze_buyzone", 1, {FCVAR_REPLICATED}, "Whether or not players may purchase weapons only in a buyzone." ) -- GM.AmmoTypes = {"smg1","pistol","357","ar2","buckshot","sniperround"} GM.AmmoTypes = {"ammo_50AE","ammo_762mm","ammo_556mm","ammo_556mm_box","ammo_338mag","ammo_9mm","ammo_buckshot","ammo_45acp","ammo_357sig","ammo_57mm"} GM.ValidHumans = {"male14","male18","male12","male17","male13","male10","male16","male15","male11", "female10","female11","female12"}
local Class = require("lib.class") local Lovox = require("lib.lovox") local Vec3 = require("lib.vec3") local Entity = require("src.entity") local World = require("src.world") local Health = require("src.bosshealth") local OmegaSkeleton = Class("OmegaSkeleton", Entity) OmegaSkeleton.isEnemy = true OmegaSkeleton.isBoss = true OmegaSkeleton.batch = require("src.omegaskeletonbatch") OmegaSkeleton.animations = { idle = {1}, laugh = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}, death = {2}, } OmegaSkeleton.animTimer = 0 OmegaSkeleton.animIndex = 1 OmegaSkeleton.state = "laugh" function OmegaSkeleton:initialize(...) Entity.initialize(self, ...) self.shape = World:circle(self.position.x, self.position.y, 35) self.shape.obj = self self.healthMeter = Health(500) self.id = self.batch:add(self.position.x, self.position.y, self.position.z, -math.pi/2, 2) end function OmegaSkeleton:idle(dt) if self.animIndex > 1 then self.animIndex = 1 end return "idle" end function OmegaSkeleton:laugh(dt) if self.animIndex > 14 then self.animIndex = 1 end return "laugh" end function OmegaSkeleton:death(dt) if self.animIndex > 1 then self.animIndex = 1 end return "death" end function OmegaSkeleton:onHit(chain) if self.state == "death" then return false end local damage = chain * chain self.healthMeter.points = self.healthMeter.points - damage if self.healthMeter.points <= 0 then self.shape:scale(0.3) self.state = "death" self.animIndex = 1 return true end end function OmegaSkeleton:onDeath() Entity.onDeath(self) self.batch:setTransformation(self.id, 0, 0, 0, 0) end function OmegaSkeleton:update(dt) Entity.update(self, dt) self.animTimer = self.animTimer + dt if self.animTimer >= 0.15 then self.animTimer = 0 self.animIndex = self.animIndex + 1 end self.state = self[self.state](self, dt) OmegaSkeleton.batch:setFrame(self.id, self.animations[self.state][self.animIndex]) self.batch:setTransformation(self.id, self.position.x, self.position.y, self.position.z, self.rotation - math.pi/2, 2) self.shape:moveTo(self.position.x, self.position.y) end return OmegaSkeleton
ITEM.name = "Zaporizske, 2.5l" ITEM.description = "A large bottle of beer" ITEM.longdesc = "Zaporiszke is a light beer. It has a clean and fresh malt flavor combined with a pleasant hop bitterness, sweetish flavor and a spicy-fruity aftertaste." ITEM.model = "models/props_junk/garbage_glassbottle001a.mdl" ITEM.price = 125 ITEM.width = 1 ITEM.height = 3 ITEM.weight = 0.500 ITEM.flatweight = 0.150 ITEM.thirst = 11 ITEM.quantity = 5 ITEM.alcohol = 10 ITEM.addictionLightAlcohol = true ITEM.sound = "stalkersound/inv_flask.mp3" ITEM.img = ix.util.GetMaterial("vgui/hud/items/drink/bottlebeer_5.png") function ITEM:PopulateTooltipIndividual(tooltip) ix.util.PropertyDesc(tooltip, "Light Alcohol", Color(64, 224, 208)) end ITEM:Hook("use", function(item) item.player:EmitSound(item.sound or "items/battery_pickup.wav") item.player:AddBuff("buff_radiationremoval", 10, { amount = 0.15 }) item.player:GetCharacter():SatisfyAddictions("CheapAlcohol") ix.chat.Send(item.player, "iteminternal", "takes a swig of their "..item.name..".", false) end) ITEM:DecideFunction()
local awful = require('awful') local gears = require("gears") local menubar = require("menubar") require('awful.autofocus') local beautiful = require('beautiful') local hotkeys_popup = require('awful.hotkeys_popup').widget local modkey = require('configuration.keys.mod').modKey local altkey = require('configuration.keys.mod').altKey local apps = require('configuration.apps') -- {{{ Key bindings globalKeys = gears.table.join( awful.key({ modkey, }, "z", hotkeys_popup.show_help, {description="show help", group="awesome"}), awful.key({ modkey, }, "Left", awful.tag.viewprev, {description = "view previous", group = "tag"}), awful.key({ modkey, }, "Right", awful.tag.viewnext, {description = "view next", group = "tag"}), awful.key({ modkey, "Shift" }, "Left", function () -- get current tag local t = client.focus and client.focus.first_tag or nil if t == nil then return end -- get previous tag (modulo 9 excluding 0 to wrap from 1 to 9) local tag = client.focus.screen.tags[(t.index - 2) % 9 + 1] awful.client.movetotag(tag) awful.tag.viewprev() end, {description = "move client to previous tag and switch to it", group = "tag"}), awful.key({ modkey, "Shift" }, "Right", function () -- get current tag local t = client.focus and client.focus.first_tag or nil if t == nil then return end -- get next tag (modulo 9 excluding 0 to wrap from 9 to 1) local tag = client.focus.screen.tags[(t.index % 9) + 1] awful.client.movetotag(tag) awful.tag.viewnext() end, {description = "move client to next tag and switch to it", group = "tag"}), awful.key({ modkey, }, "Escape", awful.tag.history.restore, {description = "go back", group = "tag"}), awful.key({ modkey, }, "j", function () awful.client.focus.byidx( 1) end, {description = "focus next by index", group = "client"} ), awful.key({ modkey, }, "k", function () awful.client.focus.byidx(-1) end, {description = "focus previous by index", group = "client"} ), awful.key({ modkey, }, "w", function () mymainmenu:show() end, {description = "show main menu", group = "awesome"}), -- Layout manipulation awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end, {description = "swap with next client by index", group = "client"}), awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end, {description = "swap with previous client by index", group = "client"}), awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end, {description = "focus the next screen", group = "screen"}), awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end, {description = "focus the previous screen", group = "screen"}), awful.key({ modkey, }, "u", awful.client.urgent.jumpto, {description = "jump to urgent client", group = "client"}), awful.key({ modkey, }, "Tab", function () awful.client.focus.history.previous() if client.focus then client.focus:raise() end end, {description = "go back", group = "client"}), -- Standard program awful.key({ modkey, }, "Return", function () awful.spawn(apps.terminal) end, {description = "open a terminal", group = "launcher"}), awful.key({ modkey, "Control" }, "r", awesome.restart, {description = "reload awesome", group = "awesome"}), awful.key({ modkey, "Shift" }, "e", awesome.quit, {description = "quit awesome", group = "awesome"}), awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end, {description = "increase master width factor", group = "layout"}), awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end, {description = "decrease master width factor", group = "layout"}), awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end, {description = "increase the number of master clients", group = "layout"}), awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end, {description = "decrease the number of master clients", group = "layout"}), awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end, {description = "increase the number of columns", group = "layout"}), awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end, {description = "decrease the number of columns", group = "layout"}), awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end, {description = "select next", group = "layout"}), awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end, {description = "select previous", group = "layout"}), awful.key({ modkey, "Control" }, "n", function () local c = awful.client.restore() -- Focus restored client if c then c:emit_signal( "request::activate", "key.unminimize", {raise = true} ) end end, {description = "restore minimized", group = "client"}), -- Prompt awful.key({ modkey }, "p", function () awful.screen.focused().mypromptbox:run() end, {description = "run prompt", group = "launcher"}), awful.key({ modkey }, "x", function () awful.prompt.run { prompt = "Run Lua code: ", textbox = awful.screen.focused().mypromptbox.widget, exe_callback = awful.util.eval, history_path = awful.util.get_cache_dir() .. "/history_eval" } end, {description = "lua execute prompt", group = "awesome"}), -- Menubar awful.key({ modkey }, "d", function() menubar.show() end, {description = "show the menubar", group = "launcher"}) ) -- Bind all tag keys to tags. -- Be careful: we use keycodes to make it works on any keyboard layout. local tag_keys = { 'a', 'r', 's', 't', 'n', 'e', 'i', 'o', 'm', } for i = 1, #tag_keys do -- Hack to only show tags 1 and 9 in the shortcut window (mod+s) local descr_view, descr_toggle, descr_move, descr_toggle_focus if i == 1 or i == 9 then descr_view = {description = 'view tag #', group = 'tag'} descr_toggle = {description = 'toggle tag #', group = 'tag'} descr_move = {description = 'move focused client to tag #', group = 'tag'} descr_toggle_focus = {description = 'toggle focused client on tag #', group = 'tag'} end globalKeys = awful.util.table.join( globalKeys, -- View tag only. awful.key( {modkey}, tag_keys[i], function() local screen = awful.screen.focused() local tag = screen.tags[i] if tag then tag:view_only() end end, descr_view ), -- Toggle tag display. awful.key( {modkey, 'Control'}, tag_keys[i], function() local screen = awful.screen.focused() local tag = screen.tags[i] if tag then awful.tag.viewtoggle(tag) end end, descr_toggle ), -- Move client to tag. awful.key( {modkey, 'Shift'}, tag_keys[i], function() if _G.client.focus then local tag = _G.client.focus.screen.tags[i] if tag then _G.client.focus:move_to_tag(tag) end end end, descr_move ), -- Toggle tag on focused client. awful.key( {modkey, 'Control', 'Shift'}, tag_keys[i], function() if _G.client.focus then local tag = _G.client.focus.screen.tags[i] if tag then _G.client.focus:toggle_tag(tag) end end end, descr_toggle_focus ) ) end return globalKeys
ITEM.name = "Empty Farm" ITEM.uniqueID = "emptyshelf" ITEM.model = "models/z-o-m-b-i-e/st/shkaf/st_cabinet_village_02.mdl" ITEM.description = "" ITEM.width = 4 ITEM.height = 4 ITEM.price = 10 ITEM.category = "Farming" ITEM.data = { producing2 = 0, growth = 0 } ITEM.color = Color(50, 255, 50) ITEM.functions.Plant = { name = "Plant Spores", icon = "icon16/cog.png", sound = "buttons/lightswitch2.wav", OnRun = function(item) local client = item.player local position = client:GetItemDropPos() local inventory = client:GetCharacter():GetInventory() local seed = inventory:HasItem("mushroom_seeds") local soil = inventory:HasItem("soil") if (not seed or not soil) then client:NotifyLocalized("You need soil and mushroom spores.") return false end seed:Remove() soil:Remove() ix.item.Spawn("mushroom_farm", position) --if not, drop it on the ground return true end } function ITEM:GetDescription() if (not self.entity or not IsValid(self.entity)) then local str = self.description .. "\nOnce dropped, you can not pick it back up." return str else return self.description end end
birthdayList = {John = 'Superman', Mary = 'Batmagggggggggggggggggggggggn', Test = 'kjjjjjj'}
Scene = {} function Scene.new(obj) assert(obj.camera ~= nil) assert(obj.materials ~= nil) assert(obj.shapes ~= nil) setmetatable(obj, Scene) return obj end function Scene:__tostring() local materials = '' local shapes = '' for name, m in pairs(self.materials) do materials = string.format('%s\n"%s": %s,', materials, name, m) end for _, s in pairs(self.shapes) do shapes = string.format('%s\n%s,', shapes, s) end return string.format([[ Scene ( camera: %s, materials: {%s }, shapes: [%s ], )]], self.camera, materials, shapes) end
--[[ key 1 -> rdb:job:queueName:set key 2 -> rdb:job:queueName:stats arg 1 -> hash field postfix arg 2 -> UID arg 3 -> time taken arg 4 -> maximum list capacity arg 5 -> key ttl - reset every time this script runs ]] local expires = tonumber(ARGV[5]) local maxRecords = tonumber(ARGV[4]) local currentRecords = redis.call("SCARD", KEYS[1]) if currentRecords and currentRecords > maxRecords then local sum = 0 local max = 0 local min = nil local members = redis.call("SMEMBERS", KEYS[1]) for i, member in ipairs(members) do local jobid, timeRaw = member:match("([^,]+):([^,]+)") local time = tonumber(timeRaw) -- running total sum = sum + tonumber(time) -- check if min or max need updating if time > max then max = time end if not min or time < min then min = time end end local average = math.floor(sum / currentRecords) redis.call("HMSET", KEYS[2], 'avg' .. ARGV[1], average, 'max' .. ARGV[1], max, 'min' .. ARGV[1], min) -- empty the set redis.call("DEL", KEYS[1]) end -- add the new time to the set redis.call("SADD", KEYS[1], ARGV[2] .. ":" .. ARGV[3]) -- refresh expiry on both keys redis.call("EXPIRE", KEYS[1], expires) redis.call("EXPIRE", KEYS[2], expires)
-------------------------------------------------------------- -- Pulse Plus - A Simple FiveM Script, Made By Jordan.#2139 -- -------------------------------------------------------------- config = { use_chat = false, -- Display alerts and responsed in the chat box or above the mini map auto_pulse = true, -- Would you like the players pulse to be determined by their health automatically? (They will still have the option to set their own either way) set_pulse = true, -- Would you like to allow the players to set their own pulse? only_dead = true, -- Should the option to check a players pulse only show then their health is 0, aka they are dead max_pulse = 200, -- How high can they set their pulse before dying? min_pulse = 35, -- How low can they set their pulse before dying? PopUpPrompt = '[E] Check Pulse', -- The prompt they get when they are close enought to a person to check their pulse Keybind = 86, -- The keybind to check a persons pulse DistToSee = 0.75, -- How close you have to be to a player to see the pop up TextSize = 0.8, -- How large should the text be on their body }
slot0 = class("BackYardThemeTemplate", import(".BackYardBaseThemeTemplate")) slot0.Ctor = function (slot0, slot1) slot0.super.Ctor(slot0, slot1) slot0.isFetched = slot1.is_fetch end slot0.GetType = function (slot0) return BackYardConst.THEME_TEMPLATE_USAGE_TYPE_OTHER end slot0.ShouldFetch = function (slot0) return not slot0.isFetched end slot0.GetWarpFurnitures = function (slot0) if not slot0.furnitures then slot0.furnitures = {} BackYardBaseThemeTemplate.WarpPutInfo2BackYardFurnitrue(slot0.furnitures, 1, slot0:GetRawPutList()) end return slot0.furnitures end slot0.GetAllFurniture = function (slot0) if not slot0.furnitruesByIds then slot2 = {} for slot6, slot7 in ipairs(slot1) do if not slot2[tonumber(slot7.id)] then slot2[tonumber(slot7.id)] = { id = tonumber(slot7.id), count = slot7:getConfig("count") } end end table.insert({}, { floor = 1, furniture_put_list = slot0:GetRawPutList() or {} }) slot0.furnitruesByIds = GetBackYardDataCommand.initFurnitures({ lv = 4, skipCheck = true, furniture_id_list = _.values(slot2), furniture_put_list = slot3 }) end return slot0.furnitruesByIds end slot0.GetFurnitureCnt = function (slot0) if not slot0.furnitureCnts then slot0.furnitureCnts = {} for slot5, slot6 in ipairs(slot1) do if not slot0.furnitureCnts[slot6.id] then slot0.furnitureCnts[slot6.id] = 0 end slot0.furnitureCnts[slot6.id] = slot0.furnitureCnts[slot6.id] + 1 end end return slot0.furnitureCnts end return slot0
local wezterm = require("wezterm") local colors = { -- bg = "#11171d", --greenish bg = "#16161e", fg = "#a9b1d6", black = "#24283b", red = "#f7768e", green = "#9ece6a", yellow = "#ff9e64", blue = "#7aa2f7", magenta = "#bb9af7", cyan = "#2ac3de", white = "#a9b1d6", cursor = "#9aa5ce", } local colors_f = { colors.black, colors.red, colors.green, colors.yellow, colors.blue, colors.magenta, colors.cyan, colors.white, } wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width) return " " .. tab.active_pane.title .. " " end) return { font = wezterm.font("JetBrainsMono Nerd Font"), font_rules= { -- Select a fancy italic font for italic text { italic = true, font = wezterm.font("VictorMono Nerd Font", {weight="Medium", italic=true}), }, -- Similarly, a fancy bold+italic font { italic = true, font = wezterm.font("VictorMono Nerd Font", {weight="Bold", italic=true}), }, }, font_size = 13, default_cursor_style = "SteadyBar", window_close_confirmation = "NeverPrompt", window_padding = { left = 18, right = 18, top = 18, bottom = 18 }, tab_max_width = 25, enable_wayland = true, colors = { foreground = colors.fg, background = colors.bg, ansi = colors_f, cursor_fg = colors.bg, cursor_bg = colors.white, cursor_border = colors.white, brights = colors_f, tab_bar = { background = "#1a1b26", active_tab = { bg_color = "#16161e", fg_color = colors.fg, intensity = "Bold", }, inactive_tab = { bg_color = "#24283b", fg_color = colors.fg, }, inactive_tab_hover = { bg_color = "#24283b", fg_color = colors.fg, italic = true, }, }, }, show_tab_index_in_tab_bar = false, hide_tab_bar_if_only_one_tab = true, exit_behavior = "Close", }
--[[ BEGIN AUTOGENERATED SEGMENT ]] local cdecl = [[ typedef struct ImVec2_Simple { float x; float y; } ImVec2_Simple; typedef struct ImVec4_Simple { float x; float y; float z; float w;} ImVec4_Simple; typedef struct ImColor_Simple { ImVec4_Simple Value;} ImColor_Simple; typedef struct ImGuiStoragePair ImGuiStoragePair; typedef struct ImGuiTextRange ImGuiTextRange; typedef struct ImFontAtlasCustomRect ImFontAtlasCustomRect; typedef struct ImVec4 ImVec4; typedef struct ImVec2 ImVec2; typedef struct ImGuiTextFilter ImGuiTextFilter; typedef struct ImGuiTextBuffer ImGuiTextBuffer; typedef struct ImGuiStyle ImGuiStyle; typedef struct ImGuiStorage ImGuiStorage; typedef struct ImGuiSizeCallbackData ImGuiSizeCallbackData; typedef struct ImGuiPayload ImGuiPayload; typedef struct ImGuiOnceUponAFrame ImGuiOnceUponAFrame; typedef struct ImGuiListClipper ImGuiListClipper; typedef struct ImGuiInputTextCallbackData ImGuiInputTextCallbackData; typedef struct ImGuiIO ImGuiIO; typedef struct ImGuiContext ImGuiContext; typedef struct ImColor ImColor; typedef struct ImFontGlyphRangesBuilder ImFontGlyphRangesBuilder; typedef struct ImFontGlyph ImFontGlyph; typedef struct ImFontConfig ImFontConfig; typedef struct ImFontAtlas ImFontAtlas; typedef struct ImFont ImFont; typedef struct ImDrawVert ImDrawVert; typedef struct ImDrawListSplitter ImDrawListSplitter; typedef struct ImDrawListSharedData ImDrawListSharedData; typedef struct ImDrawList ImDrawList; typedef struct ImDrawData ImDrawData; typedef struct ImDrawCmd ImDrawCmd; typedef struct ImDrawChannel ImDrawChannel; struct ImDrawChannel; struct ImDrawCmd; struct ImDrawData; struct ImDrawList; struct ImDrawListSharedData; struct ImDrawListSplitter; struct ImDrawVert; struct ImFont; struct ImFontAtlas; struct ImFontConfig; struct ImFontGlyph; struct ImFontGlyphRangesBuilder; struct ImColor; struct ImGuiContext; struct ImGuiIO; struct ImGuiInputTextCallbackData; struct ImGuiListClipper; struct ImGuiOnceUponAFrame; struct ImGuiPayload; struct ImGuiSizeCallbackData; struct ImGuiStorage; struct ImGuiStyle; struct ImGuiTextBuffer; struct ImGuiTextFilter; typedef void* ImTextureID; typedef unsigned int ImGuiID; typedef unsigned short ImWchar; typedef int ImGuiCol; typedef int ImGuiCond; typedef int ImGuiDataType; typedef int ImGuiDir; typedef int ImGuiKey; typedef int ImGuiNavInput; typedef int ImGuiMouseCursor; typedef int ImGuiStyleVar; typedef int ImDrawCornerFlags; typedef int ImDrawListFlags; typedef int ImFontAtlasFlags; typedef int ImGuiBackendFlags; typedef int ImGuiColorEditFlags; typedef int ImGuiConfigFlags; typedef int ImGuiComboFlags; typedef int ImGuiDragDropFlags; typedef int ImGuiFocusedFlags; typedef int ImGuiHoveredFlags; typedef int ImGuiInputTextFlags; typedef int ImGuiSelectableFlags; typedef int ImGuiTabBarFlags; typedef int ImGuiTabItemFlags; typedef int ImGuiTreeNodeFlags; typedef int ImGuiWindowFlags; typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData *data); typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); typedef signed char ImS8; typedef unsigned char ImU8; typedef signed short ImS16; typedef unsigned short ImU16; typedef signed int ImS32; typedef unsigned int ImU32; typedef int64_t ImS64; typedef uint64_t ImU64; typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd); typedef unsigned short ImDrawIdx;typedef struct ImVector{int Size;int Capacity;void* Data;} ImVector; typedef struct ImVector_float {int Size;int Capacity;float* Data;} ImVector_float; typedef struct ImVector_ImWchar {int Size;int Capacity;ImWchar* Data;} ImVector_ImWchar; typedef struct ImVector_ImDrawVert {int Size;int Capacity;ImDrawVert* Data;} ImVector_ImDrawVert; typedef struct ImVector_ImFontGlyph {int Size;int Capacity;ImFontGlyph* Data;} ImVector_ImFontGlyph; typedef struct ImVector_ImGuiTextRange {int Size;int Capacity;ImGuiTextRange* Data;} ImVector_ImGuiTextRange; typedef struct ImVector_ImGuiStoragePair {int Size;int Capacity;ImGuiStoragePair* Data;} ImVector_ImGuiStoragePair; typedef struct ImVector_ImDrawChannel {int Size;int Capacity;ImDrawChannel* Data;} ImVector_ImDrawChannel; typedef struct ImVector_char {int Size;int Capacity;char* Data;} ImVector_char; typedef struct ImVector_ImU32 {int Size;int Capacity;ImU32* Data;} ImVector_ImU32; typedef struct ImVector_ImFontAtlasCustomRect {int Size;int Capacity;ImFontAtlasCustomRect* Data;} ImVector_ImFontAtlasCustomRect; typedef struct ImVector_ImTextureID {int Size;int Capacity;ImTextureID* Data;} ImVector_ImTextureID; typedef struct ImVector_ImFontConfig {int Size;int Capacity;ImFontConfig* Data;} ImVector_ImFontConfig; typedef struct ImVector_ImFontPtr {int Size;int Capacity;ImFont** Data;} ImVector_ImFontPtr; typedef struct ImVector_ImDrawCmd {int Size;int Capacity;ImDrawCmd* Data;} ImVector_ImDrawCmd; typedef struct ImVector_ImVec4 {int Size;int Capacity;ImVec4* Data;} ImVector_ImVec4; typedef struct ImVector_ImDrawIdx {int Size;int Capacity;ImDrawIdx* Data;} ImVector_ImDrawIdx; typedef struct ImVector_ImVec2 {int Size;int Capacity;ImVec2* Data;} ImVector_ImVec2; struct ImVec2 { float x, y; }; struct ImVec4 { float x, y, z, w; }; enum ImGuiWindowFlags_ { ImGuiWindowFlags_None = 0, ImGuiWindowFlags_NoTitleBar = 1 << 0, ImGuiWindowFlags_NoResize = 1 << 1, ImGuiWindowFlags_NoMove = 1 << 2, ImGuiWindowFlags_NoScrollbar = 1 << 3, ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, ImGuiWindowFlags_NoCollapse = 1 << 5, ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, ImGuiWindowFlags_NoBackground = 1 << 7, ImGuiWindowFlags_NoSavedSettings = 1 << 8, ImGuiWindowFlags_NoMouseInputs = 1 << 9, ImGuiWindowFlags_MenuBar = 1 << 10, ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12, ImGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13, ImGuiWindowFlags_AlwaysVerticalScrollbar= 1 << 14, ImGuiWindowFlags_AlwaysHorizontalScrollbar=1<< 15, ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16, ImGuiWindowFlags_NoNavInputs = 1 << 18, ImGuiWindowFlags_NoNavFocus = 1 << 19, ImGuiWindowFlags_UnsavedDocument = 1 << 20, ImGuiWindowFlags_NoNav = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus, ImGuiWindowFlags_NoDecoration = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse, ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus, ImGuiWindowFlags_NavFlattened = 1 << 23, ImGuiWindowFlags_ChildWindow = 1 << 24, ImGuiWindowFlags_Tooltip = 1 << 25, ImGuiWindowFlags_Popup = 1 << 26, ImGuiWindowFlags_Modal = 1 << 27, ImGuiWindowFlags_ChildMenu = 1 << 28 }; enum ImGuiInputTextFlags_ { ImGuiInputTextFlags_None = 0, ImGuiInputTextFlags_CharsDecimal = 1 << 0, ImGuiInputTextFlags_CharsHexadecimal = 1 << 1, ImGuiInputTextFlags_CharsUppercase = 1 << 2, ImGuiInputTextFlags_CharsNoBlank = 1 << 3, ImGuiInputTextFlags_AutoSelectAll = 1 << 4, ImGuiInputTextFlags_EnterReturnsTrue = 1 << 5, ImGuiInputTextFlags_CallbackCompletion = 1 << 6, ImGuiInputTextFlags_CallbackHistory = 1 << 7, ImGuiInputTextFlags_CallbackAlways = 1 << 8, ImGuiInputTextFlags_CallbackCharFilter = 1 << 9, ImGuiInputTextFlags_AllowTabInput = 1 << 10, ImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11, ImGuiInputTextFlags_NoHorizontalScroll = 1 << 12, ImGuiInputTextFlags_AlwaysInsertMode = 1 << 13, ImGuiInputTextFlags_ReadOnly = 1 << 14, ImGuiInputTextFlags_Password = 1 << 15, ImGuiInputTextFlags_NoUndoRedo = 1 << 16, ImGuiInputTextFlags_CharsScientific = 1 << 17, ImGuiInputTextFlags_CallbackResize = 1 << 18, ImGuiInputTextFlags_Multiline = 1 << 20, ImGuiInputTextFlags_NoMarkEdited = 1 << 21 }; enum ImGuiTreeNodeFlags_ { ImGuiTreeNodeFlags_None = 0, ImGuiTreeNodeFlags_Selected = 1 << 0, ImGuiTreeNodeFlags_Framed = 1 << 1, ImGuiTreeNodeFlags_AllowItemOverlap = 1 << 2, ImGuiTreeNodeFlags_NoTreePushOnOpen = 1 << 3, ImGuiTreeNodeFlags_NoAutoOpenOnLog = 1 << 4, ImGuiTreeNodeFlags_DefaultOpen = 1 << 5, ImGuiTreeNodeFlags_OpenOnDoubleClick = 1 << 6, ImGuiTreeNodeFlags_OpenOnArrow = 1 << 7, ImGuiTreeNodeFlags_Leaf = 1 << 8, ImGuiTreeNodeFlags_Bullet = 1 << 9, ImGuiTreeNodeFlags_FramePadding = 1 << 10, ImGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13, ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_NoAutoOpenOnLog }; enum ImGuiSelectableFlags_ { ImGuiSelectableFlags_None = 0, ImGuiSelectableFlags_DontClosePopups = 1 << 0, ImGuiSelectableFlags_SpanAllColumns = 1 << 1, ImGuiSelectableFlags_AllowDoubleClick = 1 << 2, ImGuiSelectableFlags_Disabled = 1 << 3 }; enum ImGuiComboFlags_ { ImGuiComboFlags_None = 0, ImGuiComboFlags_PopupAlignLeft = 1 << 0, ImGuiComboFlags_HeightSmall = 1 << 1, ImGuiComboFlags_HeightRegular = 1 << 2, ImGuiComboFlags_HeightLarge = 1 << 3, ImGuiComboFlags_HeightLargest = 1 << 4, ImGuiComboFlags_NoArrowButton = 1 << 5, ImGuiComboFlags_NoPreview = 1 << 6, ImGuiComboFlags_HeightMask_ = ImGuiComboFlags_HeightSmall | ImGuiComboFlags_HeightRegular | ImGuiComboFlags_HeightLarge | ImGuiComboFlags_HeightLargest }; enum ImGuiTabBarFlags_ { ImGuiTabBarFlags_None = 0, ImGuiTabBarFlags_Reorderable = 1 << 0, ImGuiTabBarFlags_AutoSelectNewTabs = 1 << 1, ImGuiTabBarFlags_TabListPopupButton = 1 << 2, ImGuiTabBarFlags_NoCloseWithMiddleMouseButton = 1 << 3, ImGuiTabBarFlags_NoTabListScrollingButtons = 1 << 4, ImGuiTabBarFlags_NoTooltip = 1 << 5, ImGuiTabBarFlags_FittingPolicyResizeDown = 1 << 6, ImGuiTabBarFlags_FittingPolicyScroll = 1 << 7, ImGuiTabBarFlags_FittingPolicyMask_ = ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_FittingPolicyScroll, ImGuiTabBarFlags_FittingPolicyDefault_ = ImGuiTabBarFlags_FittingPolicyResizeDown }; enum ImGuiTabItemFlags_ { ImGuiTabItemFlags_None = 0, ImGuiTabItemFlags_UnsavedDocument = 1 << 0, ImGuiTabItemFlags_SetSelected = 1 << 1, ImGuiTabItemFlags_NoCloseWithMiddleMouseButton = 1 << 2, ImGuiTabItemFlags_NoPushId = 1 << 3 }; enum ImGuiFocusedFlags_ { ImGuiFocusedFlags_None = 0, ImGuiFocusedFlags_ChildWindows = 1 << 0, ImGuiFocusedFlags_RootWindow = 1 << 1, ImGuiFocusedFlags_AnyWindow = 1 << 2, ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows }; enum ImGuiHoveredFlags_ { ImGuiHoveredFlags_None = 0, ImGuiHoveredFlags_ChildWindows = 1 << 0, ImGuiHoveredFlags_RootWindow = 1 << 1, ImGuiHoveredFlags_AnyWindow = 1 << 2, ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 3, ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 5, ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 6, ImGuiHoveredFlags_AllowWhenDisabled = 1 << 7, ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped, ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows }; enum ImGuiDragDropFlags_ { ImGuiDragDropFlags_None = 0, ImGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0, ImGuiDragDropFlags_SourceNoDisableHover = 1 << 1, ImGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2, ImGuiDragDropFlags_SourceAllowNullID = 1 << 3, ImGuiDragDropFlags_SourceExtern = 1 << 4, ImGuiDragDropFlags_SourceAutoExpirePayload = 1 << 5, ImGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10, ImGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11, ImGuiDragDropFlags_AcceptNoPreviewTooltip = 1 << 12, ImGuiDragDropFlags_AcceptPeekOnly = ImGuiDragDropFlags_AcceptBeforeDelivery | ImGuiDragDropFlags_AcceptNoDrawDefaultRect }; enum ImGuiDataType_ { ImGuiDataType_S8, ImGuiDataType_U8, ImGuiDataType_S16, ImGuiDataType_U16, ImGuiDataType_S32, ImGuiDataType_U32, ImGuiDataType_S64, ImGuiDataType_U64, ImGuiDataType_Float, ImGuiDataType_Double, ImGuiDataType_COUNT }; enum ImGuiDir_ { ImGuiDir_None = -1, ImGuiDir_Left = 0, ImGuiDir_Right = 1, ImGuiDir_Up = 2, ImGuiDir_Down = 3, ImGuiDir_COUNT }; enum ImGuiKey_ { ImGuiKey_Tab, ImGuiKey_LeftArrow, ImGuiKey_RightArrow, ImGuiKey_UpArrow, ImGuiKey_DownArrow, ImGuiKey_PageUp, ImGuiKey_PageDown, ImGuiKey_Home, ImGuiKey_End, ImGuiKey_Insert, ImGuiKey_Delete, ImGuiKey_Backspace, ImGuiKey_Space, ImGuiKey_Enter, ImGuiKey_Escape, ImGuiKey_KeyPadEnter, ImGuiKey_A, ImGuiKey_C, ImGuiKey_V, ImGuiKey_X, ImGuiKey_Y, ImGuiKey_Z, ImGuiKey_COUNT }; enum ImGuiNavInput_ { ImGuiNavInput_Activate, ImGuiNavInput_Cancel, ImGuiNavInput_Input, ImGuiNavInput_Menu, ImGuiNavInput_DpadLeft, ImGuiNavInput_DpadRight, ImGuiNavInput_DpadUp, ImGuiNavInput_DpadDown, ImGuiNavInput_LStickLeft, ImGuiNavInput_LStickRight, ImGuiNavInput_LStickUp, ImGuiNavInput_LStickDown, ImGuiNavInput_FocusPrev, ImGuiNavInput_FocusNext, ImGuiNavInput_TweakSlow, ImGuiNavInput_TweakFast, ImGuiNavInput_KeyMenu_, ImGuiNavInput_KeyTab_, ImGuiNavInput_KeyLeft_, ImGuiNavInput_KeyRight_, ImGuiNavInput_KeyUp_, ImGuiNavInput_KeyDown_, ImGuiNavInput_COUNT, ImGuiNavInput_InternalStart_ = ImGuiNavInput_KeyMenu_ }; enum ImGuiConfigFlags_ { ImGuiConfigFlags_None = 0, ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, ImGuiConfigFlags_NavEnableGamepad = 1 << 1, ImGuiConfigFlags_NavEnableSetMousePos = 1 << 2, ImGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3, ImGuiConfigFlags_NoMouse = 1 << 4, ImGuiConfigFlags_NoMouseCursorChange = 1 << 5, ImGuiConfigFlags_IsSRGB = 1 << 20, ImGuiConfigFlags_IsTouchScreen = 1 << 21 }; enum ImGuiBackendFlags_ { ImGuiBackendFlags_None = 0, ImGuiBackendFlags_HasGamepad = 1 << 0, ImGuiBackendFlags_HasMouseCursors = 1 << 1, ImGuiBackendFlags_HasSetMousePos = 1 << 2, ImGuiBackendFlags_RendererHasVtxOffset = 1 << 3 }; enum ImGuiCol_ { ImGuiCol_Text, ImGuiCol_TextDisabled, ImGuiCol_WindowBg, ImGuiCol_ChildBg, ImGuiCol_PopupBg, ImGuiCol_Border, ImGuiCol_BorderShadow, ImGuiCol_FrameBg, ImGuiCol_FrameBgHovered, ImGuiCol_FrameBgActive, ImGuiCol_TitleBg, ImGuiCol_TitleBgActive, ImGuiCol_TitleBgCollapsed, ImGuiCol_MenuBarBg, ImGuiCol_ScrollbarBg, ImGuiCol_ScrollbarGrab, ImGuiCol_ScrollbarGrabHovered, ImGuiCol_ScrollbarGrabActive, ImGuiCol_CheckMark, ImGuiCol_SliderGrab, ImGuiCol_SliderGrabActive, ImGuiCol_Button, ImGuiCol_ButtonHovered, ImGuiCol_ButtonActive, ImGuiCol_Header, ImGuiCol_HeaderHovered, ImGuiCol_HeaderActive, ImGuiCol_Separator, ImGuiCol_SeparatorHovered, ImGuiCol_SeparatorActive, ImGuiCol_ResizeGrip, ImGuiCol_ResizeGripHovered, ImGuiCol_ResizeGripActive, ImGuiCol_Tab, ImGuiCol_TabHovered, ImGuiCol_TabActive, ImGuiCol_TabUnfocused, ImGuiCol_TabUnfocusedActive, ImGuiCol_PlotLines, ImGuiCol_PlotLinesHovered, ImGuiCol_PlotHistogram, ImGuiCol_PlotHistogramHovered, ImGuiCol_TextSelectedBg, ImGuiCol_DragDropTarget, ImGuiCol_NavHighlight, ImGuiCol_NavWindowingHighlight, ImGuiCol_NavWindowingDimBg, ImGuiCol_ModalWindowDimBg, ImGuiCol_COUNT }; enum ImGuiStyleVar_ { ImGuiStyleVar_Alpha, ImGuiStyleVar_WindowPadding, ImGuiStyleVar_WindowRounding, ImGuiStyleVar_WindowBorderSize, ImGuiStyleVar_WindowMinSize, ImGuiStyleVar_WindowTitleAlign, ImGuiStyleVar_ChildRounding, ImGuiStyleVar_ChildBorderSize, ImGuiStyleVar_PopupRounding, ImGuiStyleVar_PopupBorderSize, ImGuiStyleVar_FramePadding, ImGuiStyleVar_FrameRounding, ImGuiStyleVar_FrameBorderSize, ImGuiStyleVar_ItemSpacing, ImGuiStyleVar_ItemInnerSpacing, ImGuiStyleVar_IndentSpacing, ImGuiStyleVar_ScrollbarSize, ImGuiStyleVar_ScrollbarRounding, ImGuiStyleVar_GrabMinSize, ImGuiStyleVar_GrabRounding, ImGuiStyleVar_TabRounding, ImGuiStyleVar_ButtonTextAlign, ImGuiStyleVar_SelectableTextAlign, ImGuiStyleVar_COUNT }; enum ImGuiColorEditFlags_ { ImGuiColorEditFlags_None = 0, ImGuiColorEditFlags_NoAlpha = 1 << 1, ImGuiColorEditFlags_NoPicker = 1 << 2, ImGuiColorEditFlags_NoOptions = 1 << 3, ImGuiColorEditFlags_NoSmallPreview = 1 << 4, ImGuiColorEditFlags_NoInputs = 1 << 5, ImGuiColorEditFlags_NoTooltip = 1 << 6, ImGuiColorEditFlags_NoLabel = 1 << 7, ImGuiColorEditFlags_NoSidePreview = 1 << 8, ImGuiColorEditFlags_NoDragDrop = 1 << 9, ImGuiColorEditFlags_AlphaBar = 1 << 16, ImGuiColorEditFlags_AlphaPreview = 1 << 17, ImGuiColorEditFlags_AlphaPreviewHalf= 1 << 18, ImGuiColorEditFlags_HDR = 1 << 19, ImGuiColorEditFlags_DisplayRGB = 1 << 20, ImGuiColorEditFlags_DisplayHSV = 1 << 21, ImGuiColorEditFlags_DisplayHex = 1 << 22, ImGuiColorEditFlags_Uint8 = 1 << 23, ImGuiColorEditFlags_Float = 1 << 24, ImGuiColorEditFlags_PickerHueBar = 1 << 25, ImGuiColorEditFlags_PickerHueWheel = 1 << 26, ImGuiColorEditFlags_InputRGB = 1 << 27, ImGuiColorEditFlags_InputHSV = 1 << 28, ImGuiColorEditFlags__OptionsDefault = ImGuiColorEditFlags_Uint8|ImGuiColorEditFlags_DisplayRGB|ImGuiColorEditFlags_InputRGB|ImGuiColorEditFlags_PickerHueBar, ImGuiColorEditFlags__DisplayMask = ImGuiColorEditFlags_DisplayRGB|ImGuiColorEditFlags_DisplayHSV|ImGuiColorEditFlags_DisplayHex, ImGuiColorEditFlags__DataTypeMask = ImGuiColorEditFlags_Uint8|ImGuiColorEditFlags_Float, ImGuiColorEditFlags__PickerMask = ImGuiColorEditFlags_PickerHueWheel|ImGuiColorEditFlags_PickerHueBar, ImGuiColorEditFlags__InputMask = ImGuiColorEditFlags_InputRGB|ImGuiColorEditFlags_InputHSV }; enum ImGuiMouseCursor_ { ImGuiMouseCursor_None = -1, ImGuiMouseCursor_Arrow = 0, ImGuiMouseCursor_TextInput, ImGuiMouseCursor_ResizeAll, ImGuiMouseCursor_ResizeNS, ImGuiMouseCursor_ResizeEW, ImGuiMouseCursor_ResizeNESW, ImGuiMouseCursor_ResizeNWSE, ImGuiMouseCursor_Hand, ImGuiMouseCursor_COUNT }; enum ImGuiCond_ { ImGuiCond_Always = 1 << 0, ImGuiCond_Once = 1 << 1, ImGuiCond_FirstUseEver = 1 << 2, ImGuiCond_Appearing = 1 << 3 }; struct ImGuiStyle { float Alpha; ImVec2 WindowPadding; float WindowRounding; float WindowBorderSize; ImVec2 WindowMinSize; ImVec2 WindowTitleAlign; ImGuiDir WindowMenuButtonPosition; float ChildRounding; float ChildBorderSize; float PopupRounding; float PopupBorderSize; ImVec2 FramePadding; float FrameRounding; float FrameBorderSize; ImVec2 ItemSpacing; ImVec2 ItemInnerSpacing; ImVec2 TouchExtraPadding; float IndentSpacing; float ColumnsMinSpacing; float ScrollbarSize; float ScrollbarRounding; float GrabMinSize; float GrabRounding; float TabRounding; float TabBorderSize; ImGuiDir ColorButtonPosition; ImVec2 ButtonTextAlign; ImVec2 SelectableTextAlign; ImVec2 DisplayWindowPadding; ImVec2 DisplaySafeAreaPadding; float MouseCursorScale; _Bool AntiAliasedLines; _Bool AntiAliasedFill; float CurveTessellationTol; ImVec4 Colors[ImGuiCol_COUNT]; }; struct ImGuiIO { ImGuiConfigFlags ConfigFlags; ImGuiBackendFlags BackendFlags; ImVec2 DisplaySize; float DeltaTime; float IniSavingRate; const char* IniFilename; const char* LogFilename; float MouseDoubleClickTime; float MouseDoubleClickMaxDist; float MouseDragThreshold; int KeyMap[ImGuiKey_COUNT]; float KeyRepeatDelay; float KeyRepeatRate; void* UserData; ImFontAtlas*Fonts; float FontGlobalScale; _Bool FontAllowUserScaling; ImFont* FontDefault; ImVec2 DisplayFramebufferScale; _Bool MouseDrawCursor; _Bool ConfigMacOSXBehaviors; _Bool ConfigInputTextCursorBlink; _Bool ConfigWindowsResizeFromEdges; _Bool ConfigWindowsMoveFromTitleBarOnly; const char* BackendPlatformName; const char* BackendRendererName; void* BackendPlatformUserData; void* BackendRendererUserData; void* BackendLanguageUserData; const char* (*GetClipboardTextFn)(void* user_data); void (*SetClipboardTextFn)(void* user_data, const char* text); void* ClipboardUserData; void (*ImeSetInputScreenPosFn)(int x, int y); void* ImeWindowHandle; void* RenderDrawListsFnUnused; ImVec2 MousePos; _Bool MouseDown[5]; float MouseWheel; float MouseWheelH; _Bool KeyCtrl; _Bool KeyShift; _Bool KeyAlt; _Bool KeySuper; _Bool KeysDown[512]; float NavInputs[ImGuiNavInput_COUNT]; _Bool WantCaptureMouse; _Bool WantCaptureKeyboard; _Bool WantTextInput; _Bool WantSetMousePos; _Bool WantSaveIniSettings; _Bool NavActive; _Bool NavVisible; float Framerate; int MetricsRenderVertices; int MetricsRenderIndices; int MetricsRenderWindows; int MetricsActiveWindows; int MetricsActiveAllocations; ImVec2 MouseDelta; ImVec2 MousePosPrev; ImVec2 MouseClickedPos[5]; double MouseClickedTime[5]; _Bool MouseClicked[5]; _Bool MouseDoubleClicked[5]; _Bool MouseReleased[5]; _Bool MouseDownOwned[5]; _Bool MouseDownWasDoubleClick[5]; float MouseDownDuration[5]; float MouseDownDurationPrev[5]; ImVec2 MouseDragMaxDistanceAbs[5]; float MouseDragMaxDistanceSqr[5]; float KeysDownDuration[512]; float KeysDownDurationPrev[512]; float NavInputsDownDuration[ImGuiNavInput_COUNT]; float NavInputsDownDurationPrev[ImGuiNavInput_COUNT]; ImVector_ImWchar InputQueueCharacters; }; struct ImGuiInputTextCallbackData { ImGuiInputTextFlags EventFlag; ImGuiInputTextFlags Flags; void* UserData; ImWchar EventChar; ImGuiKey EventKey; char* Buf; int BufTextLen; int BufSize; _Bool BufDirty; int CursorPos; int SelectionStart; int SelectionEnd; }; struct ImGuiSizeCallbackData { void* UserData; ImVec2 Pos; ImVec2 CurrentSize; ImVec2 DesiredSize; }; struct ImGuiPayload { void* Data; int DataSize; ImGuiID SourceId; ImGuiID SourceParentId; int DataFrameCount; char DataType[32+1]; _Bool Preview; _Bool Delivery; }; struct ImGuiOnceUponAFrame { int RefFrame; }; struct ImGuiTextFilter { char InputBuf[256]; ImVector_ImGuiTextRange Filters; int CountGrep; }; struct ImGuiTextBuffer { ImVector_char Buf; }; struct ImGuiStorage { ImVector_ImGuiStoragePair Data; }; struct ImGuiListClipper { float StartPosY; float ItemsHeight; int ItemsCount, StepNo, DisplayStart, DisplayEnd; }; struct ImColor { ImVec4 Value; }; struct ImDrawCmd { unsigned int ElemCount; ImVec4 ClipRect; ImTextureID TextureId; unsigned int VtxOffset; unsigned int IdxOffset; ImDrawCallback UserCallback; void* UserCallbackData; }; struct ImDrawVert { ImVec2 pos; ImVec2 uv; ImU32 col; }; struct ImDrawChannel { ImVector_ImDrawCmd _CmdBuffer; ImVector_ImDrawIdx _IdxBuffer; }; struct ImDrawListSplitter { int _Current; int _Count; ImVector_ImDrawChannel _Channels; }; enum ImDrawCornerFlags_ { ImDrawCornerFlags_None = 0, ImDrawCornerFlags_TopLeft = 1 << 0, ImDrawCornerFlags_TopRight = 1 << 1, ImDrawCornerFlags_BotLeft = 1 << 2, ImDrawCornerFlags_BotRight = 1 << 3, ImDrawCornerFlags_Top = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_TopRight, ImDrawCornerFlags_Bot = ImDrawCornerFlags_BotLeft | ImDrawCornerFlags_BotRight, ImDrawCornerFlags_Left = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_BotLeft, ImDrawCornerFlags_Right = ImDrawCornerFlags_TopRight | ImDrawCornerFlags_BotRight, ImDrawCornerFlags_All = 0xF }; enum ImDrawListFlags_ { ImDrawListFlags_None = 0, ImDrawListFlags_AntiAliasedLines = 1 << 0, ImDrawListFlags_AntiAliasedFill = 1 << 1, ImDrawListFlags_AllowVtxOffset = 1 << 2 }; struct ImDrawList { ImVector_ImDrawCmd CmdBuffer; ImVector_ImDrawIdx IdxBuffer; ImVector_ImDrawVert VtxBuffer; ImDrawListFlags Flags; const ImDrawListSharedData* _Data; const char* _OwnerName; unsigned int _VtxCurrentOffset; unsigned int _VtxCurrentIdx; ImDrawVert* _VtxWritePtr; ImDrawIdx* _IdxWritePtr; ImVector_ImVec4 _ClipRectStack; ImVector_ImTextureID _TextureIdStack; ImVector_ImVec2 _Path; ImDrawListSplitter _Splitter; }; struct ImDrawData { _Bool Valid; ImDrawList** CmdLists; int CmdListsCount; int TotalIdxCount; int TotalVtxCount; ImVec2 DisplayPos; ImVec2 DisplaySize; ImVec2 FramebufferScale; }; struct ImFontConfig { void* FontData; int FontDataSize; _Bool FontDataOwnedByAtlas; int FontNo; float SizePixels; int OversampleH; int OversampleV; _Bool PixelSnapH; ImVec2 GlyphExtraSpacing; ImVec2 GlyphOffset; const ImWchar* GlyphRanges; float GlyphMinAdvanceX; float GlyphMaxAdvanceX; _Bool MergeMode; unsigned int RasterizerFlags; float RasterizerMultiply; char Name[40]; ImFont* DstFont; }; struct ImFontGlyph { ImWchar Codepoint; float AdvanceX; float X0, Y0, X1, Y1; float U0, V0, U1, V1; }; struct ImFontGlyphRangesBuilder { ImVector_ImU32 UsedChars; }; struct ImFontAtlasCustomRect { unsigned int ID; unsigned short Width, Height; unsigned short X, Y; float GlyphAdvanceX; ImVec2 GlyphOffset; ImFont* Font; }; enum ImFontAtlasFlags_ { ImFontAtlasFlags_None = 0, ImFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0, ImFontAtlasFlags_NoMouseCursors = 1 << 1 }; struct ImFontAtlas { _Bool Locked; ImFontAtlasFlags Flags; ImTextureID TexID; int TexDesiredWidth; int TexGlyphPadding; unsigned char* TexPixelsAlpha8; unsigned int* TexPixelsRGBA32; int TexWidth; int TexHeight; ImVec2 TexUvScale; ImVec2 TexUvWhitePixel; ImVector_ImFontPtr Fonts; ImVector_ImFontAtlasCustomRect CustomRects; ImVector_ImFontConfig ConfigData; int CustomRectIds[1]; }; struct ImFont { ImVector_float IndexAdvanceX; float FallbackAdvanceX; float FontSize; ImVector_ImWchar IndexLookup; ImVector_ImFontGlyph Glyphs; const ImFontGlyph* FallbackGlyph; ImVec2 DisplayOffset; ImFontAtlas* ContainerAtlas; const ImFontConfig* ConfigData; short ConfigDataCount; ImWchar FallbackChar; float Scale; float Ascent, Descent; int MetricsTotalSurface; _Bool DirtyLookupTables; }; struct ImGuiTextRange { const char* b; const char* e; }; struct ImGuiStoragePair { ImGuiID key; union { int val_i; float val_f; void* val_p; }; }; ImVec2* ImVec2_ImVec2(void); void ImVec2_destroy(ImVec2* self); ImVec2* ImVec2_ImVec2Float(float _x,float _y); ImVec4* ImVec4_ImVec4(void); void ImVec4_destroy(ImVec4* self); ImVec4* ImVec4_ImVec4Float(float _x,float _y,float _z,float _w); ImGuiContext* igCreateContext(ImFontAtlas* shared_font_atlas); void igDestroyContext(ImGuiContext* ctx); ImGuiContext* igGetCurrentContext(void); void igSetCurrentContext(ImGuiContext* ctx); _Bool igDebugCheckVersionAndDataLayout(const char* version_str,size_t sz_io,size_t sz_style,size_t sz_vec2,size_t sz_vec4,size_t sz_drawvert,size_t sz_drawidx); ImGuiIO* igGetIO(void); ImGuiStyle* igGetStyle(void); void igNewFrame(void); void igEndFrame(void); void igRender(void); ImDrawData* igGetDrawData(void); void igShowDemoWindow( _Bool * p_open); void igShowAboutWindow( _Bool * p_open); void igShowMetricsWindow( _Bool * p_open); void igShowStyleEditor(ImGuiStyle* ref); _Bool igShowStyleSelector(const char* label); void igShowFontSelector(const char* label); void igShowUserGuide(void); const char* igGetVersion(void); void igStyleColorsDark(ImGuiStyle* dst); void igStyleColorsClassic(ImGuiStyle* dst); void igStyleColorsLight(ImGuiStyle* dst); _Bool igBegin(const char* name, _Bool * p_open,ImGuiWindowFlags flags); void igEnd(void); _Bool igBeginChild(const char* str_id,const ImVec2 size, _Bool border,ImGuiWindowFlags flags); _Bool igBeginChildID(ImGuiID id,const ImVec2 size, _Bool border,ImGuiWindowFlags flags); void igEndChild(void); _Bool igIsWindowAppearing(void); _Bool igIsWindowCollapsed(void); _Bool igIsWindowFocused(ImGuiFocusedFlags flags); _Bool igIsWindowHovered(ImGuiHoveredFlags flags); ImDrawList* igGetWindowDrawList(void); ImVec2 igGetWindowPos(void); ImVec2 igGetWindowSize(void); float igGetWindowWidth(void); float igGetWindowHeight(void); void igSetNextWindowPos(const ImVec2 pos,ImGuiCond cond,const ImVec2 pivot); void igSetNextWindowSize(const ImVec2 size,ImGuiCond cond); void igSetNextWindowSizeConstraints(const ImVec2 size_min,const ImVec2 size_max,ImGuiSizeCallback custom_callback,void* custom_callback_data); void igSetNextWindowContentSize(const ImVec2 size); void igSetNextWindowCollapsed( _Bool collapsed,ImGuiCond cond); void igSetNextWindowFocus(void); void igSetNextWindowBgAlpha(float alpha); void igSetWindowPosVec2(const ImVec2 pos,ImGuiCond cond); void igSetWindowSizeVec2(const ImVec2 size,ImGuiCond cond); void igSetWindowCollapsedBool( _Bool collapsed,ImGuiCond cond); void igSetWindowFocus(void); void igSetWindowFontScale(float scale); void igSetWindowPosStr(const char* name,const ImVec2 pos,ImGuiCond cond); void igSetWindowSizeStr(const char* name,const ImVec2 size,ImGuiCond cond); void igSetWindowCollapsedStr(const char* name, _Bool collapsed,ImGuiCond cond); void igSetWindowFocusStr(const char* name); ImVec2 igGetContentRegionMax(void); ImVec2 igGetContentRegionAvail(void); ImVec2 igGetWindowContentRegionMin(void); ImVec2 igGetWindowContentRegionMax(void); float igGetWindowContentRegionWidth(void); float igGetScrollX(void); float igGetScrollY(void); float igGetScrollMaxX(void); float igGetScrollMaxY(void); void igSetScrollX(float scroll_x); void igSetScrollY(float scroll_y); void igSetScrollHereX(float center_x_ratio); void igSetScrollHereY(float center_y_ratio); void igSetScrollFromPosX(float local_x,float center_x_ratio); void igSetScrollFromPosY(float local_y,float center_y_ratio); void igPushFont(ImFont* font); void igPopFont(void); void igPushStyleColorU32(ImGuiCol idx,ImU32 col); void igPushStyleColor(ImGuiCol idx,const ImVec4 col); void igPopStyleColor(int count); void igPushStyleVarFloat(ImGuiStyleVar idx,float val); void igPushStyleVarVec2(ImGuiStyleVar idx,const ImVec2 val); void igPopStyleVar(int count); const ImVec4* igGetStyleColorVec4(ImGuiCol idx); ImFont* igGetFont(void); float igGetFontSize(void); ImVec2 igGetFontTexUvWhitePixel(void); ImU32 igGetColorU32(ImGuiCol idx,float alpha_mul); ImU32 igGetColorU32Vec4(const ImVec4 col); ImU32 igGetColorU32U32(ImU32 col); void igPushItemWidth(float item_width); void igPopItemWidth(void); void igSetNextItemWidth(float item_width); float igCalcItemWidth(void); void igPushTextWrapPos(float wrap_local_pos_x); void igPopTextWrapPos(void); void igPushAllowKeyboardFocus( _Bool allow_keyboard_focus); void igPopAllowKeyboardFocus(void); void igPushButtonRepeat( _Bool repeat); void igPopButtonRepeat(void); void igSeparator(void); void igSameLine(float offset_from_start_x,float spacing); void igNewLine(void); void igSpacing(void); void igDummy(const ImVec2 size); void igIndent(float indent_w); void igUnindent(float indent_w); void igBeginGroup(void); void igEndGroup(void); ImVec2 igGetCursorPos(void); float igGetCursorPosX(void); float igGetCursorPosY(void); void igSetCursorPos(const ImVec2 local_pos); void igSetCursorPosX(float local_x); void igSetCursorPosY(float local_y); ImVec2 igGetCursorStartPos(void); ImVec2 igGetCursorScreenPos(void); void igSetCursorScreenPos(const ImVec2 pos); void igAlignTextToFramePadding(void); float igGetTextLineHeight(void); float igGetTextLineHeightWithSpacing(void); float igGetFrameHeight(void); float igGetFrameHeightWithSpacing(void); void igPushIDStr(const char* str_id); void igPushIDRange(const char* str_id_begin,const char* str_id_end); void igPushIDPtr(const void* ptr_id); void igPushIDInt(int int_id); void igPopID(void); ImGuiID igGetIDStr(const char* str_id); ImGuiID igGetIDRange(const char* str_id_begin,const char* str_id_end); ImGuiID igGetIDPtr(const void* ptr_id); void igTextUnformatted(const char* text,const char* text_end); void igText(const char* fmt,...); void igTextV(const char* fmt,va_list args); void igTextColored(const ImVec4 col,const char* fmt,...); void igTextColoredV(const ImVec4 col,const char* fmt,va_list args); void igTextDisabled(const char* fmt,...); void igTextDisabledV(const char* fmt,va_list args); void igTextWrapped(const char* fmt,...); void igTextWrappedV(const char* fmt,va_list args); void igLabelText(const char* label,const char* fmt,...); void igLabelTextV(const char* label,const char* fmt,va_list args); void igBulletText(const char* fmt,...); void igBulletTextV(const char* fmt,va_list args); _Bool igButton(const char* label,const ImVec2 size); _Bool igSmallButton(const char* label); _Bool igInvisibleButton(const char* str_id,const ImVec2 size); _Bool igArrowButton(const char* str_id,ImGuiDir dir); void igImage(ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 tint_col,const ImVec4 border_col); _Bool igImageButton(ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,int frame_padding,const ImVec4 bg_col,const ImVec4 tint_col); _Bool igCheckbox(const char* label, _Bool * v); _Bool igCheckboxFlags(const char* label,unsigned int* flags,unsigned int flags_value); _Bool igRadioButtonBool(const char* label, _Bool active); _Bool igRadioButtonIntPtr(const char* label,int* v,int v_button); void igProgressBar(float fraction,const ImVec2 size_arg,const char* overlay); void igBullet(void); _Bool igBeginCombo(const char* label,const char* preview_value,ImGuiComboFlags flags); void igEndCombo(void); _Bool igCombo(const char* label,int* current_item,const char* const items[],int items_count,int popup_max_height_in_items); _Bool igComboStr(const char* label,int* current_item,const char* items_separated_by_zeros,int popup_max_height_in_items); _Bool igComboFnPtr(const char* label,int* current_item, _Bool (*items_getter)(void* data,int idx,const char** out_text),void* data,int items_count,int popup_max_height_in_items); _Bool igDragFloat(const char* label,float* v,float v_speed,float v_min,float v_max,const char* format,float power); _Bool igDragFloat2(const char* label,float v[2],float v_speed,float v_min,float v_max,const char* format,float power); _Bool igDragFloat3(const char* label,float v[3],float v_speed,float v_min,float v_max,const char* format,float power); _Bool igDragFloat4(const char* label,float v[4],float v_speed,float v_min,float v_max,const char* format,float power); _Bool igDragFloatRange2(const char* label,float* v_current_min,float* v_current_max,float v_speed,float v_min,float v_max,const char* format,const char* format_max,float power); _Bool igDragInt(const char* label,int* v,float v_speed,int v_min,int v_max,const char* format); _Bool igDragInt2(const char* label,int v[2],float v_speed,int v_min,int v_max,const char* format); _Bool igDragInt3(const char* label,int v[3],float v_speed,int v_min,int v_max,const char* format); _Bool igDragInt4(const char* label,int v[4],float v_speed,int v_min,int v_max,const char* format); _Bool igDragIntRange2(const char* label,int* v_current_min,int* v_current_max,float v_speed,int v_min,int v_max,const char* format,const char* format_max); _Bool igDragScalar(const char* label,ImGuiDataType data_type,void* v,float v_speed,const void* v_min,const void* v_max,const char* format,float power); _Bool igDragScalarN(const char* label,ImGuiDataType data_type,void* v,int components,float v_speed,const void* v_min,const void* v_max,const char* format,float power); _Bool igSliderFloat(const char* label,float* v,float v_min,float v_max,const char* format,float power); _Bool igSliderFloat2(const char* label,float v[2],float v_min,float v_max,const char* format,float power); _Bool igSliderFloat3(const char* label,float v[3],float v_min,float v_max,const char* format,float power); _Bool igSliderFloat4(const char* label,float v[4],float v_min,float v_max,const char* format,float power); _Bool igSliderAngle(const char* label,float* v_rad,float v_degrees_min,float v_degrees_max,const char* format); _Bool igSliderInt(const char* label,int* v,int v_min,int v_max,const char* format); _Bool igSliderInt2(const char* label,int v[2],int v_min,int v_max,const char* format); _Bool igSliderInt3(const char* label,int v[3],int v_min,int v_max,const char* format); _Bool igSliderInt4(const char* label,int v[4],int v_min,int v_max,const char* format); _Bool igSliderScalar(const char* label,ImGuiDataType data_type,void* v,const void* v_min,const void* v_max,const char* format,float power); _Bool igSliderScalarN(const char* label,ImGuiDataType data_type,void* v,int components,const void* v_min,const void* v_max,const char* format,float power); _Bool igVSliderFloat(const char* label,const ImVec2 size,float* v,float v_min,float v_max,const char* format,float power); _Bool igVSliderInt(const char* label,const ImVec2 size,int* v,int v_min,int v_max,const char* format); _Bool igVSliderScalar(const char* label,const ImVec2 size,ImGuiDataType data_type,void* v,const void* v_min,const void* v_max,const char* format,float power); _Bool igInputText(const char* label,char* buf,size_t buf_size,ImGuiInputTextFlags flags,ImGuiInputTextCallback callback,void* user_data); _Bool igInputTextMultiline(const char* label,char* buf,size_t buf_size,const ImVec2 size,ImGuiInputTextFlags flags,ImGuiInputTextCallback callback,void* user_data); _Bool igInputTextWithHint(const char* label,const char* hint,char* buf,size_t buf_size,ImGuiInputTextFlags flags,ImGuiInputTextCallback callback,void* user_data); _Bool igInputFloat(const char* label,float* v,float step,float step_fast,const char* format,ImGuiInputTextFlags flags); _Bool igInputFloat2(const char* label,float v[2],const char* format,ImGuiInputTextFlags flags); _Bool igInputFloat3(const char* label,float v[3],const char* format,ImGuiInputTextFlags flags); _Bool igInputFloat4(const char* label,float v[4],const char* format,ImGuiInputTextFlags flags); _Bool igInputInt(const char* label,int* v,int step,int step_fast,ImGuiInputTextFlags flags); _Bool igInputInt2(const char* label,int v[2],ImGuiInputTextFlags flags); _Bool igInputInt3(const char* label,int v[3],ImGuiInputTextFlags flags); _Bool igInputInt4(const char* label,int v[4],ImGuiInputTextFlags flags); _Bool igInputDouble(const char* label,double* v,double step,double step_fast,const char* format,ImGuiInputTextFlags flags); _Bool igInputScalar(const char* label,ImGuiDataType data_type,void* v,const void* step,const void* step_fast,const char* format,ImGuiInputTextFlags flags); _Bool igInputScalarN(const char* label,ImGuiDataType data_type,void* v,int components,const void* step,const void* step_fast,const char* format,ImGuiInputTextFlags flags); _Bool igColorEdit3(const char* label,float col[3],ImGuiColorEditFlags flags); _Bool igColorEdit4(const char* label,float col[4],ImGuiColorEditFlags flags); _Bool igColorPicker3(const char* label,float col[3],ImGuiColorEditFlags flags); _Bool igColorPicker4(const char* label,float col[4],ImGuiColorEditFlags flags,const float* ref_col); _Bool igColorButton(const char* desc_id,const ImVec4 col,ImGuiColorEditFlags flags,ImVec2 size); void igSetColorEditOptions(ImGuiColorEditFlags flags); _Bool igTreeNodeStr(const char* label); _Bool igTreeNodeStrStr(const char* str_id,const char* fmt,...); _Bool igTreeNodePtr(const void* ptr_id,const char* fmt,...); _Bool igTreeNodeVStr(const char* str_id,const char* fmt,va_list args); _Bool igTreeNodeVPtr(const void* ptr_id,const char* fmt,va_list args); _Bool igTreeNodeExStr(const char* label,ImGuiTreeNodeFlags flags); _Bool igTreeNodeExStrStr(const char* str_id,ImGuiTreeNodeFlags flags,const char* fmt,...); _Bool igTreeNodeExPtr(const void* ptr_id,ImGuiTreeNodeFlags flags,const char* fmt,...); _Bool igTreeNodeExVStr(const char* str_id,ImGuiTreeNodeFlags flags,const char* fmt,va_list args); _Bool igTreeNodeExVPtr(const void* ptr_id,ImGuiTreeNodeFlags flags,const char* fmt,va_list args); void igTreePushStr(const char* str_id); void igTreePushPtr(const void* ptr_id); void igTreePop(void); float igGetTreeNodeToLabelSpacing(void); _Bool igCollapsingHeader(const char* label,ImGuiTreeNodeFlags flags); _Bool igCollapsingHeaderBoolPtr(const char* label, _Bool * p_open,ImGuiTreeNodeFlags flags); void igSetNextItemOpen( _Bool is_open,ImGuiCond cond); _Bool igSelectable(const char* label, _Bool selected,ImGuiSelectableFlags flags,const ImVec2 size); _Bool igSelectableBoolPtr(const char* label, _Bool * p_selected,ImGuiSelectableFlags flags,const ImVec2 size); _Bool igListBoxStr_arr(const char* label,int* current_item,const char* const items[],int items_count,int height_in_items); _Bool igListBoxFnPtr(const char* label,int* current_item, _Bool (*items_getter)(void* data,int idx,const char** out_text),void* data,int items_count,int height_in_items); _Bool igListBoxHeaderVec2(const char* label,const ImVec2 size); _Bool igListBoxHeaderInt(const char* label,int items_count,int height_in_items); void igListBoxFooter(void); void igPlotLines(const char* label,const float* values,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size,int stride); void igPlotLinesFnPtr(const char* label,float(*values_getter)(void* data,int idx),void* data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size); void igPlotHistogramFloatPtr(const char* label,const float* values,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size,int stride); void igPlotHistogramFnPtr(const char* label,float(*values_getter)(void* data,int idx),void* data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 graph_size); void igValueBool(const char* prefix, _Bool b); void igValueInt(const char* prefix,int v); void igValueUint(const char* prefix,unsigned int v); void igValueFloat(const char* prefix,float v,const char* float_format); _Bool igBeginMainMenuBar(void); void igEndMainMenuBar(void); _Bool igBeginMenuBar(void); void igEndMenuBar(void); _Bool igBeginMenu(const char* label, _Bool enabled); void igEndMenu(void); _Bool igMenuItemBool(const char* label,const char* shortcut, _Bool selected, _Bool enabled); _Bool igMenuItemBoolPtr(const char* label,const char* shortcut, _Bool * p_selected, _Bool enabled); void igBeginTooltip(void); void igEndTooltip(void); void igSetTooltip(const char* fmt,...); void igSetTooltipV(const char* fmt,va_list args); void igOpenPopup(const char* str_id); _Bool igBeginPopup(const char* str_id,ImGuiWindowFlags flags); _Bool igBeginPopupContextItem(const char* str_id,int mouse_button); _Bool igBeginPopupContextWindow(const char* str_id,int mouse_button, _Bool also_over_items); _Bool igBeginPopupContextVoid(const char* str_id,int mouse_button); _Bool igBeginPopupModal(const char* name, _Bool * p_open,ImGuiWindowFlags flags); void igEndPopup(void); _Bool igOpenPopupOnItemClick(const char* str_id,int mouse_button); _Bool igIsPopupOpen(const char* str_id); void igCloseCurrentPopup(void); void igColumns(int count,const char* id, _Bool border); void igNextColumn(void); int igGetColumnIndex(void); float igGetColumnWidth(int column_index); void igSetColumnWidth(int column_index,float width); float igGetColumnOffset(int column_index); void igSetColumnOffset(int column_index,float offset_x); int igGetColumnsCount(void); _Bool igBeginTabBar(const char* str_id,ImGuiTabBarFlags flags); void igEndTabBar(void); _Bool igBeginTabItem(const char* label, _Bool * p_open,ImGuiTabItemFlags flags); void igEndTabItem(void); void igSetTabItemClosed(const char* tab_or_docked_window_label); void igLogToTTY(int auto_open_depth); void igLogToFile(int auto_open_depth,const char* filename); void igLogToClipboard(int auto_open_depth); void igLogFinish(void); void igLogButtons(void); _Bool igBeginDragDropSource(ImGuiDragDropFlags flags); _Bool igSetDragDropPayload(const char* type,const void* data,size_t sz,ImGuiCond cond); void igEndDragDropSource(void); _Bool igBeginDragDropTarget(void); const ImGuiPayload* igAcceptDragDropPayload(const char* type,ImGuiDragDropFlags flags); void igEndDragDropTarget(void); const ImGuiPayload* igGetDragDropPayload(void); void igPushClipRect(const ImVec2 clip_rect_min,const ImVec2 clip_rect_max, _Bool intersect_with_current_clip_rect); void igPopClipRect(void); void igSetItemDefaultFocus(void); void igSetKeyboardFocusHere(int offset); _Bool igIsItemHovered(ImGuiHoveredFlags flags); _Bool igIsItemActive(void); _Bool igIsItemFocused(void); _Bool igIsItemClicked(int mouse_button); _Bool igIsItemVisible(void); _Bool igIsItemEdited(void); _Bool igIsItemActivated(void); _Bool igIsItemDeactivated(void); _Bool igIsItemDeactivatedAfterEdit(void); _Bool igIsAnyItemHovered(void); _Bool igIsAnyItemActive(void); _Bool igIsAnyItemFocused(void); ImVec2 igGetItemRectMin(void); ImVec2 igGetItemRectMax(void); ImVec2 igGetItemRectSize(void); void igSetItemAllowOverlap(void); _Bool igIsRectVisible(const ImVec2 size); _Bool igIsRectVisibleVec2(const ImVec2 rect_min,const ImVec2 rect_max); double igGetTime(void); int igGetFrameCount(void); ImDrawList* igGetBackgroundDrawList(void); ImDrawList* igGetForegroundDrawList(void); ImDrawListSharedData* igGetDrawListSharedData(void); const char* igGetStyleColorName(ImGuiCol idx); void igSetStateStorage(ImGuiStorage* storage); ImGuiStorage* igGetStateStorage(void); ImVec2 igCalcTextSize(const char* text,const char* text_end, _Bool hide_text_after_double_hash,float wrap_width); void igCalcListClipping(int items_count,float items_height,int* out_items_display_start,int* out_items_display_end); _Bool igBeginChildFrame(ImGuiID id,const ImVec2 size,ImGuiWindowFlags flags); void igEndChildFrame(void); ImVec4 igColorConvertU32ToFloat4(ImU32 in); ImU32 igColorConvertFloat4ToU32(const ImVec4 in); int igGetKeyIndex(ImGuiKey imgui_key); _Bool igIsKeyDown(int user_key_index); _Bool igIsKeyPressed(int user_key_index, _Bool repeat); _Bool igIsKeyReleased(int user_key_index); int igGetKeyPressedAmount(int key_index,float repeat_delay,float rate); _Bool igIsMouseDown(int button); _Bool igIsAnyMouseDown(void); _Bool igIsMouseClicked(int button, _Bool repeat); _Bool igIsMouseDoubleClicked(int button); _Bool igIsMouseReleased(int button); _Bool igIsMouseDragging(int button,float lock_threshold); _Bool igIsMouseHoveringRect(const ImVec2 r_min,const ImVec2 r_max, _Bool clip); _Bool igIsMousePosValid(const ImVec2* mouse_pos); ImVec2 igGetMousePos(void); ImVec2 igGetMousePosOnOpeningCurrentPopup(void); ImVec2 igGetMouseDragDelta(int button,float lock_threshold); void igResetMouseDragDelta(int button); ImGuiMouseCursor igGetMouseCursor(void); void igSetMouseCursor(ImGuiMouseCursor type); void igCaptureKeyboardFromApp( _Bool want_capture_keyboard_value); void igCaptureMouseFromApp( _Bool want_capture_mouse_value); const char* igGetClipboardText(void); void igSetClipboardText(const char* text); void igLoadIniSettingsFromDisk(const char* ini_filename); void igLoadIniSettingsFromMemory(const char* ini_data,size_t ini_size); void igSaveIniSettingsToDisk(const char* ini_filename); const char* igSaveIniSettingsToMemory(size_t* out_ini_size); void igSetAllocatorFunctions(void*(*alloc_func)(size_t sz,void* user_data),void(*free_func)(void* ptr,void* user_data),void* user_data); void* igMemAlloc(size_t size); void igMemFree(void* ptr); ImGuiStyle* ImGuiStyle_ImGuiStyle(void); void ImGuiStyle_destroy(ImGuiStyle* self); void ImGuiStyle_ScaleAllSizes(ImGuiStyle* self,float scale_factor); void ImGuiIO_AddInputCharacter(ImGuiIO* self,unsigned int c); void ImGuiIO_AddInputCharactersUTF8(ImGuiIO* self,const char* str); void ImGuiIO_ClearInputCharacters(ImGuiIO* self); ImGuiIO* ImGuiIO_ImGuiIO(void); void ImGuiIO_destroy(ImGuiIO* self); ImGuiInputTextCallbackData* ImGuiInputTextCallbackData_ImGuiInputTextCallbackData(void); void ImGuiInputTextCallbackData_destroy(ImGuiInputTextCallbackData* self); void ImGuiInputTextCallbackData_DeleteChars(ImGuiInputTextCallbackData* self,int pos,int bytes_count); void ImGuiInputTextCallbackData_InsertChars(ImGuiInputTextCallbackData* self,int pos,const char* text,const char* text_end); _Bool ImGuiInputTextCallbackData_HasSelection(ImGuiInputTextCallbackData* self); ImGuiPayload* ImGuiPayload_ImGuiPayload(void); void ImGuiPayload_destroy(ImGuiPayload* self); void ImGuiPayload_Clear(ImGuiPayload* self); _Bool ImGuiPayload_IsDataType(ImGuiPayload* self,const char* type); _Bool ImGuiPayload_IsPreview(ImGuiPayload* self); _Bool ImGuiPayload_IsDelivery(ImGuiPayload* self); ImGuiOnceUponAFrame* ImGuiOnceUponAFrame_ImGuiOnceUponAFrame(void); void ImGuiOnceUponAFrame_destroy(ImGuiOnceUponAFrame* self); ImGuiTextFilter* ImGuiTextFilter_ImGuiTextFilter(const char* default_filter); void ImGuiTextFilter_destroy(ImGuiTextFilter* self); _Bool ImGuiTextFilter_Draw(ImGuiTextFilter* self,const char* label,float width); _Bool ImGuiTextFilter_PassFilter(ImGuiTextFilter* self,const char* text,const char* text_end); void ImGuiTextFilter_Build(ImGuiTextFilter* self); void ImGuiTextFilter_Clear(ImGuiTextFilter* self); _Bool ImGuiTextFilter_IsActive(ImGuiTextFilter* self); ImGuiTextRange* ImGuiTextRange_ImGuiTextRange(void); void ImGuiTextRange_destroy(ImGuiTextRange* self); ImGuiTextRange* ImGuiTextRange_ImGuiTextRangeStr(const char* _b,const char* _e); _Bool ImGuiTextRange_empty(ImGuiTextRange* self); void ImGuiTextRange_split(ImGuiTextRange* self,char separator,ImVector_ImGuiTextRange* out); ImGuiTextBuffer* ImGuiTextBuffer_ImGuiTextBuffer(void); void ImGuiTextBuffer_destroy(ImGuiTextBuffer* self); const char* ImGuiTextBuffer_begin(ImGuiTextBuffer* self); const char* ImGuiTextBuffer_end(ImGuiTextBuffer* self); int ImGuiTextBuffer_size(ImGuiTextBuffer* self); _Bool ImGuiTextBuffer_empty(ImGuiTextBuffer* self); void ImGuiTextBuffer_clear(ImGuiTextBuffer* self); void ImGuiTextBuffer_reserve(ImGuiTextBuffer* self,int capacity); const char* ImGuiTextBuffer_c_str(ImGuiTextBuffer* self); void ImGuiTextBuffer_append(ImGuiTextBuffer* self,const char* str,const char* str_end); void ImGuiTextBuffer_appendfv(ImGuiTextBuffer* self,const char* fmt,va_list args); ImGuiStoragePair* ImGuiStoragePair_ImGuiStoragePairInt(ImGuiID _key,int _val_i); void ImGuiStoragePair_destroy(ImGuiStoragePair* self); ImGuiStoragePair* ImGuiStoragePair_ImGuiStoragePairFloat(ImGuiID _key,float _val_f); ImGuiStoragePair* ImGuiStoragePair_ImGuiStoragePairPtr(ImGuiID _key,void* _val_p); void ImGuiStorage_Clear(ImGuiStorage* self); int ImGuiStorage_GetInt(ImGuiStorage* self,ImGuiID key,int default_val); void ImGuiStorage_SetInt(ImGuiStorage* self,ImGuiID key,int val); _Bool ImGuiStorage_GetBool(ImGuiStorage* self,ImGuiID key, _Bool default_val); void ImGuiStorage_SetBool(ImGuiStorage* self,ImGuiID key, _Bool val); float ImGuiStorage_GetFloat(ImGuiStorage* self,ImGuiID key,float default_val); void ImGuiStorage_SetFloat(ImGuiStorage* self,ImGuiID key,float val); void* ImGuiStorage_GetVoidPtr(ImGuiStorage* self,ImGuiID key); void ImGuiStorage_SetVoidPtr(ImGuiStorage* self,ImGuiID key,void* val); int* ImGuiStorage_GetIntRef(ImGuiStorage* self,ImGuiID key,int default_val); _Bool * ImGuiStorage_GetBoolRef(ImGuiStorage* self,ImGuiID key, _Bool default_val); float* ImGuiStorage_GetFloatRef(ImGuiStorage* self,ImGuiID key,float default_val); void** ImGuiStorage_GetVoidPtrRef(ImGuiStorage* self,ImGuiID key,void* default_val); void ImGuiStorage_SetAllInt(ImGuiStorage* self,int val); void ImGuiStorage_BuildSortByKey(ImGuiStorage* self); ImGuiListClipper* ImGuiListClipper_ImGuiListClipper(int items_count,float items_height); void ImGuiListClipper_destroy(ImGuiListClipper* self); _Bool ImGuiListClipper_Step(ImGuiListClipper* self); void ImGuiListClipper_Begin(ImGuiListClipper* self,int items_count,float items_height); void ImGuiListClipper_End(ImGuiListClipper* self); ImColor* ImColor_ImColor(void); void ImColor_destroy(ImColor* self); ImColor* ImColor_ImColorInt(int r,int g,int b,int a); ImColor* ImColor_ImColorU32(ImU32 rgba); ImColor* ImColor_ImColorFloat(float r,float g,float b,float a); ImColor* ImColor_ImColorVec4(const ImVec4 col); void ImColor_SetHSV(ImColor* self,float h,float s,float v,float a); ImColor ImColor_HSV(ImColor* self,float h,float s,float v,float a); ImDrawCmd* ImDrawCmd_ImDrawCmd(void); void ImDrawCmd_destroy(ImDrawCmd* self); ImDrawListSplitter* ImDrawListSplitter_ImDrawListSplitter(void); void ImDrawListSplitter_destroy(ImDrawListSplitter* self); void ImDrawListSplitter_Clear(ImDrawListSplitter* self); void ImDrawListSplitter_ClearFreeMemory(ImDrawListSplitter* self); void ImDrawListSplitter_Split(ImDrawListSplitter* self,ImDrawList* draw_list,int count); void ImDrawListSplitter_Merge(ImDrawListSplitter* self,ImDrawList* draw_list); void ImDrawListSplitter_SetCurrentChannel(ImDrawListSplitter* self,ImDrawList* draw_list,int channel_idx); ImDrawList* ImDrawList_ImDrawList(const ImDrawListSharedData* shared_data); void ImDrawList_destroy(ImDrawList* self); void ImDrawList_PushClipRect(ImDrawList* self,ImVec2 clip_rect_min,ImVec2 clip_rect_max, _Bool intersect_with_current_clip_rect); void ImDrawList_PushClipRectFullScreen(ImDrawList* self); void ImDrawList_PopClipRect(ImDrawList* self); void ImDrawList_PushTextureID(ImDrawList* self,ImTextureID texture_id); void ImDrawList_PopTextureID(ImDrawList* self); ImVec2 ImDrawList_GetClipRectMin(ImDrawList* self); ImVec2 ImDrawList_GetClipRectMax(ImDrawList* self); void ImDrawList_AddLine(ImDrawList* self,const ImVec2 a,const ImVec2 b,ImU32 col,float thickness); void ImDrawList_AddRect(ImDrawList* self,const ImVec2 a,const ImVec2 b,ImU32 col,float rounding,ImDrawCornerFlags rounding_corners,float thickness); void ImDrawList_AddRectFilled(ImDrawList* self,const ImVec2 a,const ImVec2 b,ImU32 col,float rounding,ImDrawCornerFlags rounding_corners); void ImDrawList_AddRectFilledMultiColor(ImDrawList* self,const ImVec2 a,const ImVec2 b,ImU32 col_upr_left,ImU32 col_upr_right,ImU32 col_bot_right,ImU32 col_bot_left); void ImDrawList_AddQuad(ImDrawList* self,const ImVec2 a,const ImVec2 b,const ImVec2 c,const ImVec2 d,ImU32 col,float thickness); void ImDrawList_AddQuadFilled(ImDrawList* self,const ImVec2 a,const ImVec2 b,const ImVec2 c,const ImVec2 d,ImU32 col); void ImDrawList_AddTriangle(ImDrawList* self,const ImVec2 a,const ImVec2 b,const ImVec2 c,ImU32 col,float thickness); void ImDrawList_AddTriangleFilled(ImDrawList* self,const ImVec2 a,const ImVec2 b,const ImVec2 c,ImU32 col); void ImDrawList_AddCircle(ImDrawList* self,const ImVec2 centre,float radius,ImU32 col,int num_segments,float thickness); void ImDrawList_AddCircleFilled(ImDrawList* self,const ImVec2 centre,float radius,ImU32 col,int num_segments); void ImDrawList_AddText(ImDrawList* self,const ImVec2 pos,ImU32 col,const char* text_begin,const char* text_end); void ImDrawList_AddTextFontPtr(ImDrawList* self,const ImFont* font,float font_size,const ImVec2 pos,ImU32 col,const char* text_begin,const char* text_end,float wrap_width,const ImVec4* cpu_fine_clip_rect); void ImDrawList_AddImage(ImDrawList* self,ImTextureID user_texture_id,const ImVec2 a,const ImVec2 b,const ImVec2 uv_a,const ImVec2 uv_b,ImU32 col); void ImDrawList_AddImageQuad(ImDrawList* self,ImTextureID user_texture_id,const ImVec2 a,const ImVec2 b,const ImVec2 c,const ImVec2 d,const ImVec2 uv_a,const ImVec2 uv_b,const ImVec2 uv_c,const ImVec2 uv_d,ImU32 col); void ImDrawList_AddImageRounded(ImDrawList* self,ImTextureID user_texture_id,const ImVec2 a,const ImVec2 b,const ImVec2 uv_a,const ImVec2 uv_b,ImU32 col,float rounding,ImDrawCornerFlags rounding_corners); void ImDrawList_AddPolyline(ImDrawList* self,const ImVec2* points,int num_points,ImU32 col, _Bool closed,float thickness); void ImDrawList_AddConvexPolyFilled(ImDrawList* self,const ImVec2* points,int num_points,ImU32 col); void ImDrawList_AddBezierCurve(ImDrawList* self,const ImVec2 pos0,const ImVec2 cp0,const ImVec2 cp1,const ImVec2 pos1,ImU32 col,float thickness,int num_segments); void ImDrawList_PathClear(ImDrawList* self); void ImDrawList_PathLineTo(ImDrawList* self,const ImVec2 pos); void ImDrawList_PathLineToMergeDuplicate(ImDrawList* self,const ImVec2 pos); void ImDrawList_PathFillConvex(ImDrawList* self,ImU32 col); void ImDrawList_PathStroke(ImDrawList* self,ImU32 col, _Bool closed,float thickness); void ImDrawList_PathArcTo(ImDrawList* self,const ImVec2 centre,float radius,float a_min,float a_max,int num_segments); void ImDrawList_PathArcToFast(ImDrawList* self,const ImVec2 centre,float radius,int a_min_of_12,int a_max_of_12); void ImDrawList_PathBezierCurveTo(ImDrawList* self,const ImVec2 p1,const ImVec2 p2,const ImVec2 p3,int num_segments); void ImDrawList_PathRect(ImDrawList* self,const ImVec2 rect_min,const ImVec2 rect_max,float rounding,ImDrawCornerFlags rounding_corners); void ImDrawList_AddCallback(ImDrawList* self,ImDrawCallback callback,void* callback_data); void ImDrawList_AddDrawCmd(ImDrawList* self); ImDrawList* ImDrawList_CloneOutput(ImDrawList* self); void ImDrawList_ChannelsSplit(ImDrawList* self,int count); void ImDrawList_ChannelsMerge(ImDrawList* self); void ImDrawList_ChannelsSetCurrent(ImDrawList* self,int n); void ImDrawList_Clear(ImDrawList* self); void ImDrawList_ClearFreeMemory(ImDrawList* self); void ImDrawList_PrimReserve(ImDrawList* self,int idx_count,int vtx_count); void ImDrawList_PrimRect(ImDrawList* self,const ImVec2 a,const ImVec2 b,ImU32 col); void ImDrawList_PrimRectUV(ImDrawList* self,const ImVec2 a,const ImVec2 b,const ImVec2 uv_a,const ImVec2 uv_b,ImU32 col); void ImDrawList_PrimQuadUV(ImDrawList* self,const ImVec2 a,const ImVec2 b,const ImVec2 c,const ImVec2 d,const ImVec2 uv_a,const ImVec2 uv_b,const ImVec2 uv_c,const ImVec2 uv_d,ImU32 col); void ImDrawList_PrimWriteVtx(ImDrawList* self,const ImVec2 pos,const ImVec2 uv,ImU32 col); void ImDrawList_PrimWriteIdx(ImDrawList* self,ImDrawIdx idx); void ImDrawList_PrimVtx(ImDrawList* self,const ImVec2 pos,const ImVec2 uv,ImU32 col); void ImDrawList_UpdateClipRect(ImDrawList* self); void ImDrawList_UpdateTextureID(ImDrawList* self); ImDrawData* ImDrawData_ImDrawData(void); void ImDrawData_destroy(ImDrawData* self); void ImDrawData_Clear(ImDrawData* self); void ImDrawData_DeIndexAllBuffers(ImDrawData* self); void ImDrawData_ScaleClipRects(ImDrawData* self,const ImVec2 fb_scale); ImFontConfig* ImFontConfig_ImFontConfig(void); void ImFontConfig_destroy(ImFontConfig* self); ImFontGlyphRangesBuilder* ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder(void); void ImFontGlyphRangesBuilder_destroy(ImFontGlyphRangesBuilder* self); void ImFontGlyphRangesBuilder_Clear(ImFontGlyphRangesBuilder* self); _Bool ImFontGlyphRangesBuilder_GetBit(ImFontGlyphRangesBuilder* self,int n); void ImFontGlyphRangesBuilder_SetBit(ImFontGlyphRangesBuilder* self,int n); void ImFontGlyphRangesBuilder_AddChar(ImFontGlyphRangesBuilder* self,ImWchar c); void ImFontGlyphRangesBuilder_AddText(ImFontGlyphRangesBuilder* self,const char* text,const char* text_end); void ImFontGlyphRangesBuilder_AddRanges(ImFontGlyphRangesBuilder* self,const ImWchar* ranges); void ImFontGlyphRangesBuilder_BuildRanges(ImFontGlyphRangesBuilder* self,ImVector_ImWchar* out_ranges); ImFontAtlasCustomRect* ImFontAtlasCustomRect_ImFontAtlasCustomRect(void); void ImFontAtlasCustomRect_destroy(ImFontAtlasCustomRect* self); _Bool ImFontAtlasCustomRect_IsPacked(ImFontAtlasCustomRect* self); ImFontAtlas* ImFontAtlas_ImFontAtlas(void); void ImFontAtlas_destroy(ImFontAtlas* self); ImFont* ImFontAtlas_AddFont(ImFontAtlas* self,const ImFontConfig* font_cfg); ImFont* ImFontAtlas_AddFontDefault(ImFontAtlas* self,const ImFontConfig* font_cfg); ImFont* ImFontAtlas_AddFontFromFileTTF(ImFontAtlas* self,const char* filename,float size_pixels,const ImFontConfig* font_cfg,const ImWchar* glyph_ranges); ImFont* ImFontAtlas_AddFontFromMemoryTTF(ImFontAtlas* self,void* font_data,int font_size,float size_pixels,const ImFontConfig* font_cfg,const ImWchar* glyph_ranges); ImFont* ImFontAtlas_AddFontFromMemoryCompressedTTF(ImFontAtlas* self,const void* compressed_font_data,int compressed_font_size,float size_pixels,const ImFontConfig* font_cfg,const ImWchar* glyph_ranges); ImFont* ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(ImFontAtlas* self,const char* compressed_font_data_base85,float size_pixels,const ImFontConfig* font_cfg,const ImWchar* glyph_ranges); void ImFontAtlas_ClearInputData(ImFontAtlas* self); void ImFontAtlas_ClearTexData(ImFontAtlas* self); void ImFontAtlas_ClearFonts(ImFontAtlas* self); void ImFontAtlas_Clear(ImFontAtlas* self); _Bool ImFontAtlas_Build(ImFontAtlas* self); void ImFontAtlas_GetTexDataAsAlpha8(ImFontAtlas* self,unsigned char** out_pixels,int* out_width,int* out_height,int* out_bytes_per_pixel); void ImFontAtlas_GetTexDataAsRGBA32(ImFontAtlas* self,unsigned char** out_pixels,int* out_width,int* out_height,int* out_bytes_per_pixel); _Bool ImFontAtlas_IsBuilt(ImFontAtlas* self); void ImFontAtlas_SetTexID(ImFontAtlas* self,ImTextureID id); const ImWchar* ImFontAtlas_GetGlyphRangesDefault(ImFontAtlas* self); const ImWchar* ImFontAtlas_GetGlyphRangesKorean(ImFontAtlas* self); const ImWchar* ImFontAtlas_GetGlyphRangesJapanese(ImFontAtlas* self); const ImWchar* ImFontAtlas_GetGlyphRangesChineseFull(ImFontAtlas* self); const ImWchar* ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon(ImFontAtlas* self); const ImWchar* ImFontAtlas_GetGlyphRangesCyrillic(ImFontAtlas* self); const ImWchar* ImFontAtlas_GetGlyphRangesThai(ImFontAtlas* self); const ImWchar* ImFontAtlas_GetGlyphRangesVietnamese(ImFontAtlas* self); int ImFontAtlas_AddCustomRectRegular(ImFontAtlas* self,unsigned int id,int width,int height); int ImFontAtlas_AddCustomRectFontGlyph(ImFontAtlas* self,ImFont* font,ImWchar id,int width,int height,float advance_x,const ImVec2 offset); const ImFontAtlasCustomRect* ImFontAtlas_GetCustomRectByIndex(ImFontAtlas* self,int index); void ImFontAtlas_CalcCustomRectUV(ImFontAtlas* self,const ImFontAtlasCustomRect* rect,ImVec2* out_uv_min,ImVec2* out_uv_max); _Bool ImFontAtlas_GetMouseCursorTexData(ImFontAtlas* self,ImGuiMouseCursor cursor,ImVec2* out_offset,ImVec2* out_size,ImVec2 out_uv_border[2],ImVec2 out_uv_fill[2]); ImFont* ImFont_ImFont(void); void ImFont_destroy(ImFont* self); const ImFontGlyph* ImFont_FindGlyph(ImFont* self,ImWchar c); const ImFontGlyph* ImFont_FindGlyphNoFallback(ImFont* self,ImWchar c); float ImFont_GetCharAdvance(ImFont* self,ImWchar c); _Bool ImFont_IsLoaded(ImFont* self); const char* ImFont_GetDebugName(ImFont* self); ImVec2 ImFont_CalcTextSizeA(ImFont* self,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining); const char* ImFont_CalcWordWrapPositionA(ImFont* self,float scale,const char* text,const char* text_end,float wrap_width); void ImFont_RenderChar(ImFont* self,ImDrawList* draw_list,float size,ImVec2 pos,ImU32 col,ImWchar c); void ImFont_RenderText(ImFont* self,ImDrawList* draw_list,float size,ImVec2 pos,ImU32 col,const ImVec4 clip_rect,const char* text_begin,const char* text_end,float wrap_width, _Bool cpu_fine_clip); void ImFont_BuildLookupTable(ImFont* self); void ImFont_ClearOutputData(ImFont* self); void ImFont_GrowIndex(ImFont* self,int new_size); void ImFont_AddGlyph(ImFont* self,ImWchar c,float x0,float y0,float x1,float y1,float u0,float v0,float u1,float v1,float advance_x); void ImFont_AddRemapChar(ImFont* self,ImWchar dst,ImWchar src, _Bool overwrite_dst); void ImFont_SetFallbackChar(ImFont* self,ImWchar c); void igGetWindowPos_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetWindowPos_nonUDT2(void); void igGetWindowSize_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetWindowSize_nonUDT2(void); void igGetContentRegionMax_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetContentRegionMax_nonUDT2(void); void igGetContentRegionAvail_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetContentRegionAvail_nonUDT2(void); void igGetWindowContentRegionMin_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetWindowContentRegionMin_nonUDT2(void); void igGetWindowContentRegionMax_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetWindowContentRegionMax_nonUDT2(void); void igGetFontTexUvWhitePixel_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetFontTexUvWhitePixel_nonUDT2(void); void igGetCursorPos_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetCursorPos_nonUDT2(void); void igGetCursorStartPos_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetCursorStartPos_nonUDT2(void); void igGetCursorScreenPos_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetCursorScreenPos_nonUDT2(void); void igGetItemRectMin_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetItemRectMin_nonUDT2(void); void igGetItemRectMax_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetItemRectMax_nonUDT2(void); void igGetItemRectSize_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetItemRectSize_nonUDT2(void); void igCalcTextSize_nonUDT(ImVec2 *pOut,const char* text,const char* text_end, _Bool hide_text_after_double_hash,float wrap_width); ImVec2_Simple igCalcTextSize_nonUDT2(const char* text,const char* text_end, _Bool hide_text_after_double_hash,float wrap_width); void igColorConvertU32ToFloat4_nonUDT(ImVec4 *pOut,ImU32 in); ImVec4_Simple igColorConvertU32ToFloat4_nonUDT2(ImU32 in); void igGetMousePos_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetMousePos_nonUDT2(void); void igGetMousePosOnOpeningCurrentPopup_nonUDT(ImVec2 *pOut); ImVec2_Simple igGetMousePosOnOpeningCurrentPopup_nonUDT2(void); void igGetMouseDragDelta_nonUDT(ImVec2 *pOut,int button,float lock_threshold); ImVec2_Simple igGetMouseDragDelta_nonUDT2(int button,float lock_threshold); void ImColor_HSV_nonUDT(ImColor *pOut,ImColor* self,float h,float s,float v,float a); ImColor_Simple ImColor_HSV_nonUDT2(ImColor* self,float h,float s,float v,float a); void ImDrawList_GetClipRectMin_nonUDT(ImVec2 *pOut,ImDrawList* self); ImVec2_Simple ImDrawList_GetClipRectMin_nonUDT2(ImDrawList* self); void ImDrawList_GetClipRectMax_nonUDT(ImVec2 *pOut,ImDrawList* self); ImVec2_Simple ImDrawList_GetClipRectMax_nonUDT2(ImDrawList* self); void ImFont_CalcTextSizeA_nonUDT(ImVec2 *pOut,ImFont* self,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining); ImVec2_Simple ImFont_CalcTextSizeA_nonUDT2(ImFont* self,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining); ImVector_float* ImVector_float_ImVector_float(void); void ImVector_float_destroy(ImVector_float* self); ImVector_ImWchar* ImVector_ImWchar_ImVector_ImWchar(void); void ImVector_ImWchar_destroy(ImVector_ImWchar* self); ImVector_ImDrawVert* ImVector_ImDrawVert_ImVector_ImDrawVert(void); void ImVector_ImDrawVert_destroy(ImVector_ImDrawVert* self); ImVector_ImFontGlyph* ImVector_ImFontGlyph_ImVector_ImFontGlyph(void); void ImVector_ImFontGlyph_destroy(ImVector_ImFontGlyph* self); ImVector_ImGuiTextRange* ImVector_ImGuiTextRange_ImVector_ImGuiTextRange(void); void ImVector_ImGuiTextRange_destroy(ImVector_ImGuiTextRange* self); ImVector_ImGuiStoragePair* ImVector_ImGuiStoragePair_ImVector_ImGuiStoragePair(void); void ImVector_ImGuiStoragePair_destroy(ImVector_ImGuiStoragePair* self); ImVector_ImDrawChannel* ImVector_ImDrawChannel_ImVector_ImDrawChannel(void); void ImVector_ImDrawChannel_destroy(ImVector_ImDrawChannel* self); ImVector_char* ImVector_char_ImVector_char(void); void ImVector_char_destroy(ImVector_char* self); ImVector_ImU32* ImVector_ImU32_ImVector_ImU32(void); void ImVector_ImU32_destroy(ImVector_ImU32* self); ImVector_ImFontAtlasCustomRect* ImVector_ImFontAtlasCustomRect_ImVector_ImFontAtlasCustomRect(void); void ImVector_ImFontAtlasCustomRect_destroy(ImVector_ImFontAtlasCustomRect* self); ImVector_ImTextureID* ImVector_ImTextureID_ImVector_ImTextureID(void); void ImVector_ImTextureID_destroy(ImVector_ImTextureID* self); ImVector_ImFontConfig* ImVector_ImFontConfig_ImVector_ImFontConfig(void); void ImVector_ImFontConfig_destroy(ImVector_ImFontConfig* self); ImVector_ImFontPtr* ImVector_ImFontPtr_ImVector_ImFontPtr(void); void ImVector_ImFontPtr_destroy(ImVector_ImFontPtr* self); ImVector_ImDrawCmd* ImVector_ImDrawCmd_ImVector_ImDrawCmd(void); void ImVector_ImDrawCmd_destroy(ImVector_ImDrawCmd* self); ImVector_ImVec4* ImVector_ImVec4_ImVector_ImVec4(void); void ImVector_ImVec4_destroy(ImVector_ImVec4* self); ImVector_ImDrawIdx* ImVector_ImDrawIdx_ImVector_ImDrawIdx(void); void ImVector_ImDrawIdx_destroy(ImVector_ImDrawIdx* self); ImVector_ImVec2* ImVector_ImVec2_ImVector_ImVec2(void); void ImVector_ImVec2_destroy(ImVector_ImVec2* self); ImVector_float* ImVector_float_ImVector_floatVector(const ImVector_float src); ImVector_ImWchar* ImVector_ImWchar_ImVector_ImWcharVector(const ImVector_ImWchar src); ImVector_ImDrawVert* ImVector_ImDrawVert_ImVector_ImDrawVertVector(const ImVector_ImDrawVert src); ImVector_ImFontGlyph* ImVector_ImFontGlyph_ImVector_ImFontGlyphVector(const ImVector_ImFontGlyph src); ImVector_ImGuiTextRange* ImVector_ImGuiTextRange_ImVector_ImGuiTextRangeVector(const ImVector_ImGuiTextRange src); ImVector_ImGuiStoragePair* ImVector_ImGuiStoragePair_ImVector_ImGuiStoragePairVector(const ImVector_ImGuiStoragePair src); ImVector_ImDrawChannel* ImVector_ImDrawChannel_ImVector_ImDrawChannelVector(const ImVector_ImDrawChannel src); ImVector_char* ImVector_char_ImVector_charVector(const ImVector_char src); ImVector_ImU32* ImVector_ImU32_ImVector_ImU32Vector(const ImVector_ImU32 src); ImVector_ImFontAtlasCustomRect* ImVector_ImFontAtlasCustomRect_ImVector_ImFontAtlasCustomRectVector(const ImVector_ImFontAtlasCustomRect src); ImVector_ImTextureID* ImVector_ImTextureID_ImVector_ImTextureIDVector(const ImVector_ImTextureID src); ImVector_ImFontConfig* ImVector_ImFontConfig_ImVector_ImFontConfigVector(const ImVector_ImFontConfig src); ImVector_ImFontPtr* ImVector_ImFontPtr_ImVector_ImFontPtrVector(const ImVector_ImFontPtr src); ImVector_ImDrawCmd* ImVector_ImDrawCmd_ImVector_ImDrawCmdVector(const ImVector_ImDrawCmd src); ImVector_ImVec4* ImVector_ImVec4_ImVector_ImVec4Vector(const ImVector_ImVec4 src); ImVector_ImDrawIdx* ImVector_ImDrawIdx_ImVector_ImDrawIdxVector(const ImVector_ImDrawIdx src); ImVector_ImVec2* ImVector_ImVec2_ImVector_ImVec2Vector(const ImVector_ImVec2 src); _Bool ImVector_float_empty(const ImVector_float* self); _Bool ImVector_ImWchar_empty(const ImVector_ImWchar* self); _Bool ImVector_ImDrawVert_empty(const ImVector_ImDrawVert* self); _Bool ImVector_ImFontGlyph_empty(const ImVector_ImFontGlyph* self); _Bool ImVector_ImGuiTextRange_empty(const ImVector_ImGuiTextRange* self); _Bool ImVector_ImGuiStoragePair_empty(const ImVector_ImGuiStoragePair* self); _Bool ImVector_ImDrawChannel_empty(const ImVector_ImDrawChannel* self); _Bool ImVector_char_empty(const ImVector_char* self); _Bool ImVector_ImU32_empty(const ImVector_ImU32* self); _Bool ImVector_ImFontAtlasCustomRect_empty(const ImVector_ImFontAtlasCustomRect* self); _Bool ImVector_ImTextureID_empty(const ImVector_ImTextureID* self); _Bool ImVector_ImFontConfig_empty(const ImVector_ImFontConfig* self); _Bool ImVector_ImFontPtr_empty(const ImVector_ImFontPtr* self); _Bool ImVector_ImDrawCmd_empty(const ImVector_ImDrawCmd* self); _Bool ImVector_ImVec4_empty(const ImVector_ImVec4* self); _Bool ImVector_ImDrawIdx_empty(const ImVector_ImDrawIdx* self); _Bool ImVector_ImVec2_empty(const ImVector_ImVec2* self); int ImVector_float_size(const ImVector_float* self); int ImVector_ImWchar_size(const ImVector_ImWchar* self); int ImVector_ImDrawVert_size(const ImVector_ImDrawVert* self); int ImVector_ImFontGlyph_size(const ImVector_ImFontGlyph* self); int ImVector_ImGuiTextRange_size(const ImVector_ImGuiTextRange* self); int ImVector_ImGuiStoragePair_size(const ImVector_ImGuiStoragePair* self); int ImVector_ImDrawChannel_size(const ImVector_ImDrawChannel* self); int ImVector_char_size(const ImVector_char* self); int ImVector_ImU32_size(const ImVector_ImU32* self); int ImVector_ImFontAtlasCustomRect_size(const ImVector_ImFontAtlasCustomRect* self); int ImVector_ImTextureID_size(const ImVector_ImTextureID* self); int ImVector_ImFontConfig_size(const ImVector_ImFontConfig* self); int ImVector_ImFontPtr_size(const ImVector_ImFontPtr* self); int ImVector_ImDrawCmd_size(const ImVector_ImDrawCmd* self); int ImVector_ImVec4_size(const ImVector_ImVec4* self); int ImVector_ImDrawIdx_size(const ImVector_ImDrawIdx* self); int ImVector_ImVec2_size(const ImVector_ImVec2* self); int ImVector_float_size_in_bytes(const ImVector_float* self); int ImVector_ImWchar_size_in_bytes(const ImVector_ImWchar* self); int ImVector_ImDrawVert_size_in_bytes(const ImVector_ImDrawVert* self); int ImVector_ImFontGlyph_size_in_bytes(const ImVector_ImFontGlyph* self); int ImVector_ImGuiTextRange_size_in_bytes(const ImVector_ImGuiTextRange* self); int ImVector_ImGuiStoragePair_size_in_bytes(const ImVector_ImGuiStoragePair* self); int ImVector_ImDrawChannel_size_in_bytes(const ImVector_ImDrawChannel* self); int ImVector_char_size_in_bytes(const ImVector_char* self); int ImVector_ImU32_size_in_bytes(const ImVector_ImU32* self); int ImVector_ImFontAtlasCustomRect_size_in_bytes(const ImVector_ImFontAtlasCustomRect* self); int ImVector_ImTextureID_size_in_bytes(const ImVector_ImTextureID* self); int ImVector_ImFontConfig_size_in_bytes(const ImVector_ImFontConfig* self); int ImVector_ImFontPtr_size_in_bytes(const ImVector_ImFontPtr* self); int ImVector_ImDrawCmd_size_in_bytes(const ImVector_ImDrawCmd* self); int ImVector_ImVec4_size_in_bytes(const ImVector_ImVec4* self); int ImVector_ImDrawIdx_size_in_bytes(const ImVector_ImDrawIdx* self); int ImVector_ImVec2_size_in_bytes(const ImVector_ImVec2* self); int ImVector_float_capacity(const ImVector_float* self); int ImVector_ImWchar_capacity(const ImVector_ImWchar* self); int ImVector_ImDrawVert_capacity(const ImVector_ImDrawVert* self); int ImVector_ImFontGlyph_capacity(const ImVector_ImFontGlyph* self); int ImVector_ImGuiTextRange_capacity(const ImVector_ImGuiTextRange* self); int ImVector_ImGuiStoragePair_capacity(const ImVector_ImGuiStoragePair* self); int ImVector_ImDrawChannel_capacity(const ImVector_ImDrawChannel* self); int ImVector_char_capacity(const ImVector_char* self); int ImVector_ImU32_capacity(const ImVector_ImU32* self); int ImVector_ImFontAtlasCustomRect_capacity(const ImVector_ImFontAtlasCustomRect* self); int ImVector_ImTextureID_capacity(const ImVector_ImTextureID* self); int ImVector_ImFontConfig_capacity(const ImVector_ImFontConfig* self); int ImVector_ImFontPtr_capacity(const ImVector_ImFontPtr* self); int ImVector_ImDrawCmd_capacity(const ImVector_ImDrawCmd* self); int ImVector_ImVec4_capacity(const ImVector_ImVec4* self); int ImVector_ImDrawIdx_capacity(const ImVector_ImDrawIdx* self); int ImVector_ImVec2_capacity(const ImVector_ImVec2* self); void ImVector_float_clear(ImVector_float* self); void ImVector_ImWchar_clear(ImVector_ImWchar* self); void ImVector_ImDrawVert_clear(ImVector_ImDrawVert* self); void ImVector_ImFontGlyph_clear(ImVector_ImFontGlyph* self); void ImVector_ImGuiTextRange_clear(ImVector_ImGuiTextRange* self); void ImVector_ImGuiStoragePair_clear(ImVector_ImGuiStoragePair* self); void ImVector_ImDrawChannel_clear(ImVector_ImDrawChannel* self); void ImVector_char_clear(ImVector_char* self); void ImVector_ImU32_clear(ImVector_ImU32* self); void ImVector_ImFontAtlasCustomRect_clear(ImVector_ImFontAtlasCustomRect* self); void ImVector_ImTextureID_clear(ImVector_ImTextureID* self); void ImVector_ImFontConfig_clear(ImVector_ImFontConfig* self); void ImVector_ImFontPtr_clear(ImVector_ImFontPtr* self); void ImVector_ImDrawCmd_clear(ImVector_ImDrawCmd* self); void ImVector_ImVec4_clear(ImVector_ImVec4* self); void ImVector_ImDrawIdx_clear(ImVector_ImDrawIdx* self); void ImVector_ImVec2_clear(ImVector_ImVec2* self); float* ImVector_float_begin(ImVector_float* self); ImWchar* ImVector_ImWchar_begin(ImVector_ImWchar* self); ImDrawVert* ImVector_ImDrawVert_begin(ImVector_ImDrawVert* self); ImFontGlyph* ImVector_ImFontGlyph_begin(ImVector_ImFontGlyph* self); ImGuiTextRange* ImVector_ImGuiTextRange_begin(ImVector_ImGuiTextRange* self); ImGuiStoragePair* ImVector_ImGuiStoragePair_begin(ImVector_ImGuiStoragePair* self); ImDrawChannel* ImVector_ImDrawChannel_begin(ImVector_ImDrawChannel* self); char* ImVector_char_begin(ImVector_char* self); ImU32* ImVector_ImU32_begin(ImVector_ImU32* self); ImFontAtlasCustomRect* ImVector_ImFontAtlasCustomRect_begin(ImVector_ImFontAtlasCustomRect* self); ImTextureID* ImVector_ImTextureID_begin(ImVector_ImTextureID* self); ImFontConfig* ImVector_ImFontConfig_begin(ImVector_ImFontConfig* self); ImFont** ImVector_ImFontPtr_begin(ImVector_ImFontPtr* self); ImDrawCmd* ImVector_ImDrawCmd_begin(ImVector_ImDrawCmd* self); ImVec4* ImVector_ImVec4_begin(ImVector_ImVec4* self); ImDrawIdx* ImVector_ImDrawIdx_begin(ImVector_ImDrawIdx* self); ImVec2* ImVector_ImVec2_begin(ImVector_ImVec2* self); float const * ImVector_float_begin_const(const ImVector_float* self); ImWchar const * ImVector_ImWchar_begin_const(const ImVector_ImWchar* self); ImDrawVert const * ImVector_ImDrawVert_begin_const(const ImVector_ImDrawVert* self); ImFontGlyph const * ImVector_ImFontGlyph_begin_const(const ImVector_ImFontGlyph* self); ImGuiTextRange const * ImVector_ImGuiTextRange_begin_const(const ImVector_ImGuiTextRange* self); ImGuiStoragePair const * ImVector_ImGuiStoragePair_begin_const(const ImVector_ImGuiStoragePair* self); ImDrawChannel const * ImVector_ImDrawChannel_begin_const(const ImVector_ImDrawChannel* self); char const * ImVector_char_begin_const(const ImVector_char* self); ImU32 const * ImVector_ImU32_begin_const(const ImVector_ImU32* self); ImFontAtlasCustomRect const * ImVector_ImFontAtlasCustomRect_begin_const(const ImVector_ImFontAtlasCustomRect* self); ImTextureID const * ImVector_ImTextureID_begin_const(const ImVector_ImTextureID* self); ImFontConfig const * ImVector_ImFontConfig_begin_const(const ImVector_ImFontConfig* self); ImFont* const * ImVector_ImFontPtr_begin_const(const ImVector_ImFontPtr* self); ImDrawCmd const * ImVector_ImDrawCmd_begin_const(const ImVector_ImDrawCmd* self); ImVec4 const * ImVector_ImVec4_begin_const(const ImVector_ImVec4* self); ImDrawIdx const * ImVector_ImDrawIdx_begin_const(const ImVector_ImDrawIdx* self); ImVec2 const * ImVector_ImVec2_begin_const(const ImVector_ImVec2* self); float* ImVector_float_end(ImVector_float* self); ImWchar* ImVector_ImWchar_end(ImVector_ImWchar* self); ImDrawVert* ImVector_ImDrawVert_end(ImVector_ImDrawVert* self); ImFontGlyph* ImVector_ImFontGlyph_end(ImVector_ImFontGlyph* self); ImGuiTextRange* ImVector_ImGuiTextRange_end(ImVector_ImGuiTextRange* self); ImGuiStoragePair* ImVector_ImGuiStoragePair_end(ImVector_ImGuiStoragePair* self); ImDrawChannel* ImVector_ImDrawChannel_end(ImVector_ImDrawChannel* self); char* ImVector_char_end(ImVector_char* self); ImU32* ImVector_ImU32_end(ImVector_ImU32* self); ImFontAtlasCustomRect* ImVector_ImFontAtlasCustomRect_end(ImVector_ImFontAtlasCustomRect* self); ImTextureID* ImVector_ImTextureID_end(ImVector_ImTextureID* self); ImFontConfig* ImVector_ImFontConfig_end(ImVector_ImFontConfig* self); ImFont** ImVector_ImFontPtr_end(ImVector_ImFontPtr* self); ImDrawCmd* ImVector_ImDrawCmd_end(ImVector_ImDrawCmd* self); ImVec4* ImVector_ImVec4_end(ImVector_ImVec4* self); ImDrawIdx* ImVector_ImDrawIdx_end(ImVector_ImDrawIdx* self); ImVec2* ImVector_ImVec2_end(ImVector_ImVec2* self); float const * ImVector_float_end_const(const ImVector_float* self); ImWchar const * ImVector_ImWchar_end_const(const ImVector_ImWchar* self); ImDrawVert const * ImVector_ImDrawVert_end_const(const ImVector_ImDrawVert* self); ImFontGlyph const * ImVector_ImFontGlyph_end_const(const ImVector_ImFontGlyph* self); ImGuiTextRange const * ImVector_ImGuiTextRange_end_const(const ImVector_ImGuiTextRange* self); ImGuiStoragePair const * ImVector_ImGuiStoragePair_end_const(const ImVector_ImGuiStoragePair* self); ImDrawChannel const * ImVector_ImDrawChannel_end_const(const ImVector_ImDrawChannel* self); char const * ImVector_char_end_const(const ImVector_char* self); ImU32 const * ImVector_ImU32_end_const(const ImVector_ImU32* self); ImFontAtlasCustomRect const * ImVector_ImFontAtlasCustomRect_end_const(const ImVector_ImFontAtlasCustomRect* self); ImTextureID const * ImVector_ImTextureID_end_const(const ImVector_ImTextureID* self); ImFontConfig const * ImVector_ImFontConfig_end_const(const ImVector_ImFontConfig* self); ImFont* const * ImVector_ImFontPtr_end_const(const ImVector_ImFontPtr* self); ImDrawCmd const * ImVector_ImDrawCmd_end_const(const ImVector_ImDrawCmd* self); ImVec4 const * ImVector_ImVec4_end_const(const ImVector_ImVec4* self); ImDrawIdx const * ImVector_ImDrawIdx_end_const(const ImVector_ImDrawIdx* self); ImVec2 const * ImVector_ImVec2_end_const(const ImVector_ImVec2* self); float* ImVector_float_front(ImVector_float* self); ImWchar* ImVector_ImWchar_front(ImVector_ImWchar* self); ImDrawVert* ImVector_ImDrawVert_front(ImVector_ImDrawVert* self); ImFontGlyph* ImVector_ImFontGlyph_front(ImVector_ImFontGlyph* self); ImGuiTextRange* ImVector_ImGuiTextRange_front(ImVector_ImGuiTextRange* self); ImGuiStoragePair* ImVector_ImGuiStoragePair_front(ImVector_ImGuiStoragePair* self); ImDrawChannel* ImVector_ImDrawChannel_front(ImVector_ImDrawChannel* self); char* ImVector_char_front(ImVector_char* self); ImU32* ImVector_ImU32_front(ImVector_ImU32* self); ImFontAtlasCustomRect* ImVector_ImFontAtlasCustomRect_front(ImVector_ImFontAtlasCustomRect* self); ImTextureID* ImVector_ImTextureID_front(ImVector_ImTextureID* self); ImFontConfig* ImVector_ImFontConfig_front(ImVector_ImFontConfig* self); ImFont** ImVector_ImFontPtr_front(ImVector_ImFontPtr* self); ImDrawCmd* ImVector_ImDrawCmd_front(ImVector_ImDrawCmd* self); ImVec4* ImVector_ImVec4_front(ImVector_ImVec4* self); ImDrawIdx* ImVector_ImDrawIdx_front(ImVector_ImDrawIdx* self); ImVec2* ImVector_ImVec2_front(ImVector_ImVec2* self); float const * ImVector_float_front_const(const ImVector_float* self); ImWchar const * ImVector_ImWchar_front_const(const ImVector_ImWchar* self); ImDrawVert const * ImVector_ImDrawVert_front_const(const ImVector_ImDrawVert* self); ImFontGlyph const * ImVector_ImFontGlyph_front_const(const ImVector_ImFontGlyph* self); ImGuiTextRange const * ImVector_ImGuiTextRange_front_const(const ImVector_ImGuiTextRange* self); ImGuiStoragePair const * ImVector_ImGuiStoragePair_front_const(const ImVector_ImGuiStoragePair* self); ImDrawChannel const * ImVector_ImDrawChannel_front_const(const ImVector_ImDrawChannel* self); char const * ImVector_char_front_const(const ImVector_char* self); ImU32 const * ImVector_ImU32_front_const(const ImVector_ImU32* self); ImFontAtlasCustomRect const * ImVector_ImFontAtlasCustomRect_front_const(const ImVector_ImFontAtlasCustomRect* self); ImTextureID const * ImVector_ImTextureID_front_const(const ImVector_ImTextureID* self); ImFontConfig const * ImVector_ImFontConfig_front_const(const ImVector_ImFontConfig* self); ImFont* const * ImVector_ImFontPtr_front_const(const ImVector_ImFontPtr* self); ImDrawCmd const * ImVector_ImDrawCmd_front_const(const ImVector_ImDrawCmd* self); ImVec4 const * ImVector_ImVec4_front_const(const ImVector_ImVec4* self); ImDrawIdx const * ImVector_ImDrawIdx_front_const(const ImVector_ImDrawIdx* self); ImVec2 const * ImVector_ImVec2_front_const(const ImVector_ImVec2* self); float* ImVector_float_back(ImVector_float* self); ImWchar* ImVector_ImWchar_back(ImVector_ImWchar* self); ImDrawVert* ImVector_ImDrawVert_back(ImVector_ImDrawVert* self); ImFontGlyph* ImVector_ImFontGlyph_back(ImVector_ImFontGlyph* self); ImGuiTextRange* ImVector_ImGuiTextRange_back(ImVector_ImGuiTextRange* self); ImGuiStoragePair* ImVector_ImGuiStoragePair_back(ImVector_ImGuiStoragePair* self); ImDrawChannel* ImVector_ImDrawChannel_back(ImVector_ImDrawChannel* self); char* ImVector_char_back(ImVector_char* self); ImU32* ImVector_ImU32_back(ImVector_ImU32* self); ImFontAtlasCustomRect* ImVector_ImFontAtlasCustomRect_back(ImVector_ImFontAtlasCustomRect* self); ImTextureID* ImVector_ImTextureID_back(ImVector_ImTextureID* self); ImFontConfig* ImVector_ImFontConfig_back(ImVector_ImFontConfig* self); ImFont** ImVector_ImFontPtr_back(ImVector_ImFontPtr* self); ImDrawCmd* ImVector_ImDrawCmd_back(ImVector_ImDrawCmd* self); ImVec4* ImVector_ImVec4_back(ImVector_ImVec4* self); ImDrawIdx* ImVector_ImDrawIdx_back(ImVector_ImDrawIdx* self); ImVec2* ImVector_ImVec2_back(ImVector_ImVec2* self); float const * ImVector_float_back_const(const ImVector_float* self); ImWchar const * ImVector_ImWchar_back_const(const ImVector_ImWchar* self); ImDrawVert const * ImVector_ImDrawVert_back_const(const ImVector_ImDrawVert* self); ImFontGlyph const * ImVector_ImFontGlyph_back_const(const ImVector_ImFontGlyph* self); ImGuiTextRange const * ImVector_ImGuiTextRange_back_const(const ImVector_ImGuiTextRange* self); ImGuiStoragePair const * ImVector_ImGuiStoragePair_back_const(const ImVector_ImGuiStoragePair* self); ImDrawChannel const * ImVector_ImDrawChannel_back_const(const ImVector_ImDrawChannel* self); char const * ImVector_char_back_const(const ImVector_char* self); ImU32 const * ImVector_ImU32_back_const(const ImVector_ImU32* self); ImFontAtlasCustomRect const * ImVector_ImFontAtlasCustomRect_back_const(const ImVector_ImFontAtlasCustomRect* self); ImTextureID const * ImVector_ImTextureID_back_const(const ImVector_ImTextureID* self); ImFontConfig const * ImVector_ImFontConfig_back_const(const ImVector_ImFontConfig* self); ImFont* const * ImVector_ImFontPtr_back_const(const ImVector_ImFontPtr* self); ImDrawCmd const * ImVector_ImDrawCmd_back_const(const ImVector_ImDrawCmd* self); ImVec4 const * ImVector_ImVec4_back_const(const ImVector_ImVec4* self); ImDrawIdx const * ImVector_ImDrawIdx_back_const(const ImVector_ImDrawIdx* self); ImVec2 const * ImVector_ImVec2_back_const(const ImVector_ImVec2* self); void ImVector_float_swap(ImVector_float* self,ImVector_float rhs); void ImVector_ImWchar_swap(ImVector_ImWchar* self,ImVector_ImWchar rhs); void ImVector_ImDrawVert_swap(ImVector_ImDrawVert* self,ImVector_ImDrawVert rhs); void ImVector_ImFontGlyph_swap(ImVector_ImFontGlyph* self,ImVector_ImFontGlyph rhs); void ImVector_ImGuiTextRange_swap(ImVector_ImGuiTextRange* self,ImVector_ImGuiTextRange rhs); void ImVector_ImGuiStoragePair_swap(ImVector_ImGuiStoragePair* self,ImVector_ImGuiStoragePair rhs); void ImVector_ImDrawChannel_swap(ImVector_ImDrawChannel* self,ImVector_ImDrawChannel rhs); void ImVector_char_swap(ImVector_char* self,ImVector_char rhs); void ImVector_ImU32_swap(ImVector_ImU32* self,ImVector_ImU32 rhs); void ImVector_ImFontAtlasCustomRect_swap(ImVector_ImFontAtlasCustomRect* self,ImVector_ImFontAtlasCustomRect rhs); void ImVector_ImTextureID_swap(ImVector_ImTextureID* self,ImVector_ImTextureID rhs); void ImVector_ImFontConfig_swap(ImVector_ImFontConfig* self,ImVector_ImFontConfig rhs); void ImVector_ImFontPtr_swap(ImVector_ImFontPtr* self,ImVector_ImFontPtr rhs); void ImVector_ImDrawCmd_swap(ImVector_ImDrawCmd* self,ImVector_ImDrawCmd rhs); void ImVector_ImVec4_swap(ImVector_ImVec4* self,ImVector_ImVec4 rhs); void ImVector_ImDrawIdx_swap(ImVector_ImDrawIdx* self,ImVector_ImDrawIdx rhs); void ImVector_ImVec2_swap(ImVector_ImVec2* self,ImVector_ImVec2 rhs); int ImVector_float__grow_capacity(const ImVector_float* self,int sz); int ImVector_ImWchar__grow_capacity(const ImVector_ImWchar* self,int sz); int ImVector_ImDrawVert__grow_capacity(const ImVector_ImDrawVert* self,int sz); int ImVector_ImFontGlyph__grow_capacity(const ImVector_ImFontGlyph* self,int sz); int ImVector_ImGuiTextRange__grow_capacity(const ImVector_ImGuiTextRange* self,int sz); int ImVector_ImGuiStoragePair__grow_capacity(const ImVector_ImGuiStoragePair* self,int sz); int ImVector_ImDrawChannel__grow_capacity(const ImVector_ImDrawChannel* self,int sz); int ImVector_char__grow_capacity(const ImVector_char* self,int sz); int ImVector_ImU32__grow_capacity(const ImVector_ImU32* self,int sz); int ImVector_ImFontAtlasCustomRect__grow_capacity(const ImVector_ImFontAtlasCustomRect* self,int sz); int ImVector_ImTextureID__grow_capacity(const ImVector_ImTextureID* self,int sz); int ImVector_ImFontConfig__grow_capacity(const ImVector_ImFontConfig* self,int sz); int ImVector_ImFontPtr__grow_capacity(const ImVector_ImFontPtr* self,int sz); int ImVector_ImDrawCmd__grow_capacity(const ImVector_ImDrawCmd* self,int sz); int ImVector_ImVec4__grow_capacity(const ImVector_ImVec4* self,int sz); int ImVector_ImDrawIdx__grow_capacity(const ImVector_ImDrawIdx* self,int sz); int ImVector_ImVec2__grow_capacity(const ImVector_ImVec2* self,int sz); void ImVector_float_resize(ImVector_float* self,int new_size); void ImVector_ImWchar_resize(ImVector_ImWchar* self,int new_size); void ImVector_ImDrawVert_resize(ImVector_ImDrawVert* self,int new_size); void ImVector_ImFontGlyph_resize(ImVector_ImFontGlyph* self,int new_size); void ImVector_ImGuiTextRange_resize(ImVector_ImGuiTextRange* self,int new_size); void ImVector_ImGuiStoragePair_resize(ImVector_ImGuiStoragePair* self,int new_size); void ImVector_ImDrawChannel_resize(ImVector_ImDrawChannel* self,int new_size); void ImVector_char_resize(ImVector_char* self,int new_size); void ImVector_ImU32_resize(ImVector_ImU32* self,int new_size); void ImVector_ImFontAtlasCustomRect_resize(ImVector_ImFontAtlasCustomRect* self,int new_size); void ImVector_ImTextureID_resize(ImVector_ImTextureID* self,int new_size); void ImVector_ImFontConfig_resize(ImVector_ImFontConfig* self,int new_size); void ImVector_ImFontPtr_resize(ImVector_ImFontPtr* self,int new_size); void ImVector_ImDrawCmd_resize(ImVector_ImDrawCmd* self,int new_size); void ImVector_ImVec4_resize(ImVector_ImVec4* self,int new_size); void ImVector_ImDrawIdx_resize(ImVector_ImDrawIdx* self,int new_size); void ImVector_ImVec2_resize(ImVector_ImVec2* self,int new_size); void ImVector_float_resizeT(ImVector_float* self,int new_size,const float v); void ImVector_ImWchar_resizeT(ImVector_ImWchar* self,int new_size,const ImWchar v); void ImVector_ImDrawVert_resizeT(ImVector_ImDrawVert* self,int new_size,const ImDrawVert v); void ImVector_ImFontGlyph_resizeT(ImVector_ImFontGlyph* self,int new_size,const ImFontGlyph v); void ImVector_ImGuiTextRange_resizeT(ImVector_ImGuiTextRange* self,int new_size,const ImGuiTextRange v); void ImVector_ImGuiStoragePair_resizeT(ImVector_ImGuiStoragePair* self,int new_size,const ImGuiStoragePair v); void ImVector_ImDrawChannel_resizeT(ImVector_ImDrawChannel* self,int new_size,const ImDrawChannel v); void ImVector_char_resizeT(ImVector_char* self,int new_size,const char v); void ImVector_ImU32_resizeT(ImVector_ImU32* self,int new_size,const ImU32 v); void ImVector_ImFontAtlasCustomRect_resizeT(ImVector_ImFontAtlasCustomRect* self,int new_size,const ImFontAtlasCustomRect v); void ImVector_ImTextureID_resizeT(ImVector_ImTextureID* self,int new_size,const ImTextureID v); void ImVector_ImFontConfig_resizeT(ImVector_ImFontConfig* self,int new_size,const ImFontConfig v); void ImVector_ImFontPtr_resizeT(ImVector_ImFontPtr* self,int new_size,ImFont* const v); void ImVector_ImDrawCmd_resizeT(ImVector_ImDrawCmd* self,int new_size,const ImDrawCmd v); void ImVector_ImVec4_resizeT(ImVector_ImVec4* self,int new_size,const ImVec4 v); void ImVector_ImDrawIdx_resizeT(ImVector_ImDrawIdx* self,int new_size,const ImDrawIdx v); void ImVector_ImVec2_resizeT(ImVector_ImVec2* self,int new_size,const ImVec2 v); void ImVector_float_reserve(ImVector_float* self,int new_capacity); void ImVector_ImWchar_reserve(ImVector_ImWchar* self,int new_capacity); void ImVector_ImDrawVert_reserve(ImVector_ImDrawVert* self,int new_capacity); void ImVector_ImFontGlyph_reserve(ImVector_ImFontGlyph* self,int new_capacity); void ImVector_ImGuiTextRange_reserve(ImVector_ImGuiTextRange* self,int new_capacity); void ImVector_ImGuiStoragePair_reserve(ImVector_ImGuiStoragePair* self,int new_capacity); void ImVector_ImDrawChannel_reserve(ImVector_ImDrawChannel* self,int new_capacity); void ImVector_char_reserve(ImVector_char* self,int new_capacity); void ImVector_ImU32_reserve(ImVector_ImU32* self,int new_capacity); void ImVector_ImFontAtlasCustomRect_reserve(ImVector_ImFontAtlasCustomRect* self,int new_capacity); void ImVector_ImTextureID_reserve(ImVector_ImTextureID* self,int new_capacity); void ImVector_ImFontConfig_reserve(ImVector_ImFontConfig* self,int new_capacity); void ImVector_ImFontPtr_reserve(ImVector_ImFontPtr* self,int new_capacity); void ImVector_ImDrawCmd_reserve(ImVector_ImDrawCmd* self,int new_capacity); void ImVector_ImVec4_reserve(ImVector_ImVec4* self,int new_capacity); void ImVector_ImDrawIdx_reserve(ImVector_ImDrawIdx* self,int new_capacity); void ImVector_ImVec2_reserve(ImVector_ImVec2* self,int new_capacity); void ImVector_float_push_back(ImVector_float* self,const float v); void ImVector_ImWchar_push_back(ImVector_ImWchar* self,const ImWchar v); void ImVector_ImDrawVert_push_back(ImVector_ImDrawVert* self,const ImDrawVert v); void ImVector_ImFontGlyph_push_back(ImVector_ImFontGlyph* self,const ImFontGlyph v); void ImVector_ImGuiTextRange_push_back(ImVector_ImGuiTextRange* self,const ImGuiTextRange v); void ImVector_ImGuiStoragePair_push_back(ImVector_ImGuiStoragePair* self,const ImGuiStoragePair v); void ImVector_ImDrawChannel_push_back(ImVector_ImDrawChannel* self,const ImDrawChannel v); void ImVector_char_push_back(ImVector_char* self,const char v); void ImVector_ImU32_push_back(ImVector_ImU32* self,const ImU32 v); void ImVector_ImFontAtlasCustomRect_push_back(ImVector_ImFontAtlasCustomRect* self,const ImFontAtlasCustomRect v); void ImVector_ImTextureID_push_back(ImVector_ImTextureID* self,const ImTextureID v); void ImVector_ImFontConfig_push_back(ImVector_ImFontConfig* self,const ImFontConfig v); void ImVector_ImFontPtr_push_back(ImVector_ImFontPtr* self,ImFont* const v); void ImVector_ImDrawCmd_push_back(ImVector_ImDrawCmd* self,const ImDrawCmd v); void ImVector_ImVec4_push_back(ImVector_ImVec4* self,const ImVec4 v); void ImVector_ImDrawIdx_push_back(ImVector_ImDrawIdx* self,const ImDrawIdx v); void ImVector_ImVec2_push_back(ImVector_ImVec2* self,const ImVec2 v); void ImVector_float_pop_back(ImVector_float* self); void ImVector_ImWchar_pop_back(ImVector_ImWchar* self); void ImVector_ImDrawVert_pop_back(ImVector_ImDrawVert* self); void ImVector_ImFontGlyph_pop_back(ImVector_ImFontGlyph* self); void ImVector_ImGuiTextRange_pop_back(ImVector_ImGuiTextRange* self); void ImVector_ImGuiStoragePair_pop_back(ImVector_ImGuiStoragePair* self); void ImVector_ImDrawChannel_pop_back(ImVector_ImDrawChannel* self); void ImVector_char_pop_back(ImVector_char* self); void ImVector_ImU32_pop_back(ImVector_ImU32* self); void ImVector_ImFontAtlasCustomRect_pop_back(ImVector_ImFontAtlasCustomRect* self); void ImVector_ImTextureID_pop_back(ImVector_ImTextureID* self); void ImVector_ImFontConfig_pop_back(ImVector_ImFontConfig* self); void ImVector_ImFontPtr_pop_back(ImVector_ImFontPtr* self); void ImVector_ImDrawCmd_pop_back(ImVector_ImDrawCmd* self); void ImVector_ImVec4_pop_back(ImVector_ImVec4* self); void ImVector_ImDrawIdx_pop_back(ImVector_ImDrawIdx* self); void ImVector_ImVec2_pop_back(ImVector_ImVec2* self); void ImVector_float_push_front(ImVector_float* self,const float v); void ImVector_ImWchar_push_front(ImVector_ImWchar* self,const ImWchar v); void ImVector_ImDrawVert_push_front(ImVector_ImDrawVert* self,const ImDrawVert v); void ImVector_ImFontGlyph_push_front(ImVector_ImFontGlyph* self,const ImFontGlyph v); void ImVector_ImGuiTextRange_push_front(ImVector_ImGuiTextRange* self,const ImGuiTextRange v); void ImVector_ImGuiStoragePair_push_front(ImVector_ImGuiStoragePair* self,const ImGuiStoragePair v); void ImVector_ImDrawChannel_push_front(ImVector_ImDrawChannel* self,const ImDrawChannel v); void ImVector_char_push_front(ImVector_char* self,const char v); void ImVector_ImU32_push_front(ImVector_ImU32* self,const ImU32 v); void ImVector_ImFontAtlasCustomRect_push_front(ImVector_ImFontAtlasCustomRect* self,const ImFontAtlasCustomRect v); void ImVector_ImTextureID_push_front(ImVector_ImTextureID* self,const ImTextureID v); void ImVector_ImFontConfig_push_front(ImVector_ImFontConfig* self,const ImFontConfig v); void ImVector_ImFontPtr_push_front(ImVector_ImFontPtr* self,ImFont* const v); void ImVector_ImDrawCmd_push_front(ImVector_ImDrawCmd* self,const ImDrawCmd v); void ImVector_ImVec4_push_front(ImVector_ImVec4* self,const ImVec4 v); void ImVector_ImDrawIdx_push_front(ImVector_ImDrawIdx* self,const ImDrawIdx v); void ImVector_ImVec2_push_front(ImVector_ImVec2* self,const ImVec2 v); float* ImVector_float_erase(ImVector_float* self,float const * it); ImWchar* ImVector_ImWchar_erase(ImVector_ImWchar* self,ImWchar const * it); ImDrawVert* ImVector_ImDrawVert_erase(ImVector_ImDrawVert* self,ImDrawVert const * it); ImFontGlyph* ImVector_ImFontGlyph_erase(ImVector_ImFontGlyph* self,ImFontGlyph const * it); ImGuiTextRange* ImVector_ImGuiTextRange_erase(ImVector_ImGuiTextRange* self,ImGuiTextRange const * it); ImGuiStoragePair* ImVector_ImGuiStoragePair_erase(ImVector_ImGuiStoragePair* self,ImGuiStoragePair const * it); ImDrawChannel* ImVector_ImDrawChannel_erase(ImVector_ImDrawChannel* self,ImDrawChannel const * it); char* ImVector_char_erase(ImVector_char* self,char const * it); ImU32* ImVector_ImU32_erase(ImVector_ImU32* self,ImU32 const * it); ImFontAtlasCustomRect* ImVector_ImFontAtlasCustomRect_erase(ImVector_ImFontAtlasCustomRect* self,ImFontAtlasCustomRect const * it); ImTextureID* ImVector_ImTextureID_erase(ImVector_ImTextureID* self,ImTextureID const * it); ImFontConfig* ImVector_ImFontConfig_erase(ImVector_ImFontConfig* self,ImFontConfig const * it); ImFont** ImVector_ImFontPtr_erase(ImVector_ImFontPtr* self,ImFont* const * it); ImDrawCmd* ImVector_ImDrawCmd_erase(ImVector_ImDrawCmd* self,ImDrawCmd const * it); ImVec4* ImVector_ImVec4_erase(ImVector_ImVec4* self,ImVec4 const * it); ImDrawIdx* ImVector_ImDrawIdx_erase(ImVector_ImDrawIdx* self,ImDrawIdx const * it); ImVec2* ImVector_ImVec2_erase(ImVector_ImVec2* self,ImVec2 const * it); float* ImVector_float_eraseTPtr(ImVector_float* self,float const * it,float const * it_last); ImWchar* ImVector_ImWchar_eraseTPtr(ImVector_ImWchar* self,ImWchar const * it,ImWchar const * it_last); ImDrawVert* ImVector_ImDrawVert_eraseTPtr(ImVector_ImDrawVert* self,ImDrawVert const * it,ImDrawVert const * it_last); ImFontGlyph* ImVector_ImFontGlyph_eraseTPtr(ImVector_ImFontGlyph* self,ImFontGlyph const * it,ImFontGlyph const * it_last); ImGuiTextRange* ImVector_ImGuiTextRange_eraseTPtr(ImVector_ImGuiTextRange* self,ImGuiTextRange const * it,ImGuiTextRange const * it_last); ImGuiStoragePair* ImVector_ImGuiStoragePair_eraseTPtr(ImVector_ImGuiStoragePair* self,ImGuiStoragePair const * it,ImGuiStoragePair const * it_last); ImDrawChannel* ImVector_ImDrawChannel_eraseTPtr(ImVector_ImDrawChannel* self,ImDrawChannel const * it,ImDrawChannel const * it_last); char* ImVector_char_eraseTPtr(ImVector_char* self,char const * it,char const * it_last); ImU32* ImVector_ImU32_eraseTPtr(ImVector_ImU32* self,ImU32 const * it,ImU32 const * it_last); ImFontAtlasCustomRect* ImVector_ImFontAtlasCustomRect_eraseTPtr(ImVector_ImFontAtlasCustomRect* self,ImFontAtlasCustomRect const * it,ImFontAtlasCustomRect const * it_last); ImTextureID* ImVector_ImTextureID_eraseTPtr(ImVector_ImTextureID* self,ImTextureID const * it,ImTextureID const * it_last); ImFontConfig* ImVector_ImFontConfig_eraseTPtr(ImVector_ImFontConfig* self,ImFontConfig const * it,ImFontConfig const * it_last); ImFont** ImVector_ImFontPtr_eraseTPtr(ImVector_ImFontPtr* self,ImFont* const * it,ImFont* const * it_last); ImDrawCmd* ImVector_ImDrawCmd_eraseTPtr(ImVector_ImDrawCmd* self,ImDrawCmd const * it,ImDrawCmd const * it_last); ImVec4* ImVector_ImVec4_eraseTPtr(ImVector_ImVec4* self,ImVec4 const * it,ImVec4 const * it_last); ImDrawIdx* ImVector_ImDrawIdx_eraseTPtr(ImVector_ImDrawIdx* self,ImDrawIdx const * it,ImDrawIdx const * it_last); ImVec2* ImVector_ImVec2_eraseTPtr(ImVector_ImVec2* self,ImVec2 const * it,ImVec2 const * it_last); float* ImVector_float_erase_unsorted(ImVector_float* self,float const * it); ImWchar* ImVector_ImWchar_erase_unsorted(ImVector_ImWchar* self,ImWchar const * it); ImDrawVert* ImVector_ImDrawVert_erase_unsorted(ImVector_ImDrawVert* self,ImDrawVert const * it); ImFontGlyph* ImVector_ImFontGlyph_erase_unsorted(ImVector_ImFontGlyph* self,ImFontGlyph const * it); ImGuiTextRange* ImVector_ImGuiTextRange_erase_unsorted(ImVector_ImGuiTextRange* self,ImGuiTextRange const * it); ImGuiStoragePair* ImVector_ImGuiStoragePair_erase_unsorted(ImVector_ImGuiStoragePair* self,ImGuiStoragePair const * it); ImDrawChannel* ImVector_ImDrawChannel_erase_unsorted(ImVector_ImDrawChannel* self,ImDrawChannel const * it); char* ImVector_char_erase_unsorted(ImVector_char* self,char const * it); ImU32* ImVector_ImU32_erase_unsorted(ImVector_ImU32* self,ImU32 const * it); ImFontAtlasCustomRect* ImVector_ImFontAtlasCustomRect_erase_unsorted(ImVector_ImFontAtlasCustomRect* self,ImFontAtlasCustomRect const * it); ImTextureID* ImVector_ImTextureID_erase_unsorted(ImVector_ImTextureID* self,ImTextureID const * it); ImFontConfig* ImVector_ImFontConfig_erase_unsorted(ImVector_ImFontConfig* self,ImFontConfig const * it); ImFont** ImVector_ImFontPtr_erase_unsorted(ImVector_ImFontPtr* self,ImFont* const * it); ImDrawCmd* ImVector_ImDrawCmd_erase_unsorted(ImVector_ImDrawCmd* self,ImDrawCmd const * it); ImVec4* ImVector_ImVec4_erase_unsorted(ImVector_ImVec4* self,ImVec4 const * it); ImDrawIdx* ImVector_ImDrawIdx_erase_unsorted(ImVector_ImDrawIdx* self,ImDrawIdx const * it); ImVec2* ImVector_ImVec2_erase_unsorted(ImVector_ImVec2* self,ImVec2 const * it); float* ImVector_float_insert(ImVector_float* self,float const * it,const float v); ImWchar* ImVector_ImWchar_insert(ImVector_ImWchar* self,ImWchar const * it,const ImWchar v); ImDrawVert* ImVector_ImDrawVert_insert(ImVector_ImDrawVert* self,ImDrawVert const * it,const ImDrawVert v); ImFontGlyph* ImVector_ImFontGlyph_insert(ImVector_ImFontGlyph* self,ImFontGlyph const * it,const ImFontGlyph v); ImGuiTextRange* ImVector_ImGuiTextRange_insert(ImVector_ImGuiTextRange* self,ImGuiTextRange const * it,const ImGuiTextRange v); ImGuiStoragePair* ImVector_ImGuiStoragePair_insert(ImVector_ImGuiStoragePair* self,ImGuiStoragePair const * it,const ImGuiStoragePair v); ImDrawChannel* ImVector_ImDrawChannel_insert(ImVector_ImDrawChannel* self,ImDrawChannel const * it,const ImDrawChannel v); char* ImVector_char_insert(ImVector_char* self,char const * it,const char v); ImU32* ImVector_ImU32_insert(ImVector_ImU32* self,ImU32 const * it,const ImU32 v); ImFontAtlasCustomRect* ImVector_ImFontAtlasCustomRect_insert(ImVector_ImFontAtlasCustomRect* self,ImFontAtlasCustomRect const * it,const ImFontAtlasCustomRect v); ImTextureID* ImVector_ImTextureID_insert(ImVector_ImTextureID* self,ImTextureID const * it,const ImTextureID v); ImFontConfig* ImVector_ImFontConfig_insert(ImVector_ImFontConfig* self,ImFontConfig const * it,const ImFontConfig v); ImFont** ImVector_ImFontPtr_insert(ImVector_ImFontPtr* self,ImFont* const * it,ImFont* const v); ImDrawCmd* ImVector_ImDrawCmd_insert(ImVector_ImDrawCmd* self,ImDrawCmd const * it,const ImDrawCmd v); ImVec4* ImVector_ImVec4_insert(ImVector_ImVec4* self,ImVec4 const * it,const ImVec4 v); ImDrawIdx* ImVector_ImDrawIdx_insert(ImVector_ImDrawIdx* self,ImDrawIdx const * it,const ImDrawIdx v); ImVec2* ImVector_ImVec2_insert(ImVector_ImVec2* self,ImVec2 const * it,const ImVec2 v); _Bool ImVector_float_contains(const ImVector_float* self,const float v); _Bool ImVector_ImWchar_contains(const ImVector_ImWchar* self,const ImWchar v); _Bool ImVector_char_contains(const ImVector_char* self,const char v); int ImVector_float_index_from_ptr(const ImVector_float* self,float const * it); int ImVector_ImWchar_index_from_ptr(const ImVector_ImWchar* self,ImWchar const * it); int ImVector_ImDrawVert_index_from_ptr(const ImVector_ImDrawVert* self,ImDrawVert const * it); int ImVector_ImFontGlyph_index_from_ptr(const ImVector_ImFontGlyph* self,ImFontGlyph const * it); int ImVector_ImGuiTextRange_index_from_ptr(const ImVector_ImGuiTextRange* self,ImGuiTextRange const * it); int ImVector_ImGuiStoragePair_index_from_ptr(const ImVector_ImGuiStoragePair* self,ImGuiStoragePair const * it); int ImVector_ImDrawChannel_index_from_ptr(const ImVector_ImDrawChannel* self,ImDrawChannel const * it); int ImVector_char_index_from_ptr(const ImVector_char* self,char const * it); int ImVector_ImU32_index_from_ptr(const ImVector_ImU32* self,ImU32 const * it); int ImVector_ImFontAtlasCustomRect_index_from_ptr(const ImVector_ImFontAtlasCustomRect* self,ImFontAtlasCustomRect const * it); int ImVector_ImTextureID_index_from_ptr(const ImVector_ImTextureID* self,ImTextureID const * it); int ImVector_ImFontConfig_index_from_ptr(const ImVector_ImFontConfig* self,ImFontConfig const * it); int ImVector_ImFontPtr_index_from_ptr(const ImVector_ImFontPtr* self,ImFont* const * it); int ImVector_ImDrawCmd_index_from_ptr(const ImVector_ImDrawCmd* self,ImDrawCmd const * it); int ImVector_ImVec4_index_from_ptr(const ImVector_ImVec4* self,ImVec4 const * it); int ImVector_ImDrawIdx_index_from_ptr(const ImVector_ImDrawIdx* self,ImDrawIdx const * it); int ImVector_ImVec2_index_from_ptr(const ImVector_ImVec2* self,ImVec2 const * it); void igLogText(const char *fmt, ...); void ImGuiTextBuffer_appendf(struct ImGuiTextBuffer *buffer, const char *fmt, ...); float igGET_FLT_MAX(); void igColorConvertRGBtoHSV(float r,float g,float b,float *out_h,float *out_s,float *out_v); void igColorConvertHSVtoRGB(float h,float s,float v,float *out_r,float *out_g,float *out_b); ImVector_ImWchar* ImVector_ImWchar_create(); void ImVector_ImWchar_Init(ImVector_ImWchar* p); void ImVector_ImWchar_UnInit(ImVector_ImWchar* p); ]] --[[ END AUTOGENERATED SEGMENT ]] local cdecl = cdecl or '' cdecl = cdecl..[[ // Helpers: UTF-8 <> wchar int igImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end); // return output UTF-8 bytes count int igImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end); // return input UTF-8 bytes count int igImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const char* in_text_end, const char** in_remaining); // return input UTF-8 bytes count int igImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end); // return number of UTF-8 code-points (NOT bytes count) int igImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end); // return number of bytes to express string as UTF-8 code-points ]] return cdecl
local S = skins.S unified_inventory.register_page("skins", { get_formspec = function(player) local skin = skins.get_player_skin(player) local formspec = "background[0.06,0.99;7.92,7.52;ui_misc_form.png]"..skins.get_skin_info_formspec(skin).. "button[.75,3;6.5,.5;skins_page;"..S("Change").."]" return {formspec=formspec} end, }) unified_inventory.register_button("skins", { type = "image", image = "skins_button.png", }) local function get_formspec(player) local context = skins.get_formspec_context(player) local formspec = "background[0.06,0.99;7.92,7.52;ui_misc_form.png]".. skins.get_skin_selection_formspec(player, context, -0.2) return formspec end unified_inventory.register_page("skins_page", { get_formspec = function(player) return {formspec=get_formspec(player)} end }) -- click button handlers minetest.register_on_player_receive_fields(function(player, formname, fields) if fields.skins then unified_inventory.set_inventory_formspec(player, "craft") return end if formname ~= "" then return end local context = skins.get_formspec_context(player) local action = skins.on_skin_selection_receive_fields(player, context, fields) if action == 'set' then unified_inventory.set_inventory_formspec(player, "skins") elseif action == 'page' then unified_inventory.set_inventory_formspec(player, "skins_page") end end)
local VarDigits, VarStartDigits, Keywords, ExtGlobals, CreateLuaParser, AddVariableInfo, FoldConstants, StripAst, FormatAst, PrintAst do local lookData = require('lookups') local minify = require('minify') VarDigits = lookData.AllIdentChars VarStartDigits = lookData.AllIdentStartChars Keywords = lookData.Keywords ExtGlobals = lookData.GlobalRenameIgnore CreateLuaParser = minify.CreateLuaParser AddVariableInfo = minify.AddVariableInfo FoldConstants = minify.FoldConstants StripAst = minify.StripAst FormatAst = minify.FormatAst PrintAst = minify.PrintAst end local function indexToVarName(index) local id = '' local vd = index % #VarStartDigits index = (index - vd) / #VarStartDigits id = id .. VarStartDigits[vd + 1] while index > 0 do local d = index % #VarDigits index = (index - d) / #VarDigits id = id .. VarDigits[d + 1] end return id end local function MinifyVariables(globalScope, rootScope) -- externalGlobals is a set of global variables that have not been assigned to, that is -- global variables defined "externally to the script". We are not going to be renaming -- those, and we have to make sure that we don't collide with them when renaming -- things so we keep track of them in this set. local externalGlobals = {} for _, var in pairs(ExtGlobals) do externalGlobals[var] = true end -- First we want to rename all of the variables to unique temoraries, so that we can -- easily use the scope::GetVar function to check whether renames are valid. local temporaryIndex = 0 for _, var in pairs(globalScope) do if var.AssignedTo then var:Rename('_TMP_' .. temporaryIndex .. '_') temporaryIndex = temporaryIndex + 1 else -- Not assigned to, external global externalGlobals[var.Name] = true end end -- Now we go through renaming, first do globals, we probably want them -- to have shorter names in general. -- TODO: Rename all vars based on frequency patterns, giving variables -- used more shorter names. local nextFreeNameIndex = 0 for _, var in pairs(globalScope) do if var.AssignedTo then local varName repeat varName = indexToVarName(nextFreeNameIndex) nextFreeNameIndex = nextFreeNameIndex + 1 until not Keywords[varName] and not externalGlobals[varName] var:Rename(varName) end end -- Now rename all local vars rootScope.FirstFreeName = nextFreeNameIndex local function doRenameScope(scope) for _, var in pairs(scope.VariableList) do local varName repeat varName = indexToVarName(scope.FirstFreeName) scope.FirstFreeName = scope.FirstFreeName + 1 until not Keywords[varName] and not externalGlobals[varName] var:Rename(varName) end for _, childScope in pairs(scope.ChildScopeList) do childScope.FirstFreeName = scope.FirstFreeName doRenameScope(childScope) end end doRenameScope(rootScope) end local function MinifyVariables_2(globalScope, rootScope) -- Variable names and other names that are fixed, that we cannot use -- Either these are Lua keywords, or globals that are not assigned to, -- that is environmental globals that are assigned elsewhere beyond our -- control. local globalUsedNames = {} for kw, _ in pairs(Keywords) do globalUsedNames[kw] = true end -- Gather a list of all of the variables that we will rename local allVariables = {} local allLocalVariables = {} do -- Add applicable globals for _, var in pairs(globalScope) do if var.AssignedTo then -- We can try to rename this global since it was assigned to -- (and thus presumably initialized) in the script we are -- minifying. table.insert(allVariables, var) else -- We can't rename this global, mark it as an unusable name -- and don't add it to the nename list globalUsedNames[var.Name] = true end end -- Recursively add locals, we can rename all of those local function addFrom(scope) for _, var in pairs(scope.VariableList) do table.insert(allVariables, var) table.insert(allLocalVariables, var) end for _, childScope in pairs(scope.ChildScopeList) do addFrom(childScope) end end addFrom(rootScope) end -- Add used name arrays to variables for _, var in pairs(allVariables) do var.UsedNameArray = {} end -- Sort the least used variables first table.sort( allVariables, function(a, b) return #a.RenameList < #b.RenameList end ) -- Lazy generator for valid names to rename to local nextValidNameIndex = 0 local varNamesLazy = {} local function varIndexToValidVarName(i) local name = varNamesLazy[i] if not name then repeat name = indexToVarName(nextValidNameIndex) nextValidNameIndex = nextValidNameIndex + 1 until not globalUsedNames[name] varNamesLazy[i] = name end return name end -- For each variable, go to rename it for _, var in pairs(allVariables) do -- Lazy... todo: Make theis pair a proper for-each-pair-like set of loops -- rather than using a renamed flag. var.Renamed = true -- Find the first unused name local i = 1 while var.UsedNameArray[i] do i = i + 1 end -- Rename the variable to that name var:Rename(varIndexToValidVarName(i)) if var.Scope then -- Now we need to mark the name as unusable by any variables: -- 1) At the same depth that overlap lifetime with this one -- 2) At a deeper level, which have a reference to this variable in their lifetimes -- 3) At a shallower level, which are referenced during this variable's lifetime for _, otherVar in pairs(allVariables) do if not otherVar.Renamed then if not otherVar.Scope or otherVar.Scope.Depth < var.Scope.Depth then -- Check Global variable (Which is always at a shallower level) -- or -- Check case 3 -- The other var is at a shallower depth, is there a reference to it -- durring this variable's lifetime? for _, refAt in pairs(otherVar.ReferenceLocationList) do if refAt >= var.BeginLocation and refAt <= var.ScopeEndLocation then -- Collide otherVar.UsedNameArray[i] = true break end end elseif otherVar.Scope.Depth > var.Scope.Depth then -- Check Case 2 -- The other var is at a greater depth, see if any of the references -- to this variable are in the other var's lifetime. for _, refAt in pairs(var.ReferenceLocationList) do if refAt >= otherVar.BeginLocation and refAt <= otherVar.ScopeEndLocation then -- Collide otherVar.UsedNameArray[i] = true break end end else --otherVar.Scope.Depth must be equal to var.Scope.Depth -- Check case 1 -- The two locals are in the same scope -- Just check if the usage lifetimes overlap within that scope. That is, we -- can shadow a local variable within the same scope as long as the usages -- of the two locals do not overlap. if var.BeginLocation < otherVar.EndLocation and var.EndLocation > otherVar.BeginLocation then otherVar.UsedNameArray[i] = true end end end end else -- This is a global var, all other globals can't collide with it, and -- any local variable with a reference to this global in it's lifetime -- can't collide with it. for _, otherVar in pairs(allVariables) do if not otherVar.Renamed then if otherVar.Type == 'Global' then otherVar.UsedNameArray[i] = true elseif otherVar.Type == 'Local' then -- Other var is a local, see if there is a reference to this global within -- that local's lifetime. for _, refAt in pairs(var.ReferenceLocationList) do if refAt >= otherVar.BeginLocation and refAt <= otherVar.ScopeEndLocation then -- Collide otherVar.UsedNameArray[i] = true break end end else assert(false, 'unreachable') end end end end end -- -- -- print("Total Variables: "..#allVariables) -- print("Total Range: "..rootScope.BeginLocation.."-"..rootScope.EndLocation) -- print("") -- for _, var in pairs(allVariables) do -- io.write("`"..var.Name.."':\n\t#symbols: "..#var.RenameList.. -- "\n\tassigned to: "..tostring(var.AssignedTo)) -- if var.Type == 'Local' then -- io.write("\n\trange: "..var.BeginLocation.."-"..var.EndLocation) -- io.write("\n\tlocal type: "..var.Info.Type) -- end -- io.write("\n\n") -- end -- -- First we want to rename all of the variables to unique temoraries, so that we can -- -- easily use the scope::GetVar function to check whether renames are valid. -- local temporaryIndex = 0 -- for _, var in pairs(allVariables) do -- var:Rename('_TMP_'..temporaryIndex..'_') -- temporaryIndex = temporaryIndex + 1 -- end -- For each variable, we need to build a list of names that collide with it -- --error() end local function BeautifyVariables(globalScope, rootScope) local externalGlobals = {} for _, var in pairs(globalScope) do if not var.AssignedTo then externalGlobals[var.Name] = true end end local localNumber = 1 local globalNumber = 1 local function setVarName(var, name) var.Name = name for _, setter in pairs(var.RenameList) do setter(name) end end for _, var in pairs(globalScope) do if var.AssignedTo then local name repeat name = 'G_' .. globalNumber .. '_' globalNumber = globalNumber + 1 until not externalGlobals[name] setVarName(var, name) end end local function modify(scope) for _, var in pairs(scope.VariableList) do local name = 'L_' .. localNumber .. '_' if var.Info.Type == 'Argument' then name = name .. 'arg' .. var.Info.Index elseif var.Info.Type == 'LocalFunction' then name = name .. 'func' elseif var.Info.Type == 'ForRange' then name = name .. 'forvar' .. var.Info.Index end setVarName(var, name) localNumber = localNumber + 1 end for _, subscope in pairs(scope.ChildScopeList) do modify(subscope) end end modify(rootScope) end -- start of minify main function function lua_minify(source, out, flags) -- run program if type(source) ~= "string" or source == "" then error("Invalid source provided") end if type(flags) ~= "table" then flags = { fold = true, small = true, minify = true } end local ast = CreateLuaParser(source) local global_scope, root_scope = AddVariableInfo(ast) if flags.fold then FoldConstants(ast) end if flags.small then MinifyVariables(global_scope, root_scope) elseif flags.smaller then MinifyVariables_2(global_scope, root_scope) elseif flags.pretty then BeautifyVariables(global_scope, root_scope) end if flags.minify then StripAst(ast) elseif flags.beautify then FormatAst(ast) end PrintAst(ast, out) end return lua_minify
local skynet = require "skynet" local bewater = require "bw.bewater" local M = {} function M:ctor() self._top = nil self._cancel = nil end function M:destroy() if self._cancel then self._cancel() end self._top = nil self._cancel = nil end function M:cancelable_timeout(delta, func) if delta <= 0 then func() return end local function cb() if func then func() end end local function cancel() func = nil end skynet.timeout(delta*100//1, cb) return cancel end function M:start() assert(self._top) self._cancel = self:cancelable_timeout(self._top.ti - skynet.time(), function() bewater.try(function() self._top.cb() end) self:next() end) end function M:cancel() self._cancel() end function M:next() --print("next") self._top = self._top.next if self._top then self:start() end --self:dump() end function M:delay(expire, cb) assert(type(expire) == "number") assert(type(cb) == "function") local node = { ti = skynet.time() + expire, cb = cb, } if not self._top then self._top = node self:start() else if node.ti < self._top.ti then node.next = self._top self._top = node self:cancel() self:start() else local cur = self._top local prev while cur do if prev and prev.ti <= node.ti and cur.ti > node.ti then if prev then prev.next = node end node.next = cur return end prev = cur cur = cur.next end prev.next = node end end end function M:dump() local str = "" local cur = self._top while cur do str = str .. "," .. cur.ti cur = cur.next end --print("timer:"..str) end local timer = {} function timer.create() return setmetatable({}, {__index = M}) end return timer
local clone = require"table.clone" local function traceback (message) local tp = type(message) if tp ~= "string" and tp ~= "number" then return message end local debug = _G.debug if type(debug) ~= "table" then return message end local tb = debug.traceback if type(tb) ~= "function" then return message end return tb(message, 4) end local function l_message (pname, msg) local stderr = io.stderr local format = string.format if pname then stderr:write(format("%s: ", pname)) end stderr:write(format("%s\n", msg)) stderr:flush() end local function getargs() local a = clone(_G.arg) for i=1,#a do a[i - 1] = _G.arg[i] end return a end local function report(status, msg) if not status and msg ~= nil then msg = (type(msg) == 'string' or type(msg) == 'number') and tostring(msg) or "(error object is not a string)" l_message(_G.arg[1], msg); end return status end do local fname = _G.arg[1] _G.arg = getargs() local status, msg = loadfile(fname) if status then status, msg = xpcall(status, traceback, _G.arg) -- force a complete garbage collection in case of errors if not status then collectgarbage("collect") end end if not report(status, msg) then os.exit(1) end end os.exit(0)
music = "castle.ogg" function start() exit = Portal:new{x=4, y=9, width=1, height=1} up = Portal:new{x=1, y=5, width=1, height=1} chest0 = Chest:new{x=6, y=6, anim_set="chest", milestone=MS_CASTLE_TOWER3_CHEST0, index=ITEM_HOLY_WATER, quantity=1} end function stop() end function update(step) exit:update() up:update() if (exit.go_time) then change_areas("castle", 15, 44, DIRECTION_SOUTH) end if (up.go_time) then change_areas("castle_tower3_2", 1, 5, DIRECTION_EAST) end end function activate(activator, activated) if (activated == chest0.id) then chest0:activate() end end function collide(id1, id2) end
local MAX_HISTORY_COUNT = 16 signals = {} function signals.on_init() global.signals_history = { -- player = { -- force -- ["some-combinator"] = { -- monitor name -- item = { -- signal type -- ["iron-ore"] = { -- signal name -- samples = { -- samples -- { tick = 0, value = 120 }, -- { tick = 60, value = 60 }, -- { tick = 120, value = 0 }, -- }, -- update_rate = 300, -- ticks -- latest = 0, -- speeds the calculation of % filled -- largest_seen = 120, -- represents 100% filled -- }, -- }, -- fluid = {}, -- virtual = {}, -- }, -- }, } end local function get_samples_root(signal) if not global.signals_history then global.signals_history = {} end local all_history = global.signals_history if not all_history[signal.entity.force.name] then all_history[signal.entity.force.name] = {} end local force_history = all_history[signal.entity.force.name] if not force_history[signal.title] then force_history[signal.title] = {} end local title_history = force_history[signal.title] if not title_history[signal.signal.type] then title_history[signal.signal.type] = {} end local type_history = title_history[signal.signal.type] if not type_history[signal.signal.name] then type_history[signal.signal.name] = { samples = {} } end return type_history[signal.signal.name] end local function reduce(tbl, func) if not tbl then return nil end local candidate = nil for _,v in pairs(tbl) do if candidate == nil or func(v, candidate) then candidate = v end end return candidate end local function largest_value_of(t) return reduce(t, function(new, current) return new > current end) end local function smallest_value_of(t) return reduce(t, function(new, current) return new < current end) end -- Potentially change the update rate of a signal, if it shows signs of changing -- more often than the currently-recorded rate. -- A signal's update rate controls the number and size of the buckets that samples -- are split into before rate-of-change analysis. In particular, signals from a -- mining drill are only updated every 300 ticks, and this is the default. -- Update rate can only ever decrease, and must show consistent faster change -- (more than (MAX_HISTORY_COUNT / 2) + 1 samples taken less than update_rate -- apart). -- NB: Signal update rates can only get shorter, never longer (but will reset -- on load). local function check_update_rate(sample_root) local update_rate = sample_root.update_rate or 300 local samples = sample_root.samples local faster_update_candidates = {} for i = 1, (#samples - 1) do local timespan = samples[i+1].tick - samples[i].tick local difference = samples[i+1].value - samples[i].value if timespan < 0 then log(string.format("WTF, there are two samples in the wrong order: %d and %d at ticks %d and %d. Ignored.", samples[i+1].value, samples[i].value, samples[i+1].tick, samples[i].tick)) -- less than update_rate (but not 0 ticks) apart... elseif timespan > 0 and timespan < update_rate then -- ...and showing any difference at all... if samples[i].value - samples[i+1].value ~= 0 then -- then record a possible update_rate diff table.insert(faster_update_candidates, timespan) end -- TODO: need a way to slow down the updates if the update rate is too fast end end -- log(string.format("Have %d faster update candidates, need %d to change.", -- #faster_update_candidates, MAX_HISTORY_COUNT / 2 + 1)) -- showing _consistent_ change... if #faster_update_candidates > MAX_HISTORY_COUNT / 2 + 1 then -- ...then pick the largest stored timespan between diffs -- (still smaller than the current update_rate) local new_rate = largest_value_of(faster_update_candidates) log(string.format("Speeding up to sample rate %d", new_rate)) sample_root.update_rate = new_rate end end local function bucketize_samples(samples, update_rate) -- Pick the largest value for each bucket formed from -- taking each sample tick and bucketing at -- sample.tick - sample.tick % update_rate local buckets = {} local offset = samples[1].tick % update_rate for _, sample in ipairs(samples) do local current_bucket_tick = sample.tick - offset - (sample.tick - offset) % update_rate local last_bucket = buckets[#buckets] if #buckets == 0 or last_bucket.tick ~= current_bucket_tick then table.insert(buckets, { value = sample.value, tick = current_bucket_tick, }) else if last_bucket.value < sample.value then last_bucket.value = sample.value end end end return buckets end local function change_per_min_between_samples(old, new) local diff = new.value - old.value local duration = new.tick - old.tick if duration == 0 then return 0 end return diff * 60 * 60 / duration -- ( ^ per minute ) end local function calculate_rate_of_change(signal) local success, sample_root = pcall(get_samples_root, signal) if not success then error(sample_root) end local samples = sample_root.samples if #samples < 2 then sample_root.rate_of_change_per_min = nil sample_root.estimated_to_depletion = nil return end check_update_rate(sample_root) local update_rate = sample_root.update_rate or 300 -- log(string.format("Updating %s, signal %s, update rate %d ticks", signal.title, signal.signal.name, update_rate)) local buckets = bucketize_samples(samples, update_rate) if #buckets < 3 then sample_root.rate_of_change_per_min = nil sample_root.estimated_to_depletion = nil return end -- Weighted average: older samples' change rates have more impact than newer local sum_weighted_change_rates = 0 local sum_weights = 0 for i = 1, #buckets - 1 do local change_rate = change_per_min_between_samples(buckets[i], buckets[i + 1]) local weight = #buckets - i -- log(string.format("Weight %d, difference %d, duration %d, unweighted change %f/min", -- weight, -- buckets[i].value - buckets[i+1].value, -- buckets[i+1].tick - buckets[i].tick, -- change_rate)) sum_weighted_change_rates = sum_weighted_change_rates + weight * change_rate sum_weights = sum_weights + weight end local rate_of_change = sum_weighted_change_rates / sum_weights sample_root.rate_of_change_per_min = rate_of_change -- log(string.format("Final sum_weights: %d, sum_weighted_change_rates: %f. New change rate: %f/min", -- sum_weights, sum_weighted_change_rates, rate_of_change)) end function signals.add_sample(tick, live) if not live.entity or not live.entity.valid then return end local success, sample_root = pcall(get_samples_root, live) if not success then error(sample_root) end sample_root.latest = live.count if not sample_root.largest_seen or sample_root.largest_seen < live.count then sample_root.largest_seen = live.count end local samples = sample_root.samples local new_sample = { tick = tick, value = live.count } table.insert(samples, new_sample) while #samples > MAX_HISTORY_COUNT do table.remove(samples, 1) end calculate_rate_of_change(live) end function signals.rate_of_change(signal) local success, sample_root = pcall(get_samples_root, signal) if not success then error(sample_root) end if sample_root.rate_of_change_per_min == nil then return {"prodmon.insufficient-data"} end return {"prodmon.rate-of-change-per-min", string.format("%.2f", sample_root.rate_of_change_per_min)} end function signals.estimate_to_depletion(signal) local success, sample_root = pcall(get_samples_root, signal) if not success then error(sample_root) end if sample_root.rate_of_change_per_min == nil then return "ETD/F: unknown" end local rate_of_change = sample_root.rate_of_change_per_min local title = "ETD" -- estimated time to depletion local minutes = 0 if rate_of_change == 0 then return "ETD/F: never" elseif sample_root.rate_of_change_per_min > 0 then title = "ETF" -- estimated time to full minutes = (sample_root.largest_seen - sample_root.latest) / rate_of_change else -- rate_of_change is negative (decaying) minutes = sample_root.latest / -rate_of_change end local hours = math.floor(minutes / 60) if hours > 0 then return string.format("%s: %d h %d m", title, hours, minutes % 60) elseif minutes > 1 then return string.format("%s: %d m", title, minutes) else return string.format("%s: <1 minute!", title) end end function signals.percent_remaining(signal) local success, sample_root = pcall(get_samples_root, signal) if not success then error(sample_root) end if not sample_root.largest_seen or not sample_root.latest then return "-- %" end return sample_root.latest * 100 / sample_root.largest_seen end function signals.on_tick(e) MAX_HISTORY_COUNT = settings.global["prodmon-sample-count"].value end
----------------------------------------------------------- -- File manager configuration file ----------------------------------------------------------- -- Plugin: nvim-tree -- https://github.com/kyazdani42/nvim-tree.lua --[[ Keybindings are defined in `keymapping.lua`: https://github.com/kyazdani42/nvim-tree.lua#keybindings Note: options under the g: command should be set BEFORE running the setup function: https://github.com/kyazdani42/nvim-tree.lua#setup See: `help NvimTree` ]]-- local g = vim.g -- g.nvim_tree_gitignore = 1 g.nvim_tree_quit_on_open = 0 g.nvim_tree_indent_markers = 1 g.nvim_tree_git_hl = 1 g.nvim_tree_highlight_opened_files = 1 g.nvim_tree_disable_window_picker = 1 g.nvim_tree_respect_buf_cwd = 1 g.nvim_tree_width_allow_resize = 1 g.nvim_tree_show_icons = { git = 1, folders = 1, files = 1 } g.nvim_tree_icons = { default = "‣ " } require('nvim-tree').setup{ open_on_setup = true, view = { width = 32, auto_resize = true }, filters = { dotfiles = true, custom = { '.git', 'node_modules', '.cache', '.bin' }, }, }
utils = require('utils') require('math_p') require('list') --[[ QUADTREE ]]-- QuadtreeItem = class(function(t, owner) t.quad_owner = owner end) function QuadtreeItem:get_bounds() end function QuadtreeItem:get_id() end function QuadtreeItem:__tostring() return "[NO_DATA]" end Quadtree = class(function(t, bnds, parnt) t.qt_capacity = 100 t.qt_max_level = 2 t.bounds = bnds t.parent = parnt t.objects = List() t.id_list = List() end) function Quadtree:__tostring() return "["..self.qt_capacity..", "..self.qt_max_level..", "..self.bounds:__tostring().."]" end function Quadtree:is_q_empty() if self.north_west == nil and self.objects:count() < 1 then return true end return false end function Quadtree:is_empty() if self.north_west ~= nil then if self.north_west:is_q_empty() and self.north_east:is_q_empty() and self.south_east:is_q_empty() and self.south_west:is_q_empty() then return true end end return false end function Quadtree:clean_up() if self.north_west ~= nil then if self:is_empty() then self.north_west = nil self.north_east = nil self.south_east = nil self.south_west = nil if self.parent ~= nil and self:total_count() == 0 then self.parent:clean_up() end end else if self.parent ~= nil and self:total_count() == 0 then self.parent:clean_up() end end end function Quadtree:get_destination(item) local d_tree = self if self.north_west.bounds:intersects(item:get_bounds()) then d_tree = self.north_west end if self.north_east.bounds:intersects(item:get_bounds()) then d_tree = self.north_east end if self.south_east.bounds:intersects(item:get_bounds()) then d_tree = self.south_east end if self.south_west.bounds:intersects(item:get_bounds()) then d_tree = self.south_west end return d_tree end local rel_i = 0 function Quadtree:relocate(item) if item == nil then return end if self.bounds:intersects(item:get_bounds()) then if self.north_west ~= nil then local dest = self:get_destination(item) if item.quad_owner ~= dest then local f_owner = item.quad_owner self:delete(item, false) dest:insert(item, item:get_bounds()) print(item:get_id().. " relocated item to "..dest.bounds:__tostring()) f_owner:clean_up() rel_i = rel_i+1 end end else if self.parent ~= nil then self.parent:relocate(item) end end end function Quadtree:get_all_items() local i = List() i:add_range(self.objects) if self.north_west ~= nil then i:add_range(self.north_west:get_all_items()) i:add_range(self.north_east:get_all_items()) i:add_range(self.south_east:get_all_items()) i:add_range(self.south_west:get_all_items()) --print("adding subgrid") end return i end function Quadtree:get_item_ids() local i = self:get_all_items() local l = List() if i ~= nil then for _, v in pairs(i:get_iterator()) do if not l:contains(v:get_id()) then l:add(v) end end end return l end function Quadtree:contains_id(id) return self.id_list:contains(id) end function Quadtree:debug_contains_content() print(self.id_list:__tostring()) end function Quadtree:move(item) if item.quad_owner ~= nil then item.quad_owner:relocate(item) return end self:relocate(item) end function Quadtree:total_count() local c = self.objects:count() c = c + self.north_west:total_count() c = c + self.north_east:total_count() c = c + self.south_east:total_count() c = c + self.south_west:total_count() return c end function Quadtree:subdivide() if parent.parent ~= nil then self.north_west = Quadtree(Rectangle(self.bounds.X, self.bounds.Y, self.bounds.Width/2, self.bounds.Height/2)) self.north_east = Quadtree(Rectangle(self.bounds.X+(self.bounds.Width/2), self.bounds.Y, self.bounds.Width/2, self.bounds.Height/2)) self.south_east = Quadtree(Rectangle(self.bounds.X+(self.bounds.Width/2), self.bounds.Y+(self.bounds.Height/2), self.bounds.Width/2, self.bounds.Height/2)) self.south_west = Quadtree(Rectangle(self.bounds.X, self.bounds.Y+(self.bounds.Height/2), self.bounds.Width/2, self.bounds.Height/2)) for i, v in pairs(self.objects:get_iterator()) do local obj = v local dst_tree = self:get_destination(obj) if dst_tree ~= self then dst_tree:insert(obj, obj:get_bounds()) self:remove(obj) end end end end function Quadtree:insert(item, ps, i) if i == nil then i = 1 end -- If nil, ignore. if ps == nil then return false end -- If not inside, ignore if not self.bounds:intersects(ps) then return false end -- If inside, and there's space, add. if self.objects:count() < self.qt_capacity or i > self.qt_max_level then item.quad_owner = self self.objects:add(item) self.id_list = self:get_item_ids() return true end if self.north_west == nil then self:subdivide() end if self.north_west:insert(item, ps, i+1) then return true end if self.north_east:insert(item, ps, i+1) then return true end if self.south_east:insert(item, ps, i+1) then return true end if self.south_west:insert(item, ps, i+1) then return true end return false end function Quadtree:query(area) -- Return value, objects local pnts = List() -- If area is not in bounds, return empty list. if not self.bounds:intersects(area) then return pnts end -- Query this level. for i=1, self.objects:count(), 1 do if area:intersects(self.objects:get_iterator()[i]) then pnts:add(self.objects:get_iterator()[i]) end end -- Terminate if no children. if self.north_west == nil then return pnts end -- Else, add objects from children. pnts:add_range(self.north_west:query(area)) pnts:add_range(self.north_east:query(area)) pnts:add_range(self.south_east:query(area)) pnts:add_range(self.south_west:query(area)) -- Return the result. return pnts end function Quadtree:delete(item, clean) if item.quad_owner ~= nil then if item.quad_owner == self then self:remove(item) self.id_list = self:get_item_ids() if clean then self:clean_up() end else item.quad_owner:delete(item) end end end function Quadtree:remove(item) if self.objects ~= nil then self.objects:remove(item) end end function Quadtree:visualize(i) if self.objects:count() > 0 then utils.draw_debug_sq(self.bounds:as_primitive(), {255*(self.objects:count()/self.qt_capacity), 255/(self.objects:count()/self.qt_capacity), 0, 255}) else utils.draw_debug_sq(self.bounds:as_primitive(), {128, 128, 128, 255}) end if i == nil then i = 1 end utils.draw_string(self.bounds.X.."::"..self.bounds.Y, self.bounds.X, self.bounds.Y, 20/i, {255, 255, 252, 255}) -- Return if done. if self.north_west == nil then return end self.north_west:visualize(i+1) self.north_east:visualize(i+1) self.south_east:visualize(i+1) self.south_west:visualize(i+1) end
function background_create() local background = { draw = background_draw, } return background end function background_draw(self) map(112, 34, 0, 0, 16, 16) end
local Command = VH_CommandLib.Command:new("Admin Chat", VH_CommandLib.UserTypes.Admin, "Send a message to all online admins.", "") Command:addArg(VH_CommandLib.ArgTypes.String, {required = true}) Command:addAlias("@") Command.Callback = function(Sender, Alias, Message) for _, v in ipairs(player.GetAll()) do --Permission check to view admin chat here vh.ChatUtil.SendMessage("_green_ "..Sender:Nick().." _reset_ to admins: _lime_ "..Message, v) end return "" end
--[[ scriptedjobs.lua Author: r3t4rd git: https://github.com/r3t4rd/ScriptedJobs Purpose: Attempt to simplify creating jobs for really big servers and their custom jobs.lua file. Example: ```lua local gangster = { name = "[Gangster]", command = "GANGSTA", color = Color(255,255,255,255), models = { "models/Humans/Group01/Male_01.mdl" }, weapons = { "weapon_physgun" }, ranks = { "Newbie", "Active", "Raider", "Leader" }, category = "Gangsters", salary = 100 } createJob(gangster) ``` Creates 4 jobs (Newbie - [Gangster], Active - [Gangster], Raider - [Gangster], Leader - [Gangster]) in category "Gangsters". --]] --[[ Table: jCats Function: cCat(jobList) Purpose: jCats [table] contains all job categories you want. cCat(jobList) [function] 1. cCat parses table (jobList) and creates every job from. 2. cCat able to create any sort of category even it's not created or just missing. --]] local jCats = { "[Example: easy jobs]", "[Example: fake job list]" } local function cCat(jobList) local a = jobList if istable(jobList) then local c = table.Count(a) print('[cats.lua] cat list contains ' .. c .. ' cats.') for n = 1, c do DarkRP.createCategory{ name = a[n], categorises = "jobs", startExpanded = true, color = Color(255,255,255,255), canSee = function(ply) return true end, sortOrder = n } print('[cats.lua] Successfully created category for [' .. n .. '] - ' .. a[n]) end else if table.HasValue(jCats, a) then return nil end DarkRP.createCategory{ name = a, categorises = "jobs", startExpanded = true, color = Color(255,0,0,255), canSee = function(ply) return true end, sortOrder = 0 } print('[cats.lua] isnt valid or dosnt exsist. Created manually cat for [' .. jobList .. ']') end end --[[ Table: cList Purpose: It just contains every color for example jobslists. cE - complexExample color, eE - easyExample color, etc. Feel free to edit this or don't even use. --]] local cList = { cE = Color(0,0,180,255), eE = Color(0,180,0,255), bE = Color(255,0,0,255), } --[[ Table: easyExample Purpose: Create job for every rank from current organisation. --]] local easyExample = { name = "", -- That's name of our organisation. If you're wanna create jobs without any tags in scoreboard, feel free to leave it empty. command = "easyEx", -- That's our command for org. It will be easyEx1 for Easy Citizen, easyEx2 for Male Citizen, etc. color = cList.eE, -- Color for our jobs. Feel free to simplify it and use Color(r,g,b,alpha). models = { -- These models will be applied for every job we have in ranklist. If you want to use each model for any job you want - check complexExample. "models/Humans/Group01/Male_01.mdl", "models/Humans/Group01/Male_02.mdl", "models/Humans/Group01/Male_03.mdl", }, weapons = { -- Same as models. Every rank will have these weapons. "weapon_fists", "weapon_physgun" }, ranks = { -- That's our jobs. If 'name' wasn't empty, then it will be shown as 'Easy Citizen - [%name%]', else just 'Easy Citizen'. "Easy Citizen", "Male Citizen", "Just yet another one citizen job", , "Fourth job", "5", "o_O", "Call me new fucking job!" }, category = "[Example: easy jobs]", -- As is. That's category. salary = 10, -- Salary multiplier. DefaultSalary + (salary*rankpos). cvar = "t" -- Cvars are here to make your joblist more complex and personal. Check complexExample or documentation for more information. } --[[ Table: complexExample Purpose: This example was created to show you how complex table you create. --]] local complexExample = { name = "[Complex Example]", -- Will be shown in scoreboard after '%jobname% - [Complex Example]' command = "complexExample", -- same as easy. color = cList.cE, -- same as easy. models = { -- Same as easy, but it will we have value 'm' in our cvar key below. So: "models/Humans/Group01/Male_01.mdl", -- Will be applied for our first job. That's 'Glock-man' "models/Humans/Group01/Male_04.mdl", -- Will be applied for our second job. That's 'AK-man' "models/Barney.mdl", -- Will be applied for our third job. That's 'Fist-man' }, weapons = { -- Same as models. Our cvar key contain value 'w', so: "weapon_physgun", -- Will be applied for our first job. "weapon_physgun", -- Will be applied for our second job. "weapon_fists" -- Third job. }, ranks = { "Glock-man", "AK-man", "Fist-man" -- joblist. Please, sort them from LOWEST to HIGHEST rank in organisation, because salary scaling from lowest to highest. }, stats = { {50, 50, 50, 50}, -- Glock man's stats, cuz it's first. {100, 100, 100, 100}, -- AK-man's stats, cuz it's second. {450, 450, 450, 450} -- Fist-man's stats, cuz it's third. }, category = "[Example: complex jobs]", -- Category. I didn't set it before, so this category will be created automatically. salary = 100, -- Salary multiplier. Same as easy. cvar = "mwst" -- m is for models, w for weapons, s for stats and t is for nulled name. A little bit shitty, but I'll try to code later. } --[[ Function: createJob(c) Purpose: Create jobs for table from Table (c). --]] local function createJob(c) local na, de, cn, co, mo, we, ra, ca, st, sa, ad, vt, lic, cc, cwm, cww, cws, cvar = c.name, c.description, c.command, c.color, c.models, c.weapons, c.ranks, c.category, c.stats, c.salary, c.admin, c.vote, c.license, table.Count(c.ranks), nil, nil, nil, c.cvar or nil print('[jobs.lua] ' .. cn .. ' contains ' .. cc .. ' jobs.') for n = 1, cc do if ra == nil or n > cc then return end local tn = "TEAM_" .. string.upper(cn) .. '_' .. ra[n] local ti = ra[n] .. ' - ' .. na[n] if cvar and string.match(cvar, 'm') then if mo == istable(mo[n]) then cwm = mo[n] else cwm = { mo[n] } end end if cvar and string.match(cvar, 'w') then if we == istable(we[n]) then cww = we[n] else cww = { we[n] } end end if cvar and string.match(cvar, 's') then if st == istable(st[n]) then cws = st[n] else cws = { st[n] } end end if cvar and string.match(cvar, 't') then ti = ra[n] end tn = DarkRP.createJob(ti, { color = co or Color('255,0,0,255'), model = cwm or mo, description = de or [[]], weapons = cww or we, max = c.max or 0, command = cn .. n or ti .. n or 'fakecmd' .. n, salary = GAMEMODE.Config.normalsalary + (sa*n), admin = ad or 0, vote = vt or false, hasLicense = lic or false, candemote = dem or false, category = cCat(ca) or ca or 'Other', PlayerSpawn = function(ply) -- stats -- finishme end }) print('[jobs.lua] Successfully created job for [' .. tn .. '] - ' .. ti) end end --[[ Function: initJobs(tj) Purpose: Initialise jobs for every organisation table from(tj). --]] local function initJobs(tj) if istable(tj) then for k, v in pairs(tj) do createJob(v) end else print('[jobs.lua] SOMETHING WAS BROKEN. CHECK YOUR JOBLIST.') return end end --[[ Table: jTables Purpose: Contain every job table and initialises in initJobs(jTables) with categories via cCat(jCats). --]] local jTables = { easyExample, complexExample } cCat(jCats) initJobs(jTables)
game.Players.LocalPlayer.PlayerGui.HitEqualsYouDie.WalkspeedEdit:Remove() game.Players.LocalPlayer.PlayerGui.HitEqualsYouDie.JumpLimiter:Remove() game.Workspace["Lua_Env"].Humanoid.WalkSpeed.Value = 25
--[[ Functions ]]-- function AddText(source, text, distance) -- Get ped. local ped = GetPlayerPed(source) if not ped or not DoesEntityExist(ped) then return end -- Check text. if type(text) ~= "string" then return end -- Sanitize text. text = Sanitize(text) -- Check length. if text:len() > 256 then TriggerClientEvent("chat:notify", source, { class = "error", text = "Too many characters (256 characters).", }) return end -- Log it. exports.log:Add({ source = source, verb = "did", extra = text, }) -- Broadcast message. Main:Broadcast(source, "players:me", NetworkGetNetworkIdFromEntity(ped), text, distance) end --[[ Commands ]]-- exports.chat:RegisterCommand("me", function(source, args, command) -- Check cooldown. if not PlayerUtil:CheckCooldown(source, 3.0) then return end PlayerUtil:UpdateCooldown(source) -- Add text. AddText(source, table.concat(args, " "), 30.0) end, { description = "Perform an action. If the first letter is a part of your body, it will attach it to that limb.", }) exports.chat:RegisterCommand("meshort", function(source, args, command) -- Check cooldown. if not PlayerUtil:CheckCooldown(source, 3.0) then return end PlayerUtil:UpdateCooldown(source) -- Add text. AddText(source, table.concat(args, " "), 5.0) end, { description = "Perform an action, but with a smaller range. If the first letter is a part of your body, it will attach it to that limb.", })
----------------------------------- -- Area: The Boyahda Tree -- NPC: Mandragora Warden -- Type: NPC -- !pos 101.978 8.369 121.969 153 ----------------------------------- ----------------------------------- function onTrade(player,npc,trade) end function onTrigger(player,npc) player:startEvent(12) end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) end
VERSION = "1.0.0" local os = import("os") local filepath = import("path/filepath") local shell = import("micro/shell") function onBufferOpen(buf) if buf.Settings["diffgutter"] and (not buf.Type.Scratch) and (buf.Path ~= "") then -- check that file exists local _, err = os.Stat(buf.AbsPath) if err == nil then local dirName, fileName = filepath.Split(buf.AbsPath) local diffBase, err = shell.ExecCommand("git", "-C", dirName, "show", "HEAD:./" .. fileName) if err ~= nil then diffBase = buf:Bytes() end buf:SetDiffBase(diffBase) end end end
-- general configuration settings for OmniCC local _, Addon = ... local OmniCC = _G.OmniCC local L = LibStub("AceLocale-3.0"):GetLocale("OmniCC") local RuleOptions = CreateFrame('Frame', 'OmniCCGroupRulesOptionsPanel') RuleOptions:SetScript('OnShow', function(self) self:AddWidgets() self:SetScript('OnShow', nil) end) function RuleOptions:GetGroupRules() return OmniCC:GetGroupRules(Addon:GetGroupId()) end function RuleOptions:AddWidgets() self.rules = self:AddRulesEditor() self.rules:SetPoint('TOPLEFT', 12, -12) self.rules:SetPoint('TOPRIGHT', -12, -12) self.rules:SetHeight(332) self.rules:Load() end function RuleOptions:UpdateValues() self.rules:UpdateList() end function RuleOptions:AddRulesEditor() local parent = self local editor = Addon.ListEditor:New('List', parent) editor.OnAddItem = function(_, ruleToAdd) table.insert(parent:GetGroupRules(), ruleToAdd) OmniCC:UpdateGroups() return true end editor.OnRemoveItem = function(_, ruleToRemove) local rules = parent:GetGroupRules() for i, rule in pairs(rules) do if rule == ruleToRemove then table.remove(rules, i) OmniCC:UpdateGroups() return true end end end editor.GetItems = function() local rules = parent:GetGroupRules() table.sort(rules) return rules end return editor end Addon:AddTab('rules', L.RuleSettings, RuleOptions)
local postgresClient = require("drive.postgres.client") -- generated from https://dbdiagram.io/d/5eb7f43539d18f5553fef7a2 local sql = [[ CREATE TYPE "record_type" AS ENUM ( 'permanent', 'generated' ); CREATE TABLE "players" ( "id" serial PRIMARY KEY, "name" varchar UNIQUE, "data" jsonb ); CREATE TABLE "player_links" ( "id" bigserial PRIMARY KEY, "player_name" varchar, "record_refId" varchar ); CREATE TABLE "cells" ( "id" serial PRIMARY KEY, "description" varchar UNIQUE, "data" jsonb ); CREATE TABLE "cell_links" ( "id" bigserial PRIMARY KEY, "cell_description" varchar, "record_refId" varchar ); CREATE TABLE "record_stores" ( "id" serial PRIMARY KEY, "type" varchar UNIQUE, "data" jsonb ); CREATE TABLE "records" ( "id" bigserial PRIMARY KEY, "refId" varchar UNIQUE, "type" record_type, "store_type" varchar, "data" jsonb ); CREATE TABLE "data_storage" ( "id" bigserial PRIMARY KEY, "key" varchar UNIQUE, "data" jsonb ); ALTER TABLE "player_links" ADD FOREIGN KEY ("player_name") REFERENCES "players" ("name"); ALTER TABLE "player_links" ADD FOREIGN KEY ("record_refId") REFERENCES "records" ("refId"); ALTER TABLE "cell_links" ADD FOREIGN KEY ("cell_description") REFERENCES "cells" ("description"); ALTER TABLE "cell_links" ADD FOREIGN KEY ("record_refId") REFERENCES "records" ("refId"); ALTER TABLE "records" ADD FOREIGN KEY ("store_type") REFERENCES "record_stores" ("type"); ]] local result = postgresClient.QueryAsync(sql) if result.error then return 1 end return 0
pg = pg or {} pg.enemy_data_statistics_274 = { [13900018] = { cannon = 6, reload = 150, speed_growth = 0, cannon_growth = 468, battle_unit_type = 50, air = 0, base = 454, dodge = 15, durability_growth = 18800, antiaircraft = 20, speed = 33, reload_growth = 0, dodge_growth = 222, luck = 0, antiaircraft_growth = 1638, hit = 14, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 54, durability = 510, armor_growth = 0, torpedo_growth = 4491, luck_growth = 0, hit_growth = 210, armor = 0, id = 13900018, equipment_list = { 1100010, 680014, 1100505 } }, [13900019] = { cannon = 24, reload = 150, speed_growth = 0, cannon_growth = 2016, pilot_ai_template_id = 10001, air = 0, battle_unit_type = 60, dodge = 7, base = 213, durability_growth = 41600, antiaircraft = 35, reload_growth = 0, dodge_growth = 102, speed = 18, luck = 0, hit = 14, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 2880, torpedo = 33, durability = 780, armor_growth = 0, torpedo_growth = 2763, luck_growth = 0, hit_growth = 210, armor = 0, id = 13900019, antisub = 0, smoke = { { 70, { { "smoke", { -0.531, 0.427, 0 } } } }, { 30, { { "smoke", { 0.711, 0.361, 0 } } } } }, appear_fx = { "appearQ" }, equipment_list = { 680015, 680016, 680017, 680018 } }, [13900020] = { cannon = 24, reload = 150, speed_growth = 0, cannon_growth = 2016, pilot_ai_template_id = 70020, air = 0, battle_unit_type = 60, dodge = 7, base = 212, durability_growth = 41600, antiaircraft = 35, reload_growth = 0, dodge_growth = 102, speed = 18, luck = 0, hit = 14, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 2880, torpedo = 33, durability = 780, armor_growth = 0, torpedo_growth = 2763, luck_growth = 0, hit_growth = 210, armor = 0, id = 13900020, antisub = 0, appear_fx = { "appearQ" }, equipment_list = { 680015, 680019, 680020, 680021 } }, [13900021] = { cannon = 7, reload = 150, speed_growth = 0, cannon_growth = 500, battle_unit_type = 25, air = 0, base = 417, dodge = 0, durability_growth = 4000, antiaircraft = 25, speed = 15, reload_growth = 0, dodge_growth = 0, luck = 0, antisub = 0, hit = 10, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 800, torpedo = 30, durability = 150, armor_growth = 0, torpedo_growth = 3000, luck_growth = 0, hit_growth = 144, armor = 0, id = 13900021, specific_fx_scale = { dianliu_DD = 1.5 }, appear_fx = { "appearsmall", "dianliu_DD" }, equipment_list = { 1002001, 1002006, 1002011 } }, [13900022] = { cannon = 13, reload = 150, speed_growth = 0, cannon_growth = 800, battle_unit_type = 30, air = 0, base = 418, dodge = 0, durability_growth = 5920, antiaircraft = 45, speed = 15, reload_growth = 0, dodge_growth = 0, luck = 0, antisub = 0, hit = 10, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 1600, torpedo = 24, durability = 260, armor_growth = 0, torpedo_growth = 2000, luck_growth = 0, hit_growth = 144, armor = 0, id = 13900022, specific_fx_scale = { dianliu_CL = 1.5 }, appear_fx = { "appearsmall", "dianliu_CL" }, equipment_list = { 1002016, 1002021 } }, [13900023] = { cannon = 16, reload = 150, speed_growth = 0, cannon_growth = 1500, battle_unit_type = 35, air = 0, base = 419, dodge = 0, durability_growth = 16000, antiaircraft = 35, speed = 15, reload_growth = 0, dodge_growth = 0, luck = 0, antisub = 0, hit = 10, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 1000, torpedo = 16, durability = 410, armor_growth = 0, torpedo_growth = 1200, luck_growth = 0, hit_growth = 144, armor = 0, id = 13900023, specific_fx_scale = { dianliu_CA = 1.5 }, appear_fx = { "appearsmall", "dianliu_CA" }, equipment_list = { 1002026, 1002031, 1002036 } }, [13900026] = { cannon = 6, reload = 150, speed_growth = 0, cannon_growth = 468, battle_unit_type = 50, air = 0, base = 423, dodge = 15, durability_growth = 20080, antiaircraft = 20, speed = 32, reload_growth = 0, dodge_growth = 222, luck = 0, antiaircraft_growth = 1638, hit = 14, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 54, durability = 640, armor_growth = 0, torpedo_growth = 4491, luck_growth = 0, hit_growth = 210, armor = 0, id = 13900026, equipment_list = { 1002101, 1002106, 1002111 } }, [13900027] = { cannon = 20, reload = 150, speed_growth = 0, cannon_growth = 936, battle_unit_type = 55, air = 0, base = 424, dodge = 11, durability_growth = 30500, antiaircraft = 28, speed = 25, reload_growth = 0, dodge_growth = 162, luck = 0, antiaircraft_growth = 3744, hit = 14, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 27, durability = 760, armor_growth = 0, torpedo_growth = 3366, luck_growth = 0, hit_growth = 210, armor = 0, id = 13900027, equipment_list = { 1002116, 1002121, 1002126, 1002131 } }, [13900036] = { cannon = 6, reload = 150, speed_growth = 0, cannon_growth = 468, pilot_ai_template_id = 20005, air = 0, battle_unit_type = 50, dodge = 15, base = 106, durability_growth = 18800, antiaircraft = 20, reload_growth = 0, dodge_growth = 222, speed = 33, luck = 0, hit = 14, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 1638, torpedo = 54, durability = 510, armor_growth = 0, torpedo_growth = 4491, luck_growth = 0, hit_growth = 210, armor = 0, id = 13900036, antisub = 0, appear_fx = { "yilishabaidanchuan_buff_01" }, equipment_list = { 1100010, 1100090, 1100505 } }, [13900037] = { cannon = 20, reload = 150, speed_growth = 0, cannon_growth = 936, battle_unit_type = 55, air = 0, base = 321, dodge = 11, durability_growth = 23120, antiaircraft = 28, speed = 25, reload_growth = 0, dodge_growth = 162, luck = 0, antiaircraft_growth = 3744, hit = 14, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 27, durability = 630, armor_growth = 0, torpedo_growth = 3366, luck_growth = 0, hit_growth = 210, armor = 0, id = 13900037, scale = 200, appear_fx = { "yilishabaidanchuan_buff_01" }, equipment_list = { 1100240, 1100270, 1100475, 1002016 } }, [13900038] = { cannon = 24, reload = 150, speed_growth = 0, cannon_growth = 2016, pilot_ai_template_id = 20004, air = 0, battle_unit_type = 60, dodge = 7, base = 322, durability_growth = 41600, antiaircraft = 35, reload_growth = 0, dodge_growth = 102, speed = 18, luck = 0, hit = 14, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 2880, torpedo = 33, durability = 780, armor_growth = 0, torpedo_growth = 2763, luck_growth = 0, hit_growth = 210, armor = 0, id = 13900038, antisub = 0, scale = 160, appear_fx = { "yilishabaidanchuan_buff_01" }, equipment_list = { 1100565, 1100370, 1100605, 1100475 } }, [13900039] = { cannon = 31, reload = 150, speed_growth = 0, cannon_growth = 2592, pilot_ai_template_id = 20004, air = 0, battle_unit_type = 65, dodge = 3, base = 323, durability_growth = 49600, antiaircraft = 45, reload_growth = 0, dodge_growth = 48, speed = 18, luck = 0, hit = 18, antisub_growth = 0, air_growth = 0, antiaircraft_growth = 3744, torpedo = 0, durability = 1020, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, hit_growth = 210, armor = 0, id = 13900039, antisub = 0, scale = 200, appear_fx = { "yilishabaidanchuan_buff_01" }, equipment_list = { 1100255, 1100605, 1100915, 1100920, 1100475 } }, [13900040] = { cannon = 0, reload = 150, speed_growth = 0, cannon_growth = 0, pilot_ai_template_id = 20004, air = 31, battle_unit_type = 60, dodge = 9, base = 324, durability_growth = 39200, antiaircraft = 38, reload_growth = 0, dodge_growth = 132, speed = 22, luck = 0, hit = 14, antisub_growth = 0, air_growth = 2574, antiaircraft_growth = 3168, torpedo = 0, durability = 770, armor_growth = 0, torpedo_growth = 0, luck_growth = 0, hit_growth = 210, armor = 0, id = 13900040, antisub = 0, scale = 200, appear_fx = { "yilishabaidanchuan_buff_01" }, equipment_list = { 1100090, 1100955, 1100965, 1100965, 1100965 } }, [13900041] = { cannon = 8, reload = 150, hit_growth = 210, cannon_growth = 900, speed_growth = 0, air = 0, battle_unit_type = 90, dodge = 14, base = 450, durability_growth = 68000, antiaircraft = 65, reload_growth = 0, dodge_growth = 306, speed = 12, luck = 0, hit = 14, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 34, durability = 490, armor_growth = 0, torpedo_growth = 2100, luck_growth = 0, antiaircraft_growth = 2800, armor = 0, id = 13900041, appear_fx = { "appearQ" } }, [13900042] = { cannon = 8, reload = 150, hit_growth = 210, cannon_growth = 900, speed_growth = 0, air = 0, battle_unit_type = 90, dodge = 14, base = 452, durability_growth = 68000, antiaircraft = 65, reload_growth = 0, dodge_growth = 306, speed = 12, luck = 0, hit = 14, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 34, durability = 490, armor_growth = 0, torpedo_growth = 2100, luck_growth = 0, antiaircraft_growth = 2800, armor = 0, id = 13900042, appear_fx = { "appearQ" } }, [13900043] = { cannon = 8, reload = 150, hit_growth = 210, cannon_growth = 900, speed_growth = 0, air = 0, battle_unit_type = 90, dodge = 14, base = 453, durability_growth = 68000, antiaircraft = 65, reload_growth = 0, dodge_growth = 306, speed = 12, luck = 0, hit = 14, antisub_growth = 0, air_growth = 0, antisub = 0, torpedo = 34, durability = 490, armor_growth = 0, torpedo_growth = 2100, luck_growth = 0, antiaircraft_growth = 2800, armor = 0, id = 13900043, appear_fx = { "appearQ" } } } return
local Calendar = require('orgmode.objects.calendar') local Date = require('orgmode.objects.date') local EditSpecial = require('orgmode.objects.edit_special') local Files = require('orgmode.parser.files') local Help = require('orgmode.objects.help') local Hyperlinks = require('orgmode.org.hyperlinks') local PriorityState = require('orgmode.objects.priority_state') local TodoState = require('orgmode.objects.todo_state') local config = require('orgmode.config') local constants = require('orgmode.utils.constants') local ts_utils = require('nvim-treesitter.ts_utils') local utils = require('orgmode.utils') ---@class OrgMappings ---@field capture Capture ---@field agenda Agenda local OrgMappings = {} ---@param data table function OrgMappings:new(data) local opts = {} opts.global_cycle_mode = 'all' opts.capture = data.capture opts.agenda = data.agenda setmetatable(opts, self) self.__index = self return opts end -- TODO: -- Support archiving to headline function OrgMappings:archive() local file = Files.get_current_file() if file.is_archive_file then return utils.echo_warning('This file is already an archive file.') end local item = file:get_closest_headline() file = Files.get_current_file() item = file:get_closest_headline() local archive_location = file:get_archive_file_location() self.capture:refile_file_headline_to_archive(file, item, archive_location) Files.reload( archive_location, vim.schedule_wrap(function() Files.update_file(archive_location, function(archive_file) local last_item = archive_file:get_closest_headline(vim.fn.line('$')) if not last_item then return end last_item:add_properties({ ARCHIVE_TIME = Date.now():to_string(), ARCHIVE_FILE = file.filename, ARCHIVE_CATEGORY = item.category, ARCHIVE_TODO = item.todo_keyword.value, }) end) end) ) end function OrgMappings:set_tags() local headline = Files.get_closest_headline() local own_tags = headline:get_own_tags() local tags = vim.fn.OrgmodeInput('Tags: ', utils.tags_to_string(own_tags), Files.autocomplete_tags) return self:_set_headline_tags(headline, tags) end function OrgMappings:toggle_archive_tag() local headline = Files.get_closest_headline() local own_tags = headline:get_own_tags() if vim.tbl_contains(own_tags, 'ARCHIVE') then own_tags = vim.tbl_filter(function(tag) return tag ~= 'ARCHIVE' end, own_tags) else table.insert(own_tags, 'ARCHIVE') end return self:_set_headline_tags(headline, utils.tags_to_string(own_tags)) end function OrgMappings:cycle() local file = Files.get_current_file() local line = vim.fn.line('.') if not vim.wo.foldenable then vim.wo.foldenable = true vim.cmd([[silent! norm!zx]]) end local level = vim.fn.foldlevel(line) if level == 0 then return utils.echo_info('No fold') end local is_fold_closed = vim.fn.foldclosed(line) ~= -1 if is_fold_closed then return vim.cmd([[silent! norm!zo]]) end local section = file.sections_by_line[line] if section then if not section:has_children() then return end local close = #section.sections == 0 if not close then local has_nested_children = false for _, child in ipairs(section.sections) do if not has_nested_children and child:has_children() then has_nested_children = true end if child:has_children() and vim.fn.foldclosed(child.line_number) == -1 then vim.cmd(string.format('silent! keepjumps norm!%dggzc', child.line_number)) close = true end end vim.cmd(string.format('silent! keepjumps norm!%dgg', line)) if not close and not has_nested_children then close = true end end if close then return vim.cmd([[silent! norm!zc]]) end return vim.cmd([[silent! norm!zczO]]) end if vim.fn.getline(line):match('^%s*:[^:]*:%s*$') then return vim.cmd([[silent! norm!za]]) end end function OrgMappings:global_cycle() if not vim.wo.foldenable or self.global_cycle_mode == 'Show All' then self.global_cycle_mode = 'Overview' utils.echo_info(self.global_cycle_mode) return vim.cmd([[silent! norm!zMzX]]) end if self.global_cycle_mode == 'Contents' then self.global_cycle_mode = 'Show All' utils.echo_info(self.global_cycle_mode) return vim.cmd([[silent! norm!zR]]) end self.global_cycle_mode = 'Contents' utils.echo_info(self.global_cycle_mode) vim.wo.foldlevel = 1 return vim.cmd([[silent! norm!zx]]) end -- TODO: Add hierarchy function OrgMappings:toggle_checkbox() local line = vim.fn.getline('.') local pattern = '^(%s*[%-%+]%s*%[([%sXx%-]?)%])' local checkbox, state = line:match(pattern) if not checkbox then return end local new_val = vim.trim(state) == '' and '[X]' or '[ ]' checkbox = checkbox:gsub('%[[%sXx%-]?%]$', new_val) local new_line = line:gsub(pattern, checkbox) vim.fn.setline('.', new_line) end function OrgMappings:timestamp_up_day() return self:_adjust_date(vim.v.count1, 'd', config.mappings.org.org_timestamp_up_day) end function OrgMappings:timestamp_down_day() return self:_adjust_date(-vim.v.count1, 'd', config.mappings.org.org_timestamp_down_day) end function OrgMappings:timestamp_up() return self:_adjust_date_part('+', vim.v.count1, config.mappings.org.org_timestamp_up) end function OrgMappings:timestamp_down() return self:_adjust_date_part('-', vim.v.count1, config.mappings.org.org_timestamp_down) end function OrgMappings:_adjust_date_part(direction, amount, fallback) local date_on_cursor = self:_get_date_under_cursor() local get_adj = function(span, count) return string.format('%d%s', count or amount, span) end local minute_adj = get_adj('M', tonumber(config.org_time_stamp_rounding_minutes) * amount) local do_replacement = function(date) local col = vim.fn.col('.') local char = vim.fn.getline('.'):sub(col, col) if col == date.range.start_col or col == date.range.end_col then date.active = not date.active return self:_replace_date(date) end local node = Files.get_node_at_cursor() local col_from_start = col - date.range.start_col local modify_end_time = false local adj = nil if node:type() == 'date' then if col_from_start <= 5 then adj = get_adj('y') elseif col_from_start <= 8 then adj = get_adj('m') elseif col_from_start <= 15 then adj = get_adj('d') end elseif node:type() == 'time' then local has_end_time = node:parent() and node:parent():type() == 'timerange' if col_from_start <= 17 then adj = get_adj('h') elseif col_from_start <= 20 then adj = minute_adj elseif has_end_time and col_from_start <= 23 then adj = get_adj('h') modify_end_time = true elseif has_end_time and col_from_start <= 26 then adj = minute_adj modify_end_time = true end elseif (node:type() == 'repeater' or node:type() == 'delay') and char:match('[hdwmy]') ~= nil then local map = { h = 'd', d = 'w', w = 'm', m = 'y', y = 'h' } vim.cmd(string.format('norm!r%s', map[char])) return true end if not adj then return false end local new_date = nil if modify_end_time then new_date = date:adjust_end_time(direction .. adj) else new_date = date:adjust(direction .. adj) end self:_replace_date(new_date) if date:is_logbook() and date.related_date_range then local item = Files.get_closest_headline() if item and item.logbook then item.logbook:recalculate_estimate(new_date.range.start_line) end end return true end if date_on_cursor then local replaced = do_replacement(date_on_cursor) if replaced then return true end end return vim.api.nvim_feedkeys(utils.esc(fallback), 'n', true) end function OrgMappings:change_date() local date = self:_get_date_under_cursor() if not date then return end return Calendar.new({ date = date }).open():next(function(new_date) if new_date then self:_replace_date(new_date) end end) end function OrgMappings:priority_up() self:set_priority('up') end function OrgMappings:priority_down() self:set_priority('down') end function OrgMappings:set_priority(direction) local item = Files.get_closest_headline() local priority = PriorityState:new(item.priority) local new_priority if direction then new_priority = direction == 'up' and priority:increase() or priority:decrease() else new_priority = priority:prompt_user() end if not new_priority then return end item:set_priority(new_priority) end function OrgMappings:todo_next_state() return self:_todo_change_state('next') end function OrgMappings:todo_prev_state() self:_todo_change_state('prev') end function OrgMappings:toggle_heading() local line = vim.fn.getline('.') local parent = Files.get_closest_headline() if not parent then line = '* ' .. line vim.fn.setline('.', line) return end if parent.line_number == vim.api.nvim_win_get_cursor(0)[1] then line = line:gsub('^%*+%s', '') else line = line:gsub('^(%s*)', '') if line:match('^[%*-]%s') then -- handle lists line = line:gsub('^[%*-]%s', '') -- strip bullet line = line:gsub('^%[([X%s])%]%s', function(checkbox_state) if checkbox_state == 'X' then return config:get_todo_keywords().DONE[1] .. ' ' else return config:get_todo_keywords().TODO[1] .. ' ' end end) end line = string.rep('*', parent.level + 1) .. ' ' .. line end vim.fn.setline('.', line) end function OrgMappings:_todo_change_state(direction) local item = Files.get_closest_headline() local was_done = item:is_done() local old_state = item.todo_keyword.value local changed = self:_change_todo_state(direction, true) if not changed then return end item = Files.get_closest_headline() if not item:is_done() and not was_done then return item end local repeater_dates = item:get_repeater_dates() if #repeater_dates == 0 then local log_time = config.org_log_done == 'time' if log_time and item:is_done() and not was_done then item:add_closed_date() end if log_time and not item:is_done() and was_done then item:remove_closed_date() end return item end for _, date in ipairs(repeater_dates) do self:_replace_date(date:apply_repeater()) end self:_change_todo_state('reset') local state_change = string.format( '- State "%s" from "%s" [%s]', item.todo_keyword.value, old_state, Date.now():to_string() ) local data = item:add_properties({ LAST_REPEAT = '[' .. Date.now():to_string() .. ']' }) if data.is_new then vim.fn.append(data.end_line, data.indent .. state_change) return item end item = Files.get_closest_headline() if item.properties.valid then vim.fn.append(item.properties.range.end_line, data.indent .. state_change) end end function OrgMappings:do_promote(whole_subtree) local item = Files.get_closest_headline() local foldclosed = vim.fn.foldclosed('.') item:promote(1, whole_subtree) if foldclosed > -1 and vim.fn.foldclosed('.') == -1 then vim.cmd([[norm!zc]]) end end function OrgMappings:do_demote(whole_subtree) local item = Files.get_closest_headline() local foldclosed = vim.fn.foldclosed('.') item:demote(1, whole_subtree) if foldclosed > -1 and vim.fn.foldclosed('.') == -1 then vim.cmd([[norm!zc]]) end end function OrgMappings:handle_return(suffix) suffix = suffix or '' local current_file = Files.get_current_file() local item = current_file:get_current_node() if item.node:parent() and item.node:parent():type() == 'headline' then item = current_file:convert_to_file_node(item.node:parent()) end if item.type == 'headline' then local linenr = vim.fn.line('.') local content = config:respect_blank_before_new_entry({ string.rep('*', item.level) .. ' ' .. suffix }) vim.fn.append(linenr, content) vim.fn.cursor(linenr + #content, 0) return vim.cmd([[startinsert!]]) end if item.type == 'list' or item.type == 'listitem' then vim.cmd([[normal! ^]]) item = Files.get_current_file():get_current_node() end if item.type == 'itemtext' or item.type == 'bullet' or item.type == 'checkbox' or item.type == 'description' then local list_item = item.node:parent() if list_item:type() ~= 'listitem' then return end local line = vim.fn.getline(list_item:start() + 1) local end_row, _ = list_item:end_() local range = { start = { line = end_row + 1, character = 0 }, ['end'] = { line = end_row + 1, character = 0 }, } local checkbox = line:match('^(%s*[%+%-])%s*%[[%sXx%-]?%]') local plain_list = line:match('^%s*[%+%-]') local indent, number_in_list, closer = line:match('^(%s*)(%d+)([%)%.])%s?') local text_edits = config:respect_blank_before_new_entry({}, 'plain_list_item', { range = range, newText = '\n', }) local add_empty_line = #text_edits > 0 if checkbox then table.insert(text_edits, { range = range, newText = checkbox .. ' [ ] \n', }) elseif plain_list then table.insert(text_edits, { range = range, newText = plain_list .. ' \n', }) elseif number_in_list then local next_sibling = list_item local counter = 1 while next_sibling do local bullet = next_sibling:child(0) local text = table.concat(ts_utils.get_node_text(bullet)) local new_text = tostring(tonumber(text:match('%d+')) + 1) .. closer if counter == 1 then table.insert(text_edits, { range = range, newText = indent .. new_text .. ' ' .. '\n', }) else table.insert(text_edits, { range = ts_utils.node_to_lsp_range(bullet), newText = new_text, }) end counter = counter + 1 next_sibling = ts_utils.get_next_node(next_sibling) end end if #text_edits > 0 then vim.lsp.util.apply_text_edits(text_edits, 0, constants.default_offset_encoding) vim.fn.cursor(end_row + 2 + (add_empty_line and 1 or 0), 0) -- +1 for 0 index and +1 for next line vim.cmd([[startinsert!]]) end end end function OrgMappings:insert_heading_respect_content(suffix) suffix = suffix or '' local item = Files.get_closest_headline() local line = config:respect_blank_before_new_entry({ string.rep('*', item.level) .. ' ' .. suffix }) vim.fn.append(item.range.end_line, line) vim.fn.cursor(item.range.end_line + #line, 0) return vim.cmd([[startinsert!]]) end function OrgMappings:insert_todo_heading_respect_content() return self:insert_heading_respect_content(config:get_todo_keywords().TODO[1] .. ' ') end function OrgMappings:insert_todo_heading() local item = Files.get_closest_headline() vim.fn.cursor(item.range.start_line, 0) return self:handle_return(config:get_todo_keywords().TODO[1] .. ' ') end function OrgMappings:move_subtree_up() local item = Files.get_closest_headline() local prev_headline = item:get_prev_headline_same_level() if not prev_headline then return utils.echo_warning('Cannot move past superior level.') end vim.cmd( string.format(':%d,%dmove %d', item.range.start_line, item.range.end_line, prev_headline.range.start_line - 1) ) end function OrgMappings:move_subtree_down() local item = Files.get_closest_headline() local next_headline = item:get_next_headline_same_level() if not next_headline then return utils.echo_warning('Cannot move past superior level.') end vim.cmd(string.format(':%d,%dmove %d', item.range.start_line, item.range.end_line, next_headline.range.end_line)) end function OrgMappings:show_help() return Help.show() end function OrgMappings:edit_special() local edit_special = EditSpecial:new() edit_special:init_in_org_buffer() edit_special:init() end function OrgMappings:_edit_special_callback() EditSpecial:new():done() end function OrgMappings:open_at_point() local date = self:_get_date_under_cursor() if date then return self.agenda:open_day(date) end local link = self:_get_link_under_cursor() if not link then return end local parts = vim.split(link, '][', true) local url = parts[1] local link_ctx = { base = url, skip_add_prefix = true } if url:find('^file:') then if url:find(' +', 1, true) then parts = vim.split(url, ' +', true) url = parts[1] local line_number = parts[2] return vim.cmd(string.format('edit +%s %s', line_number, url:sub(6))) end if url:find('^file:(.-)::') then link_ctx.line = url else return vim.cmd(string.format('edit %s', url:sub(6))) end end if url:find('^https?://') then if not vim.g.loaded_netrwPlugin then return utils.echo_warning('Netrw plugin must be loaded in order to open urls.') end return vim.fn['netrw#BrowseX'](url, vim.fn['netrw#CheckIfRemote']()) end local stat = vim.loop.fs_stat(url) if stat and stat.type == 'file' then return vim.cmd(string.format('edit %s', url)) end local current_headline = Files.get_closest_headline() local headlines = vim.tbl_filter(function(headline) return headline.line ~= current_headline.line and headline.id ~= current_headline.id end, Hyperlinks.find_matching_links(link_ctx)) if #headlines == 0 then return end local headline = headlines[1] if #headlines > 1 then local longest_headline = utils.reduce(headlines, function(acc, h) return math.max(acc, h.line:len()) end, 0) local options = {} for i, h in ipairs(headlines) do table.insert(options, string.format('%d) %-' .. longest_headline .. 's (%s)', i, h.line, h.file)) end vim.cmd([[echo "Multiple targets found. Select target:"]]) local choice = vim.fn.inputlist(options) if choice < 1 or choice > #headlines then return end headline = headlines[choice] end vim.cmd(string.format('edit %s', headline.file)) vim.fn.cursor(headline.range.start_line, 0) end function OrgMappings:export() return require('orgmode.export').prompt() end function OrgMappings:next_visible_heading() return vim.fn.search([[^\*\+]], 'W') end function OrgMappings:previous_visible_heading() return vim.fn.search([[^\*\+]], 'bW') end function OrgMappings:forward_heading_same_level() local item = Files.get_closest_headline() if not item then return end local next_headline_same_level = item:get_next_headline_same_level() if not next_headline_same_level then return end return vim.fn.cursor(next_headline_same_level.range.start_line, 1) end function OrgMappings:backward_heading_same_level() local item = Files.get_closest_headline() if not item then return end local prev_headline_same_level = item:get_prev_headline_same_level() if not prev_headline_same_level then return end return vim.fn.cursor(prev_headline_same_level.range.start_line, 1) end function OrgMappings:outline_up_heading() local item = Files.get_closest_headline() if not item then return end if item.level <= 1 then return utils.echo_info('Already at top level of the outline') end return vim.fn.cursor(item.parent.range.start_line, 1) end function OrgMappings:org_deadline() local item = Files.get_closest_headline() local deadline_date = item:get_deadline_date() return Calendar.new({ date = deadline_date or Date.today() }).open():next(function(new_date) if not new_date then return end item:remove_closed_date() item = Files.get_closest_headline() item:add_deadline_date(new_date) end) end function OrgMappings:org_schedule() local item = Files.get_closest_headline() local scheduled_date = item:get_scheduled_date() return Calendar.new({ date = scheduled_date or Date.today() }).open():next(function(new_date) if not new_date then return end item:remove_closed_date() item = Files.get_closest_headline() item:add_scheduled_date(new_date) end) end ---@param inactive boolean function OrgMappings:org_time_stamp(inactive) local date = self:_get_date_under_cursor() if date then return Calendar.new({ date = date }).open():next(function(new_date) if not new_date then return end self:_replace_date(new_date) end) end local date_start = self:_get_date_under_cursor(-1) return Calendar.new({ date = Date.today() }).open():next(function(new_date) if not new_date then return end local date_string = new_date:to_wrapped_string(not inactive) if date_start then date_string = '--' .. date_string end vim.cmd(string.format('norm!i%s', date_string)) end) end ---@param direction string ---@param use_fast_access boolean ---@return string function OrgMappings:_change_todo_state(direction, use_fast_access) local item = Files.get_closest_headline() local todo = item.todo_keyword local todo_state = TodoState:new({ current_state = todo.value }) local next_state = nil if use_fast_access and todo_state:has_fast_access() then next_state = todo_state:open_fast_access() else if direction == 'next' then next_state = todo_state:get_next() elseif direction == 'prev' then next_state = todo_state:get_prev() elseif direction == 'reset' then next_state = todo_state:get_todo() end end if not next_state then return false end if next_state.value == todo.value then if todo.value ~= '' then utils.echo_info('TODO state was already ', { { next_state.value, next_state.hl } }) end return false end local linenr = item.range.start_line local stars = string.rep('%*', item.level) local old_state = todo.value if old_state ~= '' then old_state = old_state .. '%s+' end local new_state = next_state.value if new_state ~= '' then new_state = new_state .. ' ' end local new_line = vim.fn.getline(linenr):gsub('^' .. stars .. '%s+' .. old_state, stars .. ' ' .. new_state) vim.fn.setline(linenr, new_line) return true end ---@param date Date function OrgMappings:_replace_date(date) local line = vim.fn.getline(date.range.start_line) local view = vim.fn.winsaveview() vim.fn.setline( date.range.start_line, string.format( '%s%s%s', line:sub(1, date.range.start_col - 1), date:to_wrapped_string(), line:sub(date.range.end_col + 1) ) ) vim.fn.winrestview(view) return true end ---@return Date|nil function OrgMappings:_get_date_under_cursor(col_offset) col_offset = col_offset or 0 local item = Files.get_closest_headline() local col = vim.fn.col('.') + col_offset local line = vim.fn.line('.') local dates = vim.tbl_filter(function(date) return date.range:is_in_range(line, col) end, item.dates) if #dates == 0 then return nil end return dates[1] end ---@param amount number ---@param span string ---@param fallback string ---@return string function OrgMappings:_adjust_date(amount, span, fallback) local adjustment = string.format('%s%d%s', amount > 0 and '+' or '', amount, span) local date = self:_get_date_under_cursor() if date then local new_date = date:adjust(adjustment) return self:_replace_date(new_date) end local is_count_mapping = vim.tbl_contains({ '<c-a>', '<c-x>' }, fallback:lower()) if not is_count_mapping then return vim.api.nvim_feedkeys(utils.esc(fallback), 'n', true) end local num = vim.fn.search([[\d]], 'c', vim.fn.line('.')) if num == 0 then return vim.api.nvim_feedkeys(utils.esc(fallback), 'n', true) end date = self:_get_date_under_cursor() if date then local new_date = date:adjust(adjustment) return self:_replace_date(new_date) end return vim.api.nvim_feedkeys(utils.esc(fallback), 'n', true) end function OrgMappings:_set_headline_tags(headline, tags_string) local tags = tags_string:gsub('^:+', ''):gsub(':+$', ''):gsub(':+', ':') if tags ~= '' then tags = ':' .. tags .. ':' end local line_without_tags = headline.line :gsub(vim.pesc(utils.tags_to_string(headline:get_own_tags())) .. '%s*$', '') :gsub('%s*$', '') local spaces = 80 - math.min(line_without_tags:len(), 79) local new_line = string.format('%s%s%s', line_without_tags, string.rep(' ', spaces), tags):gsub('%s*$', '') return vim.fn.setline(headline.range.start_line, new_line) end ---@return string|nil function OrgMappings:_get_link_under_cursor() local found_link = nil local links = {} local line = vim.fn.getline('.') local col = vim.fn.col('.') for link in line:gmatch('%[%[(.-)%]%]') do local start_from = #links > 0 and links[#links].to or nil local from, to = line:find('%[%[(.-)%]%]', start_from) if col >= from and col <= to then found_link = link break end table.insert(links, { link = link, from = from, to = to }) end return found_link end return OrgMappings
--The references go to CTTBOT, Shulepin and Pinggin IncludeFile("Lib\\TOIR_SDK.lua") CompYasuo = class() function OnLoad() if GetChampName(GetMyChamp()) == "Yasuo" then CompYasuo:Competitive() end end function CompYasuo:Competitive() SetLuaCombo(true) W_Bloked = { ["FizzMarinerDoom"] = {Spellname ="FizzMarinerDoom",Name = "Fizz", Spellslot =_R}, ["AatroxE"] = {Spellname ="AatroxE",Name= "Aatrox", Spellslot =_E}, ["AhriOrbofDeception"] = {Spellname ="AhriOrbofDeception",Name = "Ahri", Spellslot =_Q}, ["AhriFoxFire"] = {Spellname ="AhriFoxFire",Name = "Ahri", Spellslot =_W}, ["AhriSeduce"] = {Spellname ="AhriSeduce",Name = "Ahri", Spellslot =_E}, ["FlashFrost"] = {Spellname ="FlashFrost",Name = "Anivia", Spellslot =_Q}, ["Anivia2"] = {Spellname ="Frostbite",Name = "Anivia", Spellslot =_E}, ["Disintegrate"] = {Spellname ="Disintegrate",Name = "Annie", Spellslot =_Q}, ["Volley"] = {Spellname ="Volley",Name ="Ashe", Spellslot =_W}, ["EnchantedCrystalArrow"] = {Spellname ="EnchantedCrystalArrow",Name ="Ashe", Spellslot =_R}, ["BandageToss"] = {Spellname ="BandageToss",Name ="Amumu",Spellslot =_Q}, ["RocketGrabMissile"] = {Spellname ="RocketGrabMissile",Name ="Blitzcrank",Spellslot =_Q}, ["BrandBlaze"] = {Spellname ="BrandBlaze",Name ="Brand", Spellslot =_Q}, ["BrandWildfire"] = {Spellname ="BrandWildfire",Name ="Brand", Spellslot =_R}, ["BraumQ"] = {Spellname ="BraumQ",Name ="Braum",Spellslot =_Q}, ["BraumRWapper"] = {Spellname ="BraumRWapper",Name ="Braum",Spellslot =_R}, ["CaitlynPiltoverPeacemaker"] = {Spellname ="CaitlynPiltoverPeacemaker",Name ="Caitlyn",Spellslot =_Q}, ["CaitlynEntrapment"] = {Spellname ="CaitlynEntrapment",Name ="Caitlyn",Spellslot =_E}, ["CaitlynAceintheHole"] = {Spellname ="CaitlynAceintheHole",Name ="Caitlyn",Spellslot =_R}, ["CassiopeiaMiasma"] = {Spellname ="CassiopeiaMiasma",Name ="Cassiopiea",Spellslot =_W}, ["CassiopeiaTwinFang"] = {Spellname ="CassiopeiaTwinFang",Name ="Cassiopiea",Spellslot =_E}, ["PhosphorusBomb"] = {Spellname ="PhosphorusBomb",Name ="Corki",Spellslot =_Q}, ["MissileBarrage"] = {Spellname ="MissileBarrage",Name ="Corki",Spellslot =_R}, ["DianaArc"] = {Spellname ="DianaArc",Name ="Diana",Spellslot =_Q}, ["InfectedCleaverMissileCast"] = {Spellname ="InfectedCleaverMissileCast",Name ="DrMundo",Spellslot =_Q}, ["dravenspinning"] = {Spellname ="dravenspinning",Name ="Draven",Spellslot =_Q}, ["DravenDoubleShot"] = {Spellname ="DravenDoubleShot",Name ="Draven",Spellslot =_E}, ["DravenRCast"] = {Spellname ="DravenRCast",Name ="Draven",Spellslot =_R}, ["EliseHumanQ"] = {Spellname ="EliseHumanQ",Name ="Elise",Spellslot =_Q}, ["EliseHumanE"] = {Spellname ="EliseHumanE",Name ="Elise",Spellslot =_E}, ["EvelynnQ"] = {Spellname ="EvelynnQ",Name ="Evelynn",Spellslot =_Q}, ["EzrealMysticShot"] = {Spellname ="EzrealMysticShot",Name ="Ezreal",Spellslot =_Q,}, ["EzrealEssenceFlux"] = {Spellname ="EzrealEssenceFlux",Name ="Ezreal",Spellslot =_W}, ["EzrealArcaneShift"] = {Spellname ="EzrealArcaneShift",Name ="Ezreal",Spellslot =_R}, ["GalioRighteousGust"] = {Spellname ="GalioRighteousGust",Name ="Galio",Spellslot =_E}, ["GalioResoluteSmite"] = {Spellname ="GalioResoluteSmite",Name ="Galio",Spellslot =_Q}, ["Parley"] = {Spellname ="Parley",Name ="Gangplank",Spellslot =_Q}, ["GnarQ"] = {Spellname ="GnarQ",Name ="Gnar",Spellslot =_Q}, ["GravesClusterShot"] = {Spellname ="GravesClusterShot",Name ="Graves",Spellslot =_Q}, ["GravesChargeShot"] = {Spellname ="GravesChargeShot",Name ="Graves",Spellslot =_R}, ["HeimerdingerW"] = {Spellname ="HeimerdingerW",Name ="Heimerdinger",Spellslot =_W}, ["IreliaTranscendentBlades"] = {Spellname ="IreliaTranscendentBlades",Name ="Irelia",Spellslot =_R}, ["HowlingGale"] = {Spellname ="HowlingGale",Name ="Janna",Spellslot =_Q}, ["JayceToTheSkies"] = {Spellname ="JayceToTheSkies" or "jayceshockblast",Name ="Jayce",Spellslot =_Q}, ["jayceshockblast"] = {Spellname ="JayceToTheSkies" or "jayceshockblast",Name ="Jayce",Spellslot =_Q}, ["JinxW"] = {Spellname ="JinxW",Name ="Jinx",Spellslot =_W}, ["JinxR"] = {Spellname ="JinxR",Name ="Jinx",Spellslot =_R}, ["KalistaMysticShot"] = {Spellname ="KalistaMysticShot",Name ="Kalista",Spellslot =_Q}, ["KarmaQ"] = {Spellname ="KarmaQ",Name ="Karma",Spellslot =_Q}, ["NullLance"] = {Spellname ="NullLance",Name ="Kassidan",Spellslot =_Q}, ["KatarinaR"] = {Spellname ="KatarinaR",Name ="Katarina",Spellslot =_R}, ["LeblancChaosOrb"] = {Spellname ="LeblancChaosOrb",Name ="Leblanc",Spellslot =_Q}, ["LeblancSoulShackle"] = {Spellname ="LeblancSoulShackle" or "LeblancSoulShackleM",Name ="Leblanc",Spellslot =_E}, ["LeblancSoulShackleM"] = {Spellname ="LeblancSoulShackle" or "LeblancSoulShackleM",Name ="Leblanc",Spellslot =_E}, ["BlindMonkQOne"] = {Spellname ="BlindMonkQOne",Name ="Leesin",Spellslot =_Q}, ["LeonaZenithBladeMissle"] = {Spellname ="LeonaZenithBladeMissle",Name ="Leona",Spellslot =_E}, ["LissandraE"] = {Spellname ="LissandraE",Name ="Lissandra",Spellslot =_E}, ["LucianR"] = {Spellname ="LucianR",Name ="Lucian",Spellslot =_R}, ["LuxLightBinding"] = {Spellname ="LuxLightBinding",Name ="Lux",Spellslot =_Q}, ["LuxLightStrikeKugel"] = {Spellname ="LuxLightStrikeKugel",Name ="Lux",Spellslot =_E}, ["MissFortuneBulletTime"] = {Spellname ="MissFortuneBulletTime",Name ="Missfortune",Spellslot =_R}, ["DarkBindingMissile"] = {Spellname ="DarkBindingMissile",Name ="Morgana",Spellslot =_Q}, ["NamiR"] = {Spellname ="NamiR",Name ="Nami",Spellslot =_R}, ["JavelinToss"] = {Spellname ="JavelinToss",Name ="Nidalee",Spellslot =_Q}, ["NocturneDuskbringer"] = {Spellname ="NocturneDuskbringer",Name ="Nocturne",Spellslot =_Q}, ["Pantheon_Throw"] = {Spellname ="Pantheon_Throw",Name ="Pantheon",Spellslot =_Q}, ["QuinnQ"] = {Spellname ="QuinnQ",Name ="Quinn",Spellslot =_Q}, ["RengarE"] = {Spellname ="RengarE",Name ="Rengar",Spellslot =_E}, ["rivenizunablade"] = {Spellname ="rivenizunablade",Name ="Riven",Spellslot =_R}, ["Overload"] = {Spellname ="Overload",Name ="Ryze",Spellslot =_Q}, ["SpellFlux"] = {Spellname ="SpellFlux",Name ="Ryze",Spellslot =_E}, ["SejuaniGlacialPrisonStart"] = {Spellname ="SejuaniGlacialPrisonStart",Name ="Sejuani",Spellslot =_R}, ["SivirQ"] = {Spellname ="SivirQ",Name ="Sivir",Spellslot =_Q}, ["SivirE"] = {Spellname ="SivirE",Name ="Sivir",Spellslot =_E}, ["SkarnerFractureMissileSpell"] = {Spellname ="SkarnerFractureMissileSpell",Name ="Skarner",Spellslot =_E}, ["SonaCrescendo"] = {Spellname ="SonaCrescendo",Name ="Sona",Spellslot =_R}, ["SwainDecrepify"] = {Spellname ="SwainDecrepify",Name ="Swain",Spellslot =_Q}, ["SwainMetamorphism"] = {Spellname ="SwainMetamorphism",Name ="Swain",Spellslot =_R}, ["SyndraE"] = {Spellname ="SyndraE",Name ="Syndra",Spellslot =_E}, ["SyndraR"] = {Spellname ="SyndraR",Name ="Syndra",Spellslot =_R}, ["TalonRake"] = {Spellname ="TalonRake",Name ="Talon",Spellslot =_W}, ["TalonShadowAssault"] = {Spellname ="TalonShadowAssault",Name ="Talon",Spellslot =_R}, ["BlindingDart"] = {Spellname ="BlindingDart",Name ="Teemo",Spellslot =_Q}, ["Thresh"] = {Spellname ="ThreshQ",Name ="Thresh",Spellslot =_Q}, ["BusterShot"] = {Spellname ="BusterShot",Name ="Tristana",Spellslot =_R}, ["VarusQ"] = {Spellname ="VarusQ",Name ="Varus",Spellslot =_Q}, ["VarusR"] = {Spellname ="VarusR",Name ="Varus",Spellslot =_R}, ["VayneCondemm"] = {Spellname ="VayneCondemm",Name ="Vayne",Spellslot =_E}, ["VeigarPrimordialBurst"] = {Spellname ="VeigarPrimordialBurst",Name ="Veigar",Spellslot =_R}, ["WildCards"] = {Spellname ="WildCards",Name ="Twistedfate",Spellslot =_Q}, ["VelkozQ"] = {Spellname ="VelkozQ",Name ="Velkoz",Spellslot =_Q}, ["VelkozW"] = {Spellname ="VelkozW",Name ="Velkoz",Spellslot =_W}, ["ViktorDeathRay"] = {Spellname ="ViktorDeathRay",Name ="Viktor",Spellslot =_E}, ["XerathArcanoPulseChargeUp"] = {Spellname ="XerathArcanoPulseChargeUp",Name ="Xerath",Spellslot =_Q}, ["ZedShuriken"] = {Spellname ="ZedShuriken",Name ="Zed",Spellslot =_Q}, ["ZiggsR"] = {Spellname ="ZiggsR",Name ="Ziggs",Spellslot =_R}, ["ZiggsQ"] = {Spellname ="ZiggsQ",Name ="Ziggs",Spellslot =_Q}, ["ZyraGraspingRoots"] = {Spellname ="ZyraGraspingRoots",Name ="Zyra",Spellslot =_E} } ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- self.Predc = VPrediction(true) self.customQvalid = 0 self.customQ3valid = 0 self.customEvalid = 0 self.customScalar = 0 self.OnPostAttackCallbacks = {}; self.AfterAttackCallbacks = {} self.OnAttackCallbacks = {} self.BeforeAttackCallbacks = {} self.ActiveAttacks = {} self.enemyMinions = {} self.OnPostAttackCallbacks = {}; self.MyHeroIsAutoAttacking = false; self.Attacks = true self.Move = true self.LastAATick = 0 self.LastMoveCommandPosition = Vector({0,0,0}) self.LastMoveCommandT = 0 self.LastAttackCommandT = 0 self._minDistance = 400 self._missileLaunched = false self.AA = {LastTime = 0, LastTarget = nil, IsAttacking = false, Object = nil} --Passive Yasuo self.CheckQ3 = false self.CheckQ2 = false self.QP3 = {range = 1150, delay = 0.5, speed = 1500, width, 90} self.customQvalid = GetTimeGame() self.customQ3valid = GetTimeGame() self.customEvalid = GetTimeGame() self.AA = {Up = 0, Down = 0, range = 305} self.CheckTimeQ3 = 0 self.CheckTimeQ2 = 0 --Menu self.Q = Spell(_Q, 425) self.W = Spell(_W, 400) self.E = Spell(_E, 500) self.R = Spell(_R, 1400) self.Q:SetSkillShot(0.25, 1200, 150, false) self.W:SetSkillShot(0.25, math.huge, 150, false) self.E:SetTargetted() self.R:SetTargetted() --self.EnemyMinions = minionManager(MINION_ENEMY, 2000, myHero, MINION_SORT_HEALTH_ASC) Callback.Add("Tick", function() self:OnTick() end) Callback.Add("Draw", function(...) self:OnDraw(...) end) Callback.Add("DrawMenu", function(...) self:OnDrawMenu(...) end) Callback.Add("Update", function(...) self:OnUpdate(...) end) Callback.Add("ProcessSpell", function(...) self:OnProcessSpell(...) end) --Callback.Add("PlayAnimation", function(...) self:OnPlayAnimation(...) end) --Callback.Add("UpdateBuff", function(...) self:OnUpdateBuff(...) end) --Callback.Add("RemoveBuff", function(...) self:OnRemoveBuff(...) end) self:VaisefuderMenu() end function CompYasuo:MenuBool(stringKey, bool) return ReadIniBoolean(self.menu, stringKey, bool) end function CompYasuo:MenuSliderInt(stringKey, valueDefault) return ReadIniInteger(self.menu, stringKey, valueDefault) end function CompYasuo:MenuKeyBinding(stringKey, valueDefault) return ReadIniInteger(self.menu, stringKey, valueDefault) end function CompYasuo:VaisefuderMenu() self.menu = "C.Yasuo" --Combo [[ CompYasuo ]] self.CQ = self:MenuBool("Combo Q", true) self.CQDash = self:MenuBool("Use Q Dash", true) self.CQAintDash = self:MenuBool("Use Q AntDash", true) self.CQNotDash = self:MenuBool("Use Q Not Dash", false) self.CW = self:MenuBool("Combo W", true) self.CE = self:MenuBool("Combo E", true) self.CR = self:MenuBool("Combo R", true) self.EnemyRange = self:MenuSliderInt("Enemy Utimate, Range:", 2) --KillSteal [[ CompYasuo ]] self.KQ = self:MenuBool("KillSteal > Q", true) self.KR = self:MenuBool("KillSteal > R", true) --Have Yasuo self.LQ = self:MenuBool("Lane Q", true) self.LE = self:MenuBool("Lane E", true) --Draws [[ CompYasuo ]] self.DrawsOff = self:MenuBool("Draw On/Off", true) self.DQ = self:MenuBool("Draw Q", true) self.DE = self:MenuBool("Draw E", true) self.DR = self:MenuBool("Draw R", true) --KeyStone [[ CompYasuo ]] self.Combo = self:MenuKeyBinding("Combo", 32) self.LaneClear = self:MenuKeyBinding("Lane Clear", 86) self.Last_Hit = self:MenuKeyBinding("Last Hit", 88) self.Flee_Yasuo = self:MenuKeyBinding("Flee", 90) end function CompYasuo:OnDrawMenu() if Menu_Begin(self.menu) then if Menu_Begin("Combo") then self.CQ = Menu_Bool("Combo Q", self.CQ, self.menu) self.CQDash = Menu_Bool("Use Q Dash", self.CQDash, self.menu) self.CQAintDash = Menu_Bool("Use Q AntDash", self.CQAintDash, self.menu) self.CQNotDash = Menu_Bool("Use Q Not Dash", self.CQNotDash, self.menu) self.CE = Menu_Bool("Combo E", self.CE, self.menu) self.CR = Menu_Bool("Combo R", self.CR, self.menu) self.EnemyRange = Menu_SliderInt("Enemy Utimate, Range:", self.EnemyRange, 0, 5, self.menu) Menu_End() end if Menu_Begin("Lane") then self.LQ = Menu_Bool("Lane Q", self.LQ, self.menu) self.LE = Menu_Bool("Lane E", self.LE, self.menu) Menu_End() end if Menu_Begin("Draws") then self.DrawsOff = Menu_Bool("Draw On/Off", self.DrawsOff, self.menu) self.DQ = Menu_Bool("Draw Q", self.DQ, self.menu) self.DE = Menu_Bool("Draw E", self.DE, self.menu) self.DR = Menu_Bool("Draw R", self.DR, self.menu) Menu_End() end if Menu_Begin("KillSteal") then self.KQ = Menu_Bool("KillSteal > Q", self.KQ, self.menu) self.KR = Menu_Bool("KillSteal > R", self.KR, self.menu) Menu_End() end if Menu_Begin("KeyStone") then self.Combo = Menu_KeyBinding("Combo", self.Combo, self.menu) self.LaneClear = Menu_KeyBinding("Lane Clear", self.LaneClear, self.menu) self.Flee_Yasuo = Menu_KeyBinding("Flee", self.Flee_Yasuo, self.menu) self.Last_Hit = Menu_KeyBinding("Last Hit", self.Last_Hit, self.menu) Menu_End() end Menu_End() end end --[[function CompYasuo:OnPlayAnimation(unit, anim) if unit.IsMe and myHero.CharName == "Yasuo" then if anim == "Spell3" or anim == "Spell3withReload" then DelayAction(function() self:ResetAutoAttackTimer() end, 0) end end if unit.IsMe then if anim:lower():find("attack") == 1 and GetTimeGame() - self.AA.LastTime + GetLatency() >= 1 * self:AnimationTimeOrb() - 25/1000 then self.AA.IsAttacking = true self.AA.LastTime = GetTimeGame() - GetLatency() end end end]] function CompYasuo:ResetAutoAttackTimer() self.LastAATick = 0 end function CompYasuo:DisableAttacks() self.Attacks = false end function CompYasuo:EnableAttacks() self.Attacks = true end function CompYasuo:GameTimeTickCount() return GetTimeGame() end function CompYasuo:GamePing() return GetLatency() / 2000 end --[[function CompYasuo:OnUpdateBuff(unit, buff) if unit.IsMe and buff.Name == "YasuoQW" then self.CheckQ2 = true self.Q.range = 425 self.CheckTimeQ2 = GetTickCount() end if unit.IsMe and buff.Name == "YasuoQ3W" then self.CheckQ3 = true self.Q.range = 1000 self.CheckTimeQ3 = GetTickCount() end end function CompYasuo:OnRemoveBuff(unit, buff) if unit.IsMe and buff.Name == "YasuoQW" then self.CheckQ2 = false self.CheckTimeQ2 = 0 end if unit.IsMe and buff.Name == "YasuoQ3W" then self.CheckQ3 = false self.CheckTimeQ3 = 0 end end ]] function CompYasuo:DashEndPos(tar) local Estent = 0 target = GetAIHero(tar) if GetDistance(target) < 500 then Estent = Vector(myHero):Extended(Vector(target), 475) else Estent = Vector(myHero):Extended(Vector(target), GetDistance(target) + 65) end return Estent end function CompYasuo:GetGapMinion(target) local bestMinion = nil local closest = 0 GetAllUnitAroundAnObject(myHero.Addr, 1500) local units = pUnit for i, unit in pairs(units) do if unit and unit ~= 0 and IsMinion(unit) and IsEnemy(unit) and not IsDead(unit) and not IsInFog(unit) and GetTargetableToTeam(unit) == 4 and not self:Marked(GetUnit(unit)) and GetDistance(GetUnit(unit)) < 375 then if GetDistance(self:DashEndPos(GetUnit(unit)), target) < GetDistance(target) and closest < GetDistance(GetUnit(unit)) then closest = GetDistance(GetUnit(unit)) bestMinion = unit end end end return bestMinion end function CompYasuo:OnProcessSpell(unit, spell) if GetChampName(GetMyChamp()) ~= "Yasuo" then return end if self.W:IsReady() and IsValidTarget(unit.Addr, 1500) then if spell and unit.IsEnemy then spell.endPos = {x=spell.DestPos_x, y=spell.DestPos_y, z=spell.DestPos_z} if W_Bloked[spell.Name] and not unit.IsMe and GetDistance(unit) <= GetDistance(unit, spell.endPos) then CastSpellToPos(unit.x, unit.z, _W) end end end end function CompYasuo:OnDraw() if self.Q:IsReady() and self.DQ then DrawCircleGame(myHero.x , myHero.y, myHero.z, self.Q.range, Lua_ARGB(255,255,255,255)) end if self.Q:IsReady() and self.DQ and self.CheckQ3 then DrawCircleGame(myHero.x , myHero.y, myHero.z, self.Q.range, Lua_ARGB(255,255,255,255)) end if self.E:IsReady() and self.DE then DrawCircleGame(myHero.x , myHero.y, myHero.z, self.E.range, Lua_ARGB(255,255,255,255)) end if self.R:IsReady() and self.DR then DrawCircleGame(myHero.x , myHero.y, myHero.z, self.R.range, Lua_ARGB(255,255,255,255)) end end function CompYasuo:BuffDash() local t = {} local hihi, buff = 0, nil if t ~= nil then for i, buff in pairs(t) do if buff.Name == "YasuoDashScalar" and GetTimeGame() then hihi = 1 end end end end function CompYasuo:Marked(target) return target.HasBuff("YasuoDashWrapper") end local function GetDistanceSqr(p1, p2) p2 = GetOrigin(p2) or GetOrigin(myHero) return (p1.x - p2.x) ^ 2 + ((p1.z or p1.y) - (p2.z or p2.y)) ^ 2 end function CompYasuo:IsSafe(pos) GetAllUnitAroundAnObject(myHero.Addr, 2000) local objects = pUnit for k,v in pairs(objects) do if IsTurret(v) and not IsDead(v) and IsEnemy(v) and GetTargetableToTeam(v) == 4 then local turretPos = Vector(GetPosX(v), GetPosY(v), GetPosZ(v)) if GetDistanceSqr(turretPos,pos) < 915*915 then return true end end end return false end function CompYasuo:Flee() local mousePos = Vector(GetMousePos()) local myHeroPos = Vector(myHero.x, myHero.y, myHero.z) MoveToPos(mousePos.x, mousePos.z) for i ,minion in pairs(self:EnemyMinionsTbl()) do local possiblePos = myHeroPos:Extended(mousePos, self.E.range) local possibleminion = minionPos:Extended(myHeroPos, self.E.range) if minino ~= 0 and GetDistance(possibleminion) < self.E.range then CastSpellTarget(possibleminion, _E) end end end function CompYasuo:CanUlt() SearchAllChamp() local Enemies = pObjChamp for idx, enemy in ipairs(Enemies) do if enemy ~= 0 then if DistanceTo(enemy, myHero.Addr) < self.R.range then if enemy ~= nil then return end local t = {} for i = 0, enemy.PathCount do local buff = enemy:HasBuffType(i) if buff.count > 0 then table.insert(t, buff) end end if t ~= nil then for i, buff in pairs(t) do if buff.Name == "YasuoQ3Mis" and GetTimeGame() then count = count +1 if count >= self.EnemyRange then return true end elseif buff.Type == (29 or 30) and GetTimeGame() then count = count +1 if count >= self.EnemyRange then return true end end end end end end end return false end function CompYasuo:yKillSteal() local UseQ = GetTargetSelector(self.Q.range) Enemy = GetAIHero(UseQ) if CanCast(_Q) and self.KQ and UseQ ~= 0 and GetDistance(Enemy) < self.Q.range and self.CheckQ3 and GetDamage("Q", Enemy) > Enemy.HP then local CQPosition, HitChance, Position = self.Predc:GetLineCastPosition(Enemy, self.Q.delay, self.Q.width, self.Q.range, self.Q.speed, myHero, false) if HitChance >= 2 then CastSpellToPos(CQPosition.x, CQPosition.z, _Q) end end end function CompYasuo:EnemyMinionsTbl() GetAllUnitAroundAnObject(myHero.Addr, 2000) local result = {} for i, obj in pairs(pUnit) do if obj ~= 0 then local minions = GetUnit(obj) if IsEnemy(minions.Addr) and not IsDead(minions.Addr) and not IsInFog(minions.Addr) and GetType(minions.Addr) == 1 then table.insert(result, minions) end end end return result end function CompYasuo:OrbWalk(target, point) if point ~= nil then if self.Attacks and self:CanAttack() and IsValidTarget(target, 1000) then self:Attack(target) MoveToPos(point.x, point.z) end end end function CompYasuo:Attack(target) BasicAttack(target) end function CompYasuo:LaneHave() for i ,minion in pairs(self:EnemyMinionsTbl()) do if minion ~= 0 then if self.LE and IsValidTarget(minion, self.E.range) and GetDamage("E", minion) > minion.HP and not self:IsSafe(minion) and minion.IsEnemy then CastSpellTarget(minion.Addr, _E) end end if CanCast(_Q) and IsValidTarget(minion, self.Q.range) and self.LQ and minion.IsEnemy then CastSpellToPos(minion.x,minion.z, _Q) end end end function CompYasuo:LastHitE() for i ,minion in pairs(self:EnemyMinionsTbl()) do if minion ~= 0 then if IsValidTarget(minion, self.E.range) and GetDamage("E", minion) > minion.HP and not self:IsSafe(minion) and minion.IsEnemy then CastSpellTarget(minion.Addr, _E) end end end end function CompYasuo:OnTick() if IsDead(myHero.Addr) or IsTyping() or IsDodging() then return end if GetTimeGame() >= 91 then if self.customQvalid ~= 0 then if GetTimeGame() - self.customQvalid <= 0.4 then return end end if self.customQ3valid ~= 0 then if GetTimeGame() - self.customQ3valid <= 0.5 then return end end if self.customEvalid ~= 0 then if GetTimeGame() - self.customEvalid <= 0.5 then return end end end if GetSpellNameByIndex(myHero.Addr, _Q) == "YasuoQW" then self.Q.range = 425 self.Q:SetSkillShot(0.25, math.huge, 30, false) elseif GetSpellNameByIndex(myHero.Addr, _Q) == "YasuoQ3W" then self.CheckQ3 = true self.Q.range = 1000 self.Q:SetSkillShot(0.25, 1200, 90, false) end --self:LogicR() self:yKillSteal() if GetKeyPress(self.LaneClear) > 0 then self:LaneHave() end if GetKeyPress(self.Last_Hit) > 0 then self:LastHitE() end if GetKeyPress(self.Flee_Yasuo) > 0 then self:Flee() end if GetKeyPress(self.Combo) > 0 then self:QPosition() self:ECombos() self:EMinion() self:RLost() end end function CompYasuo:RLost() local UseR = GetTargetSelector(self.R.range) Enemy = GetAIHero(UseR) if CanCast(_R) and self.KR and UseR ~= 0 and GetDistance(Enemy) < self.R.range and GetDamage("R", Enemy) > Enemy.HP then CastSpellTarget(Enemy.Addr, _R) end end function CompYasuo:QPosition() local UseQ = GetTargetSelector(self.Q.range) Enemy = GetAIHero(UseQ) if CanCast(Q) and IsValidTarget(Enemy, self.Q.range) then local CEPosition, HitChance, Position = self.Predc:GetLineCastPosition(Enemy, self.Q.delay, self.Q.width, self.Q.range, self.Q.speed, myHero, false) if HitChance >= 2 then CastSpellToPos(CEPosition.x, CEPosition.z, _Q) end end --[[if CanCast(Q) and IsValidTarget(Enemy, self.Q.range) then local CEPosition, HitChance, Position = self.Predc:GetLineCastPosition(Enemy, self.Q.delay, self.Q.width, self.Q.range, self.Q.speed, myHero, false) if HitChance >= 2 then CastSpellToPos(CEPosition.x, CEPosition.z, _Q) end end ]] end function CompYasuo:ECombos() local UseE = GetTargetSelector(self.E.range) Enemy = GetAIHero(UseE) if UseE ~= 0 then if self.E:IsReady() then if self.CE and IsValidTarget(Enemy, self.E.range) and not self:Marked(Enemy) and self:DashEndPos(Enemy) then CastSpellTarget(Enemy.Addr, _E) end end end end function CompYasuo:OnUpdate() -- end
local Observable = require 'observable' local util = require 'util' --- Returns a new Observable that subscribes to the Observables produced by the original and -- produces their values. -- @returns {Observable} function Observable:flatten() return Observable.create(function(observer) local function onError(message) return observer:onError(message) end local function onNext(observable) local function innerOnNext(...) observer:onNext(...) end observable:subscribe(innerOnNext, onError, util.noop) end local function onCompleted() return observer:onCompleted() end return self:subscribe(onNext, onError, onCompleted) end) end
require('..') tmp = torch.rand(5, 5, 2) res1 = tmp[{{},{1}}] tmp[{{2, 5},{1}}]:zero() print(tmp) print(tmp[{{1, 2},{1}}]) print(tmp[{{1, 2},{2}}]) local network = dmn.BatchMask() local indices = torch.IntTensor(5, 2):fill(1) indices[2]:fill(2) indices[3]:fill(3) local masked_input = network:forward(tmp, indices) local input = network:backward(tmp, indices, torch.rand(5, 5, 2)) print(masked_input) print(input) tmp = torch.rand(5, 2) local res1 = network:forward(tmp, indices) local res2 = network:backward(tmp, indices, torch.rand(5, 2)) print(res1 - tmp) print(res2)
local util = require("__bztungsten__.data-util"); if mods["5dim_core"] then data.raw.item["tungsten-plate"].subgroup = "plates-plates" data.raw.recipe["tungsten-plate"].subgroup = "plates-plates" data.raw.recipe["tungsten-carbide"].subgroup = "plates-misc" data.raw.item["tungsten-carbide"].subgroup = "plates-misc" data.raw.item["tungsten-ore"].subgroup = "plates-ore" -- Industrial furnace data:extend({ { type = "recipe", name = "tungsten-plate-industrial-ore", category = "industrial-furnace", subgroup = "plates-industrial-ore", order = "ad[tungsten-plate]", icon = "__bztungsten__/graphics/icons/tungsten-plate.png", icon_size = 128, icon_mipmaps = 3, enabled = true, energy_required = 50, ingredients = {{"tungsten-ore", 85}}, result = "tungsten-plate", result_count = 50, } }) -- Lead dust data:extend( { { type = "item", name = "tungsten-dust", subgroup = "plates-dust", order = "d[tungsten-plate]", icon = "__bztungsten__/graphics/icons/tungsten-powder.png", icon_size = 64, icon_mipmaps = 3, stack_size = 200 }, { type = "recipe", name = "tungsten-plate-dust", icon = "__bztungsten__/graphics/icons/tungsten-plate.png", icon_size = 128, icon_mipmaps = 3, subgroup = "plates-plates2", order = "d[tungsten-plate]", category = "smelting", energy_required = 32/15, enabled = true, ingredients = { {"tungsten-dust", 2} }, result = "tungsten-plate", }, { type = "recipe", name = "tungsten-dust", icon = "__bztungsten__/graphics/icons/tungsten-powder.png", icon_size = 64, icon_mipmaps = 3, category = "mashering", subgroup = "", order = "d[tungsten-plate]", energy_required = 3.2, enabled = true, ingredients = { {"tungsten-ore", 1} }, results = { {type="item", name = "tungsten-dust", amount=2}, } }, { type = "recipe", name = "tungsten-plate-industrial-dust", category = "industrial-furnace", subgroup = "plates-industrial-dust", order = "ad[tungsten-plate]", icon = "__bztungsten__/graphics/icons/tungsten-plate.png", icon_size = 128, icon_mipmaps = 3, enabled = true, energy_required = 50, ingredients = {{"tungsten-dust", 85}}, result = util.tungsten_plate, result_count = 50, }, { type = "recipe", name = "tungsten-carbide-industrial-dust", category = "industrial-furnace", subgroup = "plates-industrial-ore", order = "ae[tungsten-carbide]", icon = "__bztungsten__/graphics/icons/tungsten-carbide.png", icon_size = 128, icon_mipmaps = 3, enabled = true, energy_required = 500, ingredients = {{"tungsten-plate", 85}}, result = util.tungsten_plate, result_count = 20, } }) local mks = {"02", "03", "04", "05", "06", "07", "08", "09", "10"} local items = {"5d-electric-mining-drill-", "5d-chemical-plant-"} for i, mk in pairs(mks) do for j, item in pairs(items) do util.add_ingredient(item..mk, "tungsten-carbide", 1) end end local mks = {"04", "05", "06", "07", "08", "09", "10"} local items = {"5d-assembling-machine-"} for i, mk in pairs(mks) do for j, item in pairs(items) do util.add_ingredient(item..mk, "tungsten-carbide", 2) end end local mks = {"02", "03", "04", "05", "06", "07", "08", "09", "10"} local items = {"5d-electric-furnace-"} for i, mk in pairs(mks) do for j, item in pairs(items) do util.add_ingredient(item..mk, "tungsten-plate", 5) end end local mks = {"02", "03", "04", "05", "06", "07", "08", "09", "10"} local items = {"5d-heat-pipe-"} for i, mk in pairs(mks) do for j, item in pairs(items) do util.replace_some_ingredient(item..mk, "copper-plate", 10, "tungsten-plate", 10) end end local mks = {"02", "03", "04", "05", "06", "07", "08", "09", "10"} local items = {"5d-heat-exchanger-"} for i, mk in pairs(mks) do for j, item in pairs(items) do util.replace_some_ingredient(item..mk, "copper-plate", 50, "tungsten-plate", 50) end end local mks = {"02", "03", "04", "05", "06", "07", "08", "09", "10"} local items = {"5d-nuclear-reactor-"} for i, mk in pairs(mks) do for j, item in pairs(items) do util.add_ingredient(item..mk, "tungsten-plate", 400) end end end
local CamTools = {} local Modules = script.Parent local VectorMath = require(Modules:WaitForChild("VectorMath")) --SIMPLIFIED frustum view implementation using WorldToScreenPoint CamTools.InFrustum = function(camera, objCF, objSize) local corners = VectorMath.Corners(objCF, objSize + Vector3.new(40, 40, 40)) for i, corner in pairs(corners) do local screenSpacePos, inView = camera:WorldToViewportPoint(corner) if inView == true then return true end end return false end --[[CamTools.InFrustum = function(camera, interestPosition, interestSize) --Given a camera instance and the position and size of a particular interest, determine if said interest is within the camera's view frustum. --Get camera field of view to establish plane normals: local angle = CamTools.GetHorizontalFOV(camera) ----print("Angle",angle) local right_plane = (camera.CFrame * CFrame.fromAxisAngle(camera.CFrame.UpVector, math.rad(-angle))).p.Unit local left_plane = (camera.CFrame * CFrame.fromAxisAngle(camera.CFrame.UpVector, math.rad((-angle + 90)))).p.Unit --Given a plane, add the magnitude of the interest position's vector projected to the normal of the plane to the plane's position to get the interest position's distance from the plane ----print("Planes:", right_plane, left_plane) local cR = VectorMath.Project(interestPosition, right_plane) - right_plane local cL = VectorMath.Project(interestPosition, left_plane) - left_plane --print("C",cR, cL) end]]-- CamTools.GetHorizontalFOV = function(camera) local verticalFov = math.rad(camera.FieldOfView) local aspectRatio = camera.ViewportSize.X / camera.ViewportSize.Y return math.deg(2 * math.atan(math.tan(verticalFov / 2) * aspectRatio)) end return CamTools
-- -- Example based on: -- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/net/reuseport_bpf_cpu.c -- https://github.com/cloudflare/cloudflare-blog/blob/master/2017-11-perfect-locality/setcbpf.stp -- -- XXX_1: Will be gone. Need to extend ljsyscall. We are missing constants. Ignore for now. local SKF_AD_OFF = -0x1000 local SKF_AD_PROTOCOL = 0 local SKF_AD_PKTTYPE = 4 local SKF_AD_IFINDEX = 8 local SKF_AD_NLATTR = 12 local SKF_AD_NLATTR_NEST = 16 local SKF_AD_MARK = 20 local SKF_AD_QUEUE = 24 local SKF_AD_HATYPE = 28 local SKF_AD_RXHASH = 32 local SKF_AD_CPU = 36 local SKF_AD_ALU_XOR_X = 40 local SKF_AD_VLAN_TAG = 44 local SKF_AD_VLAN_TAG_PRESENT = 48 local SKF_AD_PAY_OFFSET = 52 local SKF_AD_MAX = 56 local SKF_NET_OFF = -0x100000 local SKF_LL_OFF = -0x200000 server_socket( function (sockfd) -- XXX_2: Will be gone. Need to extend script_prelude.h. Ignore for now. local ffi = require("ffi") local sys = require("syscall") local sizeof = ffi.sizeof local sock_filter = sys.types.t.sock_filter local sock_filters = sys.types.t.sock_filters local sock_fprog1 = sys.types.t.sock_fprog1 -- XXX_3: Defined here because can't use cdata as upvalue (yet). Will be moved to top-level. local group_size = 16 local code = { sock_filter("LD,W,ABS", SKF_AD_OFF + SKF_AD_CPU), -- A = #cpu sock_filter("ALU,MOD,K", tonumber(group_size)), -- A = A % group_size sock_filter("RET,A"), -- return A } local prog = sock_fprog1( {{ #code, sock_filters(#code, code) }}) -- Ugh, ugly. assert(prog, "Failed to create sock_fprog") local ok, err = setsockopt(sockfd, SOL_SOCKET, SO_REUSEPORT, true) assert(ok, tostring(err)) local ok, err = setsockopt(sockfd, SOL_SOCKET, SO_ATTACH_REUSEPORT_CBPF, prog, sizeof(prog)) assert(ok, tostring(err)) end )
local composer = require( "composer" ) local scene = composer.newScene() local _groot local _view local _bagWindow local BagWindow = class('BagWindow', Window) function BagWindow:onInit() self.contentPane = UIPackage.createObject("Bag", "BagWin") self:center() end function BagWindow:onShown() local list = self.contentPane:getChild("list") list:on("clickItem", self.onClickItem, self) local this = self list.itemRenderer = function(index, obj) this:renderListItem(index, obj) end list:setVirtual() list.numItems = 45 end function BagWindow:renderListItem(index, obj) obj.icon = "Icons/i"..(math.floor(math.random(10))-1)..".png" obj.text = "" ..math.floor(math.random(100)) end function BagWindow:onClickItem(context) local item = context.data self.contentPane:getChild("n11").url = item.icon self.contentPane:getChild("n13").text = item.icon end function scene:create( event ) _groot = GRoot.create(self) UIPackage.addPackage('UI/Bag') composer.addCloseButton() _view = UIPackage.createObject("Bag", "Main") _view:makeFullScreen() _groot:addChild(_view) _bagWindow = BagWindow.new() _view:getChild("bagBtn"):onClick(function() _bagWindow:show() end); end function scene:destroy( event ) _groot:dispose() UIPackage.removePackage('Bag') end scene:addEventListener( "create", scene ) scene:addEventListener( "destroy", scene ) return scene
--- The graphic library is a wrapper around paintutils. -- @module[kind=skyos] graphic -- @deprecated use blit. local graphic = {} -- Graphics library for SkyOS local to_colors, to_blit = {}, {} for i = 1, 16 do to_blit[2^(i-1)] = ("0123456789abcdef"):sub(i, i) to_colors[("0123456789abcdef"):sub(i, i)] = 2^(i-1) end --- drawFilledBox draws a filled in box at the specified coordinates -- @tparam number x topleft x coordinate of the box -- @tparam number y topleft y coordinate of the box -- @tparam number x2 bottomright x coordinate of the box -- @tparam number y2 bottomright y coordinate of the box -- @tparam number colour colour of the box -- @tparam table output output terminal of the box function graphic.drawFilledBox(nX1,nY1,nX2,nY2,nC,tOutput) tOutput = tOutput or term.current() local currentX,currentY = tOutput.getCursorPos() local col = to_blit[nC] local w = tonumber(nX2)-tonumber(nX1)+1 for i=tonumber(nY1),tonumber(nY2) do tOutput.setCursorPos(tonumber(nX1),i) tOutput.blit(string.rep(" ",w),string.rep(col,w),string.rep(col,w)) end tOutput.setCursorPos(currentX,currentY) end --- drawBox draws a hollow box at the specified coordinates -- @tparam number x topleft x coordinate of the box -- @tparam number y topleft y coordinate of the box -- @tparam number x2 bottomright x coordinate of the box -- @tparam number y2 bottomright y coordinate of the box -- @tparam number colour colour of the box -- @tparam table output output terminal of the box function graphic.drawBox(nX1,nY1,nX2,nY2,nC,tOutput) tOutput = tOutput or term.current() local nCurFG = tOutput.getTextColour() local nCurBG = tOutput.getBackgroundColour() local nCurX, nCurY = tOutput.getCursorPos() paintutils.drawBox(tonumber(nX1),tonumber(nY1),tonumber(nX2),tonumber(nY2),tonumber(nC),tOutput) tOutput.setCursorPos(nCurX,nCurY) tOutput.setTextColour(nCurFG) tOutput.setBackgroundColour(nCurBG) end --- drawPixel draws a single pixel at the specified coordinates -- @tparam number x x coordinate of the pixel -- @tparam number y y coordinate of the pixel -- @tparam number colour colour of the pixel -- @tparam table output output terminal of the pixel function graphic.drawPixel(nX,nY,nC,tOutput) tOutput = tOutput or term.current() local nCurFG = tOutput.getTextColour() local nCurBG = tOutput.getBackgroundColour() local nCurX, nCurY = tOutput.getCursorPos() paintutils.drawPixel(tonumber(nX),tonumber(nY),tonumber(nC),tOutput) tOutput.setCursorPos(nCurX,nCurY) tOutput.setTextColour(nCurFG) tOutput.setBackgroundColour(nCurBG) end --- drawText draws a textline with set colours -- @tparam number x x coordinate of the start of the text -- @tparam number y y coordinate of the start of the text -- @tparam number fg colour of the text -- @tparam number bg background colour of the text -- @tparam string text the text to write -- @tparam table output output terminal of the text function graphic.drawText(nX,nY,nFG,nBG,sText,tOutput) tOutput = tOutput or term.current() local nCurFG = tOutput.getTextColour() local nCurBG = tOutput.getBackgroundColour() local nCurX, nCurY = tOutput.getCursorPos() tOutput.setCursorPos(tonumber(nX),tonumber(nY)) tOutput.setTextColour(tonumber(nFG)) tOutput.setBackgroundColour(tonumber(nBG)) tOutput.write(sText) tOutput.setCursorPos(nCurX,nCurY) tOutput.setTextColour(nCurFG) tOutput.setBackgroundColour(nCurBG) end --- drawLine draws a line between the two coordinates -- @tparam number x1 x coordinate of one end -- @tparam number y2 y coordinate of one end -- @tparam number x2 x coordinate of the other end -- @tparam number y2 y coordinate of the other end -- @tparam number colour colour of the line -- @tparam table output output terminal of the line function graphic.drawLine(nX1, nY1, nX2, nY2, nCol, tOutput) tOutput = tOutput or term.current() local nCurFG = tOutput.getTextColour() local nCurBG = tOutput.getBackgroundColour() local nCurX, nCurY = tOutput.getCursorPos() paintutils.drawLine(tonumber(nX1),tonumber(nY1),tonumber(nX2),tonumber(nY2),tonumber(nCol)) tOutput.setCursorPos(nCurX,nCurY) tOutput.setTextColour(nCurFG) tOutput.setBackgroundColour(nCurBG) end return graphic
data:extend({ { type = "recipe", name = "advanced-probe", category = "satellite-crafting", energy_required = 200, enabled = "false", ingredients = { {"satellite-bus", 1}, {"satellite-radar", 1}, {"satellite-flight-computer", 1}, {"satellite-thruster", 1,}, {"radioisotope-thermoelectric-generator", 1}, {"satellite-communications", 1}, }, result = "advanced-probe", } })
local util = require("util") local original_ngx = ngx local function reset_ngx() _G.ngx = original_ngx end local function mock_ngx(mock) local _ngx = mock setmetatable(_ngx, { __index = ngx }) _G.ngx = _ngx end local function flush_all_ewma_stats() ngx.shared.balancer_ewma:flush_all() ngx.shared.balancer_ewma_last_touched_at:flush_all() end local function store_ewma_stats(endpoint_string, ewma, touched_at) ngx.shared.balancer_ewma:set(endpoint_string, ewma) ngx.shared.balancer_ewma_last_touched_at:set(endpoint_string, touched_at) end local function assert_ewma_stats(endpoint_string, ewma, touched_at) assert.are.equals(ewma, ngx.shared.balancer_ewma:get(endpoint_string)) assert.are.equals(touched_at, ngx.shared.balancer_ewma_last_touched_at:get(endpoint_string)) end describe("Balancer ewma", function() local balancer_ewma = require("balancer.ewma") local ngx_now = 1543238266 local backend, instance before_each(function() mock_ngx({ now = function() return ngx_now end, var = { balancer_ewma_score = -1 } }) backend = { name = "namespace-service-port", ["load-balance"] = "ewma", endpoints = { { address = "10.10.10.1", port = "8080", maxFails = 0, failTimeout = 0 }, { address = "10.10.10.2", port = "8080", maxFails = 0, failTimeout = 0 }, { address = "10.10.10.3", port = "8080", maxFails = 0, failTimeout = 0 }, } } store_ewma_stats("10.10.10.1:8080", 0.2, ngx_now - 1) store_ewma_stats("10.10.10.2:8080", 0.3, ngx_now - 5) store_ewma_stats("10.10.10.3:8080", 1.2, ngx_now - 20) instance = balancer_ewma:new(backend) end) after_each(function() reset_ngx() flush_all_ewma_stats() end) describe("after_balance()", function() it("updates EWMA stats", function() ngx.var = { upstream_addr = "10.10.10.2:8080", upstream_connect_time = "0.02", upstream_response_time = "0.1" } instance:after_balance() local weight = math.exp(-5 / 10) local expected_ewma = 0.3 * weight + 0.12 * (1.0 - weight) assert.are.equals(expected_ewma, ngx.shared.balancer_ewma:get(ngx.var.upstream_addr)) assert.are.equals(ngx_now, ngx.shared.balancer_ewma_last_touched_at:get(ngx.var.upstream_addr)) end) end) describe("balance()", function() it("returns single endpoint when the given backend has only one endpoint", function() local single_endpoint_backend = util.deepcopy(backend) table.remove(single_endpoint_backend.endpoints, 3) table.remove(single_endpoint_backend.endpoints, 2) local single_endpoint_instance = balancer_ewma:new(single_endpoint_backend) local peer = single_endpoint_instance:balance() assert.are.equals("10.10.10.1:8080", peer) assert.are.equals(-1, ngx.var.balancer_ewma_score) end) it("picks the endpoint with lowest decayed score", function() local two_endpoints_backend = util.deepcopy(backend) table.remove(two_endpoints_backend.endpoints, 2) local two_endpoints_instance = balancer_ewma:new(two_endpoints_backend) local peer = two_endpoints_instance:balance() -- even though 10.10.10.1:8080 has a lower ewma score -- algorithm picks 10.10.10.3:8080 because its decayed score is even lower assert.equal("10.10.10.3:8080", peer) assert.are.equals(0.16240233988393523723, ngx.var.balancer_ewma_score) end) end) describe("sync()", function() it("does not reset stats when endpoints do not change", function() local new_backend = util.deepcopy(backend) instance:sync(new_backend) assert.are.same(new_backend.endpoints, instance.peers) assert_ewma_stats("10.10.10.1:8080", 0.2, ngx_now - 1) assert_ewma_stats("10.10.10.2:8080", 0.3, ngx_now - 5) assert_ewma_stats("10.10.10.3:8080", 1.2, ngx_now - 20) end) it("updates peers, deletes stats for old endpoints and sets average ewma score to new ones", function() local new_backend = util.deepcopy(backend) -- existing endpoint 10.10.10.2 got deleted -- and replaced with 10.10.10.4 new_backend.endpoints[2].address = "10.10.10.4" -- and there's one new extra endpoint table.insert(new_backend.endpoints, { address = "10.10.10.5", port = "8080", maxFails = 0, failTimeout = 0 }) instance:sync(new_backend) assert.are.same(new_backend.endpoints, instance.peers) assert_ewma_stats("10.10.10.1:8080", 0.2, ngx_now - 1) assert_ewma_stats("10.10.10.2:8080", nil, nil) assert_ewma_stats("10.10.10.3:8080", 1.2, ngx_now - 20) local slow_start_ewma = (0.2 + 1.2) / 2 assert_ewma_stats("10.10.10.4:8080", slow_start_ewma, ngx_now) assert_ewma_stats("10.10.10.5:8080", slow_start_ewma, ngx_now) end) it("does not set slow_start_ewma when there is no existing ewma", function() local new_backend = util.deepcopy(backend) table.insert(new_backend.endpoints, { address = "10.10.10.4", port = "8080", maxFails = 0, failTimeout = 0 }) -- when the LB algorithm instance is just instantiated it won't have any -- ewma value set for the initial endpoints (because it has not processed any request yet), -- this test is trying to simulate that by flushing existing ewma values flush_all_ewma_stats() instance:sync(new_backend) assert_ewma_stats("10.10.10.1:8080", nil, nil) assert_ewma_stats("10.10.10.2:8080", nil, nil) assert_ewma_stats("10.10.10.3:8080", nil, nil) assert_ewma_stats("10.10.10.4:8080", nil, nil) end) end) end)
local o = require("buftabline.options") local b = require("buftabline.buffers") local buftabline = require("buftabline") local reset = function() vim.cmd("bufdo bwipeout!") end describe("buftarget", function() it("should call specified command on specified buffer", function() reset() for i = 1, 5 do vim.cmd("e" .. i) end buftabline.buftarget(1, "buffer") local buffers = b.get_buffers() assert.equals(buffers[1].current, true) end) it("should target 10th buffer when number == 0", function() reset() for i = 1, 10 do vim.cmd("e" .. i) end buftabline.buftarget(1, "buffer") buftabline.buftarget(10, "buffer") local buffers = b.get_buffers() assert.equals(buffers[10].current, true) end) end) describe("toggle_tabline", function() it("should hide tabline when visible", function() vim.o.showtabline = 2 buftabline.toggle_tabline() assert.equals(vim.o.showtabline, 0) end) it("should show tabline when hidden", function() vim.o.showtabline = 0 buftabline.toggle_tabline() assert.equals(vim.o.showtabline, 2) end) end) describe("custom_command", function() it("should call custom command when set", function() o.set({custom_command = "buffer"}) reset() for i = 1, 5 do vim.cmd("e" .. i) end buftabline.custom_command(1) local buffers = b.get_buffers() assert.equals(buffers[1].current, true) end) it("should throw an error when custom command is falsy", function() o.set({custom_command = false}) -- setting to nil doesn't work w/ tbl_extend assert.has_error(function() buftabline.custom_command(1) end) end) end) describe("build_bufferline", function() it("should build default bufferline from list of buffers", function() reset() for i = 1, 5 do vim.cmd("e" .. i) end local bufferline = buftabline.build_bufferline() assert.equals(bufferline, "%#TabLineFill# 1: 1 %*%#TabLineFill# 2: 2 %*%#TabLineFill# 3: 3 %*%#TabLineFill# 4: 4 %*%#TabLineSel# 5: 5 %*") end) it( "should throw an error when icons == true but devicons are not available", function() o.set({icons = true}) assert.has_error(function() buftabline.build_bufferline() end) end) end) describe("next_buffer", function() it("should target next buffer", function() reset() for i = 1, 5 do vim.cmd("e" .. i) end local buf_numbers = b.get_buf_numbers() vim.cmd("buffer " .. buf_numbers[3]) buftabline.next_buffer() local current_buf_number = b.get_current_buf_number() assert.equals(current_buf_number, 4) end) it("should wrap and target 1st buffer when current buffer is last buffer", function() reset() for i = 1, 5 do vim.cmd("e" .. i) end local buf_numbers = b.get_buf_numbers() vim.cmd("buffer " .. buf_numbers[5]) buftabline.next_buffer() local current_buf_number = b.get_current_buf_number() assert.equals(current_buf_number, 1) end) end) describe("prev_buffer", function() it("should target previous buffer", function() reset() for i = 1, 5 do vim.cmd("e" .. i) end local buf_numbers = b.get_buf_numbers() vim.cmd("buffer " .. buf_numbers[3]) buftabline.prev_buffer() local current_buf_number = b.get_current_buf_number() assert.equals(current_buf_number, 2) end) it("should wrap and target last buffer when current buffer is first buffer", function() reset() for i = 1, 5 do vim.cmd("e" .. i) end local buf_numbers = b.get_buf_numbers() vim.cmd("buffer " .. buf_numbers[1]) buftabline.prev_buffer() local current_buf_number = b.get_current_buf_number() assert.equals(current_buf_number, 5) end) end)
// Wildfire Black Mesa Roleplay // File description: BMRP crystal system script // Copyright (c) 2022 KiwifruitDev // Licensed under the MIT License. //********************************************************************************************* // 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. //********************************************************************************************* // BASE FILE HEADER DO NOT MODIFY!! // local ent = FindMetaTable("Entity") // local ply = FindMetaTable("Player") // local vec = FindMetaTable("Vector") // // ================================ // // Every file needs this :) include("autorun/sh_bmrp.lua") // Purple crystal vector bounds local purple = { Vector(-5335.317383, -11369.000977, -2624.817627), Vector(-5763.113281, -11093.235352, -2900.767090), } // Green crystals vector bounds local green = { Vector(-5975.271973, -8271.554688, -1893.910034), Vector(-5681.434570, -7832.852051, -2151.242676), } // Red crystals vector bounds local red = { Vector(-6496.148926, -12817.813477, 220.980255), Vector(-6650.963379, -12709.971680, 109.932632), } // Orange crystals vector bounds // This is basically the entirety of xen local orange = { Vector(-1017.688904, -5353.187012, 1311.713013), Vector(-11005.366211, -13998.221680, -7347.238281), } // The names of the crystals local crystalids = { "Purple Crystal", "Green Crystal", "Red Crystal", "Orange Crystal", } local function DeleteCrystals(ply) // Psuedo print function local function prt(txt) if IsValid(ply) then if ply:IsPlayer() then return ply:ChatPrint(txt) end end return print(txt) end // these are the crystals themselves local everyent = { [crystalids[1]] = ents.FindInBox(purple[1], purple[2]), [crystalids[2]] = ents.FindInBox(green[1], green[2]), [crystalids[3]] = ents.FindInBox(red[1], red[2]), [crystalids[4]] = ents.FindInBox(orange[1], orange[2]), // haha orange box go brr } prt("======= Deleting xen crystals... =======") local totalcrystals = {} local allcrystals = {} for k,v in pairs(crystalids) do allcrystals = {} for k1,v1 in pairs(everyent[v]) do if IsValid(v1) then if v1:GetClass() == "func_physbox" then table.insert(allcrystals, v1:MapCreationID()) table.insert(totalcrystals, v1:MapCreationID()) v1:Remove() end end end prt("------- Found "..#allcrystals.." "..v.."s -------") end prt("======= Done! "..#totalcrystals.." total deleted! =======") end concommand.Add("dev_resetcrystals", function(ply, cmd, args) if not IsValid(ply) then return end if not ply:IsDeveloper() then return end DeleteCrystals(ply) ply:ChatPrint("All crystals deleted.") end) BMRP.AddToMapReset("BMRP_ResetCrystals", DeleteCrystals)
------------------------------------------------------------------ -- -- Author: Alexey Melnichuk <alexeymelnichuck@gmail.com> -- -- Copyright (C) 2016 Alexey Melnichuk <alexeymelnichuck@gmail.com> -- -- Licensed according to the included 'LICENSE' document -- -- This file is part of lua-EventEmitter library. -- ------------------------------------------------------------------ local EE = { _NAME = "EventEmitter"; _VERSION = "0.1.2-dev"; _COPYRIGHT = "Copyright (C) 2016 Alexey Melnichuk"; _LICENSE = "MIT"; } local ut = require "EventEmitter.utils" local function callable(f) return type(f) == 'function' end local function empty(t) return (not t) or (nil == next(t)) end local BasicEventEmitter = ut.class() do local ANY_EVENT = {} BasicEventEmitter.ANY = ANY_EVENT function BasicEventEmitter:__init() -- map of array of listeners self._handlers = {} -- map to convert user's listener to internal wrapper self._once = {} return self end function BasicEventEmitter:on(event, handler) local list = self._handlers[event] or {} for i = 1, #list do if list[i] == handler then return self end end list[#list + 1] = handler self._handlers[event] = list return self end function BasicEventEmitter:many(event, ttl, handler) self:off(event, handler) local function listener(...) ttl = ttl - 1 if ttl == 0 then self:off(event, handler) end handler(...) end self:on(event, listener) self._once[handler] = listener return self end function BasicEventEmitter:once(event, handler) return self:many(event, 1, handler) end function BasicEventEmitter:off(event, handler) local list = self._handlers[event] if not list then return self end if handler then local listener = self._once[handler] or handler self._once[handler] = nil for i = 1, #list do if list[i] == listener then table.remove(list, i) break end end if #list == 0 then self._handlers[event] = nil end else for handler, listener in pairs(self._once) do for i = 1, #list do if list[i] == listener then self._once[handler] = nil break end end end self._handlers[event] = nil end return self end function BasicEventEmitter:onAny(handler) return self:on(ANY_EVENT, handler) end function BasicEventEmitter:manyAny(ttl, handler) return self:many(ANY_EVENT, ttl, handler) end function BasicEventEmitter:onceAny(handler) return self:once(ANY_EVENT, handler) end function BasicEventEmitter:offAny(handler) return self:off(ANY_EVENT, handler) end function BasicEventEmitter:_emit_impl(call_any, event, ...) local ret = false if call_any and ANY_EVENT ~= event then ret = self:_emit_impl(false, ANY_EVENT, ...) or ret end local list = self._handlers[event] if list then for i = #list, 1, -1 do if list[i] then -- we need this check because cb could remove some listeners list[i](...) ret = true end end end return ret end function BasicEventEmitter:emit(event, ...) return self:_emit_impl(true, event, ...) end function BasicEventEmitter:_emit_all(...) -- we have to copy because cb can remove/add some events -- and we do not need call new one or removed one local names = {} for name in pairs(self._handlers) do names[#names+1] = name end local ret = false for i = 1, #names do ret = self:_emit_impl(false, names[i], ...) or ret end return ret end function BasicEventEmitter:_empty() return nil == next(self._handlers) end function BasicEventEmitter:removeAllListeners(eventName) if not eventName then self._handlers = {} self._once = {} else self:off(eventName) end return self end end local TreeEventEmitter = ut.class() do local ANY = BasicEventEmitter.ANY local AN2 = {} -- each `node` has two parts -- array part has: -- [1] - BasicEventEmitter -- hash part is map -- [sub event] => node -- -- 'A'=>e0 -- 'A::*'=>e1 -- 'A::B'=>e2 -- 'A::*::B'=>e5 -- 'A::B::C'=>e3 -- 'A::B::*'=>e4 -- 'A::**'=>e6 -- 'A::**::B'=>e7 -- node{ -- 1 = EE{ -- A => E0 -- } -- A = { -- 1 = EE{ -- * => e1 -- ** => e6 -- B => e2 -- } -- B = node{ -- 1 = EE{ -- * => e4 -- C => e3 -- } -- } -- * = node{ -- 1 = EE{ -- B => e5 -- } -- } -- ** = node{ -- 1 = EE{ -- B => e5 -- } -- } -- } -- } function TreeEventEmitter:__init(sep, wildcard) self._sep = sep or '.' self._wld = wildcard or '*' self._wl2 = self._wld .. self._wld self._any = BasicEventEmitter.new() self._tree = {} return self end local function find_emitter(self, event, create, node, cb, ...) local name, tail = ut.split_first(event, self._sep, true) if not tail then event = (event == self._wld) and ANY or (event == self._wl2) and AN2 or event local emitter = node[1] if not emitter then if not create then return false end emitter = BasicEventEmitter.new() node[1] = emitter end cb(emitter, event, ...) -- remove empty emitter. We really need check only on `off` event if (not create) and emitter:_empty() then node[1] = nil end return true end -- If we have tail and this tail is not wildcard then we -- need continue search in subtree local tree = node[name] if not tree then -- If we just whant remove event wich does not exists we do not need -- create subtree, we just can stop search if not create then return end tree = {} node[name] = tree end local ret = find_emitter(self, tail, create, tree, cb, ...) if (not create) and empty(tree) then node[name] = nil end return ret end function TreeEventEmitter:many(event, ...) find_emitter(self, event, true, self._tree, BasicEventEmitter.many, ...) return self end function TreeEventEmitter:once(event, ...) find_emitter(self, event, true, self._tree, BasicEventEmitter.once, ...) return self end function TreeEventEmitter:on(event, ...) find_emitter(self, event, true, self._tree, BasicEventEmitter.on, ...) return self end function TreeEventEmitter:off(event, ...) find_emitter(self, event, false, self._tree, BasicEventEmitter.off, ...) return self end -- wld true if `node` is match to `**` local function do_emit(self, wld, event, node, ...) local ret = false if not node then return ret end local name, tail = ut.split_first(event, self._sep, true) if not tail then -- match mask to event local emitter = node[1] if emitter then if event == self._wld then ret = emitter:_emit_all() or ret else ret = emitter:_emit_impl(false, AN2, ...) or ret ret = emitter:emit(event, ...) or ret end if emitter:_empty() then node[1] = nil end end -- match mask is 'A::**::B' and event is 'A::B' emitter = node[self._wl2] and node[self._wl2][1] if emitter then if event == self._wld then ret = emitter:_emit_all() or ret else ret = emitter:emit(event, ...) or ret end if node[self._wl2] then if emitter:_empty() then node[self._wl2][1] = nil end if empty(node[self._wl2]) then node[self._wl2] = nil end end end -- match mask 'A::**' to event 'A' emitter = node[name] and node[name][1] if emitter then ret = emitter:_emit_impl(false, AN2, ...) or ret if node[name] then if emitter:_empty() then node[name][1] = nil end if empty(node[name]) then node[name] = nil end end end return ret end -- if we have mask like `A::**` and emit event say `A::B::C` then -- we have call this listener for node `A` if node[1] then ret = node[1]:_emit_impl(false, AN2, ...) or ret if node[1] and node[1]:_empty() then node[1] = nil end end -- wld = true if current node has mask == '**' if wld then -- we should keep looking tail in current node ret = do_emit(self, true, tail, node, ...) or ret elseif node[self._wl2] then -- we should start looking event in wildcard node -- e.g. we have mask='A::**::B' and event='A::B' -- so here name = 'A', tail = 'B' so we have to use `event` ret = do_emit(self, true, event, node[self._wl2], ...) or ret if empty(node[self._wl2]) then node[self._wl2] = nil end end -- here we handle wildcard in mask like `A::*::B` if node[self._wld] then ret = do_emit(self, false, tail, node[self._wld], ...) or ret if empty(node[self._wld]) then node[self._wld] = nil end end -- check if event has wildcard like `A::*` if name == self._wld then for k, v in pairs(node) do if (k ~= 1) and (k ~= self._wld) and (k ~= self._wl2) then ret = do_emit(self, false, tail, v, ...) or ret if empty(v) then node[k] = nil end end end else if node[name] then ret = do_emit(self, false, tail, node[name], ...) or ret -- listener can remove self from EE so there may be no `node[name]` any more if empty(node[name]) then node[name] = nil end end end return ret end function TreeEventEmitter:emit(event, ...) local ret = self._any:emit(ANY, ...) return do_emit(self, false, event, self._tree, ...) or ret end function TreeEventEmitter:onAny(handler) self._any:onAny(handler) return self end function TreeEventEmitter:manyAny(ttl, handler) self._any:manyAny(ttl, handler) return self end function TreeEventEmitter:onceAny(handler) self._any:onceAny(handler) return self end function TreeEventEmitter:offAny(handler) self._any:offAny(handler) return self end function TreeEventEmitter:removeAllListeners(eventName) if not eventName then self._any:removeAllListeners() self._tree = {} else self:off(eventName) end return self end end do -- Debug code -- local C = {} -- local c = function(str) C[str]= C[str] or function() print(str) end; return C[str] end -- local server = TreeEventEmitter.new('::') -- server:on('A', c'e0'); -- server:on('A::*', c'e1'); -- server:on('A::**', c'e2'); -- server:on('A::**::C', c'e3'); -- server:on('A::**::B::C', c'e4'); -- server:once('A::**::B::C', c'e4'); -- server:emit('A::B') -- server:emit('A::*') -- server:emit('A::B::C') -- local function h() server:off('A::**::B', h) end -- server:on('A::**::B', h); -- server:emit('A::B') end local EventEmitter = ut.class() do function EventEmitter:__init(opt) if opt and opt.wildcard then self._EventEmitter = TreeEventEmitter.new(opt.delimiter) else self._EventEmitter = BasicEventEmitter.new() end self._EventEmitter_self = opt and opt.self or self return self end function EventEmitter:on(event, listener) assert(event, 'event expected') assert(callable(listener), 'function expected') self._EventEmitter:on(event, listener) return self end function EventEmitter:many(event, ttl, listener) assert(event, 'event expected') assert(type(ttl) == 'number', 'number required') assert(callable(listener), 'function expected') self._EventEmitter:many(event, ttl, listener) return self end function EventEmitter:once(event, listener) assert(event, 'event expected') assert(callable(listener), 'function expected') self._EventEmitter:once(event, listener) return self end function EventEmitter:off(event, listener) assert(event, 'event expected') assert((listener == nil) or callable(listener), 'function expected') self._EventEmitter:off(event, listener) return self end function EventEmitter:emit(event, ...) assert(event, 'event expected') return self._EventEmitter:emit(event, self._EventEmitter_self, event, ...) end function EventEmitter:onAny(listener) assert(callable(listener), 'function expected') self._EventEmitter:onAny(listener) return self end function EventEmitter:manyAny(ttl, listener) assert(type(ttl) == 'number', 'number required') assert(callable(listener), 'function expected') self._EventEmitter:manyAny(ttl, listener) return self end function EventEmitter:onceAny(listener) assert(callable(listener), 'function expected') self._EventEmitter:onceAny(listener) return self end function EventEmitter:offAny(listener) assert((listener == nil) or callable(listener), 'function expected') self._EventEmitter:offAny(listener) return self end function EventEmitter:removeAllListeners(eventName) self._EventEmitter:removeAllListeners(eventName) return self end -- aliases EventEmitter.addListener = EventEmitter.on EventEmitter.removeListener = EventEmitter.off end local extend, wrap do local exports = {'on', 'many', 'once', 'off', 'emit', 'onAny', 'manyAny', 'onceAny', 'offAny', 'addListener', 'removeListener', 'removeAllListeners' } extend = function(class, getter) getter = (getter == nil) and '_EventEmitter' or getter if type(getter) == 'string' then for _, method in ipairs(exports) do class[method] = function(self, ...) local emitter = self[getter] return emitter[method](emitter, ...) end end elseif type(getter) == 'function' then for _, method in ipairs(exports) do class[method] = function(self, ...) local emitter = getter(self) return emitter[method](emitter, ...) end end elseif getmetatable(getter) == EventEmitter then local emitter = getter for _, method in ipairs(exports) do class[method] = function(self, ...) return emitter[method](emitter, ...) end end else error('Unsupported Emitter get argument: ' .. type(getter)) end return class end wrap = function(object, emitter) emitter = emitter or EventEmitter.new{self = object} return extend(object, emitter) end end return ut.clone(EE, { EventEmitter = EventEmitter, new = EventEmitter.new, extend = extend, extend_class = extend, extend_object = wrap, })
local loader = function(loader, ...) local packet = require"_cqueues.dns.packet" local record = require"_cqueues.dns.record" -- dns.record depends on dns.packet local function toconst(id, map, what, lvl) local n if id == nil then return elseif type(id) == "number" then n = map[id] and id elseif type(id) == "string" then n = map[id] or map[string.upper(id)] end if not n then error((tostring(id) .. ": unknown DNS " .. what), lvl + 1) end return n end -- toconst local _push; _push = packet.interpose("push", function (self, section, name, type, class, ttl, rdata) section = toconst(section, packet.section, "section", 2) type = toconst(type, record.type, "type", 2) class = toconst(class, record.class, "class", 2) return _push(self, section, name, type, class, ttl, rdata) end) -- packet:push -- -- TODO: Don't restrict ourselves to the C iteration interface, -- which is limited by fixed-sized fields. For example, you cannot -- specify multiple different record types because the type -- identifiers cannot be ORd together. -- local _grep; _grep = packet.interpose("grep", function (self, opts) if opts then opts.type = toconst(opts.type, record.type, "type", 2) opts.class = toconst(opts.class, record.class, "class", 2) if type(opts.section) == "string" then local n = 0 for s in string.gmatch(opts.section, "%a+") do n = n + toconst(s, packet.section, "section", 2) end opts.section = n elseif type(opts.section) == "table" then local n = 0 for i=1,#opts.section do n = n + toconst(opts.section[i], packet.section, "section", 2) end opts.section = n end end return _grep(self, opts) end) -- packet:grep return packet end return loader(loader, ...)
-- model file model_file = './obj/GermanShephardLowPoly.obj' -- directory to save result result_directory = './result_dog/' -- save result per frame save_per_frame = 50 -- set true to enable view view = true -- set true to save image save_image = true -- result width width = 600 -- result height height = 400 -- result fov fov = 50 -- model center offset, center = center + center_offset center_offset = {0, 0, 0} -- camera eye offset, eye = center + eye_offset eye_offset = {3, 4, -15} -- camera up direction up = {0, 1, 0} -- max iteration depth for ray max_depth = 5 -- scene ambient scene_ambient = {0.2, 0.2, 0.2} -- external light illumination external_light_num = 2 -- external light 0: origin el_origin_0 = {-35, 20, -35} -- external light 0: x direction expand el_dx_0 = {60, 0, 0} -- external light 0: y direction expand el_dy_0 = {0, 0, 60} -- external light 0: emission el_emission_0 = {15.0, 15.0, 15.0} -- external light 1: origin el_origin_1 = {25, 20, 25} -- external light 1: x direction expand el_dx_1 = {-60, 0, 0} -- external light 1: y direction expand el_dy_1 = {0, 0, -60} -- external light 1: emission el_emission_1 = {15.0, 15.0, 15.0}
setenv("MY_NAME",myModuleFullName())
return { name = 'PowerState', description = 'The basic state of the system\'s power supply.', constants = { { name = 'unknown', description = 'Cannot determine power status.', }, { name = 'battery', description = 'Not plugged in, running on a battery.', }, { name = 'nobattery', description = 'Plugged in, no battery available.', }, { name = 'charging', description = 'Plugged in, charging battery.', }, { name = 'charged', description = 'Plugged in, battery is fully charged.', }, }, }
-->TODO Better selection algorithm -->TODO Several activation functions, maybe as a thing that can be mutated for each node -->TODO Better speciation (barely used atm). Current implementation almost nonspeciated, which is mentioned as being a lot worse in the paper. -->TODO Crossover using speciation at all -->TODO Less weight on stagnated species -->TODO Fix Crossover error (commented out) -->TODO Clean code -->TODO Other elitism (top of each species atm) -->TODO Fix potential bugs dofile"2048.lua" math.randomseed(os.time()) connect_gene = { new = function(self) o = {} setmetatable(o, self) self.__index = self return o end, init = function(self, inn, out, weight, enabled, innov) self.inn = inn self.out = out self.weight = weight self.enabled = enabled self.innov = innov end } node_gene = { new = function(self) o = {} setmetatable(o, self) self.__index = self return o end, init = function (self, id, ntype) --self.current_value = 0 --self.previous_value = 0 self.id = id self.ntype = ntype end } --> Class for the genotype of an individual genotype = { new = function(self) o = {} setmetatable(o, self) self.__index = self return o end, init = function(self, nin, nout, init_func, ...) self.nodes = {} self.connections = {} for i = 1, nin do self.nodes[i] = node_gene:new() self.nodes[i]:init(i, 1) end for i = 1, nout do self.nodes[i+nin] = node_gene:new() self.nodes[i+nin]:init(i+nin, 2) end counter = 1 for i = 1, nin do for j = 1, nout do self.connections[counter] = connect_gene:new() self.connections[counter]:init(i, j+nin, init_func(...), true, counter) counter = counter +1 end end end, add_connection = function(self, inn, out, innovation, weight_func, ...) for i = 1, #self.nodes do if self.nodes[i].id == out and self.nodes[i].ntype == 1 then return false end end for i = 1, #self.connections do if self.connections[i].inn == inn and self.connections[i].out == out then return false end end self.connections[#self.connections+1] = connect_gene:new() self.connections[#self.connections]:init(inn, out, weight_func(...), true, innovation+1) return true end, add_node = function(self, connection, innovation, weight_func, ...) connection.enabled = false self.nodes[#self.nodes+1] = node_gene:new() self.nodes[#self.nodes]:init(#self.nodes, 3) self.connections[#self.connections+1] = connect_gene:new() self.connections[#self.connections]:init(connection.inn, self.nodes[#self.nodes].id, weight_func(...), true, innovation+1) self.connections[#self.connections+1] = connect_gene:new() self.connections[#self.connections]:init(self.nodes[#self.nodes].id, connection.out, weight_func(...), true, innovation+2) end, print = function(self) io.write("Nodes: \n") for i = 1, #self.nodes do io.write(string.format("ID: %d\t Type: %d\n", self.nodes[i].id, self.nodes[i].ntype)) end io.write("Connections: \n") for i = 1, #self.connections do io.write(string.format("Inn node: %d\t Out node: %d\t Weight: %f\t Enabled: %s\t Innovation: %d\n", self.connections[i].inn, self.connections[i].out, self.connections[i].weight, self.connections[i].enabled, self.connections[i].innov)) end end } --> Class for the phenotype of an individual phenotype = { new = function(self) o = {} setmetatable(o, self) self.__index = self return o end, init = function(self, nodes, connections) local nodes = nodes local connections = connections local all_cons = {} self.in_cons = {} for i = 1, #nodes do self.in_cons[nodes[i].id] = {node=nodes[i], recurrent_connections = {}, requires={}, weights={}, current_value = 0, previous_value = 0} end for i = 1, #connections do if connections[i].enabled == true then if not self:creates_cycle(all_cons, connections[i]) then self.in_cons[connections[i].out].requires[1 + #self.in_cons[connections[i].out].requires] = connections[i].inn self.in_cons[connections[i].out].weights[1 + #self.in_cons[connections[i].out].weights] = connections[i].weight else self.in_cons[connections[i].out].recurrent_connections[#self.in_cons[connections[i].out].recurrent_connections + 1] = connections[i] end all_cons[#all_cons+1] = connections[i] end end end, inference = function(self, input) visited = {} output_nodes = {} for k, v in pairs(self.in_cons) do if self.in_cons[k].node.ntype == 1 then self.in_cons[k].current_value = input[k] elseif self.in_cons[k].node.ntype == 2 then output_nodes[#output_nodes+1] = self.in_cons[k].node.id end if next(self.in_cons[k].requires) == nil then visited[k] = true end for j = 1, #self.in_cons[k].recurrent_connections do self.in_cons[k].current_value = self.in_cons[k].current_value + self.in_cons[self.in_cons[k].recurrent_connections[j].inn].previous_value end end for i = 1, #output_nodes do self:single_inference(output_nodes[i], visited) end outputs = {} for k, v in pairs(self.in_cons) do if self.in_cons[k].node.ntype == 2 then outputs[#outputs+1] = self.in_cons[k].current_value end self.in_cons[k].previous_value = self.in_cons[k].current_value self.in_cons[k].current_value = 0 end return outputs end, single_inference = function(self, node, visited) for i = 1, #self.in_cons[node].requires do if visited[self.in_cons[node].requires[i]] then self.in_cons[node].current_value = self.in_cons[node].current_value + self.in_cons[node].weights[i] * self.in_cons[self.in_cons[node].requires[i]].current_value else self:single_inference(self.in_cons[node].requires[i], visited) self.in_cons[node].current_value = self.in_cons[node].current_value + self.in_cons[node].weights[i] * self.in_cons[self.in_cons[node].requires[i]].current_value end end if self.in_cons[node].node.ntype ~= 1 then self.in_cons[node].current_value = 1 / ( 1 + math.exp(-self.in_cons[node].current_value) ) end visited[node] = true end, creates_cycle = function (self, connections, con) if con.inn == con.out then return true end visited = {} visited[con.out] = true while(true) do num_added = 0 for k, v in pairs(connections) do if visited[v.inn] and not visited[v.out] then if con.inn == v.out then return true end visited[v.out] = true num_added = num_added + 1 end end if num_added == 0 then return false end end end } --> Class for the individual individual = { new = function(self, o) o = o or {} setmetatable(o, self) self.__index = self return o end, init = function(self, nin, nout, init_func, ...) self.geno = genotype:new() self.geno:init(nin, nout, init_func, ...) self.pheno = phenotype:new() self.pheno:init(self.geno.nodes, self.geno.connections) self.fitness = 0 self.species = 0 end } --> Class for the population in the algorithm. Might be unnecessary and just have a normal table for this with no extra properties. population = { new = function(self, o) o = o or {} setmetatable(o, self) self.__index = self return o end, init = function(self, pop, nin, nout, init_func, ...) self.inds = {} for n = 1, pop do self.inds[n] = individual:new() self.inds[n]:init(nin, nout, init_func, ...) end end } species = { new = function(self) o = {} setmetatable(o, self) self.__index = self return o end, init = function(self) self.inds = {} self.representative = {} self.num_inds = 0 self.total_fit = 0 end, add_ind = function(self, fitness, ind) self.total_fit = self.total_fit + fitness self.num_inds = self.num_inds + 1 self.inds[#self.inds+1] = ind end } function main_loop(generations, pop_size, crossover_rate, enabled_mutation_rate, connection_mutation_rate, node_mutation_rate, weight_mutation_rate, input_size, output_size, species_threshold) --> Generate initial population here: local pop = population:new() local species_list = {} local mutation_list = {} local innovation = 1 pop:init(pop_size, input_size, output_size, function() return math.random()*2 - 1 end) innovation = #pop.inds[1].geno.connections species_list[1] = species:new() species_list[1]:init() species_list[1].inds = pop.inds species_list[1].num_inds = #pop.inds -->The main loop for g = 1, generations do for v, k in pairs(species_list) do species_list[v].representative = species_list[v].inds[math.random(1, #species_list[v].inds)] end local temp_species = {} local temp_pop = {} local total_species = 0 -->evolutionary loop for i=1, #pop.inds do pop.inds[i].fitness = fitness(pop.inds[i]) local has_species = false for v, k in pairs(species_list) do if species_threshold > species_compare(pop.inds[i], species_list[v].representative) then pop.inds[i].species = v has_species = true break end end if not has_species then total_species = total_species + 1 pop.inds[i].species = total_species end if not temp_species[pop.inds[i].species] then temp_species[pop.inds[i].species] = species:new() temp_species[pop.inds[i].species]:init() end temp_species[pop.inds[i].species]:add_ind(pop.inds[i].fitness, pop.inds[i]) end local reproduction_population = {} local counter = 0 for k, v in pairs(temp_species) do counter = counter +1 end io.write(string.format("Number of species %d\n", counter)) for k, v in pairs(temp_species) do table.sort(temp_species[k].inds, function (a, b) return a.fitness > b.fitness end) temp_pop[#temp_pop+1] = copy_individual(temp_species[k].inds[1]) temp_pop[#temp_pop].pheno = phenotype:new() temp_pop[#temp_pop].pheno:init(temp_pop[#temp_pop].geno.nodes, temp_pop[#temp_pop].geno.connections) local n if temp_species[k].num_inds == 1 then n = 1 else n = math.floor(temp_species[k].num_inds/2) end for j = 1, n do reproduction_population[#reproduction_population+1] = {ind = temp_species[k].inds[j], fitness = temp_species[k].inds[j].fitness / temp_species[k].num_inds} end end while #temp_pop < pop_size do local child = {} if math.random() < crossover_rate then local parent1 = reproduction_population[math.random(1, #reproduction_population)] local parent2 = reproduction_population[math.random(1, #reproduction_population)] local pc1, pc2 = reproduction_population[math.random(1, #reproduction_population)], reproduction_population[math.random(1, #reproduction_population)] if pc1.fitness >= pc2.fitness then parent1 = pc1 else parent1 = pc2 end pc1, pc2 = reproduction_population[math.random(1, #reproduction_population)], reproduction_population[math.random(1, #reproduction_population)] if pc1.fitness >= pc2.fitness then parent2 = pc1 else parent2 = pc2 end child = crossover(parent1, parent2) else child = copy_individual(reproduction_population[math.random(1, #reproduction_population)].ind) end if math.random() < enabled_mutation_rate then child = enable_mutation(child) end if math.random() < weight_mutation_rate then child = weight_mutation(child) end if math.random() < connection_mutation_rate then child, change = connection_mutation(child, innovation) if change then innovation = innovation + 1 end end if math.random() < node_mutation_rate then child = node_mutation(child, innovation) innovation = innovation + 2 end child.pheno = phenotype:new() child.pheno:init(child.geno.nodes, child.geno.connections) temp_pop[#temp_pop+1] = child end table.sort(pop.inds, function (a, b) return a.fitness > b.fitness end) io.write(string.format("Generation: %d Best Fitness: %f\n", g, pop.inds[1].fitness)) io.write(string.rep("-", 30)) io.write("\n") species_list = temp_species pop.inds = temp_pop end for k, v in pairs(pop.inds) do pop.inds[k].fitness = fitness(pop.inds[k]) end table.sort(pop.inds, function(a,b) return a.fitness > b.fitness end) return pop.inds end function species_compare(ind1, ind2) local N = math.max(#ind1.geno.connections, #ind2.geno.connections) local D = 0 local E = 0 local W = 0 local trailing = 0 local inno1 = {} local inno2 = {} for i = #ind1.geno.connections, 1, -1 do inno1[i] = {ind1.geno.connections[#ind1.geno.connections-i+1].innov, ind1.geno.connections[#ind1.geno.connections-i+1].weight} if i == 1 then trailing = inno1[i][1] end end for i = #ind2.geno.connections, 1, -1 do inno2[i] = {ind2.geno.connections[#ind2.geno.connections-i+1].innov, ind2.geno.connections[#ind2.geno.connections-i+1].weight} if i == 1 and inno2[i][1] > trailing then trailing = 2 elseif inno2[i][1] == trailing then trailing = 0 else trailing = 1 end end if trailing == 1 then E, D, W = dis_ex(inno1, inno2) else E, D, W = dis_ex(inno2, inno1) end return E/N + D/N + W end function dis_ex(ind1_con, ind2_con) local excess = true local E = 0 local D = 0 local W = 0 local matching = 0 for i = 1, #ind1_con do local match = false for j = 1, #ind2_con do if ind1_con[i][1] > ind2_con[j][1] and excess == true then E = E + 1 break elseif ind1_con[i][1] == ind2_con[j][1] then excess = false match = true matching = matching + 1 W = W + math.abs(ind1_con[i][2], ind2_con[j][2]) break else excess = false end end if not match and not excess then D = D + 1 end end for i = 1, #ind2_con do local match = false for j = 1, #ind1_con do if ind2_con[i][1] == ind1_con[j][1] then match = true break end end if not match then D = D + 1 end end return E, D, W/matching end function enable_mutation(ind) index = math.random(1, #ind.geno.connections) ind.geno.connections[index].enabled = not ind.geno.connections[index].enabled return ind end function connection_mutation(ind, innov) local changed changed = ind.geno:add_connection(ind.geno.nodes[math.random(1, #ind.geno.nodes)].id, ind.geno.nodes[math.random(1, #ind.geno.nodes)].id, innov, function() return math.random()*2-1 end) return ind, changed end function node_mutation(ind, innov) ind.geno:add_node(ind.geno.connections[math.random(1, #ind.geno.connections)], innov, function() return math.random()*2-1 end) return ind end function weight_mutation(ind) index = math.random(1, #ind.geno.connections) if math.random() < 0.8 then ind.geno.connections[index].weight = ind.geno.connections[index].weight * math.random()*2 else ind.geno.connections[index].weight = math.random()*2-1 end return ind end function crossover(parent1, parent2) local child = {} local other_parent = {} local equal_parents = false if parent1.fitness > parent2.fitness then child = copy_individual(parent1.ind) other_parent = parent2.ind elseif parent1.fitness < parent2.fitness then child = copy_individual(parent2.ind) other_parent = parent1.ind else equal_parents = true end if not equal_parents then for i = 1, #child.geno.connections do local is_in_both = false local other_w, other_e for j = 1, #other_parent.geno.connections do if child.geno.connections[i].innov == other_parent.geno.connections[j].innov then is_in_both = true other_w = other_parent.geno.connections[j].weight other_e = other_parent.geno.connections[j].enabled break end end if is_in_both and math.random() < 0.5 then child.geno.connections[i].weight = other_w child.geno.connections[i].enabled = other_e end end else child = copy_individual(parent1.ind) for k, v in pairs(child.geno.connections) do local not_in_both = true for j = 1, #parent2.ind.geno.connections do if child.geno.connections[k].innov == parent2.ind.geno.connections[j].innov then not_in_both = false break end end if not_in_both and math.random() < 0.5 then --table.remove(child.geno.connections, k) end end for i = 1, #parent2.ind.geno.connections do local is_in_both = false local other_index for j = 1, #parent1.ind.geno.connections do if parent2.ind.geno.connections[i].innov == parent1.ind.geno.connections[j].innov then is_in_both = true other_index = j break end end if is_in_both then if math.random() < 0.5 then child.geno.connections[other_index].weight = parent2.ind.geno.connections[i].weight child.geno.connections[other_index].enabled = parent2.ind.geno.connections[i].enabled end else if math.random() < 0.5 then local has_in_node = false local has_out_node = false local id = 0 for j = 1, #parent1.ind.geno.nodes do if parent2.ind.geno.connections[i].inn == parent1.ind.geno.nodes[j].id then has_in_node = true id = parent2.ind.geno.connections[i].inn elseif parent2.ind.geno.connections[i].out == parent1.ind.geno.nodes[j].id then has_out_node = true id = parent2.ind.geno.connections[i].out end end if not has_in_node then child.geno.nodes[#child.geno.nodes+1] = node_gene:new() child.geno.nodes[#child.geno.nodes]:init(parent2.ind.geno.connections[i].inn, 3) end if not has_out_node then child.geno.nodes[#child.geno.nodes+1] = node_gene:new() child.geno.nodes[#child.geno.nodes]:init(parent2.ind.geno.connections[i].out, 3) end child.geno:add_connection(parent2.ind.geno.connections[i].inn, parent2.ind.geno.connections[i].out, parent2.ind.geno.connections[i].innov-1, function(a) return a end, parent2.ind.geno.connections[i].weight) end end end end return child end function fitness(ind) local total_fitness = 0 local boards = 3 local total_steps = 500 for x = 1, boards do local outputs = {} local b = generate_board() local step = 1 while has_moves(b) do outputs = ind.pheno:inference(flatten(b)) local action = -1 local failed = {} local has_moved = false while not has_moved and #failed ~= 4 do local prev_output_node = nil if action ~= -1 then failed[#failed+1] = action end for i = 1, #outputs do if not prev_output_node or outputs[i] > prev_output_node then local has_failed = false for f = 1, #failed do if i == failed[f] then has_failed = true end end if not has_failed then prev_output_node = outputs[i] action = i end end end if not move_tiles(action, b) then -- total_fitness = total_fitness - (1*(total_steps-step)) else has_moved = true end end step = step + 1 end --for i = 1, 4 do -- for j = 1, 4 do -- total_fitness = total_fitness + 2^b[1][i][j] * point_board[i][j] -- end --end max_board(b) total_fitness = total_fitness + b.score --* b.max end return total_fitness / boards end function copy_individual(ind) local new_ind = individual:new() new_ind:init(0, 0, function(a) return a end, 0) for i = 1, #ind.geno.nodes do new_ind.geno.nodes[i] = node_gene:new() -- new_ind.geno.nodes[i]:init(ind.geno.nodes[i].id, ind.geno.nodes[i].ntype) new_ind.geno.nodes[i].id = ind.geno.nodes[i].id new_ind.geno.nodes[i].ntype = ind.geno.nodes[i].ntype end for i = 1, #ind.geno.connections do new_ind.geno.connections[i] = connect_gene:new() -- new_ind.geno.connections[i]:init(ind.geno.connections[i].inn, ind.geno.connections[i].out, ind.geno.connections[i].weight, ind.geno.connections[i].enabled, ind.geno.connections[i].innov) new_ind.geno.connections[i].inn = ind.geno.connections[i].inn new_ind.geno.connections[i].out = ind.geno.connections[i].out new_ind.geno.connections[i].weight = ind.geno.connections[i].weight new_ind.geno.connections[i].enabled = ind.geno.connections[i].enabled new_ind.geno.connections[i].innov = ind.geno.connections[i].innov end return new_ind end function play(ind) local b = generate_board() print_board(b) for k, v in pairs(ind.pheno.in_cons) do ind.pheno.in_cons[k].previous_value = 0 ind.pheno.in_cons[k].current_value = 0 end while has_moves(b) do local outputs = ind.pheno:inference(flatten(b)) local action = -1 local failed = {} while not move_tiles(action, b) and #failed ~= 4 do local prev_output_node = nil if action ~= -1 then failed[#failed+1] = action end for i = 1, #outputs do if not prev_output_node or outputs[i] > prev_output_node then local has_failed = false for f = 1, #failed do if i == failed[f] then has_failed = true end end if not has_failed then prev_output_node = outputs[i] action = i end end end --move_tiles(action, b) end end max_board(b) print_board(b) end function play_random() local b = generate_board() print_board(b) local actions = {1, 2, 3, 4} while has_moves(b) do move_tiles(actions[math.random(1, #actions)], b) end max_board(b) print_board(b) end
local t = require('luatest') local g = t.group() -- Check that fiber_join_timeout is accessible from ffi. g.test_ffi_fiber_join_timeout = function() local t = require('luatest') local ffi = require('ffi') local fiber = require('fiber') ffi.cdef([[ struct fiber; struct fiber * fiber_self(void); int fiber_join_timeout(struct fiber *f, double timeout); ]]) local fiber_ptr = nil fiber.create(function() fiber_ptr = ffi.C.fiber_self() fiber.self():set_joinable(true) end) t.assert_equals(ffi.C.fiber_join_timeout(fiber_ptr, 100500), 0) end
Inherit = 'SnapWindow' ContentViewName = 'infowindow' Title = 'Info' OnContentLoad = function(self) self:UpdateInfo() end UpdateInfo = function(self) local artboard = self.Bedrock:GetObject('Artboard') local selection = (artboard == nil or artboard.Selection == nil or artboard.Selection[1] == nil or artboard.Selection[2] == nil) self:GetObject("CanvasWidthLabel").Text = (artboard == nil and '-' or tostring(#artboard:GetCurrentLayer().Layer.Pixels)) self:GetObject("CanvasHeightLabel").Text = (artboard == nil and '-' or tostring(#artboard:GetCurrentLayer().Layer.Pixels[1])) self:GetObject("SelectionWidthLabel").Text = (selection and '-' or tostring(math.abs(artboard.Selection[1].X-artboard.Selection[2].X))) self:GetObject("SelectionHeightLabel").Text = (selection and '-' or tostring(math.abs(artboard.Selection[1].Y-artboard.Selection[2].Y))) self:GetObject("SelectionX1Label").Text = (selection and '-' or tostring(artboard.Selection[1].X)) self:GetObject("SelectionY1Label").Text = (selection and '-' or tostring(artboard.Selection[1].Y)) self:GetObject("SelectionX2Label").Text = (selection and '-' or tostring(artboard.Selection[2].X)) self:GetObject("SelectionY2Label").Text = (selection and '-' or tostring(artboard.Selection[2].Y)) end
--------------------------------------------------------------------------------------------------- -- User story: Smoke -- Use case: GetInteriorVehicleData -- Item: Happy path -- -- Requirement summary: -- [ReadDID] SUCCESS: getting SUCCESS:RC.GetInteriorVehicleData() -- -- Description: -- Mobile application sends valid GetInteriorVehicleData request for CLIMATE:C0A RC module. -- Pre-conditions: -- a. HMI and SDL are started -- b. appID is registered and activated on SDL -- c. appID is currently Full HMI level -- Steps: -- appID requests GetInteriorVehicleData with valid parameters -- Expected: -- SDL responds with (resultCode: SUCCESS, success:true) to mobile application --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') local common = require('test_scripts/Smoke/commonSmoke') --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false --[[ General configuration parameters ]] config.defaultProtocolVersion = 2 config.application1.registerAppInterfaceParams.appHMIType = { "REMOTE_CONTROL" } --[[ Local Variables ]] local moduleId = common.getRcModuleId("CLIMATE", 1) local moduleData = { moduleType = "CLIMATE", moduleId = moduleId, climateControlData = { fanSpeed = 10, currentTemperature = { unit = "FAHRENHEIT", value = 22.4 }, desiredTemperature = { unit = "CELSIUS", value = 20.7 }, acEnable = false, circulateAirEnable = true, autoModeEnable = true, defrostZone = "FRONT", dualModeEnable = false, acMaxEnable = true, ventilationMode = "BOTH", heatedSteeringWheelEnable = true, heatedWindshieldEnable = false, heatedRearWindowEnable = true, heatedMirrorsEnable = true } } local params = { mobRequest = { moduleType = "CLIMATE", moduleId = moduleId, subscribe = true }, hmiRequest = { moduleType = "CLIMATE", moduleId = moduleId, subscribe = true }, hmiResponse = { moduleData = moduleData, isSubscribed = true }, mobResponse = { success = true, resultCode = "SUCCESS", moduleData = moduleData, isSubscribed = true } } --[[ Local Functions ]] local function getInteriorVehicleData() local mobSession = common.getMobileSession() local hmi = common.getHMIConnection() local cid = mobSession:SendRPC("GetInteriorVehicleData", params.mobRequest) hmi:ExpectRequest("RC.GetInteriorVehicleData", params.hmiRequest) :Do(function(_, data) hmi:SendResponse(data.id, data.method, "SUCCESS", params.hmiResponse) end) mobSession:ExpectResponse(cid, params.mobResponse) end --[[ Scenario ]] runner.Title("Preconditions") runner.Step("Clean environment", common.preconditions) runner.Step("Update Preloaded PT", common.updatePreloadedPT) runner.Step("Prepare preloaded policy table", common.preparePreloadedPTForRC) runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start) runner.Step("RAI", common.registerApp) runner.Step("Activate App", common.activateApp) runner.Title("Test") runner.Step("GetInteriorVehicleData CLIMATE module Positive Case", getInteriorVehicleData) runner.Title("Postconditions") runner.Step("Stop SDL", common.postconditions)
--[[ Copyright 2017 YANG Huan (sy.yanghuan@gmail.com). 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. --]] local System = System local define = System.define local throw = System.throw local each = System.each local identityFn = System.identityFn local wrap = System.wrap local unWrap = System.unWrap local is = System.is local cast = System.cast local Int32 = System.Int32 local isArrayLike = System.isArrayLike local Array = System.Array local arrayEnumerator = Array.GetEnumerator local NullReferenceException = System.NullReferenceException local ArgumentNullException = System.ArgumentNullException local ArgumentOutOfRangeException = System.ArgumentOutOfRangeException local InvalidOperationException = System.InvalidOperationException local EqualityComparer_1 = System.EqualityComparer_1 local Comparer_1 = System.Comparer_1 local Empty = System.Array.Empty local IEnumerable_1 = System.IEnumerable_1 local IEnumerable = System.IEnumerable local IEnumerator_1 = System.IEnumerator_1 local IEnumerator = System.IEnumerator local assert = assert local select = select local getmetatable = getmetatable local tsort = table.sort local InternalEnumerable = define("System.Linq.InternalEnumerable", function(T) return { __inherits__ = { IEnumerable_1(T), IEnumerable } } end) local function createEnumerable(T, GetEnumerator) assert(T) return setmetatable({ __genericT__ = T, GetEnumerator = GetEnumerator }, InternalEnumerable(T)) end local InternalEnumerator = define("System.Linq.InternalEnumerator", function(T) return { __inherits__ = { IEnumerator_1(T), IEnumerator } } end) local function createEnumerator(T, source, tryGetNext, init) assert(T) local state = 1 local current local en return setmetatable({ MoveNext = function() if state == 1 then state = 2 if source then en = source:GetEnumerator() end if init then init(en) end end if state == 2 then local ok, v = tryGetNext(en) if ok then current = v return true elseif en then local dispose = en.Dispose if dispose then dispose(en) end end end return false end, getCurrent = function() return current end }, InternalEnumerator(T)) end local Enumerable = {} define("System.Linq.Enumerable", Enumerable) function Enumerable.Where(source, predicate) if source == nil then throw(ArgumentNullException("source")) end if predicate == nil then throw(ArgumentNullException("predicate")) end local T = source.__genericT__ return createEnumerable(T, function() local index = -1 return createEnumerator(T, source, function(en) while en:MoveNext() do local current = en:getCurrent() index = index + 1 if predicate(current, index) then return true, current end end return false end) end) end function Enumerable.Select(source, selector, T) if source == nil then throw(ArgumentNullException("source")) end if selector == nil then throw(ArgumentNullException("selector")) end return createEnumerable(T, function() local index = -1 return createEnumerator(T, source, function(en) if en:MoveNext() then index = index + 1 return true, selector(en:getCurrent(), index) end return false end) end) end local function selectMany(source, collectionSelector, resultSelector, T) if source == nil then throw(ArgumentNullException("source")) end if collectionSelector == nil then throw(ArgumentNullException("collectionSelector")) end if resultSelector == nil then throw(ArgumentNullException("resultSelector")) end return createEnumerable(T, function() local element, midEn local index = -1 return createEnumerator(T, source, function(en) while true do if midEn and midEn:MoveNext() then return true, resultSelector(element, midEn:getCurrent()) else if not en:MoveNext() then return false end index = index + 1 local current = en:getCurrent() midEn = collectionSelector(current, index):GetEnumerator() if midEn == nil then throw(NullReferenceException()) end element = current end end end) end) end local function identityFnOfSelectMany(s, x) return x end function Enumerable.SelectMany(source, ...) local len = select("#", ...) if len == 2 then local collectionSelector, T = ... return selectMany(source, collectionSelector, identityFnOfSelectMany, T) else return selectMany(source, ...) end end function Enumerable.Take(source, count) if source == nil then throw(ArgumentNullException("source")) end local T = source.__genericT__ return createEnumerable(T, function() return createEnumerator(T, source, function(en) if count > 0 then if en:MoveNext() then count = count - 1 return true, en:getCurrent() end end return false end) end) end function Enumerable.TakeWhile(source, predicate) if source == nil then throw(ArgumentNullException("source")) end if predicate == nil then throw(ArgumentNullException("predicate")) end local T = source.__genericT__ return createEnumerable(T, function() local index = -1 return createEnumerator(T, source, function(en) if en:MoveNext() then local current = en:getCurrent() index = index + 1 if not predicate(current, index) then return false end return true, current end return false end) end) end function Enumerable.Skip(source, count) if source == nil then throw(ArgumentNullException("source")) end local T = source.__genericT__ return createEnumerable(T, function() return createEnumerator(T, source, function(en) while count > 0 and en:MoveNext() do count = count - 1 end if count <= 0 then if en:MoveNext() then return true, en:getCurrent() end end return false end) end) end function Enumerable.SkipWhile(source, predicate) if source == nil then throw(ArgumentNullException("source")) end if predicate == nil then throw(ArgumentNullException("predicate")) end local T = source.__genericT__ return createEnumerable(T, function() local index = -1 local isSkipEnd = false return createEnumerator(T, source, function(en) while not isSkipEnd do if en:MoveNext() then local current = en:getCurrent() index = index + 1 if not predicate(current, index) then isSkipEnd = true return true, current end else return false end end if en:MoveNext() then return true, en:getCurrent() end return false end) end) end local Lookup = {} function Lookup.__ctor__(this, comparer) this.comparer = comparer or EqualityComparer_1(this.__genericTKey__).getDefault() this.groups = {} this.indexs = {} end local function getGrouping(this, key) local hashCode = this.comparer.GetHashCode(key) local groupIndex = this.indexs[hashCode] return this.groups[groupIndex] end function Lookup.get(this, key) local grouping = getGrouping(this, key) if grouping ~= nil then return grouping end return Empty(this.__genericTElement__) end function Lookup.GetCount(this) return #this.groups end function Lookup.Contains(this, key) return getGrouping(this, key) ~= nil end function Lookup.GetEnumerator(this) return arrayEnumerator(this.groups) end local LookupFn = define("System.Linq.Lookup", function(TKey, TElement) local cls = { __genericTKey__ = TKey, __genericTElement__ = TElement, } return cls end, Lookup) local IGrouping = System.defInf("System.Linq.IGrouping") local Grouping = {} Grouping.GetEnumerator = arrayEnumerator function Grouping.getKey(this) return this.key end function Grouping.getCount(this) return #this end Grouping.__inherits__ = { IGrouping } define("System.Linq.Grouping", Grouping) local function addToLookup(this, key, value) local hashCode = this.comparer.GetHashCode(key) local groupIndex = this.indexs[hashCode] local group if groupIndex == nil then groupIndex = #this.groups + 1 this.indexs[hashCode] = groupIndex group = setmetatable({ key = key, __genericT__ = this.__genericTElement__ }, Grouping) this.groups[groupIndex] = group else group = this.groups[groupIndex] assert(group) end group[#group + 1] = wrap(value) end local function createLookup(source, keySelector, elementSelector, comparer, TKey, TElement) local lookup = LookupFn(TKey, TElement)(comparer) for _, item in each(source) do addToLookup(lookup, keySelector(item), elementSelector(item)) end return lookup end local function createLookupForJoin(source, keySelector, comparer, TKey, TElement) local lookup = LookupFn(TKey, TElement)(comparer) for _, item in each(source) do local key = keySelector(item) if key ~= nil then addToLookup(lookup, key, item) end end return lookup end function Enumerable.Join(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, TKey, TResult) if outer == nil then throw(ArgumentNullException("outer")) end if inner == nil then throw(ArgumentNullException("inner")) end if outerKeySelector == nil then throw(ArgumentNullException("outerKeySelector")) end if innerKeySelector == nil then throw(ArgumentNullException("innerKeySelector")) end if resultSelector == nil then throw(ArgumentNullException("resultSelector")) end local lookup = createLookupForJoin(inner, innerKeySelector, comparer, TKey, inner.__genericT__) return createEnumerable(TResult, function () local item, grouping, index return createEnumerator(TResult, outer, function (en) while true do if grouping ~= nil then index = index + 1 if index < #grouping then return true, resultSelector(item, unWrap(grouping[index + 1])) end end if not en:MoveNext() then return false end local current = en:getCurrent() item = current grouping = getGrouping(lookup, outerKeySelector(current)) index = -1 end end) end) end function Enumerable.GroupJoin(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer, TKey, TResult) if outer == nil then throw(ArgumentNullException("outer")) end if inner == nil then throw(ArgumentNullException("inner")) end if outerKeySelector == nil then throw(ArgumentNullException("outerKeySelector")) end if innerKeySelector == nil then throw(ArgumentNullException("innerKeySelector")) end if resultSelector == nil then throw(ArgumentNullException("resultSelector")) end local lookup = createLookupForJoin(inner, innerKeySelector, comparer, TKey, inner.__genericT__) return createEnumerable(TResult, function () return createEnumerator(TResult, outer, function (en) if en:MoveNext() then local item = en:getCurrent() return true, resultSelector(item, lookup:get(outerKeySelector(item))) end return false end) end) end local function ordered(source, compare) local T = source.__genericT__ local orderedEnumerable = createEnumerable(T, function() local t = {} local index = 0 return createEnumerator(T, source, function() index = index + 1 local v = t[index] if v ~= nil then return true, unWrap(v) end return false end, function() local count = 1 for _, v in each(source) do t[count] = wrap(v) count = count + 1 end if count > 1 then tsort(t, function(x, y) return compare(unWrap(x), unWrap(y)) < 0 end) end end) end) orderedEnumerable.source = source orderedEnumerable.compare = compare return orderedEnumerable end local function orderBy(source, keySelector, comparer, TKey, descending) if source == nil then throw(ArgumentNullException("source")) end if keySelector == nil then throw(ArgumentNullException("keySelector")) end if comparer == nil then comparer = Comparer_1(TKey).getDefault() end local keys = {} local function getKey(t) local k = keys[t] if k == nil then k = keySelector(t) keys[t] = k end return k end local compare if descending then local c = comparer.Compare compare = function(x, y) return -c(getKey(x), getKey(y)) end else local c = comparer.Compare compare = function(x, y) return c(getKey(x), getKey(y)) end end return ordered(source, compare) end function Enumerable.OrderBy(source, keySelector, comparer, TKey) return orderBy(source, keySelector, comparer, TKey, false) end function Enumerable.OrderByDescending(source, keySelector, comparer, TKey) return orderBy(source, keySelector, comparer, TKey, true) end local function thenBy(source, keySelector, comparer, TKey, descending) if source == nil then throw(ArgumentNullException("source")) end if keySelector == nil then throw(ArgumentNullException("keySelector")) end if comparer == nil then comparer = Comparer_1(TKey).getDefault() end local keys = {} local function getKey(t) local k = keys[t] if k == nil then k = keySelector(t) keys[t] = k end return k end local compare local parentSource, parentCompare = source.source, source.compare if descending then local c = comparer.Compare compare = function(x, y) local v = parentCompare(x, y) if v ~= 0 then return v else return -c(getKey(x), getKey(y)) end end else local c = comparer.Compare compare = function(x, y) local v = parentCompare(x, y) if v ~= 0 then return v else return c(getKey(x), getKey(y)) end end end return ordered(parentSource, compare) end function Enumerable.ThenBy(source, keySelector, comparer, TKey) return thenBy(source, keySelector, comparer, TKey, false) end function Enumerable.ThenByDescending(source, keySelector, comparer, TKey) return thenBy(source, keySelector, comparer, TKey, true) end local function groupBy(source, keySelector, elementSelector, comparer, TKey, TElement) if source == nil then throw(ArgumentNullException("source")) end if keySelector == nil then throw(ArgumentNullException("keySelector")) end if elementSelector == nil then throw(ArgumentNullException("elementSelector")) end return createEnumerable(IGrouping, function() return createLookup(source, keySelector, elementSelector, comparer, TKey, TElement):GetEnumerator() end) end function Enumerable.GroupBy(source, ...) if source == nil then throw(ArgumentNullException("source")) end local len = select("#", ...) if len == 2 then local keySelector, TKey = ... return groupBy(source, keySelector, identityFn, nil, TKey, source.__genericT__) elseif len == 3 then local keySelector, comparer, TKey = ... return groupBy(source, keySelector, identityFn, comparer, TKey, source.__genericT__) elseif len == 4 then local keySelector, elementSelector, TKey, TElement = ... return groupBy(source, keySelector, elementSelector, nil, TKey, TElement) else return groupBy(source, ...) end end local function groupBySelect(source, keySelector, elementSelector, resultSelector, comparer, TKey, TElement, TResult) if source == nil then throw(ArgumentNullException("source")) end if keySelector == nil then throw(ArgumentNullException("keySelector")) end if elementSelector == nil then throw(ArgumentNullException("elementSelector")) end if resultSelector == nil then throw(ArgumentNullException("resultSelector")) end return createEnumerable(TResult, function() local lookup = createLookup(source, keySelector, elementSelector, comparer, TKey, TElement) return createEnumerator(TResult, lookup, function(en) if en:MoveNext() then local current = en:getCurrent() return resultSelector(current.key, current) end return false end) end) end function Enumerable.GroupBySelect(source, ...) local len = select("#", ...) if len == 4 then local keySelector, resultSelector, TKey, TResult = ... return groupBySelect(source, keySelector, identityFn, resultSelector, nil, TKey, source.__genericT__, TResult) elseif len == 5 then local keySelector, resultSelector, comparer, TKey, TResult = ... return groupBySelect(source, keySelector, identityFn, resultSelector, comparer, TKey, source.__genericT__, TResult) elseif len == 6 then local keySelector, elementSelector, resultSelector, TKey, TElement, TResult = ... return groupBySelect(source, keySelector, elementSelector, resultSelector, nil, TKey, TElement, TResult) else return groupBySelect(source, ...) end end function Enumerable.Concat(first, second) if first == nil then throw(ArgumentNullException("first")) end if second == nil then throw(ArgumentNullException("second")) end local T = first.__genericT__ return createEnumerable(T, function() local secondEn return createEnumerator(T, first, function(en) if secondEn == nil then if en:MoveNext() then return true, en:getCurrent() end secondEn = second:GetEnumerator() end if secondEn:MoveNext() then return true, secondEn:getCurrent() end return false end) end) end function Enumerable.Zip(first, second, resultSelector, TResult) if first == nil then throw(ArgumentNullException("first")) end if second == nil then throw(ArgumentNullException("second")) end if resultSelector == nil then throw(ArgumentNullException("resultSelector")) end return createEnumerable(TResult, function() local e2 return createEnumerator(TResult, first, function(e1) if e1:MoveNext() and e2:MoveNext() then return true, resultSelector(e1:getCurrent(), e2:getCurrent()) end end, function() e2 = second:GetEnumerator() end) end) end local function addToSet(set, v, getHashCode) local hashCode = getHashCode(v) if set[hashCode] == nil then set[hashCode] = true return true end return false end local function removeFromSet(set, v, getHashCode) local hashCode = getHashCode(v) if set[hashCode] ~= nil then set[hashCode] = nil return true end return false end local function getComparer(source, comparer) return comparer or EqualityComparer_1(source.__genericT__).getDefault() end function Enumerable.Distinct(source, comparer) if source == nil then throw(ArgumentNullException("source")) end local T = source.__genericT__ return createEnumerable(T, function() local set = {} local getHashCode = getComparer(source, comparer).GetHashCode return createEnumerator(T, source, function(en) while en:MoveNext() do local current = en:getCurrent() if addToSet(set, current, getHashCode) then return true, current end end return false end) end) end function Enumerable.Union(first, second, comparer) if first == nil then throw(ArgumentNullException("first")) end if second == nil then throw(ArgumentNullException("second")) end local T = source.__genericT__ return createEnumerable(T, function() local set = {} local getHashCode = getComparer(first, comparer).GetHashCode local secondEn return createEnumerator(T, first, function(en) if secondEn == nil then while en:MoveNext() do local current = en:getCurrent() if addToSet(set, current, getHashCode) then return true, current end end secondEn = second:GetEnumerator() end while secondEn:MoveNext() do local current = secondEn:getCurrent() if addToSet(set, current, getHashCode) then return true, current end end return false end) end) end function Enumerable.Intersect(first, second, comparer) if first == nil then throw(ArgumentNullException("first")) end if second == nil then throw(ArgumentNullException("second")) end local T = source.__genericT__ return createEnumerable(T, function() local set = {} local getHashCode = getComparer(first, comparer).GetHashCode return createEnumerator(T, first, function(en) while en:MoveNext() do local current = en:getCurrent() if removeFromSet(set, current, getHashCode) then return true, current end end return false end, function() for _, v in each(second) do addToSet(set, v, getHashCode) end end) end) end function Enumerable.Except(first, second, comparer) if first == nil then throw(ArgumentNullException("first")) end if second == nil then throw(ArgumentNullException("second")) end local T = source.__genericT__ return createEnumerable(T, function() local set = {} local getHashCode = getComparer(first, comparer).GetHashCode return createEnumerator(T, first, function(en) while en:MoveNext() do local current = en:getCurrent() if addToSet(set, current, getHashCode) then return true, current end end return false end, function() for _, v in each(second) do addToSet(set, v, getHashCode) end end) end) end function Enumerable.Reverse(source) if source == nil then throw(ArgumentNullException("source")) end local T = source.__genericT__ return createEnumerable(T, source, function() local t = {} local index return createEnumerator(T, nil, function() if index > 1 then index = index - 1 return true, unWrap(t[index]) end return false end, function() local count = 1 for _, v in each(source) do t[count] = wrap(v) count = count + 1 end index = count end) end) end function Enumerable.SequenceEqual(first, second, comparer) if first == nil then throw(ArgumentNullException("first")) end if second == nil then throw(ArgumentNullException("second")) end local equals = getComparer(first, comparer).Equals local e1 = first:GetEnumerator() local e2 = second:GetEnumerator() while e1:MoveNext() do if not(e2:MoveNext() and equals(e1:getCurrent(), e2:getCurrent())) then return false end end if e2:MoveNext() then return false end return true end Enumerable.ToArray = Array.toArray function Enumerable.ToList(source) return System.List(source.__genericT__)(source) end local function toDictionary(source, keySelector, elementSelector, comparer, TKey, TValue) if source == nil then throw(ArgumentNullException("source")) end if keySelector == nil then throw(ArgumentNullException("keySelector")) end if elementSelector == nil then throw(ArgumentNullException("elementSelector")) end local dict = System.Dictionary(TKey, TValue)(comparer) for _, v in each(source) do dict:Add(keySelector(v), elementSelector(v)) end return dict end function Enumerable.ToDictionary(source, ...) local len = select("#", ...) if len == 2 then local keySelector, TKey = ... return toDictionary(source, keySelector, identityFn, nil, TKey, source.__genericT__) elseif len == 3 then local keySelector, comparer, TKey = ... return toDictionary(source, keySelector, identityFn, comparer, TKey, source.__genericT__) elseif len == 4 then local keySelector, elementSelector, TKey, TElement = ... return toDictionary(source, keySelector, elementSelector, nil, TKey, TElement) else return toDictionary(source, ...) end end local function toLookup(source, keySelector, elementSelector, comparer, TKey, TElement ) if source == nil then throw(ArgumentNullException("source")) end if keySelector == nil then throw(ArgumentNullException("keySelector")) end if elementSelector == nil then throw(ArgumentNullException("elementSelector")) end return createLookup(source, keySelector, elementSelector, comparer, TKey, TElement) end function Enumerable.ToLookup(source, ...) local len = select("#", ...) if len == 2 then local keySelector, TKey = ... return toLookup(source, keySelector, identityFn, nil, TKey, source.__genericT__) elseif len == 3 then local keySelector, comparer, TKey = ... return toLookup(source, keySelector, identityFn, comparer, TKey, source.__genericT__) elseif len == 4 then local keySelector, elementSelector, TKey, TElement = ... return toLookup(source, keySelector, elementSelector, nil, TKey, TElement) else return toLookup(source, ...) end end function Enumerable.Cast(source, T) if source == nil then throw(ArgumentNullException("source")) end if is(source, IEnumerable_1(T)) then return source end return createEnumerable(T, function() return createEnumerator(T, source, function(en) if en:MoveNext() then return true, cast(T, en:getCurrent()) end return false end) end) end local function first(source, ...) if source == nil then throw(ArgumentNullException("source")) end local len = select("#", ...) if len == 0 then if isArrayLike(source) then local count = #source if count > 0 then return true, unWrap(source[1]) end else local en = source:GetEnumerator() if en:MoveNext() then return true, en:getCurrent() end end return false, 0 else local predicate = ... if predicate == nil then throw(ArgumentNullException("predicate")) end for _, v in each(source) do if predicate(v) then return true, v end end return false, 1 end end function Enumerable.First(source, ...) local ok, result = first(source, ...) if ok then return result end if result == 0 then throw(InvalidOperationException("NoElements")) end throw(InvalidOperationException("NoMatch")) end function Enumerable.FirstOrDefault(source, ...) local ok, result = first(source, ...) return ok and result or source.__genericT__:default() end local function last(source, ...) if source == nil then throw(ArgumentNullException("source")) end local len = select("#", ...) if len == 0 then if isArrayLike(source) then local count = #source if count > 0 then return true, unWrap(source[count]) end else local en = source:GetEnumerator() if en:MoveNext() then local result repeat result = en:getCurrent() until not en:MoveNext() return true, result end end return false, 0 else local predicate = ... if predicate == nil then throw(ArgumentNullException("predicate")) end local result, found for _, v in each(source) do if predicate(v) then result = v found = true end end if found then return true, result end return false, 1 end end function Enumerable.Last(source, ...) local ok, result = last(source, ...) if ok then return result end if result == 0 then throw(InvalidOperationException("NoElements")) end throw(InvalidOperationException("NoMatch")) end function Enumerable.LastOrDefault(source, ...) local ok, result = last(source, ...) return ok and result or source.__genericT__:default() end local function single(source, ...) if source == nil then throw(ArgumentNullException("source")) end local len = select("#", ...) if len == 0 then if isArrayLike(source) then local count = #source if count == 0 then return false, 0 elseif count == 1 then return true, unWrap(source[1]) end else local en = source:GetEnumerator() if not en:MoveNext() then return false, 0 end local result = en:getCurrent() if not en:MoveNext() then return true, result end end return false, 1 else local predicate = ... if predicate == nil then throw(ArgumentNullException("predicate")) end local result, found for _, v in each(source) do if predicate(v) then result = v if found then return false, 1 end found = true end end if foun then return true, result end return false, 0 end end function Enumerable.Single(source, ...) local ok, result = single(source, ...) if ok then return result end if result == 0 then throw(InvalidOperationException("NoElements")) end throw(InvalidOperationException("MoreThanOneMatch")) end function Enumerable.SingleOrDefault(source, ...) local ok, result = single(source, ...) return ok and result or source.__genericT__:default() end local function elementAt(source, index) if source == nil then throw(ArgumentNullException("source")) end if index >= 0 then if isArrayLike(source) then local count = #source if index < count then return unWrap(source[index + 1]) end else local en = source:GetEnumerator() while true do if not en:MoveNext() then break end if index == 0 then return true, en:getCurrent() end index = index - 1 end end end return false end function Enumerable.ElementAt(source, index) local ok, result = elementAt(source, index) if ok then return result end throw(ArgumentOutOfRangeException("index")) end function Enumerable.ElementAtOrDefault(source, index) local ok, result = elementAt(source, index) return ok and result or source.__genericT__:default() end function Enumerable.Range(start, count) if count < 0 then throw(ArgumentOutOfRangeException("count")) end return createEnumerable(Int32, function() local index = -1 return createEnumerator(Int32, nil, function() index = index + 1 if index < count then return true, start + index end return false end) end) end function Enumerable.Repeat(element, count, T) if count < 0 then throw(ArgumentOutOfRangeException("count")) end return createEnumerable(T, function() local index = -1 return createEnumerator(T, nil, function() index = index + 1 if index < count then return true, element end return false end) end) end function Enumerable.Any(source, ...) if source == nil then throw(ArgumentNullException("source")) end local len = select("#", ...) if len == 0 then local en = source:GetEnumerator() return en:MoveNext() else local predicate = ... if predicate == nil then throw(ArgumentNullException("predicate")) end for _, v in each(source) do if predicate(v) then return true end end return false end end function Enumerable.All(source, predicate) if source == nil then throw(ArgumentNullException("source")) end if predicate == nil then throw(ArgumentNullException("predicate")) end for _, v in each(source) do if not predicate(v) then return false end end return true end function Enumerable.Count(source, ...) if source == nil then throw(ArgumentNullException("source")) end local len = select("#", ...) if len == 0 then if isArrayLike(source) then return #source end local count = 0 local en = source:GetEnumerator() while en:MoveNext() do count = count + 1 end return count else local predicate = ... if predicate == nil then throw(ArgumentNullException("predicate")) end local count = 0 for _, v in each(source) do if predicate(v) then count = count + 1 end end return count end end function Enumerable.Contains(source, value, comparer) if source == nil then throw(ArgumentNullException("source")) end local equals = getComparer(source, comparer).Equals for _, v in each(source) do if equals(v, value) then return true end end return false end function Enumerable.Aggregate(source, ...) if source == nil then throw(ArgumentNullException("source")) end local len = select("#", ...); if len == 1 then local func = ... if func == nil then throw(ArgumentNullException("func")) end local e = source:GetEnumerator() if not e:MoveNext() then throw(InvalidOperationException("NoElements")) end local result = e:getCurrent() while e:MoveNext() do result = func(result, e:getCurrent()) end return result elseif len == 2 then local seed, func = ... if func == nil then throw(ArgumentNullException("func")) end local result = seed for _, element in each(source) do result = func(result, element) end return result else local seed, func, resultSelector = ... if func == nil then throw(ArgumentNullException("func")) end if resultSelector == nil then throw(ArgumentNullException("resultSelector")) end local result = seed for _, element in each(source) do result = func(result, element) end return resultSelector(result) end end function Enumerable.Sum(source, ...) if source == nil then throw(ArgumentNullException("source")) end local len = select("#", ...) if len == 0 then local sum = 0 for _, v in each(source) do sum = sum + v end return sum else local selector = ... if selector == nil then throw(ArgumentNullException("selector")) end local sum = 0 for _, v in each(source) do sum = sum + selector(v) end return sum end end local function minOrMax(compareFn, source, ...) if source == nil then throw(ArgumentNullException("source")) end local len = select("#", ...) local selector, T if len == 0 then selector, T = identityFn, source.__genericT__ else selector, T = ... if selector == nil then throw(ArgumentNullException("selector")) end end local compare = Comparer_1(T).getDefault().Compare local value = T:default() if value == nil then for _, x in each(source) do x = selector(x) if x ~= nil and (value == nil or compareFn(compare, x, value)) then value = x end end return value else local hasValue = false for _, x in each(source) do x = selector(x) if hasValue then if compareFn(compare, x, value) then value = x end else value = x hasValue = true end end if hasValue then return value end throw(InvalidOperationException("NoElements")) end end local function minFn(compare, x, y) return compare(x, y) < 0 end function Enumerable.Min(source, ...) return minOrMax(minFn, source, ...) end local function maxFn(compare, x, y) return compare(x, y) > 0 end function Enumerable.Max(source, ...) return minOrMax(maxFn, source, ...) end
require 'wdm' -- start page local page = 'http://www.google.sk/search?q=lua' for i=1,10 do -- retrieve the page local src = get(page) -- convert it to table local t = toTidy(src) -- get links with class "l" local res = getElements(t, 'tag=="a" and class=="l"') for _,link in ipairs(res) do -- print the link url and link text print(link.href, text(link)) end -- get the element, whose first child is the 'next' image local nxt = getElements(t, 'self[1].tag=="img" and self[1].src=="nav_next.gif"')[1] -- construct the next url page = 'http://www.google.com' .. nxt.href end
---- Customized scoring local math = math local string = string local table = table local pairs = pairs SCORE = SCORE or {} SCORE.Events = SCORE.Events or {} -- One might wonder why all the key names in the event tables are so annoyingly -- short. Well, the serialisation module in gmod (glon) does not do any -- compression. At all. This means the difference between all events having a -- "time_added" key versus a "t" key is very significant for the amount of data -- we need to send. It's a pain, but I'm not going to code my own compression, -- so doing it manually is the only way. -- One decent way to reduce data sent turned out to be rounding the time floats. -- We don't actually need to know about 10000ths of seconds after all. function SCORE:AddEvent(entry, t_override) entry["t"] = math.Round(t_override or CurTime(), 2) table.insert(self.Events, entry) end local function CopyDmg(dmg) local wep = util.WeaponFromDamage(dmg) -- t = type, a = amount, g = gun, h = headshot local d = {} -- util.TableToJSON doesn't handle large integers properly d.t = tostring(dmg:GetDamageType()) d.a = dmg:GetDamage() d.h = false if wep then local id = WepToEnum(wep) if id then d.g = id else -- we can convert each standard TTT weapon name to a preset ID, but -- that's not workable with custom SWEPs from people, so we'll just -- have to pay the byte tax there d.g = wep:GetClass() end else local infl = dmg:GetInflictor() if IsValid(infl) and infl.ScoreName then d.n = infl.ScoreName end end return d end function SCORE:HandleKill( victim, attacker, dmginfo ) if not (IsValid(victim) and victim:IsPlayer()) then return end local e = { id=EVENT_KILL, att={ni="", sid=-1, tr=false}, vic={ni=victim:Nick(), sid=victim:SteamID(), tr=false}, dmg=CopyDmg(dmginfo)}; e.dmg.h = victim.was_headshot e.vic.tr = victim:GetTraitor() if IsValid(attacker) and attacker:IsPlayer() then e.att.ni = attacker:Nick() e.att.sid = attacker:SteamID() e.att.tr = attacker:GetTraitor() -- If a traitor gets himself killed by another traitor's C4, it's his own -- damn fault for ignoring the indicator. if dmginfo:IsExplosionDamage() and attacker:GetTraitor() and victim:GetTraitor() then local infl = dmginfo:GetInflictor() if IsValid(infl) and infl:GetClass() == "ttt_c4" then e.att = table.Copy(e.vic) end end end self:AddEvent(e) end function SCORE:HandleSpawn( ply ) if ply:Team() == TEAM_TERROR then self:AddEvent({id=EVENT_SPAWN, ni=ply:Nick(), sid=ply:SteamID()}) end end function SCORE:HandleSelection() local traitors = {} local detectives = {} for k, ply in pairs(player.GetAll()) do if ply:GetTraitor() then table.insert(traitors, ply:SteamID()) elseif ply:GetDetective() then table.insert(detectives, ply:SteamID()) end end self:AddEvent({id=EVENT_SELECTED, traitor_ids=traitors, detective_ids=detectives}) end function SCORE:HandleBodyFound(finder, found) self:AddEvent({id=EVENT_BODYFOUND, ni=finder:Nick(), sid=finder:SteamID(), b=found:Nick()}) end function SCORE:HandleC4Explosion(planter, arm_time, exp_time) local nick = "Someone" if IsValid(planter) and planter:IsPlayer() then nick = planter:Nick() end self:AddEvent({id=EVENT_C4PLANT, ni=nick}, arm_time) self:AddEvent({id=EVENT_C4EXPLODE, ni=nick}, exp_time) end function SCORE:HandleC4Disarm(disarmer, owner, success) if disarmer == owner then return end if not IsValid(disarmer) then return end local ev = { id = EVENT_C4DISARM, ni = disarmer:Nick(), s = success }; if IsValid(owner) then ev.own = owner:Nick() end self:AddEvent(ev) end function SCORE:HandleCreditFound(finder, found_nick, credits) self:AddEvent({id=EVENT_CREDITFOUND, ni=finder:Nick(), sid=finder:SteamID(), b=found_nick, cr=credits}) end function SCORE:ApplyEventLogScores(wintype) local scores = {} local traitors = {} local detectives = {} for k, ply in pairs(player.GetAll()) do scores[ply:SteamID()] = {} if ply:GetTraitor() then table.insert(traitors, ply:SteamID()) elseif ply:GetDetective() then table.insert(detectives, ply:SteamID()) end end -- individual scores, and count those left alive local alive = {traitors = 0, innos = 0} local dead = {traitors = 0, innos = 0} local scored_log = ScoreEventLog(self.Events, scores, traitors, detectives) local ply = nil for sid, s in pairs(scored_log) do ply = player.GetBySteamID(sid) if ply and ply:ShouldScore() then ply:AddFrags(KillsToPoints(s, ply:GetTraitor())) end end -- team scores local bonus = ScoreTeamBonus(scored_log, wintype) for sid, s in pairs(scored_log) do ply = player.GetBySteamID(sid) if ply and ply:ShouldScore() then ply:AddFrags(ply:GetTraitor() and bonus.traitors or bonus.innos) end end -- count deaths for k, e in pairs(self.Events) do if e.id == EVENT_KILL then local victim = player.GetBySteamID(e.vic.sid) if IsValid(victim) and victim:ShouldScore() then victim:AddDeaths(1) end end end end function SCORE:RoundStateChange(newstate) self:AddEvent({id=EVENT_GAME, state=newstate}) end function SCORE:RoundComplete(wintype) self:AddEvent({id=EVENT_FINISH, win=wintype}) end function SCORE:Reset() self.Events = {} end local function SortEvents(events) -- sort events on time table.sort(events, function(a,b) if not b or not a then return false end return a.t and b.t and a.t < b.t end) return events end local function EncodeForStream(events) events = SortEvents(events) -- may want to filter out data later -- just serialize for now local result = util.TableToJSON( events ) if not result then ErrorNoHalt("Round report event encoding failed!\n") return false else return result end end function SCORE:StreamToClients() local s = EncodeForStream(self.Events) if not s then return -- error occurred end -- divide into happy lil bits. -- this was necessary with user messages, now it's -- a just-in-case thing if a round somehow manages to be > 64K local cut = {} local max = 65500 while #s != 0 do local bit = string.sub(s, 1, max - 1) table.insert(cut, bit) s = string.sub(s, max, -1) end local parts = #cut for k, bit in pairs(cut) do net.Start("TTT_ReportStream") net.WriteBit((k != parts)) -- continuation bit, 1 if there's more coming net.WriteString(bit) net.Broadcast() end end
print("this is the utils file") return 34
object_tangible_quest_talus_selonian_hide_container_01 = object_tangible_quest_shared_talus_selonian_hide_container_01:new { } ObjectTemplates:addTemplate(object_tangible_quest_talus_selonian_hide_container_01, "object/tangible/quest/talus_selonian_hide_container_01.iff")
local PLUGIN = PLUGIN local PANEL = {} local PADDING = 2 local HEADER_HEIGHT = 22 local WEIGHT_PANEL_HEIGHT = 32 local BORDER_FIX_W = 8 local BORDER_FIX_H = 14 local SHADOW_COLOR = Color(0, 0, 0, 100) function PANEL:Init() self:SetPaintBackground(false) self.weight = self:Add("DPanel") self.weight:SetTall(WEIGHT_PANEL_HEIGHT + PADDING) self.weight:Dock(TOP) self.weight:DockMargin(0, 0, 0, PADDING) self.weight:InvalidateLayout(true) self.weightBar = self.weight:Add("DPanel") self.weightBar:Dock(FILL) self.weightBar:DockMargin(PADDING, PADDING, PADDING, PADDING) self.weightBar.Paint = function(this, w, h) self:paintWeightBar(w, h) end self.weightLabel = self.weight:Add("DLabel") self.weightLabel:SetText("WEIGHT: 0/10KG") self.weightLabel:SetFont("nutChatFont") self.weightLabel:Dock(FILL) self.weightLabel:SetContentAlignment(5) self.weightLabel:SetExpensiveShadow(1, SHADOW_COLOR) self.scroll = self:Add("DScrollPanel") self.scroll:Dock(FILL) self.scroll.VBar:SetWide(0) self.content = self.scroll:Add("DGrid") self.content:Dock(FILL) self.content:SetCols(1) self.content:SetColWide(NS_ICON_SIZE + PADDING) self.content:SetRowHeight(NS_ICON_SIZE + PADDING) self.icons = {} end function PANEL:setInventory(inventory) self:nutListenForInventoryChanges(inventory) self.inventory = inventory self:populateItems() self:updateWeight() end function PANEL:setColumns(numColumns, iconSideLength) iconSideLength = iconSideLength or (NS_ICON_SIZE + PADDING) self.content:SetCols(numColumns) self.content:SetColWide(iconSideLength) self.content:SetRowHeight(iconSideLength) self.scroll:InvalidateLayout(true) end function PANEL:getIcons() return self.icons end function PANEL:removeIcon(icon) self.content:RemoveItem(icon) end function PANEL:addStack(key, stack) if (IsValid(self.icons[key]) or #stack == 0) then return end local icon = self.content:Add("nutItemIcon") icon:setItemType(stack[1]:getID()) icon.PaintBehind = self.itemPaintBehind icon.OnMousePressed = function(itemIcon, keyCode) self:onItemPressed(itemIcon, keyCode) end local quantity = icon:Add("DLabel") quantity:SetPos(PADDING, PADDING) quantity:SetFont("nutChatFont") quantity:SetText(#stack) quantity:SetExpensiveShadow(1, SHADOW_COLOR) quantity:SizeToContents() self.icons[key] = icon self.content:AddItem(icon) self.scroll:InvalidateLayout() end function PANEL:onItemPressed(itemIcon, keyCode) itemIcon:openActionMenu() end function PANEL:populateItems() for _, icon in pairs(self.icons) do self.content:RemoveItem(icon) end local stacks = PLUGIN:getItemStacks(self.inventory) for key, stack in SortedPairs(stacks) do self:addStack(key, stack) end self.content:InvalidateLayout(true) end function PANEL:updateWeight() local inventory = self.inventory if (not inventory) then return end self.weightLabel:SetText( L"weight":upper()..": ".. inventory:getWeight().."/"..inventory:getMaxWeight().. nut.config.get("invWeightUnit", "KG") ) end function PANEL:Center() local parent = self:GetParent() local centerX, centerY = ScrW() * 0.5, ScrH() * 0.5 self:SetPos( centerX - (self:GetWide() * 0.5), centerY - (self:GetTall() * 0.5) ) end function PANEL:paintWeightBar(w, h) if (not self.inventory) then return end local weight = self.inventory:getWeight() local maxWeight = self.inventory:getMaxWeight() local percentage = math.Clamp(weight / maxWeight, 0, 1) surface.SetDrawColor(nut.config.get("color")) surface.DrawRect(0, 0, w * percentage, h) end -- self actually refers to the icon function PANEL:itemPaintBehind(w, h) surface.SetDrawColor(0, 0, 0, 50) surface.DrawRect(0, 0, w, h) surface.SetDrawColor(0, 0, 0, 150) surface.DrawOutlinedRect(0, 0, w, h) end -- Called when a data value has been changed for the inventory. function PANEL:InventoryDataChanged(key, oldValue, newValue) if (key == "maxWeight") then self:updateWeight() end end -- Called when the given item has been added to the inventory. function PANEL:InventoryItemAdded(item) self:populateItems() self:updateWeight() end -- Called when the given item has been removed from the inventory. function PANEL:InventoryItemRemoved(item) self:populateItems() self:updateWeight() end -- Called when an item within this inventory has its data changed. function PANEL:InventoryItemDataChanged(item, key, oldValue, newValue) self:populateItems() self:updateWeight() end vgui.Register("nutListInventoryPanel", PANEL, "DPanel")
require "mgunit" table.foreachi( { "tests/test_log.lua", "tests/test_stringutils.lua", "tests/test_tableutils.lua", }, function (_, file) local testcase = assert(loadfile(file))() mgunit.TestCase:new(testcase) end ) mgunit.main()
local Package = game:GetService("ReplicatedStorage").Fusion local Value = require(Package.State.Value) local ForPairs = require(Package.State.ForValues) local function callback() return true end local function constantOutput(key, value) return key, value end local function dynamicOutput(key, value) return {key}, {value} end return { { name = "ForPairs with blank input table", calls = 20000, run = function() ForPairs({}, callback) end, }, { name = "ForPairs with input table - constant output", calls = 20000, run = function() ForPairs({ ["Foo"] = "bar" }, constantOutput) end, }, { name = "ForPairs with input table - dynamic output", calls = 20000, run = function() ForPairs({ ["Foo"] = "bar" }, dynamicOutput) end, }, { name = "ForPairs with input state - constant output", calls = 20000, run = function() ForPairs(Value({ ["Foo"] = "bar" }), constantOutput) end, }, { name = "ForPairs with input state - dynamic output", calls = 20000, run = function() ForPairs(Value({ ["Foo"] = "bar" }), dynamicOutput) end, }, { name = "ForPairs with changed input table - constant output", calls = 20000, run = function() local computed = ForPairs({ ["Foo"] = "bar" }, constantOutput) computed.__inputTable = { ["Bar"] = "foo" } computed:update() end, }, { name = "ForPairs with changed input table - dynamic output", calls = 20000, run = function() local computed = ForPairs({ ["Foo"] = "bar" }, dynamicOutput) computed.__inputTable = { ["Bar"] = "foo" } computed:update() end, }, { name = "ForPairs with changed input state - constant output", calls = 20000, run = function() local state = Value({ ["Foo"] = "bar" }) ForPairs(state, constantOutput) state:set({ ["Bar"] = "foo" }) end, }, { name = "ForPairs with changed input state - dynamic output", calls = 20000, run = function() local state = Value({ ["Foo"] = "bar" }) ForPairs(state, dynamicOutput) state:set({ ["Bar"] = "foo" }) end, }, }
--#-package:0C160701# -- package signature --# dsp Diaspora SC4 base functions: Filing & Configuration 0.1 --# copyright emcekah 2013 - use for personal pleasure --################################ DiasporaMainDataFile = [[Apps\Diaspora\data.dat]] DiasporaUserPatchFile = [[Apps\Diaspora\patch.dat]] dsp = {} function dsp.CreateDiasporaFile(file) local f = io.open(file) if not(f) then local f = io.output(file) f:write("#0x000000#".. os.time() .. "#" .. file,"\n") f:flush() end f:close() end function dsp.addGameStatus(data) local f = io.open(DiasporaMainDataFile, "a+") f:seek ("end") f:write("#0x000001#" .. os.time() .. "#CONFIG", "\n") for i,v in ipairs(data) do local str = split(v,"#") --# if str[1] == '0xd0000a' then f:write("#"..str[2].."#" .. dsp.automataGetSourceBuildingCount(str[2]) .. "#" ..str[3], "\n") end --# That's where the hook is.... end f:write("#0x000002#" .. sc4game.budget.total_funds().."#current budget", "\n") f:write("#0xffffff#", "\n") f:flush() f:close() end function dsp.readConfig() local lines = {} local i = 0 for line in io.lines(DiasporaUserPatchFile) do table.insert(lines, line) i = i+1 end dsp.saveTo(i, DiasporaMainDataFile, "' readable lines in " .. DiasporaUserPatchFile) return lines end function dsp.automataGetSourceBuildingCount(key) return sc4game.automata.get_source_building_count(hex2dec(key)) end function dsp.saveTo(data, file, comment) local f = io.open(file, "a+") f:seek ("end") f:write("#0xfffff0#" .. data .. "#" .. comment, "\n") f:flush() f:close() end --################################ --# Helpers function split(str, patt) vals = {}; valindex = 0; word = "" str = str .. patt for i = 1, string.len(str) do cha = string.sub(str, i, i) if cha ~= patt then word = word .. cha else if word ~= nil then vals[valindex] = word valindex = valindex + 1 word = "" else break end end end return vals end --################################ --# MAIN dsp.CreateDiasporaFile(DiasporaMainDataFile) if dsp.addGameStatus(dsp.readConfig()) then dsp.saveTo("#SUCCESS#", DiasporaMainDataFile, "#config loaded.") --# create the advisor end
--- This file is generated by ava-x2l.exe, --- Don't change it manaully. --- @copyright Lilith Games, Project Da Vinci(Avatar Team) --- @see Official Website: https://www.projectdavinci.com/ --- @see Dev Framework: https://github.com/lilith-avatar/avatar-ava --- @see X2L Tool: https://github.com/lilith-avatar/avatar-ava-xls2lua --- source file: .//ItemNew.xlsm local MeleeXls = { [1001] = { ItemID = 1001, ModelName = 'Stick_Wood', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 10.0, Hunt = true }, [1002] = { ItemID = 1002, ModelName = 'S_Stick', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 1, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 10.0, Hunt = true }, [1003] = { ItemID = 1003, ModelName = 'S_BaseballBat_Wood_01', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 16, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 20.0, Hunt = true }, [1004] = { ItemID = 1004, ModelName = 'Hoes_Iron', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 0.0, Hunt = true }, [1005] = { ItemID = 1005, ModelName = 'Hammer_Wood', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 20.0, Hunt = true }, [1006] = { ItemID = 1006, ModelName = 'Hammer_Iron', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 20.0, Hunt = true }, [1007] = { ItemID = 1007, ModelName = 'Dagger', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 10.0, Hunt = true }, [1008] = { ItemID = 1008, ModelName = 'Cleats_Zombies_02', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 0.0, Hunt = true }, [1009] = { ItemID = 1009, ModelName = 'Axe_OneHand', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 20.0, Hunt = true }, [1010] = { ItemID = 1010, ModelName = 'Axe_Wood', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 15.0, Hunt = true }, [1011] = { ItemID = 1011, ModelName = 'Axe_Wood_02', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 15.0, Hunt = true }, [1012] = { ItemID = 1012, ModelName = 'Pan', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 5.0, Hunt = true }, [1013] = { ItemID = 1013, ModelName = 'S_Sword_Laser_Blue', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 10, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 31, HitForce = 20.0, Hunt = true }, [1014] = { ItemID = 1014, ModelName = 'S_Sword_Laser_Red', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 4, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 31, HitForce = 20.0, Hunt = true }, [1015] = { ItemID = 1015, ModelName = 'S_Magnet_Red_01', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 2, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = -5.0, Hunt = true }, [1016] = { ItemID = 1016, ModelName = 'S_Plunger_Red', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(180, 0, 0), HealthChange = 30, HitAddBuffID = 42, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 5.0, Hunt = true }, [1017] = { ItemID = 1017, ModelName = 'Hoes_Energy', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 3, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 15.0, Hunt = true }, [1018] = { ItemID = 1018, ModelName = 'Crowbar_Energy', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 3, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 15.0, Hunt = true }, [1019] = { ItemID = 1019, ModelName = 'Scoop_Energy', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(189, 269.5, 272), HealthChange = 30, HitAddBuffID = 6, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 5.0, Hunt = true }, [1020] = { ItemID = 1020, ModelName = 'Spade_Energy', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 3, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 15.0, Hunt = true }, [1021] = { ItemID = 1021, ModelName = 'S_Tree_01', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 40, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 15.0, Hunt = true }, [1022] = { ItemID = 1022, ModelName = 'FishingRod', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 5.0, Hunt = true }, [1023] = { ItemID = 1023, ModelName = 'Fireworks_Y', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 0.0, Hunt = true }, [1024] = { ItemID = 1024, ModelName = 'S_Hammer_Yellow', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 41, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 20.0, Hunt = true }, [1025] = { ItemID = 1025, ModelName = 'S_Axe_Wood_02', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 7, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 20.0, Hunt = true }, [1026] = { ItemID = 1026, ModelName = 'S_Axe_OneHand', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 41, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 20.0, Hunt = true }, [1027] = { ItemID = 1027, ModelName = 'S_Hammer_Bones', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 4, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 20.0, Hunt = true }, [1028] = { ItemID = 1028, ModelName = 'S_Hammer_Blue', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 20.0, Hunt = true }, [1029] = { ItemID = 1029, ModelName = 'S_Dagger_01', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 3, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 15.0, Hunt = true }, [1030] = { ItemID = 1030, ModelName = 'S_Hammer_Iron_01', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 4, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 15.0, Hunt = true }, [1031] = { ItemID = 1031, ModelName = 'S_Axe_Wood_01', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 1, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 15.0, Hunt = true }, [1032] = { ItemID = 1032, ModelName = 'S_Hammer_Wood_01', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 1, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 15.0, Hunt = true }, [1033] = { ItemID = 1033, ModelName = 'S_MeteorHammer_Iron_01', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 16, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 20.0, Hunt = true }, [1034] = { ItemID = 1034, ModelName = 'Fireworks_G', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 0.0, Hunt = true }, [1035] = { ItemID = 1035, ModelName = 'Fireworks_R', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 0.0, Hunt = true }, [1036] = { ItemID = 1036, ModelName = 'Fireworks_B', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 0.0, Hunt = true }, [1037] = { ItemID = 1037, ModelName = 'Fireworks_P', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 0.0, Hunt = true }, [1038] = { ItemID = 1038, ModelName = 'Fireworks_O', ParentNode = 'Bone_R_Hand.RHandWeaponNode', Offset = Vector3(0, 0, 0), Angle = EulerDegree(0, 0, 0), HealthChange = 30, HitAddBuffID = 48, HitAddBuffDur = 10.0, HitRemoveBuffID = 0, HitEffectName = 'ArrowTartgetHitEffect', HitSoundID = 32, HitForce = 0.0, Hunt = true } } return MeleeXls
if not _start then local a,b=net.createServer(net.TCP,10),{}a:listen(80,function(c)local d;c:on("receive",function(c,e)local f=dofile("web_request.lua")(e)if f then d=f.file;b[d]=nil;b[d]=coroutine.create(dofile("web_file.lua"))coroutine.resume(b[d],c,f)end;print(node.heap())end)c:on("sent",function(c)if b[d]then local g=coroutine.status(b[d])if g=="suspended"then local h=coroutine.resume(b[d])if not h then c:close()b[d]=nil;collectgarbage()end elseif g=="dead"then c:close()b[d]=nil;collectgarbage()end end end)end)end;_start=true
local MsgN = MsgN local IsValid = IsValid local setmetatable = setmetatable local SERVER = SERVER local math = math local util = util local Vector = Vector local ErrorNoHalt = ErrorNoHalt local baseclass = baseclass local LocalPlayer = LocalPlayer module( "drive" ) local Type = {} function Register( name, table, base ) Type[ name ] = table; -- -- If we have a base method then hook -- it up in the meta table -- if ( base ) then setmetatable( Type[ name ], { __index = Type[ base ] } ) end if ( SERVER ) then util.AddNetworkString( name ) end -- -- drive methods cooperate with the baseclass system -- /lua/includes/modules/baseclass.lua -- baseclass.Set( name, Type[ name ] ) end function PlayerStartDriving( ply, ent, mode ) local method = Type[mode] if ( !method ) then ErrorNoHalt( "Unknown drive type " .. (mode) ) return; end local id = util.NetworkStringToID( mode ) ply:SetDrivingEntity( ent, id ) end function PlayerStopDriving( ply ) ply:SetDrivingEntity( nil ) end function GetMethod( ply ) -- -- Not driving, return immediately -- if ( !ply:IsDrivingEntity() ) then return end local ent = ply:GetDrivingEntity(); local modeid = ply:GetDrivingMode(); -- -- Entity is invalid or mode isn't set - return out -- if ( !IsValid( ent ) || modeid == 0 ) then return end -- -- Have we already got a drive method? If so then reuse. -- local method = ply.m_CurrentDriverMethod; if ( method && method.Entity == ent && method.ModeID == modeid ) then return method end -- -- No method - lets create one. Get the string from the modeid. -- local modename = util.NetworkIDToString( modeid ) if ( !modename ) then return end -- -- Get that type. Fail if we don't have the type. -- local type = Type[ modename ] if ( !type ) then return end local method = {} method.Entity = ent method.Player = ply method.ModeID = modeid setmetatable( method, { __index = type } ) ply.m_CurrentDriverMethod = method method:Init() return method end function DestroyMethod( pl ) if ( !IsValid( pl ) ) then return end pl.m_CurrentDriverMethod = nil; end -- -- Called when the player first -- starts driving this entity -- function Start( ply, ent ) if ( SERVER ) then -- Set this to the ent's view entity ply:SetViewEntity( ent ) -- Save the player's eye angles ply.m_PreDriveEyeAngles = ply:EyeAngles() ply.m_PreDriveObserveMode = ply:GetObserverMode() -- Lock the player's eye angles to our angles local ang = ent:GetAngles() ply:SetEyeAngles( ang ) -- Hide the controlling player's world model ply:DrawWorldModel( false ) end end -- -- Clientside, the client creates the cmd (usercommand) -- from their input device (mouse, keyboard) and then -- it's sent to the server. Restrict view angles here :) -- function CreateMove( cmd ) method = GetMethod( LocalPlayer() ) if ( !method ) then return end method:SetupControls( cmd ) return true end -- -- Optionally alter the view -- function CalcView( ply, view ) method = GetMethod( ply ) if ( !method ) then return end method:CalcView( view ) return true end -- -- The user command is received by the server and then -- converted into a move. This is also run clientside -- when in multiplayer, for prediction to work. -- function StartMove( ply, mv, cmd ) method = GetMethod( ply ) if ( !method ) then return end method:StartMove( mv, cmd ) return true end -- -- The move is executed here. -- function Move( ply, mv ) method = GetMethod( ply ) if ( !method ) then return end method:Move( mv ) return true end -- -- The move is finished. Copy mv back into the target. -- function FinishMove( ply, mv ) method = GetMethod( ply ) if ( !method ) then return end method:FinishMove( mv ) if ( method.StopDriving ) then PlayerStopDriving( ply ) end return true end -- -- Player has stopped driving the entity -- function End( ply, ent ) -- -- If the player is valid then set the view entity to nil -- if ( SERVER && IsValid( ply ) ) then if ( ply.m_PreDriveEyeAngles != nil ) then ply:SetEyeAngles( ply.m_PreDriveEyeAngles ) ply.m_PreDriveEyeAngles = nil end if ( ply.m_PreDriveObserveMode != nil ) then ply:SetObserverMode( ply.m_PreDriveObserveMode ) ply.m_PreDriveObserveMode = nil end ply:SetViewEntity( nil ) -- Show the controlling player's world model ply:DrawWorldModel( true ) end DestroyMethod( ply ); end
require'colorizer'.setup( {'*';}, { RGB = true; -- #RGB hex codes RRGGBB = true; -- #RRGGBB hex codes names = true; -- "Name" codes like Blue RRGGBBAA = true; -- #RRGGBBAA hex codes rgb_fn = true; -- CSS rgb() and rgba() functions hsl_fn = true; -- CSS hsl() and hsla() functions css = true; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn })
require 'nn'; --require 'cunn'; --require 'cudnn'; require 'torch2caffe/prepnv.lua' local t2c=require 'torch2caffe.lib' -- Figure out the path of the model and load it local path = arg[1] local basename = paths.basename(path, 't7b') local ext = path:match("^.+(%..+)$") print(ext) local model = nil if ext == '.t7b' then model = torch.load(path) elseif ext == '.txt' then error('wrong model') else assert(false, "We assume models end in either .t7b or .txt") end if model.net then model = model.net end model2 = model:clone() model=g_t2c_preprocess(model, opts) local function check(module, module2,input_dims) module:apply(function(m) m:evaluate() end) local opts = { prototxt = string.format('%s.prototxt', basename), caffemodel = string.format('%s.caffemodel', basename), inputs={{name="data", input_dims=input_dims}}, } t2c.convert(opts, module) t2c.compare(opts, module2) return opts end check(model, model2, {50,3,224,224})
return { sharp = { 38, 4, 18, 12, 6 }, sharpp = { 38, 4, 18, 12, 15, 3 } }
yatm_overhead_rails:require("nodes/overhead_rails.lua") yatm_overhead_rails:require("nodes/overhead_rail_riser.lua") yatm_overhead_rails:require("nodes/overhead_docking_station.lua") yatm_overhead_rails:require("nodes/docking_crate.lua")
local class = require 'middleclass' local lume = require 'lume' -- 基底クラス local Super = require 'Scene' -- クラス local Scene = class('Camp', Super) -- 組み込み Scene:include(require 'stateful') -- 初期化 function Scene:initialize(t) Super.initialize(self) self.app = t.app or {} end -- 破棄 function Scene:destroy() end -- 更新 function Scene:update(dt) end -- 描画 function Scene:draw() love.graphics.print( '[Camp]\n\n' .. '#)Inspect\n' .. 'R)eorder\n' .. 'E)quip\n' .. 'L)eave', 0, 0 ) end -- キー入力 function Scene:keypressed(key, scancode, isrepeat) if key == '1' or key == '2' or key == '3' or key == '4' or key == '5' or key == '6' then self:pushState('Inspect', tonumber(key)) elseif key == 'r' then self:pushState 'Reorder' elseif key == 'e' then self:pushState 'Equip' elseif key == 'l' or key == 'return' then self:popScene() end end -- マウス入力 function Scene:mousepressed(x, y, button, istouch, presses) --self:popScene() end -- ステート追加 local Inspect = Scene:addState 'Inspect' -- ステート開始時 function Inspect:enteredState(index) self.inspect = { index = index, } end -- 描画 function Inspect:draw() love.graphics.print( '[Camp]\n\n' .. 'Inspect #' .. self.inspect.index , 0, 0 ) end -- キー入力 function Inspect:keypressed(key, scancode, isrepeat) if key == 'return' then self:popState() end end -- ステート追加 local Reorder = Scene:addState 'Reorder' -- 描画 function Reorder:draw() love.graphics.print( '[Camp]\n\n' .. 'Reorder\n' , 0, 0 ) end -- キー入力 function Reorder:keypressed(key, scancode, isrepeat) if key == 'return' then self:popState() end end -- キー入力 function Inspect:keypressed(key, scancode, isrepeat) if key == 'return' then self:popState() end end -- ステート追加 local Equip = Scene:addState 'Equip' -- 描画 function Equip:draw() love.graphics.print( '[Camp]\n\n' .. 'Equip\n' , 0, 0 ) end -- キー入力 function Equip:keypressed(key, scancode, isrepeat) if key == 'return' then self:popState() end end return Scene
function string:count(p) local c = 0; for _ in self:gmatch(p) do c = c+1 end return c; end function string:fmtCheck(...) return self:count('%%s') == select('#',...) end function string:properNoun() return self:gsub("^%l", string.upper) end function string:startswith( s ) return self:sub(1, #s) == s end function string:endswith( s ) return self:sub(-#s) == s end function string:suffix (pre) return self:startswith(pre) and self:sub(#pre+1) or self end function string:prefix (pre) return self:endswith(pre) and self:sub(1,-(#pre+1)) or self end getmetatable"".__mod = function(self, t ) if type(t) == 'table' then return self:format(unpack(t)) else return self:format(t) end end local codeblock = "```%s```" local langblock = "```%s\n%s\n```" local bold = "**%s**" local emphasis = "*%s*" local strike = "~~%s~~" local snippet = "`%s`" local lpeg = require"lpeg" lpeg.locale(lpeg) local modifiers = lpeg.S"`*_~:<>" function lpeg.gsub (s, patt, repl) patt = lpeg.P(patt) patt = lpeg.Cs((patt / repl + 1)^0) return lpeg.match(patt, s) end --cleans a string so that it's discord safe function string.sanitize(str) return lpeg.gsub(str, modifiers, "\\%0") end function string.strip(str) return str:gsub("%^.-;", "") end function string:codeblock() return codeblock:format(self) end function string:lang( lang ) return langblock:format(lang, self) end function string:bold( ) return bold:format(self:sanitize()) end function string:emphasis( ) return emphasis:format(self:sanitize()) end function string:strike( ) return strike:format(self:sanitize()) end function string:snippet() return snippet:format(self) end function string:trim() return self:gsub("^%s*(.-)%s*$","%1",1) end local matches = { ["^"] = "%^"; ["$"] = "%$"; ["("] = "%("; [")"] = "%)"; ["%"] = "%%"; ["."] = "%."; ["["] = "%["; ["]"] = "%]"; ["*"] = "%*"; ["+"] = "%+"; ["-"] = "%-"; ["?"] = "%?"; ["\0"] = "%z"; } function string:escape_lua_pattern(s) return (s:gsub(".", matches)) end local util = {} local insert = table.insert local running, resume, yield, wrap, status = coroutine.running, coroutine.resume, coroutine.yield, coroutine.wrap, coroutine.status local sleep = require"timer".sleep function util.keys(t) local new = {} for k in pairs(t) do insert(new, k) end return new end function util.merge(t1, t2) for k, v in pairs(t2) do if type(v) == "table" and type(t1[k]) == "table" then util.merge(t1[k] or {}, v) else t1[k] = v end end return t1 end function util.mergeShallow(t1, t2) for k, v in pairs(t2) do if type(v) == "table" and type(t1[k]) == "table" then t1[k] = util.mergeShallow(util.mergeShallow({}, t1[k]), v) else t1[k] = v end end return t1 end local insert = table.insert function util.mergeLists(l1, l2) for _, v in ipairs(l2) do insert(l1, v) end end function util.foldWithArgs( l, f, a,...) for k, v in ipairs(l) do a = f(a,k,v,...) end return a end function util.fold(l, f, a) for k,v in ipairs(l) do a = f(a,v) end return a end function util.filterout(t, elem) local new = {} for _, v in ipairs(r) do if v ~= elem then insert(new, v) end end return new end function util.reduce(f, a, t,...) for k, v in ipairs(t) do a = f(a,v,k,...) end return a end function util.contains(t, elem) for k, v in pairs(t) do if v == elem then return true end end end local function compose2(f,fnext) return function(...) return fnext(f(...)) end end function util.compose( ... ) local funcs = {select(2,...)} return util.reduce(compose2, (...),funcs) end function util.map( list, func, ...) local new = {} for k, v in ipairs(list) do new[k] = func(v, ...) end return new end function util.filter( list, func, ... ) local new = {} for k, v in ipairs(list) do if func(v, ...) then insert(new, v) end end return new end function util.str( s, default ) if s == nil or s == '' then return default else return s end end util.proxy = setmetatable({}, {__index = util, __newindex = function() end, __metatable = false}) local function _disjuct(A,B) return function(cmd, msg) return A(cmd, msg) or B(cmd, msg) end end function util.disjunct(...) local f = _disjuct(...) for _, nxt in ipairs{select(3,...)} do f = _disjuct(f, nxt) end return f end function util.negate(A) return function(cmd, msg) return not A(cmd, msg) end end function util.guild_only(_, msg) return not not msg.guild end function util.has_required_roles(cmd, msg, scope) scope = scope or cmd.scope or "moderation" local roles = cmd.plugin:config().roles local member = msg.member if not roles[scope] then return false end for _, id in ipairs(roles[scope]) do if not member:hasRole(id) then return false end end return true end function util.in_correct_channel(cmd, msg, scope) scope = scope or cmd.scope or "moderation" local channels = cmd.plugin:config().channels[scope] local id = msg.channel.id return channels and util.contains(channels, id) end function util.has_a_required_role(cmd, msg, scope) scope = scope or cmd.scope or "moderation" local roles = cmd.plugin:config().roles[scope] local member = msg.member if not roles then return false end for _, id in ipairs(roles) do if member:hasRole(id) then return true end end return false end function util.has_admin(cmd, msg) return util.has_a_required_role(cmd, msg, "admin") or msg.member and msg.member:hasPermission(msg.channel, 0x8) end function util.in_guild(gid) return function(_, msg) return msg.guild and msg.guild.id == gid end end function util.makeCallback() local thread = running() return wrap(function(...) while status(thread) ~= "suspended" do sleep(0) end return assert(resume(thread, ...)) end) end local weak_meta = {__mode = "k"} function util.weak(t) return setmetatable(t, weak_meta) end return util
-- Copyright (C) 2017 Afonso Bordado -- -- Licensed under the MIT license <http://opensource.org/licenses/MIT>, -- This file may not be copied, modified, or distributed except according -- to the terms of that license. -- make generated variable nicer. set_variable_format "%s%d" c_module "llvm" { luajit_ffi = false, luajit_ffi_load_cmodule = false, use_globals = false, hide_meta_info = false, --true, include "llvm-c/Analysis.h", include "llvm-c/BitReader.h", include "llvm-c/BitWriter.h", include "llvm-c/Core.h", include "llvm-c/Disassembler.h", include "llvm-c/ErrorHandling.h", include "llvm-c/ExecutionEngine.h", include "llvm-c/Initialization.h", include "llvm-c/IRReader.h", include "llvm-c/Linker.h", include "llvm-c/LinkTimeOptimizer.h", include "llvm-c/lto.h", include "llvm-c/Object.h", include "llvm-c/OrcBindings.h", include "llvm-c/Support.h", include "llvm-c/Target.h", include "llvm-c/TargetMachine.h", include "llvm-c/Types.h", subfiles { "src/core/type.nobj.lua", "src/core/module.nobj.lua", "src/core/context.nobj.lua", "src/core/value.nobj.lua", "src/core/basic_block.nobj.lua", -- Threading -- Bit Reader -- Analysis -- Bit Writer -- Target Information -- LTO "src/builder.nobj.lua", -- Disassembler -- Transforms -- Link Time Optimization -- Memory Buffers -- Pass Registry -- Module Providers -- Object file reading and writing -- Pass Managers -- Execution Engine -- ThinLTO -- Initialization Routines "src/enums.nobj.lua", }, }
require("__Constructron-Continued__.data.constructron") require("__Constructron-Continued__.data.constructron_pathing_proxy") require("__Constructron-Continued__.data.service_station") if mods["space-exploration"] and settings.startup["enable_rocket_powered_constructron"].value then require("__Constructron-Continued__.data.constructron-rocket-powered") end