content
stringlengths
5
1.05M
#!/usr/bin/luajit local lu=require"luaunit" local ffi=require"ffi" local ubx=require"ubx" local utils=require"utils" local cdata=require"cdata" assert_equals = lu.assert_equals assert_true = lu.assert_true -- require"trace" -- require"strict" local code_str_len = 16*1024*1024 local nd = ubx.node_create("test_struct_comm") ubx.load_module(nd, "stdtypes") ubx.load_module(nd, "testtypes") ubx.load_module(nd, "luablock") ubx.load_module(nd, "lfds_cyclic") local lua_testcomp = [[ ubx=require "ubx" ffi=require "ffi" local rd, this function init(b) b=ffi.cast("ubx_block_t*", b) this=b ubx.ffi_load_types(b.nd) -- print("adding port 'pos_in' to block ", ubx.safe_tostr(b.name)) ubx.port_add(b, "pos_in", "{ desc='current measured position' }", 0, "struct kdl_vector", 1, nil, 0) ubx.port_add(b, "pos_out", "{ desc='desired position' }", 0, nil, 0, "struct kdl_vector", 1) rd = ubx.data_alloc(b.nd, "struct kdl_vector") return true end function start(b) return true end function step(b) local res = ubx.port_read(ubx.port_get(b, "pos_in"), rd) if res<=0 then print("step: no sample received", res) goto out end local cdat=ubx.data_to_cdata(rd) -- print("received vector["..tostring(res).."]: ", cdat.x, cdat.y, cdat.z) cdat.x=cdat.x*2; cdat.y=cdat.y*2; cdat.z=cdat.z*2; ubx.port_write(ubx.port_get(b, "pos_out"), rd) ::out:: end function cleanup(b) ubx.port_rm(b, "pos_out") ubx.port_rm(b, "pos_in") end ]] lb1=ubx.block_create(nd, "lua/luablock", "lb1", { lua_str=lua_testcomp } ) assert_equals(ubx.block_init(lb1), 0) local p_pos_out = ubx.port_clone_conn(lb1, "pos_in", 4) local p_pos_in = ubx.port_clone_conn(lb1, "pos_out", 4) assert_equals(ubx.block_start(lb1), 0) local _vin=ubx.data_alloc(nd, "struct kdl_vector") local _vout=ubx.data_alloc(nd, "struct kdl_vector") vcdin = ubx.data_to_cdata(_vin) vcdout = ubx.data_to_cdata(_vout) ubx.data_set(_vin, {x=1,y=2,z=3}) function test_comm() for i=1,100000 do vcdin.x=vcdin.x*i; vcdin.y=vcdin.y*i; vcdin.z=vcdin.z*i; ubx.port_write(p_pos_out, _vin) ubx.cblock_step(lb1) assert_true(ubx.port_read(p_pos_in, _vout) > 0, "test block produced no output") assert_equals(vcdin.x*2, vcdout.x) assert_equals(vcdin.y*2, vcdout.y) assert_equals(vcdin.z*2, vcdout.z) end end os.exit( lu.LuaUnit.run() )
--[[ Core - chaty @author Jakub 'XJMLN' Starzak <jack@pszmta.pl @package PSZMTA.psz-core @copyright Jakub 'XJMLN' Starzak <jack@pszmta.pl> Nie mozesz uzywac tego skryptu bez mojej zgody. Napisz - byc moze sie zgodze na uzycie. ]]-- local meTime = {} local lastMeMessage = {} local chatTime = {} local lastChatMessage = {} playerData = {} serverData = {} serverData.cenzurowane_slowa = { "[kK][uU]+[rR][wW]", "[pP][iI][zZ][dD]", "[pP][iI][eE][rR][dD][oO][lL]", "[sS][pP][iI][eE][rR][dD][aA][lL][aA][jJ]", "[sS][uU][kK][iI][nN]", "[jJ][eE][bB]", "[cC][iI][pP][oO]", "[hH][uU][jJ][uU]", "[hH][uU][jJ]", "[cC][iI][pP]+[aA]", "[cC][iI][pP][kK][aA]", "[dD][zZ][iI][wW][kK][aA]", "[sS][uU][kK][aA]", "[sS][zZ][mM][aA][tT][aA]", "[jJ][eE][bB][aA][cC]+[ćĆ]", "[cC][iI][oO][tT][aA]", "[cC][wW][eE][lL]", "[fF][uU][cC][kK]", } local syfEmoty = { -- ugly table "╭", "∩", "╮", "°", " ͡", "ʖ", " ͜", ":͊͌͌͋͋͊͊͊̏̏̏̏̏̏̏̏̏̏̏̏̏͌̏̏̏̏̏̏̏͏͌͌͌͋͋͋͊͊͊͊̏̏̏:͊͌͌͋͋͊͊͊̏", " ͡;", " ͜ʖ", "っ", "◡", "^", "╭", " ͡", "┌", "┐", "◢", "◣", "▄", "︻̷̿", "一", "━", "═", "✖", "。", "┻̿", "︻̷̿", "*͡", "͋", "̏", " ͋", "™", "✭", "★", "✔", } function removeHEXFromString(str) return str:gsub("#%x%x%x%x%x%x","") end function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end function cenzurujSlowo(slowo) return string.gsub(slowo,"(.).*(.)","***") end function cenzurujZdanie(zdanie) local cnt=0 for _,slowo in ipairs(serverData.cenzurowane_slowa) do zdanie,lcnt=string.gsub(zdanie,slowo,cenzurujSlowo) if lcnt and lcnt>0 then cnt=cnt+lcnt end end return zdanie,cnt end local function checkCenzura(zdanie) local cnt=0 for _,slowo in ipairs(serverData.cenzurowane_slowa) do zdanie,lcnt=string.gsub(zdanie,slowo,cenzurujSlowo) if lcnt and lcnt>0 then cnt=cnt+lcnt end end return cnt end local function trim(s) return (s:gsub("^%s*(.-)%s*$", "%1")) end local function firstToUpper(str) return (str:gsub("^%l", string.upper)) end function usuwajSyfskieEmoty(tekst) local cnt=0 for _,v in ipairs(syfEmoty) do tekst,lcnt=string.gsub(tekst,v,"") if lcnt and lcnt>0 then cnt=cnt+lcnt end end return tekst end local function isPlayerInFraction(plr) local fr = getElementData(plr,"faction:data") if (not fr) then return false end return true end local function outputChatBoxSplitted(text, target, c1,c2,c3, ca) if (string.len(text)<128) then outputChatBox(text, target, c1,c2,c3,ca) return end local t="" for i,v in string.gmatch(text,"(.)") do if (string.len(t)>0 and string.len(t)+string.len(i)>=128) then outputChatBox(t, target, c1,c2,c3,ca) t=" " end t=t..i end if (string.len(t)>0 and t~=" ") then outputChatBox(t, target, c1,c2,c3,ca) end end addEventHandler('onPlayerChat', getRootElement(), function(msg, type) if type == 0 then cancelEvent() if (not source or not isElement(source)) then return end local character=getElementData(source,"character") if (not character) then outputChatBox("Najpierw zaloguj się/poczekaj aż pobierze się serwer.", source, 255,0,0,true) cancelEvent() return end if getElementData(source,"player:muted") then outputChatBox("Posiadasz wyciszenie, nie możesz nic napisać.",source) return end if getElementData(source,"kary:blokada_aj") then outputChatBox("Posiadasz nałożony AJ, nie możesz nic napisać.",source) return end if chatTime[source] and chatTime[source] + tonumber(1000) > getTickCount() then outputChatBox("Powtarzasz się...", source, 255, 0, 0) return else chatTime[source] = getTickCount() end if lastChatMessage[source] and lastChatMessage[source] == msg then outputChatBox("Skończ spamować!", source, 255, 0, 0) return else lastChatMessage[source] = msg end local r, g, b = getPlayerNametagColor(source) if (checkCenzura(msg)>0) then outputChatBox("Tracisz 1PZ za przeklinanie. Nie tolerujemy takich czynów - jeśli dalej będziesz przeklinać możesz otrzymać blokadę.",source,255,0,0) pz = getElementData(source,"PZ") pz = pz-1 if pz<0 then pz = 0 end setElementData(source,"PZ",pz) end local msg = removeHEXFromString(cenzurujZdanie(msg)) local msg = trim(stripColors(msg)) if string.len(msg)<1 then return end local msg = usuwajSyfskieEmoty(msg) if string.len(msg)<1 then return end local msg = firstToUpper(msg) if msg == "()" then return end local r,g,b = getPlayerNametagColor(source) local nick = RGBToHex(r,g,b)..getPlayerName(source) if (getElementData(source,"vip")) then local playerID = "#FFD133"..getElementData(source,"id").." #FFFFFF" outputChatBox(playerID.." "..nick.. ': #FFFFFF' .. string.gsub(msg,'#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true) exports["psz-admin"]:gameView_add("LOCAL "..string.gsub(getPlayerName(source),"#%x%x%x%x%x%x","").." /"..getElementData(source,"id").." : "..string.gsub(msg,"#%x%x%x%x%x%x","")) triggerClientEvent("onChatIncome", source, msg,type) else local playerID = "#6B6A64"..getElementData(source,"id").." #FFFFFF" outputChatBox(playerID.." "..nick.. ': #FFFFFF' .. string.gsub(msg,'#%x%x%x%x%x%x', ''), getRootElement(), r, g, b, true) exports["psz-admin"]:gameView_add("LOCAL "..string.gsub(getPlayerName(source),"#%x%x%x%x%x%x","").." /"..getElementData(source,"id").." : "..string.gsub(msg,"#%x%x%x%x%x%x","")) triggerClientEvent("onChatIncome", source, msg,type) end end end ) function chat_me(message, messageType) if messageType == 1 then cancelEvent() local character=getElementData(source,"character") if (not character) then outputChatBox("Najpierw zaloguj się/poczekaj aż pobierze się serwer.", source, 255,0,0,true) cancelEvent() return end if getElementData(source,"player:muted") then outputChatBox("Posiadasz wyciszenie, nie możesz nic napisać.",source) return end if getElementData(source,"kary:blokada_aj") then outputChatBox("Posiadasz nałożony AJ, nie możesz nic napisać.",source) return end if meTime[source] and meTime[source] + tonumber(1000) > getTickCount() then outputChatBox("Powtarzasz się...", source, 255, 0, 0) return else meTime[source] = getTickCount() end if lastMeMessage[source] and lastMeMessage[source] == message then outputChatBox("Skończ spamować!", source, 255, 0, 0) return else lastMeMessage[source] = message end local message = usuwajSyfskieEmoty(message) if string.len(message)<1 then return end if message == "()" then return end local x,y,z = getElementPosition(source) local strefa = createColSphere(x,y,z,150) local gracze = getElementsWithinColShape(strefa,"player") local playername = string.gsub(getPlayerName(source),"#%x%x%x%x%x%x","") for i,v in ipairs(gracze) do if (getElementInterior(v) == getElementInterior(source) and getElementDimension(v) == getElementDimension(source)) then outputChatBoxSplitted( " * " .. playername .. " " ..message, v, 223,87,223, true)-- 0x41, 0x69, 0xE1 end end exports["psz-admin"]:gameView_add("LOCAL /ME "..playername.." /"..getElementData(source,"id").." : "..message) destroyElement(strefa) end end addEventHandler("onPlayerChat",getRootElement(),chat_me) function cmd_chatY(plr, cmd, ...) local msg = table.concat(arg, " ") if (not isPlayerInFraction(plr)) then outputChatBox("Nie masz przy sobie krótkofalówki.", plr) return end local fr = getElementData(plr, "faction:data") if (not fr.id) then outputChatBox("Krótkofalówka nie działa.",plr) return end fid=tonumber(fr.id) if getElementData(plr,"kary:blokada_aj") then outputChatBox("Posiadasz nałożony AJ, nie możesz nic napisać.",plr) return end local playername = string.gsub(getPlayerName(plr),"#%x%x%x%x%x%x","") exports['psz-admin']:gameView_add("KF ("..fid..") "..playername.."/"..getPlayerID(plr)..": "..msg) triggerClientEvent(root, "onFractionChatY", resourceRoot, plr, fid, msg) end addCommandHandler("Krótkofalówka", cmd_chatY, false, false) function chat_gang(plr, cmd, ...) local msg=table.concat(arg," ") local gid=getElementData(plr,"character") if (not gid.gg_id) then outputChatBox("Nie należysz do gangu.",plr) return end local character=getElementData(plr,"character") if (not character) then outputChatBox("Najpierw zaloguj się/poczekaj aż pobierze się serwer.", plr, 255,0,0,true) --cancelEvent() return end if getElementData(plr,"kary:blokada_aj") then outputChatBox("Posiadasz nałożony AJ, nie możesz nic napisać.",plr) return end gid=tonumber(gid.gg_id) exports['psz-admin']:gameView_add("CHAT G>"..gid.." "..getPlayerName(plr).."/"..getPlayerID(plr)..": "..msg) triggerClientEvent(root,"onGangChat",resourceRoot,plr,gid,msg) end addCommandHandler("g",chat_gang, false, false) function msgToVIP(text) for i,v in ipairs(getElementsByType("player")) do if (getElementData(v,"vip")) then outputChatBox(text, v,255, 215, 0,true) end end end function chat_v(plr,cmd, ...) local msg = table.concat(arg," ") local vip = getElementData(plr,"vip") if (not vip) then return end local character=getElementData(plr,"character") if (not character) then outputChatBox("Najpierw zaloguj się/poczekaj aż pobierze się serwer.", plr, 255,0,0,true) --cancelEvent() return end if getElementData(plr,"kary:blokada_aj") then outputChatBox("Posiadasz nałożony AJ, nie możesz nic napisać.",plr) return end if string.len(msg) <3 then return end local nick = string.gsub(getPlayerName(plr),"#%x%x%x%x%x%x","") exports['psz-admin']:gameView_add("CHATV "..getPlayerName(plr).."/"..getElementData(plr,"id")..": "..msg) msgToVIP("VIP> #e3d06a"..getElementData(plr,"id").." "..nick..": #FFFFFF"..msg) end addCommandHandler("v",chat_v)
local socket = require "socket" local client = socket.udp() function love.load() client = socket.udp() --make a new socket client:setsockname( "192.168.0.3", 22122 ) --set the socket name to the real IP address client:settimeout( 0 ) continuar = true end function love.update(dt) if continuar then local data, ip, port = client:receivefrom() if data then print(data,ip,port) continuar=false client:close() end end end function love.event.quit() client:close() end
-- Autogenerated from KST: please remove this line if doing any edits by hand! local luaunit = require("luaunit") require("str_encodings_default") TestStrEncodingsDefault = {} function TestStrEncodingsDefault:test_str_encodings_default() local r = StrEncodingsDefault:from_file("src/str_encodings.bin") luaunit.assertEquals(r.str1, "Some ASCII") luaunit.assertEquals(r.rest.str2, "\u{0103}\u{fffd}\u{201c}\u{0103}\u{201a}\u{201c}\u{0103}\u{fffd}\253\u{0103}\u{fffd}\u{02c7}\u{0103}\u{fffd}\u{017b}") luaunit.assertEquals(r.rest.str3, "\u{0103}\u{fffd}\u{201c}\u{0103}\u{201a}\u{201c}\u{0103}\u{fffd}\253\u{0103}\u{fffd}\u{02c7}\u{0103}\u{fffd}\u{017b}") luaunit.assertEquals(r.rest.str4, "\342\u{2013}\u{2018}\342\u{2013}\u{2019}\342\u{2013}\u{201c}") end
--[[ Quest Map by CaptainBlagbird https://github.com/CaptainBlagbird --]] local LMP = LibMapPins local iconRepeatableTexture local iconRepeatableSets = {} for k,v in pairs(QuestMap.icon_sets) do table.insert(iconRepeatableSets, k) end local panelData = { type = "panel", name = QuestMap.displayName, displayName = "|c70C0DE"..QuestMap.displayName.."|r", author = "|c70C0DECaptainBlagbird|r, |cff9b15Sharlikran|r", version = "2.81", slashCommand = "/questmap", --(optional) will register a keybind to open to this panel registerForRefresh = true, --boolean (optional) (will refresh all options controls when a setting is changed and when the panel is shown) registerForDefaults = true, --boolean (optional) (will set all options controls back to default values) resetFunc = function() -- Also reset pin filters. The only thing in the saved variables will be the hidden quests (QuestMap.settings.hiddenQuests) QuestMap.settings.pinFilters = QuestMap.settings_default.pinFilters QuestMap:RefreshPinFilters() end, --function (optional) if registerForDefaults is true, this custom function will run after settings are reset to defaults } local optionsTable = { { type = "dropdown", name = GetString(QUESTMAP_MENU_ICON_SET), choices = iconRepeatableSets, getFunc = function() return QuestMap.settings.iconRepeatableSet end, setFunc = function(value) QuestMap.settings.iconRepeatableSet = value iconRepeatableTexture:SetTexture(QuestMap.icon_sets[QuestMap.settings.iconRepeatableSet]) QuestMap:RefreshPinLayout() end, default = QuestMap.settings_default.iconRepeatableSet, width = "full", }, { type = "slider", name = GetString(QUESTMAP_MENU_PIN_SIZE), tooltip = GetString(QUESTMAP_MENU_PIN_SIZE_TT), min = 5, max = 70, step = 1, getFunc = function() return QuestMap.settings.pinSize end, setFunc = function(value) QuestMap.settings.pinSize = value QuestMap:RefreshPinLayout() end, width = "full", default = QuestMap.settings_default.pinSize, }, { type = "slider", name = GetString(QUESTMAP_MENU_PIN_LVL), tooltip = GetString(QUESTMAP_MENU_PIN_LVL_TT), min = 10, max = 200, step = 1, getFunc = function() return QuestMap.settings.pinLevel end, setFunc = function(value) QuestMap.settings.pinLevel = value QuestMap:RefreshPinLayout() end, width = "full", default = QuestMap.settings_default.pinLevel, }, -- shows message in chat { type = "checkbox", name = GetString(QUESTMAP_MENU_DISP_MSG), tooltip = GetString(QUESTMAP_MENU_DISP_MSG_TT), getFunc = function() return QuestMap.settings.displayClickMsg end, setFunc = function(value) QuestMap.settings.displayClickMsg = value end, default = QuestMap.settings_default.displayClickMsg, width = "full", }, -- toggle option to show suffix { type = "checkbox", name = GetString(QUESTMAP_MENU_SHOW_SUFFIX), tooltip = GetString(QUESTMAP_MENU_SHOW_SUFFIX_TT), getFunc = function() return QuestMap.settings.displaySuffix end, setFunc = function(value) QuestMap.settings.displaySuffix = value QuestMap:RefreshPins() end, default = QuestMap.settings_default.displaySuffix, width = "full", }, -- toggle option to hide pins { type = "checkbox", name = GetString(QUESTMAP_MENU_TOGGLE_HIDDEN_MSG), tooltip = GetString(QUESTMAP_MENU_TOGGLE_HIDDEN_MSG_TT), getFunc = function() return QuestMap.settings.displayHideQuest end, setFunc = function(value) QuestMap.settings.displayHideQuest = value end, default = QuestMap.settings_default.displayHideQuest, width = "full", }, -- toggle option to show quest list when pins are stacked { type = "checkbox", name = GetString(QUESTMAP_MENU_TOGGLE_COMPLETED_MSG), tooltip = GetString(QUESTMAP_MENU_TOGGLE_COMPLETED_MSG_TT), getFunc = function() return QuestMap.settings.displayQuestList end, setFunc = function(value) QuestMap.settings.displayQuestList = value end, default = QuestMap.settings_default.displayQuestList, width = "full", }, -- Uncompleted pins { type = "colorpicker", name = GetString(QUESTMAP_UNCOMPLETED_PIN_COLOR), tooltip = GetString(QUESTMAP_UNCOMPLETED_PIN_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_UNCOMPLETED]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_UNCOMPLETED] = QuestMap.create_color_table(r, g, b, a) QuestMap.pin_color[QuestMap.PIN_TYPE_QUEST_UNCOMPLETED]:SetRGBA(unpack(QuestMap.settings["pin_colors"][QuestMap.PIN_TYPE_QUEST_UNCOMPLETED])) LMP:RefreshPins(QuestMap.PIN_TYPE_QUEST_UNCOMPLETED) end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_colors[QuestMap.PIN_TYPE_QUEST_UNCOMPLETED] ), }, { type = "colorpicker", name = GetString(QUESTMAP_UNCOMPLETED_TOOLTIP_COLOR), tooltip = GetString(QUESTMAP_UNCOMPLETED_TOOLTIP_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_UNCOMPLETED]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_UNCOMPLETED] = QuestMap.create_color_table(r, g, b, a) QuestMap:RefreshPinLayout() end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_UNCOMPLETED] ), }, -- Completed pins { type = "colorpicker", name = GetString(QUESTMAP_COMPLETED_PIN_COLOR), tooltip = GetString(QUESTMAP_COMPLETED_PIN_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_COMPLETED]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_COMPLETED] = QuestMap.create_color_table(r, g, b, a) QuestMap.pin_color[QuestMap.PIN_TYPE_QUEST_COMPLETED]:SetRGBA(unpack(QuestMap.settings["pin_colors"][QuestMap.PIN_TYPE_QUEST_COMPLETED])) LMP:RefreshPins(QuestMap.PIN_TYPE_QUEST_COMPLETED) end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_colors[QuestMap.PIN_TYPE_QUEST_COMPLETED] ), }, { type = "colorpicker", name = GetString(QUESTMAP_COMPLETED_TOOLTIP_COLOR), tooltip = GetString(QUESTMAP_COMPLETED_TOOLTIP_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_COMPLETED]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_COMPLETED] = QuestMap.create_color_table(r, g, b, a) QuestMap:RefreshPinLayout() end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_COMPLETED] ), }, -- Hidden pins { type = "colorpicker", name = GetString(QUESTMAP_HIDDEN_PIN_COLOR), tooltip = GetString(QUESTMAP_HIDDEN_PIN_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_HIDDEN]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_HIDDEN] = QuestMap.create_color_table(r, g, b, a) QuestMap.pin_color[QuestMap.PIN_TYPE_QUEST_HIDDEN]:SetRGBA(unpack(QuestMap.settings["pin_colors"][QuestMap.PIN_TYPE_QUEST_HIDDEN])) LMP:RefreshPins(QuestMap.PIN_TYPE_QUEST_HIDDEN) end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_colors[QuestMap.PIN_TYPE_QUEST_HIDDEN] ), }, { type = "colorpicker", name = GetString(QUESTMAP_HIDDEN_TOOLTIP_COLOR), tooltip = GetString(QUESTMAP_HIDDEN_TOOLTIP_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_HIDDEN]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_HIDDEN] = QuestMap.create_color_table(r, g, b, a) QuestMap:RefreshPinLayout() end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_HIDDEN] ), }, -- Started pins { type = "colorpicker", name = GetString(QUESTMAP_STARTED_PIN_COLOR), tooltip = GetString(QUESTMAP_STARTED_PIN_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_STARTED]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_STARTED] = QuestMap.create_color_table(r, g, b, a) QuestMap.pin_color[QuestMap.PIN_TYPE_QUEST_STARTED]:SetRGBA(unpack(QuestMap.settings["pin_colors"][QuestMap.PIN_TYPE_QUEST_STARTED])) LMP:RefreshPins(QuestMap.PIN_TYPE_QUEST_STARTED) end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_colors[QuestMap.PIN_TYPE_QUEST_STARTED] ), }, { type = "colorpicker", name = GetString(QUESTMAP_STARTED_TOOLTIP_COLOR), tooltip = GetString(QUESTMAP_STARTED_TOOLTIP_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_STARTED]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_STARTED] = QuestMap.create_color_table(r, g, b, a) QuestMap:RefreshPinLayout() end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_STARTED] ), }, -- Repeatable pins { type = "colorpicker", name = GetString(QUESTMAP_REPEATABLE_PIN_COLOR), tooltip = GetString(QUESTMAP_REPEATABLE_PIN_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_REPEATABLE]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_REPEATABLE] = QuestMap.create_color_table(r, g, b, a) QuestMap.pin_color[QuestMap.PIN_TYPE_QUEST_REPEATABLE]:SetRGBA(unpack(QuestMap.settings["pin_colors"][QuestMap.PIN_TYPE_QUEST_REPEATABLE])) LMP:RefreshPins(QuestMap.PIN_TYPE_QUEST_REPEATABLE) end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_colors[QuestMap.PIN_TYPE_QUEST_REPEATABLE] ), }, { type = "colorpicker", name = GetString(QUESTMAP_REPEATABLE_TOOLTIP_COLOR), tooltip = GetString(QUESTMAP_REPEATABLE_TOOLTIP_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_REPEATABLE]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_REPEATABLE] = QuestMap.create_color_table(r, g, b, a) QuestMap:RefreshPinLayout() end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_REPEATABLE] ), }, -- Daily pins { type = "colorpicker", name = GetString(QUESTMAP_DAILY_PIN_COLOR), tooltip = GetString(QUESTMAP_DAILY_PIN_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_DAILY]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_DAILY] = QuestMap.create_color_table(r, g, b, a) QuestMap.pin_color[QuestMap.PIN_TYPE_QUEST_DAILY]:SetRGBA(unpack(QuestMap.settings["pin_colors"][QuestMap.PIN_TYPE_QUEST_DAILY])) LMP:RefreshPins(QuestMap.PIN_TYPE_QUEST_DAILY) end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_colors[QuestMap.PIN_TYPE_QUEST_DAILY] ), }, { type = "colorpicker", name = GetString(QUESTMAP_DAILY_TOOLTIP_COLOR), tooltip = GetString(QUESTMAP_DAILY_TOOLTIP_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_DAILY]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_DAILY] = QuestMap.create_color_table(r, g, b, a) QuestMap:RefreshPinLayout() end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_DAILY] ), }, -- Cadwell pins { type = "colorpicker", name = GetString(QUESTMAP_CADWELL_PIN_COLOR), tooltip = GetString(QUESTMAP_CADWELL_PIN_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_CADWELL]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_CADWELL] = QuestMap.create_color_table(r, g, b, a) QuestMap.pin_color[QuestMap.PIN_TYPE_QUEST_CADWELL]:SetRGBA(unpack(QuestMap.settings["pin_colors"][QuestMap.PIN_TYPE_QUEST_CADWELL])) LMP:RefreshPins(QuestMap.PIN_TYPE_QUEST_CADWELL) end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_colors[QuestMap.PIN_TYPE_QUEST_CADWELL] ), }, { type = "colorpicker", name = GetString(QUESTMAP_CADWELL_TOOLTIP_COLOR), tooltip = GetString(QUESTMAP_CADWELL_TOOLTIP_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_CADWELL]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_CADWELL] = QuestMap.create_color_table(r, g, b, a) QuestMap:RefreshPinLayout() end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_CADWELL] ), }, -- Skill pins { type = "colorpicker", name = GetString(QUESTMAP_SKILL_PIN_COLOR), tooltip = GetString(QUESTMAP_SKILL_PIN_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_SKILL]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_colors[QuestMap.PIN_TYPE_QUEST_SKILL] = QuestMap.create_color_table(r, g, b, a) QuestMap.pin_color[QuestMap.PIN_TYPE_QUEST_SKILL]:SetRGBA(unpack(QuestMap.settings["pin_colors"][QuestMap.PIN_TYPE_QUEST_SKILL])) LMP:RefreshPins(QuestMap.PIN_TYPE_QUEST_SKILL) end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_colors[QuestMap.PIN_TYPE_QUEST_SKILL] ), }, { type = "colorpicker", name = GetString(QUESTMAP_SKILL_TOOLTIP_COLOR), tooltip = GetString(QUESTMAP_SKILL_TOOLTIP_COLOR_DESC), getFunc = function() return unpack(QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_SKILL]) end, setFunc = function(r,g,b,a) QuestMap.settings.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_SKILL] = QuestMap.create_color_table(r, g, b, a) QuestMap:RefreshPinLayout() end, default = QuestMap.create_color_table_rbga( QuestMap.settings_default.pin_tooltip_colors[QuestMap.PIN_TYPE_QUEST_SKILL] ), }, { type = "header", name = "", width = "full", }, { type = "description", title = GetString(QUESTMAP_MENU_HIDDEN_QUESTS_T), text = GetString(QUESTMAP_MENU_HIDDEN_QUESTS_1), width = "full", }, { type = "description", title = "", text = GetString(QUESTMAP_MENU_HIDDEN_QUESTS_2), width = "full", }, { type = "description", title = "", text = GetString(QUESTMAP_MENU_HIDDEN_QUESTS_B), width = "half", }, { type = "button", name = GetString(QUESTMAP_MENU_RESET_HIDDEN), tooltip = GetString(QUESTMAP_MENU_RESET_HIDDEN_TT), func = function() QuestMap.settings.hiddenQuests = {} QuestMap:RefreshPinLayout() end, width = "half", warning = GetString(QUESTMAP_MENU_RESET_HIDDEN_W), }, { type = "description", title = "", text = GetString(QUESTMAP_MENU_RESET_NOTE), width = "full", }, } -- Create texture on first load of the Better Rally LAM panel local function CreateTexture(panel) if panel == WINDOW_MANAGER:GetControlByName(QuestMap.idName, "_Options") then -- Create texture control iconRepeatableTexture = WINDOW_MANAGER:CreateControl(QuestMap.idName.."_Options_RepeatableTexture", panel.controlsToRefresh[1], CT_TEXTURE) iconRepeatableTexture:SetAnchor(CENTER, panel.controlsToRefresh[1].dropdown:GetControl(), LEFT, -30, 0) iconRepeatableTexture:SetTexture(QuestMap.icon_sets[QuestMap.settings.iconRepeatableSet]) iconRepeatableTexture:SetDimensions(28, 28) CALLBACK_MANAGER:UnregisterCallback("LAM-PanelControlsCreated", CreateTexture) end end CALLBACK_MANAGER:RegisterCallback("LAM-PanelControlsCreated", CreateTexture) -- Wait until all addons are loaded local function OnPlayerActivated(event) local LAM = LibAddonMenu2 if LAM ~= nil then LAM:RegisterAddonPanel(QuestMap.idName.."_Options", panelData) LAM:RegisterOptionControls(QuestMap.idName.."_Options", optionsTable) end EVENT_MANAGER:UnregisterForEvent(QuestMap.idName.."_Options", EVENT_PLAYER_ACTIVATED) end EVENT_MANAGER:RegisterForEvent(QuestMap.idName.."_Options", EVENT_PLAYER_ACTIVATED, OnPlayerActivated)
uller = Creature:new { customName = "uller", randomNameType = NAME_GENERIC, randomNameTag = true, socialGroup = "townsperson", faction = "townsperson", level = 11, chanceHit = 0.28, damageMin = 90, damageMax = 110, baseXp = 514, baseHAM = 810, baseHAMmax = 990, armor = 0, resists = {10,5,0,0,0,0,0,-1,-1}, meatType = "", meatAmount = 0, hideType = "", hideAmount = 0, boneType = "", boneAmount = 0, milk = 0, tamingChance = 0, ferocity = 0, pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY, creatureBitmask = KILLER + STALKER, optionsBitmask = AIENABLED, diet = HERBIVORE, templates = {"object/mobile/uller.iff"}, lootGroups = {}, weapons = {}, conversationTemplate = "", attacks = { } } CreatureTemplates:addCreatureTemplate(uller, "uller")
if SERVER then AddCSLuaFile("shared.lua") end if CLIENT then SWEP.ViewModelFlip = true SWEP.PrintName = "USP Compact" SWEP.IconLetter = "a" SWEP.Slot = 2 SWEP.Slotpos = 2 end SWEP.HoldType = "pistol" SWEP.Base = "rad_base" SWEP.ViewModel = "models/weapons/v_pist_usp.mdl" SWEP.WorldModel = "models/weapons/w_pistol.mdl" SWEP.SprintPos = Vector (0.4776, 0.446, 3.1631) SWEP.SprintAng = Vector (-15.3501, -1.3761, -1.5457) SWEP.IsSniper = false SWEP.AmmoType = "Pistol" SWEP.Primary.Sound = Sound( "Weapon_USP.Single" ) SWEP.Primary.Recoil = 5.5 SWEP.Primary.Damage = 30 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.040 SWEP.Primary.Delay = 0.150 SWEP.Primary.ClipSize = 12 SWEP.Primary.Automatic = false
Loot.Window = function(config, callback) -- callback = function(newConfig) config = config or {} local window = UI.createWindow('LootWindow') local values = {} -- (key, function returning value of key) window.name:setText(config.name or "") table.insert(values, {"name", function() return window.name:getText() end}) local addScrollBar = function(id, title, min, max, defaultValue) local widget = UI.createWidget('LootWindowScrollBar', window.content.left) widget.scroll.onValueChange = function(scroll, value) widget.text:setText(title .. ": " .. value) end widget.scroll:setRange(min, max) if max-min > 1000 then widget.scroll:setStep(100) elseif max-min > 100 then widget.scroll:setStep(10) end widget.scroll:setValue(config[id] or defaultValue) widget.scroll.onValueChange(widget.scroll, widget.scroll:getValue()) table.insert(values, {id, function() return widget.scroll:getValue() end}) end local addTextEdit = function(id, title, defaultValue) local widget = UI.createWidget('LootWindowTextEdit', window.content.right) widget.text:setText(title) widget.textEdit:setText(config[id] or defaultValue or "") table.insert(values, {id, function() return widget.textEdit:getText() end}) end local addCheckBox = function(id, title, defaultValue) local widget = UI.createWidget('LootWindowCheckBox', window.content.right) widget.onClick = function() widget:setOn(not widget:isOn()) end widget:setText(title) if config[id] == nil then widget:setOn(defaultValue) else widget:setOn(config[id]) end table.insert(values, {id, function() return widget:isOn() end}) end local addItem = function(id, title, defaultItem) local widget = UI.createWidget('LootWindowItem', window.content.right) widget.text:setText(title) widget.item:setItemId(config[id] or defaultItem) table.insert(values, {id, function() return widget.item:getItemId() end}) end window.cancel.onClick = function() Loot:destroy() end window.onEscape = window.cancel.onClick window.ok.onClick = function() local newConfig = {} for _, value in ipairs(values) do newConfig[value[1]] = value[2]() end if newConfig.name:len() < 1 then return end newConfig.regex = "" for part in string.gmatch(newConfig.name, "[^,]+") do if newConfig.regex:len() > 0 then newConfig.regex = newConfig.regex .. "|" end newConfig.regex = newConfig.regex .. "^" .. part:trim():lower():gsub("%*", ".*"):gsub("%?", ".?") .. "$" end Loot:destroy() callback(newConfig) end -- values addScrollBar("scrollBar", "scrollBar", 0, 3000, 200) addCheckBox("checkBox", "checkBox", true) addTextEdit("textEdit", "textEdit", "") addItem("item", "item:", 0) end
nibRealUICharacter = nil
local media = require 'media' local Game = require 'game' require 'gamestates.play' local game function love.load() media.load() love.graphics.setBackgroundColor(9, 46, 78) game = Game:new() end -- Updating function love.update(dt) media.cleanup() game:update(dt) end -- Drawing function love.draw() game:draw() end function love.keypressed(k) game:keypressed(k) end
---@class CS.UnityEngine.LightmapSettings : CS.UnityEngine.Object ---@field public lightmaps LightmapData[] ---@field public lightmapsMode number ---@field public lightProbes CS.UnityEngine.LightProbes ---@type CS.UnityEngine.LightmapSettings CS.UnityEngine.LightmapSettings = { } return CS.UnityEngine.LightmapSettings
--测试lua接收到的oc传入的参数 local crash = function (message) -- body print("program crash") print(message) os.exit(1) end --这里的assert好像不能检测错误 _G.TestForwardArgument_checkInt = function (className,i) -- body -- assert(i == 1,"TestForwardArgument_checkInt error") if i ~= 1 then crash("TestForwardArgument_checkInt error") end return i end _G.TestForwardArgument_checkDouble = function (className,i) -- body -- assert(i == 1.1,"TestForwardArgument_checkDouble error") if i ~= 1.1 then crash("TestForwardArgument_checkDouble error") end return i end _G.TestForwardArgument_checkId = function (className,i) -- body -- assert(i.isKindOfClass(require("luapatch").packClass("NSDictionary").class()) == 1,"TestForwardArgument_checkId error") if i.isKindOfClass(require("luapatch").packClass("NSDictionary").class()) ~= 1 then crash("TestForwardArgument_checkId error") end return i end _G.TestForwardArgument_checkSEL = function (className,i) -- body -- assert(i == "checkSEL:","TestForwardArgument_checkSEL error") print("call TestForwardArgument_checkSEL in lua") if i ~= "checkSEL:" then crash("TestForwardArgument_checkSEL error") end return i end _G.TestForwardArgument_checkPoint = function (className,i) -- body -- assert(require("luapatch").convertUserDataToStr(i) == "hello world","TestForwardArgument_checkPoint error") if require("luapatch").convertUserDataToStr(i) ~= "hello world" then crash("TestForwardArgument_checkPoint error") end return i end _G.TestForwardArgument_checkClass = function (className,i) -- body local luapatch = require("luapatch") -- assert(luapatch.unpackPoint(i) == luapatch.unpackPoint(luapatch.packClass("NSDictionary").class()),"TestForwardArgument_checkClass error") if luapatch.unpackPoint(i) ~= luapatch.unpackPoint(luapatch.packClass("NSDictionary").class()) then crash("TestForwardArgument_checkClass error") end return i end _G.TestForwardArgument_checkNum = function (className,i) -- body -- assert(i == 1,"TestForwardArgument_checkNum error") if i ~= 1 then crash("TestForwardArgument_checkNum error") end return i end _G.TestForwardArgument_checkStr = function (className,i) -- body -- assert(i == "hello world","TestForwardArgument_checkStr error") if i ~= "hello world" then crash("TestForwardArgument_checkStr error") end return i end -- expose("expose lua function") describe("test forward argument",function( ... ) -- body local luapatch = require("luapatch") it("start test forward argument",function ( ... ) -- body luapatch.redefineClassMethod("TestForwardArgument","checkInt:","TestForwardArgument_checkInt") luapatch.redefineClassMethod("TestForwardArgument","checkDouble:","TestForwardArgument_checkDouble") luapatch.redefineClassMethod("TestForwardArgument","checkId:","TestForwardArgument_checkId") luapatch.redefineClassMethod("TestForwardArgument","checkSEL:","TestForwardArgument_checkSEL") luapatch.redefineClassMethod("TestForwardArgument","checkPoint:","TestForwardArgument_checkPoint") luapatch.redefineClassMethod("TestForwardArgument","checkClass:","TestForwardArgument_checkClass") luapatch.redefineClassMethod("TestForwardArgument","checkNum:","TestForwardArgument_checkNum") luapatch.redefineClassMethod("TestForwardArgument","checkStr:","TestForwardArgument_checkStr") local TestForwardArgument = luapatch.packClass("TestForwardArgument") TestForwardArgument.startCheckArgument() end) end)
local access = require "kong.plugins.kong-path-based-routing.access" KongPathBasedRoutingHandler = {} KongPathBasedRoutingHandler.PRIORITY = 10 KongPathBasedRoutingHandler.VERSION = "2.0.0" function KongPathBasedRoutingHandler:access(conf) access.execute(conf) end return KongPathBasedRoutingHandler
NodeTreeEditor = GuiElement:extend("NodeTreeEditor"); function NodeTreeEditor:init(parent, name, x, y, tree) NodeTreeEditor.super.init(self, parent, name, x, y); self.tree = tree; self.texts = {}; self.selected = -1; self.selected_node = {}; self.inspector = nil; self.w = 100; self.h = 100; self.tx = 0; self.ty = 0; self.ii = 0; if tree then --self.texts = self:create_tree_text(); self:collapse(tree); end end -- Rectangular stencil used to draw the text local rect_stencil = function() local ww, hh = lg.getWidth(), lg.getHeight(); love.graphics.rectangle("fill", 0, 0, 100, 100 ) end function NodeTreeEditor:collapse(t) for i, v in ipairs(t.children) do v.collapsed = true; self:collapse(v); end end function NodeTreeEditor:select(v) print("found selected node", v.name); self.selected_node = v v.collapsed = false; if self.inspector then print("reloading inspector"); self.inspector:reload_selected(); end end function NodeTreeEditor:_resolve_selected(n) --self.ii = self.ii or 0; if n.collapsed then return false; end for i, v in ipairs(n.children) do print(self.ii, v.name); self.ii = self.ii + 1; if self.ii >= self.selected then --[[print("found selected node", v.name); self.selected_node = v v.collapsed = false;]] self:select(v); return true; else if self:_resolve_selected(v) then return true; end end end end function NodeTreeEditor:resolve_selected() self.ii = 0; if self.selected == 0 then --[[print("found selected node", self.tree.name); self.selected_node = self.tree self.tree.collapsed = false;]] self:select(self.tree); else self:_resolve_selected(self.tree); end end -- Draws the name of a node in the scene tree -- TODO: Optimize it so it only draws an approximate of the -- names that can be seen, instead of stenciling the whole list. -- TODO: Modify love.mouse.isDown so it works on phone (?) function NodeTreeEditor:draw_node(s, d, yy) local sk = self:get_skin(); love.graphics.setColor(sk.font_color); love.graphics.print(s.name, ((d-1)*16)+8, yy); --love.graphics.setColor( sk:get_clickable_color( self.tx+(((d-1)*16)-8), self.ty+yy, 8, 16) ); if math.pointraw(love.mouse.getX(), love.mouse.getY(), self:get_x()+(((d-1)*16)-8)-self.tx, self:get_y()+yy-self.ty, 8, 16) then love.graphics.setColor(sk.highlight_color); else love.graphics.setColor(sk.shighlight_color); end love.graphics.rectangle("fill", (((d-1)*16)-8), yy, 8, 16); if not s.collapsed then for i, v in ipairs(s.children) do yy = yy + 16; yy = self:draw_node(v, d+1, yy) end end return yy; end function NodeTreeEditor:draw() local sk = self:get_skin(); love.graphics.setColor(sk.default_color); love.graphics.rectangle( "fill", self:get_x(), self:get_y(), self.w, self.h ); love.graphics.push(); love.graphics.translate( self:get_x(), self:get_y() ); love.graphics.stencil(rect_stencil, "replace", 1); love.graphics.setStencilTest("greater", 0); love.graphics.translate( 0,-self.ty ); love.graphics.setColor(sk.highlight_color); love.graphics.rectangle( "fill", 0, self.selected*16, self.w, 16 ); love.graphics.setColor(sk.font_color); self:draw_node(self.tree, 1, 0); love.graphics.setStencilTest(); love.graphics.pop(); love.graphics.setColor( 1,1,1,1 ); end function NodeTreeEditor:mousepressed(x, y, b) if math.pointraw(x, y, self:get_x(), self:get_y(), self.w, self.h) then local cy = y-(self:get_y())+self.ty self.selected = math.floor(cy/16); self:resolve_selected(); end end function NodeTreeEditor:wheelmoved(mx, my) if math.pointraw(love.mouse.getX(), love.mouse.getY(), self:get_x(), self:get_y(), self.w, self.h) then self.ty = math.clamp( 0, self.ty-(my*10), self.tree.childs*16 ); end end return NodeTreeEditor
data.raw.gun["rocket-launcher"].attack_parameters.range = 50
-- OptimisticSide local Players = game:GetService("Players") local Package = script.Parent local Formatter = require(Package.Formatter) local Http = require(Package.Http) local API = require(Package.API) local Item = require(Package.Item) local Player = { } Player.__index = Player function Player:GetData() => table return API.GetData("Player", self.Id) end function Player:UpdateData() => nil local NewData = self:GetData() for Name, Element in pairs(NewData) do self[Name] = Element end end function Player.new(UserId) => table if typeof(UserId) == "string" then UserId = Players:GetUserIdFromNameAsync(UserId) end local self = setmetatable({ }, Player) self.Id = UserId self:UpdateData() return self end return Player
-- Load configuration options up front ScriptHost:LoadScript("scripts/settings.lua") Tracker:AddMaps("maps/maps.json") Tracker:AddItems("items/common.json") Tracker:AddLayouts("layouts/tracker.json") Tracker:AddLayouts("layouts/tracker_broadcast.json") Tracker:AddLocations("locations/rooms.json")
local Prop = {} Prop.Name = "City Apartment 104" Prop.Cat = "Apartments" Prop.Price = 750 Prop.Doors = { Vector( -11104.5, 12201, 675.21002197266 ), Vector( -11431.5, 12333, 675.21002197266 ), Vector( -11432.900390625, 12453, 675.21002197266 ), } GM.Property:Register( Prop )
melody.fg = Def.ActorFrame {} local t = melody.fg t[#t+1] = Def.Quad { InitCommand=melody(function(self) function am_bl(mult) return (GAMESTATE:GetCurBPS()) * (mult or 1) end init_hooks{'mods init',function() -- lua{'fg/mods', env=modreader.jaezmien} end} end) } -- Foreground actors here -- t[#t+1] = Def.ActorFrame { Name="Judgments", Def.ActorProxy { Name="P1 Judgment", InitializeProxiesMessageCommand=melody(function(self) proxy.create_proxy( self, jud1, 'P1 Judgment' ) self:zoom( 0.7 ) self:xy( mod_plr_origin[1][1] , mod_plr_origin[1][2] ) jud1:hidden(1) jud1:sleep(9E9) end) }, Def.ActorProxy { Name="P1 Combo", InitializeProxiesMessageCommand=melody(function(self) proxy.create_proxy( self, com1, 'P1 Combo' ) self:zoom( 0.7 ) self:xy( mod_plr_origin[1][1] , mod_plr_origin[1][2] ) com1:hidden(1) com1:sleep(9E9) end) }, Def.ActorProxy { Name="P2 Judgment", InitializeProxiesMessageCommand=melody(function(self) proxy.create_proxy( self, jud2, 'P2 Judgment' ) self:zoom( 0.7 ) self:xy( mod_plr_origin[2][1] , mod_plr_origin[2][2] ) jud1:hidden(1) jud1:sleep(9E9) end) }, Def.ActorProxy { Name="P2 Combo", InitializeProxiesMessageCommand=melody(function(self) proxy.create_proxy( self, com2, 'P2 Combo' ) self:zoom( 0.7 ) self:xy( mod_plr_origin[2][1] , mod_plr_origin[2][2] ) com1:hidden(1) com1:sleep(9E9) end) } } return t
function convertnumbers(numbers) local _numbers = {} for i = 0, 9, 1 do for innerKey, value in pairs(numbers[i]) do table.insert(_numbers, value) end end return _numbers end function getMaxVal(toSort) local maxVal = 0 for key, value in pairs(toSort) do if (value > maxVal) then maxVal = value end end return maxVal end function sort(toSort, divisor, maxDivisor) local numbers = {} for i = 0, 9, 1 do numbers[i] = {} --initialize every list end for key, value in pairs(toSort) do local digit = math.floor((value / divisor)) % 10 print(digit) table.insert(numbers[digit], value) end local newlist = convertnumbers(numbers) if (divisor == maxDivisor) then return newlist end return sort(newlist, divisor * 10, maxDivisor) end function RadixSort(toSort) local maxVal = getMaxVal(toSort) maxVal = tostring(maxVal) local maxLen = #maxVal local maxDivisor = 10^(maxLen-1) print(maxDivisor) return sort(toSort, 1, maxDivisor) end unsortedList = { 123, 435, 456, 456, 456,234, 567, 876, 234, 2345, 5865, 1234, 23534262, 2342, 3125, 36243, 546 } result = RadixSort(unsortedList) print(table.concat(result, ", "))
------------------------------------------------------------------------------ -- Encoding of ANSI color escape sequences ------------------------------------------------------------------------------ local codes = { -- attributes reset = 0, clear = 0, bold = 1, bright = 1, dim = 2, underline = 4, blink = 5, reverse = 7, hidden = 8, -- foreground black = 30, red = 31, green = 32, yellow = 33, blue = 34, magenta = 35, cyan = 36, white = 37, -- background onblack = 40, onred = 41, ongreen = 42, onyellow = 43, onblue = 44, onmagenta = 45, oncyan = 46, onwhite = 47, } -- given a string such as 'reset;red;onblack' returns a escape sequence local str_gsub = string.gsub local function encode(seq) return '\27[' .. str_gsub(seq, '([^;]+)', codes) .. 'm' end -- colors are disabled by default; use set_enabled() local enabled = false local function set_enabled(v) enabled = v end -- =encode(seq) if colors are enabled; otherwise returns empty string local function ESC(seq) if enabled then return encode(seq) end return '' end -- =encode(seq) if colors are enabled; otherwise returns nil local function esc(seq) if enabled then return encode(seq) end return nil end -- encodes an escape sequence based on a style table like {fg='red', -- bg='black', bold=true} etc. Returns an empty string if not enabled. local function from_style(t) if not enabled then return '' end local seq = '' for k, v in pairs(t) do local c = codes[k] ; if c and v then seq = seq .. ';' .. c end end local c = codes[t.fg] if c then seq = seq .. ';' .. c end c = codes[t.bg] if c then seq = seq .. ';' .. c + 10 end return '\27[0'..seq..'m' end ------------------------------------------------------------------------------ -- Module Table ------------------------------------------------------------------------------ local M = { encode = encode, ESC = ESC, esc = esc, from_style = from_style, set_enabled = set_enabled, } return M
------------------------------------------------- -- ToDo Widget for Awesome Window Manager -- More details could be found here: -- https://github.com/streetturtle/awesome-wm-widgets/tree/master/todo-widget -- @author Pavel Makhov -- @copyright 2020 Pavel Makhov ------------------------------------------------- local awful = require("awful") local wibox = require("wibox") local json = require("json") local spawn = require("awful.spawn") local gears = require("gears") local beautiful = require("beautiful") local gfs = require("gears.filesystem") local HOME_DIR = os.getenv("HOME") local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/todo-widget' local STORAGE = HOME_DIR .. '/.cache/awmw/todo-widget/todos.json' local GET_TODO_ITEMS = 'bash -c "cat ' .. STORAGE .. '"' local rows = { layout = wibox.layout.fixed.vertical } local todo_widget = {} local update_widget todo_widget.widget = wibox.widget { { { { { id = "icon", forced_height = 16, forced_width = 16, widget = wibox.widget.imagebox }, valign = 'center', layout = wibox.container.place }, { id = "txt", widget = wibox.widget.textbox }, spacing = 4, layout = wibox.layout.fixed.horizontal, }, margins = 4, layout = wibox.container.margin }, shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, 4) end, widget = wibox.container.background, set_text = function(self, new_value) self:get_children_by_id("txt")[1].text = new_value end, set_icon = function(self, new_value) self:get_children_by_id("icon")[1].image = new_value end } function todo_widget:update_counter(todos) local todo_count = 0 for _,p in ipairs(todos) do if not p.status then todo_count = todo_count + 1 end end todo_widget.widget:set_text(todo_count) end local popup = awful.popup{ bg = beautiful.bg_normal, ontop = true, visible = false, shape = gears.shape.rounded_rect, border_width = 1, border_color = beautiful.bg_focus, maximum_width = 700, offset = { y = 5 }, widget = {} } local add_button = wibox.widget { { { image = WIDGET_DIR .. '/list-add-symbolic.svg', resize = false, widget = wibox.widget.imagebox }, top = 11, left = 8, right = 8, layout = wibox.container.margin }, shape = function(cr, width, height) gears.shape.circle(cr, width, height, 12) end, widget = wibox.container.background } add_button:connect_signal("button::press", function() local pr = awful.widget.prompt() table.insert(rows, wibox.widget { { { pr.widget, spacing = 8, layout = wibox.layout.align.horizontal }, margins = 8, layout = wibox.container.margin }, bg = beautiful.bg_normal, widget = wibox.container.background }) awful.prompt.run{ prompt = "<b>New item</b>: ", bg = beautiful.bg_normal, bg_cursor = beautiful.fg_urgent, textbox = pr.widget, exe_callback = function(input_text) if not input_text or #input_text == 0 then return end spawn.easy_async(GET_TODO_ITEMS, function(stdout) local res = json.decode(stdout) table.insert(res.todo_items, {todo_item = input_text, status = false}) spawn.easy_async_with_shell("echo '" .. json.encode(res) .. "' > " .. STORAGE, function() spawn.easy_async(GET_TODO_ITEMS, function(items) update_widget(items) end) end) end) end } popup:setup(rows) end) add_button:connect_signal("mouse::enter", function(c) c:set_bg(beautiful.bg_focus) end) add_button:connect_signal("mouse::leave", function(c) c:set_bg(beautiful.bg_normal) end) local function worker(user_args) local args = user_args or {} local icon = args.icon or WIDGET_DIR .. '/checkbox-checked-symbolic.svg' todo_widget.widget:set_icon(icon) function update_widget(stdout) local result = json.decode(stdout) if result == nil or result == '' then result = {} end todo_widget:update_counter(result.todo_items) for i = 0, #rows do rows[i]=nil end local first_row = wibox.widget { { {widget = wibox.widget.textbox}, { markup = '<span size="large" font_weight="bold" color="#ffffff">ToDo</span>', align = 'center', forced_width = 550, -- for horizontal alignment forced_height = 40, widget = wibox.widget.textbox }, add_button, spacing = 8, layout = wibox.layout.fixed.horizontal }, bg = beautiful.bg_normal, widget = wibox.container.background } table.insert(rows, first_row) for i, todo_item in ipairs(result.todo_items) do local checkbox = wibox.widget { checked = todo_item.status, color = beautiful.bg_normal, paddings = 2, shape = gears.shape.circle, forced_width = 20, forced_height = 20, check_color = beautiful.fg_urgent, widget = wibox.widget.checkbox } checkbox:connect_signal("button::press", function(c) c:set_checked(not c.checked) todo_item.status = not todo_item.status result.todo_items[i] = todo_item spawn.easy_async_with_shell("echo '" .. json.encode(result) .. "' > " .. STORAGE, function () todo_widget:update_counter(result.todo_items) end) end) local trash_button = wibox.widget { { { image = WIDGET_DIR .. '/window-close-symbolic.svg', resize = false, widget = wibox.widget.imagebox }, margins = 5, layout = wibox.container.margin }, border_width = 1, shape = function(cr, width, height) gears.shape.circle(cr, width, height, 10) end, widget = wibox.container.background } trash_button:connect_signal("button::press", function() table.remove(result.todo_items, i) spawn.easy_async_with_shell("printf '" .. json.encode(result) .. "' > " .. STORAGE, function () spawn.easy_async(GET_TODO_ITEMS, function(items) update_widget(items) end) end) end) local move_up = wibox.widget { image = WIDGET_DIR .. '/chevron-up.svg', resize = false, widget = wibox.widget.imagebox } move_up:connect_signal("button::press", function() local temp = result.todo_items[i] result.todo_items[i] = result.todo_items[i-1] result.todo_items[i-1] = temp spawn.easy_async_with_shell("printf '" .. json.encode(result) .. "' > " .. STORAGE, function () spawn.easy_async(GET_TODO_ITEMS, function(items) update_widget(items) end) end) end) local move_down = wibox.widget { image = WIDGET_DIR .. '/chevron-down.svg', resize = false, widget = wibox.widget.imagebox } move_down:connect_signal("button::press", function() local temp = result.todo_items[i] result.todo_items[i] = result.todo_items[i+1] result.todo_items[i+1] = temp spawn.easy_async_with_shell("printf '" .. json.encode(result) .. "' > " .. STORAGE, function () spawn.easy_async(GET_TODO_ITEMS, function(items) update_widget(items) end) end) end) local move_buttons = { layout = wibox.layout.fixed.vertical } if i == 1 and #result.todo_items > 1 then table.insert(move_buttons, move_down) elseif i == #result.todo_items and #result.todo_items > 1 then table.insert(move_buttons, move_up) elseif #result.todo_items > 1 then table.insert(move_buttons, move_up) table.insert(move_buttons, move_down) end local row = wibox.widget { { { { checkbox, valign = 'center', layout = wibox.container.place, }, { { text = todo_item.todo_item, align = 'left', widget = wibox.widget.textbox }, left = 10, layout = wibox.container.margin }, { { move_buttons, valign = 'center', layout = wibox.container.place, }, { trash_button, valign = 'center', layout = wibox.container.place, }, spacing = 8, layout = wibox.layout.align.horizontal }, spacing = 8, layout = wibox.layout.align.horizontal }, margins = 8, layout = wibox.container.margin }, bg = beautiful.bg_normal, widget = wibox.container.background } row:connect_signal("mouse::enter", function(c) c:set_bg(beautiful.bg_focus) end) row:connect_signal("mouse::leave", function(c) c:set_bg(beautiful.bg_normal) end) table.insert(rows, row) end popup:setup(rows) end todo_widget.widget:buttons( gears.table.join( awful.button({}, 1, function() if popup.visible then todo_widget.widget:set_bg('#00000000') popup.visible = not popup.visible else todo_widget.widget:set_bg(beautiful.bg_focus) popup:move_next_to(mouse.current_widget_geometry) end end) ) ) spawn.easy_async(GET_TODO_ITEMS, function(stdout) update_widget(stdout) end) return todo_widget.widget end if not gfs.file_readable(STORAGE) then spawn.easy_async(string.format([[bash -c "dirname %s | xargs mkdir -p && echo '{\"todo_items\":{}}' > %s"]], STORAGE, STORAGE)) end return setmetatable(todo_widget, { __call = function(_, ...) return worker(...) end })
local cjson = require "cjson" local _M = {} --[[local function get_content_type(content_type) if content_type == nil then return end if string.find(content_type:lower(), "application/json", nil, true) then return JSON elseif string.find(content_type:lower(), "multipart/form-data", nil, true) then return MULTI elseif string.find(content_type:lower(), "application/x-www-form-urlencoded", nil, true) then return ENCODED end end ]] local function set (list) local set = {} for _, l in ipairs(list) do set[l] = true end return set end local function obfuscate_entry(key, value, keys_to_obfuscate, mask) if not keys_to_obfuscate then return end local type = type(value) if type ~= 'table' then -- io.write(key, '=', value, '\n') return keys_to_obfuscate[key] ~= nil else -- io.write(key == nil and 'root' or key, ' content:\n') end for k, v in pairs(value) do local should_be_obfuscated = obfuscate_entry(k, v, keys_to_obfuscate, mask) if should_be_obfuscated then value[k] = mask end end end function _M.obfuscate(json_string, keys_to_obfuscate, mask) local response = _M.obfuscate_return_table(json_string, keys_to_obfuscate, mask) return cjson.encode(response) end function _M.obfuscate_return_table(json_string, keys_to_obfuscate, mask) local json_object = cjson.decode(json_string) if keys_to_obfuscate == nil or #keys_to_obfuscate == 0 then return json_object end obfuscate_entry(nil, json_object, set(keys_to_obfuscate), mask) return json_object end return _M
ogre_tank_boss_jump_smash = class( AbilityBaseClass ) LinkLuaModifier( "modifier_ogre_tank_melee_smash_thinker", "modifiers/modifier_ogre_tank_melee_smash_thinker.lua", LUA_MODIFIER_MOTION_NONE ) ----------------------------------------------------------------------------- function ogre_tank_boss_jump_smash:ProcsMagicStick() return false end ----------------------------------------------------------------------------- function ogre_tank_boss_jump_smash:GetPlaybackRateOverride() return self:GetSpecialValueFor("jump_speed") / 1.5 -- 0.9 for 1.8, 0.7 for 1.5 end ----------------------------------------------------------------------------- function ogre_tank_boss_jump_smash:OnSpellStart() if IsServer() then local hThinker = CreateModifierThinker( self:GetCaster(), self, "modifier_ogre_tank_melee_smash_thinker", { duration = self:GetSpecialValueFor( "jump_speed") }, self:GetCaster():GetOrigin(), self:GetCaster():GetTeamNumber(), false ) end end -----------------------------------------------------------------------------
local M = {} local home = os.getenv("HOME") local disabled_worksapce_path = home .. "/.config/nvim/format_disabled_dirs.txt" local disabled_worksapce_file = io.open(disabled_worksapce_path, "r") local disabled_worksapce = {} if disabled_worksapce_file ~= nil then for line in disabled_worksapce_file:lines() do local str = line:gsub("%s+", "") table.insert(disabled_worksapce, str) end end local format_on_save = true vim.api.nvim_create_user_command("FormatToggle", function() M.toggle_format_on_save() end, {}) local block_list = {} vim.api.nvim_create_user_command("SelectedFormatToggle", function(opts) if block_list[opts.args] == nil then print("Select disable format file type is " .. opts.args) block_list[opts.args] = true return end block_list[opts.args] = not block_list[opts.args] end, { nargs = 1, complete = function(_, _, _) return { "markdown", "vim", "lua", "c", "cpp", "python", "vue", "typescript", "javascript", "yaml", "html", "css", "scss", "sh", "rust", } end, }) function M.enable_format_on_save(is_configured) local opts = { pattern = "*", timeout = 1000 } vim.api.nvim_create_augroup("format_on_save", {}) vim.api.nvim_create_autocmd("BufWritePre", { group = "format_on_save", pattern = opts.pattern, callback = function() require("modules.completion.formatting").format({ timeout_ms = opts.timeout, filter = M.format_filter }) end, }) if not is_configured then vim.notify("Enabled format-on-save", vim.log.levels.INFO) end end function M.disable_format_on_save() pcall(vim.api.nvim_del_augroup_by_name, "format_on_save") vim.notify("Disabled format-on-save", vim.log.levels.INFO) end function M.configure_format_on_save() if format_on_save then M.enable_format_on_save(true) else M.disable_format_on_save() end end function M.toggle_format_on_save() local status, _ = pcall(vim.api.nvim_get_autocmds, { group = "format_on_save", event = "BufWritePre", }) if not status then M.enable_format_on_save(false) else M.disable_format_on_save() end end function M.format_filter(clients) return vim.tbl_filter(function(client) local status_ok, formatting_supported = pcall(function() return client.supports_method("textDocument/formatting") end) if status_ok and formatting_supported and client.name == "efm" then return "efm" elseif client.name ~= "sumneko_lua" and client.name ~= "tsserver" and client.name ~= "clangd" then return status_ok and formatting_supported and client.name end end, clients) end function M.format(opts) local cwd = vim.fn.getcwd() for i = 1, #disabled_worksapce do if cwd.find(cwd, disabled_worksapce[i]) ~= nil then return end end local bufnr = opts.bufnr or vim.api.nvim_get_current_buf() local clients = vim.lsp.buf_get_clients(bufnr) if opts.filter then clients = opts.filter(clients) elseif opts.id then clients = vim.tbl_filter(function(client) return client.id == opts.id end, clients) elseif opts.name then clients = vim.tbl_filter(function(client) return client.name == opts.name end, clients) end clients = vim.tbl_filter(function(client) return client.supports_method("textDocument/formatting") end, clients) if #clients == 0 then vim.notify("[LSP] Format request failed, no matching language servers.") end local timeout_ms = opts.timeout_ms for _, client in pairs(clients) do if block_list[vim.bo.filetype] == true then vim.notify(string.format("[LSP][%s] format [%s] has disable", client.name, vim.bo.filetype)) return end local params = vim.lsp.util.make_formatting_params(opts.formatting_options) local result, err = client.request_sync("textDocument/formatting", params, timeout_ms, bufnr) if result and result.result then vim.lsp.util.apply_text_edits(result.result, bufnr, client.offset_encoding) vim.notify(string.format("Format successfully with %s!", client.name), vim.log.levels.INFO) elseif err then vim.notify(string.format("[LSP][%s] %s", client.name, err), vim.log.levels.WARN) end end end return M
local Class = require("facto.class") local Event = require("facto.event") local AbstractFactory = require("facto.abstractfactory") --- Exchanger factory class for registering, creating different exchangers, and centralized managing all exchanger instances. -- @classmod ExchangerFactory local ExchangerFactory = Class.extend({}, AbstractFactory) -- @section property members -- @section metatable members --- Setup exchanger factory. -- @todo using cfg function ExchangerFactory:setup() local class = require("facto.exchanger.cargowagonexchanger") self:register(class.type, class) class = require("facto.exchanger.fluidwagonexchanger") self:register(class.type, class) end --- Create exchanger in lazy added mode. -- Considering creating facto entities and tiles in one call -- When in final creation of all entities, invoke the returned closure -- @tparam table props -- @treturn class<Exchanger>, closure function ExchangerFactory:createLazyAdded(key, props) local class = self:getClass(key) if class == nil then error(string.format("Key(%s) not registered.", key)) end local instance = class(props) -- this value for deserialization instance.type = key return instance, function() self.instanced[tostring(instance:getId())] = instance end end --- Return a global unique key. -- @treturn string function ExchangerFactory.guid() return "facto.exchanger.exchangerfactory" end local instance --- Get singleton instance. -- @treturn class<ExchangerFactory> function ExchangerFactory.getInstance() if instance == nil then instance = ExchangerFactory() instance:setup() end return instance end Event.on_nth_tick(60, function() if instance then for _,exchanger in pairs(instance.instanced) do exchanger:exchange() end end end) -- @export return ExchangerFactory
--addEventHandler( "OnClientWeaponFire", root, function (target) -- if (target == getLocalPlayer()) then -- outputChatBox("Phew") -- if (getElementDimension(target) == 2000) then -- local pedSlot = getPedWeaponSlot ( target ) -- if (pedSlot == 8 or pedSlot == 12 or pedSlot == 7) then -- outputChatBox("You cannot use that weapon.", 255, 0, 0) -- cancelEvent() -- end -- end -- end --end) --addEventHandler( "onClientProjectileCreation", root, -- --function ( creator ) -- -- if getElementDimension ( localPlayer, 2000 ) then -- -- if ( getProjectileType( source ) == 16 ) or ( getProjectileType( source ) == 17 ) or ( getProjectileType( source ) == 18 ) or ( getProjectileType( source ) == 39 ) or ( getProjectileType( source ) == 38 )then -- -- -- -- if ( creator == localPlayer ) then -- -- ------- -- -- end -- -- -- -- destroyElement( source ) -- -- end -- -- end -- --end -- --)
--|> SIMPLEX | Easy-to-use interaction system <|-- -- ShutoExpressway -- Handles interaction in-range detection. local InteractionProximityHandler = {} InteractionProximityHandler.CharacterHandler = nil InteractionProximityHandler.NearestPoint = nil local CollectionService = game:GetService("CollectionService") local character local humanoidRoot local closest local interactionsAvailable = {} local hooks = {} local Simplex local EventManager local Character local INTERACTION_POLL_INTERVAL = 0.125 local COLLECTION_SERVICE_TAG = "Interaction" local DISABLED_TAG = "Simplex:Disabled" -- Yet again, another tag to kill ValueObjects local CAMERA = workspace.CurrentCamera local function addTag(point) interactionsAvailable[point] = point end local function removeTag(point) interactionsAvailable[point] = nil end -- Inspired from the endorsed Dune Buggy by Roblox local function getClosestInteraction() if character and humanoidRoot and character.Humanoid.Health > 0 then local closestInter local closestDist = math.huge for _, point in pairs(interactionsAvailable) do if point:IsA("BasePart") then local tags = CollectionService:GetTags(point) local _, visible = CAMERA:WorldToViewportPoint(point.Position) if visible then local dist = (humanoidRoot.Position - point.Position).Magnitude if closestDist < dist and dist < 12.5 and not table.find(tags, DISABLED_TAG) then end end end end end end -- Runs the handler. Identical to ::Setup function InteractionProximityHandler:Run() CollectionService:GetInstanceAddedSignal(COLLECTION_SERVICE_TAG):Connect(addTag) CollectionService:GetInstanceRemovedSignal(COLLECTION_SERVICE_TAG):Connect(removeTag) for _, point in ipairs(CollectionService:GetTagged(COLLECTION_SERVICE_TAG)) do addTag(point) end while true do local closestInteraction = getClosestInteraction() if closestInteraction and closestInteraction ~= closest then closest = closestInteraction self.NearestPoint = closest EventManager.InteractionInRange:Fire(closest) elseif closest then EventManager.InteractionOutOfRange:Fire(closest) self.NearestPoint = nil end wait(INTERACTION_POLL_INTERVAL) end end function InteractionProximityHandler:Init(simplex) Simplex = simplex EventManager = Simplex.Client.EventManager Character = require(script.Character) Simplex:Wrap(Character) self.CharacterHandler = Character character = Character.Character or Character.CharacterAdded:Wait() humanoidRoot = character:WaitForChild("HumanoidRootPart") Character.CharacterAdded:Connect(function(theCharacter) character = theCharacter humanoidRoot = theCharacter:WaitForChild("HumanoidRootPart") end) self:Run() end return InteractionProximityHandler
local runner = require("test_executive") local console = require("console") local json = require("json") -- Setup -- server = core.httpd(9081) endpoint = core.endpoint() server:attach(endpoint, "/source") client = core.http("127.0.0.1", 9081) -- Unit Test -- rsps, status = client:request("GET", "/", "{}") runner.check(status == nil, "failed to report error on unattached endpoint") rsps, status = client:request("RAW", "/", "\r\n\r\n") runner.check(status == nil, "failed to report error on empty http request") rsps, status = client:request("GET", "/source/health", "{}") runner.check(status == true, "failed to remain healthy after invalid requests") -- Clean Up -- server:destroy() client:destroy() -- Report Results -- runner.report()
--[[ - SKYNET SIMPLE ( https://github.com/viticm/skynet-simple ) - $Id base.lua - @link https://github.com/viticm/skynet-simple for the canonical source repository - @copyright Copyright (c) 2020 viticm( viticm.ti@gmail.com ) - @license - @user viticm( viticm.ti@gmail.com ) - @date 2020/09/07 13:53 - @uses The player base module. --]] local skynet = require 'skynet' local mod = require 'world.role.mod' local cache = require 'mysql.cache' local log = require 'log' local client = require 'client' -- Enviroment. ------------------------------------------------------------------------------- local print = print local table = table local _CH = client.handler() local _M = {} package.loaded[...] = _M if setfenv and type(setfenv) == 'function' then setfenv(1, _M) -- Lua 5.1 else _ENV = _M -- Lua 5.2+ end -- Data. ------------------------------------------------------------------------------- local nm = 'base' mod(nm, _M) -- API(self is the role object). ------------------------------------------------------------------------------- function load(self) local rid = self.id self[nm] = cache.load(rid, nm) log:dump(self[nm], 'base load===================') end function enter(self) print('base enter==============================', self.id) end -- Message. ------------------------------------------------------------------------------- function _CH:forward() return self.map and self.map.addr end
local NotificationBindable = Instance.new("BindableFunction") NotificationBindable.OnInvoke = callback -- game.StarterGui:SetCore("SendNotification", { Title = "Dynamic Client"; Text = "Xray Activated."; Icon = "rbxassetid://9136813125"; Duration = 3; Callback = NotificationBindable; }) -- Made by Clifford from Intriga Discord -- Edited by Foxxy#2439 -- local localPlayer=game.Players.LocalPlayer function highlightModel(objObject) for i,v in pairs(objObject:children())do if v:IsA'BasePart'and v.Name~='HumanoidRootPart'then local bHA=Instance.new('BoxHandleAdornment',v) bHA.Adornee=v bHA.Size= v.Name=='Head' and Vector3.new(1.25,1.25,1.25) or v.Size bHA.Color3=v.Name=='Head'and Color3.new(1,0,0)or v.Name=='Torso'and Color3.new(0,1,0)or Color3.new(0,0,1) bHA.Transparency=.5 bHA.ZIndex=1 bHA.AlwaysOnTop=true end if #v:children()>0 then highlightModel(v) end end end function unHighlightModel(objObject) for i,v in pairs(objObject:children())do if v:IsA'BasePart' and v:findFirstChild'BoxHandleAdornment' then v.BoxHandleAdornment:Destroy() end if #v:children()>0 then unHighlightModel(v) end end end function sortTeamHighlights(objPlayer) repeat wait() until objPlayer.Character if objPlayer.TeamColor~=localPlayer.TeamColor then highlightModel(objPlayer.Character) else unHighlightModel(objPlayer.Character) end if objPlayer~=localPlayer then objPlayer.Changed:connect(function(strProp) if strProp=='TeamColor'then if objPlayer.TeamColor~=localPlayer.TeamColor then unHighlightModel(objPlayer.Character) highlightModel(objPlayer.Character) else unHighlightModel(objPlayer.Character) end end end) else objPlayer.Changed:connect(function(strProp) if strProp=='TeamColor'then wait(.5) for i,v in pairs(game.Players:GetPlayers())do unHighlightModel(v) if v.TeamColor~=localPlayer.TeamColor then highlightModel(v.Character) end end end end) end end for i,v in pairs(game.Players:GetPlayers())do v.CharacterAdded:connect(function() sortTeamHighlights(v) end) sortTeamHighlights(v) end game.Players.PlayerAdded:connect(function(objPlayer) objPlayer.CharacterAdded:connect(function(objChar) sortTeamHighlights(objPlayer) end) end)
local indent = require'indent_blankline' indent.setup { show_current_context = true, show_current_context_start = false, }
data:extend( { { type = "item", name = "hr-glass", icon = "__More-Materia__/graphics/hr-glass.png", icon_size = 64, flags = {"goes-to-main-inventory"}, action = { type="direct", action_delivery = { type = "instant", target_effects = { type = "damage", damage = { amount = 5 , type = "physical"} } } }, subgroup = "intermediate-product", order = "f[hr-glass]", stack_size = 200 }, { type = "item", name = "beaker", icon = "__More-Materia__/graphics/science-beaker.png", icon_size = 64, flags = {"goes-to-main-inventory"}, action = { type="direct", action_delivery = { type = "instant", target_effects = { type = "damage", damage = { amount = 5 , type = "physical"} } } }, subgroup = "science-pack", order = "f[beaker]", stack_size = 200 }, } )
-- FxControlHelper -- Copyright (c) 2021 ぬーもす -- This script is released under the MIT License. -- # Effect local set_effect = function(self, vci_item_name) self._effect = vci.assets.GetEffekseerEmitter(vci_item_name) end local set_effect_loop = function(self, is_loop) self._is_effect_loop = is_loop end local enable_effect_loop = function(self) self:set_effect_loop(true) end local disable_effect_loop = function(self) self:set_effect_loop(false) end local play_effect = function(self) if self._effect == nil then return end if self._is_effect_loop then self._effect._ALL_Play() else self._effect._ALL_PlayOneShot() end end local stop_effect = function(self) if self._effect == nil then return end self._effect._ALL_Stop() end -- # Sound local set_sound = function(self, audio_clip_name) self._audio_clip_name = audio_clip_name end local set_sound_volume = function(self, volume) assert(volume >= 0 and volume <= 1, "Volume should be from 0 to 1") self._audio_volume = volume end local set_sound_loop = function(self, is_loop) self._is_audio_loop = is_loop end local enable_sound_loop = function(self) self:set_sound_loop(true) end local disable_sound_loop = function(self) self:set_sound_loop(false) end local play_sound = function(self) if self._audio_clip_name == nil then return end if self._is_sound_loop then vci.assets.audio._ALL_Play(self._audio_clip_name, self._audio_volume, true) else vci.assets.audio._ALL_PlayOneShot(self._audio_clip_name, self._audio_volume) end end local stop_sound = function(self) if self._audio_clip_name == nil then return end vci.assets.audio._ALL_Stop(self._audio_clip_name) end -- # Alias local play = function(self) self:play_effect() self:play_sound() end local stop = function(self) self:stop_effect() self:stop_sound() end local functions = { set_effect = set_effect, set_effect_loop = set_effect_loop, enable_effect_loop = enable_effect_loop, disable_effect_loop = disable_effect_loop, play_effect = play_effect, stop_effect = stop_effect, set_sound = set_sound, set_sound_volume = set_sound_volume, set_sound_loop = set_sound_loop, enable_sound_loop = enable_sound_loop, disable_sound_loop = disable_sound_loop, play_sound = play_sound, stop_sound = stop_sound, play = play, stop = stop, } local new = function(self) local _member_params = { _effect = nil, _is_effect_loop = false, _audio_clip_name = nil, _audio_volume = 1, _is_sound_loop = false, } return setmetatable(_member_params, {__index = functions}) end return { new = new }
-- See LICENSE for terms -- local any funcs used below (more than once) local tonumber, tostring, pcall = tonumber, tostring, pcall local AsyncRand, _InternalTranslate, T = AsyncRand, _InternalTranslate, T do -- translate local locale_path = CurrentModPath .. "Locales/" if not LoadTranslationTableFile(locale_path .. GetLanguage() .. ".csv") then LoadTranslationTableFile(locale_path .. "English.csv") end Msg("TranslationChanged") end -- locale id to string local function t(str) return _InternalTranslate(T(str)) end local str = { not_implemented = t(302535920010000, "math.%s not implemented yet."), error = t(302535920010001, "bad argument #%s to 'math.%s' (%s)"), zero = t(302535920010002, "zero"), less_than_or_equals_zero = t(302535920010003, "less than or equals zero"), less_than_zero = t(302535920010004, "less than zero"), arg2_arg1_less_than_zero = t(302535920010005, "arg#2 - arg#1 == less than zero"), test_start = t(302535920010006, "Testing math: Start"), test_end = t(302535920010007, "Testing math: End"), test_error = t(302535920010008, "Testing math: Error file: (%s) line number: (%s) val1: (%s) val2: (%s) func: (math.%s)"), nan = t(302535920010009, "nan"), fmod = t(302535920010010, "fmod"), log = t(302535920010011, "log"), oneortwo = t(302535920010012, "1 or #2"), random = t(302535920010013, "random"), sqrt = t(302535920010014, "sqrt"), sin = t(302535920010015, "sin"), tan = t(302535920010016, "tan"), acos = t(302535920010017, "acos"), asin = t(302535920010018, "asin"), atan = t(302535920010019, "atan"), abs = t(302535920010020, "abs"), ceil = t(302535920010021, "ceil"), deg = t(302535920010022, "deg"), exp = t(302535920010023, "exp"), floor = t(302535920010024, "floor"), modf = t(302535920010025, "modf"), rad = t(302535920010026, "rad"), tointeger = t(302535920010027, "tointeger"), type = t(302535920010028, "type"), cos = t(302535920010029, "cos"), RoundDown = t(302535920010030, "RoundDown"), pow = t(302535920010031, "pow"), log10 = t(302535920010032, "log10"), ldexp = t(302535920010033, "ldexp"), frexp = t(302535920010034, "frexp"), } local function CheckNum(x, name, arg) x = tonumber(x) if x then return x else print(str.error:format(arg or 1, name, str.nan)) return 0/0 end end -- don't overwrite math. table if it exists (maybe someone else added it) if type(math) ~= "table" then -- global table holding all the functions math = {} end -- Returns the absolute value of x. (integer/float) math.sm_abs = abs function math.abs(x) x = CheckNum(x, str.abs) if x < 0 then x = 0 - x end return x end -- Returns the smallest integral value larger than or equal to x. function math.ceil(x) x = CheckNum(x, str.ceil) -- needed for neg numbers if x < 0 then x = x + 1 - (x % 1) return math.floor(x) end -- works fine on pos numbers return math.floor(x + 0.9) end -- Converts the angle x from radians to degrees. function math.deg(x) x = CheckNum(x, str.deg) return x * 180.0 / math.pi end -- Napier's constant/Euler's number (to 104 digits) math.e = 2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746 -- Returns the value e^x (where e is the base of natural logarithms). function math.exp(x) x = CheckNum(x, str.exp) return math.e^x end -- Returns the largest integral value smaller than or equal to x. math.floor = rawget(_G, "floatfloor") or function(x) x = CheckNum(x, str.floor) return x - (x % 1) end -- Returns the remainder of the division of x by y that rounds the quotient towards zero. (integer/float) function math.fmod(x, y) x = CheckNum(x, str.fmod) y = CheckNum(y, str.fmod, 2) if y == 0 then print(str.error:format(2, str.fmod, str.zero)) return 0/0 end if y < 0 then y = y * -1 end local neg if x < 0 then neg = true x = x * -1 end x = x % y if neg then return -x end return x end -- The float value HUGE_VAL, a value larger than any other numeric value. math.huge = 10e500 + 10e500 -- Returns the logarithm of x in the given base. The default for base is e (so that the function returns the natural logarithm of x). function math.log(x, base) x = CheckNum(x, str.log) if x < 0 or tostring(x) == "0" then print(str.error:format(1, str.log, str.less_than_or_equals_zero)) return 0/0 end if base then base = tonumber(base) if base then if base < 0 then print(str.error:format(2, str.log, str.less_than_zero)) return 0/0 elseif base == 0 then return -0.0 end if tostring(x) == "1" then return 0.0 end return math.log(x) / math.log(base) else -- user put something for base that isn't a number print(str.error:format(2, str.log, str.nan)) return 0/0 end end -- no base means use base = math.e -- http://foldit.wikia.com/wiki/Lua_Script_Library#math.log_.28Taylor_Series_Approximation_.29 local result = 0 local residue = x / base while residue > 1 do residue = residue / base result = result + 1 end local y = residue - 1 -- Taylor series, just enough to get the same result as math.log() residue = 1+y-y ^2/2+y ^3/3-y ^4/4+y ^5/5-y ^6/6+y ^7/7-y ^8/8+y ^9/9-y ^10/10+y ^11/11-y ^12/12+y ^13/13-y ^14/14+y ^15/15-y ^16/16+y ^17/17-y ^18/18+y ^19/19-y ^20/20+y ^21/21-y ^22/22+y ^23/23-y ^24/24+y ^25/25-y ^26/26+y ^27/27-y ^28/28+y ^29/29-y ^30/30+y ^31/31-y ^32/32+y ^33/33-y ^34/34+y ^35/35-y ^36/36+y ^37/37-y ^38/38+y ^39/39-y ^40/40+y ^41/41-y ^42/42+y ^43/43-y ^44/44+y ^45/45-y ^46/46+y ^47/47-y ^48/48+y ^49/49-y ^50/50+y ^51/51-y ^52/52+y ^53/53-y ^54/54+y ^55/55-y ^56/56+y ^57/57-y ^58/58+y ^59/59-y ^60/60+y ^61/61-y ^62/62+y ^63/63-y ^64/64 result = result + residue return result end -- Returns the argument with the maximum value, according to the Lua operator <. (integer/float) math.max = Max -- An integer with the maximum value for an integer. math.maxinteger = max_int -- Returns the argument with the minimum value, according to the Lua operator <. (integer/float) math.min = Min -- An integer with the minimum value for an integer. math.mininteger = min_int -- Returns the integral part of x and the fractional part of x. Its second result is always a float. function math.modf(x) x = CheckNum(x, str.modf) if math.type(x) == "integer" then return x, 0.0 end local neg if x < 0 then neg = true x = x * -1 end local int = math.floor(x) if tostring(x) == tostring(int) then x = x % 1 else x = x - int end if neg then return -int, -x end return int, x end -- pi is pi is pi (to 104 digits) math.pi = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214 -- Converts the angle x from degrees to radians. function math.rad(x) x = CheckNum(x, str.rad) return x * math.pi / 180.0 end -- When called without arguments, returns a pseudo-random float with uniform distribution in the range [0, 1). -- When called with two integers m and n, math.random returns a pseudo-random integer with uniform distribution in the range [m, n]. -- (The value n-m cannot be negative and must fit in a Lua integer.) The call math.random(n) is equivalent to math.random(1, n). function math.random(m, n) if m and n then m = CheckNum(m, str.random) n = CheckNum(n, str.random) if n-m < 0 then print(str.error:format(str.oneortwo, str.random, str.arg2_arg1_less_than_zero)) return 0/0 end return AsyncRand(n - m + 1) + m elseif m then m = CheckNum(m, str.random) if m <= 0 then print(str.error:format(1, str.random, str.less_than_or_equals_zero)) return 0/0 end return AsyncRand(m) else -- so it'll never return 1, close enough return tonumber("0." .. AsyncRand()) end end -- Sets x as the "seed" for the pseudo-random generator: equal seeds produce equal sequences of numbers. -- The math.randomseed() function sets a seed for the pseudo-random generator: Equal seeds produce equal sequences of numbers. math.randomseed = AsyncSetSeed -- Returns the square root of x. function math.sqrt(x) x = CheckNum(x, str.sqrt) if x < 0 then print(str.error:format(1, str.sqrt, str.less_than_zero)) return 0/0 end return x^0.5 end -- If the value x is convertible to an integer, returns that integer. Otherwise, returns nil. function math.tointeger(x) x = CheckNum(x, str.tointeger) return math.floor(x) end -- Returns "integer" if x is an integer, "float" if it is a float, or nil if x is not a number. function math.type(x) -- nil if not tonumber(x) then return end x = CheckNum(x, str.type) -- SM thinks 5.5 == 5... if tostring(math.floor(x)) == tostring(x) then return "integer" end return "float" end -- Returns a boolean, true if and only if integer m is below integer n when they are compared as unsigned integers. function math.ult(m, n) m = math.tointeger(m) n = math.tointeger(n) --~ if m and n and m < n then --~ return true --~ end --~ return false if m and n then if m < n then return true else return false end end end -- Returns the cosine of x (assumed to be in radians). math.sm_cos = cos function math.cos(x) x = CheckNum(x, str.cos) return math.sin(x + math.pi/2) end -- Returns the sine of x (assumed to be in radians). math.sm_sin = sin function math.sin(x) x = CheckNum(x, str.sin) print(str.not_implemented:format(str.sin)) end -- Returns the tangent of x (assumed to be in radians). function math.tan(x) x = CheckNum(x, str.tan) print(str.not_implemented:format(str.tan)) end -- Returns the arc cosine of x (in radians). math.sm_acos = acos function math.acos(x) x = CheckNum(x, str.acos) print(str.not_implemented:format(str.acos)) end -- Returns the arc sine of x (in radians). math.sm_asin = asin function math.asin(x) x = CheckNum(x, str.asin) print(str.not_implemented:format(str.asin)) end -- Returns the arc tangent of y/x (in radians), but uses the signs of both arguments to find the quadrant of the result. (It also handles correctly the case of x being zero.) -- The default value for x is 1, so that the call math.atan(y) returns the arc tangent of y. math.sm_atan = atan function math.atan(x) x = CheckNum(x, str.atan) print(str.not_implemented:format(str.atan)) end --~ other functions -- round down to nearest (default 1000) function math.RoundDown(x, g) x = CheckNum(x, str.RoundDown) g = CheckNum(g, str.RoundDown, 2) g = g or 1000 return (x - x % g) / g * g end pcall(function() -- Integer round up to nearest math.sm_RoundUp = round -- (number, granularity) math.sm_AngleNormalize = AngleNormalize -- (angle) math.sm_band = band -- (n1, n2) math.sm_bnot = bnot -- (n) math.sm_bor = bor -- (n1, n2) math.sm_bxor = bxor -- (n1, n2) math.sm_CatmullRomSpline = CatmullRomSpline -- (p1, p2, p3, p4, t, scale) math.sm_compare = compare -- (n1, n2) math.sm_DivCeil = DivCeil -- (v, d) math.sm_DivRound = DivRound -- (m, d) --~ math.sm_FastSin = FastSin -- (a) math.sm_GetClock = GetClock math.sm_GetPreciseTicks = GetPreciseTicks math.sm_HermiteSpline = HermiteSpline -- (p1, m1, p2, m2, t, scale) math.sm_IsPowerOf2 = IsPowerOf2 -- (v) math.sm_maskset = maskset -- (flags, mask, value) math.sm_MulDivRound = MulDivRound -- (v, m, d) math.sm_MulDivTrunc = MulDivTrunc -- (v, m, d) math.sm_shift = shift -- (value, shift) math.sm_xxhash = xxhash -- (arg1, arg2, arg3) -- not really mathy --~ math.sm_cs = cs math.sm_perlin = perlin math.sm_Encode16 = Encode16 math.sm_Decode16 = Decode16 math.sm_Encode64 = Encode64 math.sm_Decode64 = Decode64 math.sm_EaseCoeff = EaseCoeff end) -- deprecated function math.pow(x, y) x = CheckNum(x, str.pow) y = CheckNum(y, str.pow, 2) return x^y end function math.log10(x) x = CheckNum(x, str.log10) return math.log(x, 10) end function math.ldexp(x, exp) x = CheckNum(x, str.ldexp) exp = CheckNum(exp, str.ldexp, 2) return x * 2.0^exp end --~ https://github.com/excessive/cpml/blob/master/modules/utils.lua function math.frexp(x) x = CheckNum(x, str.frexp) if x == 0 then return 0, 0 end local e = math.floor(math.log(math.abs(x)) / math.log(2) + 1) return x / 2 ^ e, e end math.atan2 = math.atan math.mod = math.fmod --~ https://github.com/NLua/LuaTests/blob/master/suite/math.lua (mostly) function math.test() print(str.test_start) local getinfo = format_value --~ local = debug.getinfo local script_name = CurrentModPath .. "Script.lua" local function Test(line, func, n1, n2) if n1 == false then print(str.test_error:format(script_name, line, n1, n2, func)) elseif n1 and n2 and n1 ~= n2 then print(str.test_error:format(script_name, line, n1, n2, func)) end end local function eq(a, b, limit) return math.abs(a-b) <= (limit or 10E-10) end Test(getinfo(function()end), "huge", math.huge > 10e30) Test(getinfo(function()end), "huge", -math.huge < -10e30) -- testing mod operator Test(getinfo(function()end), "pi", tostring(math.pi - math.pi % 1), "3.0") Test(getinfo(function()end), "pi", tostring(math.pi - math.pi % 0.001), "3.141") --~ local function testbit(a, n) --~ return a/2^n % 2 >= 1 --~ end --~ Test(getinfo(function()end), "sin", eq(math.sin(-9.8)^2 + math.cos(-9.8)^2, 1)) --~ Test(getinfo(function()end), "tan", eq(math.tan(math.pi/4), 1)) --~ Test(getinfo(function()end), "sin", eq(math.sin(math.pi/2), 1) and eq(math.cos(math.pi/2), 0)) --~ Test(getinfo(function()end), "atan", eq(math.atan(1), math.pi/4) and eq(math.acos(0), math.pi/2) and --~ eq(math.asin(1), math.pi/2)) Test(getinfo(function()end), "deg", eq(math.deg(math.pi/2), 90) and eq(math.rad(90), math.pi/2)) Test(getinfo(function()end), "abs", math.abs(-10), 10) --~ Test(getinfo(function()end), "atan2", eq(math.atan2(1, 0), math.pi/2)) Test(getinfo(function()end), "ceil", math.ceil(4.5), 5) Test(getinfo(function()end), "floor", math.floor(4.5), 4) Test(getinfo(function()end), "mod", math.mod(10, 3), 1) Test(getinfo(function()end), "sqrt", eq(math.sqrt(10)^2, 10)) Test(getinfo(function()end), "log10", eq(math.log10(2), math.log(2)/math.log(10))) Test(getinfo(function()end), "exp", eq(math.exp(0), 1)) --~ Test(getinfo(function()end), "sin", eq(math.sin(10), math.sin(10%(2*math.pi)))) local v, e = math.frexp(math.pi) Test(getinfo(function()end), "ldexp", eq(math.ldexp(v, e), math.pi)) --~ Test(getinfo(function()end), "tanh", eq(math.tanh(3.5), math.sinh(3.5)/math.cosh(3.5))) --~ if rawget(_G, "_soft") then return end --~ local AsyncStringToFile = AsyncStringToFile --~ ThreadLockKey(tmpfile) --~ AsyncStringToFile(tmpfile, "a = {", "-1") --~ for i = 1, 1000 do --~ AsyncStringToFile(tmpfile, --~ "{" .. math.sin(i) .. ", " .. math.cos(i) .. ", " .. i/3 .. "}, \n", --~ "-1") --~ end --~ AsyncStringToFile(tmpfile, "}", "-1") --~ f:seek("set", 0) --~ Test(getinfo(function()end), "sin", loadstring(select(2, AsyncFileToString(tmpfile))))() --~ ThreadUnlockKey(tmpfile) --~ Test(getinfo(function()end), "sin", eq(a[300][1], math.sin(300))) --~ Test(getinfo(function()end), "sin", eq(a[600][1], math.sin(600))) --~ Test(getinfo(function()end), "cos", eq(a[500][2], math.cos(500))) --~ Test(getinfo(function()end), "cos", eq(a[800][2], math.cos(800))) --~ Test(getinfo(function()end), "sin", eq(a[200][3], 200/3)) --~ Test(getinfo(function()end), "sin", eq(a[1000][3], 1000/3, 0.001)) --~ -- doesn't work in SM ("10e500 - 10e400" returns "-nan(ind)" instead of "nan") --~ do -- testing NaN --~ local NaN = 10e500 - 10e400 --~ Test(getinfo(function()end), "nan", NaN ~= NaN) --~ Test(getinfo(function()end), "nan", not (NaN < NaN)) --~ Test(getinfo(function()end), "nan", not (NaN <= NaN)) --~ Test(getinfo(function()end), "nan", not (NaN > NaN)) --~ Test(getinfo(function()end), "nan", not (NaN >= NaN)) --~ Test(getinfo(function()end), "nan", not (0 < NaN)) --~ Test(getinfo(function()end), "nan", not (NaN < 0)) --~ local a = {} --~ Test(getinfo(function()end), "nan", not pcall(function () a[NaN] = 1 end)) --~ Test(getinfo(function()end), "nan", a[NaN], nil) --~ a[1] = 1 --~ Test(getinfo(function()end), "nan", not pcall(function () a[NaN] = 1 end)) --~ Test(getinfo(function()end), "nan", a[NaN], nil) --~ end --~ require "checktable" --~ stat(a) --~ a = nil math.randomseed(0) for _ = 1, 10 do local t = math.random(5) Test(getinfo(function()end), "random", 1 <= t and t <= 5) end local flag local Max = -200 local Min = 200 for _ = 1, 10000 do local t = math.random(-10, 0) Max = math.max(Max, t) Min = math.min(Min, t) flag = (Max == 0 and Min == -10) if flag then break end end Test(getinfo(function()end), "random", -10 <= Min and Max<=0) Test(getinfo(function()end), "random", flag); -- tests I added Test(getinfo(function()end), "huge", math.huge + math.huge, math.huge) Test(getinfo(function()end), "log", tostring(math.log(1.1)), "0.095310179804325") Test(getinfo(function()end), "log", tostring(math.log(6.4643, 25)), "0.57979705728765") Test(getinfo(function()end), "exp", tostring(math.exp(5.453454)), "233.56350262858") Test(getinfo(function()end), "exp", tostring(math.exp(-5.453454)), "0.0042814908525766") Test(getinfo(function()end), "fmod", tostring(math.fmod(56546.45645, 1)), "0.45644999999786") Test(getinfo(function()end), "fmod", tostring(math.fmod(-56546.45645, 1.5)), "-0.95644999999786") Test(getinfo(function()end), "fmod", tostring(math.fmod(-876.0007665, -1)), "-0.00076650000005429") Test(getinfo(function()end), "fmod", tostring(math.fmod(876.0007665, -1.6)), "0.80076650000001") Test(getinfo(function()end), "ceil", math.ceil(123.334546452), 124) Test(getinfo(function()end), "ceil", math.ceil(-123.334546452), -123) Test(getinfo(function()end), "floor", math.floor(-123.525645644), -124) Test(getinfo(function()end), "floor", math.floor(123.525645644), 123) local int, flt = math.modf(3453444.54354645) Test(getinfo(function()end), "modf", int, 3453444) Test(getinfo(function()end), "modf", tostring(flt), "0.5435464498587") int, flt = math.modf(-3453444.54354645) Test(getinfo(function()end), "modf", int, -3453444) Test(getinfo(function()end), "modf", tostring(flt), "-0.5435464498587") -- check error msg --~ Test(getinfo(function()end), "test", 1, 0) print(str.test_end) end
STRING_PROVISIONS = { 'provision_alligator_legendary_skin_pristine', 'provision_alligator_legendary_tooth', 'provision_alligator_skin_poor', 'provision_alligator_skin_pristine', 'provision_alligator_skin', 'provision_alligator_tooth', 'provision_animal_carcass_alligator_high_quality', 'provision_animal_carcass_alligator_perfect', 'provision_animal_carcass_alligator_poor', 'provision_animal_carcass_armadillo_high_quality', 'provision_animal_carcass_armadillo_perfect', 'provision_animal_carcass_armadillo_poor', 'provision_animal_carcass_badger_high_quality', 'provision_animal_carcass_badger_perfect', 'provision_animal_carcass_badger_poor', 'provision_animal_carcass_bat_high_quality', 'provision_animal_carcass_bat_perfect', 'provision_animal_carcass_bat_poor', 'provision_animal_carcass_beaver_high_quality', 'provision_animal_carcass_beaver_legendary_perfect', 'provision_animal_carcass_beaver_perfect', 'provision_animal_carcass_beaver_poor', 'provision_animal_carcass_bighorn_ram_legendary_perfect', 'provision_animal_carcass_bighorn_sheep_high_quality', 'provision_animal_carcass_bighorn_sheep_perfect', 'provision_animal_carcass_bighorn_sheep_poor', 'provision_animal_carcass_bluejay_high_quality', 'provision_animal_carcass_bluejay_perfect', 'provision_animal_carcass_bluejay_poor', 'provision_animal_carcass_buck_high_quality', 'provision_animal_carcass_buck_legendary_perfect', 'provision_animal_carcass_buck_perfect', 'provision_animal_carcass_buck_poor', 'provision_animal_carcass_bullfrog_high_quality', 'provision_animal_carcass_bullfrog_perfect', 'provision_animal_carcass_bullfrog_poor', 'provision_animal_carcass_calicondor_high_quality', 'provision_animal_carcass_calicondor_perfect', 'provision_animal_carcass_calicondor_poor', 'provision_animal_carcass_cardinal_high_quality', 'provision_animal_carcass_cardinal_perfect', 'provision_animal_carcass_cardinal_poor', 'provision_animal_carcass_cedarwaxwing_high_quality', 'provision_animal_carcass_cedarwaxwing_perfect', 'provision_animal_carcass_cedarwaxwing_poor', 'provision_animal_carcass_chicken_high_quality', 'provision_animal_carcass_chicken_perfect', 'provision_animal_carcass_chicken_poor', 'provision_animal_carcass_chipmunk_high_quality', 'provision_animal_carcass_chipmunk_perfect', 'provision_animal_carcass_chipmunk_poor', 'provision_animal_carcass_cormorant_high_quality', 'provision_animal_carcass_cormorant_perfect', 'provision_animal_carcass_cormorant_poor', 'provision_animal_carcass_cougar_high_quality', 'provision_animal_carcass_cougar_legendary_perfect', 'provision_animal_carcass_cougar_perfect', 'provision_animal_carcass_cougar_poor', 'provision_animal_carcass_coyote_high_quality', 'provision_animal_carcass_coyote_legendary_perfect', 'provision_animal_carcass_coyote_perfect', 'provision_animal_carcass_coyote_poor', 'provision_animal_carcass_crab_high_quality', 'provision_animal_carcass_crab_perfect', 'provision_animal_carcass_crab_poor', 'provision_animal_carcass_crane_high_quality', 'provision_animal_carcass_crane_perfect', 'provision_animal_carcass_crane_poor', 'provision_animal_carcass_crawfish_high_quality', 'provision_animal_carcass_crawfish_perfect', 'provision_animal_carcass_crawfish_poor', 'provision_animal_carcass_crlnaparket_high_quality', 'provision_animal_carcass_crlnaparket_perfect', 'provision_animal_carcass_crlnaparket_poor', 'provision_animal_carcass_crow_high_quality', 'provision_animal_carcass_crow_perfect', 'provision_animal_carcass_crow_poor', 'provision_animal_carcass_deer_high_quality', 'provision_animal_carcass_deer_perfect', 'provision_animal_carcass_deer_poor', 'provision_animal_carcass_duck_high_quality', 'provision_animal_carcass_duck_perfect', 'provision_animal_carcass_duck_poor', 'provision_animal_carcass_eagle_high_quality', 'provision_animal_carcass_eagle_perfect', 'provision_animal_carcass_eagle_poor', 'provision_animal_carcass_egret_high_quality', 'provision_animal_carcass_egret_perfect', 'provision_animal_carcass_egret_poor', 'provision_animal_carcass_fox_high_quality', 'provision_animal_carcass_fox_legendary_perfect', 'provision_animal_carcass_fox_perfect', 'provision_animal_carcass_fox_poor', 'provision_animal_carcass_gila_high_quality', 'provision_animal_carcass_gila_perfect', 'provision_animal_carcass_gila_poor', 'provision_animal_carcass_goat_high_quality', 'provision_animal_carcass_goat_perfect', 'provision_animal_carcass_goat_poor', 'provision_animal_carcass_goose_high_quality', 'provision_animal_carcass_goose_perfect', 'provision_animal_carcass_goose_poor', 'provision_animal_carcass_hawk_high_quality', 'provision_animal_carcass_hawk_perfect', 'provision_animal_carcass_hawk_poor', 'provision_animal_carcass_heron_high_quality', 'provision_animal_carcass_heron_perfect', 'provision_animal_carcass_heron_poor', 'provision_animal_carcass_iguana_high_quality', 'provision_animal_carcass_iguana_perfect', 'provision_animal_carcass_iguana_poor', 'provision_animal_carcass_loon_high_quality', 'provision_animal_carcass_loon_perfect', 'provision_animal_carcass_loon_poor', 'provision_animal_carcass_muskrat_high_quality', 'provision_animal_carcass_muskrat_perfect', 'provision_animal_carcass_muskrat_poor', 'provision_animal_carcass_opossum_high_quality', 'provision_animal_carcass_opossum_perfect', 'provision_animal_carcass_opossum_poor', 'provision_animal_carcass_oriole_high_quality', 'provision_animal_carcass_oriole_perfect', 'provision_animal_carcass_oriole_poor', 'provision_animal_carcass_owl_high_quality', 'provision_animal_carcass_owl_perfect', 'provision_animal_carcass_owl_poor', 'provision_animal_carcass_panther_high_quality', 'provision_animal_carcass_panther_legendary_perfect', 'provision_animal_carcass_panther_perfect', 'provision_animal_carcass_panther_poor', 'provision_animal_carcass_parrot_high_quality', 'provision_animal_carcass_parrot_perfect', 'provision_animal_carcass_parrot_poor', 'provision_animal_carcass_pelican_high_quality', 'provision_animal_carcass_pelican_perfect', 'provision_animal_carcass_pelican_poor', 'provision_animal_carcass_pheasant_high_quality', 'provision_animal_carcass_pheasant_perfect', 'provision_animal_carcass_pheasant_poor', 'provision_animal_carcass_pig_high_quality', 'provision_animal_carcass_pig_perfect', 'provision_animal_carcass_pig_poor', 'provision_animal_carcass_pigeon_high_quality', 'provision_animal_carcass_pigeon_perfect', 'provision_animal_carcass_pigeon_poor', 'provision_animal_carcass_prarechick_high_quality', 'provision_animal_carcass_prarechick_perfect', 'provision_animal_carcass_prarechick_poor', 'provision_animal_carcass_pronghorn_high_quality', 'provision_animal_carcass_pronghorn_legendary_perfect', 'provision_animal_carcass_pronghorn_perfect', 'provision_animal_carcass_pronghorn_poor', 'provision_animal_carcass_quail_high_quality', 'provision_animal_carcass_quail_perfect', 'provision_animal_carcass_quail_poor', 'provision_animal_carcass_rabbit_high_quality', 'provision_animal_carcass_rabbit_perfect', 'provision_animal_carcass_rabbit_poor', 'provision_animal_carcass_racoon_high_quality', 'provision_animal_carcass_racoon_perfect', 'provision_animal_carcass_racoon_poor', 'provision_animal_carcass_ram_high_quality', 'provision_animal_carcass_ram_perfect', 'provision_animal_carcass_ram_poor', 'provision_animal_carcass_rat_high_quality', 'provision_animal_carcass_rat_perfect', 'provision_animal_carcass_rat_poor', 'provision_animal_carcass_raven_high_quality', 'provision_animal_carcass_raven_perfect', 'provision_animal_carcass_raven_poor', 'provision_animal_carcass_redftbooby_high_quality', 'provision_animal_carcass_redftbooby_perfect', 'provision_animal_carcass_redftbooby_poor', 'provision_animal_carcass_robin_high_quality', 'provision_animal_carcass_robin_perfect', 'provision_animal_carcass_robin_poor', 'provision_animal_carcass_rooster_high_quality', 'provision_animal_carcass_rooster_perfect', 'provision_animal_carcass_rooster_poor', 'provision_animal_carcass_rosespoonbil_high_quality', 'provision_animal_carcass_rosespoonbil_perfect', 'provision_animal_carcass_rosespoonbil_poor', 'provision_animal_carcass_seagull_high_quality', 'provision_animal_carcass_seagull_perfect', 'provision_animal_carcass_seagull_poor', 'provision_animal_carcass_sheep_high_quality', 'provision_animal_carcass_sheep_perfect', 'provision_animal_carcass_sheep_poor', 'provision_animal_carcass_skunk_high_quality', 'provision_animal_carcass_skunk_perfect', 'provision_animal_carcass_skunk_poor', 'provision_animal_carcass_snake_blrat_high_quality', 'provision_animal_carcass_snake_blrat_perfect', 'provision_animal_carcass_snake_blrat_poor', 'provision_animal_carcass_snake_boa_high_quality', 'provision_animal_carcass_snake_boa_perfect', 'provision_animal_carcass_snake_boa_poor', 'provision_animal_carcass_snake_copper_high_quality', 'provision_animal_carcass_snake_copper_perfect', 'provision_animal_carcass_snake_copper_poor', 'provision_animal_carcass_snake_ferdlnce_high_quality', 'provision_animal_carcass_snake_ferdlnce_perfect', 'provision_animal_carcass_snake_ferdlnce_poor', 'provision_animal_carcass_snake_high_quality', 'provision_animal_carcass_snake_perfect', 'provision_animal_carcass_snake_poor', 'provision_animal_carcass_snake_water_high_quality', 'provision_animal_carcass_snake_water_perfect', 'provision_animal_carcass_snake_water_poor', 'provision_animal_carcass_songbird_high_quality', 'provision_animal_carcass_songbird_perfect', 'provision_animal_carcass_songbird_poor', 'provision_animal_carcass_sparrow_high_quality', 'provision_animal_carcass_sparrow_perfect', 'provision_animal_carcass_sparrow_poor', 'provision_animal_carcass_squirrel_high_quality', 'provision_animal_carcass_squirrel_perfect', 'provision_animal_carcass_squirrel_poor', 'provision_animal_carcass_toad_high_quality', 'provision_animal_carcass_toad_perfect', 'provision_animal_carcass_toad_poor', 'provision_animal_carcass_turkey_high_quality', 'provision_animal_carcass_turkey_perfect', 'provision_animal_carcass_turkey_poor', 'provision_animal_carcass_turtle_snap_high_quality', 'provision_animal_carcass_turtle_snap_perfect', 'provision_animal_carcass_turtle_snap_poor', 'provision_animal_carcass_vulture_high_quality', 'provision_animal_carcass_vulture_perfect', 'provision_animal_carcass_vulture_poor', 'provision_animal_carcass_wolf_high_quality', 'provision_animal_carcass_wolf_legendary_perfect', 'provision_animal_carcass_wolf_perfect', 'provision_animal_carcass_wolf_poor', 'provision_animal_carcass_woodpecker_high_quality', 'provision_animal_carcass_woodpecker_perfect', 'provision_animal_carcass_woodpecker_poor', 'provision_animal_fat', 'provision_animal_scent_gland', 'provision_armadillo_skin_poor', 'provision_armadillo_skin_pristine', 'provision_armadillo_skin', 'provision_badger_claw', 'provision_badger_pelt_poor', 'provision_badger_pelt_pristine', 'provision_badger_pelt', 'provision_bat_wing', 'provision_bear_claw', 'provision_bear_fur_poor', 'provision_bear_fur_pristine', 'provision_bear_fur', 'provision_bear_legendary_claw', 'provision_bear_legendary_fur_pristine', 'provision_beaver_fur_poor', 'provision_beaver_fur_pristine', 'provision_beaver_fur', 'provision_beaver_legendary_fur_pristine', 'provision_beaver_tooth_legendary', 'provision_big_game_meat', 'provision_bighorn_horn', 'provision_bird_feather_flight', 'provision_bison_horn_legendary', 'provision_black_bear_claw', 'provision_black_bear_fur_poor', 'provision_black_bear_fur_pristine', 'provision_black_bear_fur', 'provision_bluejay_feather', 'provision_boar_legendary_skin_pristine', 'provision_boar_rare_tusk', 'provision_boar_skin_poor', 'provision_boar_skin_pristine', 'provision_boar_skin', 'provision_boar_tusk_legendary', 'provision_boar_tusk', 'provision_booby_feather', 'provision_buck_antler_legendary', 'provision_buck_antlers', 'provision_buck_fur_poor', 'provision_buck_fur_pristine', 'provision_buck_fur', 'provision_buck_legendary_fur_pristine', 'provision_buffalo_fur_poor', 'provision_buffalo_fur_pristine', 'provision_buffalo_fur', 'provision_buffalo_horn_legendary', 'provision_buffalo_horn', 'provision_bull_hide_poor', 'provision_bull_hide_pristine', 'provision_bull_hide', 'provision_bull_horns', 'provision_cardinal_feather', 'provision_cedarwaxwing_feather', 'provision_chicken_feather', 'provision_condor_feather', 'provision_cormorant_feather', 'provision_cougar_fang_legendary', 'provision_cougar_fang', 'provision_cougar_fur_poor', 'provision_cougar_fur_pristine', 'provision_cougar_fur', 'provision_cougar_legendary_fur_pristine', 'provision_cow_hide_poor', 'provision_cow_hide_pristine', 'provision_cow_hide', 'provision_coyote_fang_legendary', 'provision_coyote_fur_poor', 'provision_coyote_fur_pristine', 'provision_coyote_fur', 'provision_coyote_legendary_fur_pristine', 'provision_crow_feather', 'provision_crustacean_meat', 'provision_deer_hide_poor', 'provision_deer_hide_pristine', 'provision_deer_hide', 'provision_duck_feather', 'provision_eagle_feather', 'provision_eagle_talon', 'provision_egret_plume_little', 'provision_egret_plume_reddish', 'provision_egret_plume_snowy', 'provision_elk_antler_legendary', 'provision_elk_antlers', 'provision_elk_fur_poor', 'provision_elk_fur_pristine', 'provision_elk_fur', 'provision_elk_legendary_fur_pristine', 'provision_exotic_bird_meat', 'provision_fish_bluegill_legendary', 'provision_fish_bluegill_poor', 'provision_fish_bluegill', 'provision_fish_bullhead_catfish_legendary', 'provision_fish_bullhead_catfish_poor', 'provision_fish_bullhead_catfish', 'provision_fish_chain_pickerel_legendary', 'provision_fish_chain_pickerel_poor', 'provision_fish_chain_pickerel', 'provision_fish_channel_catfish_legendary', 'provision_fish_channel_catfish_poor', 'provision_fish_channel_catfish', 'provision_fish_lake_sturgeon_legendary', 'provision_fish_lake_sturgeon_poor', 'provision_fish_lake_sturgeon', 'provision_fish_largemouth_bass_legendary', 'provision_fish_largemouth_bass_poor', 'provision_fish_largemouth_bass', 'provision_fish_longnose_gar_legendary', 'provision_fish_longnose_gar_poor', 'provision_fish_longnose_gar', 'provision_fish_muskie_legendary', 'provision_fish_muskie_poor', 'provision_fish_muskie', 'provision_fish_northern_pike_legendary', 'provision_fish_northern_pike_poor', 'provision_fish_northern_pike', 'provision_fish_perch_legendary', 'provision_fish_perch_poor', 'provision_fish_perch', 'provision_fish_redfin_pickerel_legendary', 'provision_fish_redfin_pickerel_poor', 'provision_fish_redfin_pickerel', 'provision_fish_rock_bass_legendary', 'provision_fish_rock_bass_poor', 'provision_fish_rock_bass', 'provision_fish_smallmouth_bass_legendary', 'provision_fish_smallmouth_bass_poor', 'provision_fish_smallmouth_bass', 'provision_fish_sockeye_salmon_legendary', 'provision_fish_sockeye_salmon_poor', 'provision_fish_sockeye_salmon', 'provision_fish_steelhead_trout_legendary', 'provision_fish_steelhead_trout_poor', 'provision_fish_steelhead_trout', 'provision_flakey_fish_meat', 'provision_fox_claw_legendary', 'provision_fox_fur_poor', 'provision_fox_fur_pristine', 'provision_fox_fur', 'provision_fox_legendary_fur_pristine', 'provision_game_meat', 'provision_gamey_bird_meat', 'provision_gila_skin_poor', 'provision_gila_skin_pristine', 'provision_gila_skin', 'provision_goat_hair_poor', 'provision_goat_hair_pristine', 'provision_goat_hair', 'provision_goose_feather', 'provision_gristly_mutton', 'provision_gritty_fish_meat', 'provision_hawk_feather', 'provision_heron_feather', 'provision_herptile_meat', 'provision_iguana_skin_poor', 'provision_iguana_skin_pristine', 'provision_iguana_skin', 'provision_javelina_skin_poor', 'provision_javelina_skin_pristine', 'provision_javelina_skin', 'provision_lions_paw', 'provision_loanshark_skins', 'provision_loon_feather', 'provision_mature_venison', 'provision_moose_antler_legendary', 'provision_moose_antler', 'provision_moose_fur_poor', 'provision_moose_fur_pristine', 'provision_moose_fur', 'provision_moose_legendary_fur_pristine', 'provision_muskrat_fur_poor', 'provision_muskrat_fur_pristine', 'provision_muskrat_fur', 'provision_opossum_fur_poor', 'provision_opossum_fur_pristine', 'provision_opossum_fur', 'provision_oriole_feather', 'provision_owl_feather', 'provision_oxen_hide_poor', 'provision_oxen_hide_pristine', 'provision_oxen_hide', 'provision_oxen_horn', 'provision_panther_eye_legendary', 'provision_panther_fur_poor', 'provision_panther_fur_pristine', 'provision_panther_fur', 'provision_panther_legendary_fur_pristine', 'provision_parakeet_feather', 'provision_parrot_feather', 'provision_pelican_feather', 'provision_pheasant_feather', 'provision_pig_skin_poor', 'provision_pig_skin_pristine', 'provision_pig_skin', 'provision_pigeon_feather', 'provision_plump_bird_meat', 'provision_prime_beef', 'provision_pronghorn_antler_legendary', 'provision_pronghorn_fur_poor', 'provision_pronghorn_fur_pristine', 'provision_pronghorn_fur', 'provision_pronghorn_legendary_fur_pristine', 'provision_quail_feather', 'provision_rabbit_pelt_poor', 'provision_rabbit_pelt_pristine', 'provision_rabbit_pelt', 'provision_raccoon_fur_poor', 'provision_raccoon_fur_pristine', 'provision_raccoon_fur', 'provision_ram_hide_poor', 'provision_ram_hide_pristine', 'provision_ram_hide', 'provision_ram_horn_legendary', 'provision_ram_legendary_hide_pristine', 'provision_rat_fur_poor', 'provision_rat_fur_pristine', 'provision_rat_fur', 'provision_raven_feather', 'provision_robin_feather', 'provision_rooster_feather', 'provision_seagull_feather', 'provision_sheep_wool_poor', 'provision_sheep_wool_pristine', 'provision_sheep_wool', 'provision_skunk_fur_poor', 'provision_skunk_fur_pristine', 'provision_skunk_fur', 'provision_snake_skin_poor', 'provision_snake_skin_pristine', 'provision_snake_skin', 'provision_songbird_feather', 'provision_sparrow_feather', 'provision_spoonbill_feather', 'provision_squirrel_pelt_poor', 'provision_squirrel_pelt_pristine', 'provision_squirrel_pelt', 'provision_squirrel_tail', 'provision_stringy_meat', 'provision_succulent_fish_meat', 'provision_takanta_buffalo_legendary_fur_pristine', 'provision_tender_pork', 'provision_turkey_feather', 'provision_vulture_feather', 'provision_white_buffalo_legendary_fur_pristine', 'provision_whooping_crane_feather', 'provision_wolf_fur_poor', 'provision_wolf_fur_pristine', 'provision_wolf_fur', 'provision_wolf_heart_legendary', 'provision_wolf_heart', 'provision_wolf_legendary_fur_pristine', 'provision_woodpecker_feather', 'provision_woodpecker_feather', } HASH_PROVISIONS = {} for k, v in pairs(STRING_PROVISIONS) do HASH_PROVISIONS[GetHashKey(v)] = v end
TUTORIALS['en'][#TUTORIALS['en'] + 1] = { name = "Attacking a Pokemon", contents = { {type = CONTENT_TYPES.IMAGE, value = "/images/tutorial/attack_creature.png"}, {type = CONTENT_TYPES.TEXT, value = "To attack a wild Pokemon in the game you can use the following options:\n\n1. Clicking directly on the creature with the right button and then selecting \"Attack\".\n\n2. Pressing the Tab shortcut on your keyboard.\n\n3. Selecting the creature in the Battle Window (Ctrl + B).\n\nNote the Pokemon that you are attacking will be marked with a red square around it."}, } }
local FillColor = Component:extend("FillColor") function FillColor:initialize(r, g, b, a) self.fill_color = {r, g, b, a} end function FillColor:setFillColor(r, g, b, a) self.fill_color = {r, g, b, a} return self end function FillColor:setFillColor() return unpack(self.fill_color) end
LinkLuaModifier("modifier_sara_fragment_of_logic", "heroes/hero_sara/fragment_of_logic.lua", LUA_MODIFIER_MOTION_NONE) LinkLuaModifier("modifier_sara_fragment_of_logic_debuff", "heroes/hero_sara/fragment_of_logic.lua", LUA_MODIFIER_MOTION_NONE) sara_fragment_of_logic = class({ GetIntrinsicModifierName = function() return "modifier_sara_fragment_of_logic" end, }) if IsClient() then function sara_fragment_of_logic:GetManaCost() return self:GetSpecialValueFor("energy_const") + self:GetCaster():GetMaxMana() * self:GetSpecialValueFor("energy_pct") * 0.01 end end modifier_sara_fragment_of_logic = class({ IsHidden = function() return true end, IsPurgable = function() return false end, }) if IsServer() then function modifier_sara_fragment_of_logic:DeclareFunctions() return { MODIFIER_EVENT_ON_TAKEDAMAGE, MODIFIER_PROPERTY_MIN_HEALTH } end function modifier_sara_fragment_of_logic:OnTakeDamage(keys) local parent = keys.unit if parent == self:GetParent() and parent:GetHealth() <= 1 and not parent:IsIllusion() and parent.GetEnergy then local ability = self:GetAbility() local toWaste = ability:GetSpecialValueFor("energy_const") + parent:GetMaxEnergy() * ability:GetSpecialValueFor("energy_pct") * 0.01 if ability:IsCooldownReady() and parent:GetEnergy() >= toWaste then if parent:HasScepter() then ability:StartCooldown(ability:GetSpecialValueFor("cooldown_scepter")) else ability:AutoStartCooldown() end parent:AddNewModifier(parent, ability, "modifier_sara_fragment_of_logic_debuff", {duration = ability:GetSpecialValueFor("debuff_duration")}) parent:ModifyEnergy(-toWaste) parent:SetHealth(parent:GetMaxHealth()) parent:Purge(false, true, false, true, false) ParticleManager:CreateParticle("particles/arena/units/heroes/hero_sara/fragment_of_logic.vpcf", PATTACH_ABSORIGIN, parent) parent:EmitSound("Hero_Chen.HandOfGodHealHero") end end end function modifier_sara_fragment_of_logic:GetMinHealth(keys) local parent = self:GetParent() if not parent:IsIllusion() and parent.GetEnergy then local ability = self:GetAbility() if ability:IsCooldownReady() and parent:GetEnergy() >= ability:GetSpecialValueFor("energy_const") + parent:GetMaxEnergy() * ability:GetSpecialValueFor("energy_pct") * 0.01 then return 1 end end end end modifier_sara_fragment_of_logic_debuff = class({ IsPurgable = function() return false end, IsDebuff = function() return true end, })
local function Finish(Thread, Success, ...) if not Success then warn(debug.traceback(Thread, tostring((...)))) end return Success, ... end local function FastSpawn(Function, ...) local Thread = coroutine.create(Function) return Finish(Thread, coroutine.resume(Thread, ...)) end return FastSpawn
--TODO: check if you can use lua type boolean instead of strings and pass that back to osm2pgsql --with the hopes that they will become strings once they get back to c++ and then just work in --postgres highway = { ["motorway"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "false", ["motorcycle_forward"] = "true", ["pedestrian"] = "false", ["bike_forward"] = "false"}, ["motorway_link"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "false", ["motorcycle_forward"] = "true", ["pedestrian"] = "false", ["bike_forward"] = "false"}, ["trunk"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["trunk_link"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["primary"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["primary_link"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["secondary"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["secondary_link"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["residential"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["residential_link"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["service"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["tertiary"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["tertiary_link"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["road"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["track"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["unclassified"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["undefined"] = {["auto_forward"] = "false", ["truck_forward"] = "false", ["bus_forward"] = "false", ["taxi_forward"] = "false", ["moped_forward"] = "false", ["motorcycle_forward"] = "false", ["pedestrian"] = "false", ["bike_forward"] = "false"}, ["unknown"] = {["auto_forward"] = "false", ["truck_forward"] = "false", ["bus_forward"] = "false", ["taxi_forward"] = "false", ["moped_forward"] = "false", ["motorcycle_forward"] = "false", ["pedestrian"] = "false", ["bike_forward"] = "false"}, ["living_street"] = {["auto_forward"] = "true", ["truck_forward"] = "true", ["bus_forward"] = "true", ["taxi_forward"] = "true", ["moped_forward"] = "true", ["motorcycle_forward"] = "true", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["footway"] = {["auto_forward"] = "false", ["truck_forward"] = "false", ["bus_forward"] = "false", ["taxi_forward"] = "false", ["moped_forward"] = "false", ["motorcycle_forward"] = "false", ["pedestrian"] = "true", ["bike_forward"] = "false"}, ["pedestrian"] = {["auto_forward"] = "false", ["truck_forward"] = "false", ["bus_forward"] = "false", ["taxi_forward"] = "false", ["moped_forward"] = "false", ["motorcycle_forward"] = "false", ["pedestrian"] = "true", ["bike_forward"] = "false"}, ["steps"] = {["auto_forward"] = "false", ["truck_forward"] = "false", ["bus_forward"] = "false", ["taxi_forward"] = "false", ["moped_forward"] = "false", ["motorcycle_forward"] = "false", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["bridleway"] = {["auto_forward"] = "false", ["truck_forward"] = "false", ["bus_forward"] = "false", ["taxi_forward"] = "false", ["moped_forward"] = "false", ["motorcycle_forward"] = "false", ["pedestrian"] = "false", ["bike_forward"] = "false"}, ["construction"] = {["auto_forward"] = "false", ["truck_forward"] = "false", ["bus_forward"] = "false", ["taxi_forward"] = "false", ["moped_forward"] = "false", ["motorcycle_forward"] = "false", ["pedestrian"] = "false", ["bike_forward"] = "false"}, ["cycleway"] = {["auto_forward"] = "false", ["truck_forward"] = "false", ["bus_forward"] = "false", ["taxi_forward"] = "false", ["moped_forward"] = "false", ["motorcycle_forward"] = "false", ["pedestrian"] = "false", ["bike_forward"] = "true"}, ["path"] = {["auto_forward"] = "false", ["truck_forward"] = "false", ["bus_forward"] = "false", ["taxi_forward"] = "false", ["moped_forward"] = "false", ["motorcycle_forward"] = "false", ["pedestrian"] = "true", ["bike_forward"] = "true"}, ["bus_guideway"] = {["auto_forward"] = "false", ["truck_forward"] = "false", ["bus_forward"] = "true", ["taxi_forward"] = "false", ["moped_forward"] = "false", ["motorcycle_forward"] = "false", ["pedestrian"] = "false", ["bike_forward"] = "false"} } road_class = { ["motorway"] = 0, ["motorway_link"] = 0, ["trunk"] = 1, ["trunk_link"] = 1, ["primary"] = 2, ["primary_link"] = 2, ["secondary"] = 3, ["secondary_link"] = 3, ["tertiary"] = 4, ["tertiary_link"] = 4, ["unclassified"] = 5, ["residential"] = 6, ["residential_link"] = 6 } restriction = { ["no_left_turn"] = 0, ["no_right_turn"] = 1, ["no_straight_on"] = 2, ["no_u_turn"] = 3, ["only_right_turn"] = 4, ["only_left_turn"] = 5, ["only_straight_on"] = 6, ["no_entry"] = 7, ["no_exit"] = 8, ["no_turn"] = 9 } --the default speed for tracks is lowered after --the call to default_speed default_speed = { [0] = 105, [1] = 90, [2] = 75, [3] = 60, [4] = 50, [5] = 40, [6] = 35, [7] = 25 } access = { ["yes"] = "true", ["private"] = "true", ["no"] = "false", ["permissive"] = "true", ["agricultural"] = "false", ["use_sidepath"] = "true", ["delivery"] = "true", ["designated"] = "true", ["dismount"] = "true", ["discouraged"] = "false", ["forestry"] = "false", ["destination"] = "true", ["customers"] = "true", ["official"] = "false", ["public"] = "true", ["restricted"] = "true", ["allowed"] = "true", ["emergency"] = "false" } private = { ["private"] = "true", ["destination"] = "true", ["customers"] = "true", ["delivery"] = "true" } no_thru_traffic = { ["destination"] = "true", ["customers"] = "true", ["delivery"] = "true" } sidewalk = { ["both"] = "true", ["none"] = "false", ["no"] = "false", ["right"] = "true", ["left"] = "true", ["separate"] = "false", ["yes"] = "true", ["shared"] = "true", ["this"] = "true", ["detached"] = "false", ["raised"] = "true", ["separate_double"] = "false", ["sidepath"] = "false", ["explicit"] = "true" } use = { ["driveway"] = 4, ["alley"] = 5, ["parking_aisle"] = 6, ["emergency_access"] = 7, ["drive-through"] = 8 } motor_vehicle = { ["yes"] = "true", ["private"] = "true", ["no"] = "false", ["permissive"] = "true", ["agricultural"] = "false", ["delivery"] = "true", ["designated"] = "true", ["discouraged"] = "false", ["forestry"] = "false", ["destination"] = "true", ["customers"] = "true", ["official"] = "false", ["public"] = "true", ["restricted"] = "true", ["allowed"] = "true" } moped = { ["yes"] = "true", ["designated"] = "true", ["private"] = "true", ["permissive"] = "true", ["destination"] = "true", ["delivery"] = "true", ["dismount"] = "true", ["no"] = "false", ["unknown"] = "false", ["agricultural"] = "false" } foot = { ["yes"] = "true", ["private"] = "true", ["no"] = "false", ["permissive"] = "true", ["agricultural"] = "false", ["use_sidepath"] = "true", ["delivery"] = "true", ["designated"] = "true", ["discouraged"] = "false", ["forestry"] = "false", ["destination"] = "true", ["customers"] = "true", ["official"] = "true", ["public"] = "true", ["restricted"] = "true", ["crossing"] = "true", ["sidewalk"] = "true", ["allowed"] = "true", ["passable"] = "true", ["footway"] = "true" } wheelchair = { ["no"] = "false", ["yes"] = "true", ["designated"] = "true", ["limited"] = "true", ["official"] = "true", ["destination"] = "true", ["public"] = "true", ["permissive"] = "true", ["only"] = "true", ["private"] = "true", ["impassable"] = "false", ["partial"] = "false", ["bad"] = "false", ["half"] = "false", ["assisted"] = "true" } bus = { ["no"] = "false", ["yes"] = "true", ["designated"] = "true", ["urban"] = "true", ["permissive"] = "true", ["restricted"] = "true", ["destination"] = "true", ["delivery"] = "false", ["official"] = "false" } taxi = { ["no"] = "false", ["yes"] = "true", ["designated"] = "true", ["urban"] = "true", ["permissive"] = "true", ["restricted"] = "true", ["destination"] = "true", ["delivery"] = "false", ["official"] = "false" } psv = { ["bus"] = "true", ["taxi"] = "true", ["no"] = "false", ["yes"] = "true", ["designated"] = "true", ["permissive"] = "true", ["1"] = "true", ["2"] = "true" } truck = { ["designated"] = "true", ["yes"] = "true", ["no"] = "false", ["destination"] = "true", ["delivery"] = "true", ["local"] = "true", ["agricultural"] = "false", ["private"] = "true", ["discouraged"] = "false", ["permissive"] = "false", ["unsuitable"] = "false", ["agricultural;forestry"] = "false", ["official"] = "false", ["forestry"] = "false", ["destination;delivery"] = "true" } hazmat = { ["designated"] = "true", ["yes"] = "true", ["no"] = "false", ["destination"] = "true", ["delivery"] = "true" } shoulder = { ["yes"] = "true", ["both"] = "true", ["no"] = "false" } shoulder_right = { ["right"] = "true" } shoulder_left = { ["left"] = "true" } bicycle = { ["yes"] = "true", ["designated"] = "true", ["use_sidepath"] = "true", ["no"] = "false", ["permissive"] = "true", ["destination"] = "true", ["dismount"] = "true", ["lane"] = "true", ["track"] = "true", ["shared"] = "true", ["shared_lane"] = "true", ["sidepath"] = "true", ["share_busway"] = "true", ["none"] = "false", ["allowed"] = "true", ["private"] = "true", ["official"] = "true" } cycleway = { ["yes"] = "true", ["designated"] = "true", ["use_sidepath"] = "true", ["permissive"] = "true", ["destination"] = "true", ["dismount"] = "true", ["lane"] = "true", ["track"] = "true", ["shared"] = "true", ["shared_lane"] = "true", ["sidepath"] = "true", ["share_busway"] = "true", ["allowed"] = "true", ["private"] = "true", ["cyclestreet"] = "true", ["crossing"] = "true" } bike_reverse = { ["opposite"] = "true", ["opposite_lane"] = "true", ["opposite_track"] = "true" } bus_reverse = { ["opposite"] = "true", ["opposite_lane"] = "true" } shared = { ["shared_lane"] = 1, ["share_busway"] = 1, ["shared"] = 1 } buffer = { ["yes"] = 2 } dedicated = { ["opposite_lane"] = 2, ["lane"] = 2, ["buffered_lane"] = 2 } separated = { ["opposite_track"] = 3, ["track"] = 3 } oneway = { ["no"] = "false", ["-1"] = "true", ["yes"] = "true", ["true"] = "true", ["1"] = "true" } bridge = { ["yes"] = "true", ["no"] = "false", ["1"] = "true" } --TODO: building_passage is for ped only tunnel = { ["yes"] = "true", ["no"] = "false", ["1"] = "true", ["building_passage"] = "true" } --TODO: snowmobile might not really be passable for much other than ped.. toll = { ["yes"] = "true", ["no"] = "false", ["true"] = "true", ["false"] = "false", ["1"] = "true", ["interval"] = "true", ["snowmobile"] = "true" } --node proc needs the same info as above but in the form of a mask so duplicate.. motor_vehicle_node = { ["yes"] = 1, ["private"] = 1, ["no"] = 0, ["permissive"] = 1, ["agricultural"] = 0, ["delivery"] = 1, ["designated"] = 1, ["discouraged"] = 0, ["forestry"] = 0, ["destination"] = 1, ["customers"] = 1, ["official"] = 0, ["public"] = 1, ["restricted"] = 1, ["allowed"] = 1 } bicycle_node = { ["yes"] = 4, ["designated"] = 4, ["use_sidepath"] = 4, ["no"] = 0, ["permissive"] = 4, ["destination"] = 4, ["dismount"] = 4, ["lane"] = 4, ["track"] = 4, ["shared"] = 4, ["shared_lane"] = 4, ["sidepath"] = 4, ["share_busway"] = 4, ["none"] = 0, ["allowed"] = 4, ["private"] = 4, ["official"] = 4 } foot_node = { ["yes"] = 2, ["private"] = 2, ["no"] = 0, ["permissive"] = 2, ["agricultural"] = 0, ["use_sidepath"] = 2, ["delivery"] = 2, ["designated"] = 2, ["discouraged"] = 0, ["forestry"] = 0, ["destination"] = 2, ["customers"] = 2, ["official"] = 2, ["public"] = 2, ["restricted"] = 2, ["crossing"] = 2, ["sidewalk"] = 2, ["allowed"] = 2, ["passable"] = 2, ["footway"] = 2 } wheelchair_node = { ["no"] = 0, ["yes"] = 256, ["designated"] = 256, ["limited"] = 256, ["official"] = 256, ["destination"] = 256, ["public"] = 256, ["permissive"] = 256, ["only"] = 256, ["private"] = 256, ["impassable"] = 0, ["partial"] = 0, ["bad"] = 0, ["half"] = 0, ["assisted"] = 256 } moped_node = { ["yes"] = 512, ["designated"] = 512, ["private"] = 512, ["permissive"] = 512, ["destination"] = 512, ["delivery"] = 512, ["dismount"] = 512, ["no"] = 0, ["unknown"] = 0, ["agricultural"] = 0 } motor_cycle_node = { ["yes"] = 1024, ["private"] = 1024, ["no"] = 0, ["permissive"] = 1024, ["agricultural"] = 0, ["delivery"] = 1024, ["designated"] = 1024, ["discouraged"] = 0, ["forestry"] = 0, ["destination"] = 1024, ["customers"] = 1024, ["official"] = 0, ["public"] = 1024, ["restricted"] = 1024, ["allowed"] = 1024 } bus_node = { ["no"] = 0, ["yes"] = 64, ["designated"] = 64, ["urban"] = 64, ["permissive"] = 64, ["restricted"] = 64, ["destination"] = 64, ["delivery"] = 0, ["official"] = 0, } taxi_node = { ["no"] = 0, ["yes"] = 32, ["designated"] = 32, ["urban"] = 32, ["permissive"] = 32, ["restricted"] = 32, ["destination"] = 32, ["delivery"] = 0, ["official"] = 0 } truck_node = { ["designated"] = 8, ["yes"] = 8, ["no"] = 0, ["destination"] = 8, ["delivery"] = 8, ["local"] = 8, ["agricultural"] = 0, ["private"] = 8, ["discouraged"] = 0, ["permissive"] = 0, ["unsuitable"] = 0, ["agricultural;forestry"] = 0, ["official"] = 0, ["forestry"] = 0, ["destination;delivery"] = 8 } psv_bus_node = { ["bus"] = 64, ["no"] = 0, ["yes"] = 64, ["designated"] = 64, ["permissive"] = 64, ["1"] = 64, ["2"] = 64 } psv_taxi_node = { ["taxi"] = 32, ["no"] = 0, ["yes"] = 32, ["designated"] = 32, ["permissive"] = 32, ["1"] = 32, ["2"] = 32 } function round(val, n) if (n) then return math.floor( (val * 10^n) + 0.5) / (10^n) else return math.floor(val+0.5) end end function restriction_prefix(restriction_str) --not a string if restriction_str == nil then return nil end --find where the restriction type ends. --format looks like --restriction:conditional=no_left_turn @ (07:00-09:00,15:30-17:30) local index = 0 local found = false for c in restriction_str:gmatch"." do if c == "@" then found = true break end if c ~= " " then index = index + 1 end end --@ symbol did not exist if found == false then return nil end --return the type of restriction return restriction_str:sub(0, index) end function restriction_suffix(restriction_str) --not a string if restriction_str == nil then return nil end --find where the restriction type ends. --format looks like --restriction:conditional=no_left_turn @ (07:00-09:00,15:30-17:30) local index = 0 local found = false for c in restriction_str:gmatch"." do if found == true then if c ~= " " then index = index + 1 break end elseif c == "@" then found = true end index = index + 1 end --@ symbol did not exist if found == false then return nil end --return the date and time information for the restriction return restriction_str:sub(index, string.len(restriction_str)) end --convert the numeric (non negative) number portion at the beginning of the string function numeric_prefix(num_str, allow_decimals) --not a string if num_str == nil then return nil end --find where the numbers stop local index = 0 -- flag to say if we've seen a decimal dot already. we shouldn't allow two, -- otherwise the call to tonumber() might fail. local seen_dot = false for c in num_str:gmatch"." do if tonumber(c) == nil then if c == "." then if allow_decimals == false or seen_dot then break end seen_dot = true else break end end index = index + 1 end --there weren't any numbers if index == 0 then return nil end --Returns the substring that's numeric at the start of num_str return num_str:sub(0, index) end --normalize a speed value function normalize_speed(speed) --grab the number prefix local num = tonumber(numeric_prefix(speed, false)) --check if the rest of the string ends in "mph" convert to kph if num then if speed:sub(-3) == "mph" then num = round(num * 1.609344) end --if num > 150kph or num < 10kph....toss if num > 150 or num < 10 then return nil end end return num end function normalize_weight(weight) if weight then local w = weight:gsub("%s+", "") --grab the number prefix local num = numeric_prefix(w, true) if num then if w:sub(-1) == "t" or w:sub(-5) == "tonne" or w:sub(-6) == "tonnes" then if (num .. "t" == w) or (num .. "tonne" == w) or (num .. "tonnes" == w) then return round(tonumber(num),2) end end if w:sub(-3) == "ton" or w:sub(-4) == "tons" then if (num .. "ton" == w) or (num .. "tons" == w) then return round(tonumber(num),2) end end if w:sub(-2) == "lb" or w:sub(-3) == "lbs" then if (num .. "lb" == w) or (num .. "lbs" == w) then return round((tonumber(num)/2000),2) -- convert to tons end end if w:sub(-2) == "kg" then if (num .. "kg" == w) then return round((tonumber(num)/1000),2) end end return round(tonumber(num),2) --3.5 end end return nil end function normalize_measurement(measurement) if measurement then -- turn commas into dots to handle European-style decimal separators measurement = measurement:gsub(",", ".") -- handle the simple case: it's just a plain number local num = tonumber(measurement) if num then return round(num, 2) end -- more complicated case, try some Lua patterns. they're almost like regular -- expressions, so there'll probably be some unintended consequences! -- -- because we want to parse compount expressions such as 3ft6in, then we use -- an accumulator to sum up each term in meters. this has the unintended -- side-effect that 10m6ft would also be valid... but whatever. local sum = 0 local count = 0 for item, unit in measurement:gmatch("(%d+[.,]?%d*) *([a-zA-Z\"\']*)") do -- just in case the pattern above matches some things that tonumber() -- disagrees are valid numbers, we'll bail here if we don't get a valid -- number. item_num = tonumber(item) if not item_num then return nil end -- case shouldn't matter for units, so just lower case everything before -- comparing. unit = unit:lower() if unit == "m" or unit == "meter" or unit == "meters" then sum = sum + item_num elseif unit == "cm" then sum = sum + item_num * 0.01 elseif (unit == "ft" or unit == "feet" or unit == "foot" or unit == "'") then sum = sum + item_num * 0.3048 elseif (unit == "in" or unit == "inches" or unit == "inch" or unit == "\"" or unit == "''") then sum = sum + item_num * 0.0254 else -- unknown unit! bail! return nil end -- increment counter, so we can check how many parts we parsed (mainly to -- make sure it's not none at all). count = count + 1 end if count > 0 then -- if we got here, then the units seem valid. yay! now we round to two -- decimal digits, because precision of less than a centimeter seems -- unnecessary. return round(sum, 2) end end return nil end --returns 1 if you should filter this way 0 otherwise function filter_tags_generic(kv) if (kv["highway"] == "construction" or kv["highway"] == "proposed") then return 1 end --figure out what basic type of road it is local forward = highway[kv["highway"]] local ferry = kv["route"] == "ferry" local rail = kv["route"] == "shuttle_train" local access = access[kv["access"]] kv["emergency_forward"] = "false" kv["emergency_backward"] = "false" if (ferry == true or rail == true or kv["highway"]) then if (kv["access"] == "emergency" or kv["emergency"] == "yes" or kv["service"] == "emergency_access") then kv["emergency_forward"] = "true" kv["emergency_tag"] = "true" end if kv["emergency"] == "no" then kv["emergency_tag"] = "false" end end if forward then for k,v in pairs(forward) do kv[k] = v end if kv["impassable"] == "yes" or access == "false" or (kv["access"] == "private" and (kv["emergency"] == "yes" or kv["service"] == "emergency_access")) then kv["auto_forward"] = "false" kv["truck_forward"] = "false" kv["bus_forward"] = "false" kv["taxi_forward"] = "false" kv["moped_forward"] = "false" kv["motorcycle_forward"] = "false" kv["pedestrian"] = "false" kv["bike_forward"] = "false" kv["auto_backward"] = "false" kv["truck_backward"] = "false" kv["bus_backward"] = "false" kv["taxi_backward"] = "false" kv["moped_backward"] = "false" kv["motorcycle_backward"] = "false" kv["bike_backward"] = "false" elseif kv["vehicle"] == "no" then --don't change ped access. kv["auto_forward"] = "false" kv["truck_forward"] = "false" kv["bus_forward"] = "false" kv["taxi_forward"] = "false" kv["moped_forward"] = "false" kv["motorcycle_forward"] = "false" kv["bike_forward"] = "false" kv["auto_backward"] = "false" kv["truck_backward"] = "false" kv["bus_backward"] = "false" kv["taxi_backward"] = "false" kv["moped_backward"] = "false" kv["motorcycle_backward"] = "false" kv["bike_backward"] = "false" end --check for auto_forward overrides kv["auto_forward"] = motor_vehicle[kv["motorcar"]] or motor_vehicle[kv["motor_vehicle"]] or kv["auto_forward"] kv["auto_tag"] = motor_vehicle[kv["motorcar"]] or motor_vehicle[kv["motor_vehicle"]] or nil --check for truck_forward override kv["truck_forward"] = truck[kv["hgv"]] or motor_vehicle[kv["motor_vehicle"]] or kv["truck_forward"] kv["truck_tag"] = truck[kv["hgv"]] or motor_vehicle[kv["motor_vehicle"]] or nil --check for bus_forward overrides kv["bus_forward"] = bus[kv["bus"]] or psv[kv["psv"]] or psv[kv["lanes:psv:forward"]] or motor_vehicle[kv["motor_vehicle"]] or kv["bus_forward"] kv["bus_tag"] = bus[kv["bus"]] or psv[kv["psv"]] or psv[kv["lanes:psv:forward"]] or motor_vehicle[kv["motor_vehicle"]] or nil --check for taxi_forward overrides kv["taxi_forward"] = taxi[kv["taxi"]] or psv[kv["psv"]] or psv[kv["lanes:psv:forward"]] or motor_vehicle[kv["motor_vehicle"]] or kv["taxi_forward"] kv["taxi_tag"] = taxi[kv["taxi"]] or psv[kv["psv"]] or psv[kv["lanes:psv:forward"]] or motor_vehicle[kv["motor_vehicle"]] or nil --check for ped overrides kv["pedestrian"] = foot[kv["foot"]] or foot[kv["pedestrian"]] or kv["pedestrian"] kv["foot_tag"] = foot[kv["foot"]] or foot[kv["pedestrian"]] or nil --check for bike_forward overrides kv["bike_forward"] = bicycle[kv["bicycle"]] or cycleway[kv["cycleway"]] or bicycle[kv["bicycle_road"]] or bicycle[kv["cyclestreet"]] or kv["bike_forward"] kv["bike_tag"] = bicycle[kv["bicycle"]] or cycleway[kv["cycleway"]] or bicycle[kv["bicycle_road"]] or bicycle[kv["cyclestreet"]] or nil --check for moped forward overrides kv["moped_forward"] = moped[kv["moped"]] or moped[kv["mofa"]] or motor_vehicle[kv["motor_vehicle"]] or kv["moped_forward"] kv["moped_tag"] = moped[kv["moped"]] or moped[kv["mofa"]] or motor_vehicle[kv["motor_vehicle"]] or nil --check for motorcycle forward overrides kv["motorcycle_forward"] = motor_vehicle[kv["motorcycle"]] or motor_vehicle[kv["motor_vehicle"]] or kv["motorcycle_forward"] kv["motorcycle_tag"] = motor_vehicle[kv["motorcycle"]] or motor_vehicle[kv["motor_vehicle"]] or nil if kv["bike_tag"] == nil then if kv["sac_scale"] == "hiking" then kv["bike_forward"] = "true" kv["bike_tag"] = "true" elseif kv["sac_scale"] then kv["bike_forward"] = "false" end end if kv["motorroad"] == "yes" then kv["motorroad_tag"] = "true" end else --if its a ferry and these tags dont show up we want to set them to true local default_val = tostring(ferry) if ferry == false and rail == true then default_val = tostring(rail) end if ((ferry == false and rail == false) or kv["impassable"] == "yes" or access == "false" or (kv["access"] == "private" and (kv["emergency"] == "yes" or kv["service"] == "emergency_access"))) then kv["auto_forward"] = "false" kv["truck_forward"] = "false" kv["bus_forward"] = "false" kv["taxi_forward"] = "false" kv["moped_forward"] = "false" kv["motorcycle_forward"] = "false" kv["pedestrian"] = "false" kv["bike_forward"] = "false" kv["auto_backward"] = "false" kv["truck_backward"] = "false" kv["bus_backward"] = "false" kv["taxi_backward"] = "false" kv["moped_backward"] = "false" kv["motorcycle_backward"] = "false" kv["bike_backward"] = "false" else local ped_val = default_val if kv["vehicle"] == "no" then --don't change ped access. default_val = "false" end --check for auto_forward overrides kv["auto_forward"] = motor_vehicle[kv["motorcar"]] or motor_vehicle[kv["motor_vehicle"]] or default_val kv["auto_tag"] = motor_vehicle[kv["motorcar"]] or motor_vehicle[kv["motor_vehicle"]] or nil --check for truck_forward override kv["truck_forward"] = truck[kv["hgv"]] or kv["truck_forward"] or motor_vehicle[kv["motor_vehicle"]] or default_val kv["truck_tag"] = truck[kv["hgv"]] or motor_vehicle[kv["motor_vehicle"]] or nil --check for bus_forward overrides kv["bus_forward"] = bus[kv["bus"]] or psv[kv["psv"]] or psv[kv["lanes:psv:forward"]] or motor_vehicle[kv["motor_vehicle"]] or default_val kv["bus_tag"] = bus[kv["bus"]] or psv[kv["psv"]] or psv[kv["lanes:psv:forward"]] or motor_vehicle[kv["motor_vehicle"]] or nil --check for taxi_forward overrides kv["taxi_forward"] = taxi[kv["taxi"]] or psv[kv["psv"]] or psv[kv["lanes:psv:forward"]] or motor_vehicle[kv["motor_vehicle"]] or default_val kv["taxi_tag"] = taxi[kv["taxi"]] or psv[kv["psv"]] or psv[kv["lanes:psv:forward"]] or motor_vehicle[kv["motor_vehicle"]] or nil --check for ped overrides kv["pedestrian"] = foot[kv["foot"]] or foot[kv["pedestrian"]] or ped_val kv["foot_tag"] = foot[kv["foot"]] or foot[kv["pedestrian"]] or nil --check for bike_forward overrides kv["bike_forward"] = bicycle[kv["bicycle"]] or cycleway[kv["cycleway"]] or bicycle[kv["bicycle_road"]] or bicycle[kv["cyclestreet"]] or default_val kv["bike_tag"] = bicycle[kv["bicycle"]] or cycleway[kv["cycleway"]] or bicycle[kv["bicycle_road"]] or bicycle[kv["cyclestreet"]] or nil --check for moped forward overrides kv["moped_forward"] = moped[kv["moped"]] or moped[kv["mofa"]] or motor_vehicle[kv["motor_vehicle"]] or default_val kv["moped_tag"] = moped[kv["moped"]] or moped[kv["mofa"]] or motor_vehicle[kv["motor_vehicle"]] or nil --check for motorcycle forward overrides kv["motorcycle_forward"] = motor_vehicle[kv["motorcycle"]] or motor_vehicle[kv["motor_vehicle"]] or default_val kv["motorcycle_tag"] = motor_vehicle[kv["motorcycle"]] or motor_vehicle[kv["motor_vehicle"]] or nil if kv["bike_tag"] == nil then if kv["sac_scale"] == "hiking" then kv["bike_forward"] = "true" kv["bike_tag"] = "true" elseif kv["sac_scale"] then kv["bike_forward"] = "false" end end if kv["motorroad"] == "yes" then kv["motorroad_tag"] = "true" end end end --TODO: handle Time conditional restrictions if available for HOVs with oneway = reversible if ((kv["access"] == "permissive" or kv["access"] == "hov" or kv["access"] == "taxi") and kv["oneway"] == "reversible") then -- for now enable only for buses if the tag exists and they are allowed. if (kv["bus_forward"] == "true") then kv["auto_forward"] = "false" kv["truck_forward"] = "false" kv["pedestrian"] = "false" kv["bike_forward"] = "false" kv["moped_forward"] = "false" kv["motorcycle_forward"] = "false" else return 1 end end --service=driveway means all are routable if kv["service"] == "driveway" and kv["access"] == nil then kv["auto_forward"] = "true" kv["truck_forward"] = "true" kv["bus_forward"] = "true" kv["taxi_forward"] = "true" kv["pedestrian"] = "true" kv["bike_forward"] = "true" kv["moped_forward"] = "true" kv["motorcycle_forward"] = "true" end --check the oneway-ness and traversability against the direction of the geom if ((kv["oneway"] == "yes" and kv["oneway:bicycle"] == "no") or kv["bicycle:backward"] == "yes" or kv["bicycle:backward"] == "no") then kv["bike_backward"] = "true" end if kv["bike_backward"] == nil or kv["bike_backward"] == "false" then kv["bike_backward"] = bike_reverse[kv["cycleway"]] or bike_reverse[kv["cycleway:left"]] or bike_reverse[kv["cycleway:right"]] or "false" end if kv["bike_backward"] == "true" then oneway_bike = oneway[kv["oneway:bicycle"]] end if kv["oneway:bus"] == nil and kv["oneway:psv"] ~= nil then kv["oneway:bus"] = kv["oneway:psv"] end if ((kv["oneway"] == "yes" and kv["oneway:bus"] == "no") or kv["bus:backward"] == "yes" or kv["bus:backward"] == "designated") then kv["bus_backward"] = "true" end if kv["bus_backward"] == nil or kv["bus_backward"] == "false" then kv["bus_backward"] = bus_reverse[kv["busway"]] or bus_reverse[kv["busway:left"]] or bus_reverse[kv["busway:right"]] or psv[kv["lanes:psv:backward"]] or "false" end if kv["bus_backward"] == "true" then oneway_bus = oneway[kv["oneway:bus"]] if (oneway_bus == "false" and kv["bus:backward"] == "yes") then oneway_bus = "true" end end if kv["oneway:taxi"] == nil and kv["oneway:psv"] ~= nil then kv["oneway:taxi"] = kv["oneway:psv"] end if ((kv["oneway"] == "yes" and kv["oneway:taxi"] == "no") or kv["taxi:backward"] == "yes" or kv["taxi:backward"] == "designated") then kv["taxi_backward"] = "true" end if kv["taxi_backward"] == nil or kv["taxi_backward"] == "false" then kv["taxi_backward"] = psv[kv["lanes:psv:backward"]] or "false" end if kv["taxi_backward"] == "true" then oneway_taxi = oneway[kv["oneway:taxi"]] if (oneway_taxi == "false" and kv["taxi:backward"] == "yes") then oneway_taxi = "true" end end if kv["moped_backward"] == nil then kv["moped_backward"] = "false" end if ((kv["oneway"] == "yes" and (kv["oneway:moped"] == "no" or kv["oneway:mofa"] == "no")) or kv["moped:backward"] == "yes" or kv["mofa:backward"] == "yes") then kv["moped_backward"] = "true" end if kv["moped_backward"] == "true" then oneway_moped = oneway[kv["oneway:moped"]] or oneway[kv["oneway:mofa"]] end if kv["motorcycle_backward"] == nil then kv["motorcycle_backward"] = "false" end if ((kv["oneway"] == "yes" and kv["oneway:motorcycle"] == "no") or kv["motorcycle:backward"] == "yes") then kv["motorcycle_backward"] = "true" end if kv["motorcycle_backward"] == "true" then oneway_motorcycle = oneway[kv["oneway:motorcycle"]] end local oneway_reverse = kv["oneway"] local oneway_norm = oneway[kv["oneway"]] if kv["junction"] == "roundabout" or kv["junction"] == "circular" then oneway_norm = "true" kv["roundabout"] = "true" else kv["roundabout"] = "false" end kv["oneway"] = oneway_norm if oneway_norm == "true" then kv["auto_backward"] = "false" kv["truck_backward"] = "false" kv["emergency_backward"] = "false" if kv["bike_backward"] == "true" then if (oneway_bike == "true") then --bike only in reverse on a bike path. kv["bike_forward"] = "false" elseif oneway_bike == "false" then --bike in both directions on a bike path. kv["bike_forward"] = "true" end end if kv["bus_backward"] == "true" then if (oneway_bus == "true") then --bus only in reverse on a bus path. kv["bus_forward"] = "false" elseif oneway_bus == "false" then --bus in both directions on a bus path. kv["bus_forward"] = "true" end end if kv["taxi_backward"] == "true" then if (oneway_taxi == "true") then --taxi only in reverse on a taxi path. kv["taxi_forward"] = "false" elseif oneway_taxi == "false" then --taxi in both directions on a taxi path. kv["taxi_forward"] = "true" end end if kv["moped_backward"] == "true" then if (oneway_moped == "true") then --moped only in reverse direction on street kv["moped_forward"] = "false" elseif oneway_moped == "false" then kv["moped_forward"] = "true" end end if kv["motorcycle_backward"] == "true" then if (oneway_motorcycle == "true") then --motorcycle only in reverse direction on street kv["motorcycle_forward"] = "false" elseif oneway_motorcycle == "false" then kv["motorcycle_forward"] = "true" end end elseif oneway_norm == nil or oneway_norm == "false" then kv["auto_backward"] = kv["auto_forward"] kv["truck_backward"] = kv["truck_forward"] kv["emergency_backward"] = kv["emergency_forward"] if (kv["bike_backward"] == "false" and kv["oneway:bicycle"] ~= "-1" and (kv["oneway:bicycle"] == nil or oneway[kv["oneway:bicycle"]] == false or kv["oneway:bicycle"] == "no")) then kv["bike_backward"] = kv["bike_forward"] end if (kv["bus_backward"] == "false" and kv["oneway:bus"] ~= "-1" and (kv["oneway:bus"] == nil or oneway[kv["oneway:bus"]] == false)) then kv["bus_backward"] = kv["bus_forward"] end if (kv["taxi_backward"] == "false" and kv["oneway:taxi"] ~= "-1" and (kv["oneway:taxi"] == nil or oneway[kv["oneway:taxi"]] == false)) then kv["taxi_backward"] = kv["taxi_forward"] end if (kv["moped_backward"] == "false" and (kv["oneway:moped"] == nil or oneway[kv["oneway:moped"]] == false or kv["oneway:moped"] == "no") and (kv["oneway:mofa"] == nil or oneway[kv["oneway:mofa"]] == false or kv["oneway:mofa"] == "no")) then kv["moped_backward"] = kv["moped_forward"] end if (kv["motorcycle_backward"] == "false" and (kv["oneway:motorcycle"] == nil or oneway[kv["oneway:motorcycle"]] == false or kv["oneway:motorcycle"] == "no")) then kv["motorcycle_backward"] = kv["motorcycle_forward"] end end --Bike forward / backward overrides. if ((shared[kv["cycleway:both"]] or separated[kv["cycleway:both"]] or dedicated[kv["cycleway:both"]]) or ((shared[kv["cycleway:right"]] or separated[kv["cycleway:right"]] or dedicated[kv["cycleway:right"]]) and (shared[kv["cycleway:left"]] or separated[kv["cycleway:left"]] or dedicated[kv["cycleway:left"]]))) then kv["bike_forward"] = "true" kv["bike_backward"] = "true" end if (kv["busway"] == "lane" or (kv["busway:left"] == "lane" and kv["busway:right"] == "lane")) then kv["bus_forward"] = "true" kv["bus_backward"] = "true" end kv["oneway_reverse"] = "false" --flip the onewayness if oneway_reverse == "-1" then kv["oneway_reverse"] = "true" local forwards = kv["auto_forward"] kv["auto_forward"] = kv["auto_backward"] kv["auto_backward"] = forwards forwards = kv["truck_forward"] kv["truck_forward"] = kv["truck_backward"] kv["truck_backward"] = forwards forwards = kv["emergency_forward"] kv["emergency_forward"] = kv["emergency_backward"] kv["emergency_backward"] = forwards forwards = kv["bus_forward"] kv["bus_forward"] = kv["bus_backward"] kv["bus_backward"] = forwards forwards = kv["taxi_forward"] kv["taxi_forward"] = kv["taxi_backward"] kv["taxi_backward"] = forwards forwards = kv["bike_forward"] kv["bike_forward"] = kv["bike_backward"] kv["bike_backward"] = forwards forwards = kv["moped_forward"] kv["moped_forward"] = kv["moped_backward"] kv["moped_backward"] = forwards forwards = kv["motorcycle_forward"] kv["motorcycle_forward"] = kv["motorcycle_backward"] kv["motorcycle_backward"] = forwards end if kv["oneway:bicycle"] == "-1" then local forwards = kv["bike_forward"] kv["bike_forward"] = kv["bike_backward"] kv["bike_backward"] = forwards end if kv["oneway:bus"] == "-1" then local forwards = kv["bus_forward"] kv["bus_forward"] = kv["bus_backward"] kv["bus_backward"] = forwards end -- bus only logic if kv["lanes:bus"] == "1" then kv["bus_forward"] = "true" kv["bus_backward"] = "false" elseif kv["lanes:bus"] == "2" then kv["bus_forward"] = "true" kv["bus_backward"] = "true" end if kv["oneway:taxi"] == "-1" then local forwards = kv["taxi_forward"] kv["taxi_forward"] = kv["taxi_backward"] kv["taxi_backward"] = forwards end if kv["lanes:psv"] == "1" then kv["taxi_forward"] = "true" kv["taxi_backward"] = "false" elseif kv["lanes:psv"] == "2" then kv["taxi_forward"] = "true" kv["taxi_backward"] = "true" end --if none of the modes were set we are done looking at this if kv["auto_forward"] == "false" and kv["truck_forward"] == "false" and kv["bus_forward"] == "false" and kv["bike_forward"] == "false" and kv["emergency_forward"] == "false" and kv["moped_forward"] == "false" and kv["motorcycle_forward"] == "false" and kv["auto_backward"] == "false" and kv["truck_backward"] == "false" and kv["bus_backward"] == "false" and kv["bike_backward"] == "false" and kv["emergency_backward"] == "false" and kv["moped_backward"] == "false" and kv["motorcycle_backward"] == "false" and kv["pedestrian"] == "false" then if kv["highway"] ~= "bridleway" then --save bridleways for country access logic. return 1 end end --toss actual areas if kv["area"] == "yes" then return 1 end delete_tags = { 'FIXME', 'note', 'source' } for i,k in ipairs(delete_tags) do kv[k] = nil end --set a few flags local road_class = road_class[kv["highway"]] if kv["highway"] == nil and ferry then road_class = 2 --TODO: can we weight based on ferry types? elseif kv["highway"] == nil and (kv["railway"] or kv["route"] == "shuttle_train") then road_class = 2 --TODO: can we weight based on rail types? elseif road_class == nil then --service and other = 7 road_class = 7 end kv["road_class"] = road_class kv["default_speed"] = default_speed[kv["road_class"]] --lower the default speed for driveways if kv["service"] == "driveway" then kv["default_speed"] = math.floor(tonumber(kv["default_speed"]) * 0.5) end local use = use[kv["service"]] if kv["highway"] then if kv["highway"] == "track" then use = 3 elseif kv["highway"] == "living_street" then use = 10 elseif use == nil and kv["highway"] == "service" then use = 11 elseif kv["highway"] == "cycleway" then use = 20 elseif kv["pedestrian"] == "false" and kv["auto_forward"] == "false" and kv["auto_backward"] == "false" and (kv["bike_forward"] == "true" or kv["bike_backward"] == "true") then use = 20 elseif (kv["highway"] == "footway" and kv["footway"] == "sidewalk") then use = 24 elseif (kv["highway"] == "footway" and kv["footway"] == "crossing") then use = 32 elseif kv["highway"] == "footway" then use = 25 elseif kv["highway"] == "steps" then use = 26 --steps/stairs elseif kv["highway"] == "path" then use = 27 elseif kv["highway"] == "pedestrian" then use = 28 elseif kv["pedestrian"] == "true" and kv["auto_forward"] == "false" and kv["auto_backward"] == "false" and kv["truck_forward"] == "false" and kv["truck_backward"] == "false" and kv["bus_forward"] == "false" and kv["bus_backward"] == "false" and kv["bike_forward"] == "false" and kv["bike_backward"] == "false" and kv["moped_forward"] == "false" and kv["moped_backward"] == "false" and kv["motorcycle_forward"] == "false" and kv["motorcycle_backward"] == "false" then use = 28 elseif kv["highway"] == "bridleway" then use = 29 end end if use == nil and kv["service"] then use = 40 --other elseif use == nil then use = 0 --general road, no special use end if (kv["access"] == "emergency" or kv["emergency"] == "yes") and kv["auto_forward"] == "false" and kv["auto_backward"] == "false" and kv["truck_forward"] == "false" and kv["truck_backward"] == "false" and kv["bus_forward"] == "false" and kv["bus_backward"] == "false" and kv["bike_forward"] == "false" and kv["bike_backward"] == "false" and kv["moped_forward"] == "false" and kv["moped_backward"] == "false" and kv["motorcycle_forward"] == "false" and kv["motorcycle_backward"] == "false" then use = 7 end kv["use"] = use local r_shoulder = shoulder[kv["shoulder"]] or shoulder[kv["shoulder:both"]] or nil local l_shoulder = r_shoulder if r_shoulder == nil then r_shoulder = shoulder[kv["shoulder:right"]] or shoulder_right[kv["shoulder"]] or "false" l_shoulder = shoulder[kv["shoulder:left"]] or shoulder_left[kv["shoulder"]] or "false" --If the road is oneway and one shoulder is tagged but not the other, we set both to true so that when setting the --shoulder in graphbuilder, driving on the right side vs the left side doesn't cause the edge to miss the shoulder tag if oneway_norm == "true" and r_shoulder == "true" and l_shoulder == "false" then l_shoulder = "true" elseif oneway_norm == "true" and r_shoulder == "false" and l_shoulder == "true" then r_shoulder = "true" end end kv["shoulder_right"] = r_shoulder kv["shoulder_left"] = l_shoulder local cycle_lane_right_opposite = "false" local cycle_lane_left_opposite = "false" local cycle_lane_right = 0 local cycle_lane_left = 0 --We have special use cases for cycle lanes when on a cycleway, footway, or path if (use == 20 or use == 25 or use == 27) and (kv["bike_forward"] == "true" or kv["bike_backward"] == "true") then if kv["pedestrian"] == "false" then cycle_lane_right = 3 --separated elseif kv["segregated"] == "yes" then cycle_lane_right = 2 --dedicated elseif kv["segregated"] == "no" then cycle_lane_right = 1 --shared elseif use == 20 then cycle_lane_right = 2 --If no segregated tag but it is tagged as a cycleway then we assume separated lanes else cycle_lane_right = 1 --If no segregated tag and it's tagged as a footway or path then we assume shared lanes end cycle_lane_left = cycle_lane_right else --Set flags if any of the lanes are marked "opposite" (contraflow) cycle_lane_right_opposite = bike_reverse[kv["cycleway"]] or "false" cycle_lane_left_opposite = cycle_lane_right_opposite if cycle_lane_right_opposite == "false" then cycle_lane_right_opposite = bike_reverse[kv["cycleway:right"]] or "false" cycle_lane_left_opposite = bike_reverse[kv["cycleway:left"]] or "false" end --Figure out which side of the road has what cyclelane cycle_lane_right = shared[kv["cycleway"]] or separated[kv["cycleway"]] or dedicated[kv["cycleway"]] or buffer[kv["cycleway:both:buffer"]] or 0 cycle_lane_left = cycle_lane_right if cycle_lane_right == 0 then cycle_lane_right = shared[kv["cycleway:right"]] or separated[kv["cycleway:right"]] or dedicated[kv["cycleway:right"]] or buffer[kv["cycleway:right:buffer"]] or 0 cycle_lane_left = shared[kv["cycleway:left"]] or separated[kv["cycleway:left"]] or dedicated[kv["cycleway:left"]] or buffer[kv["cycleway:left:buffer"]] or 0 end --If we have the oneway:bicycle=no tag and there are not "opposite_lane/opposite_track" tags then there are certain situations where --the cyclelane is considered a two-way. (Based off of some examples on wiki.openstreetmap.org/wiki/Bicycle) if kv["oneway:bicycle"] == "no" and cycle_lane_right_opposite == "false" and cycle_lane_left_opposite == "false" then if cycle_lane_right == 2 or cycle_lane_right == 3 then --Example M1 or M2d but on the right side if oneway_norm == "true" then cycle_lane_left = cycle_lane_right cycle_lane_left_opposite = "true" --Example L1b elseif cycle_lane_left == 0 then cycle_lane_left = cycle_lane_right end elseif cycle_lane_left == 2 or cycle_lane_left == 3 then --Example M2d if oneway_norm == "true" then cycle_lane_right = cycle_lane_left cycle_lane_right_opposite = "true" --Example L1b but on the left side elseif cycle_lane_right == 0 then cycle_lane_right = cycle_lane_left end end end end kv["cycle_lane_right"] = cycle_lane_right kv["cycle_lane_left"] = cycle_lane_left kv["cycle_lane_right_opposite"] = cycle_lane_right_opposite kv["cycle_lane_left_opposite"] = cycle_lane_left_opposite if kv["highway"] and string.find(kv["highway"], "_link") then --*_link kv["link"] = "true" --do we need to add more? turnlane? kv["link_type"] = kv["link_type"] end kv["private"] = private[kv["access"]] or private[kv["motor_vehicle"]] or "false" kv["no_thru_traffic"] = no_thru_traffic[kv["access"]] or "false" kv["ferry"] = tostring(ferry) kv["rail"] = tostring(kv["auto_forward"] == "true" and (kv["railway"] == "rail" or kv["route"] == "shuttle_train")) kv["name"] = kv["name"] kv["name:en"] = kv["name:en"] kv["alt_name"] = kv["alt_name"] kv["official_name"] = kv["official_name"] if kv["maxspeed"] == "none" then --- special case unlimited speed limit (german autobahn) kv["max_speed"] = "unlimited" else kv["max_speed"] = normalize_speed(kv["maxspeed"]) end kv["advisory_speed"] = normalize_speed(kv["maxspeed:advisory"]) kv["average_speed"] = normalize_speed(kv["maxspeed:practical"]) kv["backward_speed"] = normalize_speed(kv["maxspeed:backward"]) kv["forward_speed"] = normalize_speed(kv["maxspeed:forward"]) kv["int"] = kv["int"] kv["int_ref"] = kv["int_ref"] kv["surface"] = kv["surface"] kv["wheelchair"] = wheelchair[kv["wheelchair"]] --lower the default speed for tracks if kv["highway"] == "track" then kv["default_speed"] = 5 if kv["tracktype"] then if kv["tracktype"] == "grade1" then kv["default_speed"] = 20 elseif kv["tracktype"] == "grade2" then kv["default_speed"] = 15 elseif kv["tracktype"] == "grade3" then kv["default_speed"] = 12 elseif kv["tracktype"] == "grade4" then kv["default_speed"] = 10 end end end --use unsigned_ref if all the conditions are met. if ((kv["name"] == nil and kv["name:en"] == nil and kv["alt_name"] == nil and kv["official_name"] == nil and kv["ref"] == nil and kv["int_ref"] == nil) and (kv["highway"] == "motorway" or kv["highway"] == "trunk" or kv["highway"] == "primary") and kv["unsigned_ref"] ~= nil) then kv["ref"] = kv["unsigned_ref"] end lane_count = tonumber(numeric_prefix(kv["lanes"],false)) if lane_count and lane_count > 15 then lane_count = nil end kv["lanes"] = lane_count lane_count = tonumber(numeric_prefix(kv["lanes:forward"],false)) if lane_count and lane_count > 15 then lane_count = nil end kv["forward_lanes"] = lane_count lane_count = tonumber(numeric_prefix(kv["lanes:backward"],false)) if lane_count and lane_count > 15 then lane_count = nil end kv["backward_lanes"] = lane_count kv["bridge"] = bridge[kv["bridge"]] or "false" -- TODO access:conditional if kv["seasonal"] and kv["seasonal"] ~= "no" then kv["seasonal"] = "true" end if (kv["hov"] and kv["hov"] == "no") then kv["hov_tag"] = "false" kv["hov_forward"] = "false" kv["hov_backward"] = "false" else kv["hov_forward"] = kv["auto_forward"] kv["hov_backward"] = kv["auto_backward"] end -- hov restrictions if ((kv["hov"] and kv["hov"] ~= "no") or kv["hov:lanes"] or kv["hov:minimum"]) then kv["hov_tag"] = "true" local only_hov_allowed = kv["hov"] == "designated" if only_hov_allowed then if kv["hov:lanes"] then for lane in (kv["hov:lanes"] .. '|'):gmatch("([^|]*)|") do if lane and lane ~= "designated" then only_hov_allowed = false end end end end if only_hov_allowed then if (kv["auto_tag"] == nil) then kv["auto_forward"] = "false" kv["auto_backward"] = "false" end if (kv["truck_tag"] == nil) then kv["truck_forward"] = "false" kv["truck_backward"] = "false" end if (kv["foot_tag"] == nil) then kv["pedestrian"] = "false" end if (kv["bike_tag"] == nil) then kv["bike_forward"] = "false" kv["bike_backward"] = "false" end end end kv["tunnel"] = tunnel[kv["tunnel"]] or "false" kv["toll"] = toll[kv["toll"]] or "false" kv["destination"] = kv["destination"] kv["destination:forward"] = kv["destination:forward"] kv["destination:backward"] = kv["destination:backward"] kv["destination:ref"] = kv["destination:ref"] kv["destination:ref:to"] = kv["destination:ref:to"] kv["destination:street"] = kv["destination:street"] kv["destination:street:to"] = kv["destination:street:to"] kv["junction:ref"] = kv["junction:ref"] kv["turn:lanes"] = kv["turn:lanes"] kv["turn:lanes:forward"] = kv["turn:lanes:forward"] kv["turn:lanes:backward"] = kv["turn:lanes:backward"] --truck goodies kv["maxheight"] = normalize_measurement(kv["maxheight"]) or normalize_measurement(kv["maxheight:physical"]) kv["maxwidth"] = normalize_measurement(kv["maxwidth"]) or normalize_measurement(kv["maxwidth:physical"]) kv["maxlength"] = normalize_measurement(kv["maxlength"]) kv["maxweight"] = normalize_weight(kv["maxweight"]) kv["maxaxleload"] = normalize_weight(kv["maxaxleload"]) --TODO: hazmat really should have subcategories kv["hazmat"] = hazmat[kv["hazmat"]] or hazmat[kv["hazmat:water"]] or hazmat[kv["hazmat:A"]] or hazmat[kv["hazmat:B"]] or hazmat[kv["hazmat:C"]] or hazmat[kv["hazmat:D"]] or hazmat[kv["hazmat:E"]] kv["maxspeed:hgv"] = normalize_speed(kv["maxspeed:hgv"]) if (kv["hgv:national_network"] or kv["hgv:state_network"] or kv["hgv"] == "local" or kv["hgv"] == "designated") then kv["truck_route"] = "true" end if (kv["maxwidth"]) then local width = tonumber(kv["maxwidth"]) if (width and width <= 1.9) then kv["auto_forward"] = "false" kv["truck_forward"] = "false" kv["bus_forward"] = "false" kv["taxi_forward"] = "false" kv["emergency_forward"] = "false" kv["hov_forward"] = "false" kv["auto_backward"] = "false" kv["truck_backward"] = "false" kv["bus_backward"] = "false" kv["taxi_backward"] = "false" kv["emergency_backward"] = "false" kv["hov_backward"] = "false" end end local nref = kv["ncn_ref"] local rref = kv["rcn_ref"] local lref = kv["lcn_ref"] local bike_mask = 0 if nref or kv["ncn"] == "yes" then bike_mask = 1 end if rref or kv["rcn"] == "yes" then bike_mask = bit.bor(bike_mask, 2) end if lref or kv["lcn"] == "yes" then bike_mask = bit.bor(bike_mask, 4) end if kv["mtb"] == "yes" then bike_mask = bit.bor(bike_mask, 8) end kv["bike_national_ref"] = nref kv["bike_regional_ref"] = rref kv["bike_local_ref"] = lref kv["bike_network_mask"] = bike_mask return 0 end function nodes_proc (kv, nokeys) if kv["iso:3166_2"] then i, j = string.find(kv["iso:3166_2"], '-', 1, true) if i == 3 then if string.len(kv["iso:3166_2"]) == 6 or string.len(kv["iso:3166_2"]) == 5 then kv["state_iso_code"] = string.sub(kv["iso:3166_2"], 4) end elseif string.find(kv["iso:3166_2"], '-', 1, true) == nil then if string.len(kv["iso:3166_2"]) == 2 or string.len(kv["iso:3166_2"]) == 3 then kv["state_iso_code"] = kv["iso:3166_2"] elseif string.len(kv["iso:3166_2"]) == 4 or string.len(kv["iso:3166_2"]) == 5 then kv["state_iso_code"] = string.sub(kv["iso:3166_2"], 3) end end end --normalize a few tags that we care about local access = access[kv["access"]] or "true" if (kv["impassable"] == "yes" or (kv["access"] == "private" and (kv["emergency"] == "yes" or kv["service"] == "emergency_access"))) then access = "false" end local hov_tag = nil if ((kv["hov"] and kv["hov"] ~= "no") or kv["hov:lanes"] or kv["hov:minimum"]) then hov_tag = 128 end local foot_tag = foot_node[kv["foot"]] local wheelchair_tag = wheelchair_node[kv["wheelchair"]] local bike_tag = bicycle_node[kv["bicycle"]] local truck_tag = truck_node[kv["hgv"]] local auto_tag = motor_vehicle_node[kv["motorcar"]] local motor_vehicle_tag = motor_vehicle_node[kv["motor_vehicle"]] local moped_tag = moped_node[kv["moped"]] or moped_node[kv["mofa"]] local motorcycle_tag = motor_cycle_node[kv["motorcycle"]] if auto_tag == nil then auto_tag = motor_vehicle_tag end local bus_tag = bus_node[kv["bus"]] if bus_tag == nil then bus_tag = psv_bus_node[kv["psv"]] end --if bus was not set and car is if bus_tag == nil and auto_tag == 1 then bus_tag = 64 end --if wheelchair was not set and foot is if wheelchair_tag == nil and foot_tag == 2 then wheelchair_tag = 256 end --if hov was not set and car is if hov_tag == nil and auto_tag == 1 then hov_tag = 128 end local taxi_tag = taxi_node[kv["taxi"]] if taxi_tag == nil then taxi_tag = psv_taxi_node[kv["psv"]] end --if taxi was not set and car is if taxi_tag == nil and auto_tag == 1 then taxi_tag = 32 end --if truck was not set and car is if truck_tag == nil and auto_tag == 1 then truck_tag = 8 end --must shut these off if motor_vehicle = 0 if motor_vehicle_tag == 0 then hov_tag = hov_tag or 0 bus_tag = bus_tag or 0 taxi_tag = taxi_tag or 0 truck_tag = truck_tag or 0 moped_tag = moped_tag or 0 motorcycle_tag = motorcycle_tag or 0 end local emergency_tag --implies nil if kv["access"] == "emergency" or kv["emergency"] == "yes" or kv["service"] == "emergency_access" then emergency_tag = 16 end --do not shut off bike access if there is a highway crossing. if bike_tag == 0 and kv["highway"] == "crossing" then bike_tag = 4 end --if tag exists use it, otherwise access allowed for all modes unless access = false or kv["hov"] == "designated" or kv["vehicle"] == "no") local auto = auto_tag or 1 local truck = truck_tag or 8 local bus = bus_tag or 64 local taxi = taxi_tag or auto_tag or 32 local foot = foot_tag or 2 local wheelchair = wheelchair_tag or 256 local bike = bike_tag or 4 local emergency = emergency_tag or 16 local hov = hov_tag or auto_tag or 128 local moped = moped_tag or 512 local motorcycle = motorcycle_tag or 1024 --if access = false use tag if exists, otherwise no access for that mode. if (access == "false" or kv["vehicle"] == "no" or kv["hov"] == "designated") then auto = auto_tag or 0 truck = truck_tag or 0 bus = bus_tag or 0 taxi = taxi_tag or 0 --don't change ped if kv["vehicle"] == "no" if access == "false" or kv["hov"] == "designated" then foot = foot_tag or 0 end wheelchair = wheelchair_tag or 0 bike = bike_tag or 0 moped = moped_tag or 0 motorcycle = motorcycle_tag or 0 emergency = emergency_tag or 0 hov = hov_tag or 0 end --check for gates, bollards, and sump_busters local gate = kv["barrier"] == "gate" or kv["barrier"] == "lift_gate" local bollard = false local sump_buster = false if gate == false then --if there was a bollard cars can't get through it bollard = kv["barrier"] == "bollard" or kv["barrier"] == "block" or kv["bollard"] == "removable" or false --if sump_buster then no access for auto, hov, and taxi unless a tag exists. sump_buster = kv["barrier"] == "sump_buster" or false --save the following as gates. if (bollard and (kv["bollard"] == "rising")) then gate = true bollard = false end --bollard = true shuts off access unless the tag exists. if bollard == true then auto = auto_tag or 0 truck = truck_tag or 0 bus = bus_tag or 0 taxi = taxi_tag or 0 foot = foot_tag or 2 wheelchair = wheelchair_tag or 256 bike = bike_tag or 4 moped = moped_tag or 0 motorcycle = motorcycle_tag or 0 emergency = emergency_tag or 0 hov = hov_tag or 0 --sump_buster = true shuts off access unless the tag exists. elseif sump_buster == true then auto = auto_tag or 0 truck = truck_tag or 8 bus = bus_tag or 64 taxi = taxi_tag or 0 foot = foot_tag or 2 wheelchair = wheelchair_tag or 256 bike = bike_tag or 4 moped = moped_tag or 512 motorcycle = motorcycle_tag or 1024 emergency = emergency_tag or 16 hov = hov_tag or 0 end end --if nothing blocks access at this node assume access is allowed. if gate == false and bollard == false and sump_buster == false and access == "true" then if kv["highway"] == "crossing" or kv["railway"] == "crossing" or kv["footway"] == "crossing" or kv["cycleway"] == "crossing" or kv["foot"] == "crossing" or kv["bicycle"] == "crossing" or kv["pedestrian"] == "crossing" or kv["crossing"] then auto = auto_tag or 1 truck = truck_tag or 8 bus = bus_tag or 64 taxi = taxi_tag or 32 foot = foot_tag or 2 wheelchair = wheelchair_tag or 256 bike = bike_tag or 4 moped = moped_tag or 512 motorcycle = motorcycle_tag or 1024 emergency = emergency_tag or 16 hov = hov_tag or 128 end end --store the gate and bollard info kv["gate"] = tostring(gate) kv["bollard"] = tostring(bollard) kv["sump_buster"] = tostring(sump_buster) if kv["barrier"] == "border_control" then kv["border_control"] = "true" elseif kv["barrier"] == "toll_booth" then kv["toll_booth"] = "true" elseif kv["highway"] == "toll_gantry" then kv["toll_gantry"] = "true" end local coins = toll[kv["payment:coins"]] or "false" local notes = toll[kv["payment:notes"]] or "false" --assume cash for toll, toll:*, and fee local cash = toll[kv["toll"]] or toll[kv["toll:hgv"]] or toll[kv["toll:bicycle"]] or toll[kv["toll:hov"]] or toll[kv["toll:motorcar"]] or toll[kv["toll:motor_vehicle"]] or toll[kv["toll:bus"]] or toll[kv["toll:motorcycle"]] or toll[kv["payment:cash"]] or toll[kv["fee"]] or "false" local etc = toll[kv["payment:e_zpass"]] or toll[kv["payment:e_zpass:name"]] or toll[kv["payment:pikepass"]] or toll[kv["payment:via_verde"]] or "false" local cash_payment = 0 if (cash == "true" or (coins == "true" and notes == "true")) then cash_payment = 3 elseif coins == "true" then cash_payment = 1 elseif notes == "true" then cash_payment = 2 end local etc_payment = 0 if etc == "true" then etc_payment = 4 end --store a mask denoting payment type kv["payment_mask"] = bit.bor(cash_payment, etc_payment) if kv["amenity"] == "bicycle_rental" or (kv["shop"] == "bicycle" and kv["service:bicycle:rental"] == "yes") then kv["bicycle_rental"] = "true" end if kv["traffic_signals:direction"] == "forward" then kv["forward_signal"] = "true" if kv["public_transport"] == nil and kv["name"] then kv["junction"] = "named" end end if kv["traffic_signals:direction"] == "backward" then kv["backward_signal"] = "true" if kv["public_transport"] == nil and kv["name"] then kv["junction"] = "named" end end if kv["public_transport"] == nil and kv["name"] then if kv["highway"] == "traffic_signals" then if kv["junction"] ~= "yes" then kv["junction"] = "named" end elseif kv["junction"] == "yes" or kv["reference_point"] == "yes" then kv["junction"] = "named" end end --store a mask denoting access kv["access_mask"] = bit.bor(auto, emergency, truck, bike, foot, wheelchair, bus, hov, moped, motorcycle, taxi) return 0, kv end function ways_proc (kv, nokeys) --if there were no tags passed in, ie keyvalues is empty if nokeys == 0 then return 1, kv, 0, 0 end --does it at least have some interesting tags filter = filter_tags_generic(kv) --let the caller know if its a keeper or not and give back the modified tags --also tell it whether or not its a polygon or road return filter, kv, 0, 0 end function rels_proc (kv, nokeys) if (kv["type"] == "connectivity") then return 0, kv end if (kv["type"] == "route" or kv["type"] == "restriction") then local restrict = restriction[kv["restriction"]] or restriction[restriction_prefix(kv["restriction:conditional"])] local restrict_type = restriction[kv["restriction:hgv"]] or restriction[kv["restriction:emergency"]] or restriction[kv["restriction:taxi"]] or restriction[kv["restriction:motorcar"]] or restriction[kv["restriction:bus"]] or restriction[kv["restriction:bicycle"]] or restriction[kv["restriction:hazmat"]] or restriction[kv["restriction:motorcycle"]] --restrictions with type win over just restriction key. people enter both. if restrict_type ~= nil then restrict = restrict_type end if kv["type"] == "restriction" or kv["restriction:conditional"] then if restrict ~= nil then kv["restriction:conditional"] = restriction_suffix(kv["restriction:conditional"]) kv["restriction:hgv"] = restriction[kv["restriction:hgv"]] kv["restriction:emergency"] = restriction[kv["restriction:emergency"]] kv["restriction:taxi"] = restriction[kv["restriction:taxi"]] kv["restriction:motorcar"] = restriction[kv["restriction:motorcar"]] kv["restriction:motorcycle"] = restriction[kv["restriction:motorcycle"]] kv["restriction:bus"] = restriction[kv["restriction:bus"]] kv["restriction:bicycle"] = restriction[kv["restriction:bicycle"]] kv["restriction:hazmat"] = restriction[kv["restriction:hazmat"]] if restrict_type == nil then kv["restriction"] = restrict else kv["restriction"] = nil end else return 1, kv end return 0, kv elseif kv["route"] == "bicycle" or kv["route"] == "mtb" then local bike_mask = 0 if kv["network"] == "mtb" or kv["route"] == "mtb" then bike_mask = 8 end if kv["network"] == "ncn" then bike_mask = bit.bor(bike_mask, 1) elseif kv["network"] == "rcn" then bike_mask = bit.bor(bike_mask, 2) elseif kv["network"] == "lcn" then bike_mask = bit.bor(bike_mask, 4) end kv["bike_network_mask"] = bike_mask kv["day_on"] = nil kv["day_off"] = nil kv["restriction"] = nil return 0, kv --has a restiction but type is not restriction...ignore elseif restrict ~= nil then return 1, kv else kv["day_on"] = nil kv["day_off"] = nil kv["restriction"] = nil return 0, kv end end return 1, kv end function rel_members_proc (keyvalues, keyvaluemembers, roles, membercount) --because we filter all rels we never call this function --because we do rel processing later we simply say that no ways are used --in the given relation, what would be nice is if we could push tags --back to the ways via keyvaluemembers, we could then avoid doing --post processing to get the shielding and directional highway info membersuperseeded = {} for i = 1, membercount do membersuperseeded[i] = 0 end return 1, keyvalues, membersuperseeded, 0, 0, 0 end
local api = vim.api local floating = {} function floating:window() -- get the editor's max width and height local width = api.nvim_get_option("columns") local height = api.nvim_get_option("lines") local height_percentage = 10 / 100 local width_percentage = 5 / 100 -- create a new, scratch buffer, for fzf local buf = api.nvim_create_buf(false, true) api.nvim_buf_set_option(buf, 'buftype', 'nofile') -- if the editor is big enough if (width > 100 or height > 35) then -- fzf's window height is 3/4 of the max height, but not more than 70 local win_height = math.min(math.ceil(height * 3 / 4), 70) local win_width -- if the width is small if (width < 100) then -- just subtract 8 from the editor's width win_width = math.ceil(width - 8) else -- use 90% of the editor's width win_width = math.ceil(width * 0.9) end -- settings for the fzf window local opts = { style = "minimal", relative = "editor", row = math.ceil(height * height_percentage), col = math.ceil(width * width_percentage), width = win_width, height = win_height, } -- create a new floating window, centered in the editor local win = api.nvim_open_win(buf, true, opts) return win end end return floating
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' server_scripts { 'GHMattiMySQL.net.dll' }
-- engine bustedhelper equivalent for game project -- see bustedhelper_ingame.lua for explanations -- attract_mode being the closest to ingame cartridge, we have the same content -- except we require common_attract_mode and removed uncommented log activation code -- Usage: -- in your game utests, always require("test/bustedhelper_attract_mode") at the top -- instead of "engine/test/bustedhelper" require("engine/test/bustedhelper") require("common_attract_mode") require("resources/visual_ingame_addon")
-- This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild -- -- This file is compatible with Lua 5.3 local class = require("class") require("kaitaistruct") local utils = require("utils") ParamsPassBool = class.class(KaitaiStruct) function ParamsPassBool:_init(io, parent, root) KaitaiStruct._init(self, io) self._parent = parent self._root = root or self self:_read() end function ParamsPassBool:_read() self.s_false = self._io:read_bits_int_be(1) self.s_true = self._io:read_bits_int_be(1) self._io:align_to_byte() self.seq_b1 = ParamsPassBool.ParamTypeB1(self.s_true, self._io, self, self._root) self.seq_bool = ParamsPassBool.ParamTypeBool(self.s_false, self._io, self, self._root) self.literal_b1 = ParamsPassBool.ParamTypeB1(false, self._io, self, self._root) self.literal_bool = ParamsPassBool.ParamTypeBool(true, self._io, self, self._root) self.inst_b1 = ParamsPassBool.ParamTypeB1(self.v_true, self._io, self, self._root) self.inst_bool = ParamsPassBool.ParamTypeBool(self.v_false, self._io, self, self._root) end ParamsPassBool.property.v_false = {} function ParamsPassBool.property.v_false:get() if self._m_v_false ~= nil then return self._m_v_false end self._m_v_false = false return self._m_v_false end ParamsPassBool.property.v_true = {} function ParamsPassBool.property.v_true:get() if self._m_v_true ~= nil then return self._m_v_true end self._m_v_true = true return self._m_v_true end ParamsPassBool.ParamTypeB1 = class.class(KaitaiStruct) function ParamsPassBool.ParamTypeB1:_init(arg, io, parent, root) KaitaiStruct._init(self, io) self._parent = parent self._root = root or self self.arg = arg self:_read() end function ParamsPassBool.ParamTypeB1:_read() self.foo = self._io:read_bytes(utils.box_unwrap((self.arg) and utils.box_wrap(1) or (2))) end ParamsPassBool.ParamTypeBool = class.class(KaitaiStruct) function ParamsPassBool.ParamTypeBool:_init(arg, io, parent, root) KaitaiStruct._init(self, io) self._parent = parent self._root = root or self self.arg = arg self:_read() end function ParamsPassBool.ParamTypeBool:_read() self.foo = self._io:read_bytes(utils.box_unwrap((self.arg) and utils.box_wrap(1) or (2))) end
Scaling = {} local x_scale = 0.8 local y_scale = 0.8 local WIDTH = 1600 local HEIGHT = 1200 function Scaling:get_width() return (love.graphics.getWidth() / x_scale) end function Scaling:get_height() return (love.graphics.getHeight() / y_scale) end function Scaling:set_window_size() love.window.setMode(WIDTH * x_scale, HEIGHT * y_scale) end function Scaling:reset_size() x_scale = 0.8 y_scale = 0.8 Scaling:set_window_size() end function Scaling:increase_size() x_scale = x_scale + 0.2 y_scale = y_scale + 0.2 love.window.setMode(WIDTH * x_scale, HEIGHT * y_scale) end function Scaling:decrease_size() x_scale = x_scale - 0.2 y_scale = y_scale - 0.2 love.window.setMode(WIDTH * x_scale, HEIGHT * y_scale) end function Scaling:scale_graphics() love.graphics.scale(x_scale, y_scale) end
local class = require "include.class" local mysql = require "include.mysql" local deepcopy = require "include.deepcopy" local swapHashKV = require "include.swaphashkv" local timetool = require "include.timetool" local cjson = require "include.cjson" local s_format = string.format local s_find = string.find local s_upper = string.upper local s_sub = string.sub local t_insert = table.insert local t_concat = table.concat local to_sqlstr = ngx.quote_sql_str local _M = class() _M.defaut_cache_time = timetool.one_hour function _M:__init(ip,port,user,pw,db,tab,cols,colsdef,keys,upk,cache_time) if type(ip) == 'table' then self.config = deepcopy(ip) ip = self.config.ip else self.config = {} end self.config.ip = self.config.ip or ip or "127.0.0.1" self.config.port = self.config.port or port or 3306 self.config.user = self.config.user or user or "root" self.config.pw = self.config.pw or pw or "123456" self.config.db = self.config.db or db or "db" self.config.table = self.config.table or tab or "table" self.config.cols = self.config.cols or cols or {} self.config.colsdef = self.config.colsdef or colsdef or {} self.config.keys = self.config.keys or keys or {id='INT NOT NULL AUTO_INCREMENT'} self.config.upk = self.config.upk or upk or 'id' for i,v in pairs(self.config.keys) do t_insert(self.config.cols,1,i) t_insert(self.config.colsdef,1,v) end self.config.colsdefvalue = self.config.colsdefvalue or colsdefvalue or {} for i,v in ipairs(self.config.colsdef) do local key = self.config.cols[i] if not self.config.colsdefvalue[key] then local ups = s_upper(v) local sp,ep = s_find(ups,"DEFAULT",1,true) if sp and ep then self.config.colsdefvalue[key] = s_sub(v,ep+2) end end end self:check() self.select_all = s_format("SELECT * FROM `%s`",self.config.table) self.select_head = s_format("SELECT * FROM `%s` WHERE `%s` = ",self.config.table,self.config.upk) self.insert_head = {} t_insert(self.insert_head,s_format("INSERT INTO `%s` (`",self.config.table)) t_insert(self.insert_head,t_concat(self.config.cols,"`,`")) t_insert(self.insert_head,"`) VALUES ") self.insert_head = t_concat(self.insert_head,"") self.insert_tail = {} for i,v in ipairs(self.config.cols) do t_insert(self.insert_tail,s_format("`%s`=VALUES(`%s`)",v,v)) end self.insert_tail = s_format(" ON DUPLICATE KEY UPDATE %s",t_concat(self.insert_tail,",")) --self.update_head = s_format("UPDATE `%s` SET ",self.config.table) self.delete_head = s_format("DELETE FROM `%s` WHERE `%s` IN (",self.config.table,self.config.upk) self.delete_all = s_format("DELETE FROM `%s`",self.config.table) self.delete_all_fast = s_format("TRUNCATE TABLE `%s`",self.config.table) self.update_rec = {} self.update_rec_num = 0 self.bcache = true self.bcache_all = false self.rec = {} self.rec_up_time = {} self.max_upk_value = self:get_max_value(self.config.upk) self.cache_time = self.config.cache_time or cache_time or self.defaut_cache_time self.cache_num = 0 end function _M:get_connect() return mysql:new(self.config.ip,self.config.port,self.config.user,self.config.pw,self.config.db) end function _M:excute(sql,con) local needclose = false if not con then con = self:get_connect() needclose = true end local rs,err = con:query(sql) if needclose then con:close() end if not rs then ngx.log(ngx.ERR,"=====>excute sql error:", err, "sql: ", sql) return false,err end return rs end function _M:check() local con = self:get_connect() local create_sql = s_format("CREATE TABLE IF NOT EXISTS `%s` (`%s` %s, PRIMARY KEY (`%s`)) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC",self.config.table,self.config.upk,self.config.keys[self.config.upk],self.config.upk) local rs = self:excute(create_sql,con) if not rs then return false end local sql = s_format("SELECT COLUMN_NAME FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = '%s' AND `TABLE_NAME` = '%s'",self.config.db,self.config.table) local rs = self:excute(sql,con) if rs then local cs = {} for i,c in ipairs(rs) do cs[c.COLUMN_NAME] = 1 end self.nc = {} local bchange = false for i,c in ipairs(self.config.cols) do if not cs[c] then self.nc[c] = self.config.colsdef[i] or "LONGTEXT" bchange = true end end local bchangekeys = false local defkeys = {} for c,def in pairs(self.config.keys) do if not cs[c] then bchangekeys = true end if c == self.config.upk then t_insert(defkeys,1,"`" .. c .. "`") else t_insert(defkeys,"`" .. c .. "`") end end if bchangekeys then defkeys = s_format("DROP PRIMARY KEY,ADD PRIMARY KEY (%s)",t_concat(defkeys,",")) end if bchange then local adds = {} for c,t in pairs(self.nc) do t_insert(adds,s_format("ADD `%s` %s",c,t)); end adds = t_concat(adds,",") local sql = "" if bchangekeys then sql = s_format("ALTER TABLE `%s` %s, %s",self.config.table,adds,defkeys) else sql = s_format("ALTER TABLE `%s` %s",self.config.table,adds) end if self:excute(sql,con) then self.nc = {} end end end con:close() end function _M:get_max_value(col,conditions,condition_values) local maxv = 0 rs = false if not conditions or conditions == "*" then rs = self:excute(s_format("SELECT MAX(`%s`) FROM `%s`",col,self.config.table)) else if type(conditions) ~= "table" then conditions = {[conditions]=condition_values} end local condition = {} for k,v in pairs(conditions) do t_insert(condition,s_format("`%s`=%s",k,to_sqlstr(v))) end rs = self:excute(s_format("SELECT MAX(`%s`) FROM `%s` WHERE %s",col,self.config.table,t_concat(condition," AND "))) end if rs and #rs > 0 then _,maxv = next(rs[1]) if type(maxv) == "userdata" then maxv = 0 end end return maxv end function _M:get_record(npk_value,cols,npk) local rs = {} if not cols then cols = "*" elseif type(cols) == "table" then cols = "`" .. t_concat(cols,"`,`") .. "`" else cols = "`" .. cols .. "`" end if not npk_value or npk_value == "*" then if self.bcache_all then rs = swapHashKV(deepcopy(self.rec),false) else rs = self:excute(s_format("SELECT %s FROM `%s`",cols,self.config.table)) if rs and self.bcache and cols == "*" then self.cache_num = #rs self.rec = swapHashKV(deepcopy(rs),self.config.upk) self.bcache_all = true end end else if type(npk_value) ~= "table" then npk_value = {npk_value} end for i,v in ipairs(npk_value) do if self.rec[v] then t_insert(rs,deepcopy(self.rec[v])) else local r = self:excute(s_format("SELECT %s FROM `%s` WHERE `%s` = %s",cols,self.config.table,npk or self.config.upk,to_sqlstr(v))) if r and #r == 1 then t_insert(rs,r[1]) if bcache and cols == "*" then self.rec[v] = deepcopy(r[1]) self.cache_num = self.cache_num + 1 end end end end if #rs == 1 then rs = rs[1] end end return rs end function _M:get_all_record(cols) return self:get_record(nil,cols) end function _M:cache(bcache,cache_time) self.bcache = bcache self.cache_time = cache_time or self.cache_time if not bcache then self.rec = {} self.rec_up_time = {} self.cache_num = 0 self.bcache_all = false end end function _M:get_cache_num() return self.cache_num end function _M:get_update_rec_num() return self.update_rec_num end function _M:get_next_upk_value() self.max_upk_value = self.max_upk_value + 1 return self.max_upk_value end function _M:check_rec(rec,bappend) if not rec[self.config.upk] then return false end local oldrec = self.rec[rec[self.config.upk]] or (self.update_rec[rec[self.config.upk]] and self.update_rec[rec[self.config.upk]].rec) if not oldrec and not bappend then oldrec = self:get_record(rec[self.config.upk]) end for i,v in ipairs(self.config.cols) do if not rec[v] and oldrec then rec[v] = oldrec[v] end if rec[v] and type(rec[v]) ~= "string" and type(rec[v]) ~= "number" then rec[v] = cjson.encode(rec[v]) end end if bcache then self.rec[rec[self.config.upk]] = rec self.rec_up_time[rec[self.config.upk]] = timetool:now() end return true end function _M:append(rec) rec[self.config.upk] = self:get_next_upk_value() return self:update(rec,true) end function _M:remove(upk_value,fast) local rs = false if not upk_value or upk_value == "*" then if fast then rs = self:excute(self.delete_all_fast) else rs = self:excute(self.delete_all) end self.rec[v] = {} else if type(upk_value) ~= "table" then upk_value = {upk_value} end for i,v in ipairs(upk_value) do self.rec[v] = nil upk_value[i] = to_sqlstr(v) end rs = self:excute(s_format("%s %s)",self.delete_head,t_concat(upk_value))) end return rs end function _M:update(rec,bappend) rec = deepcopy(rec) if not self:check_rec(rec,bappend) then return false end local t = {} for i,v in ipairs(self.config.cols) do t[i] = rec[v] or self.config.colsdefvalue[v] or "NULL" if t[i] ~= "NULL" then t[i] = to_sqlstr(t[i]) end end if not self.update_rec[rec[self.config.upk]] then self.update_rec_num = self.update_rec_num + 1 end self.update_rec[rec[self.config.upk]] = {rec=rec,sql=s_format("(%s)",t_concat(t,","))} return true end function _M:save(limit) local n = 0 local insert = {} local insert_ids = {} for i,v in pairs(self.update_rec) do t_insert(insert,v.sql) t_insert(insert_ids,i) n = n + 1 if limit and n >= limit then break end end if n == 0 then return true,n end local rs,err = self:excute(s_format("%s%s%s",self.insert_head,t_concat(insert,","),self.insert_tail)) if not rs then return false,err end for i,v in ipairs(insert_ids) do self.update_rec[v] = nil end self.update_rec_num = self.update_rec_num - n return true,n end function _M:clean(force) if force then self:save() self.rec = {} self.rec_up_time = {} self.cache_num = 0 else if not bcache then return true end local ct = timetool:now() - self.cache_time for i,v in pairs(self.rec) do local upt = self.rec_up_time[i] or 0 if upt < ct then self.rec[i] = nil self.rec_up_time[i] = nil self.cache_num = self.cache_num - 1 end end end return true end return _M
function love.conf(t) local TILE_SIZE = 16 local SCALE = 4 t.identity = 'love_jav_2022' -- For debugging, build must have it as false t.console = true t.title = "Löve Jam 2022" -- Set by default a 16:9 resolution (the most common one) t.window.width = TILE_SIZE * 16 * SCALE t.window.height = TILE_SIZE * 9 * SCALE t.window.minwidth = TILE_SIZE * 16 * 2 t.window.minheight = TILE_SIZE * 9 * 2 t.window.resizable = true end
class "UIColorPicker" { extends "UIPanel", new = function (self, x,y, width,height, colorHueAlias,colorSaturationAlias,colorValueAlias,colorAlphaAlias) self.colorHue = colorHueAlias or 0 self.colorSaturation = colorSaturationAlias or 0 self.colorValue = colorValueAlias or 0 self.colorAlpha = colorAlphaAlias or 0 self.hexCode = self:hsvToHex(self.colorHue, self.colorSaturation, self.colorValue) local palette = UIPalette(0,0,0.5,0.25, colorHueAlias,colorSaturationAlias,colorValueAlias) local colorBlock = UIColorBlock(0.5,0,0.5,0.25, colorHueAlias,colorSaturationAlias,colorValueAlias,1) local colorHueSlider = UISliderSuite(0.0,0.3, 1.0,0.1, "Hue", colorHueAlias or 0, 0,1, 0.0001) if colorHueAlias == nil then colorHueSlider:setIsFrozen(true) end local colorSaturationSlider = UISliderSuite(0.0,0.45, 1.0,0.1, "Saturation", colorSaturationAlias or 0, 0,1, 0.0001) if colorSaturationAlias == nil then colorSaturationSlider:setIsFrozen(true) end local colorValueSlider = UISliderSuite(0.0,0.6, 1.0,0.1, "Value", colorValueAlias or 0, 0,1, 0.0001) if colorValueAlias == nil then colorValueSlider:setIsFrozen(true) end local colorAlphaSlider = UISliderSuite(0.0,0.75, 1.0,0.1, "Alpha", colorAlphaAlias or 0, 0,1, 0.0001) if colorAlphaAlias == nil then colorAlphaSlider:setIsFrozen(true) end local hexCodeText = UIText(0,0.95, 0.5,0.05, "Hex Code", 0.7, false,true) local hexCodeInputBox = UIInputBox(0.5,0.95, 0.5,0.05, Follower( function () return self:hsvToHex(self.colorHue, self.colorSaturation, self.colorValue) end, function (value) self.hexCode = value self.colorHue, self.colorSaturation, self.colorValue = self:hexToHSV(self.hexCode) end ), false) UIPanel.instanceMethods.new(self, x,y, width,height, { colorBlock, palette, colorHueSlider, colorSaturationSlider, colorValueSlider, colorAlphaSlider, hexCodeText, hexCodeInputBox, }) self.cornerRadiuses = {0.05, 0.02} end, hexToHSV = function (self, hexCode) if string.sub(hexCode, 1,1) == "#" then -- Remove the hash symbol hexCode = string.sub(hexCode, 2) end local r = tonumber( string.sub(hexCode, 1,2), 16 ) / 255 local g = tonumber( string.sub(hexCode, 3,4), 16 ) / 255 local b = tonumber( string.sub(hexCode, 5,6), 16 ) / 255 return vivid.RGBtoHSV(r,g,b) end, hsvToHex = function (self, h,s,v) local r,g,b = vivid.HSVtoRGB(h,s,v) r = math.round( r * 255 ) g = math.round( g * 255 ) b = math.round( b * 255 ) local hexCode = string.format("#%.2X%.2X%.2X", r,g,b) return hexCode end, }
---@class Framework.core.context.LoadContext LoadContext = class("Framework.core.context.LoadContext") function LoadContext:ctor(loader) end
require("zen-mode").setup { window = { width = 165, height = 80, options = { signcolumn = "no", number = true, list = false, }, }, plugins = { tmux = { enabled = true } } }
-- get the fruit from the list -- and store it in an array (table) -- or our "basket" if you will local fruit = "apple,pear,banana,pineapple" local basket = {} local i = 1 for fruit in string.gmatch(fruit, "%w+") do basket[i] = fruit i = i + 1 end -- I needs a nice, fruity drink... return "What about a nice " .. basket[3] .. " smoothie?"
local panelName = "alarms" local ui = setupUI([[ Panel height: 19 BotSwitch id: title anchors.top: parent.top anchors.left: parent.left text-align: center width: 130 !text: tr('Alarms') Button id: alerts anchors.top: prev.top anchors.left: prev.right anchors.right: parent.right margin-left: 3 height: 17 text: Edit ]]) ui:setId(panelName) if not storage[panelName] then storage[panelName] = { enabled = false, playerAttack = false, playerDetected = false, playerDetectedLogout = false, creatureDetected = false, healthBelow = false, healthValue = 40, manaBelow = false, manaValue = 50, privateMessage = false } end local config = storage[panelName] ui.title:setOn(config.enabled) ui.title.onClick = function(widget) config.enabled = not config.enabled widget:setOn(config.enabled) end rootWidget = g_ui.getRootWidget() if rootWidget then alarmsWindow = UI.createWindow('AlarmsWindow', rootWidget) alarmsWindow:hide() alarmsWindow.closeButton.onClick = function(widget) alarmsWindow:hide() end alarmsWindow.playerAttack:setOn(config.playerAttack) alarmsWindow.playerAttack.onClick = function(widget) config.playerAttack = not config.playerAttack widget:setOn(config.playerAttack) end alarmsWindow.playerDetected:setOn(config.playerDetected) alarmsWindow.playerDetected.onClick = function(widget) config.playerDetected = not config.playerDetected widget:setOn(config.playerDetected) end alarmsWindow.playerDetectedLogout:setChecked(config.playerDetectedLogout) alarmsWindow.playerDetectedLogout.onClick = function(widget) config.playerDetectedLogout = not config.playerDetectedLogout widget:setChecked(config.playerDetectedLogout) end alarmsWindow.creatureDetected:setOn(config.creatureDetected) alarmsWindow.creatureDetected.onClick = function(widget) config.creatureDetected = not config.creatureDetected widget:setOn(config.creatureDetected) end alarmsWindow.healthBelow:setOn(config.healthBelow) alarmsWindow.healthBelow.onClick = function(widget) config.healthBelow = not config.healthBelow widget:setOn(config.healthBelow) end alarmsWindow.healthValue.onValueChange = function(scroll, value) config.healthValue = value alarmsWindow.healthBelow:setText("Health < " .. config.healthValue .. "%") end alarmsWindow.healthValue:setValue(config.healthValue) alarmsWindow.manaBelow:setOn(config.manaBelow) alarmsWindow.manaBelow.onClick = function(widget) config.manaBelow = not config.manaBelow widget:setOn(config.manaBelow) end alarmsWindow.manaValue.onValueChange = function(scroll, value) config.manaValue = value alarmsWindow.manaBelow:setText("Mana < " .. config.manaValue .. "%") end alarmsWindow.manaValue:setValue(config.manaValue) alarmsWindow.privateMessage:setOn(config.privateMessage) alarmsWindow.privateMessage.onClick = function(widget) config.privateMessage = not config.privateMessage widget:setOn(config.privateMessage) end onTextMessage(function(mode, text) if config.enabled and config.playerAttack and mode == 16 and string.match(text, "hitpoints due to an attack") and not string.match(text, "hitpoints due to an attack by a ") then playSound("/sounds/Player_Attack.ogg") end end) macro(100, function() if not config.enabled then return end if config.playerDetected then for _, spec in ipairs(getSpectators()) do if spec:isPlayer() and spec:getName() ~= name() then specPos = spec:getPosition() if math.max(math.abs(posx()-specPos.x), math.abs(posy()-specPos.y)) <= 8 then playSound("/sounds/Player_Detected.ogg") delay(1500) if config.playerDetectedLogout then modules.game_interface.tryLogout(false) end return end end end end if config.creatureDetected then for _, spec in ipairs(getSpectators()) do if not spec:isPlayer()then specPos = spec:getPosition() if math.max(math.abs(posx()-specPos.x), math.abs(posy()-specPos.y)) <= 8 then playSound("/sounds/Creature_Detected.ogg") delay(1500) return end end end end if config.healthBelow then if hppercent() <= config.healthValue then playSound("/sounds/Low_Health.ogg") delay(1500) return end end if config.manaBelow then if manapercent() <= config.manaValue then playSound("/sounds/Low_Mana.ogg") delay(1500) return end end end) onTalk(function(name, level, mode, text, channelId, pos) if mode == 4 and config.enabled and config.privateMessage then playSound("/sounds/Private_Message.ogg") return end end) end ui.alerts.onClick = function(widget) alarmsWindow:show() alarmsWindow:raise() alarmsWindow:focus() end
-- @description Random Track FX -- @author Aaron Cendan -- @version 1.1 -- @metapackage -- @provides -- [main] . -- @link https://ko-fi.com/acendan_ -- @changelog -- + Added JSFX support -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- ~~~~~~~~~~~ GLOBAL VARS ~~~~~~~~~~ -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Get this script's name and directory local script_name = ({reaper.get_action_context()})[2]:match("([^/\\_]+)%.lua$") local script_directory = ({reaper.get_action_context()})[2]:sub(1,({reaper.get_action_context()})[2]:find("\\[^\\]*$")) -- Load lua utilities acendan_LuaUtils = reaper.GetResourcePath()..'/scripts/ACendan Scripts/Development/acendan_Lua Utilities.lua' if reaper.file_exists( acendan_LuaUtils ) then dofile( acendan_LuaUtils ); if not acendan or acendan.version() < 4.4 then acendan.msg('This script requires a newer version of ACendan Lua Utilities. Please run:\n\nExtensions > ReaPack > Synchronize Packages',"ACendan Lua Utilities"); return end else reaper.ShowConsoleMsg("This script requires ACendan Lua Utilities! Please install them here:\n\nExtensions > ReaPack > Browse Packages > 'ACendan Lua Utilities'"); return end -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- ~~~~~~~~~~~~ FUNCTIONS ~~~~~~~~~~~ -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function main() local win, sep = acendan.getOS() local vst_file = reaper.GetResourcePath() .. sep .. "reaper-vstplugins64.ini" local jsfx_file = reaper.GetResourcePath() .. sep .. "reaper-jsfx.ini" local plugins = {} if reaper.file_exists(vst_file) then if reaper.file_exists(jsfx_file) then -- Fetch plugins from vst_file local vst_tbl = acendan.fileToTable(vst_file) for _, v in pairs(vst_tbl) do local vst = v:gsub(" %(.*","") if vst:find(",") and not vst:find("<SHELL>") then vst = vst:sub(vst:find(",[^,]*$")+1) plugins[#plugins+1]=vst end end -- Fetch plugins from jsfx_file local jsfx_tbl = acendan.fileToTable(jsfx_file) for _, j in pairs(jsfx_tbl) do if j:find("NAME") and j:find("JS: ") then local jsfx = j:sub(j:find("JS: "),-2):gsub("JS: ","JS:") plugins[#plugins+1]=jsfx end end -- Loop through selected tracks local num_sel_tracks = reaper.CountSelectedTracks( 0 ) if num_sel_tracks > 0 then for i = 0, num_sel_tracks-1 do local track = reaper.GetSelectedTrack(0,i) reaper.TrackFX_AddByName(track,plugins[math.random(#plugins)],false,-1) reaper.TrackFX_Show(track, reaper.TrackFX_GetCount(track)-1,3) end else acendan.msg("No tracks selected!") end else acendan.msg("Unable to find reaper-jsfx.ini file!") end else acendan.msg("Unable to find reaper-vstplugins64.ini file!") end end -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- ~~~~~~~~~~~~~~ MAIN ~~~~~~~~~~~~~~ -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ reaper.PreventUIRefresh(1) reaper.Undo_BeginBlock() main() reaper.Undo_EndBlock(script_name,-1) reaper.PreventUIRefresh(-1) reaper.UpdateArrange()
local MEME = ThemePrefs.Get("MEMEMode"); local Menu = 0 local Allow_Press = false; local IDontWantLetHerGo = true; local InputHandler = function( event ) -- if (somehow) there's no event, bail if not event then return end if not Allow_Press then return end --printf("Meow !%d! %s->%s\n%d",math.random( 0,99 ),event.type,event.button,Menu); if event.type == "InputEventType_FirstPress" then if event.button == "Start" or event.button == "Center" then MESSAGEMAN:Broadcast("_FailOkay") if Menu == 0 then MESSAGEMAN:Broadcast("Ret") Allow_Press = false elseif Menu == 1 then IDontWantLetHerGo = false Allow_Press = false end end if event.button == "MenuLeft" or event.button == "MenuUp" or event.button == "Left" or event.button == "Up" or event.button == "DownLeft" then Menu = math.mod(Menu - 1 + 2 ,2) MESSAGEMAN:Broadcast("_FailArrow") end if event.button == "MenuRight" or event.button == "MenuDown" or event.button == "Right" or event.button == "Down" or event.button == "DownRight" then Menu = math.mod(Menu + 1 ,2) MESSAGEMAN:Broadcast("_FailArrow") end if Menu == 0 then MESSAGEMAN:Broadcast("NotoSWYD") MESSAGEMAN:Broadcast("YestoNew") elseif Menu == 1 then MESSAGEMAN:Broadcast("YestoSWYD") MESSAGEMAN:Broadcast("NotoNew") end end end local FailType = math.random(1,20) local Ror = 2.5 local Hoold = 5 local t = Def.ActorFrame{ StartTransitioningCommand=function(self) if ToEnumShortString(GAMESTATE:GetCurrentStage()) == "Event" and not IsNetConnected() then SCREENMAN:GetTopScreen():AddInputCallback( InputHandler ) end end; }; t[#t+1] = Def.Quad{ StartTransitioningCommand=function() MESSAGEMAN:Broadcast("AFTERFAIL"); end; }; if FailType < 7 or not MEME then t[#t+1]=LoadActor("Normal"); elseif FailType == 7 then t[#t+1]=LoadActor("What"); Ror = 0.2 elseif FailType == 8 then t[#t+1]=LoadActor("IWNKTG"); Ror = 1.5 elseif FailType == 9 then t[#t+1]=LoadActor("Round"); Ror = 0.2 elseif FailType == 10 then t[#t+1]=LoadActor("Directed"); Ror = 7.794 elseif FailType >= 11 and FailType <= 15 then t[#t+1]=LoadActor("Pump"); Ror = 4 elseif FailType >= 16 and FailType <= 20 then t[#t+1]=LoadActor("DefaultLoooong");--So OG Ror = 12 end --[[local WIDS = PLAYER_1,"PlayerP1"; t[#t+1] = Def.ActorFrame{ OnCommand=cmd(z,20); Def.ActorFrame{ InitCommand=function(self) self:visible(false) end; SigMessageCommand=function(self) if GAMESTATE:IsHumanPlayer(PLAYER_1) then if SCREENMAN:GetTopScreen():GetLifeMeter(PLAYER_1):IsFailing() or SCREENMAN:GetTopScreen():GetLifeMeter(PLAYER_1):GetLife() == 0 then WIDS = "PlayerP1"; end end if GAMESTATE:IsHumanPlayer(PLAYER_2) then if SCREENMAN:GetTopScreen():GetLifeMeter(PLAYER_2):IsFailing() or SCREENMAN:GetTopScreen():GetLifeMeter(PLAYER_2):GetLife() == 0 then WIDS ="PlayerP2"; end end local Me = scale(math.random(0,1),0,1,-1,1); SCREENMAN:GetTopScreen():GetChild(WIDS):finishtweening():accelerate(0.7):rotationz(math.random(30)*Me):y(SCREEN_BOTTOM*1.75):addx(30*Me); self:x(SCREENMAN:GetTopScreen():GetChild(WIDS):GetX()):y(SCREENMAN:GetTopScreen():GetChild(WIDS):GetY()-50):visible(true):sleep(0.7):queuecommand("Ma") end; MaCommand=cmd(bob;effectmagnitude,0,5,0); LoadFont("Common Normal")..{ Text = "O"; InitCommand = cmd(x,-50;y,-25;zoom,3;diffusebottomedge,Color.Red or color("#FF0000")); OnCommand = cmd(y,-SCREEN_CENTER_Y+50-50;rotationz,math.random(-10,10);sleep,math.random(1,5)/10;bouncebegin,0.7;y,-25;rotationz,0;); }; LoadFont("Common Normal")..{ Text = "h"; InitCommand = cmd(x,0;y,-25;zoom,3;diffusebottomedge,Color.Red or color("#FF0000")); OnCommand = cmd(y,-SCREEN_CENTER_Y+50-50;rotationz,math.random(-10,10);sleep,math.random(1,5)/10;bouncebegin,0.7;y,-25;rotationz,0;); }; LoadFont("Common Normal")..{ Text = "N"; InitCommand = cmd(x,0-20;y,25;zoom,3;diffusebottomedge,Color.Red or color("#FF0000")); OnCommand = cmd(y,-SCREEN_CENTER_Y+50-50;rotationz,math.random(-10,10);sleep,math.random(1,5)/10;bouncebegin,0.7;y,25;rotationz,0;); }; LoadFont("Common Normal")..{ Text = "o"; InitCommand = cmd(x,50-30;y,25;zoom,3;diffusebottomedge,Color.Red or color("#FF0000")); OnCommand = cmd(y,-SCREEN_CENTER_Y+50-50;rotationz,math.random(-10,10);sleep,math.random(1,5)/10;bouncebegin,0.7;y,25;rotationz,0;); }; LoadFont("Common Normal")..{ Text = "!"; InitCommand = cmd(x,80-30;y,25;zoom,3;diffusebottomedge,Color.Red or color("#FF0000")); OnCommand = cmd(y,-SCREEN_CENTER_Y+50-50;rotationz,math.random(-10,10);sleep,math.random(1,5)/10;bouncebegin,0.7;y,25;rotationz,0;); }; }; LoadActor("MAY")..{ SigMessageCommand=cmd(play); }; LoadActor("MEMEDirected (loop)")..{ DirectedMessageCommand=cmd(play); }; Def.Quad{ DirectedMessageCommand=cmd(zoom,99999;diffuse,color("#000000FF");); }; LoadFont("_century schoolbook 72px")..{ OnCommand=cmd(diffusealpha,0;Center;zoom,0.35;); DirectedMessageCommand=function(self) self:sleep(1.234) self:diffusealpha(1) self:settext("Directed by\nROBERT B.WEIDE") self:sleep(4.526-1.234) self:queuecommand("Ex") end; ExCommand=cmd(settext,"Executive Producer\nLARRY DAVID";sleep,7.794-4.526;queuecommand,"me"); meCommand=function(self) local lt = "Executive Producer\n"; for player in ivalues(GAMESTATE:GetHumanPlayers()) do lt=lt..PN_Name(player).." "; end self:settext(lt) end }; Def.Quad{ InitCommand=cmd(FullScreen;diffuse,color("#00000000")); NeFailMessageCommand=cmd(linear,0.2;diffusealpha,1;linear,0.5;diffusealpha,0;linear,2;diffuse,{0.4,0.1,0.1,0.6}); }; Def.Quad{ InitCommand=cmd(FullScreen;diffuse,color("#FF888800");blend,"BlendMode_Modulate"); NeFailMessageCommand=cmd(diffusealpha,1); }; Def.Sprite{ InitCommand=cmd(blend,"BlendMode_Add";CenterX;y,SCREEN_CENTER_Y-100;animate,false;zoom,0.9;diffuse,{1,0,0,0}); OnCommand=cmd(Load,THEME:GetCurrentThemeDirectory().."Graphics/_GraphFont/BigCount/FAIL.png"); NeFailMessageCommand=cmd(sleep,Ror;decelerate,0.5;diffusealpha,1;y,SCREEN_CENTER_Y-50); }; LoadActor("Failll") .. { NeFailMessageCommand=cmd(play); }; };]] --[[ Control Part ]] if ToEnumShortString(GAMESTATE:GetCurrentStage()) == "Event" and not IsNetConnected() then t[#t+1] = Def.ActorFrame{ LoadFont("Common Normal")..{ Text="-Retry-"; InitCommand=cmd(diffusealpha,0); AFTERFAILMessageCommand=cmd(CenterX;y,SCREEN_CENTER_Y+15+80;zoom,5;diffuse,Color.Magenta;diffusealpha,0;wag;effectmagnitude,0,0,-2;effectperiod,10;effectoffset,3;sleep,Ror;decelerate,0.5;diffusealpha,1;diffuse,Color.Green;zoom,2); YestoNewMessageCommand=cmd(stoptweening;decelerate,0.25;diffuse,Color.Green;diffusealpha,1;zoom,2); NotoNewMessageCommand=cmd(stoptweening;decelerate,0.25;diffuse,Color.Magenta;diffusealpha,1;zoom,1.5); HideMenuuuMessageCommand=cmd(stoptweening;visible,false); }; LoadFont("Common Normal")..{ Text="-Give it up-"; InitCommand=cmd(diffusealpha,0); AFTERFAILMessageCommand=cmd(CenterX;y,SCREEN_CENTER_Y+60+80;zoom,5;diffuse,Color.Magenta;diffusealpha,0;wag;effectmagnitude,0,0,-2;effectperiod,10;effectoffset,5;sleep,Ror;decelerate,0.5;diffusealpha,1;zoom,1.5); YestoSWYDMessageCommand=cmd(stoptweening;decelerate,0.25;diffuse,Color.Green;diffusealpha,1;zoom,2); NotoSWYDMessageCommand=cmd(stoptweening;decelerate,0.25;diffuse,Color.Magenta;diffusealpha,1;zoom,1.5); HideMenuuuMessageCommand=cmd(stoptweening;visible,false); }; Def.Quad{ InitCommand=cmd(zoom,999999;diffuse,color("#55555500")); AFTERFAILMessageCommand=function(self) self:sleep(Ror):queuecommand('LOOOP') end; LOOOPCommand=function(self) Allow_Press = true; end; }; Def.Quad { InitCommand=cmd(diffusealpha,0;rotationx,35;); BeginCommand=cmd(diffuse,color("#00000000");Center;zoom,9999); RetMessageCommand=cmd(decelerate,0.75;diffusealpha,1;rotationx,0;queuecommand,"Goo"); GooCommand=function() TP.Eva.readyState = 2; SCREENMAN:GetTopScreen():SetNextScreenName("ScreenProfileSave"):StartTransitioningScreen("SM_DoNextScreen"); end; }; Def.Quad{ InitCommand=cmd(zoom,9999;diffuse,Color.Black;diffusealpha,0); OnCommand=cmd(playcommand,'GOO'); GOOCommand=function(self) --printf(" Let her = %s %d",tostring(IDontWantLetHerGo),math.random(00,99)) if not IDontWantLetHerGo then self:accelerate(0.5):diffuse(color("#FFAAAA")):diffusealpha(1) else self:sleep(0.02):queuecommand("GOO") end end; }; LoadActor( THEME:GetPathS("Common","start") )..{ _FailOkayMessageCommand=cmd(play); }; LoadActor( THEME:GetPathS("Common","value") )..{ _FailArrowMessageCommand=cmd(play); }; }; end return t;
local beautiful = require("beautiful") local awful = require("awful") local gtable = require("gears.table") local hotkeys_popup = require("awful.hotkeys_popup").widget -- Enable hotkeys help widget for VIM and other apps -- -- when client with a matching name is opened: require("awful.hotkeys_popup.keys") -- default config beautiful.menu_fg_normal = M.x.on_surface beautiful.menu_bg_normal = M.x.surface beautiful.menu_fg_focus = M.x.on_primary beautiful.menu_bg_focus = M.x.primary -- {{{ Menu -- Create a launcher widget and a main menu local myawesomemenu = { { "hotkeys", function() return false, hotkeys_popup.show_help end}, { "manual", terminal_cmd .. "man awesome" }, { "edit config", editor_cmd .. " " .. awesome.conffile }, { "restart", awesome.restart }, { "quit", function() exit_screen_show() end} } local myappmenu = { { "ncmpcpp", terminal .. terminal_args[1] .. "music_n" .. terminal_args[2] .. "ncmpcpp" }, { "cava", terminal .. terminal_args[1] .. "music_c" .. terminal_args[2] .. "cava" }, { "web", web_browser }, { "virtualbox", "firejail VirtualBox" }, { "weechat", terminal .. terminal_args[1] .. "chat" .. terminal_args[2] .. "weechat" }, { "mutt", terminal .. terminal_args[1] .. "mail" .. terminal_args[2] .. "mutt" }, { "ranger", terminal_cmd .. "ranger" }, { "gimp", gimp } } local mypentestmenu = { { "metasploit", terminal_cmd .. "msf" }, { "leaked", terminal_cmd .. "leaked.py" }, { "burpsuite", burpsuite } } local mygamemenu = { { "baldur's gate 1", "" }, { "baldur's gate 2", "" }, { "don't starve", "" } } local mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, { "open terminal", terminal }, { "apps", myappmenu }, { "pentest tools", mypentestmenu }, { "games", mygamemenu } } }) -- Mouse bindings root.buttons(gtable.join( awful.button({}, 3, function () mymainmenu:toggle() end), awful.button({}, 4, awful.tag.viewnext), awful.button({}, 5, awful.tag.viewprev) )) return mymainmenu
--[[ Common Stuff (part 1) ]] -- Modification Flags -- If you ever change a setting of the Interface object, will add one of these flags to it. -- This will be sent to the client to know what to read in the net message to save networking local Modify = { volume = 1, time = 2, pos = 4, playing = 8, playback_rate = 16, direction = 32, parented = 64, radius = 128, looping = 256, destroyed = 512 } local function hasModifyFlag(...) return bit.band(...) ~= 0 end --- Debug function that's exported as well local function getFlags(number) local out = {} for enum_name, enum_val in pairs(Modify) do if hasModifyFlag(number, enum_val) then table.insert(out, enum_name) end end return out end -- SERVER local WAAdminOnly = CreateConVar("wa_admin_only", "0", FCVAR_REPLICATED, "Whether creation of WebAudio objects should be limited to admins. 0 for everyone, 1 for admins, 2 for superadmins. wa_enable_sv takes precedence over this", 0, 2) local WAMaxStreamsPerUser = CreateConVar("wa_stream_max", "5", FCVAR_REPLICATED, "Max number of streams a player can have at once.", 1) -- SHARED local WAEnabled = CreateConVar("wa_enable", "1", FCVAR_ARCHIVE + FCVAR_USERINFO, "Whether webaudio should be enabled to play on your client/server or not.", 0, 1) local WAMaxVolume = CreateConVar("wa_volume_max", "300", FCVAR_ARCHIVE, "Highest volume a webaudio sound can be played at, in percentage. 200 is 200%. SHARED Convar", 0, 100000) local WAMaxRadius = CreateConVar("wa_radius_max", "10000", FCVAR_ARCHIVE, "Farthest distance a WebAudio stream can be heard from. Will clamp to this value. SHARED Convar", 0) local WAFFTEnabled = CreateConVar("wa_fft_enable", "1", FCVAR_ARCHIVE, "Whether FFT data is enabled for the server / your client. You shouldn't need to disable it as it is very lightweight.", 0, 1) local Black = Color(0, 0, 0) local Color_Warn = Color(243, 71, 41) local Color_Notify = Color(65, 172, 235) local White = Color(255, 255, 255) local function warn(...) local msg = string.format(...) MsgC(Black, "[", Color_Warn, "WA", Black, "]", White, ": ", msg, "\n") end local function notify(...) local msg = string.format(...) MsgC(Black, "[", Color_Notify, "WA", Black, "]", White, ": ", msg, "\n") end if WebAudio and WebAudio.disassemble then if SERVER then -- Make sure to also run wire_expression2_reload (after this) if working on this addon with hot reloading. notify("Reloaded!") end WebAudio.disassemble() end --[[ OOP ]] --- Initiate WebAudio struct for both realms _G.WebAudio = {} WebAudio.__index = WebAudio local WebAudioCounter = 0 local WebAudios = {} -- TODO: See why weak kv doesn't work clientside for this local MaxID = 1023 -- UInt10. Only 1024 concurrent webaudio streams are allowed, if you use more than that then you've probably already broken the server local TopID = -1 -- Current top-most id. Set to -1 since we will increment first, having the ids start at 0. local IsSequential = true -- Boost for initial creation when no IDs have been dropped. local function register(id) -- id is set as occupied in the constructor through WebAudios WebAudioCounter = WebAudioCounter + 1 TopID = id return id end --- Alloc an id for a webaudio stream & register it to WebAudios -- Modified from https://gist.github.com/Vurv78/2de64f77d04eb409abed008ab000e5ef -- @param self WebAudio stream local function allocID() if WebAudioCounter > MaxID then return end if IsSequential then return register(TopID + 1) end local left_until_loop = MaxID - TopID -- Avoid constant modulo with two for loops for i = 1, left_until_loop do local i2 = TopID + i if not WebAudios[i2] then return register(i2) end end for i = 0, TopID do if not WebAudios[i] then return register(i) end end end debug.getregistry()["WebAudio"] = WebAudio --- Returns whether the WebAudio object is valid and not destroyed. -- @return boolean If it's Valid function WebAudio:IsValid() return not self.destroyed end --- Returns whether the WebAudio object is Null -- @return boolean Whether it's destroyed/null function WebAudio:IsDestroyed() return self.destroyed end --- Destroys a webaudio object and makes it the same (value wise) as WebAudio.getNULL() -- @param boolean transmit If SERVER, should we transmit the destruction to the client? Default true function WebAudio:Destroy(transmit) if self:IsDestroyed() then return end if transmit == nil then transmit = true end if CLIENT and self.bass then self.bass:Stop() elseif transmit then if self.AddModify then -- Bandaid fix for garbage with autorefresh -- 1. create stream -- 2. wire_expression2_reload -- 3. autorefresh this file -- AddModify won't exist. self:AddModify(Modify.destroyed) self:Transmit() end end local id = self.id if WebAudios[id] then -- Drop ID WebAudioCounter = WebAudioCounter - 1 IsSequential = false WebAudios[id] = nil end for k in next, self do self[k] = nil end self.destroyed = true return true end --- Returns time elapsed in URL stream. -- Time elapsed is calculated on the server using playback rate and playback time. -- Not perfect for the clients and there will be desync if you pause and unpause constantly. -- @return number Elapsed time function WebAudio:GetTimeElapsed() return self.stopwatch:GetTime() end --- Returns the volume of the object set by SetVolume -- @return number Volume from 0-1 function WebAudio:GetVolume() return self.volume end --- Returns the position of the WebAudio object. -- @return vector? Position of the stream or nil if not set. function WebAudio:GetPos() return self.pos end --- Returns the radius of the stream set by SetRadius -- @return number Radius function WebAudio:GetRadius() return self.radius end --- Returns the playtime length of a WebAudio object. -- @return number Playtime Length function WebAudio:GetLength() return self.length end --- Returns the file name of the WebAudio object. Not necessarily always the URL. -- @return string File name function WebAudio:GetFileName() return self.filename end --- Returns the state of the WebAudio object -- @return number State, See STOPWATCH_* Enums function WebAudio:GetState() return self.stopwatch:GetState() end --- Returns whether the webaudio stream is looping (Set by SetLooping.) -- @return boolean Looping function WebAudio:GetLooping() return self.looping end --- Returns whether the stream is parented or not. If it is parented, you won't be able to set it's position. -- @return boolean Whether it's parented function WebAudio:IsParented() return self.parented end -- Static Methods local WebAudioStatic = {} -- For consistencies' sake, Static functions will be lowerCamelCase, while object / meta methods will be CamelCase. --- Returns an unusable WebAudio object that just has the destroyed field set to true. -- @return Webaudio The null stream function WebAudioStatic.getNULL() return setmetatable({ destroyed = true }, WebAudio) end -- Bit lengths local ID_LEN = 10 local MODIFY_LEN = 10 local FFTSAMP_LEN = 8 WebAudio.ID_LEN = ID_LEN WebAudio.MODIFY_LEN = MODIFY_LEN WebAudio.FFTSAMP_LEN = FFTSAMP_LEN --- Same as net.ReadUInt but doesn't need the bit length in order to adapt our code more easily. -- @return number UInt10 function WebAudioStatic.readID() return net.ReadUInt(ID_LEN) end --- Faster version of WebAudio.getFromID( WebAudio.readID() ) -- @return WebAudio? The stream or nil if it wasn't found function WebAudioStatic.readStream() return WebAudios[ net.ReadUInt(ID_LEN) ] end --- Same as net.WriteUInt but doesn't need the bit length in order to adapt our code more easily. -- @param number id UInt10 (max id is 1023) function WebAudioStatic.writeID(id) net.WriteUInt(id, ID_LEN) end --- Same as net.WriteUInt but doesn't need the bit length in order to adapt our code more easily. -- @param WebAudio stream The stream. This is the same as WebAudio.writeID( stream.id ) function WebAudioStatic.writeStream(stream) net.WriteUInt(stream.id, ID_LEN) end --- Reads a WebAudio Modify enum -- @return number UInt16 function WebAudioStatic.readModify() return net.ReadUInt(MODIFY_LEN) end --- Writes a WebAudio Modify enum -- @param number UInt16 function WebAudioStatic.writeModify(modify) net.WriteUInt(modify, MODIFY_LEN) end function WebAudioStatic.getFromID(id) return WebAudios[id] end function WebAudioStatic.getList() return WebAudios end local next = next --- Returns an iterator for the global table of all webaudio streams. Use this in a for in loop -- @return function Iterator, should be the same as ipairs / next -- @return table Global webaudio table. Same as WebAudio.getList() -- @return number Origin index, will always be nil (0 would be ipairs) function WebAudioStatic.getIterator() return next, WebAudios, nil end --- Returns the number of currently active streams -- Cheaper than manually calling __len on the webaudio table as we keep track of it ourselves. function WebAudioStatic.getCountActive() return WebAudioCounter end local function isWebAudio(v) if not istable(v) then return end return debug.getmetatable(v) == WebAudio end WebAudioStatic.instanceOf = isWebAudio --- If you want to extend the static functions -- @return table The WebAudio static function / var table. function WebAudioStatic.getStatics() return WebAudioStatic end --- Used internally. Should be called both server and client as it doesn't send any net messages to destroy the ids to the client. -- Called on WebAudio reload to stop all streams function WebAudioStatic.disassemble() for k, stream in WebAudio.getIterator() do stream:Destroy(not SERVER) end end local function createWebAudio(_, url, owner, bassobj, id) assert( WebAudio.isWhitelistedURL(url), "'url' argument must be given a whitelisted url string." ) -- assert( owner and isentity(owner) and owner:IsPlayer(), "'owner' argument must be a valid player." ) -- Commenting this out in case someone wants a webaudio object to be owned by the world or something. local self = setmetatable({}, WebAudio) self.id = id or allocID() -- allocID will return nil if there's no slots left. if id == nil and not self.id then error("Reached maximum amount of concurrent WebAudio streams!") end self.url = url self.owner = owner -- Mutable -- self.playing = false self.destroyed = false self.parented = false self.parent = nil -- Entity self.modified = 0 self.playback_rate = 1 self.volume = 1 self.time = 0 self.radius = math.min(200, WAMaxRadius:GetInt()) -- Default IGmodAudioChannel radius self.pos = nil self.direction = Vector() self.looping = false -- Mutable -- -- Net vars self.needs_info = SERVER -- Whether this stream still needs information from the client. self.length = -1 self.filename = "" self.fft = {} -- SERVER will receive this every think by default. if CLIENT then self.bass = bassobj self.parent_pos = Vector() -- Parent pos being nil means we will go directly to the parent's position w/o calculating local pos. else self.stopwatch = StopWatch(100, function(watch) if not watch:GetLooping() then self:Pause() end end) self.ignored = RecipientFilter() net.Start("wa_create", true) WebAudio.writeID(self.id) net.WriteString(self.url) net.WriteEntity(self.owner) self:Broadcast() -- Defined in wa_interface end WebAudios[self.id] = self return self end setmetatable(WebAudio, { __index = WebAudioStatic, __call = createWebAudio }) --[[ Whitelist handling ]] -- Match, IsPattern local function pattern(str) return { str, true } end local function simple(str) return { string.PatternSafe(str), false } end local registers = { ["pattern"] = pattern, ["simple"] = simple } -- Inspired / Taken from StarfallEx & Metastruct/gurl -- No blacklist for now, just don't whitelist anything that has weird other routes. --- Note #1 (For PR Help) -- Sites cannot track users / do any scummy shit with your data unless they're a massive corporation that you really can't avoid anyways. -- So don't think about PRing your own website -- Also these have to do with audio since this is an audio based addon. --- Note #2 -- Create a file called webaudio_whitelist.txt in your data folder to overwrite this, works on the server box or on your client. -- Example file might look like this: -- ``` -- pattern %w+%.sndcdn%.com -- simple translate.google.com -- ``` local Whitelist = { -- Soundcloud pattern [[%w+%.sndcdn%.com/.+]], -- Google Translate Api, Needs an api key. simple [[translate.google.com]], -- Discord pattern [[cdn[%w-_]*%.discordapp%.com/.+]], -- Reddit simple [[i.redditmedia.com]], simple [[i.redd.it]], simple [[preview.redd.it]], -- Shoutcast simple [[yp.shoutcast.com]], -- Dropbox simple [[dl.dropboxusercontent.com]], pattern [[%w+%.dl%.dropboxusercontent%.com/(.+)]], simple [[www.dropbox.com]], simple [[dl.dropbox.com]], -- Github simple [[raw.githubusercontent.com]], simple [[gist.githubusercontent.com]], simple [[raw.github.com]], simple [[cloud.githubusercontent.com]], -- Steam simple [[steamuserimages-a.akamaihd.net]], simple [[steamcdn-a.akamaihd.net]], -- Gitlab simple [[gitlab.com]], -- Onedrive simple [[onedrive.live.com/redir]], -- ytdl host. Requires 2d mode which we currently don't support. simple [[youtubedl.mattjeanes.com]] } local CustomWhitelist = false local function loadWhitelist(reloading) if file.Exists("webaudio_whitelist.txt", "DATA") then CustomWhitelist = true local dat = file.Read("webaudio_whitelist.txt", "DATA") local new_list, ind = {}, 1 for line in dat:gmatch("[^\r\n]+") do local type, match = line:match("(%w+)%s+(.*)") local reg = registers[type] if reg then new_list[ind] = reg(match) ind = ind + 1 elseif type ~= nil then -- Make sure type isn't nil so we ignore empty lines warn("Invalid entry type found [\"", type, "\"] in webaudio_whitelist\n") end end notify("Whitelist from webaudio_whitelist.txt found and parsed with %d entries!", ind) Whitelist = new_list elseif reloading then notify("Couldn't find your whitelist file! %s", CLIENT and "Make sure to run this on the server if you want to reload the server's whitelist!" or "") end end local function isWhitelistedURL(url) if not isstring(url) then return false end local relative = url:match("^https?://(.*)") if not relative then return false end for _, data in ipairs(Whitelist) do local match, is_pattern = data[1], data[2] local haystack = is_pattern and relative or (relative:match("(.-)/.*") or relative) if haystack:find( "^" .. match .. (is_pattern and "" or "$") ) then return true end end return false end concommand.Add("wa_reload_whitelist", loadWhitelist) WebAudioStatic.isWhitelistedURL = isWhitelistedURL WebAudio.Common = { -- Object WebAudio = WebAudio, -- Common warn = warn, notify = notify, Modify = Modify, hasModifyFlag = hasModifyFlag, getFlags = getFlags, -- Convars WAAdminOnly = WAAdminOnly, WAMaxStreamsPerUser = WAMaxStreamsPerUser, WAEnabled = WAEnabled, WAMaxVolume = WAMaxVolume, WAMaxRadius = WAMaxRadius, WAFFTEnabled = WAFFTEnabled, -- Whitelist loadWhitelist = loadWhitelist, CustomWhitelist = CustomWhitelist, -- If we're using a user supplied whitelist. Whitelist = Whitelist } AddCSLuaFile("webaudio/receiver.lua") if CLIENT then include("webaudio/receiver.lua") else include("webaudio/interface.lua") end return WebAudio.Common
local d_pack = require'pb.standard.pack' local d_unpack = require'pb.standard.unpack' local bit = require'bit' local zigzag = d_pack.zigzag64 local unzigzag = d_unpack.unzigzag64 local first = arg[1] or -100000000 local last = arg[2] or 100000000 local bits = tonumber(arg[3] or 64) if bits == 32 then zigzag = d_pack.zigzag32 unzigzag = d_unpack.unzigzag32 else bits = 64 end print(string.format("test range(%d <=> %d) bits=%d", first, last, bits)) for n=first,last do local n2 = unzigzag(zigzag(n)) if n ~= n2 then assert(n == n2, string.format('%d ~= %d: zigzag=%d', n, n2, d_pack.zigzag64(n))) end end
local KC = require('klib/container/container') local Helper = require('pda/behavior/helper') local Alert = KC.class('pda.behavior.Alert', function(self, agent) self.agent = agent end) Helper.define_name(Alert, "alert") function Alert:update() local entity = self.agent.entity local enemy = entity.surface.find_nearest_enemy({ position = entity.position, max_distance = 15, entity.force }) if (enemy ~= nil) then entity.selected_gun_index = 1 -- 以后改成寻找可用的武器 entity.shooting_state = { state = defines.shooting.shooting_enemies, position = enemy.position } else entity.shooting_state = { state = defines.shooting.not_shooting } end end return Alert
object_tangible_door_som_old_republic_facility_door = object_tangible_door_shared_som_old_republic_facility_door:new { } ObjectTemplates:addTemplate(object_tangible_door_som_old_republic_facility_door, "object/tangible/door/som_old_republic_facility_door.iff")
local AC = require 'aho-corasick' local count = 0 function error(e, t) print(count .. " " .. e) os.exit() end function test(s, d, r) count = count + 1 local t = AC.build(d) local f = AC.match(t, s) if #r ~= #f then error("Wrong number of results " .. #r .. ", " .. #f, t) end for i = 1,#r do if r[i] ~= f[i] then error("Non-matching result " .. r[i] .. ", " .. f[i], t) end end print(count .. " ok") end -- Example from Wikipedia page test("abccab", {"a", "ab", "bc", "bca", "c", "caa"}, {"a", "ab", "bc", "c", "c", "a", "ab"}) -- Simple test for finding a string test("The pot had a handle", {"poto"}, {}) test("The pot had a handle", {"The"}, {"The"}) test("The pot had a handle", {"pot"}, {"pot"}) test("The pot had a handle", {"pot "}, {"pot "}) test("The pot had a handle", {"ot h"}, {"ot h"}) test("The pot had a handle", {"andle"}, {"andle"}) -- Multiple non-overlapping patterns test("The pot had a handle", {"h"}, {"h", "h", "h"}) test("The pot had a handle", {"ha", "he"}, {"he", "ha", "ha"}) test("The pot had a handle", {"pot", "had"}, {"pot", "had"}) test("The pot had a handle", {"pot", "had", "hod"}, {"pot", "had"}) test("The pot had a handle", {"The", "pot", "had", "hod", "andle"}, {"The", "pot", "had", "andle"}) -- Overlapping patterns test("The pot had a handle", {"Th", "he pot", "The", "pot h"}, {"Th", "The", "he pot", "pot h"}) -- One pattern inside another test("The pot had a handle", {"handle", "hand", "and", "andle"}, {"hand", "and", "handle", "andle"}) test("The pot had a handle", {"handle", "hand", "an", "n"}, {"an", "n", "hand", "handle"}) test("The pot had a handle", {"dle", "l", "le"}, {"l", "dle", "le"}) -- Random example test("yasherhs", {"say", "she", "shr", "he", "her"}, {"she", "he", "her"}) -- Fail from partial match test("The pot had a handle", {"dlf", "l"}, {"l"}) -- Many suffixes and prefixes test("The pot had a handle", {"handle", "andle", "ndle", "dle", "le", "e"}, {"e", "handle", "andle", "ndle", "dle", "le", "e"}) test("The pot had a handle", {"handle", "handl", "hand", "han", "ha", "a"}, {"ha", "a", "a", "ha", "a", "han", "hand", "handl", "handle"}) -- Long word test("macintosh", {"acintosh", "in"}, {"in", "acintosh"}) test("macintosh", {"acintosh", "in", "tosh"}, {"in", "acintosh", "tosh"}) test("macintosh", {"acintosh", "into", "to", "in"}, {"in", "into", "to", "acintosh", })
function ink(n) if ROUND.gameMode.hell and ROUND.accumulated then ROUND.accumulated = nil addBlockPoint(ROUND.chair[n].owner) end local target = nextChair(ROUND.turn) local change = {} for i, v in pairs(ROUND.chair[target].hand) do if v[1] ~= "black" then if v[3] or v[2] == "batata" then v[1] = ROUND.topCard.card[1] else table.insert(ROUND.pile, 1, v) table.insert(change, i) end end end if BOT[ROUND.chair[target].owner] and BOT[ROUND.chair[target].owner].eventInk then BOT[ROUND.chair[target].owner].eventInk(ROUND.topCard.card[1]) end for i, v in pairs(change) do ROUND.chair[target].hand[v] = {ROUND.topCard.card[1], ROUND.chair[target].hand[v][2], true} end if ROUND.topCard.card[1] == "black" then unlockChair(ROUND.chair[target].owner, "gothic") end local fx = {red=13, blue=1, yellow=11, green=9, black=0} for i=1, 20 do tfm.exec.displayParticle(fx[ROUND.topCard.card[1]], math.random(-50,50)+ROUND.chair[target].x, 15, 0, math.random()*4, 0, 0, nil) end local qtd = #ROUND.chair[target].hand > 16 and 16 or #ROUND.chair[target].hand local maxx = math.floor(qtd*1.5) for i=1, maxx do tfm.exec.displayParticle(fx[ROUND.topCard.card[1]], math.random(-25*qtd,25*qtd)+400, math.random(290,330), 0, math.random()*3, 0, 0, ROUND.chair[target].owner) tfm.exec.displayParticle(fx[ROUND.topCard.card[1]], math.random(-25*qtd,25*qtd)+400, math.random(290,330), 0, math.random()*3, 0, 0, ROUND.chair[target].owner) end addFunctionTimer(function() for i=1, 20 do tfm.exec.displayParticle(fx[ROUND.topCard.card[1]], math.random(-50,50)+ROUND.chair[target].x, 15, 0, math.random()*4, 0, 0, nil) end local qtd = #ROUND.chair[target].hand > 16 and 16 or #ROUND.chair[target].hand local maxx = math.floor(qtd*1.5) for i=1, maxx do tfm.exec.displayParticle(fx[ROUND.topCard.card[1]], math.random(-25*qtd,25*qtd)+400, math.random(290,330), 0, math.random()*3, 0, 0, ROUND.chair[target].owner) tfm.exec.displayParticle(fx[ROUND.topCard.card[1]], math.random(-25*qtd,25*qtd)+400, math.random(290,330), 0, math.random()*3, 0, 0, ROUND.chair[target].owner) end end, 200) sortHand(ROUND.chair[target].hand) updateHand(target) passTurn() batataTimer(n) ROUND.chair[n].confuse = false end
local entity = {} entity["level"] = [[51]] entity["spellDeck"] = {} entity["spellDeck"][1] = [[Maragion]] entity["spellDeck"][2] = [[]] entity["spellDeck"][3] = [[Masukukaja]] entity["spellDeck"][4] = [[]] entity["spellDeck"][5] = [[]] entity["spellDeck"][6] = [[]] entity["heritage"] = {} entity["heritage"][1] = [[Fire]] entity["heritage"][2] = [[]] entity["resistance"] = {} entity["resistance"][1] = [[Normal]] entity["resistance"][2] = [[Normal]] entity["resistance"][3] = [[Normal]] entity["resistance"][4] = [[Null]] entity["resistance"][5] = [[Weak]] entity["resistance"][6] = [[Normal]] entity["resistance"][7] = [[Normal]] entity["resistance"][8] = [[Normal]] entity["resistance"][9] = [[Normal]] entity["desc"] = [[One of the Ssu-Ling, celestial creatures in Chinese myth. It represents the direction south, the season of summer and the element fire.]] --a function: evolveName entity["arcana"] = [[Sun]] entity["stats"] = {} entity["stats"][1] = [[32]] entity["stats"][2] = [[39]] entity["stats"][3] = [[32]] entity["stats"][4] = [[40]] entity["stats"][5] = [[29]] entity["name"] = [[Suzaku]] entity["spellLearn"] = {} entity["spellLearn"]["Growth 3"] = [[55]] entity["spellLearn"]["Mediarama"] = [[54]] entity["spellLearn"]["Agidyne"] = [[53]] entity["spellLearn"]["Resist Ice"] = [[57]] return entity
local json local config local logger local enums local http = require('coro-http') local yield,wrap,resume,running = coroutine.yield,coroutine.wrap,coroutine.resume,coroutine.running local p = require('pretty-print').prettyPrint local TTS = { request_url = "https://us-central1-sunlit-context-217400.cloudfunctions.net/streamlabs-tts", method = "POST", } local function request(voice, text) local headers = {{"Content-Type","application/json"}, {"Accepts", "application/json"}} local url = "https://us-central1-sunlit-context-217400.cloudfunctions.net/streamlabs-tts" local body = {voice = voice, text = text} body = json.stringify(body) local ojb = {} local thread = running() wrap(function() local res,obj = http.request("POST", url, headers, body) if res.code ~= 200 then logger:log(enums.logLevel.warning, "TTS request did not get response code 200.") ojb.error = res.code else ojb = json.decode(obj)["speak_url"] end assert(resume(thread)) end)() yield() p(ojb) return ojb end function TTS.request(args, voice, text, rawargs) if not args.msg.member.voiceChannel then return false, "You're not in a voice channel inside this discord guild!" end if text == "" then text = TTS.defaultts end local url = request(voice, text) if url.error then return false, ("TTS service returned error code " .. url.error) end if not url then return false, ("Was not able to fetch tts with voice " .. voice) end local arguments = {url} return Music:addToQueue(arguments, args.msg.author, args.msg.channel, args.msg.member.voiceChannel, rawargs.guild.id) end function TTS:__init() json = self.Deps.Json config = self.Deps.Config logger = self.Deps.Logger enums = self.Deps.Enums self.defaultts = config.Defaults.DefaultTTS end return TTS
weapon_model_id = 22 create_rocket_timer = 3000 rocket_timer_delay = 1000 rocket_lerp_each_server_delay = 25 rocket_speed_per_s = 6500 -- irl ~ 300m/s rocket_damage_vehicles = 5000 rocket_particle_id = 68 added_speed = rocket_timer_delay / 1000
local lpeg = require("lpeg") local chardata = characters.data local types = { "Bi", "Bi","CSR", "Vs", "VI", "VI", "VI", "VI", "VI", "C", "C", "C", "VI", "VI", "VI", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "N", "M", "M", "M", "M", "M", "M", "M", "M", "M", "CS", "CM", "CM", "V", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "Nd", "Nd", "Nd", "Nd", "Nd", "Nd", "Nd", "Nd", "Nd", "Nd", "x", "x", "x", "x", "x", "x" } jv = {} local P8 = function (c) return lpeg.P(SU.utf8char(c)) end for i = 1, #types do local cp = i - 1 + 0xA980 local match = P8(cp) jv[types[i]] = jv[types[i]] and (jv[types[i]]+match) or match end jv.medial_ra = P8(0xA9BF) jv.medial_ya = P8(0xA9BE) jv.tarung = P8(0xA9B4) jv.consonant = ((jv.C * jv.N) + jv.C + jv.VI) jv.consonant_sign = jv.Bi + jv.CSR + jv.Vs + jv.CM jv.syllable = (jv.consonant * jv.V)^-1 * jv.consonant * ((jv.medial_ra^-1) * jv.medial_ya)^-1 * (jv.M * jv.tarung^-1)^-1 * jv.consonant_sign^0 local nonsyll = (1 - jv.syllable)^0 local breakpoint = { node = SILE.nodefactory.newPenalty({ penalty = 0 }) } local utoke = function(text) -- Yuck local chunks = SU.splitUtf8(text) local tmp = {} for i = 1,#chunks do local cp = SU.codepoint(chunks[i]) if chardata[cp] and chardata[cp].linebreak == "sp" then coroutine.yield({ string = table.concat(tmp, "") }) tmp = {} coroutine.yield({ separator = chunks[i]}) elseif chardata[cp] and (chardata[cp].linebreak == "ba" or chardata[cp].linebreak == "zw") then coroutine.yield({ string = table.concat(tmp, "") }) tmp = {} coroutine.yield({ node = SILE.nodefactory.newPenalty({ penalty = 0 }) }) else tmp[#tmp+1] = chunks[i] end end coroutine.yield({ string = table.concat(tmp, "") }) end SILE.tokenizers.jv = function(text) local chunk = text return coroutine.wrap(function() while chunk:len() > 0 do local end_syll = jv.syllable:match(chunk) if end_syll then coroutine.yield({ string = string.sub(chunk, 1, end_syll -1 ) }) chunk = string.sub(chunk, end_syll) coroutine.yield(breakpoint) else local end_nonsyl = nonsyll:match(chunk) utoke(string.sub(chunk, 1, end_nonsyl -1 )) chunk = string.sub(chunk, end_nonsyl) end end end) end
-- Level description file for Breakout -- -- 0 = no tile -- 1 = solid tile -- 2..5 = non-solid tiles of different colors local LevelDescription = {} LevelDescription[1] = { {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, {4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4}, {4, 1, 4, 1, 4, 0, 0, 1, 0, 0, 4, 1, 4, 1, 4}, {3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3}, {3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3}, {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, } LevelDescription[2] = { {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 0, 5, 5, 0, 5, 5, 0, 5, 5, 0, 5, 5, 0, 1}, {1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1}, {1, 0, 3, 3, 0, 3, 3, 0, 3, 3, 0, 3, 3, 0, 1}, {1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1}, {1, 0, 2, 2, 0, 2, 2, 0, 2, 2, 0, 2, 2, 0, 1}, {1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1}, {1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1}, } LevelDescription[3] = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0}, {0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0}, {0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0}, {0, 0, 5, 5, 0, 5, 5, 5, 0, 5, 5, 0, 0}, {0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0}, {0, 3, 0, 1, 1, 1, 1, 1, 1, 1, 0, 3, 0}, {0, 3, 0, 3, 0, 0, 0, 0, 0, 3, 0, 3, 0}, {0, 0, 0, 0, 4, 4, 0, 4, 4, 0, 0, 0, 0}, } LevelDescription[4] = { {1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1}, {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, {2, 1, 3, 1, 4, 1, 5, 1, 4, 1, 3, 1, 2}, {2, 3, 3, 4, 4, 5, 5, 5, 4, 4, 3, 3, 2}, {2, 1, 3, 1, 4, 1, 5, 1, 4, 1, 3, 1, 2}, {2, 2, 3, 3, 4, 4, 5, 4, 4, 3, 3, 2, 2}, } LevelDescription[5] = { {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, {4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, } LevelDescription[6] = { {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, {4, 1, 1, 4, 4, 1, 4, 1, 4, 4, 1, 1, 4}, {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, {5, 5, 5, 1, 5, 5, 5, 5, 5, 1, 5, 5, 5}, {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, {4, 1, 1, 4, 4, 1, 4, 1, 4, 4, 1, 1, 4}, {5, 5, 5, 1, 5, 5, 5, 5, 5, 1, 5, 5, 5}, } LevelDescription[7] = { -- an easy one :) {2}, {3}, {4}, {5}, } return LevelDescription
-- luastg module loader for editor --local old={} --old._LoadImageFromFile=_LoadImageFromFile --old._LoadImageGroupFromFile=_LoadImageGroupFromFile current_module_name=nil current_module=nil current_dir=nil modules={} local new={} function new._LoadImageFromFile(teximgname,filename,mipmap,a,b,rect,edge) local a={} a.src=filename current_module.textures[teximgname]=a end function new._LoadImageFromFileE(teximgname,filename,mipmap,a,b,rect,edge) LoadTexture(teximgname,filename,mipmap) local w,h=GetTextureSize(teximgname) LoadImage(teximgname,teximgname,edge,edge,w-edge*2,h-edge*2,a,b,rect) end function LoadLuaModule(path) _LoadImageFromFile=new._LoadImageFromFile _LoadImageGroupFromFile=new._LoadImageGroupFromFile current_module_name=wx.wxFileName(path):GetName() current_module={} current_module.textures={} current_dir=wx.wxFileName(path):GetHomeDir() modules[current_module_name]=current_module dofile(path) end
-- Functions implementing operators, ie commands to be followed by a motion. local M = {} -- Implements c{motion} function M.change(start, end_, mtype) M.cut(start, end_, mtype) if mtype == 'linewise' then -- If linewise, should be editing in a new empty line if buffer.current_pos == 0 then -- start of buffer buffer.new_line() buffer.char_left() -- position cursor at start of the inserted -- line else buffer.char_left() buffer.new_line() end end end --- Delete a range from this buffer, and save in a register. -- If the register is not specified, use the unnamed register (""). function M.cut(start, end_, mtype, register) local linewise = mtype == 'linewise' if not linewise then -- If start/end_ are on different lines and there would only be -- whitespace left after the delete, then change to linewise. local sline = buffer:line_from_position(start) local eline = buffer:line_from_position(end_) if sline ~= eline then local sline_start = buffer:position_from_line(sline) local prestart = buffer:get_line(sline):sub(1, start-sline_start) local eline_start = buffer:position_from_line(eline) local postend = buffer:get_line(eline):sub(end_-eline_start+1) if prestart:match('^%s*$') and postend:match('^%s*$') then -- Switch to linewise linewise = true start = sline_start end_ = eline_start + buffer:line_length(eline) end end end buffer:set_sel(start, end_) local text = buffer:get_sel_text() buffer:cut() state.registers[register or '"'] = {text=text, line=linewise} end --- yank a range from this buffer, and save in a register. -- If the register is not specified, use the unnamed register (""). function M.yank(start, end_, mtype, register) local linewise = mtype == 'linewise' local orig_pos = buffer.current_pos buffer:set_sel(start, end_) local text = buffer:get_sel_text() buffer:clear_selections() buffer:goto_pos(orig_pos) state.registers[register or '"'] = {text=text, line=linewise} end function M.indent(start, end_, mtype) buffer:set_sel(start, end_) buffer:tab() buffer:clear_selections() buffer:goto_pos(buffer.line_indent_position[buffer:line_from_position(start)]) end function M.undent(start, end_, mtype) buffer:set_sel(start, end_) buffer:back_tab() buffer:clear_selections() buffer:goto_pos(buffer.line_indent_position[buffer:line_from_position(start)]) end -- Auto indent function M.reindent(start, end_, mtype) local line_start = buffer.line_from_position(start) local line_end = buffer.line_from_position(end_-1) local pat = vi_mode.lang.indents.xml.indent local dpat = vi_mode.lang.indents.xml.dedent local indent_inc = buffer.indent local next_indent = nil -- If this isn't the first line, then get the indent -- from the previous non-blank line local prev_lineno = line_start-1 while prev_lineno >= 0 do local prev_line = buffer:get_line(prev_lineno) if not prev_line:match('^%s*$') then local prev_indent = buffer.line_indentation[prev_lineno] next_indent = prev_indent + indent_inc * pat:match(prev_line) -- disregard any dedent we would have applied to the previous line next_indent = next_indent - indent_inc * dpat:match(prev_line) -- found a non-blank line, so stop. break end prev_lineno = prev_lineno-1 break end for lineno=line_start,line_end do local line = buffer:get_line(lineno) local indent_delta = pat:match(line) -- re-indent this line if next_indent then local this_indent = next_indent -- Special case - looking at this line may -- make us want to dedent (eg closing brace/tag) this_indent = this_indent + indent_inc * dpat:match(line) -- If a line is all blanks, remove any whitespace. buffer.line_indentation[lineno] = line:match('^%s*$') and 0 or this_indent else next_indent = 0 end next_indent = next_indent + indent_inc * indent_delta end end local function wrap_lines(lines, width) local alltext = table.concat(lines, " ") local result = {} local linelen = 0 -- length of this line local line = {} -- parts of this line local sentence_end = false for word in string.gmatch(alltext, "[^%s]+") do local newlen = linelen + string.len(word) + 1 if linelen > 0 and newlen > width then -- Doesn't fit, so start a new line table.insert(result, table.concat(line, " ")) line = {} linelen = 0 newlen = string.len(word) end -- double space after sentence endings, if not at end of line. if linelen > 0 and sentence_end then word = ' '..word newlen = newlen + 1 end table.insert(line, word) sentence_end = (word:sub(-1) == '.') linelen = newlen end if linelen > 0 then table.insert(result, table.concat(line, " ")) end return result end function M.wrap(start, end_, mtype) local width = 78 -- FIXME: configurable local line_start = buffer:line_from_position(start) local line_end = buffer:line_from_position(end_) -- Linewise motions stop at the position at the start of the next line. if mtype == 'linewise' and line_end >= 0 then line_end = line_end - 1 end local pos_start = buffer:position_from_line(line_start) local pos_end = buffer.line_end_position[line_end] local prefix = nil local lines_to_wrap = {} while line_start <= (line_end+1) do local line, new_prefix if line_start <= line_end then line = buffer:get_line(line_start) new_prefix = string.match(line, "^[>| ]*") else -- A dummy end iteration to output the result line = "dummy line" new_prefix = "invalid prefix" end if prefix == nil then prefix = new_prefix end local is_blank = line:sub(prefix:len()):match("^%s*$") if new_prefix ~= prefix or is_blank then -- New prefix; Emit previous wrapped lines and -- start again local endpos = buffer.position_from_line(line_start) local new_lines = wrap_lines(lines_to_wrap, width-string.len(prefix)) local new_parts = {} for _,l in ipairs(new_lines) do table.insert(new_parts,prefix) table.insert(new_parts,l) table.insert(new_parts,"\n") end buffer.set_selection(pos_start, endpos) local orig_end_line = buffer.line_from_position(endpos) local new_text = table.concat(new_parts) buffer.replace_sel(new_text) pos_start = buffer.selection_end local new_end_line = buffer.line_from_position(pos_start) buffer.clear_selections() -- Adjust line counts after wrapping text line_start = line_start + (new_end_line - orig_end_line) line_end= line_end + (new_end_line - orig_end_line) prefix = new_prefix lines_to_wrap = {} buffer.goto_pos(pos_start) buffer.line_up() end line_start = line_start + 1 -- If we're on a blank, then skip to the next line if is_blank then pos_start = buffer:position_from_line(line_start) else -- Otherwise add the line and keep looking table.insert(lines_to_wrap, string.sub(line, string.len(prefix))) end end buffer.goto_pos(buffer:position_from_line(line_end)) end return M
-- Create a TCP server PORT = 8181; ADDR = "192.168.4.1"; wifi.setmode(wifi.SOFTAP); wifi.start(); tmr.delay(2); srv = net.createServer(net.TCP, 30); srv:listen(PORT, ADDR, function(sock) sock:on("receive", function(sock, c) print(c); end) end)
local _, ns = ... local B, C, L, DB, P = unpack(ns) local M = P:GetModule("Misc") -- 宝箱开锁等级 do local Lockpicking = GetSpellInfo(1804) local TooltipCache = {} local LockedBoxes = { [16882] = 1, [4632] = 1, [6354] = 1, [6712] = 1, [4633] = 25, [16883] = 70, [4634] = 70, [6355] = 70, [4636] = 125, [4637] = 175, [13875] = 175, [16884] = 175, [4638] = 225, [5758] = 225, [5759] = 225, [5760] = 225, [16885] = 250, [13918] = 250, [12033] = 275, [29569] = 300, [31952] = 325, } local function GetLockpickLevel() if DB.MyClass ~= "ROGUE" then return 0 end for i = 1, GetNumSkillLines() do local skill, _, _, level = GetSkillLineInfo(i) if skill == Lockpicking then return level end end return 0 end local function OnTooltipSetItem_Hook(self) if self:IsForbidden() then return end local item = select(2, self:GetItem()) if not item then return end if not TooltipCache[item] then TooltipCache[item] = tonumber(strmatch(item, "item:(%d+)")) end item = TooltipCache[item] if LockedBoxes[item] then local skillLv = GetLockpickLevel() local boxLv = LockedBoxes[item] local colorStr = boxLv > skillLv and "|cffff0000" or "|cffffffff" for i = 1, self:NumLines() do local line = _G[self:GetName().."TextLeft"..i] if not line then break end local text = line:GetText() if text == LOCKED then self:AddLine(colorStr..format(ITEM_MIN_SKILL, Lockpicking, boxLv).."|r") return end end end end GameTooltip:HookScript("OnTooltipSetItem", OnTooltipSetItem_Hook) end
print('I was hoping this would work') for i,v in pairs(args) do print(i,v) end
--[=[ @Author: Gavin "Mullets" Rosenthal @Desc: DataSync, a custom DataStoreService wrapper ]=] --[=[ [DOCUMENTATION]: store = DataSync.GetStore(key,default) subscription = store:Subscribe(index,value,function) subscription:Unsubscribe() file = store:GetFile(index) file:GetData(value) file:UpdateData(value,data) file:IncrementData(value,number) file:SaveData() file:RemoveData() file:WipeData() file:Loaded() file:Ready() subscriptionParameters = { Stat = 'string'; Value = <any>; Key = 'store_key'; Index = 'store_index'; Player = player or nil; } Internal DataStore values: __CanSave - determines whether or not the DataFile can be saved __IsReady - this is false until the DataFile is ready for use __HasChanged - this will fire to true whenever data has changed, this will tell the DataStore whether to save or not [OUTLINE]: DataSync └─ .GetStore(key[,data]) ├─ :GetFile(index) │ ├─ :Ready() │ ├─ :Loaded() │ ├─ :GetData([value]) │ ├─ :UpdateData(value,data) │ ├─ :IncrementData(value,num) │ ├─ :SaveData() │ ├─ :WipeData() │ └─ :RemoveData() └─ :Subscribe(index,value,function) └─ :Unsubscribe() [LICENSE]: MIT License Copyright (c) 2020 Gavin "Mullets" Rosenthal Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]=] local DataSync = {} DataSync.__index = DataSync DataSync._Name = string.upper(script.Name) DataSync._ShuttingDown = false DataSync._Cache = {} DataSync._Stores = {} DataSync._Files = {} DataSync._Filters = {} DataSync._Defaults = {} DataSync._Network = {} DataSync._Sessions = {} DataSync._Subscriptions = {} DataSync._Remotes = { ["Download"] = "_DOWNLOAD", ["Upload"] = "_UPLOAD", ["Subscribe"] = "_SUBSCRIBE", ["Unsubscribe"] = "_UNSUBSCRIBE", } DataSync.Sync = true -- allow data to sync - highly recommended to leave this to true DataSync.Shutdown = true -- support BindToClose & autosave all DataFiles DataSync.AutoSave = true -- can DataFiles autosave DataSync.AutoSaveTimer = 30 -- how often, in seconds, a DataFile autosaves DataSync.FailProof = false -- kick the player if the datastore failed loading player-based data DataSync.All = "all" -- the 'all' variable for streamlining data types local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Loader")) local Manager = require("Manager") local Network = require("Network") local Methods = require(script:WaitForChild("Methods")) local Subscribe = require(script:WaitForChild("Subscribe")) local Players = game:GetService("Players") --[=[ Get the Player from either the instance or UserId @param index string | number | Instance -- find the player from the index @return Player? ]=] local function GetPlayer(index: string | number | Instance): Player? if typeof(index) == "Instance" and index:IsA("Player") then return index elseif tonumber(index) then local success, player = pcall(function() return Players:GetPlayerByUserId(tonumber(index)) end) if success then return player end end end --[=[ Get a DataStore object on a key @param key string -- the DataStore key required @param data? table -- if you set a default table to load player data @return DataStoreObject @outline GetStore ]=] function DataSync.GetStore(key: string, data: table?): typeof(DataSync.GetStore()) if DataSync._Stores[key] and not data then return DataSync._Stores[key] end if not DataSync._Cache[key] then DataSync._Cache[key] = {} end if not DataSync._Defaults[key] and typeof(data) == "table" then DataSync._Defaults[key] = data end local store = { _key = key, } setmetatable(store, DataSync) DataSync._Stores[key] = store return store end --[=[ A blacklist/whitelist filter for saving keys on a datastore @param keys table -- the keys to filter @param filter? boolean -- if true, only save these keys, if false, don't save those keys @outline FilterKeys ]=] function DataSync:FilterKeys(keys: table, filter: boolean?): typeof(DataSync.GetStore()) assert(self._key, "':FilterKeys' can only be used with a store") if not DataSync._Defaults[self._key] then warn("Unable to set filter, no Default Data table found") return self end DataSync._Filters[self._key] = { ["Keys"] = keys, ["Type"] = filter and "Whitelist" or "Blacklist", } return self end --[=[ Get a DataFile Object with an index on a store @param index string | number | nil & client -- the index on the DataStore @return DataFileObject @outline GetFile ]=] function DataSync:GetFile(index: string | number | nil): typeof(DataSync:GetFile()) assert(self._key, "':GetFile' can only be used with a store") if not index and Manager.IsClient and Players.LocalPlayer then index = tostring(Players.LocalPlayer.UserId) else index = tostring(index) end if not DataSync._Sessions[index] then DataSync._Sessions[index] = { lock = false, loading = false, } end local player = GetPlayer(index) local data = { _key = self._key, _file = index, _loaded = false, _ready = false, } if (not DataSync._Defaults[data._key] and Manager.IsServer) or DataSync._Files[index] or DataSync._Sessions[index].lock then while not DataSync._Files[index] do Manager.Wait() end return DataSync._Files[index] end DataSync._Sessions[index].lock = true if not DataSync._Cache[data._key][index] and Manager.IsServer and not DataSync._Sessions[index].loading then DataSync._Sessions[index].loading = true local load, success = Methods.LoadData(data._key, index, DataSync._Defaults[data._key]) if not success then if load == Methods._Private .. "OCCUPIED" then while not DataSync._Files[index] do Manager.Wait() end return DataSync._Files[index] end warn("DataStores are currently down; returning default data") if player and not Manager.IsStudio and DataSync.FailProof then player:Kick("\n" .. "DataStores are currently down, please try again later") return nil end data._loaded = false else data._loaded = true end DataSync._Cache[data._key][index] = load DataSync._Sessions[index].loading = false end setmetatable(data, DataSync) if Manager.IsClient and DataSync.Sync then local download = Network:InvokeServer(DataSync._Remotes.Upload, data._key, index) local cache = download or {} DataSync._Cache[data._key][index] = cache if cache[Methods._Private .. "CanSave"] then data._loaded = true else data._loaded = false end if player and player == Players.LocalPlayer then self:Subscribe(index, { "all" }) end end if DataSync.AutoSave and Manager.IsServer then Manager.Wrap(function() while Manager.Wait(DataSync.AutoSaveTimer) do if player then local success, _ = Manager.Retry(1, function() return Players:GetPlayerByUserId(index) end) if not success then break end end if DataSync._Cache[data._key][index] == nil then break end data:SaveData() end end) end data:UpdateData(Methods._Private .. "IsReady", true) data:UpdateData(Methods._Private .. "HasChanged", false) DataSync._Files[index] = data DataSync._Sessions[index].lock = false data._ready = true return data end --[=[ Validates if the DataFile loaded or not @return boolean @outline Loaded ]=] function DataSync:Loaded(): boolean assert(self._key, "':Loaded' can only be used with a DataFile") while self._loaded == nil do Manager.Wait() end return self._loaded end --[=[ Validates if the DataFile is ready @return boolean @outline Ready ]=] function DataSync:Ready(): boolean assert(self._key, "':Ready' can only be used with a DataFile") while self._ready == nil do Manager.Wait() end return self._ready end --[=[ Get the value of a specified data or the entire DataFile @param value? string | number -- the value to grab data from @return DataValue | DataFile? @outline GetData ]=] function DataSync:GetData(value: string | number | nil): any? | table assert(self._file, "':GetData' can only be used with a data file") local file = DataSync._Cache[self._key][self._file] while not DataSync._Cache[self._key][self._file] do Manager.Wait() end file = DataSync._Cache[self._key][self._file] if value ~= nil then return file[value] else return file end end --[=[ Update a given value with any type of data @param value string | table -- the specific value in a DataFile, provide a table to override a file @param data any? -- any valid type can be provided to a value @return DataFileObject @outline UpdateData ]=] function DataSync:UpdateData(value: string, data: any?): typeof(DataSync:GetFile()) assert(self._file, "':UpdateData' can only be used with a data file") local file = DataSync._Cache[self._key][self._file] if data == nil and DataSync._Defaults[self._key][value] ~= nil then data = DataSync._Defaults[self._key][value] end if file == nil and Manager.IsServer then while DataSync._Cache[self._key][self._file] == nil do Manager.Wait() end file = DataSync._Cache[self._key][self._file] end if typeof(value) == "table" then file = value else file[value] = data end if string.sub(tostring(value), 1, #Methods._Private) ~= Methods._Private then if not file["__HasChanged"] then file["__HasChanged"] = true end end local tosend = file[value] ~= nil and file[value] or file DataSync._Cache[self._key][self._file] = file self:_FireSubscriptions(self._file, value, tosend) return self end --[=[ Increment a numerical value with the given number @param value string -- the specific value in a DataFile @param num number -- how much to increment/decrement @return DataFileObject @outline IncrementData ]=] function DataSync:IncrementData(value: string, num: number): typeof(DataSync:GetFile()) assert(self._file, "':UpdateData' can only be used with a data file") local current = self:GetData(value) if typeof(current) == "number" then self:UpdateData(value, current + num) else error("':IncrementData' failed, tried to increment a non-number") end return self end --[=[ Save a DataFile to the cloud (Roblox DataStores) @return DataFileObject @outline SaveData ]=] function DataSync:SaveData(_override: boolean?): typeof(DataSync:GetFile()) assert(self._file, "':SaveData' can only be used with a data file") assert(Manager.IsServer, "':SaveData' only works on the server") if (DataSync._ShuttingDown and not _override) or self._sesh then return self end self._sesh = true local file = DataSync._Cache[self._key][self._file] local clone = Manager.DeepCopy(file) local filter = DataSync._Filters[self._key] if filter and filter["Type"] == "Whitelist" then for key, _ in pairs(file) do if not table.find(filter["Keys"], key) then clone[key] = nil end end elseif filter and filter["Type"] == "Blacklist" then for key, _ in pairs(file) do if table.find(filter["Keys"], key) then clone[key] = nil end end end local _, success = Methods.SaveData(self._key, self._file, clone) if not success then warn("!URGENT! Failed to save file '" .. self._file .. "' on store '" .. self._key .. "'") end if DataSync._Cache[self._key][self._file] then DataSync._Cache[self._key][self._file][Methods._Private .. "HasChanged"] = false end self._sesh = false return self end --[=[ Remove & destroy a DataFile from cache @return DestroyedDataFileObject @outline RemoveData ]=] function DataSync:RemoveData(_override: boolean?): typeof(DataSync:RemoveData()) assert(self._file, "':RemoveData' can only be used with a data file") if self._sesh then return self end if DataSync._ShuttingDown and not _override then return self end if DataSync._Cache[self._key][self._file] ~= nil then for index, _ in pairs(DataSync._Cache[self._key][self._file]) do DataSync._Cache[self._key][self._file][index] = nil end DataSync._Cache[self._key][self._file] = nil end if DataSync._Subscriptions[self._key .. self._file] ~= nil then DataSync._Subscriptions[self._key .. self._file]:Unsubscribe() end if DataSync._Files[self._file] then DataSync._Files[self._file] = nil end return self end --[=[ Wipe a DataFile from the cloud (Roblox DataStores) @Return DataFileObject @outline WipeData ]=] function DataSync:WipeData(): typeof(DataSync:GetFile()) assert(self._file, "':WipeData' can only be used with a data file") assert(Manager.IsServer, "':SaveData' only works on the server") Methods.WipeData(self._key, self._file) return self end --[=[ Subscribe to an index with a value and possibly a provided function @param index number | string | Instance -- the index can be a number or Player, and converted to string @param value string -- the value for the file @param code function -- the function which to be called whenever the value changes @outline Subscribe ]=] function DataSync:Subscribe(index: string | number | Player, value: string | table, code: (any) -> nil, _sent: Player?): typeof(DataSync:Subscribe()) assert(self._key, "':Subscribe' can only be used with a store") value = typeof(value) == "table" and value or { value } index = typeof(index) == "Instance" and index:IsA("Player") and tostring(index.UserId) or tostring(index) local player = Manager.IsClient and Players.LocalPlayer or Manager.IsServer and _sent local info = player or index local guid = Subscribe.ConnectSubscription(info, self._key, index, value, code) local sub = { _key = self._key, _index = index, _value = value, _info = info, _guid = guid, } setmetatable(sub, DataSync) DataSync._Subscriptions[self._key .. index] = sub return sub end --[=[ Unsubscribe from a subscription on a store @return SubscriptionObject @outline Unsubscribe ]=] function DataSync:Unsubscribe(): typeof(DataSync:Unsubscribe()) assert(self._key, "':Unsubscribe' can only be used with a store") assert( self._guid, "':Unsubscribe' can only be used with a subscription created with ':Subscribe'" ) if self._deactivated then return self end Subscribe.DisconnectSubscription(self._key, self._guid) self._deactivated = true return self end --[=[ Fire all the subscriptions on a value & the 'all' values @param index string -- the DataFile index @param value string -- the value to fire @param data any? -- this can be any data @return nil @outline _FireSubscriptions ]=] function DataSync:_FireSubscriptions(index: string, value: string, data: any?): nil if string.sub(tostring(tostring(value)), 1, #Methods._Private) == Methods._Private then return true end Subscribe.FireSubscription(self._key, index, value, data) end if Manager.IsServer then if DataSync.Shutdown then game:BindToClose(function() DataSync._ShuttingDown = true if Manager.Count(DataSync._Files) == 0 then return end print("Shutting down and saving DataSync files") for index, file in pairs(DataSync._Files) do Manager.Wrap(function() file:SaveData(true):RemoveData(true) DataSync._Files[index] = nil end) end while Manager.Count(DataSync._Files) > 0 do Manager.Wait() end end) end Network.CreateEvent(DataSync._Remotes.Download) Network:HookFunction(DataSync._Remotes.Upload, function(_, key, index, value) local success, response = pcall(function() return DataSync.GetStore(key):GetFile(index):GetData(value) end) return success and response or nil end) Network:HookEvent(DataSync._Remotes.Subscribe, function(client, key, index, value, uid) local store = DataSync.GetStore(key) store:Subscribe(index, value, nil, client, nil, uid) end) Network:HookEvent(DataSync._Remotes.Unsubscribe, function(_, key, uid) Subscribe.DisconnectSubscription(key, uid) end) elseif Manager.IsClient then Network:HookEvent(DataSync._Remotes.Download, function(key, index, value, data, uid) if not DataSync._Cache[key] then DataSync._Cache[key] = {} end if not DataSync._Cache[key][index] then DataSync._Cache[key][index] = {} end if string.lower(value) == "all" then DataSync._Cache[key][index] = data else DataSync._Cache[key][index][value] = data end Subscribe.FireSubscription(key, index, value, data, uid) end) end return DataSync
data:extend({ { type = "recipe", name = "void-pipe", enabled = "false", ingredients = { {"pipe", 1}, {"electronic-circuit", 1}, }, result = "void-pipe", }, { type = "recipe", name = "void-chest", enabled = "false", ingredients = { {"steel-chest", 1}, {"steel-furnace", 1}, {"electronic-circuit", 5} }, result = "void-chest" }, })
local function createUseEffect(component) return function(callback, dependsOn) if type(callback) ~= "function" then error("useEffect callback is not a function", 2) end local hookCount = component.hookCounter + 1 component.hookCounter = hookCount -- TODO: This mutates the component in the middle of render. That's bad, right? -- It's idempotent, so it shouldn't matter. -- Is there a way to do this that keeps `render` truly pure? component.effects[hookCount] = {callback, dependsOn} end end return createUseEffect
local uv = require "lluv" local ssl = require "lluv.ssl" local config = require "./config" local ctx = assert(ssl.context(config)) local EOF = uv.error(uv.ERROR_UV, uv.EOF) local function ping() ctx:client():connect("127.0.0.1", 8881, function(cli, err) if err then print("Connection fail:", err) return cli:close() end cli:start_read(function(cli, err, data) if err then print("Read ERROR:", err) return cli:close() end print("`".. data.. "`") cli:close(ping) end) end) end ping() uv.run()
-- -- Copyright (c) 2014, Facebook, Inc. -- All rights reserved. -- -- This source code is licensed under the BSD-style license found in the -- LICENSE file in the root directory of this source tree. An additional grant -- of patent rights can be found in the PATENTS file in the same directory. -- -- utilities to deal with multi-level tables (tables of tables) -- -- set(table, k1, k2, ..., kn, val) is the same as -- table[k1][k2]...[kn] = val -- except that intermediate tables are created automatically -- -- del(table, k1, k2, ..., kn) is the same as -- table[k1][k2]...[kn] = nil -- except that intermediate tables that have become empty are deleted -- -- get(table, k1, k2, ..., kn) is the same as -- table[k1][k2]...[kn] -- except that it returns nil if any intermediate table is missing -- (rather than throwing an error) local function del(t, ...) local args = {...} local stack = { } local lt local nlt = t for i = 1, #args do lt = nlt if type(lt) ~= 'table' then return false end stack[i] = lt nlt = lt[args[i]] if nlt == nil then return false end end lt[args[#args]] = nil local i = #args while i >= 1 and not next(stack[i]) do i = i - 1 end if i >= 1 then stack[i][args[i]] = nil end return true end local function _set(overwrite, t, ...) local args = {...} local lt = t for i = 1, #args - 2 do local nlt = lt[args[i]] if not nlt then nlt = { } lt[args[i]] = nlt end lt = nlt end if not overwrite then local prev = lt[args[#args - 1]] if prev ~= nil then return prev end end local v = args[#args] lt[args[#args - 1]] = v return v end local function set(t, ...) _set(true, t, ...) end local function setdefault(t, ...) return _set(false, t, ...) end local function get(t, ...) local args = {...} local lt local nlt = t for i = 1, #args do lt = nlt if type(lt) ~= 'table' then return nil end nlt = lt[args[i]] if nlt == nil then return false end end return nlt end return { get = get, set = set, setdefault = setdefault, del = del, }
local ACT_MP_STAND_IDLE = ACT_MP_STAND_IDLE local ACT_HL2MP_SWIM_SLAM = ACT_HL2MP_SWIM_SLAM local ACT_HL2MP_SWIM_IDLE_SLAM = ACT_HL2MP_SWIM_IDLE_SLAM local ACT_HL2MP_WALK_SUITCASE = ACT_HL2MP_WALK_SUITCASE local ACT_MP_WALK = ACT_MP_WALK local ACT_MP_RUN = ACT_MP_RUN local ACT_HL2MP_IDLE_MELEE_ANGRY = ACT_HL2MP_IDLE_MELEE_ANGRY local ACT_HL2MP_IDLE_ANGRY = ACT_HL2MP_IDLE_ANGRY local ACT_HL2MP_RUN_FAST = ACT_HL2MP_RUN_FAST local ACT_HL2MP_IDLE_SCARED = ACT_HL2MP_IDLE_SCARED function GM:HandlePlayerSwimming(pl, velocity) if not pl:IsSwimming() then return false end if velocity:Length2DSqr() > 100 then pl.CalcIdeal = ACT_HL2MP_SWIM_SLAM else pl.CalcIdeal = ACT_HL2MP_SWIM_IDLE_SLAM end return true end function GM:CalcMainActivity(pl, velocity) pl.CalcIdeal = ACT_MP_STAND_IDLE pl.CalcSeqOverride = -1 self:HandlePlayerLanding( pl, velocity, pl.m_bWasOnGround ) if not ( self:HandlePlayerJumping( pl, velocity ) or self:HandlePlayerDucking( pl, velocity ) or self:HandlePlayerSwimming( pl, velocity ) ) then local len2d = velocity:LengthSqr() if len2d >= 22500 then --150^2 pl.CalcIdeal = ACT_HL2MP_RUN_FAST elseif len2d >= 4096 then --64^2 pl.CalcIdeal = ACT_MP_RUN elseif len2d >= 1 then pl.CalcIdeal = --[[pl:IsCarrying() and ACT_HL2MP_WALK_SUITCASE or]] ACT_MP_WALK else pl.CalcIdeal = --[[pl:IsCarrying() and ACT_HL2MP_IDLE_MELEE_ANGRY or]] ACT_HL2MP_IDLE_SCARED end end pl.m_bWasOnGround = pl:IsOnGround() --[[if not]] pl:CallStateFunction("CalcMainActivity", velocity) --then --pl:CallCarryFunction("CalcMainActivity", velocity) --end return pl.CalcIdeal, pl.CalcSeqOverride end function GM:DoAnimationEvent(pl, event, data) return pl:CallStateFunction("DoAnimationEvent", event, data) --[[or pl:CallCarryFunction("DoAnimationEvent", event, data)]] or self.BaseClass.DoAnimationEvent(self, pl, event, data) end function GM:UpdateAnimation(pl, velocity, maxseqgroundspeed) return pl:CallStateFunction("UpdateAnimation", velocity, maxseqgroundspeed) --[[or pl:CallCarryFunction("UpdateAnimation", velocity, maxseqgroundspeed)]] or self.BaseClass.UpdateAnimation(self, pl, velocity, maxseqgroundspeed) end
local tbug = SYSTEMS:GetSystem("merTorchbug") local cm = CALLBACK_MANAGER local wm = WINDOW_MANAGER local BLUE = ZO_ColorDef:New(0.8, 0.8, 1.0) local RED = ZO_ColorDef:New(1.0, 0.2, 0.2) -------------------------------- -- class ObjectInspectorPanel -- local BasicInspectorPanel = tbug.classes.BasicInspectorPanel local ObjectInspectorPanel = tbug.classes.ObjectInspectorPanel .. BasicInspectorPanel local function valueEdit_OnEnter(editBox) editBox.panel:valueEditConfirm(editBox) end local function valueEdit_OnFocusLost(editBox) editBox.panel:valueEditCancel(editBox) end local function valueEdit_OnTextChanged(editBox) editBox.panel:valueEditUpdate(editBox) end function ObjectInspectorPanel:__init__(control, ...) BasicInspectorPanel.__init__(self, control, ...) self:initScrollList(control) self:createValueEditBox(self.list.contents) cm:RegisterCallback("tbugChanged:typeColor", function() self:refreshVisible() end) end function ObjectInspectorPanel:anchorEditBoxToListCell(editBox, listCell) editBox:ClearAnchors() editBox:SetAnchor(TOPRIGHT, listCell, TOPRIGHT, 0, 4) editBox:SetAnchor(BOTTOMLEFT, listCell, BOTTOMLEFT, 0, -3) listCell:SetHidden(true) end function ObjectInspectorPanel:createValueEditBox(parent) local editBox = wm:CreateControlFromVirtual("$(parent)ValueEdit", parent, "ZO_DefaultEdit") self.editBox = editBox self.editData = nil editBox.panel = self editBox:SetDrawLevel(10) editBox:SetMaxInputChars(1024) -- hard limit in ESO 2.1.7 editBox:SetFont("ZoFontGameSmall") editBox:SetHandler("OnEnter", valueEdit_OnEnter) editBox:SetHandler("OnFocusLost", valueEdit_OnFocusLost) editBox:SetHandler("OnTextChanged", valueEdit_OnTextChanged) end function ObjectInspectorPanel:reset() tbug.truncate(self.masterList, 0) ZO_ScrollList_Clear(self.list) self:commitScrollList() self.control:SetHidden(true) self.control:ClearAnchors() self.subject = nil end function ObjectInspectorPanel:setupRow(row, data) BasicInspectorPanel.setupRow(self, row, data) if self.editData == data then self:anchorEditBoxToListCell(self.editBox, row.cVal) else row.cVal:SetHidden(false) end end function ObjectInspectorPanel:valueEditCancel(editBox) local editData = self.editData if editData then --df("tbug: edit cancel") self.editData = nil ZO_ScrollList_RefreshVisible(self.list, editData) end editBox:SetHidden(true) end function ObjectInspectorPanel:valueEditConfirm(editBox) local expr = editBox:GetText() --df("tbug: edit confirm: %s", expr) local func, err = zo_loadstring("return " .. expr) if not func then df("|c%stbug: %s", RED:ToHex(), err) return end local ok, evalResult = pcall(setfenv(func, tbug.env)) if not ok then df("|c%stbug: %s", RED:ToHex(), evalResult) return end local err = self:valueEditConfirmed(editBox, evalResult) if err then df("|c%stbug: %s", RED:ToHex(), err) end end function ObjectInspectorPanel:valueEditConfirmed(editBox, evalResult) return "valueEditConfirmed: intended to be overridden" end function ObjectInspectorPanel:valueEditStart(editBox, row, data) if self.editData ~= data then editBox:LoseFocus() --df("tbug: edit start") editBox:SetText(row.cVal:GetText()) editBox:SetHidden(false) editBox:TakeFocus() self:anchorEditBoxToListCell(editBox, row.cVal) self.editData = data end end function ObjectInspectorPanel:valueEditUpdate(editBox) local expr = editBox:GetText() local func, err = zo_loadstring("return " .. expr) -- syntax check only, no evaluation yet if func then editBox:SetColor(BLUE:UnpackRGBA()) else editBox:SetColor(RED:UnpackRGBA()) end end --------------------------- -- class ObjectInspector -- local BasicInspector = tbug.classes.BasicInspector local ObjectInspector = tbug.classes.ObjectInspector .. BasicInspector ObjectInspector._activeObjects = {} ObjectInspector._inactiveObjects = {} ObjectInspector._nextObjectId = 1 ObjectInspector._templateName = "tbugTabWindow" function ObjectInspector.acquire(Class, subject, name, recycleActive) local inspector = Class._activeObjects[subject] if not inspector then if recycleActive and Class._lastActive and Class._lastActive.subject then inspector = Class._lastActive Class._activeObjects[inspector.subject] = nil else inspector = table.remove(Class._inactiveObjects) if not inspector then local id = Class._nextObjectId local templateName = Class._templateName local controlName = templateName .. id local control = wm:CreateControlFromVirtual(controlName, nil, templateName) Class._nextObjectId = id + 1 inspector = Class(id, control) end if Class._lastActive then Class._lastActive.titleIcon:SetDesaturation(0) end Class._lastActive = inspector Class._lastActive.titleIcon:SetDesaturation(1) end Class._activeObjects[subject] = inspector inspector.subject = subject inspector.subjectName = name end return inspector end function ObjectInspector:__init__(id, control) BasicInspector.__init__(self, id, control) self.conf = tbug.savedTable("objectInspector" .. id) self:configure(self.conf) end function ObjectInspector:openTabFor(object, title) local newTabIndex = 0 local tabControl, panel -- the global table should only be viewed in GlobalInspector if rawequal(object, _G) then local inspector = tbug.getGlobalInspector() if inspector.control:IsHidden() then inspector.control:SetHidden(false) inspector:refresh() end inspector.control:BringWindowToTop() return end -- try to find an existing tab inspecting the given object for tabIndex, tabControl in ipairs(self.tabs) do if rawequal(tabControl.panel.subject, object) then self:selectTab(tabControl) return tabControl elseif tabControl == self.activeTab then newTabIndex = tabIndex + 1 end end if type(object) == "table" then title = tbug.glookup(object) or title or tostring(object) panel = self:acquirePanel(tbug.classes.TableInspectorPanel) elseif tbug.isControl(object) then title = title or tbug.getControlName(object) panel = self:acquirePanel(tbug.classes.ControlInspectorPanel) end if panel then tabControl = self:insertTab(title, panel, newTabIndex) panel.subject = object panel:refreshData() self:selectTab(tabControl) end return tabControl end function ObjectInspector:refresh() --df("tbug: refreshing %s (%s)", tostring(self.subject), tostring(self.subjectName)) self:removeAllTabs() self:openTabFor(self.subject, self.subjectName) end function ObjectInspector:release() if self.subject then self._activeObjects[self.subject] = nil self.subject = nil table.insert(self._inactiveObjects, self) end self.control:SetHidden(true) self:removeAllTabs() end
local f = string.format My.Translator:register("de", { upgrade_speed1_name = "Impulsantrieb MkI", upgrade_speed1_description = function(speedUPerMin) return f("Der Impulsantrieb MkI ist die Einsteigervariante für kleinere und mittlere Frachter. Geschwindigkeiten über %0.1fu/min sind nur für erfahrene Techniker machbar, aber aufgrund seiner Zuverlässigkeit wird der Antrieb überall geschätzt.", speedUPerMin) end, upgrade_speed2_name = "Impulsantrieb MkII", upgrade_speed2_description = function(speedUPerMin) return f("Der Impulsantrieb MkII ist eine verbesserte Version des serienmäßig in leichten Schiffen verbauten Antriebs. Im Normalbetrieb sind mit ihm Geschwindigkeiten bis zu %0.1fu/min möglich - ein guter Techniker kann aber auch mehr herauskitzeln.", speedUPerMin) end, upgrade_speed3_name = "Impulsantrieb MkIII", upgrade_speed3_description = function(speedUPerMin) return f("Durch überragende menschliche Konstruktionskunst konnte der Impulsantrieb für kleinere und mittlere Frachter noch weiter optimiert werden. Heraus kam der Impulsantrieb MkIII, der mit einer Maximalgeschwindigkeit %0.1fu/min überzeugt.", speedUPerMin) end, upgrade_speed4_name = "Impulsantrieb MkIV", upgrade_speed4_description = function(speedUPerMin) return f("Kleinere Verbesserungen an der Materieeinspritzung und die Optimierung des Wirkungsgrads machen den Impulsantrieb MkIV zu einer der besten Optionen für kleine und mittlere Frachter. Seine Höchstgeschwindigkeit liegt bei %0.1fu/min ohne Turbo.", speedUPerMin) end, upgrade_rotation1_name = "Schubdüsen MkI", upgrade_rotation1_description = function(secondsPer180) return f("Die MkI ist eine der einfachsten Schubdüsen, die am Markt verfügbar sind. Wendungen um 180 Grad sind immerhin in %0.1f Sekunden möglich.", secondsPer180) end, upgrade_rotation2_name = "Schubdüsen MkII", upgrade_rotation2_description = function(secondsPer180) return f("Eine zielgerichtetere Steuerung der Schubdüsen erhöht die Wendigkeit des Schiffes immens und erlaubt es dem Schiff in weniger als %0.1f Sekunden eine 180 Grad Wende auszuführen.", secondsPer180) end, upgrade_rotation3_name = "Schubdüsen MkIII", upgrade_rotation3_description = function(secondsPer180) return f("Dieses Update verteilt die Energie zwischen Schubdüsen und Impulsantrieb dynamisch und erlaubt so in weniger als %0.1f Sekunden eine 180 Grad Wende auszuführen.", secondsPer180) end, upgrade_storage1_name = "Lagerraum S", upgrade_storage1_description = function(storageSize) return f("Ein Lagerraum für Frachter, der %d Einheiten lagern kann.", storageSize) end, upgrade_storage2_name = "Lagerraum M", upgrade_storage2_description = function(storageSize) return f("Durch Erweiterung des Laderaums kann die Ladekapazität eines kleinen oder mittleren Frachters um %d Einheiten erhöht werden.", storageSize) end, upgrade_storage3_name = "Lagerraum L", upgrade_storage3_description = function(storageSize) return f("Die Nutzung des Laderaums kann optimiert werden, in dem unnötige Trennwände entfernt und durch intelligente Lagersysteme ersetzt werden. Dadurch können bis zu %d Einheiten mehr gelagert werden.", storageSize) end, upgrade_combatManeuver_name = "Manöverdüsen BST200", upgrade_combatManeuver_description = "Manöverdüsen erlaubt schnelle, aber kurze Ausweichmanöver durchzuführen. So erlauben sie Objekten im All auszuweichen oder Raketen ins Leere laufen zu lassen.", upgrade_warpDrive_name = "Warpantrieb X8", upgrade_warpDrive_description = "Für längere Reisen sind größere Schiffe mit Warpantrieben ausgerüstet, die Reisen mit Überlichtgeschwindigkeit ermöglichen.\n\nAuf einem Schiff können nur entweder ein Warpantrieb oder ein Sprungantrieb installiert werden.", upgrade_jumpDrive_name = function(range) return f("Sprungantrieb %dU", range) end, upgrade_jumpDrive_description = function(range) return f("Der Sprungantrieb wird häufig von militärischen und paramilitärischen Gruppierungen verwendet, um Überraschungsangriffe durchzuführen. Doch auch für längere Reisen ist der Sprungantrieb durchaus geeignet. Dieser Antrieb erlaubt Sprünge bis zu %dU.\n\nAuf einem Schiff können nur entweder ein Warpantrieb oder ein Sprungantrieb installiert werden.", range) end, upgrade_jumpDrive2_description = function(range) return f("Der Sprungantrieb wird häufig von militärischen und paramilitärischen Gruppierungen verwendet, um Überraschungsangriffe durchzuführen. Doch auch für längere Reisen ist der Sprungantrieb durchaus geeignet. Dieser Antrieb erlaubt Sprünge bis zu %dU und ist eine signifikante Verbesserung gegenüber herkömmlichen Sprungantrieben.", range) end, upgrade_tacticalJumpDrive_description = function(range) return f("Der Sprungantrieb wird häufig von militärischen und paramilitärischen Gruppierungen verwendet, um Überraschungsangriffe durchzuführen. Doch auch für längere Reisen ist der Sprungantrieb durchaus geeignet. Dieser Antrieb erlaubt Sprünge bis zu %dU und kommt am Besten in taktischen Manövern, wie dem Ausweichen von Feinden oder zum Ändern der Angriffsrichtung, zum Einsatz.", range) end, upgrade_hvli1_name = "HVLI Lager S", upgrade_hvli1_description = function(storageSize) return f("Platz für %d HVLI Raketen ist selbst in den kleinsten Schiffen vorhanden. So auch hier: eine kleine Ecke in der Nähe der Torpedorohre reicht vollkommen aus.", storageSize) end, upgrade_hvli2_name = "HVLI Lager M", upgrade_hvli2_description = function(storageSize, storageMalusSize) return f("Durch Umbau des Lagerraums kann Platz für %d HVLI Raketen geschaffen werden. Dadurch wird jedoch der Lagerraum um %d Einheiten verringert.", storageSize, storageMalusSize) end, upgrade_hvli3_name = "HVLI Lager L", upgrade_hvli3_description = function(storageSize, storageMalusSize) return f("Eine weitere Verkleinerung des Lagerraums um %d Einheiten schafft Platz für Aufhängungen mit denen insgesamt %d HVLI Raketen gelagert werden können.", storageMalusSize, storageSize) end, upgrade_homing1_name = "Homing Lager S", upgrade_homing1_description = function(storageSize) return f("In einem kleinen Teil des Raumschiffs wird ein Laderaum für %d Homing Raketen geschaffen. Dieser ist verstärkt, um eine Explosion im Inneren des Schiffs zu vermeiden.", storageSize) end, upgrade_homing2_name = "Homing Lager M", upgrade_homing2_description = function(storageSize, storageMalusSize) return f("Durch Umbau des Lagerraums kann Platz für %d Homing Raketen geschaffen werden. Dadurch wird jedoch der Lagerraum um %d Einheiten verringert.", storageSize, storageMalusSize) end, upgrade_homing3_name = "Homing Lager L", upgrade_homing3_description = function(storageSize, storageMalusSize) return f("Eine weitere Verkleinerung des Lagerraums um %d Einheiten schafft Platz für Aufhängungen mit denen insgesamt %d Homing Raketen gelagert werden können.", storageMalusSize, storageSize) end, upgrade_mine1_name = "Mine Lager S", upgrade_mine1_description = function(storageMalusSize) return f("Durch Einrichtung eines Stasisfelds kann im Lagerraum eine Mine sicher transportiert werden. Der Lagerraum wird durch den Umbau um %d Einheiten verkleinert.", storageMalusSize) end, upgrade_mine2_name = "Mine Lager M", upgrade_mine2_description = function(storageSize, storageMalusSize) return f("Durch eine Vergrößerung des Stasisfelds können insgesamt %d Minen im Lagerraum untergebracht werden. Dazu wird aber der Lagerraum um weitere %d Einheiten verkleinert.", storageSize, storageMalusSize) end, upgrade_mine3_name = "Mine Lager L", upgrade_mine3_description = function(storageSize, storageMalusSize) return f("Mit diesem Upgrade kann ein mittlerer Transporter zu einem Behelfs-Minenleger umfunktioniert werden. Mit einer Lagerkapazität von %d Minen können kleinere Minengürtel gelegt werden. Durch das Upgrade werden %d Einheiten im Lagerraum nicht anderweitig nutzbar.", storageSize, storageMalusSize) end, upgrade_emp1_name = "EMP Lager S", upgrade_emp1_description = function(storageMalusSize) return f("EMP Waffen erlauben das Schild von Schiffen zu deaktivieren, ohne die Hülle zu beschädigen. Durch Reduzierung des Lagerraums um %d Einheiten kann Platz zum Lagern einer EMP Rakete geschaffen werden.", storageMalusSize) end, upgrade_emp2_name = "EMP Lager M", upgrade_emp2_description = function(storageSize, storageMalusSize) return f("Durch eine weitere Reduzierung des Lagerraums um %d wird Lagerraum für insgesamt %d EMP Raketen geschaffen.", storageMalusSize, storageSize) end, upgrade_emp3_name = "EMP Lager L", upgrade_emp3_description = function(storageSize, storageMalusSize) return f("Die Erweiterung des Lagerraums auf %d EMP Raketen ist besonders bei Piraten und Gesetzeshütern sehr beliebt, da im Gegensatz zu konventionellen Raketen kaum bleibende Schäden verursacht werden. Für den Lagerraum muss der Lagerraum um %d Einheiten verkleinert werden.", storageSize, storageMalusSize) end, upgrade_nuke1_name = "Nuke Lager S", upgrade_nuke1_description = function(storageMalusSize) return f("Um ein konventionelles Lager für Nukes nutzbar zu machen sind größere Umbauten nötig um einen zuverlässigen Strahlenschutz der Besatzung und des restlichen Schiffs zu gewährleisten. Der Lagerraum wird um %d Einheiten reduziert.", storageMalusSize) end, upgrade_nuke2_name = "Nuke Lager M", upgrade_nuke2_description = function(storageMalusSize) return f("Größerer Lagerraum für eine weitere Nuke, der auf Kosten von %d Einheiten Lagerraum geht. Dafür wird die militärische Schlagkraft des Schiffes enorm erhöht.", storageMalusSize) end, upgrade_energy1_name = "Power MkI", upgrade_energy1_description = function(energyUnits) return f("Ein einfacher Energiespeicher für Transportschiffe, der %d Einheiten Energie speichern kann.", energyUnits) end, upgrade_energy2_name = "Power MkII", upgrade_energy2_description = function(energyUnits) return f("Technische Fortschritte der Energiespeicherforschung in den letzten Jahren erlauben höhere Mengen Energie auf gleichem Raum zu speichern. Durch ein Upgrade auf Mikroporen Speichertechnologie kann zusätzliche Energie mit einem Level von %d gespeichert werden.", energyUnits) end, upgrade_energy3_name = "Power MkIII", upgrade_energy3_description = function(energyUnits) return f("Verteilte Energiesysteme sorgen für Redundanz und Ausfallsicherheit. Durch kleinere Energiespeicher direkt an den Komponenten kann sowohl die Speicherkapazität um %d erhöht werden als auch eine bessere Ausfallsicherheit gewährleistet werden.", energyUnits) end, upgrade_energy4_name = "Power MkIV", upgrade_energy4_description = function(energyUnits, storageMalusSize) return f("Zusätzliche Energiespeicher können im Lagerraum installiert werden, um die Speicherkapazität um %d zu erhöhen. Dadurch stehen allerdings %d Einheiten weniger im Lager zur Verfügung.", energyUnits, storageMalusSize) end, upgrade_powerPresets_name = "Power Magician", upgrade_powerPresets_description = function(slots) return f("Dieses Software Update für die Engineering Station gestattet es die Energie- und Kühlmittelverteilung in Raumschiffen zu speichern und schnell abzurufen. Viele Engineers auf größeren Schiffen nutzen dieses System, um effizienter zu agieren und schnell auf sich verändernde Anforderungen im Energiebedarf von Raumschiffen zu reagieren.", slots) end, upgrade_shield1_name = "Schild MkI", upgrade_shield1_description = function(strength) return f("Kein Handelsschiff sollte sich in die Weiten des Alls ohne adäquate Schilde wagen. Dieses Schild mit einer Nennkapazität von %d hat die vordergründige Aufgabe das Schiff vor Asteroidenkollisionen zu schützen.", strength) end, upgrade_shield2_name = "Schild MkII", upgrade_shield2_description = function(strength) return f("Die Nennkapazität von %d dieses Schilds für Handelsschiffe bietet einen grundlegenden Schutz gegen angreifende Piraten. Nicht selten hat die Langlebigkeit des Schilds dafür gesorgt, dass Handelsschiffe lange genug ausharren konnten, bis Begleitschiffe den Feind vertreiben konnten.", strength) end, upgrade_shield3_name = "Schild MkIII", upgrade_shield3_description = function(strength) return f("Dies ist die höchste Klasse an Schilden, die für Handelsschiffe zugelassen sind und keine erweiterte Zulassung für Kampfschiffe benötigen. Es wird nicht empfohlen diese Schilde für längere Zeit Kampfhandlungen auszusetzen, aber eine Nennkapazität von %d erlaubt die Teilnahme als Unterstützer an kleinen Scharmützeln.", strength) end, upgrade_hull1_name = "Basis Hülle", upgrade_hull1_description = "Hüllen schützen die Besatzung eines Raumschiffs vor den Einflüssen des Alls, wie Strahlung, Sauerstoffmangel, Asteroideneinschlägen oder Laserbeschuss.", upgrade_hull2_name = "Plasteel Verstärkung", upgrade_hull2_description = function(strength) return f("Die Hülle ihres Schiffs wird mit Platten aus Plasteel ausgekleidet und verstärkt. Dadurch verbessern sich die Widerstands der Außenhaut auf %d. Zusätzlich werden die Systeme des Schiffs effektiver vor Schäden geschützt.", strength) end, upgrade_laserRefit_name = "Laser Konfigurator", upgrade_laserRefit_description = "Der Laser Konfigurator kann die Laser eines Schiffs überladen, um verschiedene Effekte zu erzielen. So kann die Reichweite oder der Schadensausstoß verbessert werden. Allerdings operiert der Laser damit außerhalb seiner üblichen Parameter und erhöhter Energieverbrauch und Überhitzung sind übliche Folgen.", upgrade_laserRefit_button = "Laser", upgrade_laserRefit_info_button = "Information", upgrade_laserRefit_info_title = "Information über Laser", upgrade_laserRefit_info_intro = function(refitCostPower, refitTime) return "Fortschrittliche Steuerelektronik erlaubt es die Laser, selbst im laufenden Betrieb, an Board von Raumschiffen zu konfigurieren. " .. "Änderungen können vom Waffenoffizier vorgenommen werden, der zwischen verschiedenen Konfigurationen wählen kann. " .. f("Eine Umkonfiguration benötigt %0.0f Einheiten Energie und dauert %0.1f Sekunden. ", refitCostPower, refitTime) .. "Der Vorgang kann aber beschleunigt werden, wenn dem Subsystem mehr Energie zur Verfügung gestellt wird.\n\n" .. "Es kann zwischen folgenden Voreinstellungen gewählt werden:" end, upgrade_laserRefit_beam_button = function(i) return f("Laser %d", i) end, upgrade_laserRefit_beam_info_button = "Information", upgrade_laserRefit_beam_info_range = function(range, minAngle, maxAngle) return f("Der Laser kann Ziele in einem Winkel von %0.0f bis %0.0f Grad und einer Entfernung von bis zu %0.3fu erfassen.", minAngle, maxAngle, range) end, upgrade_laserRefit_beam_info_damage = function(damage, shotsPerMinute, damagePerMinute) return f("Er feuert %0.1f Schüsse pro Minute, die jeweils %0.1f Schaden verursachen können. Der maximale Schaden pro Minute beträgt somit bis zu %0.1f.", shotsPerMinute, damage, damagePerMinute) end, upgrade_laserRefit_beam_info_heat = function(minutesToOverHeat) return f("Der Laser kann ungekühlt maximal %0.1f Minuten im Dauerbetrieb gefeuert werden bevor er durch Überhitzung Schaden nimmt.", minutesToOverHeat) end, upgrade_laserRefit_beam_info_energy = function(energyPerMinute) return f("Um optimal arbeiten zu können benötigt der Laser pro Minute %0.0f Energie.", energyPerMinute) end, upgrade_laserRefit_beam_info_disclaimer = "Alle Werte beziehen sich auf ein gesundes und nicht überlastetes Lasersystem.", upgrade_laserRefit_beam_info_default_button = "Standard", upgrade_laserRefit_beam_info_default_description = "Dies ist die Standardeinstellung aller industriell gefertigten Laser. Sie bieten ein ausgewogenes Verhältnis von Feuerkraft, Feuerrate und Reichweite und sind auf ihren Energieverbrauch und Hitzeabstrahlung optimiert.", upgrade_laserRefit_beam_info_range_button = "Sniper", upgrade_laserRefit_beam_info_range_description = "Diese Einstellung opfert Feuerrate und flexible Schusswinkel einer höheren Schussweite. Um den Energiestrahl über höhere Distanzen schießen zu können wurde auch der Energiebedarf der Waffe erhöht, was zu einer schnelleren Überhitzung führt.", upgrade_laserRefit_beam_info_power_button = "Schaden", upgrade_laserRefit_beam_info_power_description = "In dieser Einstellung werden die Laser auf maximale Schadenswirkung hin optimiert. Der Laserstrahl wird mit mehr Energie vorgeladen, was die Feuerrate verringert, aber auch die Schadenswirkung signifikant steigert. Da der Laser außerhalb der Spezifikation betrieben wird, muss mit schneller Überhitzung und einem ineffizienten Energieverbrauch gerechnet werden. Da solch hochenergetischen Laserstrahlen eine höhere Streung besitzen verringert sich die effektive Reichweite leicht.", upgrade_laserRefit_beam_info_speed_button = "Feuerrate", upgrade_laserRefit_beam_info_speed_description = "Um mehrere schwache Ziele schnell abzuwehren, kann die Schadenswirkung des Lasers geschwächt werden, um die Feuerrate zu erhöhen. Der mögliche Schadensausstoß pro Zeiteinheit bleibt gleich, allerdings erhöht sich auch der Energiebedarf und die Abwärme, da zwischen den Schüssen nicht genügend Zeit bleibt, um die Komponenten zu kühlen.", upgrade_laserRefit_beam_info_is_refitting = "wird konfiguriert...", upgrade_beam_name = "Beam Emitter", upgrade_beam_description = function(storageMalusSize) return f("Auf ihrem Schiff kann ein weiterer Laser installiert werden, der das Heck des Schiffs gegen Beschuss verteidigen kann. Um Platz für den Laser zu schaffen werden %d Einheiten des Lagerraums benötigt, aber gerade bei Händlern ist dieser zusätzliche Laser sehr beliebt, da er das Schiff verteidigen kann, während der Sprungantrieb lädt.", storageMalusSize) end, upgrade_probe_name = "Sonden Lager", upgrade_probe_description = function(storageMalusSize, amount) return f("Den Laderaum für Sonden zu vergrößern ist ein sehr einfacher Prozess. Es muss lediglich der Lagerraum um %d Einheiten reduziert werden und als Lagerfläche für %d zusätzliche Sonden ausgewiesen werden.", storageMalusSize, amount) end, upgrade_jumpCalculator_label_info_button = "Informationen", upgrade_jumpCalculator_label_info = "Der Sprungrechner hilft dabei korrekte Sprungvektoren selbst in den schwierigsten Situationen zu berechnen. Er kann als Ziel bekannte Stationen oder Wegpunkte des Kommunikationsoffiziers nutzen. Als Ergebnis wird die Richtung und Entfernung des Ziels ausgegeben.", upgrade_jumpCalculator_label = "Sprungrechner", upgrade_jumpCalculator_waypoint_label = function(number) return f("Wegpunkt %d", number) end, upgrade_jumpCalculator_result = function(label, heading, distance) return f("Vektor nach %s\n\nEntfernung: %0.1fu\nRichtung: %d", label, distance, heading) end, upgrade_nanobots_name = "Nanobot System", upgrade_nanobots_description = function(hullMalusPercent) return f("Durch Hinzufügen eines Tunnelsystems in die Schiffshülle können Nanobots zur Reparatur der Schiffshülle ausgesendet werden. Dieser Umbau schwächt zwar die Hülle um %0.1f%%, aber erlaubt es die Hülle auch während Missionen zu reparieren, vorausgesetzt die Schilde sind deaktiviert. Nach Verwendung müssen Nanobots an Stationen nachgekauft werden.", hullMalusPercent) end, upgrade_nanobots_label = "Nanobots", upgrade_nanobots_info_label = "Informationen", upgrade_nanobots_info = function(repairPercent, repairTime) return f( "Nanobots reparieren %0.1f%% Hüllenschaden innerhalb von %d Sekunden.\n\nSie können nicht freigesetzt werden, solange die Schilde aktiviert sind und werden sofort zerstört, sobald die Schilde aktiviert werden.", repairPercent, repairTime ) end, upgrade_nanobots_go_label = "Aktivieren", upgrade_nanobots_no_charges = "Keine Nanobots", upgrade_nanobots_currently_active = "Aktiv", upgrade_nanobots_no_shields = "Nanobots können nur eingesetzt werden, wenn die Schilde deaktiviert sind.", upgrade_nanobots_no_shields_alert = "Durch das Aktivieren der Schilde wurden die Nanobots, die die Hülle reparierten, zerstört.", })
-- Initialize gSQL for database queries. include("gsql/gsql.lua") include("advisor_config.lua") include("shared.lua")
fx_version 'adamant' game 'gta5' author 'Ziraflix Dev Group' contact 'E-mail: contato@ziraflix.com - Discord: discord.gg/6p3M3Cz' version '1.0.4' ui_page 'nui/darkside.html' client_scripts { '@vrp/lib/utils.lua', 'hansolo/*.lua' } files { 'nui/*.html', 'nui/*.js', 'nui/*.css' }
local DataPersistence = {} DataPersistence.__index = DataPersistence function DataPersistence:new() end function DataPersistence:save() end function DataPersistence:load() end return DataPersistence
-- -- c_switch.lua -- ---------------------------------------------------------------- ---------------------------------------------------------------- -- Effect switching on and off -- -- To switch on: -- triggerEvent( "switchWaterRef", root, 4 ) -- -- To switch off: -- triggerEvent( "switchWaterRef", root, 0 ) -- ---------------------------------------------------------------- ---------------------------------------------------------------- -------------------------------- -- onClientResourceStart -- Auto switch on at start -------------------------------- addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource()), function() if not isMTAUpToDate() then outputChatBox('Water Refract: You need to update your MTA nightly client',255,0,0) return end triggerEvent( "switchWaterRef", localPlayer, false) addCommandHandler( "sWaterRef", function() triggerEvent( "switchWaterRef", resourceRoot, not wrEffectEnabled) end ) end ) -------------------------------- -- Switch effect on or off -------------------------------- function switchWaterRef( wrOn ) outputDebugString( "switchWaterRef: " .. tostring(wrOn) ) if (wrOn) then enableWaterRef() else disableWaterRef() end end addEvent( "switchWaterRef", true ) addEventHandler( "switchWaterRef", localPlayer, switchWaterRef )
require"hang2kill" --hang2kill.SetTimeout(30) --uncomment to manually set freeze kill timeout.
local tasks = {} -- Functions for handling long-running things over a period of time. Async = {} Async.__index = Async AsyncTask = {} AsyncTask.__index = AsyncTask local async_tasks = nil local async_runtimes = {} local async_initialized = false -- can't use configuration_function because that's set before LuaGameScript is available local async_configuration_function = nil local async_loop_function = nil local function add_async_task(task) if not async_tasks then async_tasks = {} global.async_tasks = async_tasks end for k, existing_task in pairs(async_tasks) do if async_tasks[k] == task.save_state then -- Just load task, no need for inserting anything async_runtimes[k] = task return end end for k, existing_task in pairs(async_runtimes) do if existing_task:is_completed() then async_tasks[k] = task.save_state async_runtimes[k] = task return end end table.insert(async_tasks, task.save_state) table.insert(async_runtimes, task) end function Async:configure(configuration_function) async_configuration_function = configuration_function end function Async:configure_loop_functions(loop_lookup_function) async_loop_function = loop_lookup_function end function Async:load_task(task_state) local task = {} setmetatable(task, AsyncTask) task.save_state = task_state local task_config = Async:config_lookup(task_state.task_data) task:load_loop_functions() task.perform_function = task_config.perform_function task.on_finished = task_config.on_finished add_async_task(task) return task end function Async:perform_once(task_data, loops) local save_state = {} save_state.task_data = task_data save_state.completions = 0 save_state.interval = 1 save_state.steps_per_interval = 1 save_state.remaining = 1 save_state.loops = loops save_state.loop_counts = table_size(loops) local task = Async:load_task(save_state) task:restart_loops() return task.save_state end function Async:delayed(task_data, delay_ticks) local sleep_loop = Async:loop("sleep", 1, delay_ticks) local task = Async:perform_once(task_data, { sleep_loop }) return task end function Async:config_lookup(task_data) if not async_configuration_function then error("Async has not been configured correctly. Call Async:configure(...)") end local result = async_configuration_function(task_data) if not result.perform_function then error("No perform_function for task " .. serpent.line(task_data) .. ". Check async configuration.") end return result end local function loop_next(loop, current, all_iterators, all_state) if loop.type == "loop" then if current == nil then return loop.start, loop.start elseif current == loop.stop then return nil, nil else return current + 1, current + 1 end elseif loop.type == "loop_values" then return next(loop.values, current) elseif loop.type == "chunks" then local value = loop.iterator() return value, value elseif loop.type == "loop_func" then if current == nil then loop.values = loop.func(all_state, all_iterators) end return next(loop.values, current) elseif loop.type == "dynamic" then local value = loop.func(all_state, all_iterators, current) return value, value else error("Unknown loop type: " .. loop.type) end end function Async:chunks(name, surface) return { type = "chunks", identifier = name, iterator = surface.get_chunks() } end function Async:dynamic(name, func) return { type = "dynamic", identifier = name, func = func } end function Async:loop(name, start, stop) if start == nil or stop == nil then error("Unable to loop using start or stop as nil: " .. tostring(start) .. " - " .. tostring(stop)) end return { type = "loop", identifier = name, start = start, stop = stop } end function Async:loop_func(name) return { type = "loop_func", identifier = name } end function Async:loop_values(name, values) return { type = "loop_values", identifier = name, values = values } end function AsyncTask:load_loop_functions() for _, loop in pairs(self.save_state.loops) do if loop.type == "loop_func" then if not async_loop_function then error("No loop lookup function set. Need to call Async:configure_loop_functions") end loop.func = async_loop_function(loop.identifier) if not loop.func then error("No loop lookup function found for " .. loop.identifier .. ". Need to check Async:configure_loop_functions configuration") end end end end function AsyncTask:restart_loops() local save_state = self.save_state save_state.state = {} save_state.loops_iterator = nil save_state.iterators = {} for loop_index, loop in pairs(save_state.loops) do local loop = save_state.loops[loop_index] local it, value = loop_next(loop, nil, save_state.iterators, save_state.state) save_state.iterators[loop_index] = it save_state.state[loop.identifier] = value if it == nil then -- if any of the loops are empty, there is nothing to loop self:finished() return end end end function AsyncTask:next_iteration() local save_state = self.save_state local loop_index = save_state.loop_counts while true do local loop = save_state.loops[loop_index] local it, value = loop_next(loop, save_state.iterators[loop_index], save_state.iterators, save_state.state) save_state.iterators[loop_index] = it save_state.state[loop.identifier] = value if it == nil then -- if iterator on loop_index is nil, then the current loop is finished so we must go to the next loop and iterate to the next there loop_index = loop_index - 1 if loop_index == 0 then self:finished() return end elseif save_state.iterators[loop_index] and loop_index == save_state.loop_counts then -- if we're on last loop and last loop is not nil, then we're good to go for next perform call. return else loop_index = loop_index + 1 end end end function AsyncTask:finished() self.save_state.completions = self.save_state.completions + 1 self.save_state.remaining = self.save_state.remaining - 1 if self.on_finished then -- game.print("Finished") self.on_finished(self.save_state.task_data) end end function AsyncTask:call_perform_function() -- log("Call perform with " .. serpent.line(self.state)) self.perform_function(self.save_state.state, self.save_state.task_data) end function AsyncTask:tick(tick) if self.save_state.remaining == 0 then return end if tick % self.save_state.interval == 0 then local steps_per_interval = self.save_state.steps_per_interval or 1 for i = 1, steps_per_interval do if self.save_state.remaining ~= 0 then self:call_perform_function() self:next_iteration() end end end end function AsyncTask:is_completed() return self.save_state.remaining == 0 end function Async:initialize() -- game.print("Async:initialize") -- perform configuration step if not global.async_tasks then global.async_tasks = {} end async_tasks = global.async_tasks for _, task_state in pairs(async_tasks) do Async:load_task(task_state) end end function Async:on_tick() if not async_initialized then Async:initialize() async_initialized = true end local tick = game.tick for _, task in pairs(async_runtimes) do task:tick(tick) end if tick % 3600 == 2700 then -- Cleanup tasks log("Cleanup async tasks") for k, task in pairs(async_runtimes) do if task:is_completed() then log("Cleaned async task " .. k) async_tasks[k] = nil async_runtimes[k] = nil end end return end end return Async
----------------------------------------------------------- -- todo-comments configuration file ----------------------------------------------------------- -- Plugin: todo-comments.nvim -- https://github.com/folke/todo-comments.nvim require("todo-comments").setup {}
require("strict") require("fileOps") require("pairsByKeys") local function nsformat(value) if (type(value) == 'string') then if (string.find(value,"\n")) then value = "[[\n" .. value .. "\n]]" else value = "\"" .. value .. "\"" end elseif (type(value) == 'boolean') then if (value) then value = 'true' else value = 'false' end end return value end local function outputTblHelper(indentIdx, name, T, a, level) ------------------------------------------------- -- Remove all keys in table that start with "_" local t = {} for key in pairs(T) do if (type(key) == "number" or key:sub(1,1) ~= '_') then t[key] = T[key] end end -------------------------------------------------- -- Set initial indent local indent = '' if (indentIdx > 0) then indent = string.rep(" ",indentIdx) end -------------------------------------------------- -- Form name: Wrap name in [] if it has special -- characters local str if (type(name) == 'string') then if (name:find("[-+:./]") or name == "local" or name == "nil" ) then str = indent .. "[\"" .. name .. "\"] = {\n" else str = indent .. name .. " = {\n" end else str = indent .. "{\n" end a[#a+1] = str -------------------------------------------------- -- Update indent local origIndentIdx = indentIdx local origIndent = indent if (indentIdx >= 0) then indentIdx = indentIdx + 2 indent = string.rep(" ",indentIdx) end for key, value in pairsByKeys(t) do if (type(t[key]) == 'table') then outputTblHelper(indentIdx, key, t[key], a, level+1) else if (type(key) == "string") then str = indent .. '[\"'..key ..'\"] = ' else str = indent end a[#a+1] = str a[#a+1] = nsformat(t[key]) a[#a+1] = ",\n" end end indent = origIndent indentIdx = origIndentIdx if (level == 0) then a[#a+1] = indent .. '}\n' else a[#a+1] = indent .. "},\n" end end function serializeTbl(options) local a = {} local n = options.name local level = 0 local value = options.value local indentIdx = -1 if (options.indent) then indentIdx = 0 end if (type(value) == "table") then outputTblHelper(indentIdx, options.name, options.value, a, level) else a[#a+1] = n a[#a+1] = " = " a[#a+1] = nsformat(value) a[#a+1] = "\n" end local s = table.concat(a,"") if (options.fn == nil) then return s end local fn = options.fn local d = dirname(fn) if (not isDir(d)) then os.execute('mkdir -p ' .. d) end local f = assert(io.open(fn, "w")) f:write("-- -*- lua -*-\n") f:write("-- created: ",os.date()," --\n") f:write(s) f:close() end
local FluidStack = assert(yatm.fluids.FluidStack) -- -- Item recipe -- local FreezingItemRecipe = foundation.com.Class:extends("FreezingItemRecipe") local ic = FreezingItemRecipe.instance_class function ic:initialize(opts) ic._super.initialize(self) self.id = opts.id self.name = opts.name self.input_item_stack = opts.input_item_stack self.output_item_stack = opts.output_item_stack self.duration = opts.duration end -- -- Fluid recipe -- local FreezingFluidRecipe = foundation.com.Class:extends("FreezingFluidRecipe") local ic = FreezingFluidRecipe.instance_class function ic:initialize(opts) ic._super.initialize(self) self.id = opts.id self.name = opts.name self.input_fluid_stack = opts.input_fluid_stack self.output_item_stack = opts.output_item_stack self.duration = opts.duration end -- -- Registry -- local FreezingRegistry = foundation.com.Class:extends("FreezingRegistry") local ic = FreezingRegistry.instance_class function ic:initialize() ic._super.initialize(self) self.g_recipe_id = 0 self.m_item_recipes = {} self.m_fluid_recipes = {} self.m_item_input_to_recipe = {} self.m_fluid_input_to_recipe = {} end function ic:get_item_freezing_recipe(recipe_id) return self.m_item_recipes[recipe_id] end function ic:get_fluid_freezing_recipe(recipe_id) return self.m_fluid_recipes[recipe_id] end function ic:register_item_freezing_recipe(name, input_item, output_item, duration) assert(type(name) == "string", "expected a name") assert(input_item, "expected an input item") assert(output_item, "expected an output item") assert(type(duration) == "number", "expected a duration") self.g_recipe_id = self.g_recipe_id + 1 local recipe_id = self.g_recipe_id local recipe = FreezingItemRecipe:new({ id = recipe_id, name = name, input_item_stack = input_item, output_item_stack = output_item, duration = duration, }) self.m_item_recipes[recipe.id] = recipe self.m_item_input_to_recipe[recipe.input_item_stack:get_name()] = recipe_id return recipe end function ic:register_fluid_freezing_recipe(name, input_fluid, output_item, duration) assert(type(name) == "string", "expected a name") assert(input_fluid, "expected an input fluid") assert(output_item, "expected an output item") assert(type(duration) == "number", "expected a duration") self.g_recipe_id = self.g_recipe_id + 1 local recipe_id = self.g_recipe_id local recipe = FreezingFluidRecipe:new({ id = recipe_id, name = name, input_fluid_stack = input_fluid, output_item_stack = output_item, duration = duration, }) self.m_fluid_recipes[recipe.id] = recipe self.m_fluid_input_to_recipe[recipe.input_fluid_stack.name] = recipe_id return recipe end function ic:find_item_freezing_recipe(input_item) if input_item:is_empty() then return nil, "input is empty" end local recipe_id = self.m_item_input_to_recipe[input_item:get_name()] if recipe_id then local recipe = assert(self.m_item_recipes[recipe_id]) if recipe.input_item_stack:get_count() > input_item:get_count() then return nil, "not enough input items" else return recipe end end return nil, "no matching recipe" end function ic:find_fluid_freezing_recipe(input_fluid) if FluidStack.is_empty(input_fluid) then return nil, "input is empty" end local recipe_id = self.m_fluid_input_to_recipe[input_fluid.name] if recipe_id then local recipe = assert(self.m_fluid_recipes[recipe_id]) if recipe.input_fluid_stack.amount > input_fluid.amount then return nil, "not enough input fluid" else return recipe end end return nil, "no matching recipe" end yatm_machines.FreezingRegistry = FreezingRegistry
require 'lfs' require 'paths' require 'image' require 'cunn' require 'nngraph' require 'InstanceNormalization' torch.setdefaulttensortype('torch.FloatTensor') local argparse = require 'argparse' local parser = argparse() parser:option('--input', 'Input file') parser:option('--input_dir', 'Input directory') parser:option('--output', 'Output file') parser:option('--output_dir', 'Output directory') parser:option('--model', 'Pre-trained model') local args = parser:parse() function predict(input_path, output_path) input_image = image.load(input_path) input_size = input_image:size() r = 256 / math.min(input_size[2], input_size[3]) input_image = image.scale(input_image, r*input_size[3], r*input_size[2]) input_size = input_image:size() input_image = input_image:resize(1, 3, input_size[2], input_size[3]):cuda() input_image:mul(2):add(-1) output_image = gen:forward(input_image) output_image:add(1):div(2) output_size = output_image:size() ouput_image = output_image:resize(3, output_size[3], output_size[4]) image.save(output_path, output_image) print('Saved '..output_path) end if ( args['model'] == nil ) then print('Specify a pre-trained model') os.exit() end if ( args['input'] == nil ) and ( args['input_dir'] == nil ) then print('Specify an input file or input directory') os.exit() end if ( args['input_dir'] ~= nil ) and ( args['output_dir'] == nil ) then args['output_dir'] = 'output' end if ( args['output_dir'] ~= nil ) and ( not(lfs.attributes(args['output_dir'])) ) then paths.mkdir(args['output_dir']) end if ( args['output'] ~= nil ) and ( not(lfs.attributes(paths.dirname(args['output']))) ) then paths.mkdir(paths.dirname(args['output'])) end if ( args['input'] ~= nil ) and ( args['output'] == nil ) then args['output'] = 'out_'..paths.basename(args['input']) end gen = torch.load(args['model']) if not ( args['input_dir'] == nil ) then for file in lfs.dir(args['input_dir']) do if not ( string.sub(file, 1, 1) == '.' ) then predict(paths.concat(args['input_dir'], file), paths.concat(args['output_dir'], file)) end end else predict(args['input'], args['output']) end
-- LV Electric Furnace -- This is a faster version of the stone furnace which runs on EUs -- FIXME: kpoppel I'd like to introduce an induction heating element here also minetest.register_craft({ output = 'technic:electric_furnace', recipe = { {'default:cobble', 'default:cobble', 'default:cobble'}, {'default:cobble', 'technic:machine_casing', 'default:cobble'}, {'default:cobble', 'technic:lv_cable', 'default:cobble'}, } }) technic.register_electric_furnace({tier="LV", demand={300}, speed = 2})
object_tangible_food_generic_drink_durindfire = object_tangible_food_generic_shared_drink_durindfire:new { } ObjectTemplates:addTemplate(object_tangible_food_generic_drink_durindfire, "object/tangible/food/generic/drink_durindfire.iff")
core.register_privilege("remove_stick", { description = "Can use the remove stick tool to delete nodes or entities", give_to_singleplayer = false, give_to_admin = true, }) minetest.register_craftitem("remove_stick:remove_stick", { description = "Admin Remove Stick", inventory_image = "admin_tools_removestick.png", on_use = function(item, user, pointed_thing) local user_name = user:get_player_name() if not minetest.check_player_privs(user, "remove_stick") then minetest.chat_send_player(user_name, "You need the remove_stick priviledge to use this tool.") return end if pointed_thing.type == "node" then local node = minetest.get_node(pointed_thing.under) minetest.remove_node(pointed_thing.under) minetest.log("action", user_name .. " used a remove stick to remove " .. node.name .. " at " .. minetest.pos_to_string(pointed_thing.under)) elseif pointed_thing.type == "object" then local obj = pointed_thing.ref local obj_pos = obj:get_pos() if obj ~= nil then if obj:is_player() then -- Player if minetest.settings:get_bool("enable_damage") == false then minetest.log("action", user_name .. " tried to use a remove stick to kill player " .. obj:get_player_name() .. " at " .. minetest.pos_to_string(obj_pos) .. " but damage is not enabled.") else obj:set_hp(0) minetest.log("action", user_name .. " used a remove stick to kill player " .. obj:get_player_name() .. " at " .. minetest.pos_to_string(obj_pos)) end else -- Mob or other entity obj:remove() minetest.log("action", user_name .. " used a remove stick to remove entity " .. obj:get_entity_name() .. " at " .. minetest.pos_to_string(obj_pos)) end end end end, stack_max = 1, liquids_pointable = true, })
----------------------------------- -- Area: The_Garden_of_RuHmet -- NPC: ??? (Ix'aern (Dark Knight) Spawn) -- Allows players to spawn the Ix'aern (Dark Knight) by checking ??? only after killing the required mobs in the same room as the ???. -- !pos -240 5.00 440 35 -- !pos -280 5.00 240 35 -- !pos -560 5.00 239 35 -- !pos -600 5.00 440 35 ----------------------------------- local ID = require("scripts/zones/The_Garden_of_RuHmet/IDs") require("scripts/globals/status") ----------------------------------- function onTrade(player,npc,trade) end function onTrigger(player,npc) local hatedPlayer = npc:getLocalVar("hatedPlayer") local isInTime = npc:getLocalVar("hateTimer") > os.time() if hatedPlayer ~= 0 and not isInTime then -- player took too long, so reset animosity npc:setLocalVar("hatedPlayer",0) npc:setLocalVar("hateTimer",0) player:messageSpecial(ID.text.UNKNOWN_PRESENCE) elseif hatedPlayer == 0 then -- nobody has animosity player:messageSpecial(ID.text.UNKNOWN_PRESENCE) elseif hatedPlayer ~= player:getID() then -- someone else has animosity player:messageSpecial(ID.text.NONE_HOSTILE) else -- this player has animosity -- spawn Ix'Aern DRK and its two minions near the QM player:messageSpecial(ID.text.MENACING_CREATURES) npcUtil.popFromQM(player, npc, {ID.mob.IXAERN_DRK, ID.mob.IXAERN_DRK + 1, ID.mob.IXAERN_DRK + 2}, {radius = 3}) -- move QM to random location, and reset animosity local pos = math.random(1,4) npcUtil.queueMove(npc, ID.npc.IXAERN_DRK_QM_POS[pos]) npc:setLocalVar("position", pos) npc:setLocalVar("hatedPlayer",0) npc:setLocalVar("hateTimer",0) end end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) end
class "PlayerColor" function PlayerColor:__init() -- Changes if window opens on load or not self.windowOpen = false -- Creates window self:CreateWindow() -- I hope you "like" this "comment" about "subscribing" -- I'm sorry for that "joke" about "YouTube" Network:Subscribe("FetchColor", self, self.FetchColor) Events:Subscribe("KeyUp", self, self.KeyUp) Events:Subscribe("LocalPlayerInput", self, self.LocalPlayerInput) Events:Subscribe("ResolutionChange", self, self.ResolutionChange) end function PlayerColor:CreateWindow() -- Self Explanatory -- Create Main Window self.window = Window.Create() self.window:SetSize(Vector2(500, 300)) self:ResolutionChange() self.window:SetTitle("Color Changer") self.window:SetVisible(self.windowOpen) self.window:Subscribe("WindowClosed", function() self:SetState(false) end) -- Create Color Picker self.colorpicker = HSVColorPicker.Create(self.window) self.colorpicker:SetDock(GwenPosition.Fill) -- Create Button self.button = Button.Create(self.window) self.button:SetDock(GwenPosition.Bottom) self.button:SetText("Apply") self.button:Subscribe("Press", function() self:ApplyColor() end) end function PlayerColor:ApplyColor() -- Fires when "Apply" button pressed, sends color to server in order to add to player self:SetState(false) local color = self.colorpicker:GetColor() Chat:Print("Color Updated", color) Network:Send("ChangeColor", color) end function PlayerColor:FetchColor(color) -- Loads last saved color self.colorpicker:SetColor(color) end function PlayerColor:SetState(state) -- Opens/Closes window self.windowOpen = state self.window:SetVisible(state) Mouse:SetVisible(state) end function PlayerColor:KeyUp(args) -- Check to see if F8 is pressed to open window if args.key == VirtualKey.F8 then local state = not self.windowOpen self:SetState(state) end end function PlayerColor:LocalPlayerInput() -- Disables input when window is open if self.windowOpen == true then return false end end function PlayerColor:ResolutionChange() -- Resizes window self.window:SetPositionRel(Vector2(0.5, 0.5) - self.window:GetSizeRel() / 2) end local player_color = PlayerColor() -- Calls class
function encode(number) local assign = { [0] = '2', [1] = '3', [2] = '4', [3] = '5', [4] = '6', [5] = '7', [6] = '8', [7] = '9', [8] = 'A', [9] = 'C', [10] = 'D', [11] = 'E', [12] = 'F', [13] = 'G', [14] = 'H', [15] = 'I', [16] = 'J', [17] = 'K', [18] = 'L', [19] = 'M', [20] = 'N', [21] = 'O', [22] = 'P', [23] = 'Q', [24] = 'R', [25] = 'T', [26] = 'U', [27] = 'V', [28] = 'W', [29] = 'X', [30] = 'Y', [31] = 'Z' } i = 0 numbers = {} while number > 0 do i = i + 1 numbers[i] = math.fmod(number, 32) number = math.floor(number/32) end recordLocator = "" for i,v in ipairs(numbers) do recordLocator = recordLocator .. assign[v] end return string.reverse(recordLocator) end function decode(recordLocator) local assign = { ['0'] = 21, ['1'] = 15, ['S'] = 12, ['B'] = 22, ['2'] = 0, ['3'] = 1, ['4'] = 2, ['5'] = 3, ['6'] = 4, ['7'] = 5, ['8'] = 6, ['9'] = 7, ['A'] = 8, ['C'] = 9, ['D'] = 10, ['E'] = 11, ['F'] = 12, ['G'] = 13, ['H'] = 14, ['I'] = 15, ['J'] = 16, ['K'] = 17, ['L'] = 18, ['M'] = 19, ['N'] = 20, ['O'] = 21, ['P'] = 22, ['Q'] = 23, ['R'] = 24, ['T'] = 25, ['U'] = 26, ['V'] = 27, ['W'] = 28, ['X'] = 29, ['Y'] = 30, ['Z'] = 31 } recordLocator = string.upper(recordLocator) number = 0 for c in recordLocator:gmatch"." do number = (number * 32) + assign[c] end return number end
Config = { Debug = false, GridSize = 4, MaxDistance = 5.0, Controls = { Place = 24, Cancel = 25, FineTune = 21, RotateR = 44, RotateL = 46, VariantR = 96, VariantL = 97, }, Placing = { Anim = { Dict = "pickup_object", Name = "putdown_low", Flag = 0, Duration = 1500, }, }, Pickup = { MaxDistance = 3.0, Anim = { Dict = "pickup_object", Name = "putdown_low", Flag = 0, Duration = 1500, }, }, }
--[[-------------------------------------------------------------------- Grid Compact party and raid unit frames. Copyright (c) 2006-2009 Kyle Smith (Pastamancer) Copyright (c) 2009-2016 Phanx <addons@phanx.net> All rights reserved. See the accompanying LICENSE file for details. https://github.com/Phanx/Grid https://mods.curse.com/addons/wow/grid http://www.wowinterface.com/downloads/info5747-Grid.html ------------------------------------------------------------------------ Stagger.lua Grid status module for Monk Stagger. ----------------------------------------------------------------------]] local _, Grid = ... local L = Grid.L local GridRoster = Grid:GetModule("GridRoster") local GridStatus = Grid:GetModule("GridStatus") local GridStatusStagger = Grid:NewStatusModule("GridStatusStagger") GridStatusStagger.menuName = L["Stagger"] GridStatusStagger.options = false GridStatusStagger.defaultDB = { alert_stagger = { enable = true, colors = { light = { r = 0, g = 1, b = 0, a = 1 }, moderate = { r = 1, g = 1, b = 0, a = 1 }, heavy = { r = 1, g = 0, b = 0, a = 1 }, }, priority = 95, range = false, }, } local stagger_names = { GetSpellInfo(124273), GetSpellInfo(124274), GetSpellInfo(124275), } local stagger_names_count = #stagger_names local spellID_severity = { [124273] = "heavy", [124274] = "moderate", [124275] = "light", } local monks = {} local function getstaggercolor(severity) local color = GridStatusStagger.db.profile.alert_stagger.colors[severity] return color.r, color.g, color.b, color.a end local function setstaggercolor(severity, r, g, b, a) local color = GridStatusStagger.db.profile.alert_stagger.colors[severity] color.r = r color.g = g color.b = b color.a = a or 1 GridStatus:SendMessage("Grid_ColorsChanged") end local staggerOptions = { stagger_color = { type = "group", dialogInline = true, name = L["Stagger colors"], order = 80, args = { light = { type = "color", name = L["Light Stagger"], desc = L["Color for Light Stagger."], order = 100, hasAlpha = true, get = function () return getstaggercolor("light") end, set = function (_, r, g, b, a) setstaggercolor("light", r, g, b, a) end, }, moderate = { type = "color", name = L["Moderate Stagger"], desc = L["Color for Moderate Stagger."], order = 101, hasAlpha = true, get = function () return getstaggercolor("moderate") end, set = function (_, r, g, b, a) setstaggercolor("moderate", r, g, b, a) end, }, heavy = { type = "color", name = L["Heavy Stagger"], desc = L["Color for Heavy Stagger."], order = 102, hasAlpha = true, get = function () return getstaggercolor("heavy") end, set = function (_, r, g, b, a) setstaggercolor("heavy", r, g, b, a) end, }, }, }, color = false, } function GridStatusStagger:PostInitialize() self:RegisterStatus("alert_stagger", L["Stagger"], staggerOptions, true) local options = GridStatus.options.args["alert_stagger"] options.desc = format(L["Status: %s\n\nSeverity of Stagger on Monk tanks"], options.name) end function GridStatusStagger:OnStatusEnable(status) if status == "alert_stagger" then self:RegisterMessage("Grid_UnitJoined") self:RegisterMessage("Grid_UnitLeft") self:RegisterEvent("UNIT_AURA", "UpdateUnit") self:RegisterEvent("UNIT_NAME_UPDATE", "UpdateName") for guid, unitid in GridRoster:IterateRoster() do local _, class = UnitClass(unitid) if class == "MONK" then monks[guid] = true end end self:UpdateAllUnits() end end function GridStatusStagger:OnStatusDisable(status) if status == "alert_stagger" then self:UnregisterMessage("Grid_UnitJoined") self:UnregisterMessage("Grid_UnitLeft") self:UnregisterEvent("UNIT_AURA") self:UnregisterEvent("UNIT_NAME_UPDATE") wipe(monks) self.core:SendStatusLostAllUnits("alert_stagger") end end function GridStatusStagger:Grid_UnitJoined(event, guid, unitid) local _, class = UnitClass(unitid) if class == "MONK" then monks[guid] = true self:UpdateUnit(event, unitid) end end function GridStatusStagger:Grid_UnitLeft(event, guid) monks[guid] = nil end function GridStatusStagger:UpdateName(event, unitid) local _, class = UnitClass(unitid) if class == "MONK" then local guid = UnitGUID(unitid) if GridRoster:IsGUIDInGroup(guid) and not monks[guid] then monks[guid] = true self:UpdateUnit(event, unitid) end end end function GridStatusStagger:UpdateAllUnits() for guid, unitid in GridRoster:IterateRoster() do self:UpdateUnit("UpdateAllUnits", unitid) end end function GridStatusStagger:UpdateUnit(event, unitid) local guid = UnitGUID(unitid) if monks[guid] then for i = 1, stagger_names_count do local name, _, icon, _, _, _, _, _, _, _, spellID = UnitDebuffWrapper(unitid, stagger_names[i]) --fix if spellID then local severity = spellID_severity[spellID] local settings = self.db.profile.alert_stagger local color = severity and settings.colors[severity] return self.core:SendStatusGained(guid, "alert_stagger", settings.priority, settings.range, color, name, nil, nil, icon) end end end self.core:SendStatusLost(guid, "alert_stagger") end
--This is to be used for static spawns that are NOT part of caves, cities, dungeons, poi's, or other large screenplays. TalusStaticSpawnsNorthScreenPlay = ScreenPlay:new { numberOfActs = 1, screenplayName = "TalusStaticSpawnsNorthScreenPlay", lootContainers = { 1094899 --9645503 = bugged container, enabling this container caused the entire screenplay to not work. }, lootLevel = 14, lootGroups = { { groups = { {group = "color_crystals", chance = 700000}, {group = "junk", chance = 7500000}, {group = "rifles", chance = 600000}, {group = "pistols", chance = 600000}, {group = "clothing_attachments", chance = 300000}, {group = "armor_attachments", chance = 300000} }, lootChance = 8000000 } }, lootContainerRespawn = 1800 -- 30 minutes } registerScreenPlay("TalusStaticSpawnsNorthScreenPlay", true) function TalusStaticSpawnsNorthScreenPlay:start() if (isZoneEnabled("talus")) then self:spawnMobiles() self:initializeLootContainers() end end function TalusStaticSpawnsNorthScreenPlay:spawnMobiles() --Crashed Transport (-2400,2033) local pNpc = spawnMobile("talus", "stormtrooper_squad_leader", 360, -2416.3, 28.3, 2034.3, 180, 0) self:setMoodString(pNpc, "npc_imperial") spawnMobile("talus", "stormtrooper_medic", 360, -2404.1, 27.2, 2036.8, 81, 0) spawnMobile("talus", "stormtrooper", 360, -2404.2, 27.3, 2031.2, 125, 0) spawnMobile("talus", "stormtrooper_commando", 360, -2403.9, 26.7, 2021.6, -90, 0) spawnMobile("talus", "stormtrooper_captain", 360, -2418.3, 28.4, 2034.8, 180, 0) spawnMobile("talus", "stormtrooper", 360, -2421.2, 28.3, 2028.2, 90, 0) spawnMobile("talus", "stormtrooper", 360, -2417.8, 27.6, 2022.3, 150, 0) spawnMobile("talus", "stormtrooper", 360, -2410.8, 27.2, 2014.5, 109, 0) spawnMobile("talus", "stormtrooper_medic", 360, -2411.6, 28.0, 2030.1, -165, 0) spawnMobile("talus", "stormtrooper_rifleman", 360, -2412.4, 27.1, 2021.7, -30, 0) spawnMobile("talus", "stormtrooper_rifleman", 360, -2419.8, 27.4, 2014.8, -125, 0) spawnMobile("talus", "stormtrooper", 360, -2398.3, 26.9, 2014.4, -15, 0) spawnMobile("talus", "stormtrooper", 360, -2392.4, 26.1, 2020.0, 45, 0) spawnMobile("talus", "stormtrooper", 360, -2389.6, 25.4, 2025.9, -22, 0) spawnMobile("talus", "stormtrooper_bombardier", 360, -2388.5, 24.7, 2032.9, 0, 0) spawnMobile("talus", "stormtrooper_bombardier", 360, -2379.8, 23.4, 2032.8, 0, 0) spawnMobile("talus", "stormtrooper", 360, -2364.2, 11.0, 2105.0, 40, 0) spawnMobile("talus", "stormtrooper", 360, -2369.2, 11.5, 2109.0, 40, 0) --Four Stones & Fire (-1832,1438) spawnMobile("talus", "aakuan_warder", 300, -1838.7, 7.5, 1437.7, 115, 0) spawnMobile("talus", "aakuan_keeper", 300, -1825.0, 8.9, 1425.7, 122, 0) spawnMobile("talus", "aakuan_keeper", 300, -1824.4, 7.9, 1442.6, 0, 0) --Bridge (-150,323) --Dath Tree (-695,156) spawnMobile("talus", "foaming_vynock", 300, -687.8, 44.3, 170.1, 45, 0) spawnMobile("talus", "foaming_vynock", 300, -699.9, 43.6, 174.7, -70, 0) spawnMobile("talus", "foaming_vynock", 300, -712.1, 42.7, 169.4, -60, 0) spawnMobile("talus", "foaming_vynock", 300, -714.6, 42.5, 152.3, 140, 0) spawnMobile("talus", "foaming_vynock", 300, -705.1, 43.2, 142.1, 60, 0) spawnMobile("talus", "foaming_vynock", 300, -690.8, 44.2, 141.7, 70, 0) spawnMobile("talus", "foaming_vynock", 300, -678.8, 44.8, 150.9, 30, 0) spawnMobile("talus", "foaming_vynock", 300, -680.9, 44.7, 160.6, 180, 0) spawnMobile("talus", "foaming_vynock", 300, -694.2, 43.9, 153.6, -130, 0) spawnMobile("talus", "foaming_vynock", 300, -705.8, 43.2, 155.6, -177, 0) spawnMobile("talus", "foaming_vynock", 300, -697.8, 43.7, 166.6, 108, 0) --Probe Droid (-2599,101) spawnMobile("talus", "rebel_commando", 300, -2601.8, 47.9, 101.0, 88, 0) spawnMobile("talus", "rebel_commando", 300, -2605.7, 45.1, 88.6, -48, 0) spawnMobile("talus", "rebel_commando", 300, -2609.7, 45.9, 97.7, 70, 0) spawnMobile("talus", "rebel_commando", 300, -2618.8, 42.7, 91.7, 68, 0) spawnMobile("talus", "rebel_commando", 300, -2613.2, 46.4, 114.5, 126, 0) --Ribcage (-4472,65) spawnMobile("talus", "decay_mite", 300, -4464.8, 17.6, 63.4, -123, 0) spawnMobile("talus", "decay_mite", 300, -4465.5, 19.2, 60.8, -123, 0) spawnMobile("talus", "decay_mite", 300, -4469.1, 20.5, 61.9, -63, 0) spawnMobile("talus", "decay_mite", 300, -4470.9, 22.1, 60.3, -43, 0) spawnMobile("talus", "decay_mite", 300, -4472.5, 23.6, 57.9, -163, 0) spawnMobile("talus", "decay_mite", 300, -4476.6, 22.9, 62.5, 63, 0) spawnMobile("talus", "decay_mite", 300, -4478.0, 21.3, 66.0, 53, 0) spawnMobile("talus", "decay_mite", 300, -4474.8, 17.4, 70.4, 135, 0) spawnMobile("talus", "decay_mite", 300, -4473.5, 14.0, 74.8, 13, 0) spawnMobile("talus", "decay_mite", 300, -4468.5, 12.3, 75.8, 113, 0) spawnMobile("talus", "decay_mite", 300, -4467.1, 12.2, 79.4, -163, 0) spawnMobile("talus", "decay_mite", 300, -4466.7, 17.2, 65.5, -98, 0) spawnMobile("talus", "decay_mite", 300, -4465.1, 14.7, 68.2, -63, 0) spawnMobile("talus", "decay_mite", 300, -4469.1, 14.5, 71.3, -143, 0) spawnMobile("talus", "decay_mite", 300, -4460.4, 13.5, 72.2, -133, 0) --statue head (-5040,116) spawnMobile("talus", "fed_dub_investigator", 300, -5040.2, 4.9, 113.2, -17, 0) --Debris (-6316,1253) spawnMobile("talus", "tortur_bull", 360, -6259.0, 7.8, 1272.6, 90, 0) spawnMobile("talus", "tortur_bull", 360, -6279.9, 7.8, 1256.0, 90, 0) spawnMobile("talus", "tortur", 360, -6283.3, 6.9, 1288.8, 90, 0) --Bones (-5855.3,1442) --Large Broken Tower (-5517,1064) spawnMobile("talus", "lost_aqualish_outrider", 360, -5512.1, 21.5, 1063.7, 87, 0) --Small Pillar + Red Haze (-5100,1271) spawnMobile("talus", "aakuan_anarchist", 360, -5096.5, 9.2, 1268.1, -55, 0) spawnMobile("talus", "aakuan_anarchist", 360, -5095.9, 9.1, 1272.2, -108, 0) --Bones (-4716,1131) --Broken Flora Harvester (-4350,1542) spawnMobile("talus", "vicious_huf_dun", 360, -4347.5, 59.5, 1546.1, -160, 0) --Bridge Struts & Skeletons (-3996,977) spawnMobile("talus", "foaming_vynock", 360, -4000.8, 1.4, 973.6, -58, 0) spawnMobile("talus", "foaming_vynock", 360, -4006.7, 0.2, 971.5, 18, 0) --Flag (-3460,1550) spawnMobile("talus", "aakuan_keeper", 360, -3456.1, 10.9, 1546.6, -45, 0) spawnMobile("talus", "aakuan_keeper", 360, -3463.7, 10.7, 1545.6, 28, 0) --Fishing (-3009,1941) spawnMobile("talus", "fed_dub_supporter", 360, -3009.7, 0.2, 1941.7, 84, 0) --AT-ST cabin (-2771,1568) spawnMobile("talus", "comm_operator", 360, -2774.0, 0.5, 1567.0, 55, 0) spawnMobile("talus", "comm_operator", 360, -2770.0, 0.9, 1563.0, 0, 0) --Red Fire (-1833,1437) spawnMobile("talus", "aakuan_keeper", 360, -1837.7, 7.8, 1433.8, 60, 0) spawnMobile("talus", "aakuan_keeper", 360, -1837.7, 7.4, 1441.0, 110, 0) spawnMobile("talus", "aakuan_keeper", 360, -1826.5, 8.1, 1438.1, -90, 0) --Gas Harvester (-1470,1231) spawnMobile("talus", "commoner_technician", 360, -1470.9, 29.1, 1230.9, 90, 0) spawnMobile("talus", "clipped_fynock", 300, -1454.1, 28.8, 1225.1, -60, 0) spawnMobile("talus", "clipped_fynock", 300, -1456.6, 28.8, 1228.1, -50, 0) spawnMobile("talus", "clipped_fynock", 300, -1453.1, 28.5, 1230.1, -90, 0) --Three Stones with campfire out (-1362,1060) --Bones (-1243,1496) spawnMobile("talus", "decay_mite", 300, -1243.0, 6.8, 1500.2, -148, 0) spawnMobile("talus", "decay_mite", 300, -1240.9, 7.7, 1595.0, -51, 0) --worship Stone (-861,1020) spawnMobile("talus", "aakuan_steward", 360, -858.2, 18.3, 1019.6, -98, 0) spawnMobile("talus", "aakuan_steward", 360, -865.0, 16.9, 1019.6, 82, 0) --Engine Debris (-563,1270) spawnMobile("talus", "imperial_probe_drone", 360, -564.8, 54.7, 1266.4, 5, 0) --Dath Tree (-55,980) spawnMobile("talus", "sludge_panther", 360, -71.0, 11.9, 982.6, 2, 0) --Tent and Skeletons (86,1581) spawnMobile("talus", "rotting_decay_mite_guard", 360, 82.6, 11.6, 1584.5, 80, 0) --Pillar (618,1100) spawnMobile("talus", "aakuan_sentinel", 360, 621.4, 41.2, 1098.0, -3, 0) --Broken Walls (1115,1489) --Imperial House and lookout (1712,1629) spawnMobile("talus", "imperial_private", 360, 1712.7, 30.1, 1629.8, -50, 0) spawnMobile("talus", "imperial_private", 360, 1740.1, 20.1, 1638.1, 70, 0) spawnMobile("talus", "imperial_trooper", 360, 1695.4, 53.6, 1639.0, -22, 0) spawnMobile("talus", "imperial_trooper", 360, 1673.7, 70.7, 1630.3, 48, 0) spawnMobile("talus", "imperial_trooper", 360, 1672.6, 67.5, 1647.2, 102, 0) spawnMobile("talus", "imperial_trooper", 360, 1710.6, 52.9, 1666.6, 142, 0) spawnMobile("talus", "imperial_trooper", 360, 1770.3, 7.1, 1649.6, 101, 0) spawnMobile("talus", "imperial_trooper", 360, 1779.9, 7.0, 1681.8, 126, 0) spawnMobile("talus", "imperial_trooper", 360, 1702.6, 21.1, 1601.0, -112, 0) spawnMobile("talus", "imperial_trooper", 360, -6.0, 0.7, -1.7, 0, 9505497) spawnMobile("talus", "imperial_pilot", 360, -1.0, 0.7, -6.9, -90, 9505498) spawnMobile("talus", "imperial_medic", 360, -2.2, 0.7, -2.0, 90, 9505499) spawnMobile("talus", "imperial_army_captain", 360, -2.2, 0.7, 4.3, 90, 9505500) --Debris (1711,783) spawnMobile("talus", "repugnant_dung_mite_crawler", 360, 1711.9, 6.5, 780.6, -78, 0) --Skull (2120,1272) --Small Shrine with Skulls (2470,787) spawnMobile("talus", "aakuan_keeper", 360, 2466.3, 34.2, 787.7, 106, 0) spawnMobile("talus", "aakuan_keeper", 360, 2472.9, 33.1, 791.7, -150, 0) spawnMobile("talus", "aakuan_champion", 360, 2469.4, 30.3, 810.6, 177, 0) --Imperial Watch Tower (3209,1262) spawnMobile("talus", "imperial_medic", 360, 3200.5, 6.3, 1261.9, -40, 0) spawnMobile("talus", "stormtrooper_sniper", 360, 3191.5, 5.1, 1269.0, -40, 0) spawnMobile("talus", "stormtrooper_sniper", 360, 3198.6, 5.3, 1274.0, -40, 0) spawnMobile("talus", "at_st", 720, 3202.0, 9.3, 1243.9, -40, 0) --Tall Odd Tree (3474,481) spawnMobile("talus", "ravenous_rasp", 360, 3480.1, 35.2, 481.4, -77, 0) --Bridge and Debris (5480,1085) spawnMobile("talus", "talus_liberation_party_loyalist", 360, 5486.8, 45.4, 1112.8, -36, 0) spawnMobile("talus", "talus_liberation_party_loyalist", 360, 5499.0, 44.4, 1081.8, 92, 0) spawnMobile("talus", "talus_liberation_party_fanatic", 360, 5477.0, 40.0, 1077.3, -32, 0) spawnMobile("talus", "talus_liberation_party_fanatic", 360, 5466.7, 40.0, 1076.4, -109, 0) spawnMobile("talus", "talus_liberation_party_activist", 360, 5484.3, 40.0, 1077.4, 66, 0) --Table (5413,2655) --Pillars Ruins (4974,3849) --Burning Rocks (4310,2563) spawnMobile("talus", "sleemo_vandal", 360, 4314.9, 48.0, 2565.8, -113, 0) --Monument in Lake (2445,2485) --Gateway (2338,2936) spawnMobile("talus", "talus_liberation_party_activist", 360, 2335.8, 38.7, 2933.4, 144, 0) spawnMobile("talus", "talus_liberation_party_activist", 360, 2341.2, 39.2, 2937.0, 144, 0) spawnMobile("talus", "talus_liberation_party_loyalist", 360, 2333.7, 39.7, 2943.7, 177, 0) --Stones (169,3409) spawnMobile("talus", "rot_mite", 300, 164.3, 73.2, 3408.4, 71, 0) spawnMobile("talus", "rot_mite", 300, 163.1, 73.5, 3402.7, 171, 0) spawnMobile("talus", "rot_mite", 300, 169.1, 73.5, 3400.2, -31, 0) spawnMobile("talus", "rot_mite", 300, 175.7, 72.3, 3412.2, 7, 0) --Aqualish Camp (-97,2610) spawnMobile("talus", "lost_aqualish_marshall", 360, -99.5, 72.4, 2616.3, 140, 0) spawnMobile("talus", "lost_aqualish_commando", 360, -92.2, 71.1, 2611.9, -118, 0) spawnMobile("talus", "lost_aqualish_warrior", 360, -95.5, 72.0, 2603.8, -20, 0) --Stone Pillars (-735,2033) --Broken Tree (-525,3790) spawnMobile("talus", "rot_mite", 300, -522.5, 51.9, 3795.8, 81, 0) spawnMobile("talus", "rot_mite", 300, -516.9, 51.7, 3796.0, 31, 0) spawnMobile("talus", "rot_mite", 300, -508.4, 50.9, 3790.2, 124, 0) spawnMobile("talus", "rot_mite", 300, -513.1, 50.3, 3780.8, -131, 0) spawnMobile("talus", "rot_mite", 300, -522.8, 50.4, 3780.3, -50, 0) spawnMobile("talus", "rot_mite", 300, -528.1, 50.1, 3778.3, 1, 0) spawnMobile("talus", "rot_mite", 300, -534.2, 51.0, 3783.8, 131, 0) spawnMobile("talus", "rot_mite", 300, -520.8, 51.5, 3789.1, 45, 0) spawnMobile("talus", "rot_mite", 300, -531.4, 51.8, 3793.4, -31, 0) --Creature Skull (-1117,3753) --Ruins (-1394,2117) --Old Communications Tower (-1652,3382) spawnMobile("talus", "imperial_probe_drone", 300, -1653.7, 115.1, 3383.9, 154, 0) --Rock Formation (-2042,2810) spawnMobile("talus", "imperial_sharpshooter", 300, -2033.9, 141.7, 2807.1, 75, 0) spawnMobile("talus", "imperial_sharpshooter", 300, -2040.6, 141.0, 2816.8, 0, 0) spawnMobile("talus", "imperial_sharpshooter", 300, -2050.3, 141.2, 2819.5, -55, 0) spawnMobile("talus", "imperial_sharpshooter", 300, -2050.5, 140.6, 2811.7, -125, 0) spawnMobile("talus", "imperial_sharpshooter", 300, -2044.1, 141.6, 2806.9, 180, 0) spawnMobile("talus", "imperial_sergeant_major", 300, -2041.2, 140.7, 2811.6, -175, 0) --Road/Trail north of Imperial Outpost (-2255,2467) to (-2059,2444) spawnMobile("talus", "imperial_first_lieutenant", 300, -2251.1, 66.7, 2487.0, -5, 0) spawnMobile("talus", "imperial_trooper", 300, -2251.3, 67.4, 2491.0, -5, 0) spawnMobile("talus", "imperial_trooper", 300, -2251.5, 68.0, 2495.0, -5, 0) spawnMobile("talus", "imperial_trooper", 300, -2251.7, 68.6, 2499.0, -5, 0) spawnMobile("talus", "imperial_trooper", 300, -2251.9, 69.1, 2503.0, -5, 0) spawnMobile("talus", "imperial_trooper", 300, -2252.1, 69.6, 2507.0, -5, 0) spawnMobile("talus", "imperial_trooper", 300, -2252.3, 70.0, 2511.0, -5, 0) --Broken Arch (-2988,3820) --Statue (-3246,3425) spawnMobile("talus", "sleemo_vandal", 300, -3248.9, 50.0, 3432.9, 175, 0) spawnMobile("talus", "sleemo_vandal", 300, -3242.6, 49.5, 3432.4, 75, 0) spawnMobile("talus", "sleemo_vandal", 300, -3241.8, 48.9, 3425.6, -95, 0) spawnMobile("talus", "sleemo_vandal", 300, -3245.5, 49.7, 3428.3, -145, 0) --Skeleton and Debris (-3394,2497) spawnMobile("talus", "scavenger", 300, -3394.8, 8.4, 2497.4, 105, 0) spawnMobile("talus", "scavenger", 300, -3391.3, 8.4, 2500.2, 180, 0) spawnMobile("talus", "scavenger", 300, -3397.8, 8.6, 2499.6, 55, 0) --Ruins (-3492,3697) spawnMobile("talus", "scavenger", 300, -3491.7, 40.5, 3697.5, 180, 0) spawnMobile("talus", "scavenger", 300, -3483.6, 39.9, 3700.0, 180, 0) --Creature Skeleton (-3482,3965) --Stones and Skull (-3710,2891) --Broken Bridge (-4025,3664) --Ruined Lookout Tower (-4381,2669) spawnMobile("talus", "scavenger", 300, -4384.1, 16.7, 2663.6, 12, 0) spawnMobile("talus", "scavenger", 300, -4379.1, 16.8, 2663.1, -33, 0) --Diseased Ruins & Mite Nest (-5117,3213) spawnMobile("talus", "giant_decay_mite_queen", 360, -5107.7, 19.6, 3215.1, -108, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5110.2, 19.2, 3214.0, -158, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5109.2, 18.8, 3210.4, 165, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5113.5, 19.9, 3220.9, -33, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5104.6, 20.7, 3221.9, 145, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5108.5, 20.8, 3225.0, -50, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5116.6, 20.1, 3224.8, -90, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5119.5, 18.8, 3216.5, -165, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5116.1, 18.4, 3211.4, 65, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5114.9, 17.7, 3204.9, 170, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5121.8, 17.2, 3205.7, -88, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5130.4, 16.1, 3202.6, -111, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5127.3, 16.0, 3199.7, 115, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5126.2, 19.7, 3228.4, -45, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5101.7, 19.6, 3211.4, -65, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5102.2, 18.6, 3204.6, -145, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5106.4, 17.8, 3201.0, -65, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5117.3, 16.5, 3197.5, -35, 0) spawnMobile("talus", "giant_decay_mite_hatchling", 300, -5119.3, 20.7, 3231.2, 175, 0) spawnMobile("talus", "giant_decay_mite_guardian", 300, -5117.8, 19.4, 3220.0, 135, 0) spawnMobile("talus", "giant_decay_mite_protector", 300, -5112.8, 18.4, 3209.4, 22, 0) spawnMobile("talus", "giant_decay_mite_sentry", 300, -5141.9, 18.9, 3233.1, -45, 0) spawnMobile("talus", "giant_decay_mite_sentry", 300, -5151.3, 16.6, 3222.0, -45, 0) spawnMobile("talus", "giant_decay_mite_sentry", 300, -5151.1, 14.6, 3205.4, -115, 0) spawnMobile("talus", "giant_decay_mite_sentry", 300, -5152.3, 15.5, 3213.9, 85, 0) spawnMobile("talus", "giant_decay_mite_soldier", 300, -5147.4, 20.8, 3253.3, -25, 0) spawnMobile("talus", "giant_decay_mite_soldier", 300, -5161.4, 18.4, 3238.1, 165, 0) spawnMobile("talus", "giant_decay_mite_soldier", 300, -5171.8, 14.1, 3215.8, 90, 0) spawnMobile("talus", "giant_decay_mite_soldier", 300, -5136.1, 12.7, 3180.4, 180, 0) spawnMobile("talus", "giant_decay_mite_soldier", 300, -5101.3, 15.9, 3184.2, 88, 0) spawnMobile("talus", "giant_decay_mite_soldier", 300, -5088.1, 19.2, 3201.6, 165, 0) spawnMobile("talus", "giant_decay_mite_soldier", 300, -5100.3, 22.8, 3235.4, 5, 0) spawnMobile("talus", "giant_decay_mite_soldier", 300, -5116.9, 22.5, 3244.1, -15, 0) spawnMobile("talus", "giant_decay_mite_harvester", 300, -5105.9, 25.3, 3258.8, -9, 0) spawnMobile("talus", "giant_decay_mite_harvester", 300, -5118.5, 25.5, 3269.7, 49, 0) spawnMobile("talus", "giant_decay_mite_harvester", 300, -5147.5, 21.4, 3259.0, -114, 0) --Diseased Debris (-5139,3706) spawnMobile("talus", "giant_decay_mite_harvester", 360, -5143.0, 35.4, 3699.2, -49, 0) spawnMobile("talus", "giant_decay_mite_harvester", 360, -5148.5, 37.6, 3708.2, 82, 0) spawnMobile("talus", "giant_decay_mite_harvester", 360, -5132.1, 37.3, 3710.6, -89, 0) --Skulls + Red Fire (-5098,2355) spawnMobile("talus", "aakuan_keeper", 360, -5098.9, 47.3, 2355.5, 75, 0) spawnMobile("talus", "aakuan_keeper", 360, -5098.3, 47.5, 2362.4, 75, 0) --Backbone (-5730,2856) --3 Stone Pillars w/ Stone on Top (-5694,4012) --3 stone Collumns w/ Force Stone on Top (-5400,4302) spawnMobile("talus", "aakuan_guardian", 360, -5399.7, 72.5, 4302.5, -46, 0) --Arch w/ Teeth (-5221,4597) --Small Stone Circle (-5100,4722) pNpc = spawnMobile("talus", "aakuan_follower", 360, -5099.2, 39.9, 4725.7, -173, 0) self:setMoodString(pNpc, "entertained") --Tie Bomber Debris (-5277,5055) spawnMobile("talus", "clipped_fynock", 300, -5284.4, 52.2, 5049.1, -4, 0) spawnMobile("talus", "clipped_fynock", 300, -5286.0, 53.5, 5063.4, 145, 0) spawnMobile("talus", "clipped_fynock", 300, -5265.7, 11.2, 5062.1, 174, 0) spawnMobile("talus", "clipped_fynock", 300, -5263.5, 10.4, 5046.0, -24, 0) --Rock Circle (-5672,5290) pNpc = spawnMobile("talus", "aakuan_sentinel", 300, -5673.5, 7.0, 5289.8, -73, 0) self:setMoodString(pNpc, "angry") --Smoldering Fire in a Skull (-5928,5652) pNpc = spawnMobile("talus", "aakuan_spice_guard", 300, -5926.9, 26.6, 5655.3, 169, 0) self:setMoodString(pNpc, "worried") --Rocks (-5997,5951) --Large Dead Tree & Skulls (-5476,5811) spawnMobile("talus", "female_roba", 300, -5466.8, 43.4, 5813.3, 180, 0) spawnMobile("talus", "female_roba", 300, -5459.9, 44.2, 5816.9, 180, 0) spawnMobile("talus", "male_roba", 300, -5458.6, 44.8, 5806.0, -90, 0) --Escape Pod & Skeletons (-4984,5753) spawnMobile("talus", "rot_mite", 300, -4988.6, 41.9, 5757.4, 81, 0) spawnMobile("talus", "rot_mite", 300, -4993.8, 41.2, 5749.9, 116, 0) spawnMobile("talus", "rot_mite", 300, -4990.1, 42.5, 5744.7, 41, 0) spawnMobile("talus", "rot_mite", 300, -4981.1, 44.5, 5744.7, -31, 0) --Broken Probe Droid (-4803,5165) spawnMobile("talus", "scavenger", 300, -4804.6, 14.8, 5165.8, 102, 0) --Geyser (-4596,5703) spawnMobile("talus", "guf_drolg", 300, -4578.9, 29.5, 5694.6, -105, 0) spawnMobile("talus", "guf_drolg_female", 300, -4590.0, 29.3, 5687.1, 45, 0) --Sunken Ruins (-4575,4356) --Bushes & Tree (-4452,4059) spawnMobile("talus", "percussive_rasp", 300, -4451.8, 5.4, 4054.8, -9, 0) --Rock Pillar + Green Flame & Smoke (-4150,5952) --Stone Pillar + Fire (-4085,5566) --Broken Gas Harvester + Debris (-4020,4623) spawnMobile("talus", "scavenger", 300, -4020.9, 30.2, 4619.2, 10, 0) spawnMobile("talus", "scavenger", 300, -4030.9, 30.6, 4628.1, 152, 0) --3 Spikes (-3920,4127) --Broken Stone Pillar (-3698,4394) --Statue Head (-3594,5675) --Scientist Camp + Old Jedi Monument (-3640,6332) loot container = 1094899 spawnMobile("talus", "scientist", 1, -3630.9, 56.5, 6328.2, -52, 0) spawnMobile("talus", "scientist", 1, -3631.8, 56.8, 6335.7, -135, 0) spawnMobile("talus", "scientist", 1, -3642.4, 56.7, 6337.1, 180, 0) --Shipping containers (-3445,6184) spawnMobile("talus", "smuggler", 300, -3448.2, 43.3, 6186.0, 10, 0) spawnMobile("talus", "scavenger", 300, -3440.6, 42.5, 6182.3, 96, 0) spawnMobile("talus", "scavenger", 300, -3444.8, 43.8, 6174.0, 28, 0) spawnMobile("talus", "scavenger", 300, -3451.5, 44.1, 6181.7, 64, 0) --Skeleton on Rocks (-3171,5735) --Spaceship Debris (-3333,5170) spawnMobile("talus", "foaming_vynock", 300, -3330.5, 75.5, 5167.9, -28, 0) spawnMobile("talus", "foaming_vynock", 300, -3325.8, 75.0, 5171.1, -91, 0) spawnMobile("talus", "foaming_vynock", 300, -3336.1, 75.9, 5164.7, 48, 0) --AT-ST Wreckage + Skeleton (-3197,4757) spawnMobile("talus", "imperial_probe_drone", 300, -3194.3, 49.7, 4761.1, -120, 0) --Small Tree (-3090,4608) spawnMobile("talus", "song_rasp", 300, -3088.2, 28.4, 4605.9, -60, 0) --Giant Broken Tree Stump (-3244,4323) --Spring (-3230,4201) nothing there?? not 14.1 ?? --Spaceship Wreckage in River (-2986,5040) --Small camp & skeleton (-1229,4344) loot container = 9645503 (enabling this container causes the entire screenplay to not work) spawnMobile("talus", "mire_marauder", 300, -1222.1, 40.9, 4345.6, -112, 0) --Statue (910,4640) spawnMobile("talus", "aakuan_warder", 300, 910.1, 80.5, 4640.1, 85, 0) --Tree & Skeletons (1638,5431) --Broken Wall (2811,5583) --Aqualish Fishing Spot (5348,4545) spawnMobile("talus", "lost_aqualish_scout", 300, 5348.2, 1.2, 4545.4, 32, 0) spawnMobile("talus", "lost_aqualish_scout", 300, 5342.9, 1.2, 4550.6, 32, 0) spawnMobile("talus", "lost_aqualish_captain", 300, 5353.8, 1.2, 4542.6, 32, 0) --2 Trees + Green Myst (5440,5584) spawnMobile("talus", "puss_covered_decay_mite_soldier", 300, 5443.8, 139.2, 5596.4, -153, 0) spawnMobile("talus", "sickly_decay_mite_queen", 600, 5436.2, 142.2, 5570.2, 0, 0) end
-- -- Name: codelite/codelite_workspace.lua -- Purpose: Generate a CodeLite workspace. -- Author: Ryan Pusztai -- Modified by: Andrea Zanellato -- Manu Evans -- Created: 2013/05/06 -- Copyright: (c) 2008-2015 Jason Perkins and the Premake project -- local p = premake local project = p.project local workspace = p.workspace local tree = p.tree local codeblocks = p.modules.codeblocks codeblocks.workspace = {} local m = codeblocks.workspace -- -- Generate a CodeBlocks workspace -- function m.generate(wks) p.utf8() _p('<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>') _p('<CodeBlocks_workspace_file>') _p(1,'<Workspace title="%s">', wks.name) for prj in workspace.eachproject(wks) do local fname = path.join(path.getrelative(wks.location, prj.location), prj.name) local active = iif(prj.project == wks.projects[1], ' active="1"', '') _p(2,'<Project filename="%s.cbp"%s>', fname, active) for _,dep in ipairs(project.getdependencies(prj)) do _p(3,'<Depends filename="%s.cbp" />', path.join(path.getrelative(wks.location, dep.location), dep.name)) end _p(2,'</Project>') end _p(1,'</Workspace>') _p('</CodeBlocks_workspace_file>') end