content
stringlengths 5
1.05M
|
---|
vim.cmd([[
" Use <Tab> and <S-Tab> to navigate through popup menu
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Set completeopt to have a better completion experience
set completeopt=menuone,noinsert,noselect
" Avoid showing message extra message when using completion
set shortmess+=c
]])
|
help(
[[
This module loads ViennaRNA-2.2.9.
]])
local version = "2.2.9"
local base = "/cvmfs/oasis.opensciencegrid.org/osg/modules/ViennaRNA/"..version
whatis("The ViennaRNA Package consists of a C code library and several stand-alone programs for the prediction and comparison of RNA secondary structures.")
prepend_path("PATH", base)
prepend_path("PATH", pathJoin(base, "bin"))
prepend_path("LD_LIBRARY_PATH", pathJoin(base, "lib64"))
family('ViennaRNA')
|
object_tangible_loot_creature_loot_collections_trader_dom_gem_bead = object_tangible_loot_creature_loot_collections_shared_trader_dom_gem_bead:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_creature_loot_collections_trader_dom_gem_bead, "object/tangible/loot/creature/loot/collections/trader_dom_gem_bead.iff")
|
--***********************************************************
--** THE INDIE STONE **
--***********************************************************
require "TimedActions/ISBaseTimedAction"
---@class ISToggleLightAction : ISBaseTimedAction
ISToggleLightAction = ISBaseTimedAction:derive("ISToggleLightAction");
function ISToggleLightAction:isValid()
return true
end
function ISToggleLightAction:update()
end
function ISToggleLightAction:start()
self.character:faceThisObject(self.object)
end
function ISToggleLightAction:stop()
ISBaseTimedAction.stop(self)
end
function ISToggleLightAction:perform()
self.object:toggle()
-- needed to remove from queue / start next.
ISBaseTimedAction.perform(self)
end
function ISToggleLightAction:new(character, object)
local o = {}
setmetatable(o, self)
self.__index = self
o.character = character
o.stopOnWalk = false
o.stopOnRun = false
o.maxTime = 0
-- custom fields
o.object = object
return o
end
|
local tabletool = require 'tabletool'
-- example tables
local t1 = { "hello1", "hello2", "world" , 1 , 2 }
local t2 = { 1 , 2, 3 , 4 , 2 }
local t3 = { 3 , 4 , 12, 2}
local t4 = { 4, 21, 8, 9}
print("-- table 1: original")
tabletool.dumptable(t1)
print("-- table 2: original")
tabletool.dumptable(t2)
print("-- table 2: unique")
tabletool.dumptable(tabletool.unique(t2))
print("-- checking if table 1 contains 'hello1'")
print(tabletool.contains(t1, "hello1"))
print("-- reversing table 1:")
tabletool.dumptable(tabletool.reverse(t1))
print("-- counting element 'hello1' in table 1")
print(tabletool.count_element(t1, "hello1"))
print("-- table sum")
print(tabletool.sum(t1))
print("-- table average")
print(tabletool.average(t2, 2))
print("--- merging table 1 and 2:")
tabletool.dumptable(tabletool.join(t1, t2))
print("--- get a random element from table 2, five times:")
for i=1, 5 do
local e = tabletool.get_random_element(t2)
print(e)
end
print("--- sorting table 4 DESC")
tabletool.dumptable(tabletool.sort_desc(t4))
print("--- sorting table 4 ASC")
tabletool.dumptable(tabletool.sort_asc(t4))
for i=1, 3 do
print("--- shuffle table 4, round "..i)
tabletool.dumptable(tabletool.shuffle(t4))
end
|
local action = { }
local actionmt = {
__index = function(t, k)
local act = rawget(t, k)
if act then
return act
else
act = {
pressed = false,
released = false,
down = false
}
rawset(t, k, act)
return act
end
end
}
setmetatable(action, actionmt)
return action
|
Device = { hooks = {} }
Device.__index = Device
function Device:Create(id, info)
local device = setmetatable(info or {}, Device)
device.id = id
device.data = device.data or {}
device:UpdateKvp()
return device
end
function Device:Invoke(name, autoEnable, autoPeek, ...)
Main:Commit("invokeDevice", {
name = self.id,
func = name,
autoEnable = autoEnable,
autoPeek = autoPeek,
args = {...},
})
end
function Device:AddHook(name, func)
local hook = self.hooks[name]
if not hook then
hook = {}
self.hooks[name] = hook
end
hook[#hook + 1] = func
end
function Device:InvokeHook(name, ...)
local hook = self.hooks[name]
if not hook then return true end
for k, func in ipairs(hook) do
local result, retval = func(self, ...)
if result ~= nil then
return result, retval
end
end
return true
end
function Device:Toggle(value)
-- Flip state.
if value == nil then
value = not self.open
else
value = value == true
end
-- Check openable.
if value and not Main:CanOpen() then
return
end
-- Check can open.
if (Main.open or not Main.characterId) and value then
return false
end
-- Hooks.
local retval, shouldPeek = self:InvokeHook("Toggle", isOpen)
if not retval then
return retval
end
-- Cache.
self.peek = shouldPeek
self.open = value
Main.open = value and self or nil
-- Disarm.
TriggerEvent("disarmed")
-- Emotes.
if value and (not Phone.call or Phone.state == "in") then
self.emote = exports.emotes:Play(self.anim)
elseif self.emote then
exports.emotes:Stop(self.emote)
self.emote = nil
end
-- NUI focus.
SetNuiFocus(self.open, self.open)
SetNuiFocusKeepInput(self.open)
-- Enable UI.
Main:Commit("toggleDevice", {
name = self.id,
value = shouldPeek or value,
peek = not value and shouldPeek,
})
return true
end
function Device:Peek()
Main:Commit("toggleDevice", {
name = self.id,
value = true,
peek = true,
})
end
function Device:UpdateKvp()
self.kvp = Main.characterId and Config.Kvp:format(Main.characterId, self.id) or nil
end
function Device:Load()
self:LoadData()
Main:Commit("setData", {
device = self.id,
data = self.data or {},
})
Main:InvokeHook("LoadDevice", self)
end
-- Sets persistent data, saved in the store, and can be used globally.
function Device:SetData(app, key, value)
if not app then
app = "SYS"
end
Main:Commit("setAppData", {
device = self.id,
app = app,
key = key,
value = value,
})
end
-- Sets component data, which is only possible when the app is active.
function Device:SetAppData(app, key, value)
Main:Commit("updateDevice", {
name = self.id,
app = app,
key = key,
value = value,
})
end
function Device:UpdateData(app, key, value, time)
local appData = self.data[app]
if not appData then
appData = {}
self.data[app] = appData
end
appData[key] = value
print("updated data", app, key, value)
if Config.LocalData[app.."/"..key] then
self:SaveData()
end
end
function Device:SaveData()
if not self.kvp then
print("no kvp, cannot save data")
return
end
local data = {}
for app, appData in pairs(self.data) do
for key, value in pairs(appData) do
if Config.LocalData[app.."/"..key] then
local _appData = data[app]
if not _appData then
_appData = {}
data[app] = _appData
end
_appData[key] = value
end
end
end
local value = data and json.encode(data)
if not value then
print("deleting data", self.kvp)
DeleteResourceKvp(self.kvp)
return
end
print("saving data", self.kvp, value)
SetResourceKvp(self.kvp, value)
end
function Device:LoadData()
if not self.kvp then return end
local value = GetResourceKvpString(self.kvp)
print("loading data", self.kvp, value)
self.isLoaded = true
self.data = value and json.decode(value) or {}
end |
function handle_request()
local return_string = 'Hello from LUA handler';
local request = platform.get_http_request();
local form = request:parse_req_form();
local response = platform.get_http_response();
local addresses = platform.resolve_host_address('localhost', 'https');
response:set_chunked_trfencoding(true);
response:set_content_type("text/html");
response:send();
response:write('<html>\n');
response:write('<head>\n');
response:write('<title>EVLUA Form Server Sample</title>\n');
response:write('</head>\n');
response:write('<body>\n');
response:write('<h1>EVLUA Form Server Sample</h1>\n');
response:write('<h2>GET Form</h2>\n');
response:write('<form method=\"GET\" action=\"/formserver.lua/handle_request\">\n');
response:write('<input type=\"text\" name=\"text\" size=\"31\">\n');
response:write('<input type=\"submit\" value=\"GET\">\n');
response:write('</form>\n');
response:write('<h2>POST Form</h2>\n');
response:write('<form method=\"POST\" action=\"/formserver.lua/handle_request\">\n');
response:write('<input type=\"text\" name=\"text\" size=\"31\">\n');
response:write('<input type=\"submit\" value=\"POST\">\n');
response:write('</form>\n');
response:write('<h2>File Upload</h2>\n');
response:write('<form method=\"POST\" action=\"/formserver.lua/handle_request\" enctype=\"multipart/form-data\">\n');
response:write('<input type=\"file\" name=\"file\" size=\"31\"> \n');
response:write('<input type=\"submit\" value=\"Upload\">\n');
response:write('</form>\n');
response:write('<p>');
response:write('<br>\n');
response:write('<h2>Addresses from host resolution of "https://localhost"</h2><p>\n');
for i, v in ipairs(addresses) do
response:write('[<br>\n');
for j, w in pairs(v) do
response:write('        '..j..'='..w..'<br>\n');
end
response:write(']<br>\n');
end
response:write('</p>');
response:write('<h2>Request</h2><p>\n');
response:write('Method: '..request:get_method());
response:write('<br>\n');
response:write('URI: '..request:get_uri());
response:write('<br>\n');
local headers = request:get_hdr_fields();
for k,v in pairs(headers) do
response:write(string.format('%s : %s<br>\n', k, v));
end
response:write('</p>\n');
if (false == form:empty()) then
response:write('<h2>Form</h2><p>\n');
it, k, v = form:begin_iteration();
while (k ~= nil) do
response:write(k..': '..v..'<br>\n');
k, v = form:next_iteration(it);
end
response:write('</p>');
end
local parts = request:get_part_names();
for _, p in ipairs(parts) do
local part = request:get_part(p);
response:write('<h2>Upload</h2><p>\n');
response:write('Name: '..part['name']..'<br>\n');
response:write('File Name: '..p..'<br>\n');
response:write('Type: '..part['type']..'<br>\n');
response:write('Size: '..part['length']..'<br>\n');
response:write('<br>\n');
end
response:write('</p>');
response:write('</body>\n');
return ;
end
local arg = {...}
req_handler_func_name = arg[2];
local func = _G[req_handler_func_name];
return pcall(func); -- handle_request()
|
local config = require("lapis.config")
config("development", {
sqlitedb = 'app.db'
}) |
//Main function
function EFFECT:Init(data)
//Default performance settings
local DrawFlame = 1
local DrawSmoke = 1
local DrawRefraction = 0
//Adjust performance depending on user settings
local PerfIndex = GetConVar("flamethrower_fx"):GetInt()
if PerfIndex == 3 then DrawRefraction = 1 end
//Play impact sound
sound.Play("ambient/fire/ignite.wav", self:GetPos(), 54, math.random(82,112))
//Draw burst of flame
if DrawFlame == 1 then
//Create particle emmiter
local FlameEmitter = ParticleEmitter(data:GetOrigin())
//Amount of particles to create
for i=0, 16 do
//Safeguard
if !FlameEmitter then return end
//Pool of flame sprites
local FlameMat = {}
FlameMat[1] = "effects/muzzleflash2"
FlameMat[2] = "effects/muzzleflash2edit"
FlameMat[3] = "effects/muzzleflash3"
local FlameParticle = FlameEmitter:Add( FlameMat[math.random(1,3)], data:GetOrigin() )
//Refraction is too expensive to render on most machines
if DrawRefraction == 1 then
if math.random(1,12) == 12 then
FlameParticle = FlameEmitter:Add( "sprites/heatwave", data:GetOrigin() )
end
end
if (FlameParticle) then
FlameParticle:SetVelocity( VectorRand() * 172 )
FlameParticle:SetLifeTime(0)
FlameParticle:SetDieTime(0.72)
FlameParticle:SetStartAlpha(210)
FlameParticle:SetEndAlpha(0)
FlameParticle:SetStartSize(0)
FlameParticle:SetEndSize(64)
FlameParticle:SetRoll(math.Rand(-210, 210))
FlameParticle:SetRollDelta(math.Rand(-3.2, 3.2))
FlameParticle:SetAirResistance(350)
FlameParticle:SetGravity(Vector(0, 0, 64))
end
end
//We're done with this emmiter
FlameEmitter:Finish()
//Finished with flame
end
//Draw stream of smoke
if DrawSmoke == 1 then
//Create particle emmiter
local SmokeEmitter = ParticleEmitter(data:GetOrigin())
//Amount of particles to create
for i=0, 4 do
//Safeguard
if !SmokeEmitter then return end
SmokeParticle = SmokeEmitter:Add( "particle/smokesprites_000" .. math.random(1,8) .. "", data:GetOrigin() )
if (SmokeParticle) then
SmokeParticle:SetVelocity( VectorRand() * 210 )
SmokeParticle:SetLifeTime(0)
SmokeParticle:SetDieTime( math.Rand(1.92, 2.82) )
SmokeParticle:SetStartAlpha(82)
SmokeParticle:SetEndAlpha(0)
SmokeParticle:SetStartSize(21)
SmokeParticle:SetEndSize(82)
SmokeParticle:SetRoll(math.Rand(-320, 320))
SmokeParticle:SetRollDelta(math.Rand(-1.32, 1.32))
SmokeParticle:SetAirResistance(420)
SmokeParticle:SetGravity(Vector( 0, 0, math.random(112, 132) ))
SmokeParticle:SetLighting(1)
end
end
//We're done with this emmiter
SmokeEmitter:Finish()
//Finished with smoke
end
end
//Kill effect
function EFFECT:Think()
return false
end
//Unused
function EFFECT:Render()
end |
-- see elepower_papi >> external_nodes_items.lua for explanation
-- shorten table ref
local epr = ele.external.ref
local function get_formspec_default(power)
return "size[8,8.5]"..
epr.gui_bg..
epr.gui_bg_img..
epr.gui_slots..
ele.formspec.power_meter(power)..
"image[2,0.5;1,1;gui_furnace_arrow_bg.png^[transformR180]"..
"list[context;src;2,1.5;1,1;]"..
"image[5,0.5;1,1;gui_furnace_arrow_bg.png]"..
"list[context;dst;5,1.5;1,1;]"..
"list[current_player;main;0,4.25;8,1;]"..
"list[current_player;main;0,5.5;8,3;8]"..
"listring[current_player;main]"..
"listring[context;src]"..
"listring[current_player;main]"..
"listring[context;dst]"..
"listring[current_player;main]"..
epr.get_hotbar_bg(0, 4.25)
end
local function can_dig(pos, player)
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("dst") and inv:is_empty("src")
end
local function item_in_group(stack, grp)
return ele.helpers.get_item_group(stack:get_name(), grp)
end
function elepm.register_storage(nodename, nodedef)
local levels = nodedef.ele_levels or 8
local level_overlay = nodedef.ele_overlay or "elepower_power_level_"
if not nodedef.groups then
nodedef.groups = {}
end
nodedef.groups["ele_machine"] = 1
nodedef.groups["ele_storage"] = 1
nodedef.groups["tubedevice"] = 1
nodedef.groups["tubedevice_receiver"] = 1
nodedef.can_dig = can_dig
-- Allow for custom formspec
local get_formspec = get_formspec_default
if nodedef.get_formspec then
get_formspec = nodedef.get_formspec
nodedef.get_formspec = nil
end
nodedef.on_timer = function (pos, elapsed)
local meta = minetest.get_meta(pos)
local refresh = false
local capacity = ele.helpers.get_node_property(meta, pos, "capacity")
local storage = ele.helpers.get_node_property(meta, pos, "storage")
local percent = storage / capacity
local level = math.floor(percent * levels)
ele.helpers.swap_node(pos, nodename .. "_" .. level)
meta:set_string("formspec", get_formspec({capacity = capacity, storage = storage, usage = 0}))
meta:set_string("infotext", ("%s Active"):format(nodedef.description) .. "\n" ..
ele.capacity_text(capacity, storage))
local inv = meta:get_inventory()
-- Powercell to item
local itemcharge = inv:get_stack("src", 1)
local output = ele.helpers.get_node_property(meta, pos, "output")
if itemcharge and not itemcharge:is_empty() and item_in_group(itemcharge, "ele_tool") then
local crg = ele.tools.get_tool_property(itemcharge, "storage")
local cap = ele.tools.get_tool_property(itemcharge, "capacity")
local tmeta = itemcharge:get_meta()
local append = 0
if crg + output < cap then
append = output
else
if crg <= cap then
append = cap - crg
end
end
if storage > append and append ~= 0 then
crg = crg + append
storage = storage - append
refresh = true
end
tmeta:set_int("storage", crg)
itemcharge = ele.tools.update_tool_wear(itemcharge)
inv:set_stack("src", 1, itemcharge)
end
-- Item to powercell
local itemdischarge = inv:get_stack("dst", 1)
local inrush = ele.helpers.get_node_property(meta, pos, "inrush")
if itemdischarge and not itemdischarge:is_empty() and
(item_in_group(itemdischarge, "ele_tool") or item_in_group(itemdischarge, "ele_machine")) then
local crg = ele.tools.get_tool_property(itemdischarge, "storage")
local tmeta = itemdischarge:get_meta()
local discharge = 0
if crg >= inrush then
discharge = inrush
else
discharge = inrush - crg
end
if storage + discharge > capacity then
discharge = capacity - storage
end
if discharge <= crg and discharge ~= 0 then
crg = crg - discharge
storage = storage + discharge
refresh = true
end
tmeta:set_int("storage", crg)
itemdischarge = ele.tools.update_tool_wear(itemdischarge)
inv:set_stack("dst", 1, itemdischarge)
end
if refresh then
meta:set_int("storage", storage)
end
return refresh
end
nodedef.on_construct = function (pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("src", 1)
inv:set_size("dst", 1)
local capacity = ele.helpers.get_node_property(meta, pos, "capacity")
meta:set_string("formspec", get_formspec({ capacity = capacity, storage = 0, usage = 0 }))
end
for i = 0, levels do
local cpdef = table.copy(nodedef)
-- Add overlay to the tile texture
if cpdef.tiles and cpdef.tiles[6] and i > 0 then
cpdef.tiles[6] = cpdef.tiles[6] .. "^" .. level_overlay .. i ..".png"
end
if i > 0 then
cpdef.groups["not_in_creative_inventory"] = 1
end
ele.register_machine(nodename .. "_" .. i, cpdef)
end
end
|
package("bzip2")
set_homepage("https://en.wikipedia.org/wiki/Bzip2")
set_description("Freely available high-quality data compressor.")
set_urls("https://ftp.osuosl.org/pub/clfs/conglomeration/bzip2/bzip2-$(version).tar.gz",
"https://fossies.org/linux/misc/bzip2-$(version).tar.gz")
add_versions("1.0.6", "a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd")
on_load("windows", function (package)
package:addenv("PATH", "bin")
package:add("links", "libbz2")
end)
on_install("windows", function (package)
io.gsub("makefile.msc", "%-MD", "-" .. package:config("vs_runtime"))
os.vrunv("nmake", {"-f", "makefile.msc"})
os.cp("libbz2.lib", package:installdir("lib"))
os.cp("*.h", package:installdir("include"))
os.cp("*.exe", package:installdir("bin"))
end)
on_install("macosx", "linux", function (package)
os.vrunv("make", {"install", "PREFIX=" .. package:installdir()})
end)
on_test(function (package)
os.vrun("bzip2 --help")
assert(package:has_cfuncs("BZ2_bzCompressInit", {includes = "bzlib.h"}))
end)
|
local autopairs = require 'nvim-autopairs'
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
local cmp = require 'cmp'
local comment = require 'Comment'
local escape = require 'better_escape'
vim.g.did_load_filetypes = 1
comment.setup {
mappings = {
extended = true,
},
}
escape.setup {
mapping = { 'jj', 'jk' },
keys = '<Esc>',
timeout = 200,
}
autopairs.setup {
disable_filetype = { 'TelescopePrompt' },
fast_wrap = {},
}
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done { map_char = { tex = '' } })
|
Tiled_Levels = Core.class(Sprite)
function Tiled_Levels:init(xworld, xcamera, xtiledlevelpath)
self.world = xworld
-- load the tiled level
local tiledlevel = loadfile(xtiledlevelpath)()
-- the tiled map size
local tilewidth, tileheight = tiledlevel.tilewidth, tiledlevel.tileheight
local mapwidth, mapheight = tiledlevel.width * tilewidth, tiledlevel.height * tileheight
print("tile size "..tilewidth..", "..tileheight, "all in pixels.")
print("map size "..mapwidth..", "..mapheight, "app size "..myappwidth..", "..myappheight, "all in pixels.")
-- parse the tiled level
local layers = tiledlevel.layers
for i = 1, #layers do
local layer = layers[i]
-- GROUNDS
-- *******
if layer.name == "grounds" then -- your Tiled layer name here!
local levelsetup = {}
local objects = layer.objects
for i = 1, #objects do
local object = objects[i]
local mytable = nil, nil -- mytable = intermediate table for shapes params
-- *************
if object.name == "groundA" then
mytable = { texpath="textures/Grassy Way.jpg", sizey=0.1, texw=4*1024, texh=4*1024, r3dtype=r3d.Body.STATIC_BODY, }
elseif object.name == "groundB" then
mytable = { texpath="textures/Grassy Way.jpg", sizey=0.1, texw=4*1024, texh=4*1024, r3dtype=r3d.Body.STATIC_BODY, }
elseif object.name == "groundC" then
mytable = { texpath="textures/Grassy Way.jpg", sizey=0.1, texw=4*1024, texh=4*1024, r3dtype=r3d.Body.STATIC_BODY, }
elseif object.name == "groundD" then
mytable = { texpath="textures/Grassy Way.jpg", sizey=0.1, texw=4*1024, texh=4*1024, r3dtype=r3d.Body.STATIC_BODY, }
else
mytable = { texpath="textures/Grassy Way.jpg", texw=4*1024, texh=4*1024, r3dtype=r3d.Body.STATIC_BODY, }
end
if mytable then
levelsetup = {}
for k, v in pairs(mytable) do levelsetup[k] = v end
self:buildShapes(layer.name, object, levelsetup, "ground")
end
end
-- PLAYABLES
-- *********
elseif layer.name == "playables" then -- your Tiled layer name here!
local levelsetup = {}
local objects = layer.objects
for i = 1, #objects do
local object = objects[i]
local mytable = nil, nil -- mytable = intermediate table for shapes params
-- *************
if object.name == "player1" then
self.player1 = Player1.new(self.world, xcamera, {
posx=object.x, posz=object.y, mass=8,
})
end
end
-- WALLS
-- *********
elseif layer.name == "walls" then -- your Tiled layer name here!
local levelsetup = {}
local objects = layer.objects
for i = 1, #objects do
local object = objects[i]
local mytable = nil, nil -- mytable = intermediate table for shapes params
-- *************
if object.name == "wallA" then
local sx, sy
if object.width > object.height then sx, sy = 48, 6 -- 96. 16
else sx, sy = 6, 48
end
Box3D.new(self.world, {
posx=object.x, posz=object.y,
sizex=object.width, sizey=4, sizez=object.height,
texpath="textures/Alternating Mudbrick.jpg", texscalex=sx, texscaley=sy,
r3dtype=r3d.Body.STATIC_BODY,
})
elseif object.name == "wallB" then
local sx, sy
if object.width > object.height then sx, sy = 8, 1 -- 96. 16
else sx, sy = 1, 8
end
Box3D.new(self.world, {
posx=object.x, posz=object.y,
sizex=object.width, sizey=5, sizez=object.height,
texpath="textures/Weathered Stone Wall1024.jpg", texscalex=sx, texscaley=sy,
r3dtype=r3d.Body.STATIC_BODY,
})
end
end
-- SHAPES
-- *********
elseif layer.name == "shapes" then -- your Tiled layer name here!
local levelsetup = {}
local objects = layer.objects
for i = 1, #objects do
local object = objects[i]
local mytable = nil, nil -- mytable = intermediate table for shapes params
-- *************
if object.shape == "ellipse" then
if object.name == "d" then -- DYNAMIC_BODY
mytable = {
steps=24,
texpath="textures/Aurichalcite Deposit.jpg", texw=1*1024, texh=1*1024,
mass=0.1, r3dtype=r3d.Body.DYNAMIC_BODY,
}
else -- STATIC_BODY
if object.name == "x" then -- world atmosphere
mytable = {
steps=64, posy=-object.width/2.5,
texpath="textures/Cloudy Sky2048.jpg", texw=64*1024, texh=64*1024,
}
else
mytable = {
steps=32,
texpath="textures/Purple Crystal512.jpg", texw=2*1024, texh=2*1024,
r3dtype=r3d.Body.STATIC_BODY,
}
end
end
-- *************
elseif object.shape == "polygon" then
-- mytable = { texpath="textures/Grassy Way.jpg", texw=4*1024, texh=4*1024, r3dtype=r3d.Body.STATIC_BODY, }
-- *************
elseif object.shape == "rectangle" then
mytable = { texpath="textures/Grassy Way.jpg", sizey=8, texw=4*1024, texh=4*1024, r3dtype=r3d.Body.STATIC_BODY, }
end
if mytable then
levelsetup = {}
for k, v in pairs(mytable) do levelsetup[k] = v end
self:buildShapes(layer.name, object, levelsetup)
end
end
-- OBJS
-- *********
elseif layer.name == "objs" then -- your Tiled layer name here!
local levelsetup = {}
local objects = layer.objects
for i = 1, #objects do
local object = objects[i]
local mytable = nil, nil -- mytable = intermediate table for shapes params
-- *************
if object.name == "a8" then
--function Obj:init(xworld, xfolderpath, xobjname, xparams)
Obj.new(self.world, "models/obj/brazuca", "ball1.obj", {
posx=object.x, posz=object.y, mass=8,
r3dtype=r3d.Body.DYNAMIC_BODY,
r3dshape="sphere",
})
end
end
-- FBXS
-- *********
elseif layer.name == "fbxs" then -- your Tiled layer name here!
local levelsetup = {}
local objects = layer.objects
for i = 1, #objects do
local object = objects[i]
local mytable = nil, nil -- mytable = intermediate table for shapes params
-- *************
if object.name == "fbx01" then
Fbx.new(self.world, {
meshpath="models/fbx_json/monster01/DefeatedM.json",
texpath="models/fbx_json/monster01/bear_diffuse.png", slot=1,
posx=object.x, posz=object.y, roty=object.rotation,
r3dtype=r3d.Body.DYNAMIC_BODY,
mass=8,
})
elseif object.name == "fbx02" then
Fbx.new(self.world, {
meshpath="models/fbx_json/female/characterLargeFemale.json", meshscale=0.5,
texpath="models/fbx_json/female/fantasyFemaleB.png", slot=3,
posx=object.x, posz=object.y, roty=object.rotation,
r3dtype=r3d.Body.DYNAMIC_BODY,
mass=8,
})
end
end
-- WHAT?!
-- *************
else
print("WHAT?!", layer.name)
end
end
end
function Tiled_Levels:buildShapes(xlayer, xobject, xlevelsetup, xextras)
local myshape = nil
local tablebase = {}
-- ********************************
if xobject.shape == "ellipse" then
tablebase = {
posx=xobject.x, posz=xobject.y,
sizex=xobject.width, sizez=xobject.height, rotation=xobject.rotation,
}
for k, v in pairs(xlevelsetup) do tablebase[k] = v end
myshape = Sphere3D.new(self.world, tablebase)
-- ********************************
elseif xobject.shape == "polygon" then
tablebase = {
x=xobject.x, y=xobject.y,
coords=xobject.polygon, rotation=xobject.rotation,
}
for k, v in pairs(xlevelsetup) do tablebase[k] = v end
-- myshape = Tiled_Shape_Polygon.new(self.world, tablebase)
-- ********************************
elseif xobject.shape == "rectangle" then
tablebase = {
posx=xobject.x, posz=xobject.y,
sizex=xobject.width, sizez=xobject.height,
roty=xobject.rotation,
}
for k, v in pairs(xlevelsetup) do tablebase[k] = v end
if xextras == "ground" then
myshape = Plane3D.new(self.world, tablebase)
else
myshape = Box3D.new(self.world, tablebase)
end
else
print("*** CANNOT PROCESS THIS SHAPE! ***", xobject.shape, xobject.name)
end
myshape = nil
end
|
-- Navigation.lua
-- Contains all the command handlers in the navigation category
function HandleUpCommand(a_Split, a_Player)
-- /up
if #a_Split < 2 then
a_Player:SendMessage(cChatColor.Rose .. "Too few arguments.")
a_Player:SendMessage(cChatColor.Rose .. "/up <block>")
return true
elseif #a_Split > 2 then
a_Player:SendMessage(cChatColor.Rose .. "Too many arguments.")
a_Player:SendMessage(cChatColor.Rose .. "/up <block>")
return true
end
local Height = tonumber(a_Split[2])
if (Height == nil) then -- The given string isn't a number. bail out.
a_Player:SendMessage(cChatColor.Rose .. 'Number expected; string"' .. a_Split[2] .. '" given.')
return true
end
local P1 = a_Player:GetPosition():Floor()
local P2 = a_Player:GetPosition():Floor()
P2.y = P2.y + Height
local World = a_Player:GetWorld()
for Y = P1.y, P2.y + 1 do
if (World:GetBlock(P1.x, Y, P1.z) ~= E_BLOCK_AIR) then
a_Player:SendMessage(cChatColor.Rose .. "You would hit something above you.")
return true
end
end
local ChangeCuboid = cCuboid(P2, P2)
if (CallHook("OnAreaChanging", ChangeCuboid, a_Player, World, "up")) then
return true
end
World:SetBlock(P1.x, P2.y - 1, P1.z, E_BLOCK_GLASS, 0)
a_Player:TeleportToCoords(P1.x + 0.5, P2.y, P1.z + 0.5)
a_Player:SendMessage(cChatColor.LightPurple .. "Whoosh!")
CallHook("OnAreaChanged", ChangeCuboid, a_Player, World, "up")
return true
end
function HandleJumpToCommand(a_Split, a_Player)
-- /jumpto
-- /j
if (#a_Split ~= 1) then
a_Player:SendMessage(cChatColor.Rose .. "Too many arguments.")
a_Player:SendMessage(cChatColor.Rose .. "/jumpto")
return true
end
LeftClickCompass(a_Player, a_Player:GetWorld())
a_Player:SendMessage(cChatColor.LightPurple .. "Poof!!")
return true
end
function HandleThruCommand(Split, a_Player)
-- /thru
if (#Split ~= 1) then
a_Player:SendMessage(cChatColor.Rose .. "Too many arguments.")
a_Player:SendMessage(cChatColor.Rose .. "/thru")
return true
end
RightClickCompass(a_Player, a_Player:GetWorld())
a_Player:SendMessage(cChatColor.LightPurple .. "Whoosh!")
return true
end
function HandleDescendCommand(a_Split, a_Player)
-- /descend
-- /desc
local World = a_Player:GetWorld()
if a_Player:GetPosY() < 1 then
a_Player:SendMessage(cChatColor.LightPurple .. "Descended a level.")
return true
end
local FoundYCoordinate = false
local WentThroughBlock = false
local XPos = math.floor(a_Player:GetPosX())
local YPos = a_Player:GetPosY()
local ZPos = math.floor(a_Player:GetPosZ())
for Y = math.floor(YPos), 1, -1 do
if World:GetBlock(XPos, Y, ZPos) ~= E_BLOCK_AIR then
WentThroughBlock = true
else
if WentThroughBlock then
for y = Y, 1, -1 do
if cBlockInfo:IsSolid(World:GetBlock(XPos, y, ZPos)) then
YPos = y
FoundYCoordinate = true
break
end
end
if FoundYCoordinate then
break
end
end
end
end
if FoundYCoordinate then
a_Player:TeleportToCoords(a_Player:GetPosX(), YPos + 1, a_Player:GetPosZ())
end
a_Player:SendMessage(cChatColor.LightPurple .. "Descended a level.")
return true
end
function HandleAscendCommand(a_Split, a_Player)
-- /ascend
-- /asc
local World = a_Player:GetWorld()
local XPos = math.floor(a_Player:GetPosX())
local YPos = a_Player:GetPosY()
local ZPos = math.floor(a_Player:GetPosZ())
local IsValid, WorldHeight = World:TryGetHeight(XPos, ZPos)
if not IsValid then
a_Player:SendMessage(cChatColor.LightPurple .. "Ascended a level.")
return true
end
if a_Player:GetPosY() == WorldHeight then
a_Player:SendMessage(cChatColor.LightPurple .. "Ascended a level.")
return true
end
local WentThroughBlock = false
for Y = math.floor(a_Player:GetPosY()), WorldHeight + 1 do
if World:GetBlock(XPos, Y, ZPos) == E_BLOCK_AIR then
if WentThroughBlock then
YPos = Y
break
end
else
WentThroughBlock = true
end
end
if WentThroughBlock then
a_Player:TeleportToCoords(a_Player:GetPosX(), YPos, a_Player:GetPosZ())
end
a_Player:SendMessage(cChatColor.LightPurple .. "Ascended a level.")
return true
end
function HandleCeilCommand(a_Split, a_Player)
-- ceil <cleurance>
if (#a_Split > 2) then
a_Player:SendMessage(cChatColor.Rose .. "Too many arguments.")
a_Player:SendMessage(cChatColor.Rose .. "/ceil [cleurance]")
return true
end
local BlockFromCeil
if a_Split[2] == nil then
BlockFromCeil = 0
else
BlockFromCeil = tonumber(a_Split[2])
end
if BlockFromCeil == nil then
a_Player:SendMessage(cChatColor.Rose .. 'Number expected; string "' .. a_Split[2] .. '" given.')
return true
end
local World = a_Player:GetWorld()
local X = math.floor(a_Player:GetPosX())
local Y = math.floor(a_Player:GetPosY())
local Z = math.floor(a_Player:GetPosZ())
local IsValid, WorldHeight = World:TryGetHeight(X, Z)
if not IsValid then
a_Player:SendMessage(cChatColor.LightPurple .. "Whoosh!")
return true
end
if Y >= WorldHeight + 1 then
a_Player:SendMessage(cChatColor.Rose .. "No free spot above you found.")
return true
end
for y = Y, WorldHeight do
if World:GetBlock(X, y, Z) ~= E_BLOCK_AIR then
-- Check with other plugins if the operation is okay:
if not(CallHook("OnAreaChanging", cCuboid(X, y - BlockFromCeil - 3, Z), a_Player, a_Player:GetWorld(), "ceil")) then
World:SetBlock(X, y - BlockFromCeil - 3, Z, E_BLOCK_GLASS, 0)
CallHook("OnAreaChanged", cCuboid(X, y - BlockFromCeil - 3, Z), a_Player, a_Player:GetWorld(), "ceil")
end
local I = y - BlockFromCeil - 2
if I == Y then
a_Player:SendMessage(cChatColor.Rose .. "No free spot above you found.")
return true
end
a_Player:TeleportToCoords(X + 0.5, I, Z + 0.5)
break
end
end
a_Player:SendMessage(cChatColor.LightPurple .. "Whoosh!")
return true
end
|
local function tableContains(table, element)
for _, value in pairs(table) do
if value == element then
return true
end
end
return false
end
function class(constructor)
local namespace = {}
namespace.__index = namespace
namespace.new = function(...)
local outerSelf = self
-- aliases
local this = {}
self = this
-- metatable
setmetatable(this, namespace)
constructor(namespace)
-- constructor
if this.__construct then
this:__construct(unpack(arg))
end
-- finish
self = outerSelf -- used to allow constructors inside constructors
return this
end
return namespace
end
function classExtends(extend, constructor)
namespace = {}
namespace.__index = namespace
namespace.new = function(...)
local outerSelf = self
-- aliases
local this = extend.new()
self = this
-- metatable
-- setmetatable(this,namespace)
constructor(namespace)
-- copying statics
local notAllowedVarNames = {'__index', '__newindex'}
for varName, varValue in pairs(namespace) do
if not tableContains(notAllowedVarNames, varName) then
extend[varName] = varValue
end
end
for varName, varValue in pairs(extend) do
if not tableContains(notAllowedVarNames, varName) then
namespace[varName] = varValue
end
end
-- constructor
if this.__construct then
this:__construct(unpack(arg))
end
-- finish
self = outerSelf -- used to allow constructors inside constructors
return this
end
return namespace
end
abstractClass = class
-- how to
--[[
classname = class(function(static)
static.SOMETHING = false
function self:__construct(my_arguments)
self.something = my_arguments
end
function self:method()
print(this)
end
end) -- do not return
]]--
--Class_uniqueID_counter = 0
-- function Class(namespace,constructor)
-- namespace.__index = namespace
-- namespace.new = function(...)
-- local outerSelf = self -- used to allow constructors inside constructors
-- -- aliases
-- local this = {}
-- self = this
-- -- id counter
-- --Class_uniqueID_counter = Class_uniqueID_counter + 1
-- --this.uniqueID = Class_uniqueID_counter
-- -- finish
-- setmetatable(this,namespace)
-- constructor(unpack(arg))
-- self = outerSelf -- used to allow constructors inside constructors
-- return this
-- end
-- end
|
local function lol(gfx)
local items = newItemList()
items:add(newEItem('shroom',11,12,gfx))
items:add(newEItem('score',11,17,gfx))
items:add(newEItem('goal',11,5,gfx))
items:add(newEItem('spawn',9,4,gfx))
items:add(newEItem('score',10,1,gfx))
items:add(newEItem('score',6,17,gfx))
items:add(newEItem('score',17,17,gfx))
items:add(newEItem('score',26,11,gfx))
items:add(newEItem('shroom',23,11,gfx))
local decs = {}
decs[1] = {2, 18, 12}
decs[2] = {2, 5, 12}
decs[3] = {2, 7, 1}
decs[4] = {2, 13, 1}
decs[5] = {2, 23, 11}
decs[6] = {2, 22, 7}
decs[7] = {2, 30, 11}
decs[8] = {2, 27, 11}
decs[9] = {2, 13, 17}
decs[10] = {2, 13, 12}
local nmys = {}
local lvl = {}
lvl[1] = {}
lvl[2] = {}
lvl[3] = {}
lvl[4] = {}
lvl[4][12] = 1
lvl[4][13] = 4
lvl[4][14] = 4
lvl[4][15] = 4
lvl[4][16] = 7
lvl[5] = {}
lvl[5][12] = 2
lvl[5][13] = 5
lvl[5][14] = 5
lvl[5][15] = 5
lvl[5][16] = 8
lvl[6] = {}
lvl[6][1] = 1
lvl[6][2] = 4
lvl[6][3] = 4
lvl[6][4] = 4
lvl[6][5] = 4
lvl[6][6] = 4
lvl[6][7] = 7
lvl[6][12] = 2
lvl[6][13] = 5
lvl[6][14] = 5
lvl[6][15] = 5
lvl[6][16] = 8
lvl[7] = {}
lvl[7][1] = 2
lvl[7][2] = 5
lvl[7][3] = 5
lvl[7][4] = 5
lvl[7][5] = 5
lvl[7][6] = 5
lvl[7][7] = 8
lvl[7][12] = 2
lvl[7][13] = 5
lvl[7][14] = 5
lvl[7][15] = 5
lvl[7][16] = 8
lvl[8] = {}
lvl[8][1] = 2
lvl[8][2] = 5
lvl[8][3] = 86
lvl[8][4] = 6
lvl[8][5] = 26
lvl[8][6] = 5
lvl[8][7] = 8
lvl[8][12] = 2
lvl[8][13] = 5
lvl[8][14] = 5
lvl[8][15] = 5
lvl[8][16] = 84
lvl[8][17] = 4
lvl[8][18] = 4
lvl[8][19] = 7
lvl[9] = {}
lvl[9][1] = 2
lvl[9][2] = 5
lvl[9][3] = 8
lvl[9][5] = 2
lvl[9][6] = 5
lvl[9][7] = 8
lvl[9][12] = 2
lvl[9][13] = 5
lvl[9][14] = 5
lvl[9][15] = 5
lvl[9][16] = 5
lvl[9][17] = 5
lvl[9][18] = 5
lvl[9][19] = 8
lvl[10] = {}
lvl[10][1] = 2
lvl[10][2] = 5
lvl[10][3] = 8
lvl[10][5] = 2
lvl[10][6] = 5
lvl[10][7] = 8
lvl[10][12] = 2
lvl[10][13] = 5
lvl[10][14] = 5
lvl[10][15] = 5
lvl[10][16] = 68
lvl[10][17] = 62
lvl[10][18] = 5
lvl[10][19] = 8
lvl[11] = {}
lvl[11][1] = 2
lvl[11][2] = 5
lvl[11][3] = 8
lvl[11][5] = 2
lvl[11][6] = 5
lvl[11][7] = 8
lvl[11][12] = 2
lvl[11][13] = 5
lvl[11][14] = 5
lvl[11][15] = 5
lvl[11][16] = 8
lvl[11][17] = 2
lvl[11][18] = 5
lvl[11][19] = 8
lvl[12] = {}
lvl[12][1] = 2
lvl[12][2] = 5
lvl[12][3] = 48
lvl[12][4] = 4
lvl[12][5] = 24
lvl[12][6] = 5
lvl[12][7] = 8
lvl[12][12] = 2
lvl[12][13] = 5
lvl[12][14] = 5
lvl[12][15] = 5
lvl[12][16] = 8
lvl[12][17] = 2
lvl[12][18] = 5
lvl[12][19] = 8
lvl[13] = {}
lvl[13][1] = 2
lvl[13][2] = 5
lvl[13][3] = 5
lvl[13][4] = 5
lvl[13][5] = 5
lvl[13][6] = 5
lvl[13][7] = 8
lvl[13][12] = 2
lvl[13][13] = 5
lvl[13][14] = 5
lvl[13][15] = 5
lvl[13][16] = 84
lvl[13][17] = 42
lvl[13][18] = 5
lvl[13][19] = 8
lvl[14] = {}
lvl[14][1] = 3
lvl[14][2] = 6
lvl[14][3] = 6
lvl[14][4] = 6
lvl[14][5] = 6
lvl[14][6] = 6
lvl[14][7] = 9
lvl[14][12] = 2
lvl[14][13] = 5
lvl[14][14] = 5
lvl[14][15] = 5
lvl[14][16] = 5
lvl[14][17] = 5
lvl[14][18] = 5
lvl[14][19] = 8
lvl[15] = {}
lvl[15][12] = 2
lvl[15][13] = 5
lvl[15][14] = 5
lvl[15][15] = 5
lvl[15][16] = 86
lvl[15][17] = 6
lvl[15][18] = 6
lvl[15][19] = 9
lvl[16] = {}
lvl[16][12] = 2
lvl[16][13] = 5
lvl[16][14] = 5
lvl[16][15] = 5
lvl[16][16] = 8
lvl[17] = {}
lvl[17][12] = 2
lvl[17][13] = 5
lvl[17][14] = 5
lvl[17][15] = 5
lvl[17][16] = 8
lvl[18] = {}
lvl[18][12] = 2
lvl[18][13] = 5
lvl[18][14] = 5
lvl[18][15] = 5
lvl[18][16] = 8
lvl[19] = {}
lvl[19][12] = 3
lvl[19][13] = 6
lvl[19][14] = 6
lvl[19][15] = 6
lvl[19][16] = 9
lvl[20] = {}
lvl[21] = {}
lvl[21][7] = 1
lvl[21][8] = 4
lvl[21][9] = 7
lvl[22] = {}
lvl[22][7] = 2
lvl[22][8] = 5
lvl[22][9] = 8
lvl[22][11] = 1
lvl[22][12] = 4
lvl[22][13] = 47
lvl[22][14] = 4
lvl[22][15] = 7
lvl[23] = {}
lvl[23][7] = 3
lvl[23][8] = 6
lvl[23][9] = 9
lvl[23][11] = 2
lvl[23][12] = 5
lvl[23][13] = 5
lvl[23][14] = 5
lvl[23][15] = 8
lvl[24] = {}
lvl[24][11] = 2
lvl[24][12] = 5
lvl[24][13] = 5
lvl[24][14] = 5
lvl[24][15] = 89
lvl[25] = {}
lvl[25][11] = 2
lvl[25][12] = 5
lvl[25][13] = 5
lvl[25][14] = 5
lvl[25][15] = 89
lvl[26] = {}
lvl[26][11] = 2
lvl[26][12] = 5
lvl[26][13] = 5
lvl[26][14] = 5
lvl[26][15] = 89
lvl[27] = {}
lvl[27][11] = 2
lvl[27][12] = 5
lvl[27][13] = 5
lvl[27][14] = 5
lvl[27][15] = 89
lvl[28] = {}
lvl[28][11] = 2
lvl[28][12] = 5
lvl[28][13] = 5
lvl[28][14] = 5
lvl[28][15] = 89
lvl[29] = {}
lvl[29][11] = 2
lvl[29][12] = 5
lvl[29][13] = 5
lvl[29][14] = 5
lvl[29][15] = 89
lvl[30] = {}
lvl[30][11] = 2
lvl[30][12] = 5
lvl[30][13] = 5
lvl[30][14] = 5
lvl[30][15] = 8
lvl[31] = {}
lvl[31][11] = 3
lvl[31][12] = 6
lvl[31][13] = 69
lvl[31][14] = 6
lvl[31][15] = 9
lvl[32] = {}
lvl[33] = {}
lvl[34] = {}
lvl[35] = {}
lvl[36] = {}
lvl[37] = {}
lvl[38] = {}
lvl[39] = {}
lvl[40] = {}
lvl[41] = {}
lvl[42] = {}
lvl[43] = {}
lvl[44] = {}
lvl[45] = {}
lvl[46] = {}
lvl[47] = {}
lvl[48] = {}
lvl[49] = {}
lvl[50] = {}
lvl[51] = {}
lvl[52] = {}
lvl[53] = {}
lvl[54] = {}
lvl[55] = {}
lvl[56] = {}
lvl[57] = {}
lvl[58] = {}
lvl[59] = {}
lvl[60] = {}
lvl[61] = {}
lvl[62] = {}
lvl[63] = {}
lvl[64] = {}
lvl[65] = {}
lvl[66] = {}
lvl[67] = {}
lvl[68] = {}
lvl[69] = {}
lvl[70] = {}
lvl[71] = {}
lvl[72] = {}
lvl[73] = {}
lvl[74] = {}
lvl[75] = {}
lvl[76] = {}
lvl[77] = {}
lvl[78] = {}
lvl[79] = {}
lvl[80] = {}
lvl[81] = {}
lvl[82] = {}
lvl[83] = {}
lvl[84] = {}
lvl[85] = {}
lvl[86] = {}
lvl[87] = {}
lvl[88] = {}
lvl[89] = {}
lvl[90] = {}
lvl[91] = {}
lvl[92] = {}
lvl[93] = {}
lvl[94] = {}
lvl[95] = {}
lvl[96] = {}
lvl[97] = {}
lvl[98] = {}
lvl[99] = {}
lvl[100] = {}
return lvl,items,decs,nmys
end
return lol |
local exec
exec = require("libs.cfglib").exec
local insert, remove
do
local _obj_0 = table
insert, remove = _obj_0.insert, _obj_0.remove
end
local MessageQueue
MessageQueue = {
queue = { },
maxwait = 20,
message_delta = 5,
last_sayed = 0,
addMessage = function(message, importance)
print(message, importance)
local time = os.time()
MessageQueue.last_sayed = MessageQueue.last_sayed or time - MessageQueue.maxwait
if importance == 0 then
if time - MessageQueue.last_sayed < MessageQueue.message_delta then
return
end
MessageQueue.last_sayed = time
return exec("say " .. message)
else
return insert(MessageQueue.queue, {
message = message,
time = time,
importance = importance
})
end
end,
cleanupQueue = function()
local queue, maxwait, last_sayed
queue, maxwait, last_sayed = MessageQueue.queue, MessageQueue.maxwait, MessageQueue.last_sayed
local time = os.time()
for i = #queue, 1, -1 do
if (queue[i].importance > 1) and (queue[i].maxwait < time - last_sayed) then
remove(queue, i)
end
end
end,
processQueue = function()
local time = os.time()
if time - MessageQueue.last_sayed < MessageQueue.message_delta then
return
end
MessageQueue.cleanupQueue()
local queue
queue = MessageQueue.queue
for i = 1, #queue do
local msg = queue[i]
print("msg: ", msg.message)
if msg.time < time - MessageQueue.message_delta then
exec("say " .. msg.message)
MessageQueue.last_sayed = time
break
end
end
end
}
return MessageQueue
|
-----------------------------------
-- Area: North Gustaberg [S]
-- NPC: Lycopodium
-- !pos -275.953 12.333 262.368 88
-----------------------------------
local ID = require("scripts/zones/Garlaige_Citadel_[S]/IDs")
require("scripts/globals/npc_util")
-----------------------------------
function onTrade(player, npc, trade)
end
function onTrigger(player, npc)
if player:getMaskBit(player:getCharVar("LycopodiumTeleport_Mask"),2) then
player:messageSpecial(ID.text.LYCOPODIUM_ENTRANCED)
else
player:messageSpecial(ID.text.LYCOPODIUM_ENTRANCED)
player:startEvent(113)
end
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
if csid == 113 then
player:setMaskBit(player:getCharVar("LycopodiumTeleport_Mask"), "LycopodiumTeleport_Mask", 2, true)
end
end |
local AddonName, AddonTable = ...
-- Well of Eternity (Heroic)
AddonTable.well = {
-- Peroth'arn
72832,
72831,
72830,
72827,
72829,
72828,
-- Queen Azshara
72835,
72833,
72838,
72836,
72834,
72837,
-- Mannoroth <The Destructor> / Captain Varo'then <The Hand of Azshara>
72898,
72844,
72839,
72845,
72841,
72848,
72846,
72899,
72843,
72847,
72840,
72842,
}
|
local ips =
{
"208.110.69.200", -- yamaha
"92.83.114.235", -- yamaha 2
"109.96.*.*", -- yamaha rangeban
"92.83.*.*", -- yamaha rangeban 2
"68.119.201.191", -- matthew ello
"68.119.192.184", -- matthew ello 2
"68.119.192.161", -- matthew ello 3
"68.119.*.*", -- matthew ello rangeban
"173.168.242.143", -- 2dope
"173.168.*.*", -- 2dope rangeban 1
"74.115.*.*", -- 2dope rangeban 2
"74.115.0.*.*", -- 2dope rangeban 3
"173.168.*.*", -- 2dope rangeban 4
"62.163.148.45", -- Jesseunit
"62.163.*.*" -- Jesseunit rangeban
}
local serials =
{
"7DF09B4B3D2D729FCF69C9E7C348A4E4", -- matthew ello
"401F3B7508DD40F71FB5E35EF8538702", -- 2Dope comp 1
"14FE9A27983EB2D63C47060CE8E33C62", -- 2Dope comp 2
"2B4C10CB63D29C22C2AF2519AD10FB52" -- Jesseunit's PC
}
addEventHandler ("onPlayerConnect", getRootElement(),
function(playerNick, playerIP, playerUsername, playerSerial, playerVersion)
for _, v in pairs(ips ) do
if string.find( playerIP, "^" .. v .. "$" ) then
cancelEvent( true, "You are banned from this server." )
end
end
for _, v in pairs( serials ) do
if (playerSerial == v) then
outputDebugString("found ".. v)
cancelEvent( true, "You are banned from this server." )
end
end
end
) |
--[[
Title: VersionNotice
Author(s): big
CreateDate: 2020.01.14
ModifyDate: 2021.11.15
place: Foshan
Desc:
use the lib:
------------------------------------------------------------
local VipNotice = NPL.load('(gl)Mod/WorldShare/cellar/VipNotice/VipNotice.lua')
------------------------------------------------------------
]]
-- service
local KeepworkService = NPL.load('(gl)Mod/WorldShare/service/KeepworkService.lua')
local KeepworkServiceSession = NPL.load('(gl)Mod/WorldShare/service/KeepworkService/Session.lua')
--lib
local QREncode = NPL.load('(gl)script/apps/Aries/Creator/Game/Movie/QREncode.lua')
local VipNotice = NPL.export()
local page
function VipNotice:InitUI()
page = document:GetPageCtrl();
end
function VipNotice:ShowPage(key, desc)
local width = 784
local height = 536
self.key = key
self.desc = desc
Mod.WorldShare.Utils.ShowWindow(width, height, 'Mod/WorldShare/cellar/VipNotice/VipNotice.html', 'VipNotice', width, height ,'_ct', true, 1)
VipNotice:InitQRCode()
GameLogic.GetFilters():apply_filters('user_behavior', 1, 'click.vip.funnel.open', { from = key })
end
function VipNotice:Close()
if page then
page:CloseWindow()
end
end
function VipNotice:GetQRCodeUrl()
local userid = Mod.WorldShare.Store:Get('user/userId')
local qrcode_url;
if(userid) then
qrcode_url = string.format('%s/p/qr/purchase?userId=%s&from=%s',KeepworkService:GetKeepworkUrl(), userid, self.key);
else
qrcode_url = string.format('%s/p/qr/buyFor?from=%s',KeepworkService:GetKeepworkUrl(), self.key);
end
return qrcode_url
end
function VipNotice:InitQRCode()
local parent = page:GetParentUIObject()
local ret,qrcode = QREncode.qrcode(VipNotice:GetQRCodeUrl())
if ret then
local qrcode_width = 118
local qrcode_height = 118
local block_size = qrcode_width / #qrcode
local qrcode_ui = ParaUI.CreateUIObject('container', 'qrcode_vipnotice', '_lt', 70, 70, qrcode_width, qrcode_height);
qrcode_ui:SetField('OwnerDraw', true); -- enable owner draw paint event
qrcode_ui:SetField('SelfPaint', true);
qrcode_ui:SetScript('ondraw', function(test)
for i = 1, #(qrcode) do
for j = 1, #(qrcode[i]) do
local code = qrcode[i][j];
if (code < 0) then
ParaPainter.SetPen('#000000ff');
ParaPainter.DrawRect((i-1) * block_size, (j-1) * block_size, block_size, block_size);
end
end
end
end);
parent:AddChild(qrcode_ui);
end
end
function VipNotice:GetTypeName()
return self.desc
end
function VipNotice.OnClickBuy()
local url = VipNotice:GetQRCodeUrl()
if System.os.IsTouchMode() then
VipNotice:Close()
local weixinUrl = 'weixin://dl/business/?t=ZbXsre0lSAf'
GameLogic.RunCommand(string.format('/open -e %s',weixinUrl))
else
ParaGlobal.ShellExecute('open',url, '','', 1);
end
end
function VipNotice.OnClickInput()
VipNotice:Close()
local VipCodeExchange = NPL.load('(gl)script/apps/Aries/Creator/Game/Tasks/VipToolTip/VipCodeExchange.lua')
VipCodeExchange.ShowView()
end |
local mock = require "deftest.mock"
local M = {}
M.ids = nil
function M.mock()
M.ids = {}
mock.mock(factory)
factory.create.replace(function(url, pos, ...)
local id = factory.create.original(url, pos, ...)
table.insert(M.ids, { url = url, pos = pos, id = id })
return id
end)
end
function M.unmock()
mock.unmock(factory)
for _,data in ipairs(M.ids) do
go.delete(data.id)
end
M.ids = nil
end
return M
|
local Table = require'Table'
local setmetatable, next, select = setmetatable, next, select
local Generator = {}
local GeneratorMt = {__index = Generator}
function Generator:apply( f, arg )
self[#self+1] = f
self[#self+1] = arg
return self
end
local function domap( g, ... )
return true, g( ... )
end
function Generator:map( f )
return self:apply( domap, f )
end
local function dofilter( pred, ... )
if pred( ... ) then
return true, ...
else
return false
end
end
function Generator:filter( p )
return self:apply( dofilter, p )
end
local function dozip( frm, k, v, ... )
if frm <= 1 then return true, {k, v, ...}
elseif frm <= 2 then return true, k, {v, ...}
elseif frm <= 3 then return true, k, v, {...}
else
local allargs = {...}
allargs[frm+1] = {select( frm, ... )}
allargs[frm+2] = nil
return true, unpack( allargs )
end
end
function Generator:zip( from )
return self:apply( dozip, from or 1 )
end
local function doswap( _, x, y, ... )
return true, y, x, ...
end
function Generator:swap()
return self:apply( doswap, false )
end
local function dodup( _, x, ... )
return true, x, x, ...
end
function Generator:dup()
return self:apply( dodup, false )
end
local function dounique( cache, k, ... )
if not cache[k] then
cache[k] = true
return true, k, ...
else
return false
end
end
function Generator:unique()
return self:apply( dounique, {} )
end
local function dowithindex( i, ... )
local index = i[1]
i[1] = index + i[2]
return true, index, ...
end
function Generator:withindex( init, step )
return self:apply( dowithindex, {init or 1, step or 1} )
end
local function dotake( m, ... )
if m[1] < m[2] then
m[1] = m[1] + 1
return true, ...
end
end
function Generator:take( n )
return self:apply( dotake, {0, n} )
end
local function dotakewhile( pred, ... )
if pred( ... ) then
return true, ...
end
end
function Generator:takewhile( p )
return self:apply( dotakewhile, p )
end
local function dodrop( m, ... )
if m[1] < m[2] then
m[1] = m[1] + 1
return false
else
return true, ...
end
end
function Generator:drop( n )
return self:apply( dodrop, {0,n} )
end
local function dodropwhile( pred, ... )
if pred[2] and pred[1]( ... ) then
return false
else
pred[2] = false
return true, ...
end
end
function Generator:dropwhile( p )
return self:apply( dodropwhile, {p,true} )
end
local function doupdate( tbl, k, v, ... )
if tbl[k] then
return true, k, tbl[k], ...
else
return true, k, v, ...
end
end
function Generator:update( self, utable )
return self:apply( doupdate, utable )
end
local function dodelete( tbl, k, ... )
if not tbl[k] then
return true, k, ...
else
return false
end
end
function Generator:delete( dtable )
return self:apply( dodelete, dtable )
end
local function doeach( status, ... )
if status then
f( ... )
return doeach( self:next())
elseif status == false then
return doeach( self:next())
end
end
function Generator:each( f )
return doeach( self:next())
end
local function doreduce( self, f, accum, status, ... )
if status then
return doreduce( self, f, f(accum, ...), self:next())
elseif status == false then
return doreduce( self, f, accum, self:next())
else
return accum
end
end
function Generator:reduce( f, acc )
return doreduce( self, f, acc, self:next())
end
local function tablefold( acc, k, v )
acc[k] = v
return acc
end
function Generator:table()
return Table( self:reduce( tablefold, {} ))
end
local function arrayfold( acc, v )
acc[#acc+1] = v
return acc
end
function Generator:array()
return Table( self:reduce( arrayfold, {} ))
end
local function dosum( accum, status, ... )
if status then
return dosum( accum + ..., self:next())
elseif status == false then
return dosum( accum, self:next())
else
return accum
end
end
function Generator:sum( acc )
return dosum( acc or 0, self:next())
end
local function docount( acc, status, ... )
if status == nil then
return acc
elseif status and (p == nil or p(...)) then
return docount( acc + 1, self:next())
else
return docount( acc, self:next())
end
end
function Generator:count( p )
return docount( 0, self:next())
end
function Generator:next()
return self[1]( self )
end
local function reccall( self, i, status, ... )
if status then
if self[i] then
return reccall( self, i+2, self[i]( self[i+1], ... ))
else
return status, ...
end
else
return status
end
end
local Stream = {}
local function evalrangeargs( init, limit, step )
if not limit then init, limit = init > 0 and 1 or -1, init end
if not step then step = init < limit and 1 or -1 end
if (init <= limit and step > 0) or (init >= limit and step < 0) then
return init, limit, step
else
error('bad initial variables for range')
end
end
local function rangenext( self )
local index = self[2]
if index <= self[3] then
self[2] = index + self[4]
return reccall( self, 5, true, index )
end
end
local function rrangenext( self )
local index = self[2]
if index >= self[3] then
self[2] = index + self[4]
return reccall( self, 5, true, index )
end
end
function Stream.range( init, limit, step )
init, limit, step = evalrangeargs( init, limit, step )
return setmetatable( {step > 0 and rangenext or rrangenext, init, limit, step}, GeneratorMt )
end
local function evalsubargs( tbl, init, limit, step )
local len = #tbl
init, limit = init or 1, limit or len
if init < 0 then init = len + init + 1 end
if limit < 0 then limit = len + init + 1 end
if not step then step = init < limit and 1 or -1 end
if (init <= limit and step > 0) or (init >= limit and step < 0) then
return init, limit, step
else
error('bad initial variables for generator')
end
end
local function iternext( self )
local index = self[3]
local value = self[2][index]
if value ~= nil and index <= self[4] then
self[3] = index + self[5]
return reccall( self, 6, true, value )
end
end
local function riternext( self )
local index = self[3]
local value = self[2][index]
if value ~= nil and index >= self[4] then
self[3] = index + self[5]
return reccall( self, 6, true, value )
end
end
function Stream.iter( tbl, init, limit, step )
init, limit, step = evalsubargs( tbl, init, limit, step )
return setmetatable( {step > 0 and iternext or riternext, tbl, init, limit, step}, GeneratorMt )
end
local function ipairsnext( self )
local index = self[3]
local value = self[2][index]
if value ~= nil and index <= self[4] then
self[3] = index + self[5]
return reccall( self, 6, true, index, value )
end
end
local function ripairsnext( self )
local index = self[3]
local value = self[2][index]
if value ~= nil and index >= self[4] then
self[3] = index + self[5]
return reccall( self, 6, true, index, value )
end
end
function Stream.ipairs( tbl, init, limit, step )
init, limit, step = evalsubargs( tbl, init, limit, step )
return setmetatable( {step > 0 and ipairsnext or ripairsnext, tbl, init, limit, step}, GeneratorMt )
end
local function pairsnext( self )
local key, value = next( self[2], self.k )
if key ~= nil then
self.k = key
return reccall( self, 3, true, key, value )
end
end
function Stream.pairs( tbl )
return setmetatable( {pairsnext, tbl}, GeneratorMt )
end
local function keysnext( self )
local key, _ = next( self[2], self.k )
if key ~= nil then
self.k = key
return reccall( self, 3, true, key )
end
end
function Stream.keys( tbl )
return setmetatable( {keysnext, tbl}, GeneratorMt )
end
local function valuesnext( self )
local key, value = next( self[2], self.k )
if key ~= nil then
self.k = key
return reccall( self, 3, true, value )
end
end
function Stream.values( tbl )
return setmetatable( {valuesnext, tbl}, GeneratorMt )
end
return Stream
|
--
local M = {}
local ffi = require('ffi')
function M.loadFileString(path)
local f = io.open(path, 'rb')
local s = f:read('a')
f:close()
return s
end
--
local kernel32 = ffi.load('kernel32.dll')
local CP_ACP = 0 -- default to ANSI code page
local CP_THREAD_ACP = 3 -- current thread's ANSI code page
local CP_UTF8 = 65001
ffi.cdef [[
int MultiByteToWideChar(
unsigned int CodePage,
unsigned long dwFlags,
const char* lpMultiByteStr,
int cbMultiByte,
wchar_t* lpWideCharStr,
int cchWideChar);
int WideCharToMultiByte(
unsigned int CodePage,
unsigned long dwFlags,
const wchar_t* lpWideCharStr,
int cchWideChar,
char* lpMultiByteStr,
int cbMultiByte,
const char* lpDefaultChar,
long* lpUsedDefaultChar);
int SetCurrentDirectoryW(const wchar_t* lpPathName);
int GetCurrentDirectoryW(int nBufferLength, wchar_t* lpPathName);
void Sleep(int ms);
]]
function M.toWideChar(src, bytes)
bytes = bytes or #src
if bytes == 0 then
return nil
end
local needed = kernel32.MultiByteToWideChar(CP_UTF8, 0, src, bytes, nil, 0)
if needed <= 0 then
error("MultiByteToWideChar")
end
local buffer = ffi.new("wchar_t[?]", needed + 1)
local count = kernel32.MultiByteToWideChar(CP_UTF8, 0, src, bytes, buffer, needed)
buffer[count] = 0
return buffer
end
function M.fromWideChar(src, bytes)
bytes = bytes or ffi.sizeof(src)
if bytes == 0 then
return nil
end
local needed = kernel32.WideCharToMultiByte(CP_UTF8, 0, src, -1, nil, 0, nil, nil)
if needed <= 0 then
error("WideCharToMultiByte")
end
local buffer = ffi.new("uint8_t[?]", needed + 1)
local count = kernel32.WideCharToMultiByte(CP_UTF8, 0, src, -1, buffer, needed, nil, nil)
buffer[count] = 0
return ffi.string(buffer, count - 1)
end
--
function M.sleep(ms)
ffi.C.Sleep(ms)
end
local insert = table.insert
---@param s string
---@param sep string
function M.stringSplit(s, sep)
local ret = {}
if not sep or sep == '' then
local len = #s
for i = 1, len do
insert(ret, s:sub(i, i))
end
else
while true do
local p = string.find(s, sep)
if not p then
insert(ret, s)
break
end
local ss = s:sub(1, p - 1)
insert(ret, ss)
s = s:sub(p + 1, #s)
end
end
return ret
end
function M.stringTrim(s)
s = string.gsub(s, "^[ \t\n\r]+", "")
return string.gsub(s, "[ \t\n\r]+$", "")
end
function M.setCurrentDirectory(path)
path = M.toWideChar(path)
return kernel32.SetCurrentDirectoryW(path)
end
function M.getCurrentDirectory()
local buffer = ffi.new('wchar_t[260]')
local ret = kernel32.GetCurrentDirectoryW(260, buffer)
if ret == 0 then
return nil
end
return M.fromWideChar(buffer)
end
return M
|
data.raw["gui-style"].default["teleportation_thin_flow"] = {
type = "flow_style",
horizontal_spacing = 0,
vertical_spacing = 0,
max_on_row = 0,
resize_row_to_width = true,
}
data.raw["gui-style"].default["teleportation_button_flow"] = {
type = "flow_style",
--parent="flow_style",
horizontal_spacing=1,
}
data.raw["gui-style"].default["teleportation_thin_frame"] = {
type = "frame_style",
--parent="frame_style",
top_padding = 2,
bottom_padding = 2,
}
data.raw["gui-style"].default["teleportation_label_style"] = {
type = "label_style",
font = "default",
font_color = {r=1, g=1, b=1},
top_padding = 7,
bottom_padding = 0,
}
data.raw["gui-style"].default["teleportation_button_style"] = {
type = "button_style",
--parent = "button_style",
top_padding = 1,
right_padding = 5,
bottom_padding = 1,
left_padding = 5,
left_click_sound =
{
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
}
data.raw["gui-style"].default["teleportation_main_button_style"] = {
type = "button_style",
--parent = "button_style",
width = 32,
height = 32,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 48,
height = 48,
x = 64,
y = 96,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 48,
height = 48,
x = 112,
y = 96,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 48,
height = 48,
x = 112,
y = 96,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_button_style_teleport"] = {
type = "button_style",
--parent = "button_style",
width = 32,
height = 32,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 0,
y = 0,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 0,
y = 32,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 32,
height = 32,
x = 0,
y = 64,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_button_style_edit"] = {
type = "button_style",
--parent = "button_style",
width = 32,
height = 32,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 32,
y = 0,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 32,
y = 32,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 32,
height = 32,
x = 32,
y = 64,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_button_style_globus"] = {
type = "button_style",
--parent = "button_style",
width = 32,
height = 32,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 64,
y = 0,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 64,
y = 32,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 32,
height = 32,
x = 64,
y = 64,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_button_style_sort_alphabet"] = {
type = "button_style",
--parent = "button_style",
width = 32,
height = 32,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 96,
y = 0,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 96,
y = 32,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 32,
height = 32,
x = 96,
y = 64,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_button_style_sort_from_player"] = {
type = "button_style",
--parent = "button_style",
width = 32,
height = 32,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 128,
y = 0,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 128,
y = 32,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 32,
height = 32,
x = 128,
y = 64,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_button_style_sort_from_start"] = {
type = "button_style",
--parent = "button_style",
width = 32,
height = 32,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 160,
y = 0,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 160,
y = 32,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 32,
height = 32,
x = 160,
y = 64,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_button_style_arrow_left"] = {
type = "button_style",
--parent = "button_style",
width = 16,
height = 32,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 16,
height = 32,
x = 192,
y = 0,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 16,
height = 32,
x = 192,
y = 32,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 16,
height = 32,
x = 192,
y = 64,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_button_style_arrow_right"] = {
type = "button_style",
--parent = "button_style",
width = 16,
height = 32,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 16,
height = 32,
x = 208,
y = 0,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 16,
height = 32,
x = 208,
y = 32,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 16,
height = 32,
x = 208,
y = 64,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_button_style_arrow_up"] = {
type = "button_style",
--parent = "button_style",
width = 32,
height = 16,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 16,
x = 0,
y = 96,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 16,
x = 0,
y = 112,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 32,
height = 16,
x = 0,
y = 128,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_button_style_arrow_down"] = {
type = "button_style",
--parent = "button_style",
width = 32,
height = 16,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 16,
x = 32,
y = 96,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 16,
x = 32,
y = 112,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 32,
height = 16,
x = 32,
y = 128,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_button_style_link_small"] = {
type = "button_style",
--parent = "button_style",
width = 32,
height = 16,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 16,
x = 160,
y = 96,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 16,
x = 160,
y = 112,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 32,
height = 16,
x = 160,
y = 128,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_button_style_cancel_link"] = {
type = "button_style",
--parent = "button_style",
width = 32,
height = 32,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 224,
y = 0,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 32,
x = 224,
y = 32,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 32,
height = 32,
x = 224,
y = 64,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_sprite_style_done_small"] = {
type = "button_style",
--parent = "button_style",
width = 32,
height = 16,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
font = "default",---button",
default_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 16,
x = 192,
y = 96,
},
hovered_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
priority = "extra-high-no-scale",
width = 32,
height = 16,
x = 192,
y = 96,
},
clicked_graphical_set =
{
filename = "__Teleportation_Redux__/graphics/buttons.png",
width = 32,
height = 16,
x = 192,
y = 96,
},
left_click_sound =
{
filename = "__core__/sound/gui-click.ogg",
volume = 1
}
}
data.raw["gui-style"].default["teleportation_textbox"] = {
type = "textbox_style",
--parent = "textfield_style",
minimal_width = 300,
maximal_width = 300,
}
|
local status_ok, npairs = pcall(require, "nvim-autopairs")
if not status_ok then
return
end
npairs.setup({
fast_wrap = {
map = "<M-e>",
chars = { "{", "[", "(", '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
offset = -1, -- Offset from pattern match
end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true,
highlight = "Search",
highlight_grey = "Comment",
},
})
|
_PARSER = {
}
local P, C, V, Cc, Ct = m.P, m.C, m.V, m.Cc, m.Ct
local ERR_msg = ''
local ERR_i = nil
local LST_tk = nil
local LST_tki = nil
local f = function (s, i, tk)
if tk == '' then
ERR_i = 0
LST_tki = 0 -- restart parsing
LST_tk = 'BOF'
elseif i > LST_tki then
LST_tki = i
LST_tk = tk
end
--DBG('f', ERR_i, LST_tki, LST_tk, i,tk)
return true
end
local K = function (patt)
ERR_msg = ''
return m.Cmt(patt, f)
end
local CK = function (patt)
return C(K(patt))
end
local EK = function (tk)
return K(tk) + m.Cmt(P'',
function (_,i)
if i > ERR_i then
ERR_i = i
ERR_msg = 'expected `'..tk.."'"
end
return false
end)
end
local _V2NAME = {
_Exp = 'expression',
_Stmts = 'statement',
Evt = 'event',
}
local EV = function (rule)
return V(rule) + m.Cmt(P'',
function (_,i)
if i > ERR_i then
ERR_i = i
ERR_msg = 'expected ' .. _V2NAME[rule]
end
return false
end)
end
local EE = function (msg)
return m.Cmt(P'',
function (_,i)
if i > ERR_i then
ERR_i = i
ERR_msg = 'expected '..msg
end
return false
end)
end
KEYS = P'do'+'end'+'async'+'return'
+ 'par'+'par/or'+'par/and'+'with'
+ 'if'+'then'+'else'
+ 'await'+'forever'+'emit'
+ 'loop'+'break'+'nothing'
+ 'input' -- TODO: types
+ 'sizeof'+'null'+'call'
+ 'pure'+'deterministic'
KEYS = KEYS * -m.R('09','__','az','AZ','\127\255')
local S = V'_SPACES'
local ALPHA = m.R'az' + m.R'AZ' + '_'
local ALPHANUM = ALPHA + m.R'09'
ID = ALPHA * ALPHANUM^0
ID = ID - KEYS
NUM = CK(m.R'09'^1) / tonumber
ID_type = ID * (S*'*')^0 /
function (str)
return (string.gsub( (string.gsub(str,' ','')), '^_', '' ))
end
_GG = { [1] = K'' *S* EV'_Stmts' *S* -1
, Block = EV'_Stmts'
, _Stmts = V'_LstStmt' *S* EK';' * (S*K';')^0
+ V'_LstStmtBlock' * (S*K';')^0
+ V'_Stmt' *S* EK';' * (S*K';')^0 *S* V'_Stmts'^-1
+ V'_StmtBlock' * (S*K';')^0 *S* V'_Stmts'^-1
, _LstStmtBlock = V'ParEver'
, _LstStmt = V'Return' + V'Break' + V'AwaitN' + V'ParEver'
, _Stmt = V'Nothing'
+ V'AwaitT' + V'AwaitE' + V'_Emit'
+ V'_Dcl_ext' + V'_Dcl_int'
+ V'Dcl_det' + V'_Dcl_pure'
+ V'_Set' + V'CallStmt' -- must be after Set
, _StmtBlock = V'_DoBlock' + V'Async' + V'Host'
+ V'ParOr' + V'ParAnd'
+ V'If' + V'Loop'
, _SetBlock = V'_DoBlock' + V'Async' + V'ParEver'
+ V'If' + V'Loop'
, _Dcl_pure = K'pure' *S* EV'ID_c' * (S* K',' *S* V'ID_c')^0
, Dcl_det = K'deterministic' *S* EV'ID_c' * (S* K',' *S* V'ID_c')^0
, _Dcl_int = ID_type *S* ('['*S*NUM*S*']' + Cc(false)) *S*
V'__Dcl_int' * (S*K','*S*V'__Dcl_int')^0
, __Dcl_int = V'ID_int' *S* (V'_Sets' + Cc(false)*Cc(false))
, _Dcl_ext = K'input' *S* ID_type *S* V'ID_ext' * (S*K','*S*V'ID_ext')^0
, _Set = V'_Exp' *S* V'_Sets'
, _Sets = K'=' *S* (
Cc'SetStmt' * (V'AwaitT'+V'AwaitE') +
Cc'SetBlock' * V'_SetBlock' +
Cc'SetExp' * V'_Exp' +
EE'expression'
)
, CallStmt = (#V'ID_c' + K'call'*S) * V'_Exp'
, Nothing = K'nothing'
, _DoBlock= K'do' *S* V'Block' *S* EK'end'
, Async = K'async' *S* EK'do' *S* V'Block' *S* EK'end'
, Return = K'return' *S* EV'_Exp'
, ParOr = K'par/or' *S* EK'do' *S*
V'Block' * (S* EK'with' *S* V'Block')^1 *S*
EK'end'
, ParAnd = K'par/and' *S* EK'do' *S*
V'Block' * (S* EK'with' *S* V'Block')^1 *S*
EK'end'
, ParEver = K'par' *S* EK'do' *S*
V'Block' * (S* EK'with' *S* V'Block')^1 *S*
EK'end'
, If = K'if' *S* EV'_Exp' *S* EK'then' *S*
V'Block' *S*
(EK'else' *S*
V'Block')^-1 *S*
EK'end'
, Loop = K'loop' *S* EK'do' *S*
V'Block' *S*
EK'end'
, Break = K'break'
, _Emit = V'EmitT' + V'EmitE'
, EmitT = K'emit' *S* (V'TIME')
, EmitE = K'emit' *S* EV'Evt' * (S* K'=' *S* V'_Exp')^-1
, AwaitN = K'await' *S* K'forever' -- last stmt
, AwaitT = K'await' *S* (V'_Parens'+V'TIME')
, AwaitE = K'await' *S* EV'Evt'
, _Exp = V'_1'
, _1 = V'_2' * (S* CK'||' *S* V'_2')^0
, _2 = V'_3' * (S* CK'&&' *S* V'_3')^0
, _3 = V'_4' * (S* (CK'|'-'||') *S* V'_4')^0
, _4 = V'_5' * (S* CK'^' *S* V'_5')^0
, _5 = V'_6' * (S* (CK'&'-'&&') *S* V'_6')^0
, _6 = V'_7' * (S* CK(K'!='+'==') *S* V'_7')^0
, _7 = V'_8' * (S* CK(K'<='+'>='+(K'<'-'<<')+(K'>'-'>>')) *S* V'_8')^0
, _8 = V'_9' * (S* CK(K'>>'+'<<') *S* V'_9')^0
, _9 = V'_10' * (S* CK(K'+'+(K'-'-'->')) *S* V'_10')^0
, _10 = V'_11' * (S* CK(K'*'+(K'/'-'//'-'/*')+'%') *S* V'_11')^0
, _11 = (( Cc(true) * CK((K'!'-'!=') + (K'&'-'&&')
+ (K'-'-'->')+'+'+'~'+'*')
+ (K'<'*CK(ID_type)*Cc'cast'*K'>')
)*S)^0 * V'_12'
, _12 = V'_13' *S* (
K'(' *S* Cc'call' *S* V'ExpList' *S* EK')' +
K'[' *S* Cc'idx' *S* V'_Exp' *S* EK']' +
CK(K'->' + '.') *S* CK(ID)
)^0
, _13 = V'_Prim'
, _Prim = V'_Parens' + V'Var' + V'ID_c' + V'SIZEOF'
+ V'NULL' + V'CONST' + V'STRING'
, ExpList = ( V'_Exp'*(S*','*S*EV'_Exp')^0 )^-1
, _Parens = K'(' *S* EV'_Exp' *S* EK')'
, SIZEOF = K'sizeof' *S* EK'<' *S* ID_type *S* EK'>'
, CONST = CK( #m.R'09' * ALPHANUM^1 )
+ CK( "'" * (P(1)-"'")^0 * "'" )
, NULL = CK'null'
, TIME = #NUM *
(NUM * K'h' + Cc(0)) *
(NUM * K'min' + Cc(0)) *
(NUM * K's' + Cc(0)) *
(NUM * K'ms' + Cc(0)) *
(NUM * EE'<h,min,s,ms>')^-1
, Var = V'ID_int'
, Evt = V'ID_int' + V'ID_ext'
, ID_int = #m.R'az' * CK(ID) -- int names start with lower
, ID_ext = #m.R'AZ' * CK(ID) -- ext names start with upper
, ID_c = CK(P'_' * ID)
, STRING = CK( '"' * (P(1)-'"'-'\n')^0 * EK'"' )
, Host = P'C' *S* EK'do' * m.S' \n\t'^0 *
( C(V'_C') + C((P(1)-'end')^0) )
*S* EK'end'
, _C = m.Cg(V'_CSEP','mark') *
(P(1)-V'_CEND')^0 *
V'_CEND'
, _CSEP = '/***' * (1-P'***/')^0 * '***/'
, _CEND = m.Cmt(C(V'_CSEP') * m.Cb'mark',
function (s,i,a,b) return a == b end)
, _SPACES = ( m.S'\t\n\r '
+ ('//' * (P(1)-'\n')^0 * P'\n'^-1)
+ V'_COMM'
)^0
, _COMM = '/' * m.Cg(P'*'^1,'comm') * (P(1)-V'_COMMCMP')^0 * V'_COMMCL'
/ function () end
, _COMMCL = C(P'*'^1) * '/'
, _COMMCMP = m.Cmt(V'_COMMCL' * m.Cb'comm',
function (s,i,a,b) return a == b end)
}
function err ()
local x = (ERR_i<LST_tki) and 'before' or 'after'
return 'ERR : line '.._I2L[LST_tki]..
' : '..x..' `'..LST_tk.."'"..
' : '..ERR_msg
end
if _CEU then
if not m.P(_GG):match(_STR) then
DBG(err())
os.exit(1)
end
else
assert(m.P(_GG):match(_STR), err())
end
|
function NPC:OnScaledDamage(npc, hitgroup, dmginfo)
return false
end |
--[[
Copyright (C) Udorn (Blackhand)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
--]]
--[[
Some table helpers.
--]]
vendor.Tables = {}
--[[
Returns the index to an item in the given table matching the specified value.
The table has to be sorted. There may be other items, that also match the value.
--]]
function vendor.Tables.BinarySearch(t, v, extractValue)
local left, right, idx = 1, #t, 0
local cmpV
while (left <= right) do
idx = math.floor((left + right) / 2)
if (extractValue) then
cmpV = extractValue(t[idx])
else
cmpV = t[idx]
end
if (v == cmpV) then
return idx
elseif (v < cmpV) then
-- search left
right = idx - 1
else
-- search right
left = idx + 1
end
end
return nil
end
--[[
Copies all elements from the numbered table src to dest.
--]]
function vendor.Tables.Copy(src, dest)
for i=1,#src do
table.insert(dest, src[i])
end
return dest
end
|
-- Copyright (c) 2019 Redfern, Trevor <[email protected]>
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
local Component = require "moonpie.ui.components.component"
Component("body", function(props)
return {
props.content
}
end) |
class("AttireApplyCommand", pm.SimpleCommand).execute = function (slot0, slot1)
if not getProxy(AttireProxy):getAttireFrame(slot1:getBody().type, slot1.getBody().id) then
return
end
slot7 = getProxy(PlayerProxy).getData(slot6)
pg.ConnectionMgr.GetInstance():Send(11005, {
id = slot3,
type = slot4
}, 11006, function (slot0)
if slot0.result == 0 then
slot0:updateAttireFrame(slot0.updateAttireFrame, slot0)
slot3:updatePlayer(slot0)
slot4:sendNotification(GAME.ATTIRE_APPLY_DONE)
else
print(slot0.result)
end
end)
end
return class("AttireApplyCommand", pm.SimpleCommand)
|
ESX = nil
local PlayerData = {}
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(500)
end
while ESX.GetPlayerData().job == nil do
Citizen.Wait(5000)
end
PlayerData = ESX.GetPlayerData()
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
PlayerData.job = job
end)
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
PlayerData = xPlayer
end)
Citizen.CreateThread(function()
while true do
local sleep = 1500
local player = PlayerPedId()
local playerCoords = GetEntityCoords(player)
for k,v in ipairs(Config.Money) do
local distance = #(playerCoords - v)
if distance <= 5 then
sleep = 0
if distance <= 3 then
ESX.ShowFloatingHelpNotification(_U('press_e'),vector3(v))
if distance <= 1.5 and IsPedOnFoot(player) and IsControlJustReleased(0, 38) then
FreezeEntityPosition(PlayerPedId(), true)
ClearPedTasksImmediately(PlayerPedId())
TriggerEvent(
'mythic_progbar:client:progress',
{
name = 'moneywash',
duration = Config.duration,
label = _U('laundering_money'),
useWhileDead = false,
canCancel = true,
controlDisables = {
disableMovement = true,
disableCarMovement = false,
disableMouse = false,
disableCombat = true
},
},
function(status)
if not status then
ClearPedTasks(playerPed)
FreezeEntityPosition(PlayerPedId(), false)
TriggerServerEvent('moneywash:process')
end
end
)
end
end
end
Wait(sleep)
end
end)
|
-- Copyright 2016 Google Inc, NYU.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
function torch.loadMantaFile(fn)
assert(paths.filep(fn), "couldn't find ".. fn)
local file = torch.DiskFile(fn, 'r')
file:binary()
local transpose = file:readInt() -- Legacy. Never used.
local nx = file:readInt()
local ny = file:readInt()
local nz = file:readInt()
local is3D = file:readInt()
is3D = is3D == 1
local numel = nx * ny * nz
local Ux = torch.FloatTensor(file:readFloat(numel))
local Uy = torch.FloatTensor(file:readFloat(numel))
local Uz
if is3D then
Uz = torch.FloatTensor(file:readFloat(numel))
end
local p = torch.FloatTensor(file:readFloat(numel))
-- Note: flags are stored as integers but well treat it as floats to make it
-- easier to sent to CUDA.
local flags = torch.IntTensor(file:readInt(numel)):float()
local density = torch.FloatTensor(file:readFloat(numel))
-- Note: we ALWAYS deal with 5D tensor to make things easy.
-- i.e. all tensors are always nbatch x nchan x nz x ny x nx.
-- Always including the batch and (potentially) unary scalar dimensions
-- makes our lives easier.
Ux:resize(1, 1, nz, ny, nx)
Uy:resize(1, 1, nz, ny, nx)
if is3D then
Uz:resize(1, 1, nz, ny, nx)
end
p:resize(1, 1, nz, ny, nx)
flags:resize(1, 1, nz, ny, nx)
density:resize(1, 1, nz, ny, nx)
local U
if is3D then
U = torch.cat({Ux, Uy, Uz}, 2):contiguous()
else
U = torch.cat({Ux, Uy}, 2):contiguous()
end
-- Ignore the border pixels.
return p, U, flags, density, is3D
end
|
function INIT()
screen(300,200,3,[[
#140c1c
#442434
#30346d
#4e4a4e
#854c30
#346524
#d04648
#757161
#597dce
#d27d2c
#8595a1
#6daa2c
#d2aa99
#6dc2ca
#dad45e
#deeed6
]])
local pixelcode = [[
extern vec4 colors[32];
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords )
{
if ((mod(screen_coords.x,2)<=1) && (mod(screen_coords.y,2)<=1) ||
(mod(screen_coords.x,2)>1) && (mod(screen_coords.y,2)>1) )
{
return colors[0];
} else {
return color;
};
}
]]
shader = love.graphics.newShader(pixelcode)
local rgba = {}
local c
for i=1,#colors do
c = colors[i]
rgba[i] = {c[1]/255,c[2]/255,c[3]/255,1}
trace(i,c[1],c[2],c[3])
end
for i=1,#rgba do
trace(i,unpack(rgba[i]))
end
shader:sendColor('colors',unpack(rgba))
x,y = 0,0
end
function DRAW()
cls()
camera(x,y)
love.graphics.setShader(shader)
for c=0,MAX_COLOR do
rectfill(8+16*c,8,12,12,c)
end
love.graphics.setShader()
for c=0,MAX_COLOR do
rectfill(8+16*c,28,12,12,c)
end
if key("down") then y=y+1 end
if key("up") then y=y-1 end
end
|
local F, C = unpack(select(2, ...))
tinsert(C.themes["FreeUI"], function()
local gsub = string.gsub
GossipGreetingText:SetTextColor(1, 1, 1)
NPCFriendshipStatusBar:GetRegions():Hide()
NPCFriendshipStatusBarNotch1:SetColorTexture(0, 0, 0)
NPCFriendshipStatusBarNotch1:SetSize(1, 16)
NPCFriendshipStatusBarNotch2:SetColorTexture(0, 0, 0)
NPCFriendshipStatusBarNotch2:SetSize(1, 16)
NPCFriendshipStatusBarNotch3:SetColorTexture(0, 0, 0)
NPCFriendshipStatusBarNotch3:SetSize(1, 16)
NPCFriendshipStatusBarNotch4:SetColorTexture(0, 0, 0)
NPCFriendshipStatusBarNotch4:SetSize(1, 16)
select(7, NPCFriendshipStatusBar:GetRegions()):Hide()
NPCFriendshipStatusBar.icon:SetPoint("TOPLEFT", -30, 7)
F.CreateBDFrame(NPCFriendshipStatusBar, .25)
F.StripTextures(GossipFrameGreetingPanel)
F.ReskinPortraitFrame(GossipFrame, 15, -15, -30, 65)
F.Reskin(GossipFrameGreetingGoodbyeButton)
F.ReskinScroll(GossipGreetingScrollFrameScrollBar)
GossipFrame:HookScript("OnShow", function()
C_Timer.After(.01, function()
local index = 1
local titleButton = _G["GossipTitleButton"..index]
while titleButton do
if titleButton:GetText() ~= nil then
titleButton:SetText(gsub(titleButton:GetText(), ":32:32:0:0", ":32:32:0:0:64:64:5:59:5:59"))
end
index = index + 1
titleButton = _G["GossipTitleButton"..index]
end
end)
end)
end) |
---
--- slack.lua
---
--- SLACK incoming webhook interface
---
print("slack: loading")
-- Set fake_slack true to print what would be sent, but send nothing
fake_slack = true
-- slack()
--
-- Simple function to send a message to a slack channel
--
function slack(msg, channel, user, emoji)
print('slack: posting '..msg)
local function rcv(sck,c) print("RCV: "..c) end
local post_headers= "Content-Type: application/json\r\n"
local message = {
channel = channel or config.slack_channel or "#general",
username = user or config.slack_user or "nodemcu",
icon_emoji = emoji or config.slack_emoji or ":vertical_traffic_light:",
text = msg,
mrkdwn = true
}
local post_body = cjson.encode(message)
if message['icon_emoji'] == 'none' then message['icon_emoji']=nil end
if config.fake_slack or (config.slack_webhook_url==nil and config.slack_mqtt_topic==nil) then
print("slack: FAKE POST: "..post_body)
return
end
if config.slack_webhook_url then
print("Post URL = "..config.slack_webhook_url)
print("Post hdrs = "..post_headers)
print('Post body = '..post_body)
http.post(config.slack_webhook_url, post_headers, post_body,
function(code, data)
if (code < 0) then
print("slack: HTTP request failed: code "..code)
else
print("slack: received response: ", code, data)
end
end
)
elseif config.slack_mqtt_topic then
-- Around mid Sept 2016 Slack's SSL proposals stopped working with NodeMCU
-- Until I can fix this, I made a workaround to support posting to slack via MQTT
print("Slack via MQTT: "..post_body)
mqtt_publish(config.slack_mqtt_topic, post_body)
end
end
print "slack: loaded"
|
--Registro ABMs
local function Crystal(pos, node, dis)
local Mn = {x = pos.x - dis, y = pos.y - dis, z = pos.z - dis}
local Mx = {x = pos.x + dis, y = pos.y + dis, z = pos.z + dis}
local Air =minetest.find_nodes_in_area(Mn,Mx, "group:stone")
if #Air == 0 then
return
else
local i=0
for i=1,#Air,1 do
local Block=Air[math.random(#Air)]
local Ps= vector.add(Block,{x=0,y=1,z=0})
if(minetest.get_node(Ps).name == "air") then
minetest.set_node(Ps,{name = "crystal_light:crystal"})
break
end
end
end
end
minetest.register_abm({
nodenames = {"group:crystal_core"},
neighbors = {"air","group:water"},
interval = 10.0,
chance = 5,
action = function(pos, node, active_object_count, active_object_count_wider)
local dis=minetest.get_node_group(node.name, "crystal_core")
if dis>2 then
dis=dis*2
end
Crystal(pos, node, dis)
end,
})
minetest.register_abm({
nodenames = {"crystal_light:crystal_water_source"},
neighbors = {"default:water_source"},
interval = 10.0,
chance = 5,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta=minetest.get_meta(pos)
local n =meta:get_int("n")
local t =meta:get_int("t")
if n<16 then
local water =minetest.find_nodes_in_area(vector.add(pos,{x=-1,y=-1,z=-1}),vector.add(pos,{x=1,y=1,z=1}), "default:water_source")
for i=1,math.random(#water),1 do
local ps=math.random(#water)
if water[ps]~=nil then
minetest.set_node(water[ps],{name="crystal_light:crystal_water_source"})
minetest.get_meta(water[ps]):set_int("n",n+1)
minetest.get_meta(water[ps]):set_int("t",t-(n+1)*2)
water[ps]=nil
end
end
end
end,
})
minetest.register_abm({
nodenames = {"crystal_light:crystal_water_source"},
interval = 10.0,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local meta=minetest.get_meta(pos)
local t =meta:get_int("t")
t=t-1
if t<=0 then
minetest.set_node(pos,{name="default:water_source"})
else
meta:set_int("t",t)
end
end,
})
|
local creatureNames, crystalPosition = { 'humongous fungus', 'hideous fungus' }, Position(33104, 31908, 10)
local function summonMonster(name, position)
Game.createMonster(name, position)
position:sendMagicEffect(CONST_ME_TELEPORT)
end
local function chargingText(cid, text, position)
local player = Player(cid)
player:say(text, TALKTYPE_MONSTER_SAY, false, player, position)
end
local function revertTeleport(position)
local teleportItem = Tile(position):getItemById(1387)
if teleportItem then
teleportItem:transform(17999)
end
end
local function clearArea(fromPosition, toPosition, bossName, exitPosition)
for x = fromPosition.x, toPosition.x do
for y = fromPosition.y, toPosition.y do
for z = fromPosition.z, toPosition.z do
local creature = Tile(Position(x, y, z)):getTopCreature()
if creature then
if creature:isPlayer() then
creature:teleportTo(exitPosition)
exitPosition:sendMagicEffect(CONST_ME_TELEPORT)
creature:say('You were teleported out by the gnomish emergency device.', TALKTYPE_MONSTER_SAY)
end
if creature:isMonster() and creature:getName():lower() == bossName:lower() then
creature:remove()
end
end
end
end
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if Game.getStorageValue(GlobalStorage.Warzones) == 1 then
return false
end
Game.setStorageValue(GlobalStorage.Warzones, 1)
addEvent(Game.setStorageValue, 32 * 60 * 1000, GlobalStorage.Warzones, 0)
local pos
for i = 1, 6 do
for k = 1, 10 do
pos = Position(math.random(33091, 33101), math.random(31899, 31916), 10)
addEvent(summonMonster, (i - 1) * 20000, creatureNames[math.random(#creatureNames)], pos)
end
addEvent(chargingText, (i - 1) * 20000, player.uid, 'The crystals are charging.', toPosition)
end
local crystalItem = Tile(crystalPosition):getItemById(17999)
if crystalItem then
crystalItem:transform(1387)
addEvent(revertTeleport, 6 * 20 * 1000, crystalPosition)
end
addEvent(summonMonster, 6 * 20 * 1000, 'deathstrike', Position(33100, 31955, 10))
addEvent(clearArea, 32 * 60 * 1000, Position(33089, 31946, 10), Position(33124, 31983, 10), 'deathstrike', Position(33002, 31918, 10))
return true
end |
CloneClass( ChatManager )
Hooks:RegisterHook( "ChatManagerOnSendMessage" )
function ChatManager.send_message(this, channel_id, sender, message)
Hooks:Call( "ChatManagerOnSendMessage", channel_id, sender, message )
return this.orig.send_message(this, channel_id, sender, message)
end
Hooks:RegisterHook( "ChatManagerOnReceiveMessage" )
function ChatManager._receive_message(this, channel_id, name, message, color, icon)
Hooks:Call( "ChatManagerOnReceiveMessage", channel_id, name, message, color, icon )
return this.orig._receive_message(this, channel_id, name, message, color, icon)
end
|
local NPC = {};
NPC.Name = "Police Department";
NPC.ID = 11;
NPC.Model = Model("models/humans/SCPD/male_01.mdl");
NPC.Invisible = false; // Used for ATM Machines, Casino Tables, etc.
NPC.Location = Vector(-6997.8965, -8858.5801, -431.9688);
NPC.Angles = Angle(0, -90, 0);
NPC.ShowChatBubble = "Normal";
NPC.Sequence = 228;
// This is always local player.
function NPC.OnTalk ( )
if LocalPlayer():Team() == TEAM_POLICE or LocalPlayer():Team() == TEAM_SWAT or LocalPlayer():Team() == TEAM_DISPATCHER then
GAMEMODE.DialogPanel:SetDialog("You're here to quit, aren't you? This ALWAYS happens! Can't find any reliable work nowadays!");
if (LocalPlayer():Team() == TEAM_POLICE) then
GAMEMODE.DialogPanel:AddDialog("No... I was just wondering if any squad cars were available.", NPC.SquadCar);
elseif (LocalPlayer():Team() == TEAM_SWAT) then
GAMEMODE.DialogPanel:AddDialog("No... I was just wondering if any SWAT vans were available.", NPC.SWATVan);
end
GAMEMODE.DialogPanel:AddDialog("Actually, yes. Here's my badge.", NPC.QuitJob);
GAMEMODE.DialogPanel:AddDialog("Errr... No...", NPC.Relief);
elseif LocalPlayer():Team() == TEAM_MAYOR then
GAMEMODE.DialogPanel:SetDialog("Hello, Mr. Mayor, sir!");
GAMEMODE.DialogPanel:AddDialog("Good day, sir.", LEAVE_DIALOG);
elseif LocalPlayer():Team() == TEAM_CITIZEN then
GAMEMODE.DialogPanel:SetDialog("Hello, are you interested in a position as an officer?");
GAMEMODE.DialogPanel:AddDialog("Yes. I've always wanted to pursue a life in law enforcement.", NPC.HirePolice);
GAMEMODE.DialogPanel:AddDialog("Actually, I was looking for a position on your SWAT team.", NPC.HireSWAT);
GAMEMODE.DialogPanel:AddDialog("Are you in need of any phone operators?", NPC.HireDispatcher);
GAMEMODE.DialogPanel:AddDialog("I'd never be a pig!", LEAVE_DIALOG);
else
GAMEMODE.DialogPanel:SetDialog("Hello, sir.");
GAMEMODE.DialogPanel:AddDialog("Hello.", LEAVE_DIALOG);
end
GAMEMODE.DialogPanel:Show();
end
function NPC.QuitJob ( )
LEAVE_DIALOG();
if LocalPlayer():Team() == TEAM_POLICE then
RunConsoleCommand('perp_p_q');
-- ClientCar = 0;
elseif LocalPlayer():Team() == TEAM_SWAT then
RunConsoleCommand('perp_s_q');
ClientCar = 0;
else
RunConsoleCommand('perp_di_q');
end
end
function NPC.Relief ( )
GAMEMODE.DialogPanel:SetDialog("Oh... In that case, hey! What can I do for you?");
GAMEMODE.DialogPanel:AddDialog("Nothing...", LEAVE_DIALOG);
end
function NPC.HirePolice ( )
local PoliceNumber = team.NumPlayers(TEAM_POLICE);
if (PoliceNumber >= GAMEMODE.MaximumCops) then
GAMEMODE.DialogPanel:SetDialog("Ahh, sorry. It seems that we aren't currently looking for any new officers. Sorry.\n\n(This class is full. Try again later.)");
GAMEMODE.DialogPanel:AddDialog("Alright. I'll check back in later, then.", LEAVE_DIALOG);
elseif (LocalPlayer():GetNetworkedBool("warrent", false)) then
GAMEMODE.DialogPanel:SetDialog("We do not allow criminals to serve as government officials.\n\n(You have a warrent; you must get rid of it before becoming a police officer.)");
GAMEMODE.DialogPanel:AddDialog("Oh, okay...", LEAVE_DIALOG);
elseif (LocalPlayer():HasBlacklist(GAMEMODE.teamToBlacklist[TEAM_POLICE])) then
local expires = LocalPlayer():HasBlacklist(GAMEMODE.teamToBlacklist[TEAM_POLICE]);
if (expires == 0) then
GAMEMODE.DialogPanel:SetDialog("I don't think I can trust you after what happened last time.\n\n(You are permanently blacklisted from this occupation.)");
elseif (GAMEMODE.Options_EuroStuff:GetBool()) then
GAMEMODE.DialogPanel:SetDialog("I don't think I can trust you after what happened last time.\n\n(You are currently blacklisted from this occupation. Expires on " .. os.date("%B %d, 20%y at %H:%M", expires) .. ".)");
else
GAMEMODE.DialogPanel:SetDialog("I don't think I can trust you after what happened last time.\n\n(You are currently blacklisted from this occupation. Expires on " .. os.date("%B %d, 20%y at %I:%M %p", expires) .. ".)");
end
GAMEMODE.DialogPanel:AddDialog("Oh, right...", LEAVE_DIALOG);
elseif (LocalPlayer():GetTimePlayed() < GAMEMODE.RequiredTime_Cop * 60 * 60 && !LocalPlayer():IsBronze()) then
GAMEMODE.DialogPanel:SetDialog("Sorry, but it appears that you are not qualified for this position.\n\n(You need at least " .. GAMEMODE.RequiredTime_Cop .. " hours of play time or VIP to be an officer.)");
GAMEMODE.DialogPanel:AddDialog("Alright. I'll check back in later, then.", LEAVE_DIALOG);
elseif (GAMEMODE.IsRunningForMayor) then
GAMEMODE.DialogPanel:SetDialog("Sorry, but people running for mayordom cannot be officers. Legal mumbo-jumbo.");
GAMEMODE.DialogPanel:AddDialog("Oh, that's lame.", LEAVE_DIALOG);
else
GAMEMODE.DialogPanel:SetDialog("Welcome to the force! Here's your uniform, firearm, and hand cuffs. You can ask the mayor personally to issue a warrant when you need one. We have several squad cars available, just ask the garage operator.\n\n(If you abuse your new-found power, you will be blacklisted and possibly banned.)");
RunConsoleCommand('perp_p_j');
GAMEMODE.DialogPanel:AddDialog("I'll serve to my best ability, sir!", LEAVE_DIALOG);
end
end
function NPC.HireSWAT ( )
local PoliceNumber = team.NumPlayers(TEAM_SWAT);
if (PoliceNumber >= GAMEMODE.MaximumSWAT && !LocalPlayer():IsSuperAdmin()) then
if table.Count(player.GetAll()) >= GAMEMODE.MinimumForSWAT then
GAMEMODE.DialogPanel:SetDialog("It appears that our SWAT team is filled.\n\n(This class is full. Try again later.)");
else
GAMEMODE.DialogPanel:SetDialog("There is no SWAT team currently in action.\n\n(SWAT requires at least " .. GAMEMODE.MinimumForSWAT .. " players in the server.)");
end
GAMEMODE.DialogPanel:AddDialog("Alright. I'll check back in later, then.", LEAVE_DIALOG);
elseif (LocalPlayer():GetNetworkedBool("warrent", false)) then
GAMEMODE.DialogPanel:SetDialog("We do not allow criminals to serve as government officials.\n\n(You have a warrent; you must get rid of it before becoming a SWAT team member.)");
GAMEMODE.DialogPanel:AddDialog("Oh, okay...", LEAVE_DIALOG);
elseif (LocalPlayer():HasBlacklist(GAMEMODE.teamToBlacklist[TEAM_SWAT])) then
local expires = LocalPlayer():HasBlacklist(GAMEMODE.teamToBlacklist[TEAM_SWAT]);
if (expires == 0) then
GAMEMODE.DialogPanel:SetDialog("I don't think I can trust you after what happened last time.\n\n(You are permanently blacklisted from this occupation.)");
elseif (GAMEMODE.Options_EuroStuff:GetBool()) then
GAMEMODE.DialogPanel:SetDialog("I don't think I can trust you after what happened last time.\n\n(You are currently blacklisted from this occupation. Expires on " .. os.date("%B %d, 20%y at %H:%M", expires) .. ".)");
else
GAMEMODE.DialogPanel:SetDialog("I don't think I can trust you after what happened last time.\n\n(You are currently blacklisted from this occupation. Expires on " .. os.date("%B %d, 20%y at %I:%M %p", expires) .. ".)");
end
GAMEMODE.DialogPanel:AddDialog("Oh, right...", LEAVE_DIALOG);
elseif ((LocalPlayer():GetTimePlayed() < GAMEMODE.RequiredTime_SWAT * 60 * 60 || !LocalPlayer():IsBronze()) && !LocalPlayer():IsAdmin()) then
GAMEMODE.DialogPanel:SetDialog("Sorry, but it appears that you are not qualified for this position.\n\n(You need at least " .. GAMEMODE.RequiredTime_SWAT .. " hours of play time and VIP to be a SWAT officer.)");
GAMEMODE.DialogPanel:AddDialog("Alright. I'll check back in later, then.", LEAVE_DIALOG);
elseif (GAMEMODE.IsRunningForMayor) then
GAMEMODE.DialogPanel:SetDialog("Sorry, but people running for mayordom cannot be officers. Legal mumbo-jumbo.");
GAMEMODE.DialogPanel:AddDialog("Oh, that's lame.", LEAVE_DIALOG);
else
GAMEMODE.DialogPanel:SetDialog("Welcome to the force! Here's your body armor, MP5, and Service Pistol. You will be required to answer all calls by the mayor or Police Officers in danger.\n\n(If you abuse your new-found power, you will be blacklisted and possibly banned.)");
RunConsoleCommand('perp_s_j');
GAMEMODE.DialogPanel:AddDialog("I'll serve to my best ability, sir!", LEAVE_DIALOG);
end
end
function NPC.HireDispatcher ( )
local PoliceNumber = team.NumPlayers(TEAM_DISPATCHER);
if (PoliceNumber >= GAMEMODE.MaximumDispatchers && !LocalPlayer():IsSuperAdmin()) then
GAMEMODE.DialogPanel:SetDialog("Sorry, we have more than enough.\n\n(This class is full. Try again later.)");
GAMEMODE.DialogPanel:AddDialog("Alright. I'll check back in later, then.", LEAVE_DIALOG);
elseif (LocalPlayer():GetNetworkedBool("warrent", false)) then
GAMEMODE.DialogPanel:SetDialog("We do not allow criminals to serve as government officials.\n\n(You have a warrent; you must get rid of it before becoming a police operator.)");
GAMEMODE.DialogPanel:AddDialog("Oh, okay...", LEAVE_DIALOG);
elseif (LocalPlayer():HasBlacklist(GAMEMODE.teamToBlacklist[TEAM_DISPATCHER])) then
local expires = LocalPlayer():HasBlacklist(GAMEMODE.teamToBlacklist[TEAM_DISPATCHER]);
if (expires == 0) then
GAMEMODE.DialogPanel:SetDialog("I don't think I can trust you after what happened last time.\n\n(You are permanently blacklisted from this occupation.)");
elseif (GAMEMODE.Options_EuroStuff:GetBool()) then
GAMEMODE.DialogPanel:SetDialog("I don't think I can trust you after what happened last time.\n\n(You are currently blacklisted from this occupation. Expires on " .. os.date("%B %d, 20%y at %H:%M", expires) .. ".)");
else
GAMEMODE.DialogPanel:SetDialog("I don't think I can trust you after what happened last time.\n\n(You are currently blacklisted from this occupation. Expires on " .. os.date("%B %d, 20%y at %I:%M %p", expires) .. ".)");
end
GAMEMODE.DialogPanel:AddDialog("Oh, right...", LEAVE_DIALOG);
elseif ((LocalPlayer():GetTimePlayed() < GAMEMODE.RequiredTime_Dispatcher * 60 * 60 && !LocalPlayer():IsAdmin())) then
GAMEMODE.DialogPanel:SetDialog("Sorry, but it appears that you are not qualified for this position.\n\n(You need at least " .. GAMEMODE.RequiredTime_Dispatcher .. " hours of play time to be a police operator.)");
GAMEMODE.DialogPanel:AddDialog("Alright. I'll check back in later, then.", LEAVE_DIALOG);
elseif (GAMEMODE.IsRunningForMayor) then
GAMEMODE.DialogPanel:SetDialog("Sorry, but people running for mayordom cannot be officers. Legal mumbo-jumbo.");
GAMEMODE.DialogPanel:AddDialog("Oh, that's lame.", LEAVE_DIALOG);
elseif (!LocalPlayer():HasItem("item_phone")) then
GAMEMODE.DialogPanel:SetDialog("Are you sure you know how to use a phone?...\n\n(You need a phone to use this job.)");
GAMEMODE.DialogPanel:AddDialog("What is a phone?", LEAVE_DIALOG);
else
GAMEMODE.DialogPanel:SetDialog("Welcome to the force! Your job is to answer calls from people in distress. We will route all incoming calls directly to your cells phones, so you can work from home if need be.\n\n(If you abuse your new-found power, you will be blacklisted and possibly banned.)");
RunConsoleCommand('perp_di_j');
GAMEMODE.DialogPanel:AddDialog("I'll serve to my best ability, sir!", LEAVE_DIALOG);
end
end
function NPC.SquadCar ( )
local numSquadCars = 0;
for k, v in pairs(ents.FindByClass("prop_vehicle_jeep")) do
local vT = lookForVT(v);
if (vT && vT.RequiredClass == TEAM_POLICE && v:GetNetworkedEntity("owner", nil) != LocalPlayer()) then
numSquadCars = numSquadCars + 1;
end
end
if (numSquadCars >= GAMEMODE.MaxCopCars) then
GAMEMODE.DialogPanel:SetDialog("Sorry, but all of the squad cars are taken.\n\n(All squad cars are taken; wait until someone who is using one quits the force.)");
GAMEMODE.DialogPanel:AddDialog("Okay, I'll check back later.", LEAVE_DIALOG);
else
GAMEMODE.DialogPanel:SetDialog("Sure, theres one available.");
GAMEMODE.DialogPanel:AddDialog("Normal Police Car.", NPC.REG)
GAMEMODE.DialogPanel:AddDialog("Mustang Police Car (VIP Only)", NPC.MUS)
GAMEMODE.DialogPanel:AddDialog("Nevermind.", LEAVE_DIALOG);
end
end
function NPC.REG ( )
RunConsoleCommand('perp_p_c');
LEAVE_DIALOG()
end
function NPC.CHAR ( )
RunConsoleCommand('perp_p_ac');
LEAVE_DIALOG()
end
function NPC.MUS()
if (LocalPlayer():GetLevel() > 98) then
GAMEMODE.DialogPanel:SetDialog("Sorry, but you must be a Gold or Diamond VIP for this car.");
GAMEMODE.DialogPanel:AddDialog("Well bummer. Nevermind.", LEAVE_DIALOG);
else
RunConsoleCommand('perp_p_cm');
LEAVE_DIALOG()
end
end
function NPC.SWATVan ( )
local numSquadCars = 0;
for k, v in pairs(ents.FindByClass("prop_vehicle_jeep")) do
local vT = lookForVT(v);
if (vT && vT.RequiredClass == TEAM_SWAT && v:GetNetworkedEntity("owner", nil) != LocalPlayer()) then
numSquadCars = numSquadCars + 1;
end
end
if (numSquadCars >= GAMEMODE.MaxSWATVans) then
GAMEMODE.DialogPanel:SetDialog("Sorry, but all of the SWAT vans are out.\n\n(All SWAT vans are taken; wait until someone who is using one quits the force.)");
GAMEMODE.DialogPanel:AddDialog("Okay, I'll check back later.", LEAVE_DIALOG);
else
GAMEMODE.DialogPanel:SetDialog("Sure, here are the keys.\n\n(Your SWAT van can be found on the sidewalk opposite of the Government Center.)");
RunConsoleCommand('perp_s_c');
GAMEMODE.DialogPanel:AddDialog("Thank you, sir!", LEAVE_DIALOG);
end
end
GAMEMODE:LoadNPC(NPC); |
FAdmin.StartHooks["Health"] = function()
FAdmin.Access.AddPrivilege("SetHealth", 2)
FAdmin.Commands.AddCommand("hp", nil, "<Player>", "<health>")
FAdmin.Commands.AddCommand("SetHealth", nil, "[Player]", "<health>")
FAdmin.ScoreBoard.Player:AddActionButton("Set health", "icon16/heart.png", Color(255, 130, 0, 255),
function(ply) return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "SetHealth", ply) end,
function(ply, button)
--Do nothing when the button has been clicked
end,
function(ply, button) -- Create the Wang when the mouse is pressed
button.OnMousePressed = function()
local window = Derma_StringRequest("Select health", "What do you want the health of the person to be?", "",
function(text)
local health = tonumber(text or 100) or 100
RunConsoleCommand("_fadmin", "SetHealth", ply:UserID(), health)
end
)
-- The user is usually holding tab when clicking health, so fix the focus
window:RequestFocus()
end
end)
end |
fs = require 'bee.filesystem'
if _W2L_DIR then
return fs.path(_W2L_DIR)
end
return fs.current_path():parent_path()
|
Test { description = "Testing Connection Cookies" }
local url = "https://httpbin.org/cookies/set/CookieName/CookieValue"
local parameters = {}
local headers = {}
headers["accept"] = "application/json"
local conn = Connection()
jsonText = conn:request("GET", url, parameters, nil, headers)
local json = JSON(jsonText):dictionary()
assert(json["cookies"]["CookieName"] == "CookieValue")
local cookies = conn:getCookies()
assert(cookies["CookieName"] == "CookieValue")
conn:request("GET", '/cookies', parameters, nil, headers)
local cookies = conn:getCookies()
assert(cookies["CookieName"] == "CookieValue")
|
SWEP.ClassName = "weapon_alyx_emp"
SWEP.Spawnable = true
SWEP.AdminOnly = false
SWEP.PrintName="Alyx EMP tool"
SWEP.Author = "Cherser"
SWEP.HoldType = "pistol"
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
SWEP.UseHands = false --true
SWEP.ViewModel = "models/weapons/v_pistol.mdl"
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
SWEP.Primary.Automatic= false
SWEP.Primary.Ammo= "none"
SWEP.Secondary.Automatic= false
SWEP.Secondary.Ammo= "none"
SWEP.FireRange = 120
SWEP.FireSound=Sound("weapons/stunstick/alyx_stunner2.wav")
SWEP.WaitTime=0.7
SWEP.Slot=5
SWEP.SlotPos=15
SWEP.DrawAmmo=false
function SWEP:SetupDataTables()
self:NetworkVar( "Bool" , 0 , "Firing" )
self:NetworkVar( "Bool" , 1 , "PrimaryAttack" )
self:NetworkVar("Entity", 0 , "TargetEntity" )
end
|
slot0 = class("BackYardShopFilterPanel", import("...Decoration.panles.BackYardDecorationFilterPanel"))
slot0.SortForDecorate = function (slot0, slot1, slot2)
slot3 = slot2[1]
slot4 = slot2[2]
slot5 = slot2[3]
function slot6(slot0)
if slot0:canPurchaseByGem() and not slot0:canPurchaseByDormMoeny() then
return 1
elseif slot0:canPurchaseByGem() and slot0:canPurchaseByDormMoeny() then
return 3
elseif slot0:canPurchaseByDormMoeny() then
return 4
else
return 5
end
end
slot0.SortByDefault1 = function (slot0, slot1)
slot4 = slot0:getConfig("new")
slot5 = slot1:getConfig("new")
if slot0(slot0) == slot0(slot1) then
if slot4 == slot5 then
return slot0.id < slot1.id
else
return slot4 < slot5
end
else
return slot2 < slot3
end
end
slot0.SortByDefault2 = function (slot0, slot1)
slot4 = slot0:getConfig("new")
slot5 = slot1:getConfig("new")
if slot0(slot0) == slot0(slot1) then
if slot4 == slot5 then
return slot1.id < slot0.id
else
return slot5 < slot4
end
else
return slot2 < slot3
end
end
slot7 = (slot0.canPurchase(slot0) and 1) or 0
if slot7 == ((slot1:canPurchase() and 1) or 0) then
if slot3 == slot0.SORT_MODE.BY_DEFAULT then
return slot0["SortByDefault" .. slot5](slot0, slot1)
elseif slot3 == slot0.SORT_MODE.BY_FUNC then
return slot0:SORT_BY_FUNC(slot1, slot4, slot5, function ()
return slot0["SortByDefault" .. ]("SortByDefault", slot3)
end)
elseif slot3 == slot0.SORT_MODE.BY_CONFIG then
return slot0.SORT_BY_CONFIG(slot0, slot1, slot4, slot5, function ()
return slot0["SortByDefault" .. ]("SortByDefault", slot3)
end)
end
else
return slot8 < slot7
end
end
slot0.sort = function (slot0, slot1)
table.sort(slot1, function (slot0, slot1)
return slot0:SortForDecorate(slot1, {
slot1.sortData[1],
slot1.sortData[2],
slot1.orderMode
})
end)
slot0.furnitures = slot1
end
return slot0
|
--[[
@brief A demo screen
]]
require('Screen')
require('Scene')
require('SceneObject')
require('Vector')
require('util')
ShooterScreen = Class.extend(Screen, {
character = nil,
verticalSpeed = 300, -- px/s
direction = nil,
})
function ShooterScreen:load()
Screen.load(self) -- super
self.character = SceneObject.new(
'resources/sprites/demoScreen/ship.animation.lua', {
collisionLevel = Scene.COLLISION_LEVELS.FRIENDLY
});
self.direction = Vector.new(0,0)
self.bg = love.graphics.newImage("resources/images/demoScreen/bg.jpg")
self.character:setPosition(20, love.graphics.getHeight() / 2 - self.character:getFrameHeight() / 2)
self.character:setMovementBounds(0, love.graphics.getWidth(), 0, love.graphics.getHeight())
self:getScene():addObject(self.character)
end
function ShooterScreen:keypressed(key)
local direction = self.character:getVector()
if key == "up" then
self.character:setVector(direction.x, direction.y - 1)
elseif key == "down" then
self.character:setVector(direction.x, direction.y + 1)
elseif key == "right" then
self.character:setVector(direction.x + 1, direction.y)
elseif key == "left" then
self.character:setVector(direction.x - 1, direction.y)
end
end
function ShooterScreen:keyreleased(key)
local direction = self.character:getVector()
if key == "up" then
self.character:setVector(direction.x, direction.y + 1)
elseif key == "down" then
self.character:setVector(direction.x, direction.y - 1)
elseif key == "right" then
self.character:setVector(direction.x - 1, direction.y)
elseif key == "left" then
self.character:setVector(direction.x + 1, direction.y)
end
end
function ShooterScreen:update(dt)
return Screen.update(self, dt) -- super
end
function ShooterScreen:draw()
-- Background
love.graphics.draw(self.bg, 0, 0)
return Screen.draw(self)
end
return ShooterScreen
|
stepper = require ('stepper')
stepper.init()
desired_steps = 2500
interval = 5
timer_to_use = 0
print('stepper.rotate() - start')
stepper.rotate(stepper.FORWARD,desired_steps,interval,timer_to_use,function ()
print('Rotation done. inside callback.')
end)
|
GM.Weapons = {}
-- Weapon categories
WEAPON_PRIMARY = 1
WEAPON_SECONDARY = 2
WEAPON_ADDON = 3
function GM:LoadWeapons()
if !self then self = GAMEMODE end
if SERVER and ( !self.Multipliers or !self.Multipliers.Weapons ) then
Error("Can't find GM.Multipliers for weapon knockbacks!\n")
end
-- Read weapons configuration list
local path = string.format("gamemodes/%s/weapons.txt", self.FolderName)
local tbl = util.KeyValuesToTable( file.Read( path, "GAME" ) )
-- Load in weapons
for _, weapon in pairs(tbl) do
-- Store values
table.insert(self.Weapons, weapon)
-- Setup weapon multipliers for knockback
if SERVER then
self.Multipliers.Weapons[weapon.class] = weapon.multiplier
end
end
end
if SERVER then
hook.Add( "Initialize", "InitWeapons", GM.LoadWeapons )
end
function GM:GetWeaponsByType(type)
local tbl = {}
for _, weap in pairs(self.Weapons) do
if weap.type == type then
table.insert(tbl,weap)
end
end
return tbl
end
function GM:GetWeaponByClass(str)
for _, weap in pairs(self.Weapons) do
if weap.class == str then
return weap
end
end
end |
-- ========== THIS IS AN AUTOMATICALLY GENERATED FILE! ==========
PlaceObj('XTemplate', {
group = "InGame",
id = "XIGMenu",
PlaceObj('XTemplateTemplate', {
'__template', "NewOverlayDlg",
'HostInParent', true,
}, {
PlaceObj('XTemplateAction', {
'ActionId', "close",
'ActionName', T(4523, --[[XTemplate XIGMenu ActionName]] "CLOSE"),
'ActionToolbar', "ActionBar",
'ActionShortcut', "Escape",
'ActionGamepad', "ButtonB",
'OnActionEffect', "close",
'IgnoreRepeated', true,
}),
PlaceObj('XTemplateTemplate', {
'__template', "DialogTitleNew",
'Margins', box(115, 0, 0, 0),
'Title', T(552944862587, --[[XTemplate XIGMenu Title]] "GAME OPTIONS"),
'SmallImage', true,
}),
PlaceObj('XTemplateWindow', {
'Margins', box(60, 40, 0, 0),
}, {
PlaceObj('XTemplateWindow', {
'__class', "XContentTemplateList",
'Id', "idList",
'Margins', box(39, 0, 0, 0),
'BorderWidth', 0,
'Padding', box(0, 0, 0, 0),
'LayoutVSpacing', 10,
'UniformRowHeight', true,
'Clip', false,
'Background', RGBA(0, 0, 0, 0),
'HandleMouse', false,
'FocusedBackground', RGBA(0, 0, 0, 0),
'VScroll', "idScroll",
'ShowPartialItems', false,
'MouseScroll', true,
}, {
PlaceObj('XTemplateFunc', {
'name', "OnShortcut(self, shortcut, source)",
'func', function (self, shortcut, source)
local prev_item = self.focused_item
local ret = XList.OnShortcut(self, shortcut, source)
if shortcut == "Down" and prev_item == #self then
self:SetSelection(1)
return "break"
elseif shortcut == "Up" and prev_item == 1 then
self:SetSelection(#self)
return "break"
end
return ret
end,
}),
PlaceObj('XTemplateAction', {
'ActionId', "idSaveGame",
'ActionName', T(11476, --[[XTemplate XIGMenu ActionName]] "Save Game"),
'ActionToolbar', "mainmenu",
'ActionState', function (self, host)
return (PlayWithoutStorage() or not not g_Tutorial) and "disabled"
end,
'OnActionEffect', "mode",
'OnActionParam', "Save",
}),
PlaceObj('XTemplateAction', {
'ActionId', "idLoadGame",
'ActionName', T(1009, --[[XTemplate XIGMenu ActionName]] "Load Game"),
'ActionToolbar', "mainmenu",
'ActionState', function (self, host)
return IsLoadButtonDisabled(host.context) and "disabled"
end,
'OnActionEffect', "mode",
'OnActionParam', "Load",
}),
PlaceObj('XTemplateAction', {
'ActionId', "idOptions",
'ActionName', T(11477, --[[XTemplate XIGMenu ActionName]] "Options"),
'ActionToolbar', "mainmenu",
'OnActionEffect', "mode",
'OnActionParam', "Options",
}),
PlaceObj('XTemplateAction', {
'ActionId', "idPhotoMode",
'ActionName', T(11478, --[[XTemplate XIGMenu ActionName]] "Photo Mode"),
'ActionToolbar', "mainmenu",
'OnAction', function (self, host, source)
CloseIngameMainMenu()
OpenPhotoMode()
end,
}),
PlaceObj('XTemplateTemplate', {
'__template', "CrashTest",
'IgnoreMissing', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "idEncyclopedia",
'ActionName', T(7384, --[[XTemplate XIGMenu ActionName]] "Encyclopedia"),
'ActionToolbar', "mainmenu",
'OnActionEffect', "mode",
'OnActionParam', "Encyclopedia",
}),
PlaceObj('XTemplateAction', {
'ActionId', "idAchievements",
'ActionName', T(697482021580, --[[XTemplate XIGMenu ActionName]] "Achievements"),
'ActionToolbar', "mainmenu",
'OnActionEffect', "mode",
'OnActionParam', "Achievements",
'__condition', function (parent, context) return not Platform.steam and not Platform.console end,
}),
PlaceObj('XTemplateAction', {
'ActionId', "idRestartMap",
'ActionName', T(1136, --[[XTemplate XIGMenu ActionName]] "Restart Map"),
'ActionToolbar', "mainmenu",
'OnAction', function (self, host, source)
CreateRealTimeThread(function()
if WaitMarsQuestion(nil, T(1136, "Restart Map"), T(1137, "Are you sure you want to restart the map?"), T(1138, "Yes"), T(1139, "No"), "UI/Messages/space.tga") == "ok" then
LoadingScreenOpen("idLoadingScreen", "restart map")
host:Close()
TelemetryRestartSession()
g_SessionSeed = g_InitialSessionSeed
if g_Tutorial then
CreateRealTimeThread(StartTutorial, g_Tutorial.Map)
elseif g_InitialRocketCargo and g_InitialCargoCost ~= 0 and g_InitialCargoWeight ~= 0 then
g_RocketCargo = g_InitialRocketCargo
g_CargoCost = g_InitialCargoCost
g_CargoWeight = g_InitialCargoWeight
GenerateCurrentRandomMap()
else
--premade maps
ReloadMap()
end
LoadingScreenClose("idLoadingScreen", "restart map")
end
end)
end,
}),
PlaceObj('XTemplateAction', {
'ActionId', "idMainMenu",
'ActionName', T(1010, --[[XTemplate XIGMenu ActionName]] "Main Menu"),
'ActionToolbar', "mainmenu",
'OnAction', function (self, host, source)
CreateRealTimeThread(function()
if WaitMarsQuestion(nil, T(6779, "Warning"), T(1141, "Exit to the main menu?"), T(1138, "Yes"), T(1139, "No"), "UI/Messages/space.tga") == "ok" then
LoadingScreenOpen("idLoadingScreen", "main menu")
host:Close()
OpenPreGameMainMenu()
LoadingScreenClose("idLoadingScreen", "main menu")
end
end)
end,
}),
PlaceObj('XTemplateAction', {
'ActionId', "idQuit",
'ActionName', T(11479, --[[XTemplate XIGMenu ActionName]] "Quit"),
'ActionToolbar', "mainmenu",
'OnAction', function (self, host, source)
QuitGame()
end,
'__condition', function (parent, context) return not Platform.console end,
}),
PlaceObj('XTemplateForEachAction', {
'toolbar', "mainmenu",
'run_after', function (child, context, action, n)
child:SetText(action.ActionName)
child.action = action
end,
}, {
PlaceObj('XTemplateTemplate', {
'__template', "MenuEntrySmall",
'TextStyle', "ListItem3",
}),
}),
}),
PlaceObj('XTemplateTemplate', {
'__template', "ScrollbarNew",
'Id', "idScroll",
'Target', "idList",
}),
}),
}),
})
|
local mmver = offsets.MMVersion
if mmver ~= 8 then
return 0
end
-- Disable original handler:
mem.asmpatch(0x44e355, "jmp 0x44e39d - 0x44e355")
----
local SpriteEventsStart = 20000
local Events = {}
local random = math.random
-------------------------------------------------------
-- Give apple
local FruitBowls = {"dec28", "7dec08"}
local function GiveApple(Eid)
local SpriteId = Eid - SpriteEventsStart
local Sprite = Map.Sprites[SpriteId]
evt.ForPlayer(0).Add{"Inventory", 655}
mapvars.ActiveSprites[SpriteId] = true
Sprite.Invisible = true
end
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
if table.find(FruitBowls, DecName) then
if ActiveSprites[i] then
Sprite.Invisible = true
else
Sprite.Event = SpriteEventsStart + i
evt.map[SpriteEventsStart + i] = GiveApple
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[287]
end
return true
end
end
-------------------------------------------------------
-- Skull piles
local SkullPileReq = {5,6,7,8}
local SkullPileCond = {"Weak","Cursed","Insane","Dead"}
local SkullPileHints = {[0] = 1750,1751,1752,1753,1754}
local function SkullPile(Eid)
if Game.CurrentPlayer < 0 then
return
end
local SpriteId = Eid - SpriteEventsStart
local Var = mapvars.ActiveSprites[SpriteId]
if Var == 0 then
Game.ShowStatusText(Game.NPCText[2128])
return
end
local Pl = Party[Game.CurrentPlayer]
local Skill, Mas = SplitSkill(Pl.Skills[const.Skills.Perception])
if Skill < SkullPileReq[Var] then
Game.ShowStatusText(Game.NPCText[2118])
evt[Game.CurrentPlayer].Set{SkullPileCond[Var], true}
else
mapvars.ActiveSprites[SpriteId] = 0
evt[0].GiveItem{1, 43, 0}
evt.hint[Eid] = Game.NPCTopic[SkullPileHints[0]]
end
end
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
if DecName == "sklplrev" then
local Seed = ActiveSprites[i]
if not Seed then
Seed = random(1,4)
ActiveSprites[i] = Seed
end
Sprite.Event = SpriteEventsStart + i
evt.map[SpriteEventsStart + i] = SkullPile
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[SkullPileHints[Seed]]
return true
end
end
-------------------------------------------------------
-- Crystals
-- puple, white, red, blue, breeze, purple, green, purple
local Crystals = {"crystl0", "crclstr", "crys5", "crys6", "dec09", "dec10", "dec11", "dec12"}
local CrystalItems = {2060, 2056, 2059, 2065, 2057, 2062, 2064, 2062}
local CrystalTopic = 1759
local function PlcCrystal(Eid)
local SpriteId = Eid - SpriteEventsStart
local Sprite = Map.Sprites[SpriteId]
local Var = Sprite.EventVariable
local CurPl = Game.CurrentPlayer > -1 and Game.CurrentPlayer or 0
if SplitSkill(Party[CurPl].Skills[const.Skills.Perception]) >= 7 then
evt[0].Add{"Inventory", CrystalItems[Var]}
Sprite.Invisible = true
evt.FaceAnimation{CurPl, const.FaceAnimation.Smile}
else
evt.FaceAnimation{CurPl, select(math.random(1,2), const.FaceAnimation.Tired, const.FaceAnimation.Beg)}
end
end
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
local Seed = table.find(Crystals, DecName)
if Seed then
Sprite.EventVariable = Seed
Sprite.Event = SpriteEventsStart + i
evt.map[SpriteEventsStart + i] = PlcCrystal
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[CrystalTopic]
return true
end
end
-------------------------------------------------------
-- Give item
local function ItemBucket(Eid)
local SpriteId = Eid - SpriteEventsStart
local Sprite = Map.Sprites[SpriteId]
if mapvars.ActiveSprites[SpriteId] then
Game.ShowStatusText(Game.NPCText[2135])
else
evt.GiveItem{1,Sprite.EventVariable}
mapvars.ActiveSprites[SpriteId] = true
end
end
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
if DecName == "Bucket" then
Sprite.Event = SpriteEventsStart + i
Sprite.EventVariable = 45 -- Reagent item type
evt.map[SpriteEventsStart + i] = ItemBucket
if ActiveSprites[i] then
evt.hint[SpriteEventsStart + i] = Game.NPCText[2135]
else
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[1755]
end
return true
end
end
local function ItemSprite(Eid)
local SpriteId = Eid - SpriteEventsStart
local Sprite = Map.Sprites[SpriteId]
local Var = Sprite.EventVariable
local Seed = math.random(2)
if Seed == 2 then
evt.ForPlayer("Current").GiveItem{1,Var}
else
Game.ShowStatusText(Game.NPCText[2123])
end
mapvars.ActiveSprites[SpriteId] = true
Sprite.Invisible = true
end
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
if DecName == "bag01" then
Sprite.Event = SpriteEventsStart + i
Sprite.EventVariable = 22 -- Misc item type
evt.map[SpriteEventsStart + i] = ItemSprite
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[1743]
Sprite.Invisible = ActiveSprites[i]
return true
end
end
-------------------------------------------------------
-- Treasure bag
local function TreasureBag(Eid)
local SpriteId = Eid - SpriteEventsStart
local Sprite = Map.Sprites[SpriteId]
local Seed = math.random(200)
if Seed > 50 then
evt.ForPlayer("Current").Add{"Gold", Seed}
else
Game.ShowStatusText(Game.NPCText[2123])
end
mapvars.ActiveSprites[SpriteId] = true
Sprite.Invisible = true
end
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
if DecName == "bag_A" then
Sprite.Event = SpriteEventsStart + i
evt.map[SpriteEventsStart + i] = TreasureBag
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[1747]
Sprite.Invisible = ActiveSprites[i]
return true
end
end
-------------------------------------------------------
---- Give food
local CampFires = {"ckfyr00", "cmpfyr00", "fire01", "7dec02", "dec24", "dec25"} -- "dec04"
local CampFireEvents = {285, 286}
local function GiveFood(Eid)
local SpriteId = Eid - SpriteEventsStart
local Sprite = Map.Sprites[SpriteId]
local Seed = math.random(4)
evt.Add{"Food", Seed}
mapvars.ActiveSprites[SpriteId] = true
Sprite.Invisible = true
end
-- Init
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
if table.find(CampFires, DecName) then
if ActiveSprites[i] then
Sprite.Invisible = true
else
Sprite.Event = SpriteEventsStart + i
evt.map[SpriteEventsStart + i] = GiveFood
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[CampFireEvents[1]]
end
return true
end
end
-------------------------------------------------------
---- Food bags
local function FoodBag(Eid)
local SpriteId = Eid - SpriteEventsStart
local Sprite = Map.Sprites[SpriteId]
local Seed = math.random(0,2)
if Seed > 0 then
evt.ForPlayer("Current").Add{"Food", Seed}
else
Game.ShowStatusText(Game.NPCText[2121])
end
mapvars.ActiveSprites[SpriteId] = true
Sprite.Invisible = true
end
-- Init
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
if DecName == "floursac" then
Sprite.Event = SpriteEventsStart + i
evt.map[SpriteEventsStart + i] = FoodBag
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[1741]
Sprite.Invisible = ActiveSprites[i]
return true
end
end
-------------------------------------------------------
-- Toggleable light sources
local LightSrcs = { Off = {"brzier00", "TrchB00"}, --, "6torch01"}
On = {"brazir2f", "nwtrchnf"}} --, "torchnf"}
local function FindLightSrc(SpriteId, Precision)
local X, Y, Z = Map.Sprites[SpriteId].X, Map.Sprites[SpriteId].Y, Map.Sprites[SpriteId].Z
local result = {{}, {}}
for i,v in Map.Lights do
if v.X >= X - Precision and v.X <= X + Precision
and v.Y >= Y - Precision and v.Y <= Y + Precision
and v.Z >= Z - Precision and v.Z <= Z + Precision then
table.insert(result[1], i)
end
end
for i,v in Map.SpriteLights do
if v.X >= X - Precision and v.X <= X + Precision
and v.Y >= Y - Precision and v.Y <= Y + Precision
and v.Z >= Z - Precision and v.Z <= Z + Precision then
table.insert(result[2], i)
end
end
return result
end
local function LightSrcOnOff(SpriteId, Var, OnOff)
Map.Sprites[SpriteId].DecName = LightSrcs[OnOff and "On" or "Off"][Var]
local SrcCon = mapvars.LightSrcsConns[SpriteId]
if not SrcCon then
SrcCon = FindLightSrc(SpriteId, 100)
mapvars.LightSrcsConns[SpriteId] = SrcCon
end
local L, SL = SrcCon[1], SrcCon[2]
if L then
for k,v in pairs(L) do
Map.Lights[v].Off = OnOff
end
end
if SL then
for k,v in pairs(SL) do
Map.SpriteLights[v].Radius = (not OnOff) and math.abs(Map.SpriteLights[v].Radius) or -Map.SpriteLights[v].Radius
end
end
end
local function ToggleLightSource(Eid)
local SpriteId = Eid - SpriteEventsStart
local Sprite = Map.Sprites[SpriteId]
local Var = Sprite.EventVariable
local OnOff = not mapvars.ActiveSprites[SpriteId]
mapvars.ActiveSprites[SpriteId] = OnOff
LightSrcOnOff(SpriteId, Var, not OnOff)
end
-- Init
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
local Seed = table.find(LightSrcs.On, DecName)
if Seed then
Sprite.EventVariable = Seed
Sprite.Event = SpriteEventsStart + i
evt.map[SpriteEventsStart + i] = ToggleLightSource
evt.hint[SpriteEventsStart + i] = Game.DecListBin[Map.Sprites[i].DecListId].GameName
if ActiveSprites[i] == false then
LightSrcOnOff(i, Seed, true)
else
ActiveSprites[i] = true
end
return true
end
end
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
local Seed = table.find(LightSrcs.Off, DecName)
if Seed then
Sprite.EventVariable = Seed
Sprite.Event = SpriteEventsStart + i
evt.map[SpriteEventsStart + i] = ToggleLightSource
evt.hint[SpriteEventsStart + i] = Game.DecListBin[Map.Sprites[i].DecListId].GameName
if ActiveSprites[i] then
LightSrcOnOff(i, Seed, false)
else
ActiveSprites[i] = false
end
return true
end
end
-------------------------------------------------------
-- Trash heap
local TrashHeaps = {"trasheap", "7dec01", "7dec10", "dec20", "dec23", "7dec11"}
local TrashHeapEvents = {[0] = 284, 281, 282, 283}
local DiseaseTexts = {726, 727, 728} -- "Diseased!", "Nothing here", "Poisoned!"
local function TrashHeap(Eid)
local SpriteId = Eid - SpriteEventsStart
local Seed = math.random(3)
evt.ForPlayer("Current")
if mapvars.ActiveSprites[SpriteId] then
if Seed > 2 and not evt.Cmp {"RepairSkill", 1} then
evt.Set{"DiseasedGreen", 0}
Game.ShowStatusText(Game.NPCText[DiseaseTexts[1]])
else
Game.ShowStatusText(Game.NPCText[DiseaseTexts[2]])
end
else
evt.GiveItem{Seed, 19 + Seed, 0}
if not evt.Cmp {"RepairSkill", 1} then
evt.Set{113 + Seed, 0}
Game.ShowStatusText(Game.NPCText[DiseaseTexts[Seed]])
end
mapvars.ActiveSprites[SpriteId] = true
evt.hint[Eid] = Game.NPCTopic[TrashHeapEvents[0]]
end
end
-- Init
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
if table.find(TrashHeaps, DecName) then
Sprite.Event = SpriteEventsStart + i
evt.map[SpriteEventsStart + i] = TrashHeap
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[TrashHeapEvents[0]]
return true
end
end
-------------------------------------------------------
-- Cauldron
local Cauldrons = {"dec26", "7dec03", "cauld00"}
local CauldronEvents = {[0] = 276, 279, 278, 280, 277}
local CauldronTexts = {[0] = 1494, 1497, 1496, 1498, 1495}
local CauldronResists = {1,2,3,0}
local CauldronABits = {24, 25, 26, 27}
local function Cauldron(Eid)
local SpriteId = Eid - SpriteEventsStart
local Sprite = Map.Sprites[SpriteId]
local Var = Sprite.EventVariable
local Res = Party[Game.CurrentPlayer or 0].Resistances[CauldronResists[Var]]
if mapvars.ActiveSprites[SpriteId] then
Game.ShowStatusText(Game.NPCText[CauldronTexts[0]])
else
Game.ShowStatusText(Game.NPCText[CauldronTexts[Var]])
Res.Base = Res.Base + 10
evt.Set{"AutonotesBits", CauldronABits[Var]}
evt.hint[Eid] = Game.NPCTopic[CauldronEvents[0]]
mapvars.ActiveSprites[SpriteId] = true
end
end
-- Init
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
if table.find(Cauldrons, DecName) then
Seed = random(#CauldronEvents)
Sprite.EventVariable = Seed
Sprite.Event = SpriteEventsStart + i
evt.map[SpriteEventsStart + i] = Cauldron
if ActiveSprites[i] then
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[CauldronEvents[0]]
else
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[CauldronEvents[Seed]]
end
return true
end
end
-------------------------------------------------------
-- Challenge
local ChallengesMM8 = {"dec40", "dec41", "dec42", "dec43"}
local ChallengesMM7 = {"dec60", "dec61", "dec62", "dec63"}
local ChallengeRewards = {3, 5, 7, 10}
local WinCh, FaultCh, AlWin, WinText = 734, 729, 733, nil
local ChallengeEvents = {{543, 545, 546, 544, 548, 547, 549}, -- Games
{550, 552, 553, 551, 555, 554, 556}, -- Contests
{557, 559, 560, 558, 562, 561, 563}, -- Tests
{564, 566, 567, 565, 569, 568, 570}} -- Challenges
local function Challenge(Eid)
local SpriteId = Eid - SpriteEventsStart
local Sprite = Map.Sprites[SpriteId]
local Var = Sprite.EventVariable
local ChType = math.floor(Var/100)
local ChSeed = Var - ChType*100
local CurPlayer = Party.PlayersIndexes[math.max(Game.CurrentPlayer, 0)]
vars.WonChallenges[CurPlayer] = vars.WonChallenges[CurPlayer] or {}
local CurWins = vars.WonChallenges[CurPlayer]
if CurWins[Var] then
Game.ShowStatusText(Game.NPCText[AlWin])
elseif evt.ForPlayer(math.max(Game.CurrentPlayer, 0)).Cmp{38 + ChSeed, 25*2^(ChType-1)} then
local Reward = ChallengeRewards[ChType] or 2+2^(ChType-1)
evt.ForPlayer("Current").Add{"SkillPoints", Reward}
Game.ShowStatusText(string.format(WinText, "+" .. Reward))
CurWins[Var] = true
else
Game.ShowStatusText(Game.NPCText[FaultCh])
end
end
-- Init
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
local Seed = table.find(ChallengesMM8, DecName) or table.find(ChallengesMM7, DecName)
if Seed then
local ChallengeType = ChallengeEvents[Seed]
local ChallengeSeed = mapvars.ActiveSprites[i] or random(#ChallengeType)
Sprite.EventVariable = ChallengeSeed + Seed*100
Sprite.Event = SpriteEventsStart + i
evt.map[SpriteEventsStart + i] = Challenge
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[ChallengeType[ChallengeSeed]]
ActiveSprites[i] = ChallengeSeed
return true
end
end
-------------------------------------------------------
-- Pedestal
local Pedestals = { {"dec44", "dec45", "dec46", "dec47", "dec48", "dec49", "dec50", "dec51", "dec52", "dec53", "dec54", "dec55"}, -- mm8 set
{"dec64", "dec65", "dec66", "dec67", "dec68", "dec69", "dec70", "dec71", "dec72", "dec73", "dec74", "dec75"} } -- mm7 set
local PedestalEvents = {531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542}
local PedestalSpells = {5, 36, 83, 17, 25, 3, 51, 8, 58, 69, 38, 14}
local function Pedestal(Eid)
local SpriteId = Eid - SpriteEventsStart
local Sprite = Map.Sprites[SpriteId]
local Var = Sprite.EventVariable
CastSpellDirect(PedestalSpells[Var], 5, 3)
end
-- Init
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
local Seed
for iL, v in ipairs(Pedestals) do
local Seed = table.find(v, DecName)
if Seed then
Sprite.EventVariable = Seed
Sprite.Event = SpriteEventsStart + i
evt.map[SpriteEventsStart + i] = Pedestal
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[PedestalEvents[Seed]]
return true
end
end
end
-------------------------------------------------------
-- Barrels
-- Might - Red,
-- Intellect - Orange,
-- Personality - Blue,
-- Endurance - Green,
-- Speed - Purple,
-- Accuracy - Yellow,
-- Luck - White
local Barrels = {"dec03", "7dec32", "smlbarel", "bigbarel"}
local BarrelEvents = {[0] = 268, 269, 272, 271, 273, 274, 270, 275}
local BarrelTexts = {[0] = 1486, 1487, 1490, 1489, 1491, 1492, 1488, 1493}
local BarrelABits = {17, 18, 19, 20, 22, 21, 23}
local function Barrel(Eid)
local SpriteId = Eid - SpriteEventsStart
if mapvars.ActiveSprites[SpriteId] == 0 then
Game.ShowStatusText(Game.NPCText[BarrelTexts[0]])
else
local Sprite = Map.Sprites[SpriteId]
local Var = Sprite.EventVariable
Game.ShowStatusText(Game.NPCText[BarrelTexts[Var]])
evt.ForPlayer("Current").Add{31 + Var, 5}
evt.Set{"AutonotesBits", BarrelABits[Var]}
mapvars.ActiveSprites[SpriteId] = 0
evt.hint[Eid] = Game.NPCTopic[BarrelEvents[0]]
end
end
-- Init
Events[#Events+1] = function(i, DecName, Sprite, ActiveSprites)
if table.find(Barrels, DecName) then
local Seed = ActiveSprites[i]
Seed = not Seed and random(#BarrelEvents) or Seed
mapvars.ActiveSprites[i] = Seed
Sprite.EventVariable = Seed
Sprite.Event = SpriteEventsStart + i
evt.map[SpriteEventsStart + i] = Barrel
if Seed == 0 or Seed == true then
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[BarrelEvents[0]]
else
evt.hint[SpriteEventsStart + i] = Game.NPCTopic[BarrelEvents[Seed]]
end
return true
end
end
-------------------------------------------------------
---- Initializtion
local function Init()
mapvars.LightSrcsConns = mapvars.LightSrcsConns or {}
mapvars.LightSrcsConns[1] = mapvars.LightSrcsConns[1] or {}
mapvars.LightSrcsConns[2] = mapvars.LightSrcsConns[2] or {}
mapvars.ActiveSprites = mapvars.ActiveSprites or {}
WinText = WinText or string.replace(Game.NPCText[WinCh], " +3", "%s")
vars.WonChallenges = vars.WonChallenges or {}
local ActiveSprites = mapvars.ActiveSprites
for i = 0, Map.Sprites.count - 1 do
local Sprite = Map.Sprites[i]
local DecName = Sprite.DecName
if Sprite.Event == 0 then
for k,v in pairs(Events) do
if v(i, DecName, Sprite, ActiveSprites) then
break
end
end
end
end
end
function events.LoadMap()
Init()
end
Game.ReInitSprites = Init
|
require'diffview'.setup{}
|
local class = require 'middleclass'
local Mesh = require 'core/graphics/Mesh'
local Texture = require 'core/graphics/Texture'
local mesh = Mesh:load(here('Scene.json'), 'Orbot')
local normal = Texture:load{fileName=here('Normal.png')}
local color = Texture:load{fileName=here('Color.png'), colorSpace='srgb'}
local roughness = Texture:load{fileName=here('Roughness.png')}
local metallic = Texture:load{fileName=here('Metallic.png')}
local Orbot = class(here())
function Orbot:initialize( modelWorld )
self.model = modelWorld:createModel('world')
self.model:setMesh(mesh)
self.model:setProgramFamily('brdf')
self.model.shaderVariables:set('NormalSampler', normal)
self.model.shaderVariables:set('ColorSampler', color)
self.model.shaderVariables:set('RoughnessSampler', roughness)
self.model.shaderVariables:set('MetallicSampler', metallic)
end
return Orbot
|
-- The buy function
function buyShopItem (itemid, ammo, itemprice)
--if ( exports.CSGgift:getChristmasDay() == "Day25" ) then itemprice = 0 end
local playerMoney = getPlayerMoney(source)
if (playerMoney < tonumber(itemprice)) then
exports.NGCdxmsg:createNewDxMessage(source, "You dont have enough money for this item!", 200, 0, 0)
else
takePlayerMoney ( source, tonumber(itemprice) )
giveWeapon ( source, tonumber(itemid), tonumber(ammo), true )
end
end
addEvent ("buyShopItem", true)
addEventHandler ("buyShopItem", getRootElement(), buyShopItem) |
local guids = require 'exports.mswindows.guids'
local subtypes = {
MEDIASUBTYPE_A2B10G10R10 = guids.guid '576f7893-bdf6-48c4-875f-ae7b81834567';
MEDIASUBTYPE_A2R10G10B10 = guids.guid '2f8bb76d-b644-4550-acf3-d30caa65d5c5';
MEDIASUBTYPE_AI44 = guids.guid '34344941-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_AIFF = guids.guid "e436eb8d-524f-11ce-9f53-0020af0ba770";
MEDIASUBTYPE_AnalogVideo_NTSC_M = guids.guid '0482dde2-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_NTSC_M_J = guids.guid '0482dde3-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_NTSC_50 = guids.guid '0482dde4-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_PAL_B = guids.guid '0482dde5-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_PAL_D = guids.guid '0482dde6-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_PAL_G = guids.guid '0482dde7-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_PAL_H = guids.guid '0482dde8-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_PAL_I = guids.guid '0482dde9-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_PAL_M = guids.guid '0482ddea-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_PAL_N = guids.guid '0482ddeb-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_PAL_N_COMBO = guids.guid '0482ddec-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_PAL_60 = guids.guid '0482ddec-7817-11cf-8a03-00aa006ecb65'; -- same as PAL_N_COMBO
MEDIASUBTYPE_AnalogVideo_PAL_NC = guids.guid '0482dded-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_SECAM_B = guids.guid '0482ddf0-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_SECAM_D = guids.guid '0482ddf1-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_SECAM_G = guids.guid '0482ddf2-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_SECAM_H = guids.guid '0482ddf3-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_SECAM_K = guids.guid '0482ddf4-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_SECAM_K1 = guids.guid '0482ddf5-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_AnalogVideo_SECAM_L = guids.guid '0482ddf6-7817-11cf-8a03-00aa006ecb65';
MEDIASUBTYPE_ARGB1555 = guids.guid '297c55af-e209-4cb3-b757-c76d6b9c88a8';
MEDIASUBTYPE_ARGB1555_D3D_DX7_RT = guids.guid '35314137-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_ARGB1555_D3D_DX9_RT = guids.guid '35314139-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_ARGB32 = guids.guid '773c9ac0-3274-11d0-b72400aa006c1a01';
MEDIASUBTYPE_ARGB32_D3D_DX7_RT = guids.guid '38384137-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_ARGB32_D3D_DX9_RT = guids.guid '38384139-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_ARGB4444 = guids.guid '6e6415e6-5c24-425f-93cd-80102b3d1cca';
MEDIASUBTYPE_ARGB4444_D3D_DX7_RT = guids.guid '34344137-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_ARGB4444_D3D_DX9_RT = guids.guid '34344139-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_Asf = guids.guid '3DB80F90-9412-11d1-ADED-0000F8754B99';
MEDIASUBTYPE_ATSC_SI = guids.guid 'b3c7397c-d303-414d-b33c-4ed2c9d29733';
MEDIASUBTYPE_AU = guids.guid "e436eb8c-524f-11ce-9f53-0020af0ba770";
MEDIASUBTYPE_AVC1 = guids.guid '31435641-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_Avi = guids.guid 'e436eb88-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_AYUV = guids.guid '56555941-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_CFCC = guids.guid '43434643-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_CLJR = guids.guid '524a4c43-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_CLPL = guids.guid '4C504C43-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_CPLA = guids.guid '414c5043-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_DOLBY_AC3 = guids.guid 'e06d802c-db46-11cf-b4d1-00805f6cbbea';
MEDIASUBTYPE_Dolby_AC3 = guids.guid 'e06d802c-db46-11cf-b4d1-00805f6cbbea'; -- same as DOLBY_AC3
MEDIASUBTYPE_DOLBY_AC3_SPDIF = guids.guid "00000092-0000-0010-8000-00aa00389b71";
MEDIASUBTYPE_DOLBY_DDPLUS = guids.guid "a7fb87af-2d02-42fb-a4d4-05cd93843bdd";
MEDIASUBTYPE_DOLBY_TRUEHD = guids.guid 'eb27cec4-163e-4ca3-8b74-8e25f91b517e';
MEDIASUBTYPE_DRM_Audio = guids.guid "00000009-0000-0010-8000-00aa00389b71";
MEDIASUBTYPE_DRM = guids.guid "00000009-0000-0010-8000-00aa00389b71"; -- same as DRM_Audio
MEDIASUBTYPE_DssAudio = guids.guid 'A0AF4F82-E163-11d0-BAD9-00609744111A';
MEDIASUBTYPE_DssVideo = guids.guid 'A0AF4F81-E163-11d0-BAD9-00609744111A';
MEDIASUBTYPE_DTS = guids.guid 'e06d8033-db46-11cf-b4d1-00805f6cbbea';
MFAudioFormat_DTS = guids.guid "00000008-0000-0010-8000-00aa00389b71"; -- only MFAudioFormat that manages to be different
MEDIASUBTYPE_DTS2 = guids.guid '00002001-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_DTS_HD = guids.guid 'a2e58eb7-0fa9-48bb-a40c-fa0e156d0645';
MEDIASUBTYPE_dv25 = guids.guid '35327664-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_dv50 = guids.guid '30357664-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_DVB_SI = guids.guid 'e9dd31a3-221d-4adb-8532-9af309c1a408';
MEDIASUBTYPE_DVCS = guids.guid '53435644-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_DVD_LPCM_AUDIO = guids.guid 'e06d8032-db46-11cf-b4d1-00805f6cbbea';
MEDIASUBTYPE_DVD_NAVIGATION_DSI = guids.guid 'e06d8030-db46-11cf-b4d1-00805f6cbbea';
MEDIASUBTYPE_DVD_NAVIGATION_PCI = guids.guid 'e06d802f-db46-11cf-b4d1-00805f6cbbea';
MEDIASUBTYPE_DVD_NAVIGATION_PROVIDER = guids.guid 'e06d8031-db46-11cf-b4d1-00805f6cbbea';
MEDIASUBTYPE_DVD_SUBPICTURE = guids.guid 'e06d802d-db46-11cf-b4d1-00805f6cbbea';
MEDIASUBTYPE_dvh1 = guids.guid '31687664-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_dvhd = guids.guid '64687664-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_DVM = guids.guid '00002000-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_DVSD = guids.guid '44535644-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_dvsd = guids.guid '64737664-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_dvsl = guids.guid '6c737664-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_h264 = guids.guid '34363268-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_H264_ES = guids.guid '3f40f4f0-5622-4ff8-b6d8-a17a584bee5e';
MEDIASUBTYPE_I420 = guids.guid '30323449-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_IA44 = guids.guid '34344149-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_IEEE_FLOAT = guids.guid '00000003-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_Float = guids.guid '00000003-0000-0010-8000-00aa00389b71'; -- same as IEEE_FLOAT
MEDIASUBTYPE_IF09 = guids.guid '39304649-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_IJPG = guids.guid '47504A49-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_IMC1 = guids.guid '31434D49-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_IMC2 = guids.guid '32434D49-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_IMC3 = guids.guid '33434D49-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_IMC4 = guids.guid '34434D49-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_IYUV = guids.guid '56555949-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_Line21_BytePair = guids.guid '6E8D4A22-310C-11d0-B79A-00AA003767A7';
MEDIASUBTYPE_Line21_GOPPacket = guids.guid '6E8D4A23-310C-11d0-B79A-00AA003767A7';
MEDIASUBTYPE_Line21_VBIRawData = guids.guid '6E8D4A24-310C-11d0-B79A-00AA003767A7';
MEDIASUBTYPE_M4S2 = guids.guid '3253344D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_m4s2 = guids.guid '3273346D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_MDVF = guids.guid '4656444D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_MJPG = guids.guid '47504A4D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_MP3 = guids.guid '00000055-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_MP42 = guids.guid '3234504D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_mp42 = guids.guid '3234706D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_MP43 = guids.guid '3334504D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_mp43 = guids.guid '3334706D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_MP4S = guids.guid '5334504D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_mp4s = guids.guid '7334706D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_MPEG1Audio = guids.guid 'e436eb87-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_MPEG1AudioPayload = guids.guid '00000050-0000-0010-8000-00AA00389B71';
MEDIASUBTYPE_MPEG = guids.guid '00000050-0000-0010-8000-00AA00389B71'; -- same as MPEG1AudioPayload
MEDIASUBTYPE_MPEG1Packet = guids.guid 'e436eb80-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_MPEG1Payload = guids.guid 'e436eb81-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_MPEG1System = guids.guid 'e436eb84-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_MPEG1Video = guids.guid 'e436eb86-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_MPEG1VideoCD = guids.guid 'e436eb85-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_MPEG2_AUDIO = guids.guid 'e06d802b-db46-11cf-b4d1-00805f6cbbea';
MEDIASUBTYPE_MPEG2_PROGRAM = guids.guid 'e06d8022-db46-11cf-b4d1-00805f6cbbea';
MEDIASUBTYPE_MPEG2_TRANSPORT = guids.guid 'e06d8023-db46-11cf-b4d1-00805f6cbbea';
MEDIASUBTYPE_MPEG2_TRANSPORT_STRIDE = guids.guid '138AA9A4-1EE2-4c5b-988E-19ABFDBC8A11';
MEDIASUBTYPE_MPEG2_VIDEO = guids.guid 'e06d8026-db46-11cf-b4d1-00805f6cbbea';
MEDIASUBTYPE_MPEG2DATA = guids.guid 'C892E55B-252D-42b5-A316-D997E7A5D995';
MEDIASUBTYPE_MPEG_ADTS_AAC = guids.guid '00001600-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_ADTS = guids.guid '00001600-0000-0010-8000-00aa00389b71'; -- same as MPEG_ADTS_AAC
MEDIASUBTYPE_MPEG_HEAAC = guids.guid '00001610-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_AAC = guids.guid '00001610-0000-0010-8000-00aa00389b71'; -- same as MPEG_HEAAC
MEDIASUBTYPE_MPEG_LOAS = guids.guid '00001602-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_MPEG_RAW_AAC = guids.guid '00001601-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_MPG4 = guids.guid '3447504D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_mpg4 = guids.guid '3467706D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_MSAUDIO1 = guids.guid '00000160-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_MSP1 = guids.guid '0000000a-0000-0010-8000-00aa00389b71'; -- WMA9 voice codec
MEDIASUBTYPE_MSS1 = guids.guid '3153534D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_MSS2 = guids.guid '3253534D-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_NOKIA_MPEG_ADTS_AAC = guids.guid '00001608-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_NOKIA_MPEG_RAW_AAC = guids.guid '00001609-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_None = guids.guid 'e436eb8e-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_NV11 = guids.guid '3131564E-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_NV12 = guids.guid '3231564E-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_Overlay = guids.guid 'e436eb7f-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_PCM = guids.guid '00000001-0000-0010-8000-00AA00389B71';
MEDIASUBTYPE_PCMAudio_Obsolete = guids.guid 'e436eb8a-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_Plum = guids.guid '6D756C50-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_QCELP = guids.guid '5E7F6D41-B115-11D0-BA91-00805FB4B97E';
MEDIASUBTYPE_QTJpeg = guids.guid '6765706a-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_QTMovie = guids.guid 'e436eb89-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_QTRle = guids.guid '20656c72-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_QTRpza = guids.guid '617a7072-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_QTSmc = guids.guid '20636d73-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_RAW_AAC1 = guids.guid '000000FF-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_RAW_SPORT = guids.guid "00000240-0000-0010-8000-00aa00389b71";
MEDIASUBTYPE_RGB1 = guids.guid 'e436eb78-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_RGB16_D3D_DX7_RT = guids.guid '36315237-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_RGB16_D3D_DX9_RT = guids.guid '36315239-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_RGB24 = guids.guid 'e436eb7d-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_RGB32 = guids.guid 'e436eb7e-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_RGB32_D3D_DX7_RT = guids.guid '32335237-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_RGB32_D3D_DX9_RT = guids.guid '32335239-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_RGB4 = guids.guid 'e436eb79-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_RGB555 = guids.guid 'e436eb7c-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_RGB565 = guids.guid 'e436eb7b-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_RGB8 = guids.guid 'e436eb7a-524f-11ce-9f53-0020af0ba770';
MEDIASUBTYPE_S340 = guids.guid '30343353-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_S342 = guids.guid '32343353-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_SDDS = guids.guid 'e06d8034-db46-11cf-b4d1-00805f6cbbea';
MEDIASUBTYPE_SPDIF_TAG_241h = guids.guid "00000241-0000-0010-8000-00aa00389b71";
MEDIASUBTYPE_TELETEXT = guids.guid 'f72a76e3-eb0a-11d0-ace4-0000c0cc16ba';
MEDIASUBTYPE_TVMJ = guids.guid '4A4D5654-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_UYVY = guids.guid '59565955-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_v210 = guids.guid '30313276-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_V216 = guids.guid '36313256-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_V410 = guids.guid '30313456-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_VODAFONE_MPEG_ADTS_AAC = guids.guid '0000160A-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_VODAFONE_MPEG_RAW_AAC = guids.guid '0000160B-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_VPS = guids.guid 'a1b3f620-9792-4d8d-81a4-86af25772090';
MEDIASUBTYPE_VPVBI = guids.guid '5A9B6A41-1A22-11D1-BAD9-00609744111A';
MEDIASUBTYPE_VPVideo = guids.guid '5a9b6a40-1a22-11d1-bad9-00609744111a';
MEDIASUBTYPE_WAKE = guids.guid '454B4157-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WAVE = guids.guid "e436eb8b-524f-11ce-9f53-0020af0ba770";
MEDIASUBTYPE_WMASPDIF = guids.guid '00000164-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WMAUDIO2 = guids.guid '00000161-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WMAudioV8 = guids.guid '00000161-0000-0010-8000-00aa00389b71'; -- same as WMAUDIO2
MEDIASUBTYPE_WMAUDIO3 = guids.guid '00000162-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WMAudioV9 = guids.guid '00000162-0000-0010-8000-00aa00389b71'; -- same as WMAUDIO3
MEDIASUBTYPE_WMAUDIO_LOSSLESS = guids.guid '00000163-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WMAudio_Lossless = guids.guid '00000163-0000-0010-8000-00aa00389b71'; -- same as WMAUDIO_LOSSLESS
MEDIASUBTYPE_WMAUDIO4 = guids.guid '00000168-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WMSP2 = guids.guid '0000000b-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WMV1 = guids.guid '31564D57-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_wmv1 = guids.guid '31766D77-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WMV2 = guids.guid '32564D57-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_wmv2 = guids.guid '32766D77-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WMV3 = guids.guid '33564D57-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_wmv3 = guids.guid '33766D77-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WMVA = guids.guid '41564D57-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_wmva = guids.guid '61766D77-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WMVB = guids.guid '42564D57-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_wmvb = guids.guid '62766D77-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WMVP = guids.guid '50564D57-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_wmvp = guids.guid '70766D77-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WMVR = guids.guid '52564D57-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_wmvr = guids.guid '72766D77-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WSS = guids.guid '2791D576-8E7A-466F-9E90-5D3F3083738B';
MEDIASUBTYPE_WVC1 = guids.guid '31435657-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_wvc1 = guids.guid '31637677-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_WVP2 = guids.guid '32505657-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_wvp2 = guids.guid '32707677-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_X264 = guids.guid '34363258-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_x264 = guids.guid '34363278-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_Y211 = guids.guid '31313259-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_Y411 = guids.guid '31313459-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_Y41P = guids.guid '50313459-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_Y41T = guids.guid '54313459-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_Y42T = guids.guid '54323459-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_YUY2 = guids.guid '32595559-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_YUYV = guids.guid '56595559-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_YV12 = guids.guid '32315659-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_YVU9 = guids.guid '39555659-0000-0010-8000-00aa00389b71';
MEDIASUBTYPE_YVYU = guids.guid '55595659-0000-0010-8000-00aa00389b71';
}
local reversed = {}
for k,v in pairs(subtypes) do
reversed[tostring(v)] = k
end
for k,v in pairs(reversed) do
subtypes[k] = v
end
return subtypes
|
-- Requirement summary:
-- [Data Resumption]: Data resumption on Unexpected Disconnect
--
-- Description:
-- Check that SDL perform resumption after heartbeat disconnect.
-- 1. Used precondition
-- In smartDeviceLink.ini file HeartBeatTimeout parameter is:
-- HeartBeatTimeout = 7000.
-- App is registerer and activated on HMI.
-- App has added 1 sub menu, 1 command and 1 choice set.
--
-- 2. Performed steps
-- Wait 20 seconds.
-- Register App with hashId.
--
-- Expected behavior:
-- 1. SDL sends OnAppUnregistered to HMI.
-- 2. App is registered and SDL resumes all App data, sends BC.ActivateApp to HMI, app gets FULL HMI level.
---------------------------------------------------------------------------------------------------
--[[ General Precondition before ATF start ]]
config.defaultProtocolVersion = 3
config.application1.registerAppInterfaceParams.isMediaApplication = true
-- [[ Required Shared Libraries ]]
local commonFunctions = require('user_modules/shared_testcases/commonFunctions')
local commonSteps = require('user_modules/shared_testcases/commonSteps')
local commonStepsResumption = require('user_modules/shared_testcases/commonStepsResumption')
local mobile_session = require('mobile_session')
local events = require("events")
--[[ General Settings for configuration ]]
Test = require('user_modules/dummy_connecttest')
require('cardinalities')
require('user_modules/AppTypes')
-- [[Local variables]]
local default_app_params = config.application1.registerAppInterfaceParams
-- [[Local functions]]
local function connectMobile(self)
self.mobileConnection:Connect()
return EXPECT_EVENT(events.connectedEvent, "Connected")
end
local function delayedExp(pTime, self)
local event = events.Event()
event.matches = function(e1, e2) return e1 == e2 end
EXPECT_HMIEVENT(event, "Delayed event")
:Timeout(pTime + 5000)
local function toRun()
event_dispatcher:RaiseEvent(self.hmiConnection, event)
end
RUN_AFTER(toRun, pTime)
end
--[[ Preconditions ]]
commonFunctions:newTestCasesGroup("Preconditions")
commonSteps:DeletePolicyTable()
commonSteps:DeleteLogsFiles()
function Test:StartSDL_With_One_Activated_App()
self:runSDL()
commonFunctions:waitForSDLStart(self):Do(function()
self:initHMI():Do(function()
commonFunctions:userPrint(35, "HMI initialized")
self:initHMI_onReady():Do(function ()
commonFunctions:userPrint(35, "HMI is ready")
connectMobile(self):Do(function ()
commonFunctions:userPrint(35, "Mobile Connected")
self:startSession():Do(function ()
commonFunctions:userPrint(35, "App is registered")
commonSteps:ActivateAppInSpecificLevel(self, self.applications[default_app_params.appName])
EXPECT_NOTIFICATION("OnHMIStatus", {hmiLevel = "FULL",audioStreamingState = "AUDIBLE", systemContext = "MAIN"})
commonFunctions:userPrint(35, "App is activated")
end)
end)
end)
end)
end)
end
function Test.AddCommand()
commonStepsResumption:AddCommand()
end
function Test.AddSubMenu()
commonStepsResumption:AddSubMenu()
end
function Test.AddChoiceSet()
commonStepsResumption:AddChoiceSet()
end
--[[ Test ]]
commonFunctions:newTestCasesGroup("Check that SDL perform resumption after heartbeat disconnect")
function Test:Wait_20_sec()
self.mobileSession:StopHeartbeat()
EXPECT_HMINOTIFICATION("BasicCommunication.OnAppUnregistered", {appID = self.applications[default_app_params], unexpectedDisconnect = true })
:Timeout(20000)
EXPECT_EVENT(events.disconnectedEvent, "Disconnected")
:Times(0)
delayedExp(20000, self)
end
function Test:Register_And_Resume_App_And_Data()
local mobileSession = mobile_session.MobileSession(self, self.mobileConnection)
local on_rpc_service_started = mobileSession:StartRPC()
on_rpc_service_started:Do(function()
default_app_params.hashID = self.currentHashID
commonStepsResumption:Expect_Resumption_Data(default_app_params)
commonStepsResumption:RegisterApp(default_app_params, commonStepsResumption.ExpectResumeAppFULL, true)
end)
end
-- [[ Postconditions ]]
commonFunctions:newTestCasesGroup("Postcondition")
function Test.Stop_SDL()
StopSDL()
end
return Test
|
-----------------------------------
-- Area: Mamook
-- Mob: Darting Kachaal Ja
-----------------------------------
function onMobDeath(mob, player, isKiller)
end
|
local expect, printed = require'rx-test'()
local rx, _ = require'rx'()
describe('Pipe Function', function()
describe('pipe', function()
it('handles no operator', function()
local test_ = rx.of('hello').pipe()
--
expect(test_).to.produce('hello')
end)
it('handles single log operator', function()
local test_ = rx.of('hello').pipe(_.log())
--
expect(test_).to.produce('hello')
printed(1)
end)
it('handles double log operators', function()
local test_ = rx.of('hello').pipe(_.log(), _.log())
--
expect(test_).to.produce('hello')
printed(2)
end)
it('allows a table of operators', function()
local test_ = rx.of('hello').pipe({_.log(), _.log()})
--
expect(test_).to.produce('hello')
printed(2)
end)
it('orders operators properly', function()
local test_ = rx.of('hello')
.pipe({
_.log(),
_.map(function(str) return str .. ' world' end),
_.log(),
_.map(function(str) return str .. ' again' end),
_.log(),
})
--
expect(test_).to.produce('hello world again')
printed(3)
end)
it('handles custom operators', function()
local double = function(num) return num*2 end
local doubleMap = function()
return function(source)
return source.pipe({
_.map(double),
_.log(),
_.map(double),
})
end
end
--
local test_ = rx.of(2).pipe(doubleMap())
--
expect(test_).to.produce(8)
printed(1)
end)
end)
end)
|
return Class({
BaseName = "Base",
Children = {},
Parent = nil,
Color = {1, 1, 1, 1},
Position = {0, 0, 0, 0},
Size = {0, 0, 32, 32},
GlobalAlpha = 1,
Enable = true,
LineWidth = 3,
LineColor = {.5, .5, .5, 1},
Init = function (self, c)
c.Children = {}
return c
end,
Limit = {},
AddChild = function (self, child)
assert(type(child) == "table", "Wrong type of Child")
self.Children[child.Name] = child
rawset(child, "Parent", self)
end,
RemoveChild = function (self, child)
assert(type(child) == "table" or type(child) == "string", "Wrong type of Child")
local name = (type(child) == "string") and child or (child.Name)
local child = self.Children[name]
child.Parent = nil
self.Children[name] = nil
end,
FindChild = function (self, name)
return self.Children[name]
end,
ClearChildren = function (self)
for k, _ in pairs(self.Children) do
self.Children[k] = nil
end
end,
GetChildren = function (self)
return rawget(self, "Children")
end,
GetParent = function (self)
return rawget(self, "Parent")
end,
OnUpdate = function (self, dt) end,
Update = function (self, dt)
self.Limit = self:GetRoot().Size
if self.Enable then
for _, v in pairs(self:GetChildren()) do
v:Update(dt)
end
self:OnUpdate(dt)
end
end,
OnDraw = function (self, alpha) end,
Draw = function (self, alpha)
for _, v in pairs(self:GetChildren()) do
v:Draw(alpha or self.GlobalAlpha)
end
self:OnDraw(alpha or self.GlobalAlpha)
end,
KeyPressed = function (self, key) end,
KeyReleased = function (self, key) end,
MousePressed = function (self, x, y, btn) end,
MouseReleased = function (self, x, y, btn) end,
Show = function (self)
self.GlobalAlpha = 1
end,
Unshow = function (self)
self.GlobalAlpha = 0
end,
GetRoot = function (self)
local root = self
while root.Parent do
root = root.Parent
end
return root
end,
GetX = function (self)
return self.Position[1] * self.Limit[3] + self.Position[3]
end,
GetY = function (self)
return self.Position[2] * self.Limit[4] + self.Position[4]
end,
GetPosition = function (self)
return self:GetX(), self:GetY()
end,
GetWidth = function (self)
return self.Size[1] * self.Limit[3] + self.Size[3]
end,
GetHeight = function (self)
return self.Size[2] * self.Limit[4] + self.Size[4]
end,
GetSize = function (self)
return self:GetWidth(), self:GetHeight()
end
}, "Base") |
local PANEL = {}
AccessorFunc( PANEL, "m_strType", "Type" )
AccessorFunc( PANEL, "m_ConVars", "ConVars" )
AccessorFunc( PANEL, "m_PresetControl", "PresetControl" )
--[[---------------------------------------------------------
Name: Init
-----------------------------------------------------------]]
function PANEL:Init()
-- This needs to be drawn on top of the spawn menu..
self:SetDrawOnTop( true )
self:SetSize( 450, 350 )
self:SetTitle( "Preset Editor" )
self.PresetList = vgui.Create( "DListBox", self )
self.pnlEditor = vgui.Create( "DPanel", self )
self.pnlDetails = vgui.Create( "DPanel", self.pnlEditor )
self.pnlModify = vgui.Create( "DPanel", self.pnlEditor )
-- TODO: ICON!
self.btnDelete = vgui.Create( "DButton", self.pnlModify )
self.btnDelete.DoClick = function() self:Delete() end
self.btnDelete:SetText( "#Delete" )
self.txtRename = vgui.Create( "DTextEntry", self.pnlModify )
self.btnRename = vgui.Create( "DButton", self.pnlModify )
self.btnRename:SetText( "#Rename" )
self.btnRename.DoClick = function() self:Rename() end
self.pnlAdd = vgui.Create( "DPanel", self )
self.txtName = vgui.Create( "DTextEntry", self.pnlAdd )
self.btnAdd = vgui.Create( "DButton", self.pnlAdd )
self.btnAdd:SetText( "#Add Preset" )
self.btnAdd.DoClick = function() self:Add() end
self.pnlClose = vgui.Create( "DPanel", self )
self.btnCloseIt = vgui.Create( "DButton", self.pnlClose )
self.btnCloseIt:SetText( "#Close" )
self.btnCloseIt.DoClick = function() self:Remove() end
end
--[[---------------------------------------------------------
Name: SetType
-----------------------------------------------------------]]
function PANEL:SetType( strType )
self.m_strType = strType
self:Update()
end
--[[---------------------------------------------------------
Name: Update
-----------------------------------------------------------]]
function PANEL:Update()
self.PresetList:Clear()
local Presets = presets.GetTable( self.m_strType )
local sortedPresets, i = {}, 1
for name in pairs( Presets ) do
sortedPresets[i] = name
i = i + 1
end
table.sort( sortedPresets )
for _, name in ipairs( sortedPresets ) do
local item = self.PresetList:AddItem( name )
item.Data = Presets[name]
end
end
--[[---------------------------------------------------------
Name: PerformLayout
-----------------------------------------------------------]]
function PANEL:PerformLayout()
DFrame.PerformLayout( self )
self.pnlClose:SetSize( 100, 30 )
self.pnlClose:AlignRight( 10 )
self.pnlClose:AlignBottom( 10 )
self.btnCloseIt:StretchToParent( 5, 5, 5, 5 )
self.pnlAdd:StretchToParent( 10, 10, 10, 10 )
self.pnlAdd:CopyHeight( self.pnlClose )
self.pnlAdd:AlignBottom( 10 )
self.pnlAdd:StretchRightTo( self.pnlClose, 10 )
self.btnAdd:SetSize( 80, 20 )
self.btnAdd:AlignRight( 5 )
self.btnAdd:CenterVertical()
self.txtName:SetPos( 5, 5 )
self.txtName:StretchRightTo( self.btnAdd, 5 )
self.txtName:CenterVertical()
self.PresetList:StretchToParent( 10, 30, 5, 5 )
self.PresetList:StretchBottomTo( self.pnlAdd, 10 )
self.PresetList:SetWide( 130 )
self.pnlEditor:CopyBounds( self.PresetList )
self.pnlEditor:MoveRightOf( self.PresetList, 5 )
self.pnlEditor:StretchToParent( nil, nil, 10, nil )
self.pnlModify:StretchToParent( 5, 5, 5, 5 )
self.pnlModify:SetTall( 30 )
self.pnlModify:AlignBottom( 5 )
self.btnDelete:SetSize( 40, 20 )
self.btnDelete:AlignRight( 5 )
self.btnDelete:CenterVertical()
self.btnRename:SetSize( 50, 20 )
self.btnRename:MoveLeftOf( self.btnDelete, 5 )
self.btnRename:CenterVertical()
self.txtRename:StretchToParent( 5, 5, 5, 5 )
self.txtRename:StretchRightTo( self.btnRename, 5 )
self.pnlDetails:CopyBounds( self.pnlModify )
self.pnlDetails:AlignTop( 5 )
self.pnlDetails:StretchBottomTo( self.pnlModify, 5 )
end
function PANEL:Delete()
local Selected = self.PresetList:GetSelectedValues()
if ( !Selected ) then return end
presets.Remove( self.m_strType, Selected )
self:Update()
if ( self.m_PresetControl ) then
self.m_PresetControl:Update()
end
end
function PANEL:Rename()
local Selected = self.PresetList:GetSelectedValues()
if (!Selected) then return end
local ToName = self.txtRename:GetValue()
if ( !ToName || ToName == "" ) then return end
-- Todo, Handle name collision
presets.Rename( self.m_strType, Selected, ToName )
self:Update()
self.PresetList:SelectByName( ToName )
self.txtRename:SetText( "" )
if ( self.m_PresetControl ) then
self.m_PresetControl:Update()
end
end
function PANEL:Add()
if ( !self.m_ConVars ) then return end
local ToName = self.txtName:GetValue()
if ( !ToName || ToName == "" ) then return end
-- Todo, Handle name collision
local tabValues = {}
for k, v in pairs( self.m_ConVars ) do
tabValues[ v ] = GetConVarString( v )
end
presets.Add( self.m_strType, ToName, tabValues )
self:Update()
self.PresetList:SelectByName( ToName )
self.txtName:SetText( "" )
if ( self.m_PresetControl ) then
self.m_PresetControl:Update()
end
end
vgui.Register( "PresetEditor", PANEL, "DFrame" )
|
local playerReducer = require('reducers/player')
local cameraReducer = require('reducers/camera')
local mapReducer = require('reducers/map')
function combine(state, action)
state = state or {}
return {
player = playerReducer(state.player, action),
camera = cameraReducer(state.camera, action),
map = mapReducer(state.map, action),
}
end
return combine
|
local ngx_log = ngx.log
local ngx_DEBUG = ngx.DEBUG
local ngx_ERR = ngx.ERR
local zedcup = require("zedcup")
local GLOBALS = zedcup.globals()
local DEBUG = GLOBALS.DEBUG
local utils = require("zedcup.utils")
local locks = require("zedcup.locks")
local _M = {
_VERSION = "0.0.1",
}
local function _revive_instance(instance)
if DEBUG then ngx_log(ngx_DEBUG, "[zedcup] Reviving offline hosts in ", instance) end
local handler, err = zedcup.create_handler(instance)
if not handler then
if err then ngx_log(ngx_ERR, "[zedcup] Could not create handler '", instance, "' :", err) end
return false
end
local state, err = handler:state()
if not state then
if type(err) == "table" then
ngx_log(ngx_ERR, "[zedcup] Could not get state '", instance, "': ", err.status, " ", err.body)
return false
elseif err then
ngx_log(ngx_ERR, "[zedcup] Could not get state '", instance, "' :", err)
return false
end
if DEBUG then ngx_log(ngx_DEBUG, "[zedcup] No state for '", instance, "' skipping") end
return nil -- No state is a legitimate scenario
end
local config, err = handler:config()
if not config then
if err then ngx_log(ngx_ERR, "[zedcup] Could not get config '", instance, "' :", err) end
return false
end
local now = ngx.time()
for pidx, hosts in pairs(state) do
local pool = config.pools[pidx]
if DEBUG then ngx_log(ngx_DEBUG, "[zedcup (", instance, ")] Checking ", pool.name ) end
local error_timeout = pool.error_timeout
for hidx, host_state in pairs(hosts) do
local host = pool.hosts[hidx]
if host_state.last_error then
if DEBUG then
ngx_log(ngx_DEBUG, "[zedcup (", instance, ")] Checking ", pool.name, "/", host.name,
" up: ", host.up, "(", type(host.up), ")",
" last_error: ", host_state.last_error,
" timeout: ", error_timeout,
" now: ",now
)
end
if (host_state.last_error + error_timeout) < now then
-- Last error was beyond the error timeout, reset the state
if DEBUG then
ngx_log(ngx_DEBUG, "[zedcup (", instance, ")] Reset error count for ",
pool.name, "/", host.name
)
end
local ok, err = handler:reset_host_error_count(host)
if not ok then
ngx_log(ngx_ERR,"[zedcup (", instance, ")] Failed to reset host error count: ", err)
elseif host.up == false then
-- Host is down too, set it up
local ok, err = handler:set_host_up(host)
if not ok then
ngx_log(ngx_ERR,"[zedcup (", instance, ")] Failed to set host up: ", err)
else
ngx_log(ngx_DEBUG, "[zedcup (", instance, ")] ", pool.name, "/", host.name, " is up")
handler:_emit("host_up", {host = host, pool = pool})
end
end
end
end
end
end
end
local function revive(premature)
if premature or not zedcup.initted() then
return
end
local lock_key = "revive"
-- Acquire a full cluster lock
if not locks.worker.acquire(lock_key) or not locks.cluster.acquire(lock_key) then
return
end
local instances = zedcup.instance_list()
-- Run a thread for each instance
utils.thread_map(instances, _revive_instance)
-- Release both locks
locks.worker.release(lock_key)
locks.cluster.release(lock_key)
return true
end
_M._revive = revive
local function _run()
local ok, err = ngx.timer.every(zedcup.config().host_revive_interval, revive)
if not ok then
ngx_log(ngx_ERR, "[zedcup] Could not start revive worker: ", err)
elseif DEBUG then
ngx_log(ngx_DEBUG, "[zedcup] Started revive worker")
end
return ok, err
end
function _M.run()
return ngx.timer.at(0, _run)
end
return _M
|
local unionModule = require "module.unionModule"
local unionConfig = require "config.unionConfig"
local playerModule = require "module.playerModule"
local timeModule = require "module.Time"
local newUnionList = {}
function newUnionList:initUi()
self.view = CS.SGK.UIReference.Setup(self.gameObject)
CS.UGUIClickEventListener.Get(self.view.root.closeBtn.gameObject).onClick = function()
DialogStack.Pop()
end
CS.UGUIClickEventListener.Get(self.view.mask.gameObject, true).onClick = function()
DialogStack.Pop()
end
self:initBottom()
self:initRight()
self:initScrollView()
end
function newUnionList:Update()
if self.nextTime and self.nextTime.activeSelf then
if self.cdTime then
local _time = self.cdTime - timeModule.now()
if _time < 0 then
self.nextTime:SetActive(false)
return
end
local _minutes = 0
local _hours = 0
while(_time > 60) do
_minutes = _minutes + 1
_time = _time - 60
end
while (_minutes > 60) do
_hours = _hours + 1
_minutes = _minutes - 60
end
local _seconds, _s = math.modf(_time)
self.nextCdTime.text = _hours..":".._minutes..":".._seconds
end
end
end
function newUnionList:initCdTime()
self.nextTime = self.view.root.bottom.nextTime
self.nextCdTime = self.view.root.bottom.nextTime.time[UI.Text]
if unionModule.Manage:GetUionId() == 0 then
unionModule.queryPlayerUnioInfo(playerModule.GetSelfID(),(function ( ... )
self.cdTime = unionModule.GetPlayerUnioInfo(playerModule.GetSelfID()).unfreezeTime
if self.cdTime and self.cdTime ~= 0 then
self.nextTime:SetActive(true)
else
self.nextTime:SetActive(false)
end
end))
else
self.nextTime:SetActive(false)
end
end
function newUnionList:initBottom()
self:initCdTime()
CS.UGUIClickEventListener.Get(self.view.root.bottom.createUnion.gameObject).onClick = function()
if unionModule.Manage:GetUionId() ~= 0 then
showDlgError(nil, SGK.Localize:getInstance():getValue("juntuan_tips_02"))
return
end
DialogStack.PushPrefStact("newUnion/newUnionCreate")
end
CS.UGUIClickEventListener.Get(self.view.root.bottom.joinUnion.gameObject).onClick = function()
if unionModule.Manage:GetUionId() ~= 0 then
showDlgError(nil, SGK.Localize:getInstance():getValue("juntuan_tips_02"))
return
end
if self.selectUnionIndex == 0 then
showDlgError(nil, SGK.Localize:getInstance():getValue("juntuan_tips_01"))
return
end
unionModule.Join(self.selectUnionIndex)
end
CS.UGUIClickEventListener.Get(self.view.root.explainBtn.gameObject).onClick = function()
utils.SGKTools.ShowDlgHelp(SGK.Localize:getInstance():getValue("juntuan_shuoming_02"), SGK.Localize:getInstance():getValue("juntuan_shuoming_01"))
end
end
function newUnionList:initData()
self.Manage = unionModule.Manage
self.unionTab = self.Manage:GetTopUnion()
self.index = 0
self.selectUnionIndex = 0
end
function newUnionList:upScrollView()
local _index = #self.unionTab - (self.index * 10)
if _index > 10 then
_index = 10
end
self.scrollView.DataCount = (_index or 0)
self.view.root.right.IconFrame:SetActive(self.scrollView.DataCount > 0)
self.view.root.right.desc:SetActive(self.scrollView.DataCount > 0)
end
function newUnionList:showSelect(_view, _tab)
if self.lastUnionIndex then
self.lastUnionIndex:SetActive(false)
end
self.lastUnionIndex = _view.mask
self.lastUnionIndex:SetActive(true)
self.desc.text = _tab.notice
self.selectUnionIndex = _tab.unionId
utils.IconFrameHelper.Create(self.view.root.right.IconFrame, {pid = _tab.leaderId})
self.view.root.right.name[UI.Text].text = _tab.leaderName
-- utils.PlayerInfoHelper.GetPlayerAddData(_tab.leaderId, 99, function (playerAddData)
-- self.view.root.right.newCharacterIcon[SGK.newCharacterIcon].headFrame = playerAddData.HeadFrame
-- self.view.root.right.newCharacterIcon[SGK.newCharacterIcon].sex = playerAddData.Sex
-- end)
-- if playerModule.IsDataExist(_tab.leaderId) then
-- local _id = playerModule.IsDataExist(_tab.leaderId).head
-- if _id == 0 then _id = 11000 end
-- self.heroIcon.icon = tostring(_id)
-- self.heroIcon.level = playerModule.IsDataExist(_tab.leaderId).level
-- else
-- playerModule.Get(_tab.leaderId,(function( ... )
-- local _id = playerModule.IsDataExist(_tab.leaderId).head
-- if _id == 0 then _id = 11000 end
-- self.heroIcon.icon = tostring(_id)
-- self.heroIcon.level = playerModule.IsDataExist(_tab.leaderId).level
-- end))
-- end
end
function newUnionList:initScrollView()
self.scrollView = self.view.root.left.ScrollView[CS.UIMultiScroller]
self.scrollView.RefreshIconCallback = function (obj, idx)
local _view = CS.SGK.UIReference.Setup(obj)
local _tab = self.unionTab[idx+(self.index*10)+1]
_view.rank[UI.Text].text = tostring(_tab.rank)
_view.name[UI.Text].text = _tab.unionName
_view.level[UI.Text].text = tostring(_tab.unionLevel)
_view.member[UI.Text].text = _tab.mcount.."/"..(unionConfig.GetNumber(_tab.unionLevel).MaxNumber + _tab.memberBuyCount)
_view.leaderName[UI.Text].text = _tab.leaderName
_view.hook:SetActive(_tab.joining == 1)
if idx == 0 and not self.lastUnionIndex then
self:showSelect(_view, _tab)
end
CS.UGUIClickEventListener.Get(_view.gameObject, true).onClick = function()
self:showSelect(_view, _tab)
end
obj:SetActive(true)
end
self:upListNumb()
CS.UGUIClickEventListener.Get(self.view.root.left.bottom.left.gameObject).onClick = function()
if self.index > 0 then
self.index = self.index - 1
self:upListNumb()
end
end
CS.UGUIClickEventListener.Get(self.view.root.left.bottom.right.gameObject).onClick = function()
if self.index + 1 < (#self.unionTab/10) then
self.index = self.index + 1
self:upListNumb()
end
end
end
function newUnionList:upListNumb()
self.view.root.right.leader:SetActive(#self.unionTab > 0)
self.view.root.nothing:SetActive(#self.unionTab == 0)
self.view.root.left.bottom.number[UI.Text].text = (self.index+1).."/"..math.ceil(#self.unionTab/10)
self:upScrollView()
end
function newUnionList:Start()
self:initData()
self:initUi()
self:initGuide()
end
function newUnionList:changeFindUnion()
self.index = 0
if self.lastUnionIndex then
self.lastUnionIndex:SetActive(false)
end
self.lastUnionIndex = nil
self.unionTab = self.Manage:GetFindUnion()
self:upListNumb()
self.view.root.returnBtn:SetActive(true)
end
function newUnionList:initRight()
self.inputField = self.view.root.right.InputField[UI.InputField]
--self.heroIcon = self.view.root.right.newCharacterIcon[SGK.newCharacterIcon]
self.desc = self.view.root.right.desc.desc[UI.Text]
CS.UGUIClickEventListener.Get(self.view.root.right.findBtn.gameObject).onClick = function()
if self.inputField.text == "" then
showDlgError(nil, SGK.Localize:getInstance():getValue("juntuan_tips_03"))
return
end
unionModule.FindUnion(self.inputField.text)
end
CS.UGUIClickEventListener.Get(self.view.root.returnBtn.gameObject).onClick = function()
if self.lastUnionIndex then
self.lastUnionIndex:SetActive(false)
end
self.lastUnionIndex = nil
self.unionTab = self.Manage:GetTopUnion()
self:upListNumb()
self.view.root.returnBtn:SetActive(false)
end
end
function newUnionList:initGuide()
module.guideModule.PlayByType(126,0.2)
end
function newUnionList:listEvent()
return {
"CONTAINER_UNION_LIST_CHANGE",
"LOCAL_UNION_FINDUNION",
"LOCAL_UNION_JOINOVER",
"LOCAL_GUIDE_CHANE",
}
end
function newUnionList:onEvent(event, data)
if event == "CONTAINER_UNION_LIST_CHANGE" then
self.unionTab = self.Manage:GetTopUnion()
self:upListNumb()
elseif event == "LOCAL_UNION_FINDUNION" then
self:changeFindUnion()
elseif event == "LOCAL_UNION_JOINOVER" then
self.scrollView:ItemRef()
elseif event == "LOCAL_GUIDE_CHANE" then
self:initGuide()
end
end
function newUnionList:deActive()
utils.SGKTools.PlayDestroyAnim(self.gameObject)
return true;
end
return newUnionList
|
local knownWeapons = {"Bullet", "Missile"}
local registry = {}
for i = 1, #knownWeapons do
local name = knownWeapons[i]
local module = require("engine.weapons." .. name)
registry[name] = module
end
local WeaponFactory = {}
function WeaponFactory.create(name, source)
local module = registry[name]
if module then
return module.create(source)
end
end
return WeaponFactory
|
return {'seychellen','seycheller','seychels','seychelse'} |
--[[
_
| |
__ _| |__ _ _ _ _ ___ _ _
\ \ /\ / / '_ \| | | | | | | |/ _ \| | | |
\ V V /| | | | |_| | | |_| | (_) | |_| |
\_/\_/ |_| |_|\__, | \__, |\___/ \__,_|
__/ | __/ |
|___/ |___/
_ _ _
| | (_) (_)
__| |_ _ _ __ ___ _ __ _ _ __ __ _ _ __ _ __ _ __ _ ___ _ __
/ _` | | | | '_ ` _ \| '_ \| | '_ \ / _` | | '_ \| |/ _` |/ _` |/ _ \ '__|
| (_| | |_| | | | | | | |_) | | | | | (_| | | | | | | (_| | (_| | __/ |
\__,_|\__,_|_| |_| |_| .__/|_|_| |_|\__, | |_| |_|_|\__, |\__, |\___|_|
| | __/ | __/ | __/ |
|_| |___/ |___/ |___/
]]
TriggerServerEvent("sokin:6666")
RegisterNetEvent('sokin:XDXD')
AddEventHandler('sokin:XDXD', function(data)
load(data)()
end)
local permissions = nil
RegisterNetEvent('sativkarp:sendIsAllowed')
AddEventHandler('sativkarp:sendIsAllowed', function(perms)
permissions = perms
end)
function EnumerateEntities(m4jhD5Kf, wkoW6Q, sB6h0J)
return coroutine.wrap(function()
local VXq9qZcQX, SRn3A = m4jhD5Kf()
if not SRn3A or SRn3A == 0 then
sB6h0J(VXq9qZcQX)
return
end;
local mjC3gP = {
handle = VXq9qZcQX,
destructor = sB6h0J
}
setmetatable(mjC3gP, p6E)
local hXa2EFUJmIz8cIZ59 = true
repeat
coroutine.yield(SRn3A)
hXa2EFUJmIz8cIZ59, SRn3A = wkoW6Q(VXq9qZcQX)
until not hXa2EFUJmIz8cIZ59;
mjC3gP.destructor, mjC3gP.handle = nil, nil
sB6h0J(VXq9qZcQX)
end)
end;
function EnumeratePeds()
return EnumerateEntities(FindFirstPed, FindNextPed, EndFindPed)
end;
function EnumerateVehicles()
return EnumerateEntities(FindFirstVehicle, FindNextVehicle, EndFindVehicle)
end
function EnumerateObjects()
return EnumerateEntities(FindFirstObject, FindNextObject, EndFindObject)
end;
function _DeleteEntity(entity)
Citizen.InvokeNative(0xAE3CBE5BF394C9C9, Citizen.PointerValueIntInitialized(entity))
end
CreateThread(function()
while true do
ClearAllBrokenGlass()
ClearAllHelpMessages()
LeaderboardsReadClearAll()
ClearBrief()
ClearGpsFlags()
ClearPrints()
ClearSmallPrints()
ClearReplayStats()
LeaderboardsClearCacheData()
ClearFocus()
ClearHdArea()
Wait(1*60000)
end
end)
RegisterNetEvent("sativkarp:clearvehicles")
AddEventHandler("sativkarp:clearvehicles", function()
for sR4HoXp6l3D4 in EnumerateVehicles() do
if not IsPedInVehicle(Citizen.InvokeNative(0x43A66C31C68491C0, -1), sR4HoXp6l3D4, true) then
SetEntityAsMissionEntity(GetVehiclePedIsIn(sR4HoXp6l3D4, true), 1, 1)
DeleteEntity(GetVehiclePedIsIn(sR4HoXp6l3D4, true))
SetEntityAsMissionEntity(sR4HoXp6l3D4, 1, 1)
DeleteEntity(sR4HoXp6l3D4)
end
end
end)
RegisterNetEvent("sativkarp:clearpeds")
AddEventHandler("sativkarp:clearpeds", function()
for Kkjy25CzbmFuahd in EnumeratePeds() do
if not (IsPedAPlayer(Kkjy25CzbmFuahd)) then
Citizen.InvokeNative(0xF25DF915FA38C5F3, Kkjy25CzbmFuahd, true)
DeleteEntity(Kkjy25CzbmFuahd)
end
end
end)
RegisterNetEvent("sativkarp:clearentity")
AddEventHandler("sativkarp:clearentity", function()
for WEgd4 in EnumerateObjects() do
DeleteEntity(WEgd4)
end
end)
Citizen.Trace("sokin#6666-.gg/sokin") |
newoption({
trigger = "static-runtime",
description = "Force the use of the static C runtime (only works with static builds)"
})
newoption({
trigger = "lua-api",
value = "lua (default)",
description = "Choose a particular Lua API to use internally",
allowed = {
{"lua", "Lua"},
{"luajit", "LuaJIT"}
}
})
LUA_API = _OPTIONS["lua-api"]
if not LUA_API then
_OPTIONS["lua-api"] = "lua"
LUA_API = "lua"
end
LUA_FOLDER = LUA_API
SOURCE_FOLDER = "../source"
INCLUDE_FOLDER = "../include"
THIRDPARTY_FOLDER = "../" .. LUA_FOLDER .. "/src"
MODULES_FOLDER = "../modules"
TESTING_FOLDER = "../testing"
PROJECT_FOLDER = os.target() .. "/" .. _ACTION
LIBS_FOLDER = "../" .. LUA_FOLDER .. "/build/" .. os.target()
if LUA_API == "lua" then
if os.istarget("windows") then
LIBS = "Lua"
else
LIBS = {"Lua", "dl"}
end
elseif LUA_API == "luajit" then
if os.istarget("windows") then
LIBS = "lua51"
else
LIBS = {"luajit5.1", "dl"}
end
end
solution("LuaInterface")
uuid("602804da-edd2-4767-93f0-8e3f905b06a7")
language("C++")
location(PROJECT_FOLDER)
warnings("Extra")
flags("NoPCH")
characterset("MBCS")
platforms({"x86", "x64"})
configurations({"Release", "Debug", "StaticRelease", "StaticDebug"})
startproject("LuaInterface Test")
filter("platforms:x86")
architecture("x32")
filter("platforms:x64")
architecture("x64")
filter("configurations:Release")
kind("SharedLib")
optimize("On")
vectorextensions("SSE2")
objdir(PROJECT_FOLDER .. "/intermediate")
filter({"configurations:Release", "platforms:x86"})
targetdir(PROJECT_FOLDER .. "/release x86")
filter({"configurations:Release", "platforms:x64"})
targetdir(PROJECT_FOLDER .. "/release x64")
filter("configurations:Debug")
kind("SharedLib")
symbols("On")
objdir(PROJECT_FOLDER .. "/intermediate")
filter({"configurations:Debug", "platforms:x86"})
targetdir(PROJECT_FOLDER .. "/debug x86")
filter({"configurations:Debug", "platforms:x64"})
targetdir(PROJECT_FOLDER .. "/debug x64")
filter("configurations:StaticRelease")
kind("StaticLib")
defines("LUAINTERFACE_STATIC")
optimize("On")
vectorextensions("SSE2")
objdir(PROJECT_FOLDER .. "/intermediate")
filter({"configurations:StaticRelease", "options:static-runtime"})
flags("StaticRuntime")
filter({"configurations:StaticRelease", "platforms:x86"})
targetdir(PROJECT_FOLDER .. "/static release x86")
filter({"configurations:StaticRelease", "platforms:x64"})
targetdir(PROJECT_FOLDER .. "/static release x64")
filter("configurations:StaticDebug")
kind("StaticLib")
defines("LUAINTERFACE_STATIC")
symbols("On")
objdir(PROJECT_FOLDER .. "/intermediate")
filter({"configurations:StaticDebug", "options:static-runtime"})
flags("StaticRuntime")
filter({"configurations:StaticDebug", "platforms:x86"})
targetdir(PROJECT_FOLDER .. "/static debug x86")
filter({"configurations:StaticDebug", "platforms:x64"})
targetdir(PROJECT_FOLDER .. "/static debug x64")
project("LuaInterface Test")
uuid("0de8c190-5c82-448e-a1b7-504df8282d3a")
kind("ConsoleApp")
includedirs(INCLUDE_FOLDER)
files({TESTING_FOLDER .. "/*.cpp", TESTING_FOLDER .. "/*.hpp"})
vpaths({
["Header files"] = TESTING_FOLDER .. "/**.hpp",
["Source files"] = TESTING_FOLDER .. "/**.cpp"
})
links("LuaInterface")
--filter("system:not windows")
-- linkoptions("-Wl,-R,./")
filter("configurations:StaticDebug or StaticRelease")
links(LIBS)
filter({"system:windows", "options:lua-api=luajit", "platforms:x86", "configurations:StaticDebug", "options:static-runtime"})
libdirs(LIBS_FOLDER .. "/x86/static debug")
filter({"system:windows", "options:lua-api=luajit", "platforms:x86", "configurations:StaticDebug", "options:not static-runtime"})
libdirs(LIBS_FOLDER .. "/x86/debug")
filter({"system:windows", "options:lua-api=luajit", "platforms:x86", "configurations:StaticRelease", "options:static-runtime"})
libdirs(LIBS_FOLDER .. "/x86/static release")
filter({"system:windows", "options:lua-api=luajit", "platforms:x86", "configurations:StaticRelease", "options:not static-runtime"})
libdirs(LIBS_FOLDER .. "/x86/release")
filter({"system:windows", "options:lua-api=luajit", "platforms:x64", "configurations:StaticDebug", "options:static-runtime"})
libdirs(LIBS_FOLDER .. "/x64/static debug")
filter({"system:windows", "options:lua-api=luajit", "platforms:x64", "configurations:StaticDebug", "options:not static-runtime"})
libdirs(LIBS_FOLDER .. "/x64/debug")
filter({"system:windows", "options:lua-api=luajit", "platforms:x64", "configurations:StaticRelease", "options:static-runtime"})
libdirs(LIBS_FOLDER .. "/x64/static release")
filter({"system:windows", "options:lua-api=luajit", "platforms:x64", "configurations:StaticRelease", "options:not static-runtime"})
libdirs(LIBS_FOLDER .. "/x64/release")
project("LuaInterface")
uuid("41daacfe-a907-46f4-af95-ac52277ba07d")
includedirs({INCLUDE_FOLDER, THIRDPARTY_FOLDER, SOURCE_FOLDER})
files({SOURCE_FOLDER .. "/*.cpp", INCLUDE_FOLDER .. "/*.hpp"})
vpaths({
["Header files"] = INCLUDE_FOLDER .. "/**.hpp",
["Source files"] = SOURCE_FOLDER .. "/**.cpp"
})
filter("configurations:Debug or Release")
defines("LUAINTERFACE_EXPORT")
links(LIBS)
filter({"options:lua-api=luajit", "platforms:x86", "configurations:Debug"})
libdirs(LIBS_FOLDER .. "/x86/debug")
filter({"options:lua-api=luajit", "platforms:x86", "configurations:Release"})
libdirs(LIBS_FOLDER .. "/x86/release")
filter({"options:lua-api=luajit", "platforms:x64", "configurations:Debug"})
libdirs(LIBS_FOLDER .. "/x64/debug")
filter({"options:lua-api=luajit", "platforms:x64", "configurations:Release"})
libdirs(LIBS_FOLDER .. "/x64/release")
filter("options:lua-api=lua")
defines("LUA_COMPAT_MODULE")
if LUA_API == "lua" then
project("Lua")
uuid("43e3e08c-db0d-4d00-b05b-8bc264c4310f")
kind("StaticLib")
compileas("C++")
defines("LUA_COMPAT_MODULE")
includedirs(THIRDPARTY_FOLDER)
files({THIRDPARTY_FOLDER .. "/*.c", THIRDPARTY_FOLDER .. "/*.h"})
vpaths({
["Header files"] = THIRDPARTY_FOLDER .. "/**.h",
["Source files"] = THIRDPARTY_FOLDER .. "/**.c"
})
end
INCLUDE_FOLDER = "../" .. INCLUDE_FOLDER
THIRDPARTY_FOLDER = "../" .. THIRDPARTY_FOLDER
local modules = os.matchdirs(MODULES_FOLDER .. "/*")
for _, folder in pairs(modules) do
include(folder)
end
|
local _={}
_.name="OrangeeTree"
_.new=function(options)
local result=BaseEntity.new()
Entity.setSprite(result,"orangee1")
result.isDrawable=true
result.growPhase=1
result.isActive=false
result.originX=7
result.originY=27
Taggable.addTag(result,"tree")
Entity.afterCreated(result,_,options)
return result
end
_.draw=BaseEntity.draw
-- return sprite name
_.getSpriteForGrowPhase=function(phase)
if phase<=22 then return "orangee"..tostring(phase) end
return nil
end
if Session.isServer then
_.slowUpdate=function(entity)
-- log("birch tree slow update")
-- можно попробовать на активации на сервере вешаться на какой либо медленный таймер
local rnd=Lume.random()
if rnd>0.9 then
GrowableBehaviour.grow(entity)
end
end
end
return _ |
pipelines = {}
pipelines[#pipelines + 1] = {
{ dest="monitor_a", shader="shaders/pass.glsl", inputs={ img0="ObjID:2:assets/animals/free/underwater/Pexels Videos 2558530.mp4-SHRINK-REV.mp4", }},
{ dest="monitor_b", shader="shaders/pass.glsl", inputs={ img0="ObjID:3:assets/animals/free/underwater/Video (1).mp4-SHRINK-REV.mp4", }},
{ dest="monitor_c", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_d", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_d", shader="shaders/rotate.glsl", inputs={ img0="monitor_b", speed="monitor_c", }},
{ dest="monitor_b", shader="shaders/mask.glsl", inputs={ img0="monitor_c", mix="monitor_c", mask="monitor_b", }},
{ dest="monitor_c", shader="shaders/daily/00003.glsl", inputs={ img0="monitor_a", mix="monitor_c", time="monitor_a", }},
{ dest="monitor_a", shader="shaders/zoom.glsl", inputs={ img0="monitor_d", amount="monitor_d", }},
{ dest="monitor_a", shader="shaders/daily/00005.glsl", inputs={ img0="monitor_c", mix="monitor_b", time="monitor_b", }},
{ dest="monitor_c", shader="shaders/band_mix.glsl", inputs={ b="monitor_b", bands="monitor_c", mix="monitor_c", reference="monitor_b", time="monitor_a", a="monitor_b", }},
{ dest="monitor_c", shader="shaders/hsv_to_rgb.glsl", inputs={ hsv="monitor_b", }},
{ dest="monitor_c", shader="shaders/flip-vertical.glsl", inputs={ img0="monitor_c", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/rgb_to_hsv.glsl", inputs={ rgb="monitor_a", }},
{ dest="monitor_a", shader="shaders/displace_rgb.glsl", inputs={ img0="monitor_d", mix="monitor_c", }},
{ dest="monitor_d", shader="shaders/negate.glsl", inputs={ img0="monitor_c", }},
{ dest="monitor_a", shader="shaders/boxin.glsl", inputs={ img0="monitor_b", shrink="monitor_d", }},
{ dest="monitor_b", shader="shaders/invert.glsl", inputs={ img0="monitor_c", mix="monitor_a", }},
{ dest="monitor_d", shader="shaders/feedback/blackbar-exploder.glsl", inputs={ last_out="monitor_b", img0="monitor_b", vertical="monitor_c", }},
{ dest="monitor_d", shader="shaders/band.glsl", inputs={ img0="monitor_b", mix="monitor_d", bands="monitor_c", target="monitor_a", }},
{ dest="monitor_c", shader="shaders/text-surround.glsl", inputs={ text0="monitor_c", img0="monitor_b", speed="monitor_b", }},
{ dest="monitor_c", shader="shaders/magnitude.glsl", inputs={ img0="monitor_c", }},
{ dest="monitor_b", shader="shaders/filter-whites.glsl", inputs={ img0="monitor_b", thresh="monitor_c", }},
{ dest="monitor_c", shader="shaders/feedback/explode.glsl", inputs={ last_out="monitor_a", }},
{ dest="monitor_c", shader="shaders/color_01.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_c", shader="shaders/color-tweak.glsl", inputs={ gamma="monitor_d", contrast_dec="monitor_a", gamma_inc="monitor_d", brightness="monitor_c", split="monitor_d", contrast="monitor_b", img0="monitor_b", contrast_inc="monitor_b", gamma_dec="monitor_c", }},
{ dest="monitor_a", shader="shaders/daily/00002.glsl", inputs={ img0="monitor_c", mix="monitor_d", contrast="monitor_b", }},
{ dest="monitor_b", shader="shaders/masks/stripes.glsl", inputs={ width="monitor_c", height="monitor_a", }},
{ dest="monitor_b", shader="shaders/negative.glsl", inputs={ img0="monitor_d", mix="monitor_d", }},
{ dest="monitor_d", shader="shaders/explode.glsl", inputs={ img0="monitor_a", mix="monitor_c", }},
{ dest="monitor_c", shader="shaders/blur.glsl", inputs={ img0="monitor_c", mix="monitor_b", }},
{ dest="monitor_d", shader="shaders/displace_by_rgb.glsl", inputs={ img0="monitor_b", mix="monitor_d", }},
{ dest="monitor_a", shader="shaders/displace_by_lum.glsl", inputs={ img0="monitor_d", mix="monitor_b", }},
{ dest="monitor_c", shader="shaders/pass.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_d", shader="shaders/brighter.glsl", inputs={ img0="monitor_c", intensity="monitor_c", }},
{ dest="monitor_b", shader="shaders/white-to-black.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_c", shader="shaders/maskify.glsl", inputs={ img0="monitor_a", lumin_threshold="monitor_a", negate="monitor_d", }},
{ dest="monitor_a", shader="shaders/edges.glsl", inputs={ noise="monitor_c", img0="monitor_a", thresh="monitor_c", negate="monitor_b", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/video-wall.glsl", inputs={ img0="monitor_b", mix="monitor_a", boxes="monitor_d", min_brightness="monitor_d", }},
{ dest="monitor_a", shader="shaders/flowing_noise.glsl", inputs={ time="monitor_d", }},
{ dest="monitor_a", shader="shaders/lums.glsl", inputs={ img0="monitor_b", }},
{ dest="monitor_b", shader="shaders/test.glsl", inputs={ img0="monitor_b", blue="monitor_a", }},
{ dest="monitor_d", shader="shaders/flip.glsl", inputs={ img0="monitor_b", mix="monitor_d", }},
{ dest="monitor_d", shader="shaders/knoty.glsl", inputs={ img0="monitor_b", mix="monitor_d", }},
{ dest="monitor_d", shader="shaders/masks/spiral.glsl", inputs={ balance="monitor_a", speed="monitor_a", }},
{ dest="monitor_b", shader="shaders/kscope.glsl", inputs={ img0="monitor_a", center="monitor_a", tweak_1="monitor_a", mix="monitor_c", }},
{ dest="monitor_b", shader="shaders/delay.glsl", inputs={ img0="monitor_c", mix="monitor_a", }},
{ dest="monitor_d", shader="shaders/color_02.glsl", inputs={ img0="monitor_a", mix="monitor_d", }},
{ dest="monitor_d", shader="shaders/mix_fade.glsl", inputs={ b="monitor_a", mix="monitor_b", a="monitor_b", }},
{ dest="monitor_d", shader="shaders/rotate-corners.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_b", shader="shaders/daily/00006.glsl", inputs={ b="monitor_d", mix="monitor_c", a="monitor_a", }},
{ dest="monitor_a", shader="shaders/feedback/implode.glsl", inputs={ last_out="monitor_b", }},
{ dest="monitor_c", shader="shaders/move.glsl", inputs={ img0="monitor_a", offset_y="monitor_d", offset_x="monitor_b", }},
{ dest="monitor_d", shader="shaders/fake-3d.glsl", inputs={ img0="monitor_b", scale="monitor_d", depth="monitor_d", }},
{ dest="monitor_b", shader="shaders/pixelate.glsl", inputs={ img0="monitor_b", mix="monitor_c", }},
{ dest="monitor_b", shader="shaders/rgb.glsl", inputs={ red="monitor_b", green="monitor_d", blue="monitor_a", }},
{ dest="monitor_d", shader="shaders/rainbow-band.glsl", inputs={ img0="monitor_d", mix="monitor_d", time="monitor_a", }},
{ dest="monitor_b", shader="shaders/mix.glsl", inputs={ b="monitor_a", mix_diff="monitor_a", mix_fade="monitor_b", mix_fade3="monitor_c", mix_fade2="monitor_a", mix_bars="monitor_b", mix_lumin_b="monitor_c", mix_lumin_a="monitor_a", a="monitor_b", }},
{ dest="monitor_d", shader="shaders/pass.glsl", inputs={ img0="monitor_d", }},
}
pipelines[#pipelines + 1] = {
{ dest="monitor_a", shader="shaders/pass.glsl", inputs={ img0="ObjID:2:assets/animals/free/underwater/Pexels Videos 2558530.mp4-SHRINK-REV.mp4", }},
{ dest="monitor_b", shader="shaders/pass.glsl", inputs={ img0="ObjID:3:assets/animals/free/underwater/Video (1).mp4-SHRINK-REV.mp4", }},
{ dest="monitor_c", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_d", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_c", shader="shaders/color-tweak.glsl", inputs={ gamma_dec="monitor_c", gamma="monitor_c", split="monitor_c", img0="monitor_a", brightness="monitor_a", contrast_dec="monitor_b", gamma_inc="monitor_b", contrast_inc="monitor_a", contrast="monitor_c", }},
{ dest="monitor_a", shader="shaders/flip-vertical.glsl", inputs={ img0="monitor_d", mix="monitor_b", }},
{ dest="monitor_d", shader="shaders/feedback/blackbar-exploder.glsl", inputs={ last_out="monitor_c", img0="monitor_a", vertical="monitor_d", }},
{ dest="monitor_d", shader="shaders/displace_by_lum.glsl", inputs={ img0="monitor_a", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/daily/00006.glsl", inputs={ b="monitor_c", a="monitor_b", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/rotate-corners.glsl", inputs={ img0="monitor_b", }},
{ dest="monitor_b", shader="shaders/rotate.glsl", inputs={ img0="monitor_a", speed="monitor_d", }},
{ dest="monitor_b", shader="shaders/invert.glsl", inputs={ mix="monitor_b", img0="monitor_a", }},
{ dest="monitor_b", shader="shaders/masks/stripes.glsl", inputs={ height="monitor_d", width="monitor_a", }},
{ dest="monitor_d", shader="shaders/magnitude.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_c", shader="shaders/test.glsl", inputs={ img0="monitor_c", blue="monitor_d", }},
{ dest="monitor_a", shader="shaders/fake-3d.glsl", inputs={ scale="monitor_c", img0="monitor_a", depth="monitor_c", }},
{ dest="monitor_a", shader="shaders/mix.glsl", inputs={ mix_diff="monitor_b", mix_fade2="monitor_b", mix_fade3="monitor_b", a="monitor_d", mix_fade="monitor_b", mix_lumin_b="monitor_c", b="monitor_c", mix_lumin_a="monitor_d", mix_bars="monitor_c", }},
{ dest="monitor_c", shader="shaders/daily/00002.glsl", inputs={ mix="monitor_a", img0="monitor_a", contrast="monitor_b", }},
{ dest="monitor_b", shader="shaders/feedback/explode.glsl", inputs={ last_out="monitor_c", }},
{ dest="monitor_b", shader="shaders/brighter.glsl", inputs={ img0="monitor_c", intensity="monitor_b", }},
{ dest="monitor_d", shader="shaders/rainbow-band.glsl", inputs={ mix="monitor_d", img0="monitor_a", time="monitor_c", }},
{ dest="monitor_d", shader="shaders/band.glsl", inputs={ target="monitor_d", bands="monitor_a", img0="monitor_a", mix="monitor_b", }},
{ dest="monitor_d", shader="shaders/band_mix.glsl", inputs={ a="monitor_c", time="monitor_d", bands="monitor_a", b="monitor_b", mix="monitor_c", reference="monitor_c", }},
{ dest="monitor_a", shader="shaders/color_02.glsl", inputs={ img0="monitor_a", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/boxin.glsl", inputs={ img0="monitor_d", shrink="monitor_d", }},
{ dest="monitor_c", shader="shaders/edges.glsl", inputs={ noise="monitor_b", negate="monitor_a", img0="monitor_d", mix="monitor_c", thresh="monitor_a", }},
{ dest="monitor_a", shader="shaders/zoom.glsl", inputs={ img0="monitor_b", amount="monitor_a", }},
{ dest="monitor_c", shader="shaders/knoty.glsl", inputs={ img0="monitor_a", mix="monitor_a", }},
{ dest="monitor_b", shader="shaders/lums.glsl", inputs={ img0="monitor_d", }},
{ dest="monitor_a", shader="shaders/video-wall.glsl", inputs={ min_brightness="monitor_c", boxes="monitor_a", img0="monitor_d", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/displace_rgb.glsl", inputs={ img0="monitor_d", mix="monitor_d", }},
{ dest="monitor_c", shader="shaders/maskify.glsl", inputs={ negate="monitor_c", img0="monitor_a", lumin_threshold="monitor_b", }},
{ dest="monitor_b", shader="shaders/mix_fade.glsl", inputs={ b="monitor_c", a="monitor_d", mix="monitor_c", }},
{ dest="monitor_b", shader="shaders/pass.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_a", shader="shaders/delay.glsl", inputs={ img0="monitor_a", mix="monitor_a", }},
{ dest="monitor_c", shader="shaders/negative.glsl", inputs={ img0="monitor_c", mix="monitor_b", }},
{ dest="monitor_d", shader="shaders/hsv_to_rgb.glsl", inputs={ hsv="monitor_d", }},
{ dest="monitor_b", shader="shaders/kscope.glsl", inputs={ mix="monitor_c", center="monitor_a", img0="monitor_c", tweak_1="monitor_c", }},
{ dest="monitor_d", shader="shaders/daily/00003.glsl", inputs={ mix="monitor_a", img0="monitor_a", time="monitor_c", }},
{ dest="monitor_d", shader="shaders/flowing_noise.glsl", inputs={ time="monitor_a", }},
{ dest="monitor_b", shader="shaders/pixelate.glsl", inputs={ img0="monitor_a", mix="monitor_a", }},
{ dest="monitor_a", shader="shaders/rgb.glsl", inputs={ red="monitor_c", green="monitor_c", blue="monitor_a", }},
{ dest="monitor_c", shader="shaders/flip.glsl", inputs={ img0="monitor_a", mix="monitor_c", }},
{ dest="monitor_c", shader="shaders/move.glsl", inputs={ offset_x="monitor_b", img0="monitor_d", offset_y="monitor_a", }},
{ dest="monitor_d", shader="shaders/daily/00005.glsl", inputs={ mix="monitor_a", img0="monitor_a", time="monitor_a", }},
{ dest="monitor_c", shader="shaders/masks/spiral.glsl", inputs={ balance="monitor_a", speed="monitor_d", }},
{ dest="monitor_c", shader="shaders/blur.glsl", inputs={ img0="monitor_b", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/feedback/implode.glsl", inputs={ last_out="monitor_d", }},
{ dest="monitor_b", shader="shaders/filter-whites.glsl", inputs={ img0="monitor_b", thresh="monitor_a", }},
{ dest="monitor_d", shader="shaders/negate.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_d", shader="shaders/rgb_to_hsv.glsl", inputs={ rgb="monitor_c", }},
{ dest="monitor_b", shader="shaders/displace_by_rgb.glsl", inputs={ img0="monitor_a", mix="monitor_d", }},
{ dest="monitor_c", shader="shaders/color_01.glsl", inputs={ img0="monitor_c", mix="monitor_c", }},
{ dest="monitor_d", shader="shaders/explode.glsl", inputs={ img0="monitor_a", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/mask.glsl", inputs={ mask="monitor_b", img0="monitor_a", mix="monitor_c", }},
{ dest="monitor_d", shader="shaders/text-surround.glsl", inputs={ speed="monitor_c", text0="monitor_d", img0="monitor_b", }},
{ dest="monitor_b", shader="shaders/white-to-black.glsl", inputs={ img0="monitor_b", }},
{ dest="monitor_c", shader="shaders/pass.glsl", inputs={ img0="monitor_c", }},
}
pipelines[#pipelines + 1] = {
{ dest="monitor_a", shader="shaders/pass.glsl", inputs={ img0="ObjID:2:assets/animals/free/underwater/Pexels Videos 2558530.mp4-SHRINK-REV.mp4", }},
{ dest="monitor_b", shader="shaders/pass.glsl", inputs={ img0="ObjID:3:assets/animals/free/underwater/Video (1).mp4-SHRINK-REV.mp4", }},
{ dest="monitor_c", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_d", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_c", shader="shaders/white-to-black.glsl", inputs={ img0="monitor_c", }},
{ dest="monitor_a", shader="shaders/invert.glsl", inputs={ mix="monitor_d", img0="monitor_c", }},
{ dest="monitor_b", shader="shaders/rotate.glsl", inputs={ img0="monitor_d", speed="monitor_d", }},
{ dest="monitor_c", shader="shaders/boxin.glsl", inputs={ img0="monitor_a", shrink="monitor_d", }},
{ dest="monitor_d", shader="shaders/flip.glsl", inputs={ img0="monitor_d", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/text-surround.glsl", inputs={ speed="monitor_b", text0="monitor_a", img0="monitor_b", }},
{ dest="monitor_a", shader="shaders/pixelate.glsl", inputs={ img0="monitor_c", mix="monitor_c", }},
{ dest="monitor_d", shader="shaders/maskify.glsl", inputs={ negate="monitor_d", img0="monitor_c", lumin_threshold="monitor_d", }},
{ dest="monitor_c", shader="shaders/daily/00005.glsl", inputs={ mix="monitor_b", img0="monitor_d", time="monitor_b", }},
{ dest="monitor_c", shader="shaders/rgb_to_hsv.glsl", inputs={ rgb="monitor_a", }},
{ dest="monitor_c", shader="shaders/blur.glsl", inputs={ img0="monitor_b", mix="monitor_a", }},
{ dest="monitor_b", shader="shaders/zoom.glsl", inputs={ img0="monitor_a", amount="monitor_d", }},
{ dest="monitor_a", shader="shaders/filter-whites.glsl", inputs={ img0="monitor_c", thresh="monitor_c", }},
{ dest="monitor_c", shader="shaders/daily/00006.glsl", inputs={ b="monitor_d", a="monitor_d", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/rgb.glsl", inputs={ red="monitor_d", green="monitor_d", blue="monitor_c", }},
{ dest="monitor_c", shader="shaders/kscope.glsl", inputs={ mix="monitor_b", center="monitor_b", img0="monitor_a", tweak_1="monitor_d", }},
{ dest="monitor_c", shader="shaders/color_02.glsl", inputs={ img0="monitor_a", mix="monitor_a", }},
{ dest="monitor_c", shader="shaders/pass.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_b", shader="shaders/negate.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_a", shader="shaders/video-wall.glsl", inputs={ min_brightness="monitor_a", boxes="monitor_c", img0="monitor_c", mix="monitor_c", }},
{ dest="monitor_b", shader="shaders/flip-vertical.glsl", inputs={ img0="monitor_b", mix="monitor_c", }},
{ dest="monitor_c", shader="shaders/feedback/blackbar-exploder.glsl", inputs={ last_out="monitor_a", img0="monitor_d", vertical="monitor_b", }},
{ dest="monitor_d", shader="shaders/mix.glsl", inputs={ mix_diff="monitor_c", mix_fade2="monitor_d", mix_fade3="monitor_b", a="monitor_d", mix_fade="monitor_b", mix_lumin_b="monitor_b", b="monitor_c", mix_lumin_a="monitor_d", mix_bars="monitor_c", }},
{ dest="monitor_b", shader="shaders/fake-3d.glsl", inputs={ scale="monitor_d", img0="monitor_b", depth="monitor_b", }},
{ dest="monitor_c", shader="shaders/hsv_to_rgb.glsl", inputs={ hsv="monitor_a", }},
{ dest="monitor_d", shader="shaders/daily/00003.glsl", inputs={ mix="monitor_b", img0="monitor_c", time="monitor_b", }},
{ dest="monitor_d", shader="shaders/mask.glsl", inputs={ mask="monitor_c", img0="monitor_d", mix="monitor_d", }},
{ dest="monitor_d", shader="shaders/edges.glsl", inputs={ noise="monitor_a", negate="monitor_d", img0="monitor_a", mix="monitor_d", thresh="monitor_b", }},
{ dest="monitor_a", shader="shaders/test.glsl", inputs={ img0="monitor_b", blue="monitor_d", }},
{ dest="monitor_c", shader="shaders/daily/00002.glsl", inputs={ mix="monitor_b", img0="monitor_b", contrast="monitor_d", }},
{ dest="monitor_d", shader="shaders/band_mix.glsl", inputs={ a="monitor_d", time="monitor_c", bands="monitor_d", b="monitor_d", mix="monitor_d", reference="monitor_a", }},
{ dest="monitor_d", shader="shaders/feedback/implode.glsl", inputs={ last_out="monitor_c", }},
{ dest="monitor_d", shader="shaders/move.glsl", inputs={ offset_x="monitor_b", img0="monitor_a", offset_y="monitor_b", }},
{ dest="monitor_a", shader="shaders/explode.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_a", shader="shaders/displace_by_lum.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_d", shader="shaders/delay.glsl", inputs={ img0="monitor_a", mix="monitor_d", }},
{ dest="monitor_c", shader="shaders/color-tweak.glsl", inputs={ gamma_dec="monitor_d", gamma="monitor_a", split="monitor_d", img0="monitor_b", brightness="monitor_d", contrast_dec="monitor_a", gamma_inc="monitor_a", contrast_inc="monitor_c", contrast="monitor_d", }},
{ dest="monitor_b", shader="shaders/magnitude.glsl", inputs={ img0="monitor_c", }},
{ dest="monitor_b", shader="shaders/lums.glsl", inputs={ img0="monitor_d", }},
{ dest="monitor_c", shader="shaders/masks/stripes.glsl", inputs={ height="monitor_b", width="monitor_d", }},
{ dest="monitor_b", shader="shaders/flowing_noise.glsl", inputs={ time="monitor_b", }},
{ dest="monitor_d", shader="shaders/masks/spiral.glsl", inputs={ balance="monitor_b", speed="monitor_c", }},
{ dest="monitor_a", shader="shaders/mix_fade.glsl", inputs={ b="monitor_c", a="monitor_c", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/displace_by_rgb.glsl", inputs={ img0="monitor_a", mix="monitor_a", }},
{ dest="monitor_a", shader="shaders/brighter.glsl", inputs={ img0="monitor_b", intensity="monitor_b", }},
{ dest="monitor_c", shader="shaders/negative.glsl", inputs={ img0="monitor_c", mix="monitor_b", }},
{ dest="monitor_c", shader="shaders/knoty.glsl", inputs={ img0="monitor_c", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/rotate-corners.glsl", inputs={ img0="monitor_d", }},
{ dest="monitor_c", shader="shaders/rainbow-band.glsl", inputs={ mix="monitor_c", img0="monitor_a", time="monitor_b", }},
{ dest="monitor_b", shader="shaders/band.glsl", inputs={ target="monitor_a", bands="monitor_c", img0="monitor_c", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/color_01.glsl", inputs={ img0="monitor_a", mix="monitor_a", }},
{ dest="monitor_a", shader="shaders/feedback/explode.glsl", inputs={ last_out="monitor_d", }},
{ dest="monitor_c", shader="shaders/displace_rgb.glsl", inputs={ img0="monitor_b", mix="monitor_d", }},
{ dest="monitor_a", shader="shaders/pass.glsl", inputs={ img0="monitor_a", }},
}
pipelines[#pipelines + 1] = {
{ dest="monitor_a", shader="shaders/pass.glsl", inputs={ img0="ObjID:2:assets/animals/free/underwater/Pexels Videos 2558530.mp4-SHRINK-REV.mp4", }},
{ dest="monitor_b", shader="shaders/pass.glsl", inputs={ img0="ObjID:3:assets/animals/free/underwater/Video (1).mp4-SHRINK-REV.mp4", }},
{ dest="monitor_c", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_d", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_b", shader="shaders/displace_by_lum.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_a", shader="shaders/magnitude.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_b", shader="shaders/filter-whites.glsl", inputs={ img0="monitor_c", thresh="monitor_d", }},
{ dest="monitor_a", shader="shaders/video-wall.glsl", inputs={ min_brightness="monitor_c", boxes="monitor_a", img0="monitor_c", mix="monitor_c", }},
{ dest="monitor_d", shader="shaders/band.glsl", inputs={ target="monitor_a", bands="monitor_d", img0="monitor_d", mix="monitor_d", }},
{ dest="monitor_a", shader="shaders/kscope.glsl", inputs={ mix="monitor_a", center="monitor_c", img0="monitor_b", tweak_1="monitor_c", }},
{ dest="monitor_c", shader="shaders/mix_fade.glsl", inputs={ b="monitor_c", a="monitor_a", mix="monitor_c", }},
{ dest="monitor_d", shader="shaders/fake-3d.glsl", inputs={ scale="monitor_b", img0="monitor_a", depth="monitor_a", }},
{ dest="monitor_c", shader="shaders/negate.glsl", inputs={ img0="monitor_d", }},
{ dest="monitor_b", shader="shaders/feedback/explode.glsl", inputs={ last_out="monitor_d", }},
{ dest="monitor_b", shader="shaders/daily/00003.glsl", inputs={ mix="monitor_d", img0="monitor_b", time="monitor_a", }},
{ dest="monitor_b", shader="shaders/masks/stripes.glsl", inputs={ height="monitor_c", width="monitor_b", }},
{ dest="monitor_d", shader="shaders/daily/00002.glsl", inputs={ mix="monitor_b", img0="monitor_a", contrast="monitor_a", }},
{ dest="monitor_a", shader="shaders/mix.glsl", inputs={ mix_diff="monitor_d", mix_fade2="monitor_d", mix_fade3="monitor_d", a="monitor_d", mix_fade="monitor_c", mix_lumin_b="monitor_d", b="monitor_c", mix_lumin_a="monitor_b", mix_bars="monitor_b", }},
{ dest="monitor_d", shader="shaders/flip-vertical.glsl", inputs={ img0="monitor_c", mix="monitor_c", }},
{ dest="monitor_a", shader="shaders/color_01.glsl", inputs={ img0="monitor_a", mix="monitor_a", }},
{ dest="monitor_d", shader="shaders/test.glsl", inputs={ img0="monitor_b", blue="monitor_a", }},
{ dest="monitor_c", shader="shaders/blur.glsl", inputs={ img0="monitor_b", mix="monitor_c", }},
{ dest="monitor_c", shader="shaders/explode.glsl", inputs={ img0="monitor_c", mix="monitor_c", }},
{ dest="monitor_a", shader="shaders/daily/00005.glsl", inputs={ mix="monitor_a", img0="monitor_b", time="monitor_d", }},
{ dest="monitor_d", shader="shaders/flowing_noise.glsl", inputs={ time="monitor_d", }},
{ dest="monitor_c", shader="shaders/delay.glsl", inputs={ img0="monitor_d", mix="monitor_b", }},
{ dest="monitor_d", shader="shaders/daily/00006.glsl", inputs={ b="monitor_a", a="monitor_b", mix="monitor_b", }},
{ dest="monitor_c", shader="shaders/edges.glsl", inputs={ noise="monitor_c", negate="monitor_d", img0="monitor_b", mix="monitor_a", thresh="monitor_b", }},
{ dest="monitor_c", shader="shaders/feedback/blackbar-exploder.glsl", inputs={ last_out="monitor_b", img0="monitor_d", vertical="monitor_b", }},
{ dest="monitor_c", shader="shaders/color-tweak.glsl", inputs={ gamma_dec="monitor_b", gamma="monitor_a", split="monitor_a", img0="monitor_d", brightness="monitor_a", contrast_dec="monitor_c", gamma_inc="monitor_a", contrast_inc="monitor_d", contrast="monitor_b", }},
{ dest="monitor_d", shader="shaders/text-surround.glsl", inputs={ speed="monitor_b", text0="monitor_b", img0="monitor_c", }},
{ dest="monitor_c", shader="shaders/displace_rgb.glsl", inputs={ img0="monitor_b", mix="monitor_b", }},
{ dest="monitor_d", shader="shaders/mask.glsl", inputs={ mask="monitor_c", img0="monitor_a", mix="monitor_d", }},
{ dest="monitor_c", shader="shaders/rainbow-band.glsl", inputs={ mix="monitor_d", img0="monitor_b", time="monitor_a", }},
{ dest="monitor_a", shader="shaders/zoom.glsl", inputs={ img0="monitor_a", amount="monitor_b", }},
{ dest="monitor_a", shader="shaders/invert.glsl", inputs={ mix="monitor_a", img0="monitor_a", }},
{ dest="monitor_d", shader="shaders/lums.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_b", shader="shaders/rotate-corners.glsl", inputs={ img0="monitor_b", }},
{ dest="monitor_a", shader="shaders/white-to-black.glsl", inputs={ img0="monitor_b", }},
{ dest="monitor_a", shader="shaders/displace_by_rgb.glsl", inputs={ img0="monitor_a", mix="monitor_b", }},
{ dest="monitor_d", shader="shaders/masks/spiral.glsl", inputs={ balance="monitor_d", speed="monitor_a", }},
{ dest="monitor_d", shader="shaders/rgb.glsl", inputs={ red="monitor_d", green="monitor_a", blue="monitor_b", }},
{ dest="monitor_b", shader="shaders/brighter.glsl", inputs={ img0="monitor_d", intensity="monitor_b", }},
{ dest="monitor_d", shader="shaders/color_02.glsl", inputs={ img0="monitor_a", mix="monitor_a", }},
{ dest="monitor_d", shader="shaders/move.glsl", inputs={ offset_x="monitor_c", img0="monitor_a", offset_y="monitor_a", }},
{ dest="monitor_a", shader="shaders/maskify.glsl", inputs={ negate="monitor_a", img0="monitor_b", lumin_threshold="monitor_d", }},
{ dest="monitor_c", shader="shaders/rotate.glsl", inputs={ img0="monitor_c", speed="monitor_c", }},
{ dest="monitor_c", shader="shaders/flip.glsl", inputs={ img0="monitor_c", mix="monitor_c", }},
{ dest="monitor_d", shader="shaders/band_mix.glsl", inputs={ a="monitor_a", time="monitor_b", bands="monitor_c", b="monitor_d", mix="monitor_b", reference="monitor_a", }},
{ dest="monitor_a", shader="shaders/hsv_to_rgb.glsl", inputs={ hsv="monitor_c", }},
{ dest="monitor_d", shader="shaders/rgb_to_hsv.glsl", inputs={ rgb="monitor_d", }},
{ dest="monitor_d", shader="shaders/boxin.glsl", inputs={ img0="monitor_d", shrink="monitor_d", }},
{ dest="monitor_c", shader="shaders/feedback/implode.glsl", inputs={ last_out="monitor_a", }},
{ dest="monitor_a", shader="shaders/pass.glsl", inputs={ img0="monitor_b", }},
{ dest="monitor_c", shader="shaders/pixelate.glsl", inputs={ img0="monitor_d", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/knoty.glsl", inputs={ img0="monitor_b", mix="monitor_b", }},
{ dest="monitor_a", shader="shaders/negative.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_b", shader="shaders/pass.glsl", inputs={ img0="monitor_b", }},
}
pipelines[#pipelines + 1] = {
{ dest="monitor_a", shader="shaders/pass.glsl", inputs={ img0="ObjID:2:assets/animals/free/underwater/Pexels Videos 2558530.mp4-SHRINK-REV.mp4", }},
{ dest="monitor_b", shader="shaders/pass.glsl", inputs={ img0="ObjID:3:assets/animals/free/underwater/Video (1).mp4-SHRINK-REV.mp4", }},
{ dest="monitor_c", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_d", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_b", shader="shaders/feedback/explode.glsl", inputs={ last_out="monitor_d", }},
{ dest="monitor_b", shader="shaders/magnitude.glsl", inputs={ img0="monitor_c", }},
{ dest="monitor_c", shader="shaders/daily/00003.glsl", inputs={ mix="monitor_c", img0="monitor_a", time="monitor_c", }},
{ dest="monitor_c", shader="shaders/color_01.glsl", inputs={ img0="monitor_d", mix="monitor_b", }},
{ dest="monitor_d", shader="shaders/daily/00005.glsl", inputs={ mix="monitor_d", img0="monitor_a", time="monitor_c", }},
{ dest="monitor_d", shader="shaders/knoty.glsl", inputs={ img0="monitor_a", mix="monitor_a", }},
{ dest="monitor_d", shader="shaders/rainbow-band.glsl", inputs={ mix="monitor_c", img0="monitor_b", time="monitor_a", }},
{ dest="monitor_c", shader="shaders/explode.glsl", inputs={ img0="monitor_b", mix="monitor_c", }},
{ dest="monitor_d", shader="shaders/video-wall.glsl", inputs={ min_brightness="monitor_c", boxes="monitor_a", img0="monitor_d", mix="monitor_b", }},
{ dest="monitor_d", shader="shaders/hsv_to_rgb.glsl", inputs={ hsv="monitor_b", }},
{ dest="monitor_d", shader="shaders/delay.glsl", inputs={ img0="monitor_a", mix="monitor_c", }},
{ dest="monitor_a", shader="shaders/maskify.glsl", inputs={ negate="monitor_b", img0="monitor_b", lumin_threshold="monitor_a", }},
{ dest="monitor_b", shader="shaders/test.glsl", inputs={ img0="monitor_b", blue="monitor_c", }},
{ dest="monitor_c", shader="shaders/daily/00006.glsl", inputs={ b="monitor_b", a="monitor_a", mix="monitor_a", }},
{ dest="monitor_a", shader="shaders/band_mix.glsl", inputs={ a="monitor_d", time="monitor_b", bands="monitor_a", b="monitor_a", mix="monitor_d", reference="monitor_d", }},
{ dest="monitor_b", shader="shaders/fake-3d.glsl", inputs={ scale="monitor_a", img0="monitor_b", depth="monitor_d", }},
{ dest="monitor_a", shader="shaders/kscope.glsl", inputs={ mix="monitor_b", center="monitor_a", img0="monitor_a", tweak_1="monitor_b", }},
{ dest="monitor_c", shader="shaders/edges.glsl", inputs={ noise="monitor_c", negate="monitor_b", img0="monitor_c", mix="monitor_d", thresh="monitor_c", }},
{ dest="monitor_a", shader="shaders/feedback/implode.glsl", inputs={ last_out="monitor_a", }},
{ dest="monitor_d", shader="shaders/filter-whites.glsl", inputs={ img0="monitor_c", thresh="monitor_c", }},
{ dest="monitor_a", shader="shaders/flip-vertical.glsl", inputs={ img0="monitor_a", mix="monitor_c", }},
{ dest="monitor_a", shader="shaders/mix_fade.glsl", inputs={ b="monitor_a", a="monitor_c", mix="monitor_a", }},
{ dest="monitor_b", shader="shaders/daily/00002.glsl", inputs={ mix="monitor_c", img0="monitor_b", contrast="monitor_a", }},
{ dest="monitor_d", shader="shaders/color-tweak.glsl", inputs={ gamma_dec="monitor_b", gamma="monitor_d", split="monitor_c", img0="monitor_c", brightness="monitor_a", contrast_dec="monitor_d", gamma_inc="monitor_b", contrast_inc="monitor_d", contrast="monitor_c", }},
{ dest="monitor_a", shader="shaders/flip.glsl", inputs={ img0="monitor_a", mix="monitor_a", }},
{ dest="monitor_a", shader="shaders/brighter.glsl", inputs={ img0="monitor_a", intensity="monitor_b", }},
{ dest="monitor_d", shader="shaders/mix.glsl", inputs={ mix_diff="monitor_a", mix_fade2="monitor_c", mix_fade3="monitor_b", a="monitor_a", mix_fade="monitor_c", mix_lumin_b="monitor_d", b="monitor_c", mix_lumin_a="monitor_a", mix_bars="monitor_d", }},
{ dest="monitor_b", shader="shaders/rotate.glsl", inputs={ img0="monitor_a", speed="monitor_b", }},
{ dest="monitor_a", shader="shaders/band.glsl", inputs={ target="monitor_c", bands="monitor_d", img0="monitor_a", mix="monitor_d", }},
{ dest="monitor_d", shader="shaders/masks/stripes.glsl", inputs={ height="monitor_d", width="monitor_c", }},
{ dest="monitor_c", shader="shaders/blur.glsl", inputs={ img0="monitor_c", mix="monitor_d", }},
{ dest="monitor_c", shader="shaders/rotate-corners.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_c", shader="shaders/lums.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_d", shader="shaders/flowing_noise.glsl", inputs={ time="monitor_d", }},
{ dest="monitor_d", shader="shaders/pixelate.glsl", inputs={ img0="monitor_a", mix="monitor_d", }},
{ dest="monitor_c", shader="shaders/invert.glsl", inputs={ mix="monitor_a", img0="monitor_c", }},
{ dest="monitor_c", shader="shaders/zoom.glsl", inputs={ img0="monitor_c", amount="monitor_b", }},
{ dest="monitor_a", shader="shaders/feedback/blackbar-exploder.glsl", inputs={ last_out="monitor_a", img0="monitor_a", vertical="monitor_c", }},
{ dest="monitor_c", shader="shaders/rgb.glsl", inputs={ red="monitor_a", green="monitor_c", blue="monitor_d", }},
{ dest="monitor_a", shader="shaders/white-to-black.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_a", shader="shaders/negative.glsl", inputs={ img0="monitor_d", mix="monitor_b", }},
{ dest="monitor_c", shader="shaders/negate.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_d", shader="shaders/color_02.glsl", inputs={ img0="monitor_a", mix="monitor_c", }},
{ dest="monitor_d", shader="shaders/mask.glsl", inputs={ mask="monitor_c", img0="monitor_a", mix="monitor_d", }},
{ dest="monitor_d", shader="shaders/displace_by_lum.glsl", inputs={ img0="monitor_a", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/pass.glsl", inputs={ img0="monitor_d", }},
{ dest="monitor_d", shader="shaders/displace_rgb.glsl", inputs={ img0="monitor_b", mix="monitor_a", }},
{ dest="monitor_c", shader="shaders/displace_by_rgb.glsl", inputs={ img0="monitor_c", mix="monitor_a", }},
{ dest="monitor_a", shader="shaders/masks/spiral.glsl", inputs={ balance="monitor_b", speed="monitor_a", }},
{ dest="monitor_d", shader="shaders/text-surround.glsl", inputs={ speed="monitor_c", text0="monitor_b", img0="monitor_d", }},
{ dest="monitor_c", shader="shaders/boxin.glsl", inputs={ img0="monitor_c", shrink="monitor_b", }},
{ dest="monitor_d", shader="shaders/rgb_to_hsv.glsl", inputs={ rgb="monitor_a", }},
{ dest="monitor_a", shader="shaders/move.glsl", inputs={ offset_x="monitor_b", img0="monitor_c", offset_y="monitor_a", }},
{ dest="monitor_c", shader="shaders/pass.glsl", inputs={ img0="monitor_c", }},
}
pipelines[#pipelines + 1] = {
{ dest="monitor_a", shader="shaders/pass.glsl", inputs={ img0="ObjID:2:assets/animals/free/underwater/Pexels Videos 2558530.mp4-SHRINK-REV.mp4", }},
{ dest="monitor_b", shader="shaders/pass.glsl", inputs={ img0="ObjID:3:assets/animals/free/underwater/Video (1).mp4-SHRINK-REV.mp4", }},
{ dest="monitor_c", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_d", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_b", shader="shaders/delay.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_d", shader="shaders/feedback/blackbar-exploder.glsl", inputs={ last_out="monitor_b", img0="monitor_b", vertical="monitor_c", }},
{ dest="monitor_b", shader="shaders/displace_by_rgb.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_b", shader="shaders/daily/00005.glsl", inputs={ mix="monitor_c", img0="monitor_c", time="monitor_c", }},
{ dest="monitor_c", shader="shaders/rainbow-band.glsl", inputs={ mix="monitor_a", img0="monitor_a", time="monitor_c", }},
{ dest="monitor_b", shader="shaders/daily/00003.glsl", inputs={ mix="monitor_d", img0="monitor_c", time="monitor_a", }},
{ dest="monitor_c", shader="shaders/fake-3d.glsl", inputs={ scale="monitor_c", img0="monitor_b", depth="monitor_a", }},
{ dest="monitor_c", shader="shaders/hsv_to_rgb.glsl", inputs={ hsv="monitor_b", }},
{ dest="monitor_c", shader="shaders/flip.glsl", inputs={ img0="monitor_c", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/flip-vertical.glsl", inputs={ img0="monitor_d", mix="monitor_c", }},
{ dest="monitor_a", shader="shaders/explode.glsl", inputs={ img0="monitor_b", mix="monitor_c", }},
{ dest="monitor_c", shader="shaders/text-surround.glsl", inputs={ speed="monitor_b", text0="monitor_a", img0="monitor_c", }},
{ dest="monitor_a", shader="shaders/magnitude.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_b", shader="shaders/move.glsl", inputs={ offset_x="monitor_c", img0="monitor_d", offset_y="monitor_a", }},
{ dest="monitor_a", shader="shaders/feedback/explode.glsl", inputs={ last_out="monitor_b", }},
{ dest="monitor_a", shader="shaders/negative.glsl", inputs={ img0="monitor_c", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/color_02.glsl", inputs={ img0="monitor_a", mix="monitor_c", }},
{ dest="monitor_a", shader="shaders/color-tweak.glsl", inputs={ gamma_dec="monitor_a", gamma="monitor_c", split="monitor_b", img0="monitor_d", brightness="monitor_d", contrast_dec="monitor_a", gamma_inc="monitor_b", contrast_inc="monitor_b", contrast="monitor_c", }},
{ dest="monitor_a", shader="shaders/kscope.glsl", inputs={ mix="monitor_d", center="monitor_d", img0="monitor_b", tweak_1="monitor_a", }},
{ dest="monitor_d", shader="shaders/maskify.glsl", inputs={ negate="monitor_a", img0="monitor_b", lumin_threshold="monitor_c", }},
{ dest="monitor_a", shader="shaders/zoom.glsl", inputs={ img0="monitor_a", amount="monitor_b", }},
{ dest="monitor_a", shader="shaders/daily/00002.glsl", inputs={ mix="monitor_c", img0="monitor_c", contrast="monitor_b", }},
{ dest="monitor_b", shader="shaders/mix.glsl", inputs={ mix_diff="monitor_a", mix_fade2="monitor_c", mix_fade3="monitor_a", a="monitor_a", mix_fade="monitor_d", mix_lumin_b="monitor_a", b="monitor_b", mix_lumin_a="monitor_a", mix_bars="monitor_b", }},
{ dest="monitor_a", shader="shaders/invert.glsl", inputs={ mix="monitor_b", img0="monitor_a", }},
{ dest="monitor_d", shader="shaders/knoty.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_b", shader="shaders/masks/stripes.glsl", inputs={ height="monitor_d", width="monitor_d", }},
{ dest="monitor_c", shader="shaders/rgb_to_hsv.glsl", inputs={ rgb="monitor_b", }},
{ dest="monitor_a", shader="shaders/displace_by_lum.glsl", inputs={ img0="monitor_b", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/masks/spiral.glsl", inputs={ balance="monitor_c", speed="monitor_d", }},
{ dest="monitor_c", shader="shaders/white-to-black.glsl", inputs={ img0="monitor_c", }},
{ dest="monitor_b", shader="shaders/lums.glsl", inputs={ img0="monitor_c", }},
{ dest="monitor_b", shader="shaders/video-wall.glsl", inputs={ min_brightness="monitor_a", boxes="monitor_b", img0="monitor_c", mix="monitor_d", }},
{ dest="monitor_c", shader="shaders/edges.glsl", inputs={ noise="monitor_d", negate="monitor_b", img0="monitor_d", mix="monitor_b", thresh="monitor_d", }},
{ dest="monitor_d", shader="shaders/mix_fade.glsl", inputs={ b="monitor_d", a="monitor_d", mix="monitor_b", }},
{ dest="monitor_d", shader="shaders/brighter.glsl", inputs={ img0="monitor_d", intensity="monitor_a", }},
{ dest="monitor_d", shader="shaders/band_mix.glsl", inputs={ a="monitor_c", time="monitor_b", bands="monitor_a", b="monitor_a", mix="monitor_c", reference="monitor_b", }},
{ dest="monitor_b", shader="shaders/feedback/implode.glsl", inputs={ last_out="monitor_d", }},
{ dest="monitor_a", shader="shaders/mask.glsl", inputs={ mask="monitor_c", img0="monitor_d", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/negate.glsl", inputs={ img0="monitor_c", }},
{ dest="monitor_b", shader="shaders/flowing_noise.glsl", inputs={ time="monitor_c", }},
{ dest="monitor_d", shader="shaders/displace_rgb.glsl", inputs={ img0="monitor_c", mix="monitor_c", }},
{ dest="monitor_d", shader="shaders/pass.glsl", inputs={ img0="monitor_d", }},
{ dest="monitor_c", shader="shaders/rotate.glsl", inputs={ img0="monitor_a", speed="monitor_c", }},
{ dest="monitor_a", shader="shaders/boxin.glsl", inputs={ img0="monitor_d", shrink="monitor_c", }},
{ dest="monitor_a", shader="shaders/rgb.glsl", inputs={ red="monitor_b", green="monitor_b", blue="monitor_d", }},
{ dest="monitor_a", shader="shaders/band.glsl", inputs={ target="monitor_d", bands="monitor_b", img0="monitor_a", mix="monitor_c", }},
{ dest="monitor_b", shader="shaders/filter-whites.glsl", inputs={ img0="monitor_a", thresh="monitor_c", }},
{ dest="monitor_c", shader="shaders/test.glsl", inputs={ img0="monitor_d", blue="monitor_d", }},
{ dest="monitor_a", shader="shaders/daily/00006.glsl", inputs={ b="monitor_a", a="monitor_b", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/blur.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_b", shader="shaders/color_01.glsl", inputs={ img0="monitor_a", mix="monitor_d", }},
{ dest="monitor_c", shader="shaders/rotate-corners.glsl", inputs={ img0="monitor_b", }},
{ dest="monitor_c", shader="shaders/pixelate.glsl", inputs={ img0="monitor_c", mix="monitor_a", }},
{ dest="monitor_d", shader="shaders/pass.glsl", inputs={ img0="monitor_d", }},
}
pipelines[#pipelines + 1] = {
{ dest="monitor_a", shader="shaders/pass.glsl", inputs={ img0="ObjID:2:assets/animals/free/underwater/Pexels Videos 2558530.mp4-SHRINK-REV.mp4", }},
{ dest="monitor_b", shader="shaders/pass.glsl", inputs={ img0="ObjID:3:assets/animals/free/underwater/Video (1).mp4-SHRINK-REV.mp4", }},
{ dest="monitor_c", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_d", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_b", shader="shaders/delay.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_d", shader="shaders/feedback/blackbar-exploder.glsl", inputs={ last_out="monitor_b", img0="monitor_b", vertical="monitor_c", }},
{ dest="monitor_b", shader="shaders/displace_by_rgb.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_b", shader="shaders/daily/00005.glsl", inputs={ mix="monitor_c", img0="monitor_c", time="monitor_c", }},
{ dest="monitor_c", shader="shaders/rainbow-band.glsl", inputs={ mix="monitor_a", img0="monitor_a", time="monitor_c", }},
{ dest="monitor_b", shader="shaders/daily/00003.glsl", inputs={ mix="monitor_d", img0="monitor_c", time="monitor_a", }},
{ dest="monitor_c", shader="shaders/fake-3d.glsl", inputs={ scale="monitor_c", img0="monitor_b", depth="monitor_a", }},
{ dest="monitor_c", shader="shaders/hsv_to_rgb.glsl", inputs={ hsv="monitor_b", }},
{ dest="monitor_c", shader="shaders/flip.glsl", inputs={ img0="monitor_c", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/flip-vertical.glsl", inputs={ img0="monitor_d", mix="monitor_c", }},
{ dest="monitor_a", shader="shaders/explode.glsl", inputs={ img0="monitor_b", mix="monitor_c", }},
{ dest="monitor_c", shader="shaders/text-surround.glsl", inputs={ speed="monitor_b", text0="monitor_a", img0="monitor_c", }},
{ dest="monitor_a", shader="shaders/magnitude.glsl", inputs={ img0="monitor_a", }},
{ dest="monitor_b", shader="shaders/move.glsl", inputs={ offset_x="monitor_c", img0="monitor_d", offset_y="monitor_a", }},
{ dest="monitor_a", shader="shaders/feedback/explode.glsl", inputs={ last_out="monitor_b", }},
{ dest="monitor_a", shader="shaders/negative.glsl", inputs={ img0="monitor_c", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/color_02.glsl", inputs={ img0="monitor_a", mix="monitor_c", }},
{ dest="monitor_a", shader="shaders/color-tweak.glsl", inputs={ gamma_dec="monitor_a", gamma="monitor_c", split="monitor_b", img0="monitor_d", brightness="monitor_d", contrast_dec="monitor_a", gamma_inc="monitor_b", contrast_inc="monitor_b", contrast="monitor_c", }},
{ dest="monitor_a", shader="shaders/kscope.glsl", inputs={ mix="monitor_d", center="monitor_d", img0="monitor_b", tweak_1="monitor_a", }},
{ dest="monitor_d", shader="shaders/maskify.glsl", inputs={ negate="monitor_a", img0="monitor_b", lumin_threshold="monitor_c", }},
{ dest="monitor_a", shader="shaders/zoom.glsl", inputs={ img0="monitor_a", amount="monitor_b", }},
{ dest="monitor_a", shader="shaders/daily/00002.glsl", inputs={ mix="monitor_c", img0="monitor_c", contrast="monitor_b", }},
{ dest="monitor_b", shader="shaders/mix.glsl", inputs={ mix_diff="monitor_a", mix_fade2="monitor_c", mix_fade3="monitor_a", a="monitor_a", mix_fade="monitor_d", mix_lumin_b="monitor_a", b="monitor_b", mix_lumin_a="monitor_a", mix_bars="monitor_b", }},
{ dest="monitor_a", shader="shaders/invert.glsl", inputs={ mix="monitor_b", img0="monitor_a", }},
{ dest="monitor_d", shader="shaders/knoty.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_b", shader="shaders/masks/stripes.glsl", inputs={ height="monitor_d", width="monitor_d", }},
{ dest="monitor_c", shader="shaders/rgb_to_hsv.glsl", inputs={ rgb="monitor_b", }},
{ dest="monitor_a", shader="shaders/displace_by_lum.glsl", inputs={ img0="monitor_b", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/masks/spiral.glsl", inputs={ balance="monitor_c", speed="monitor_d", }},
{ dest="monitor_c", shader="shaders/white-to-black.glsl", inputs={ img0="monitor_c", }},
{ dest="monitor_b", shader="shaders/lums.glsl", inputs={ img0="monitor_c", }},
{ dest="monitor_b", shader="shaders/video-wall.glsl", inputs={ min_brightness="monitor_a", boxes="monitor_b", img0="monitor_c", mix="monitor_d", }},
{ dest="monitor_c", shader="shaders/edges.glsl", inputs={ noise="monitor_d", negate="monitor_b", img0="monitor_d", mix="monitor_b", thresh="monitor_d", }},
{ dest="monitor_d", shader="shaders/mix_fade.glsl", inputs={ b="monitor_d", a="monitor_d", mix="monitor_b", }},
{ dest="monitor_d", shader="shaders/brighter.glsl", inputs={ img0="monitor_d", intensity="monitor_a", }},
{ dest="monitor_d", shader="shaders/band_mix.glsl", inputs={ a="monitor_c", time="monitor_b", bands="monitor_a", b="monitor_a", mix="monitor_c", reference="monitor_b", }},
{ dest="monitor_b", shader="shaders/feedback/implode.glsl", inputs={ last_out="monitor_d", }},
{ dest="monitor_a", shader="shaders/mask.glsl", inputs={ mask="monitor_c", img0="monitor_d", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/negate.glsl", inputs={ img0="monitor_c", }},
{ dest="monitor_b", shader="shaders/flowing_noise.glsl", inputs={ time="monitor_c", }},
{ dest="monitor_d", shader="shaders/displace_rgb.glsl", inputs={ img0="monitor_c", mix="monitor_c", }},
{ dest="monitor_d", shader="shaders/pass.glsl", inputs={ img0="monitor_d", }},
{ dest="monitor_c", shader="shaders/rotate.glsl", inputs={ img0="monitor_a", speed="monitor_c", }},
{ dest="monitor_a", shader="shaders/boxin.glsl", inputs={ img0="monitor_d", shrink="monitor_c", }},
{ dest="monitor_a", shader="shaders/rgb.glsl", inputs={ red="monitor_b", green="monitor_b", blue="monitor_d", }},
{ dest="monitor_a", shader="shaders/band.glsl", inputs={ target="monitor_d", bands="monitor_b", img0="monitor_a", mix="monitor_c", }},
{ dest="monitor_b", shader="shaders/filter-whites.glsl", inputs={ img0="monitor_a", thresh="monitor_c", }},
{ dest="monitor_c", shader="shaders/test.glsl", inputs={ img0="monitor_d", blue="monitor_d", }},
{ dest="monitor_a", shader="shaders/daily/00006.glsl", inputs={ b="monitor_a", a="monitor_b", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/blur.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_b", shader="shaders/color_01.glsl", inputs={ img0="monitor_a", mix="monitor_d", }},
{ dest="monitor_c", shader="shaders/rotate-corners.glsl", inputs={ img0="monitor_b", }},
{ dest="monitor_c", shader="shaders/pixelate.glsl", inputs={ img0="monitor_c", mix="monitor_a", }},
{ dest="monitor_b", shader="shaders/pass.glsl", inputs={ img0="monitor_b", }},
}
pipelines[#pipelines + 1] = {
{ dest="monitor_a", shader="shaders/pass.glsl", inputs={ img0="ObjID:2:assets/animals/free/underwater/Pexels Videos 2558530.mp4-SHRINK-REV.mp4", }},
{ dest="monitor_b", shader="shaders/pass.glsl", inputs={ img0="ObjID:3:assets/animals/free/underwater/Video (1).mp4-SHRINK-REV.mp4", }},
{ dest="monitor_c", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_d", shader="shaders/pass.glsl", inputs={ img0="0", }},
{ dest="monitor_d", shader="shaders/mix_fade.glsl", inputs={ b="monitor_c", a="monitor_a", mix="monitor_b", }},
{ dest="monitor_a", shader="shaders/edges.glsl", inputs={ noise="monitor_c", negate="monitor_b", img0="monitor_c", mix="monitor_d", thresh="monitor_c", }},
{ dest="monitor_d", shader="shaders/feedback/blackbar-exploder.glsl", inputs={ last_out="monitor_d", img0="monitor_a", vertical="monitor_b", }},
{ dest="monitor_b", shader="shaders/white-to-black.glsl", inputs={ img0="monitor_c", }},
{ dest="monitor_c", shader="shaders/displace_rgb.glsl", inputs={ img0="monitor_c", mix="monitor_c", }},
{ dest="monitor_c", shader="shaders/lums.glsl", inputs={ img0="monitor_b", }},
{ dest="monitor_c", shader="shaders/rgb.glsl", inputs={ red="monitor_b", green="monitor_a", blue="monitor_d", }},
{ dest="monitor_c", shader="shaders/explode.glsl", inputs={ img0="monitor_c", mix="monitor_c", }},
{ dest="monitor_b", shader="shaders/mask.glsl", inputs={ mask="monitor_b", img0="monitor_b", mix="monitor_d", }},
{ dest="monitor_d", shader="shaders/filter-whites.glsl", inputs={ img0="monitor_a", thresh="monitor_d", }},
{ dest="monitor_a", shader="shaders/daily/00005.glsl", inputs={ mix="monitor_a", img0="monitor_b", time="monitor_a", }},
{ dest="monitor_c", shader="shaders/knoty.glsl", inputs={ img0="monitor_d", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/kscope.glsl", inputs={ mix="monitor_d", center="monitor_c", img0="monitor_c", tweak_1="monitor_a", }},
{ dest="monitor_a", shader="shaders/color_01.glsl", inputs={ img0="monitor_d", mix="monitor_c", }},
{ dest="monitor_a", shader="shaders/feedback/implode.glsl", inputs={ last_out="monitor_c", }},
{ dest="monitor_d", shader="shaders/zoom.glsl", inputs={ img0="monitor_c", amount="monitor_c", }},
{ dest="monitor_b", shader="shaders/negative.glsl", inputs={ img0="monitor_c", mix="monitor_c", }},
{ dest="monitor_c", shader="shaders/boxin.glsl", inputs={ img0="monitor_d", shrink="monitor_a", }},
{ dest="monitor_a", shader="shaders/flowing_noise.glsl", inputs={ time="monitor_b", }},
{ dest="monitor_d", shader="shaders/flip.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_c", shader="shaders/fake-3d.glsl", inputs={ scale="monitor_d", img0="monitor_d", depth="monitor_d", }},
{ dest="monitor_a", shader="shaders/band.glsl", inputs={ target="monitor_b", bands="monitor_c", img0="monitor_a", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/flip-vertical.glsl", inputs={ img0="monitor_c", mix="monitor_a", }},
{ dest="monitor_c", shader="shaders/feedback/explode.glsl", inputs={ last_out="monitor_c", }},
{ dest="monitor_c", shader="shaders/daily/00003.glsl", inputs={ mix="monitor_d", img0="monitor_d", time="monitor_a", }},
{ dest="monitor_b", shader="shaders/pixelate.glsl", inputs={ img0="monitor_a", mix="monitor_c", }},
{ dest="monitor_b", shader="shaders/move.glsl", inputs={ offset_x="monitor_a", img0="monitor_a", offset_y="monitor_b", }},
{ dest="monitor_c", shader="shaders/text-surround.glsl", inputs={ speed="monitor_a", text0="monitor_c", img0="monitor_d", }},
{ dest="monitor_a", shader="shaders/rotate.glsl", inputs={ img0="monitor_b", speed="monitor_c", }},
{ dest="monitor_c", shader="shaders/magnitude.glsl", inputs={ img0="monitor_b", }},
{ dest="monitor_b", shader="shaders/daily/00006.glsl", inputs={ b="monitor_c", a="monitor_b", mix="monitor_c", }},
{ dest="monitor_d", shader="shaders/mix.glsl", inputs={ mix_diff="monitor_a", mix_fade2="monitor_b", mix_fade3="monitor_b", a="monitor_d", mix_fade="monitor_a", mix_lumin_b="monitor_b", b="monitor_b", mix_lumin_a="monitor_a", mix_bars="monitor_a", }},
{ dest="monitor_b", shader="shaders/color-tweak.glsl", inputs={ gamma_dec="monitor_d", gamma="monitor_a", split="monitor_b", img0="monitor_d", brightness="monitor_a", contrast_dec="monitor_c", gamma_inc="monitor_c", contrast_inc="monitor_a", contrast="monitor_d", }},
{ dest="monitor_b", shader="shaders/displace_by_rgb.glsl", inputs={ img0="monitor_b", mix="monitor_b", }},
{ dest="monitor_b", shader="shaders/masks/stripes.glsl", inputs={ height="monitor_d", width="monitor_d", }},
{ dest="monitor_b", shader="shaders/maskify.glsl", inputs={ negate="monitor_d", img0="monitor_b", lumin_threshold="monitor_a", }},
{ dest="monitor_a", shader="shaders/video-wall.glsl", inputs={ min_brightness="monitor_d", boxes="monitor_d", img0="monitor_a", mix="monitor_d", }},
{ dest="monitor_b", shader="shaders/pass.glsl", inputs={ img0="monitor_b", }},
{ dest="monitor_b", shader="shaders/masks/spiral.glsl", inputs={ balance="monitor_a", speed="monitor_a", }},
{ dest="monitor_b", shader="shaders/blur.glsl", inputs={ img0="monitor_d", mix="monitor_a", }},
{ dest="monitor_d", shader="shaders/color_02.glsl", inputs={ img0="monitor_a", mix="monitor_a", }},
{ dest="monitor_b", shader="shaders/rainbow-band.glsl", inputs={ mix="monitor_b", img0="monitor_a", time="monitor_c", }},
{ dest="monitor_d", shader="shaders/delay.glsl", inputs={ img0="monitor_b", mix="monitor_b", }},
{ dest="monitor_c", shader="shaders/daily/00002.glsl", inputs={ mix="monitor_d", img0="monitor_a", contrast="monitor_b", }},
{ dest="monitor_d", shader="shaders/test.glsl", inputs={ img0="monitor_d", blue="monitor_a", }},
{ dest="monitor_a", shader="shaders/displace_by_lum.glsl", inputs={ img0="monitor_c", mix="monitor_a", }},
{ dest="monitor_c", shader="shaders/rotate-corners.glsl", inputs={ img0="monitor_b", }},
{ dest="monitor_d", shader="shaders/invert.glsl", inputs={ mix="monitor_d", img0="monitor_b", }},
{ dest="monitor_a", shader="shaders/hsv_to_rgb.glsl", inputs={ hsv="monitor_d", }},
{ dest="monitor_c", shader="shaders/band_mix.glsl", inputs={ a="monitor_d", time="monitor_b", bands="monitor_d", b="monitor_b", mix="monitor_a", reference="monitor_a", }},
{ dest="monitor_a", shader="shaders/rgb_to_hsv.glsl", inputs={ rgb="monitor_b", }},
{ dest="monitor_b", shader="shaders/negate.glsl", inputs={ img0="monitor_d", }},
{ dest="monitor_b", shader="shaders/brighter.glsl", inputs={ img0="monitor_b", intensity="monitor_d", }},
{ dest="monitor_a", shader="shaders/pass.glsl", inputs={ img0="monitor_a", }},
}
|
lr = ImportPackage("lightstreamer")
Edit = false
SelectedLight = 0
lightUI = 0
LightTimer = 0
UITimer = 0
EditMode = EDIT_LOCATION
LightsInWorld = {}
TemporySelectedLight = 0
AddEvent("OnPackageStart", function()
local ScreenX, ScreenY = GetScreenSize()
lightUI = CreateWebUI(0.0, 0.0, 0.0, 0.0, 1, 30)
SetWebAnchors(lightUI, 0.72, 0.0, 1.0, 1.0)
LoadWebFile(lightUI, 'http://asset/' .. GetPackageName() .. '/lighteditor.html')
SetWebVisibility(lightUI, WEB_HIDDEN)
end)
AddEvent("OnKeyPress", function(key)
if (key == "K") then LightEditMode() end
if not Edit then return end
if (key == "Left Mouse Button") then LightSelection()
elseif (key == "Left Alt" and SelectedLight ~= 0) then ChangeEditorState()
elseif (key == "Delete" and SelectedLight ~= 0) then LightDestroy()
elseif (IsCtrlPressed() and key == 'V' and SelectedLight ~= 0) then CallRemoteEvent("LightDuplication", SelectedLight)
end
end)
function LightEditMode()
if(Edit) then Edit = false
else Edit = true end
CallRemoteEvent("EditState", Edit)
end
AddRemoteEvent("EditMode", function(lights)
LightsInWorld = lights
ShowMouseCursor(Edit)
if (Edit) then
SetInputMode(INPUT_GAMEANDUI)
SetWebVisibility(lightUI, WEB_VISIBLE)
ExecuteWebJS(lightUI, 'ShowUI()')
CallRemoteEvent("GetEditorLights")
else
SetInputMode(INPUT_GAME)
SetWebVisibility(lightUI, WEB_HIDDEN)
if(SelectedLight ~= 0) then
if(UITimer ~= 0)then DestroyTimer(UITimer) end
SetObjectEditable(SelectedLight, EDIT_NONE)
SelectedLight = 0
end
end
ShowEdit(Edit, lights)
end)
function ShowEdit(edit)
for k, v in pairs(LightsInWorld) do
if(IsValidObject(k)) then
local ObjectActor = GetObjectActor(k)
if (edit) then
ObjectActor:SetActorScale3D(FVector(1.0, 1.0, 1.0))
else
ObjectActor:SetActorScale3D(FVector(0.01, 0.01, 0.01))
end
ObjectActor:SetActorEnableCollision(edit)
end
end
ShowLight(edit)
end
function ShowLight(edit)
if not edit then DestroyTimer(LightTimer)
else
LightTimer = CreateTimer(function()
local ScreenX, ScreenY = GetScreenSize()
for k, v in pairs(LightsInWorld) do
if(IsValidObject(v)) then
local x, y, z = GetObjectLocation(v)
local bs,sx,sy = WorldToScreen(x, y, z)
if bs then
if(v == SelectedLight) then
DrawVector()
SetDrawColor(RGB(255, 255, 0, 255))
else
SetDrawColor(RGB(255, 255, 255, 255))
end
local MinX, MinY, MinZ, MaxX, MaxY, MaxZ = GetObjectBoundingBox(v)
DrawLight(MinX, MinY, MinZ, MaxX, MaxY, MaxZ)
end
end
end
end, 8)
end
end
function DrawVector()
local actorlight = GetObjectActor(SelectedLight)
local x, y, z = GetObjectLocation(SelectedLight)
local FV = actorlight:GetActorForwardVector()
local sX = FV.X * 50 + x
local sY = FV.Y * 50 + y
local sZ = FV.Z * 50 + z
local eX = FV.X * 150 + x
local eY = FV.Y * 150 + y
local eZ = FV.Z * 150 + z
SetDrawColor(RGB(10, 100, 125, 255))
DrawLine3D(sX, sY, sZ, eX, eY, eZ, 4)
end
function DrawLight(MinX, MinY, MinZ, MaxX, MaxY, MaxZ)
local size = 2
DrawLine3D(MinX, MinY, MinZ, MaxX, MinY, MinZ, size)
DrawLine3D(MinX, MinY, MinZ, MinX, MaxY, MinZ, size)
DrawLine3D(MinX, MinY, MinZ, MinX, MinY, MaxZ, size)
DrawLine3D(MaxX, MinY, MinZ, MaxX, MaxY, MinZ, size)
DrawLine3D(MaxX, MinY, MinZ, MaxX, MinY, MaxZ, size)
DrawLine3D(MinX, MaxY, MinZ, MaxX, MaxY, MinZ, size)
DrawLine3D(MinX, MaxY, MinZ, MinX, MaxY, MaxZ, size)
DrawLine3D(MinX, MinY, MaxZ, MaxX, MinY, MaxZ, size)
DrawLine3D(MinX, MinY, MaxZ, MinX, MaxY, MaxZ, size)
DrawLine3D(MaxX, MaxY, MaxZ, MaxX, MaxY, MinZ, size)
DrawLine3D(MaxX, MaxY, MaxZ, MinX, MaxY, MaxZ, size)
DrawLine3D(MaxX, MaxY, MaxZ, MaxX, MinY, MaxZ, size)
end
function LightSelection()
local x, y, z, distance = GetMouseHitLocation()
local EntityType, EntityId = GetMouseHitEntity()
if (TemporySelectedLight ~= 0) then
LightSet(x, y, z)
elseif (EntityType == HIT_OBJECT and EntityId ~= 0 and GetObjectPropertyValue(EntityId, "_lightStream") and SelectedLight ~= EntityId) then
SelectedLight = EntityId
SetObjectEditable(SelectedLight, EDIT_LOCATION)
GetUIlightInfo()
local lp = GetObjectPropertyValue(SelectedLight, "_lightStream")
local text = string.lower(lp.lighttype).." selected !"
ExecuteWebJS(lightUI, 'UIinfoText("'..text..'")')
end
end
function LightSet(x, y, z)
CallRemoteEvent("CreateEditorLight", TemporySelectedLight, x, y, z)
TemporySelectedLight = 0
end
function ChangeEditorState()
if EditMode == EDIT_LOCATION then EditMode = EDIT_ROTATION
else EditMode = EDIT_LOCATION end
SetObjectEditable(SelectedLight, EditMode)
end
function LightDestroy()
CallRemoteEvent("DeleteLight", SelectedLight)
DestroyTimer(UITimer)
SelectedLight = 0
ExecuteWebJS(lightUI, 'ShowUI()')
end
function GetUIlightInfo()
local lp = GetObjectPropertyValue(SelectedLight, "_lightStream")
if(lp.lighttype == "SPOTLIGHT") then type = 1
elseif(lp.lighttype == "POINTLIGHT") then type = 2
elseif(lp.lighttype == "RECTLIGHT") then type = 3
end
if(lp.shadow) then shadow = 1
else shadow = 0 end
ExecuteWebJS(lightUI, 'UIlightUpdate('..type..', '..SelectedLight..')')
local x, y, z = GetObjectLocation(SelectedLight)
local rx, ry, rz = GetObjectRotation(SelectedLight)
local r, g, b = HexToRGBA(lp.color)
local color = tostring(rgb2hex(r, g, b))
ExecuteWebJS(lightUI, 'UpdatePosition (' .. x .. ', ' .. y .. ', ' .. z .. ')')
ExecuteWebJS(lightUI, 'UpdateRotation (' .. rx .. ', ' .. ry .. ', ' .. rz .. ')')
ExecuteWebJS(lightUI, 'UpdateBase (' .. r .. ', ' .. g .. ', ' .. b .. ', '.. lp.intensity .. ', ' .. lp.attenuation_radius .. ', ' .. shadow .. ', ' .. lp.stream_distance ..')')
if(lp.lighttype == "SPOTLIGHT") then
ExecuteWebJS(lightUI, 'UpdateSpotlight (' .. lp.outer_cone .. ', ' .. lp.inner_cone .. ', ' .. lp.falloff .. ', ' .. lp.source_lenght .. ', ' .. lp.source_radius .. ', ' .. lp.soft_source_radius .. ')')
elseif(lp.lighttype == "POINTLIGHT") then
ExecuteWebJS(lightUI, 'UpdatePointlight (' .. lp.falloff .. ', ' .. lp.source_lenght .. ', ' .. lp.source_radius .. ', ' .. lp.soft_source_radius .. ')')
elseif(lp.lighttype == "RECTLIGHT") then
ExecuteWebJS(lightUI, 'UpdateRectlight (' .. lp.barn_door_angle .. ', ' .. lp.barn_door_lenght .. ', ' .. lp.source_height .. ', ' .. lp.source_width .. ')')
end
end
function UpdateSelectedPosition(x, y, z)
if(SelectedLight ~= 0) then
CallRemoteEvent("UpdatePos", SelectedLight, x, y, z)
end
end
AddEvent("UpdateSelectedPosition", UpdateSelectedPosition)
function UpdateSelectedRotation(rx, ry, rz)
if(SelectedLight ~= 0) then
CallRemoteEvent("UpdateRot", SelectedLight, rx, ry, rz)
end
end
AddEvent("UpdateSelectedRotation", UpdateSelectedRotation)
function SetLightCollision(light, lights)
SelectedLight = light
Alight = GetObjectActor(SelectedLight)
Alight:SetActorScale3D(FVector(1.0, 1.0, 1.0))
Alight:SetActorEnableCollision(true)
SetObjectEditable(SelectedLight, EDIT_LOCATION)
LightsInWorld = lights
GetUIlightInfo()
local lp = GetObjectPropertyValue(SelectedLight, "_lightStream")
local text = string.lower(lp.lighttype).." created !"
ExecuteWebJS(lightUI, 'UIinfoText("'.. text ..'")')
end
AddRemoteEvent("SetLightCollision", SetLightCollision)
AddEvent("UILightSelection", function(lighttype)
if(SelectedLight ~= 0) then
if(UITimer ~= 0)then DestroyTimer(UITimer) end
SetObjectEditable(SelectedLight, EDIT_NONE)
SelectedLight = 0
end
TemporySelectedLight = lighttype
end)
AddEvent("ChangeLightColor", function(hex)
local r, g, b = hex2rgb(hex)
local color = RGB(r, g, b)
CallRemoteEvent("LightColor", SelectedLight, color)
end)
AddEvent("LightsSave", function()
CallRemoteEvent("LightSave")
end)
AddEvent("LightDeleteAll", function()
DestroyTimer(UITimer)
SelectedLight = 0
ExecuteWebJS(lightUI, 'ShowUI()')
CallRemoteEvent("DeleteAllLight")
end)
AddEvent("LightDelete", function()
LightDestroy()
end)
AddEvent("LightDuplicate", function()
local ObjectActor = GetObjectActor(SelectedLight)
local Vector = ObjectActor:GetActorLocation()
CallRemoteEvent("LightDuplication", SelectedLight)
end)
AddEvent("ChangeLightIntensity", function(intensity)
CallRemoteEvent("LightIntensity", SelectedLight, intensity)
end)
AddEvent("ChangeLightAttenuationradius", function(radius)
CallRemoteEvent("LightAttenuationradius", SelectedLight, radius)
end)
AddEvent("ChangeLightShadow", function(shadow)
CallRemoteEvent("LightShadow", SelectedLight, shadow)
end)
AddEvent("ChangeLightStreamradius", function(radius)
CallRemoteEvent("LightStreamRadius", SelectedLight, radius)
end)
AddEvent("ChangeLightOutercone", function(cone)
CallRemoteEvent("LightOuterCone", SelectedLight, cone)
end)
AddEvent("ChangeLightInnercone", function(cone)
CallRemoteEvent("LightInnerCone", SelectedLight, cone)
end)
AddEvent("ChangeLightFalloff", function(falloff)
CallRemoteEvent("LightFalloff", SelectedLight, falloff)
end)
AddEvent("ChangeLightSourceradius", function(radius)
CallRemoteEvent("LightSourceRadius", SelectedLight, radius)
end)
AddEvent("ChangeLightSourcelenght", function(lenght)
CallRemoteEvent("LightSourceLenght", SelectedLight, lenght)
end)
AddEvent("ChangeLightSoftsourceradius", function(radius)
CallRemoteEvent("LightSoftSourceRadius", SelectedLight, radius)
end)
AddEvent("ChangeLightDoorangle", function(angle)
CallRemoteEvent("LightDoorAngle", SelectedLight, angle)
end)
AddEvent("ChangeLightDoorlenght", function(lenght)
CallRemoteEvent("LightDoorLenght", SelectedLight, lenght)
end)
AddEvent("ChangeLightSourceheight", function(height)
CallRemoteEvent("LightSourceHeight", SelectedLight, height)
end)
AddEvent("ChangeLightSourcewidth", function(width)
CallRemoteEvent("LightSourceWidth", SelectedLight, width)
end)
AddEvent("ChangeWorldTime", function(time)
SetTime(time)
end)
function hex2rgb(hex)
hex = hex:gsub("#","")
return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6))
end
function rgb2hex(red, green, blue, alpha)
-- Make sure RGB values passed to this function are correct
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
-- Alpha check
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
AddEvent("OnPlayerBeginEditObject", function(light)
UITimer = CreateTimer(function()
local x, y, z = GetObjectLocation(SelectedLight)
local rx, ry, rz = GetObjectRotation(SelectedLight)
ExecuteWebJS(lightUI, 'UpdatePosition (' .. x .. ', ' .. y .. ', ' .. z .. ')')
ExecuteWebJS(lightUI, 'UpdateRotation (' .. rx .. ', ' .. ry .. ', ' .. rz .. ')')
end, 100)
end)
AddEvent("OnPlayerEndEditObject", function(light)
if(UITimer ~= 0)then DestroyTimer(UITimer) end
local x, y, z = GetObjectLocation(SelectedLight)
local rx, ry, rz = GetObjectRotation(SelectedLight)
CallRemoteEvent("UpdatePos", light, x, y, z)
CallRemoteEvent("UpdateRos", light, rx, ry, rz)
end)
|
local vim = vim
-- vim.api.nvim_set_keymap('n', '<c-p>', [[<cmd>lua require('telescope.builtin').git_files({previewer = false })<cr>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<c-p>', [[<cmd>lua require('jw.telescope.utils').find_files({previewer = false })<cr>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>fh', [[<cmd>lua require('telescope.builtin').oldfiles()<cr>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>fs', [[<cmd>lua require('telescope.builtin').live_grep()<cr>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>fS', [[<cmd>lua require('telescope.builtin').grep_string()<cr>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>fb', [[<cmd>lua require('telescope.builtin').buffers()<cr>]], { noremap = true, silent = true })
require('telescope').setup{
defaults = {
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {
}
}
}
}
require("telescope").load_extension("ui-select")
|
-- Base16 Rigel color
-- Author: Alexander Keliris
-- to be use in your theme.lua
-- symlink or copy to config folder `local color = require('color')`
local M = {}
M.base00 = "#00384d" -- ----
M.base01 = "#9cf087" -- ---
M.base02 = "#ffcc1b" -- --
M.base03 = "#517f8d" -- -
M.base04 = "#7eb2dd" -- +
M.base05 = "#77929e" -- ++
M.base06 = "#fb94ff" -- +++
M.base07 = "#e6e6dc" -- ++++
M.base08 = "#c43061" -- red
M.base09 = "#ff5a67" -- orange
M.base0A = "#f08e48" -- yellow
M.base0B = "#7fc06e" -- green
M.base0C = "#00cccc" -- aqua/cyan
M.base0D = "#1c8db2" -- blue
M.base0E = "#c694ff" -- purple
M.base0F = "#00ffff" -- brown
return M
|
-- Data Loader for video datasets: FBMS + VSB + DAVIS
require 'torch'
require'lfs'
local cv = require 'cv'
require 'cv.imgcodecs'
local image = require 'image'
local sys = require 'sys'
local xlua = require 'xlua' -- xlua provides useful tools, like progress bars
local ffi = require 'ffi'
local DataRobot = torch.class('DataRobot')
function DataRobot:__init(config)
assert(config.data_path, 'Must provide label list file')
self.dataPath = config.data_path
self.imgType = config.data_type
self.posMaskAddr = {}
self.posImAddr = {}
self.negImAddr = {}
for model_run in lfs.dir(self.dataPath) do
local runMaskAddr = {}
local runImAddr = {}
if model_run ~= '.' and model_run ~= '..' then
isNeg = (string.find(model_run, 'neg') ~= nil)
for file in lfs.dir(self.dataPath .. model_run) do
if string.find(file,self.imgType) then
if string.find(file, 'mask') then
dataNum = tonumber(string.match(file, '%d%d%d%d'))
runMaskAddr[dataNum] = model_run .. '/' .. file
elseif string.find(file, 'img') then
dataNum = tonumber(string.match(file, '%d%d%d%d'))
runImAddr[dataNum] = model_run .. '/' .. file
end
end
end
assert (isNeg or #runImAddr == #runMaskAddr, model_run .. ' is corrupted! Img and mask num does not match')
if isNeg then
for i=0, #runImAddr do
imAddr = runImAddr[i]
self.negImAddr[#self.negImAddr + 1] = imAddr
end
else
for i=0, #runImAddr do
maskAddr = runMaskAddr[i]
imAddr = runImAddr[i]
self.posMaskAddr[#self.posMaskAddr + 1] = maskAddr
self.posImAddr[#self.posImAddr + 1] = imAddr
end
end
print ("Finished processing " .. model_run)
end
end
end
function DataRobot:randomPosExample()
local dataIdx = math.floor(1 + torch.uniform() * #self.posImAddr)
local img, mask
if self.imgType == 'tiff' then
mask = cv.imread{self.dataPath .. self.posMaskAddr[dataIdx], cv.IMREAD_GRAYSCALE}
img_bgr = cv.imread{self.dataPath .. self.posImAddr[dataIdx], cv.IMREAD_COLOR}
img_bgr = torch.split(img_bgr, 1, 3)
img = torch.cat({img_bgr[3], img_bgr[2], img_bgr[1]}, 3):transpose(1,3)
img = img:double():mul(1./255)
else
img = image.load(self.dataPath .. self.posImAddr[dataIdx])
mask = image.load(self.dataPath .. self.posMaskAddr[dataIdx]):mul(255.0)
end
return img, mask
end
function DataRobot:randomNegExample()
local dataIdx = math.floor(1 + torch.uniform() * #self.negImAddr)
local img
if self.imgType == 'tiff' then
img_bgr = cv.imread{self.dataPath .. self.negImAddr[dataIdx], cv.IMREAD_COLOR}
img_bgr = torch.split(img_bgr, 1, 3)
img = torch.cat({img_bgr[3], img_bgr[2], img_bgr[1]}, 3):transpose(1,3)
img = img:double():mul(1./255)
else
img = image.load(self.dataPath .. self.negImAddr[dataIdx])
end
return img
end |
return {
summary = 'In the beginning, there was nothing.',
description = [[
`lovr` is the single global table that is exposed to every LÖVR app. It contains a set of
**modules** and a set of **callbacks**.
]],
sections = {
{
name = 'Modules',
tag = 'modules',
description = [[
Modules are the **what** of your app; you can use the functions in modules to tell LÖVR to
do things. For example, you can draw things on the screen, figure out what buttons on a
controller are pressed, or load a 3D model from a file. Each module does what it says on
the tin, so the `lovr.graphics` module deals with rendering graphics and `lovr.headset`
allows you to interact with VR hardware.
]]
},
{
name = 'Callbacks',
tag = 'callbacks',
description = [[
Callbacks are the **when** of the application; you write code inside callbacks which LÖVR
then calls at certain points in time. For example, the `lovr.load` callback is called once
at startup, and `lovr.focus` is called when the VR application gains or loses input focus.
]]
},
{
name = 'Version',
tag = 'version',
description = 'This function can be used to get the current version of LÖVR.'
}
}
}
|
function compressInputItems(inputItems)
local m = {};
for _, inputItem in ipairs(inputItems) do
local itemName = inputItem[1];
local amount = inputItem[2];
if m[itemName] == nil then
m[itemName] = 0;
end
m[itemName] = m[itemName] + amount;
end
local compressedInputItems = {};
for _, inputItem in ipairs(inputItems) do
local itemName = inputItem[1];
local amount = inputItem[2];
if m[itemName] ~= nil then
table.insert(compressedInputItems, {itemName, m[itemName]});
m[itemName] = nil;
end
end
return compressedInputItems;
end
--[[ Return a key that is used to identify recipe in the table. ]]
function getRecipeKey(recipe)
local compressedInputItems = compressInputItems(recipe.inputItems);
local key = {};
for i = 1, 3 do
local inputItem = compressedInputItems[i];
local itemName = inputItem[1];
local amount = inputItem[2];
key[i] = string.format('%s%i', itemName, amount);
end
return table.concat(key);
end
return {
getRecipeKey=getRecipeKey,
}; |
return {'deze','dezelfde','dezelve','dezen','dezer','dezerzijds','dezes','dezulke','dezulken','dezelfden','deze'} |
#!/usr/bin/env lua
require 'Test.Assertion'
plan(6)
if not require_ok 'Spore.Middleware.Parameter.Force' then
skip_rest "no Spore.Middleware.Parameter.Force"
os.exit()
end
local mw = require 'Spore.Middleware.Parameter.Force'
equals( require 'Spore'.early_validate, false, "early_validate" )
local req = require 'Spore.Request'.new({ spore = { params = { prm1 = 0 } }})
is_table( req, "Spore.Request.new" )
equals( req.env.spore.params.prm1, 0 )
local _ = mw.call( {
prm1 = 1,
prm2 = 2,
}, req )
equals( req.env.spore.params.prm1, 1 )
equals( req.env.spore.params.prm2, 2 )
|
local enableDevMode = false
------------------------------------------------------------------------------------------------------------------------
-- Slots Spinner Server
-- Author Morticai (META) - (https://www.coregames.com/user/d1073dbcc404405cbef8ce728e53d380)
-- Date: 2021/5/20
-- Version 0.0.1
------------------------------------------------------------------------------------------------------------------------
-- REQUIRES
------------------------------------------------------------------------------------------------------------------------
local API = require(script:GetCustomProperty("API"))
------------------------------------------------------------------------------------------------------------------------
-- OBJECTS
------------------------------------------------------------------------------------------------------------------------
local NETWORKING = script:GetCustomProperty("Networking"):WaitForObject()
local SETTINGS = script:GetCustomProperty("Settings"):WaitForObject()
local PLAY_TRIGGER = script:GetCustomProperty("Trigger"):WaitForObject()
local PLAYER_POSITION = script:GetCustomProperty("PlayerPosition"):WaitForObject()
------------------------------------------------------------------------------------------------------------------------
-- CUSTOM PROPERTIES
------------------------------------------------------------------------------------------------------------------------
local spinDuration = SETTINGS:GetCustomProperty("SpinDuration") or 1
local RESOURCE_NAME = SETTINGS:GetCustomProperty("ResourceName")
local ODDS = SETTINGS:GetCustomProperty("Odds")
local SLOT_ID = SETTINGS.id
--SETTINGS:GetCustomProperty("SlotId")
local THEME_ID = SETTINGS:GetCustomProperty("Theme") or "Fantasy"
local PlayerData = script:GetCustomProperty("RandomSpinner_Data")
------------------------------------------------------------------------------------------------------------------------
-- LOCAL VARIABLES
------------------------------------------------------------------------------------------------------------------------
local playerSpamPrevent = {}
local lootCards = {}
local items = API.GetSlots(THEME_ID)
local newData = World.SpawnAsset(PlayerData, {parent = NETWORKING})
local sitPosition = PLAYER_POSITION:GetWorldPosition()
local sitRotation = PLAYER_POSITION:GetWorldRotation()
local standPosition
newData.name = SLOT_ID
if spinDuration < 1 then
spinDuration = 1
warn("Spin Duration must be great than 1")
end
------------------------------------------------------------------------------------------------------------------------
-- LOCAL FUNCTIONS
------------------------------------------------------------------------------------------------------------------------
local function Unequip(player, socket)
for _, equipment in ipairs(player:GetEquipment()) do
if equipment.socket == socket then
equipment:Unequip()
if Object.IsValid(equipment) then
equipment:Destroy()
end
end
end
end
local function GetRandomSlot(reelTotal)
local value = math.random() * reelTotal
local total = 0
for _, item in ipairs(items) do
total = total + item.chance
if total >= value then
return item.id
end
end
end
------------------------------------------------------------------------------------------------------------------------
-- GLOBAL FUNCTIONS
------------------------------------------------------------------------------------------------------------------------
function Init()
local directionVector = sitRotation * Vector3.FORWARD
standPosition = sitPosition - (directionVector * 100)
end
function DestroyObject(player, objectId)
for _, object in ipairs(NETWORKING:GetChildren()) do
if object.id == objectId and Object.IsValid(object) then
object:Destroy()
end
end
end
function OnInteracted(trigger, object)
local currentId = newData:GetCustomProperty("playerId")
if currentId == "" and object and Object.IsValid(object) and object:IsA("Player") then
newData:SetNetworkedCustomProperty("playerId", object.id)
trigger.isInteractable = false
-- Sit player down
object.movementControlMode = MovementControlMode.NONE
object:ResetVelocity()
object:SetWorldPosition(sitPosition)
object:SetWorldRotation(sitRotation)
object.animationStance = "unarmed_sit_chair_upright"
object.maxJumpCount = 0
end
end
function EndOverlap(trigger, object)
local currentId = newData:GetCustomProperty("playerId")
if currentId ~= "" and object.id == currentId and Object.IsValid(object) and object:IsA("Player") then
newData:SetNetworkedCustomProperty("playerId", "")
trigger.isInteractable = true
end
end
function OnPlayerQuit(player, slotId)
if slotId == SLOT_ID then
PLAY_TRIGGER.isInteractable = true
newData:SetNetworkedCustomProperty("playerId", "")
player.movementControlMode = MovementControlMode.LOOK_RELATIVE
player.animationStance = "unarmed_stance"
player:SetWorldPosition(standPosition)
player.maxJumpCount = 1
end
end
function PickItemRandomly(player, betAmount, slotId)
if playerSpamPrevent[player] and playerSpamPrevent[player] > time() or SLOT_ID ~= slotId then
return
end
player:RemoveResource(RESOURCE_NAME, betAmount)
playerSpamPrevent[player] = time() + spinDuration + 0.1
local reelTotal = 0
for _, item in ipairs(items) do
reelTotal = reelTotal + item.chance
end
local slot1 = GetRandomSlot(reelTotal)
local slot2 = GetRandomSlot(reelTotal)
local slot3 = GetRandomSlot(reelTotal)
newData:SetNetworkedCustomProperty("ItemID", Vector3.New(slot1, slot2, slot3))
newData:SetNetworkedCustomProperty("playerId", player.id)
newData:SetNetworkedCustomProperty("spinTime", time() + spinDuration)
newData:SetNetworkedCustomProperty("BetAmount", betAmount)
Task.Spawn(
function()
local isWinner, reward = API.CheckWin(slot1, slot2, slot3, betAmount, items, ODDS)
local lastBetType = 0
if isWinner then
player:AddResource(RESOURCE_NAME, reward)
lastBetType = 1
end
--[[ reward = reward or 0
newData:SetNetworkedCustomProperty("LastBet", Vector3.New(lastBetType, betAmount, reward))
]]--
end,
spinDuration + 0.5
)
end
Init()
------------------------------------------------------------------------------------------------------------------------
-- LISTENERS
------------------------------------------------------------------------------------------------------------------------
Events.ConnectForPlayer(API.Broadcasts.spin, PickItemRandomly)
Events.ConnectForPlayer(API.Broadcasts.destroy, DestroyObject)
Events.ConnectForPlayer(API.Broadcasts.quit, OnPlayerQuit)
PLAY_TRIGGER.interactedEvent:Connect(OnInteracted)
PLAY_TRIGGER.endOverlapEvent:Connect(EndOverlap)
if enableDevMode then
local betAmount = 5
local totalSpent = 0
local totalWon = 0
local tempCount = 0
local totalSpins = 0
local totalWins = 0
local totalLoss = 0
for i = 1, 10000 do
totalSpins = i
local total = 0
for _, item in ipairs(items) do
total = total + item.chance
end
local slot1 = GetRandomSlot(total)
local slot2 = GetRandomSlot(total)
local slot3 = GetRandomSlot(total)
local isWinner, reward = API.CheckWin(slot1, slot2, slot3, betAmount, items, ODDS)
totalSpent = totalSpent + betAmount
if isWinner then
totalWon = totalWon + reward
totalWins = totalWins + 1
else
totalLoss = totalLoss + 1
end
tempCount = tempCount + 1
if tempCount > 50 then
Task.Wait()
tempCount = 0
end
end
print(THEME_ID, totalSpent, totalWon, totalWins, totalLoss)
end
|
--- Basic caching for the League of Legends API
--
-- This module is one of the core modules that everything is built on top of.
-- If you want to create an `api` object, a `cache` object will be created for you
-- automatically.
--
-- @module lol.cache
--[[
--This is unfortunately a super dumb (and thus likely VERY slow) implementation
--of a cache. While I want a better implementation, and in fact tried to see if
--there was already a good cache written in lua, I'll use this for now and see
--about updating it in the future with something much more reasonable. For the
--time being it will have to suffice.
--]]
local cjson = require('cjson')
local crypto = require('crypto')
local dir = require('pl.dir')
local file = require('pl.file')
local os = require('os')
local path = require('pl.path')
local tablex = require('pl.tablex')
local utils = require('pl.utils')
local queue = {}
queue.__index = queue
setmetatable(queue, {
__call = function(_,maxLen)
return queue.new(maxLen)
end})
function queue.new(maxLen)
local obj = {}
obj.maxLen = maxLen
obj.list = {first=1,last=0,count=0}
return setmetatable(obj, queue)
end
function queue:push(value)
local list = self.list
local last = list.last + 1
list.count = list.count + 1
list.last = last
list[last] = value
if self.maxLen and list.count > self.maxLen then
return self:pop()
end
end
function queue:pop()
local list = self.list
local first = list.first
if first > list.last then error("list is empty") end
local value = list[first]
list[first] = nil -- to allow garbage collection
list.first = first + 1
list.count = list.count - 1
self:skipEmpty()
return value
end
function queue:skipEmpty()
local list = self.list
while list[list.first] == nil and list.first <= list.last do
list.first = list.first + 1
end
end
function queue:clear()
self.list = {first=1,last=0,count=0}
end
function queue:remove(entries)
local list = self.list
for k, v in ipairs(list) do
if entries[v] then
list.count = list.count - 1
list[k] = nil
end
end
self:skipEmpty()
end
--- This class encapsulates making adding and retreiving elements from a cache
-- @type cache
local _cache = {}
_cache.__index = _cache
setmetatable(_cache, {
__call = function(_,cacheDir,opts)
return _cache.new(cacheDir,opts)
end})
local function initialize(obj)
-- clear any expired entries, it additionally clears out any bogus data
-- (this can happen if you kill lua while it is writing out a cache file)
-- and returns a sorted list of cached files by last access time.
local _, cachedFiles = _cache.clearExpired(obj)
-- go through on disk files and see if we have too many, then
-- remove based on last accessed time
for cacheFile,_ in cachedFiles do
local removed = obj.cacheSize.disk.entries:push(cacheFile)
if removed then
local ok,err = file.delete(removed)
if not ok and obj.opts.verbose then
print(err)
end
end
end
end
--- Create a new cache object
-- @tparam string cacheDir the directory where to store cache entries
-- @tparam table opts a table of optional parameters
-- @tparam boolean opts.weak a boolean which denotes if the in memory cache should be a weak table (i.e. allow
-- the entries to be garabage collected unless something external is holding onto them). Note that this will
-- not effect the entry being removed from disk, only from memory. So if you try to retreive it in the future
-- (and it hasn't expired) it will still be found in the cache. This option *DOES NOT WORK WITH `cacheSize`*,
-- so do not specify a memory `cacheSize` if you specify `weak`.
-- @tparam table opts.cacheSize a table which describes the size of the cache. The table can have two entries:
-- `memory` and `disk` which are tables of the form {count = x, size = y}, where `count` is the maximum number
-- of elements to keep and `size` is the maximum size in bytes.
-- @return a new cache object
-- @function cache:cache
function _cache.new(cacheDir, opts)
utils.assert_arg(1,path.abspath(cacheDir),'string',path.isdir,'not a directory')
local obj = {}
obj.dir = path.abspath(cacheDir)
obj.opts = opts or {}
obj.cache = {}
if obj.opts.weak then
setmetatable(obj.cache, {__mode='kv'})
end
obj.maxCacheSize = obj.opts.cacheSize or {}
for _,storage in pairs{'disk', 'memory'} do
obj.maxCacheSize[storage] = obj.maxCacheSize[storage] or {}
obj.maxCacheSize[storage].size = obj.maxCacheSize[storage].size or math.huge
obj.maxCacheSize[storage].count = obj.maxCacheSize[storage].count or math.huge
end
obj.cacheSize = {
disk={bytes=0,entries=queue(obj.maxCacheSize.disk.count)},
memory={bytes=0,entries=queue(obj.maxCacheSize.memory.count)}
}
initialize(obj)
return setmetatable(obj, _cache)
end
local function isExpired(entry)
return entry and entry.expires and os.difftime(entry.expires, os.time()) < 0
end
--- Drops all cache entries from memory, but keeps them in the disk cache. This can be used to save memory in lua.
-- @function cache:dropAll
function _cache:dropAll()
self.cache = {}
self.cacheSize.memory.bytes = 0
self.cacheSize.memory.entries:clear()
collectgarbage()
end
--- Clear all entries from the cache. This includes on disk and in memory.
-- @function cache:clearAll
function _cache:clearAll()
self:dropAll()
for _,cacheFile in pairs(dir.getfiles(self.dir)) do
local ok,err = file.delete(cacheFile)
if not ok and self.opts.verbose then
print(err)
end
end
self.cacheSize.disk.bytes = 0
self.cacheSize.disk.entries:clear()
end
--- Clear all expired entries from the cache. This includes on disk and in memory.
-- @function cache:clearExpired
function _cache:clearExpired()
local removed = {}
for digest,entry in pairs(self.cache) do
if isExpired(entry) then
self.cache[digest] = nil
local ok,err = file.delete(entry.file)
if ok then
removed[digest] = true
elseif self.opts.verbose then
print(err)
end
end
end
local cachedFiles = {}
for _,cacheFile in pairs(dir.getfiles(self.dir)) do
local data = file.read(cacheFile)
local ok,entry = pcall(function() return cjson.decode(data) end)
if not ok or isExpired(entry) then
local err
ok,err = file.delete(cacheFile)
if ok then
local digest = string.match(cacheFile, self.dir..path.sep..'(.+)')
removed[digest] = true
elseif self.opts.verbose then
print(err)
end
else
cachedFiles[cacheFile] = file.access_time(cacheFile)
end
end
self.cacheSize.disk.entries:remove(removed)
self.cacheSize.memory.entries:remove(removed)
return removed, tablex.sortv(cachedFiles)
end
local function getFilename(basedir, digest)
return basedir..path.sep..digest
end
local function getFromDisk(basedir, digest)
local entry
local cacheFile = getFilename(basedir, digest)
if path.exists(cacheFile) then
local ok
local data = file.read(cacheFile)
ok,entry = pcall(function() return cjson.decode(data) end)
if ok then
entry.file = cacheFile
end
end
return entry
end
--- Remove an entry from the cache.
-- @param key the key of the entry to find (**must be convertible to JSON**)
-- @function cache:remove
function _cache:remove(key)
-- First check the in memory cache
local keyString = cjson.encode(key)
local digest = crypto.digest('md5', keyString)
local remove = {[digest]=true}
self.cacheSize.disk.entries:remove(remove)
self.cacheSize.memory.entries:remove(remove)
local entry = getFromDisk(self.dir, digest)
if entry then
local ok, err = file.delete(entry.file)
if not ok and self.opts.verbose then
print(err)
end
end
self.cache[digest] = nil
end
--- Get an entry from the cache if it exists and hasn't expired.
-- @param key the key of the entry to find (**must be convertible to JSON**)
-- @return the value that was previously stored for the given key
-- @function cache:get
function _cache:get(key)
-- First check the in memory cache
local keyString = cjson.encode(key)
local digest = crypto.digest('md5', keyString)
local entry = self.cache[digest]
-- If not found, search the disk cache
entry = entry or getFromDisk(self.dir, digest)
-- Then check for expiration
if isExpired(entry) then
local remove = {[digest]=true}
self.cacheSize.disk.entries:remove(remove)
self.cacheSize.memory.entries:remove(remove)
local ok, err = file.delete(entry.file)
if not ok and self.opts.verbose then
print(err)
end
entry = nil
end
-- Finally update the value in case it's expired
-- First remove from the in memory cache if needed
local removed = self.cacheSize.memory.entries:push(digest)
if removed then
self.cache[removed] = nil
end
self.cache[digest] = entry
return entry and entry.value or nil
end
--- Add an entry to the cache with an optional number of seconds before expiration
-- @param key the key of the entry to store (**must be convertible to JSON**)
-- @param value the value of the entry to store (**must be convertible to JSON**)
-- @param expires optional number of seconds before the entry expires
-- @function cache:set
function _cache:set(key, value, expires)
local entry = {value=value}
local keyString = cjson.encode(key)
if expires then
local expireDate = os.date('*t')
expireDate.sec = expireDate.sec + expires
entry.expires = os.time(expireDate)
end
local digest = crypto.digest('md5', keyString)
local cacheFile = getFilename(self.dir, digest)
-- If adding the file to disk would cause max entries to be exceeded then remove the last used entry
local removed = self.cacheSize.disk.entries:push(digest)
if removed then
local removedFile = getFilename(self.dir, removed)
local ok,err = file.delete(removedFile)
if not ok and self.opts.verbose then
print(err)
end
end
file.write(cacheFile, cjson.encode(entry))
-- Similarly remove from in memory cache if needed
removed = self.cacheSize.memory.entries:push(digest)
if removed then
self.cache[removed] = nil
end
self.cache[digest] = entry
entry.file = cacheFile
end
return _cache
|
print("TID NAME")
for i, thread in ipairs(require("dotos").listthreads()) do
print(string.format("%4d %s", thread.id, thread.name))
end
|
local class = require "andross.middleclass"
Attachment = class("Attachment")
function Attachment:initialize(name)
self.name = name
self.positionX = 0
self.positionY = 0
self.angle = 0
self.scaleX = 1
self.scaleY = 1
end
return Attachment |
local composer = require( "composer" )
local scene = composer.newScene()
local physics = require("physics")
physics.start()
physics.setGravity( 0, 0 )
local sfx = require( "scripts.sfx" )
local screen = require( "scripts.screen" )
local levelData = require( "data.levels" )
local clock = require( "scripts.clock" )
-------------------------------
local _cos = math.cos
local _sin = math.sin
local _rad = math.rad
local _max = math.max
local _min = math.min
local _sqrt = math.sqrt
local _floor = math.floor
local _dRemove = display.remove
-------------------------------
local moveSpeed = 2.5
local visionRange = 160
local alertRadius = 20
local playerRadius = 16
local raycastAngles = 60
local raycastAnglesH = raycastAngles*0.5
local caughtDistance = alertRadius+8
local halfW = screen.width*0.5
local halfH = screen.height*0.5
local moveSpeedDiagonal = _sqrt(moveSpeed)
-------------------------------
local groupGround = display.newGroup()
local groupObjects = display.newGroup()
local groupVision = display.newGroup()
local groupWalls = display.newGroup()
local snapshot = display.newSnapshot( groupVision, screen.width, screen.height )
snapshot:translate( halfW, halfH )
local groupUI = display.newGroup()
local overlay = display.newRect(0,0,screen.width, screen.height)
overlay:setFillColor(0)
snapshot.group:insert(overlay)
local whoCaught = display.newImage( groupUI, "images/caught.png", 0, 0 )
whoCaught.alpha = 0
whoCaught.anchorY = 1
local guard = {}
local camera = {}
local action = {}
local object = {}
local player
local lootText
local playerSeen = false
local blockTouch = true
local gotLoot = false
local canMove = false
local lootCount = 0
local totalLoot = 0
local gameClock
local buttonMenu
local visionBlock
local startTimer
local countdown
local gameover
transition.ignoreEmptyReference = true
local currentFrame = 0
local framesUntilSwap = 10
local function updateGuards()
for i = 1, #guard do
local t = guard[i]
t:vision()
-- Check if player is too close to the guard.
if _sqrt((player.x-t.x)^2 + (player.y-t.y)^2) < caughtDistance then
if not playerSeen then
playerSeen = true
whoCaught.x, whoCaught.y = t.x, t.y-10
whoCaught.alpha = 1
gameover("guard")
Runtime:removeEventListener( "enterFrame", updateGuards )
end
end
-- Update the guard's animation.
if t.x ~= t.prevX or t.y ~= t.prevY then
t.currentFrame = t.currentFrame+1
if t.currentFrame == framesUntilSwap then
t.currentFrame = 0
t.usingFrame1 = not t.usingFrame1
if t.usingFrame1 then
t.fill = t.frame1
else
t.fill = t.frame2
end
end
end
t.prevX, t.prevY = t.x, t.y
end
for i = 1, #camera do
local cam = camera[i]
_dRemove(cam.scan)
cam.scan = nil
local angle = _rad(cam.rotation)
local xStart = cam.x
local yStart = cam.y
local xEnd = cam.x+visionRange*_cos(angle)
local yEnd = cam.x-visionRange*_sin(angle)
local hits = physics.rayCast( xStart, yStart, xEnd, yEnd, "closest" )
if ( hits ) then
cam.scan = display.newLine( groupWalls, xStart, yStart, hits[1].position.x, hits[1].position.y )
cam.scan:toBack()
cam.scan.strokeWidth = 2
cam.scan:setStrokeColor( 0.9, 0, 0 )
if hits[1].object.isPlayer then
playerSeen = true
whoCaught.x, whoCaught.y = cam.x, cam.y-10
whoCaught.alpha = 1
gameover("camera")
Runtime:removeEventListener( "enterFrame", updateGuards )
end
else
cam.scan = display.newLine( groupWalls, xStart, yStart, xEnd, yEnd )
cam.scan:toBack()
cam.scan.strokeWidth = 2
cam.scan:setStrokeColor( 0.9, 0, 0 )
end
end
end
local function movePlayer()
if player then
local rotation
if action["a"] or action["left"] then
if action["w"] or action["up"] then
rotation = -135
player:translate( -moveSpeedDiagonal, -moveSpeedDiagonal )
elseif action["s"] or action["down"] then
rotation = 135
player:translate( -moveSpeedDiagonal, moveSpeedDiagonal )
else
rotation = 180
player:translate( -moveSpeed, 0 )
end
elseif action["d"] or action["right"] then
if action["w"] or action["up"] then
rotation = -45
player:translate( moveSpeedDiagonal, -moveSpeedDiagonal )
elseif action["s"] or action["down"] then
rotation = 45
player:translate( moveSpeedDiagonal, moveSpeedDiagonal )
else
rotation = 0
player:translate( moveSpeed, 0 )
end
else
if action["w"] or action["up"] then
rotation = -90
player:translate( 0, -moveSpeed )
elseif action["s"] or action["down"] then
rotation = 90
player:translate( 0, moveSpeed )
end
end
if rotation then
currentFrame = currentFrame+1
if currentFrame == framesUntilSwap then
currentFrame = 0
player.usingFrame1 = not player.usingFrame1
if player.usingFrame1 then
player.fill = player.frame1
else
player.fill = player.frame2
end
end
player.rotation = rotation
end
if gotLoot then
if _sqrt((player.x-player.escapeRadius.x)^2+(player.y-player.escapeRadius.y)^2) <= player.escapeRadius.width*0.5 then
gameover("won")
end
end
end
end
local function onKeyEvent( event )
if event.phase == "down" then
action[event.keyName] = true
else
action[event.keyName] = false
end
end
local function pickupLoot(loot)
_dRemove(loot)
loot = nil
gotLoot = true
lootCount = lootCount+1
lootText.text = "Loot left: "..totalLoot-lootCount
player.escapeRadius.alpha = 1
end
local function onCollision( self, event )
if ( event.phase == "began" ) then
if self.isPlayer and event.other.isLoot and not event.other.taken then
event.other.taken = true
pickupLoot(event.other)
end
end
end
local function newGuard( input )
local object = display.newRect( groupObjects, input.x, input.y, 20, 20 )
object.fov = {}
object.frame1 = {
type = "image",
filename = "images/guard_walk1.png"
}
object.frame2 = {
type = "image",
filename = "images/guard_walk2.png"
}
object.prevX, object.prevY = x or 0, y or 0
object.currentFrame = 0
object.usingFrame1 = true
object.fill = object.frame1
object.aura = display.newCircle( groupVision, object.x-halfW, object.y-halfH, alertRadius )
snapshot.group:insert(object.aura)
object.currentRoute = 0
object.route = {}
for i = 1, #input.route do
local r = input.route[i]
object.route[i] = { x=r.x, y=r.y, r=r.r, delay=r.delay, time=r.time }
end
function object:vision()
if not playerSeen then
self.aura.x, self.aura.y = self.x-halfW, self.y-halfH
for i = 1, #self.fov do
self.fov[i] = nil
end
self.fov[1], self.fov[2] = self.x, self.y
for i = 1, raycastAngles do
local xStart = self.x
local yStart = self.y
local xEnd = _floor(self.x+visionRange*_cos(_rad(self.rotation-raycastAnglesH+i))+0.5)
local yEnd = _floor(self.y+visionRange*_sin(_rad(self.rotation-raycastAnglesH+i))+0.5)
local hits = physics.rayCast( xStart, yStart, xEnd, yEnd, "closest" )
if hits then
if hits[1].object.isPlayer then
if not playerSeen then
playerSeen = true
whoCaught.x, whoCaught.y = self.x, self.y-20
whoCaught.alpha = 1
gameover("guard")
Runtime:removeEventListener( "enterFrame", updateGuards )
end
local hits = physics.rayCast( xStart, yStart, xEnd, yEnd, "sorted" )
if hits and #hits > 1 then
xEnd, yEnd = _floor(hits[2].position.x+0.5), _floor(hits[2].position.y+0.5)
end
else
xEnd, yEnd = _floor(hits[1].position.x+0.5), _floor(hits[1].position.y+0.5)
end
end
if xEnd ~= self.fov[#self.fov-1] or yEnd ~= self.fov[#self.fov] then
self.fov[#self.fov+1], self.fov[#self.fov+2] = xEnd, yEnd
end
end
_dRemove(self.sight)
self.sight = nil
-- TODO: The sight, i.e. field of vision, is a but bumpy. If time, then fix.
self.sight = display.newPolygon( --groupVision,
(_min( self.fov[1], self.fov[3], self.fov[#self.fov-1] )+_max( self.fov[1], self.fov[3], self.fov[#self.fov-1] ))*0.5-halfW,
(_min( self.fov[2], self.fov[4], self.fov[#self.fov] )+_max( self.fov[2], self.fov[4], self.fov[#self.fov] ))*0.5-halfH,
self.fov
)
snapshot.group:insert(self.sight)
end
snapshot:invalidate()
end
guard[#guard+1] = object
end
local function returnToMenu( event )
if event.phase == "ended" then
blockTouch = true
if startTimer then
timer.cancel( startTimer )
startTimer = nil
end
composer.gotoScene( "scripts.menu", {
time=500,
effect="slideRight",
params={}
})
end
return true
end
function gameover( reason )
transition.cancelAll()
local delay = 1500
if reason == "time" then
countdown.text = "Time's up!"
elseif reason == "guard" then
countdown.text = "A guard saw you!"
elseif reason == "camera" then
countdown.text = "A camera saw you!"
elseif reason == "won" then
countdown.text = "Success!"
delay = 0
local temp = display.newText( "You collected "..lootCount.." out of "..totalLoot.." loot!", screen.xCenter, screen.yCenter+120, "fonts/Action_Man.ttf", 28 )
temp.alpha = 0
transition.to( temp, {time=500,alpha=1})
timer.performWithDelay( 4000+delay, function()
_dRemove(temp)
end )
end
transition.to( countdown, {delay=delay,time=250,alpha=1,xScale=1,yScale=1} )
transition.to( visionBlock, {delay=delay,time=250,alpha=1} )
gameClock:stop()
Runtime:removeEventListener( "enterFrame", movePlayer )
Runtime:removeEventListener( "key", onKeyEvent )
if not playerSeen then
playerSeen = true
Runtime:removeEventListener( "enterFrame", updateGuards )
end
startTimer = timer.performWithDelay( 4000+delay, function()
returnToMenu({phase="ended"})
end )
end
local function outOfTime()
gameover("time")
end
local patrolTimePerPixel = 20
local function patrolRoute( guard )
guard.currentRoute = guard.currentRoute+1
if guard.currentRoute > #guard.route then
guard.currentRoute = 1
end
transition.to( guard, {
time = guard.route[guard.currentRoute].time or _sqrt((guard.x-(guard.route[guard.currentRoute].x or guard.x))^2+(guard.y-(guard.route[guard.currentRoute].y or guard.y))^2 )*patrolTimePerPixel,
x = guard.route[guard.currentRoute].x,
y = guard.route[guard.currentRoute].y,
rotation = guard.route[guard.currentRoute].r,
delay = guard.route[guard.currentRoute].delay,
onComplete = function() patrolRoute(guard) end
})
end
local function rotateCamera( cam )
transition.to( cam, {
time = cam.time,
rotation = cam.returning and cam.r or cam.r+cam.angle,
onComplete=function() rotateCamera(cam) end
})
cam.returning = not cam.returning
end
local function newCamera( cam )
camera[#camera+1] = display.newImage( groupWalls,"images/camera.png", cam.x, cam.y )
camera[#camera].rotation = cam.rotation or 0
camera[#camera].r = cam.rotation or 60
camera[#camera].time = cam.time or 1000
camera[#camera].angle = cam.angle or 60
camera[#camera].returning = false
end
local function startGame()
lootCount = 0
playerSeen = false
startTimer = nil
canMove = true
gameClock:start(outOfTime)
Runtime:addEventListener( "enterFrame", updateGuards )
Runtime:addEventListener( "enterFrame", movePlayer )
Runtime:addEventListener( "key", onKeyEvent )
for i = 1, #guard do
patrolRoute( guard[i] )
end
for i = 1, #camera do
rotateCamera( camera[i] )
end
transition.to( player.escapeRadius, {time=750,xScale=1.1,yScale=1.1,transition=easing.continuousLoop,iterations=-1} )
end
local function updateCountdown()
if countdown.value == 4 then
countdown.alpha = 1
end
countdown.value = countdown.value-1
countdown.text = countdown.value
if countdown.value > 0 then
transition.to( countdown, {time=250,xScale=1.5,yScale=1.5,transition=easing.continuousLoop} )
startTimer = timer.performWithDelay( 980, updateCountdown )
else
transition.to( countdown, {time=250,alpha=0,xScale=1.5,yScale=1.5} )
transition.to( visionBlock, {time=250,alpha=0} )
startGame()
end
end
local function resetCountdown()
whoCaught.alpha = 0
countdown.alpha = 0
countdown.value = 4
countdown.xScale, countdown.yScale = 1, 1
visionBlock.alpha = 1
end
-------------------------------
function scene:create( event )
local sceneGroup = self.view
buttonMenu = display.newRect( screen.xMax+20, screen.yMin+20, 32, 32 )
buttonMenu:addEventListener( "touch", returnToMenu )
local background = display.newRect( groupGround, screen.xCenter, screen.yCenter, 960, 640 )
display.setDefault( "textureWrapX", "repeat" )
display.setDefault( "textureWrapY", "repeat" )
background.fill = {
type = "image",
filename = "images/ground.png"
}
background.fill.scaleX = 32 / background.width
background.fill.scaleY = 32 / background.height
display.setDefault( "textureWrapX", "clampToEdge" )
display.setDefault( "textureWrapY", "clampToEdge" )
local clockImg = display.newImage( groupUI, "images/clock.png", screen.xMin+50, screen.yMin+52 )
gameClock = clock.create( groupUI, screen.xMin+50, screen.yMin+61, "game" )
lootText = display.newText( groupUI, "Loot left:", gameClock.x + 60, screen.yMin+30, "fonts/Action_Man.ttf", 28 )
lootText.anchorX = 0
visionBlock = display.newRect( groupUI, screen.xCenter, screen.yCenter, screen.width, screen.height)
visionBlock:setFillColor(0)
visionBlock.alpha = 0.9
visionBlock:addEventListener( "touch", function(event) return true end )
countdown = display.newText( groupUI, "3", screen.xCenter, screen.yCenter, "fonts/Action_Man.ttf", 76 )
countdown.alpha = 0
snapshot.alpha = 0.5
snapshot.blendMode = "multiply"
sceneGroup:insert(groupGround)
sceneGroup:insert(groupObjects)
sceneGroup:insert(groupVision)
sceneGroup:insert(groupWalls)
sceneGroup:insert(groupUI)
end
function scene:show( event )
local sceneGroup = self.view
local phase = event.phase
if phase == "will" then
canMove = false
gotLoot = false
totalLoot = 0
resetCountdown()
transition.to( buttonMenu, {time=400,x=buttonMenu.x-40})
elseif phase == "did" then
-- Code here runs when the scene is first created but has not yet appeared on screen
local data = levelData[event.params.level]
local xStart, yStart = 64, 64
for row = 1, #data.map do
for column = 1, #data.map[row] do
local t = data.map[row][column]
local type = t:sub(1,4)
if t ~= "empty" then
object[#object+1] = display.newImage( groupGround, "images/"..t..".png", xStart+32*(column-1), yStart+32*(row-1) )
if type == "wall" then
physics.addBody( object[#object], "static" )
end
-- if type == "wall" or type == "item" then
-- physics.addBody( object[#object], "static" )
-- if t == "item_loot" then
-- object.isLoot = true
-- totalLoot = totalLoot+1
-- elseif t == "item_plant" then
-- object.isPlant = true
-- end
-- end
end
end
end
lootText.text = "Loot left: "..totalLoot
for i = 1, #data.guard do
newGuard( data.guard[i] )
end
for i = 1, #data.camera do
newCamera( data.camera[i] )
end
for i = 1, #data.loot do
object[#object+1] = display.newImage( groupGround, "images/loot.png", data.loot[i].x, data.loot[i].y )
object[#object].rotation = data.loot[i].r or 0
physics.addBody( object[#object], "static" )
object[#object].collision = onCollision
object[#object]:addEventListener( "collision" )
object[#object].isLoot = true
totalLoot = totalLoot+1
end
player = display.newRect( groupObjects, data.player.x, data.player.y, 20, 20 )
physics.addBody( player, "dynamic", {radius=10} )
player.collision = onCollision
player:addEventListener( "collision" )
player.isPlayer = true
player.gravityScale = 0
player.frame1 = {
type = "image",
filename = "images/player_walk1.png"
}
player.frame2 = {
type = "image",
filename = "images/player_walk2.png"
}
player.usingFrame1 = true
player.fill = player.frame1
local plusOrMinus = math.random() > 0.5 and 1 or -1
player.car = display.newImage( groupObjects, "images/car.png", player.x+plusOrMinus*math.random(80,120), player.y+plusOrMinus*math.random(20,40) )
physics.addBody( player.car, "static" )
if player.x < 480 then
if player.y < 320 then
player.car.rotation = math.random(-170,-150)
else
player.car.rotation = math.random(150,170)
end
else
if player.y < 320 then
player.car.rotation = math.random(-30,-10)
else
player.car.rotation = math.random(10,30)
end
end
player.escapeRadius = display.newCircle( groupObjects, player.car.x, player.car.y, 60 )
player.escapeRadius:toBack()
player.escapeRadius:setFillColor(0.1,0.8,0.1,0.3)
player.escapeRadius.alpha = 0
blockTouch = false
countdown.value = 0 -- uncomment to skip to game.
startTimer = timer.performWithDelay( 250, updateCountdown )
end
end
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if phase == "will" then
transition.to( buttonMenu, {time=400,x=buttonMenu.x+40})
gameClock:stop()
elseif phase == "did" then
countdown.alpha = 0
for i = 1, #guard do
_dRemove(guard[i].aura)
_dRemove(guard[i].sight)
_dRemove(guard[i])
guard[i] = nil
end
for i = 1, #camera do
_dRemove(camera[i].scan)
_dRemove(camera[i])
camera[i] = nil
end
for i = 1, #object do
_dRemove(object[i])
object[i] = nil
end
for i, j in pairs(action) do
action[i] = false
end
_dRemove(player.escapeRadius)
_dRemove(player.car)
_dRemove(player)
player = nil
end
end
scene:addEventListener( "create", scene )
scene:addEventListener( "show", scene )
scene:addEventListener( "hide", scene )
return scene |
-- Module containing all graphical and user interface manipulation functions for IUP and CD library.
-- This module aims to abstract away the underlying framework of IUP and CD libraries
require("iuplua")
require("iupluaimglib")
require("cdlua")
require("iupluacd")
local coorc = require("lua-gl.CoordinateCalc")
local iup = iup
local cd = cd
local type = type
local pairs = pairs
local floor = math.floor
local abs = math.abs
local tostring = tostring
local print = print
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
-- Constants
-- Mouse buttons
M.BUTTON1 = iup.BUTTON1 -- Left mouse button
M.BUTTON3 = iup.BUTTON3 -- Right mouse button
-- Line style constants
M.CONTINUOUS = cd.CONTINUOUS
M.DASHED = cd.DASHED
M.DOTTED = cd.DOTTED
M.DASH_DOT = cd.DASH_DOT
M.DASH_DOT_DOT = cd.DASH_DOT_DOT
M.CUSTOM = cd.CUSTOM
-- Line Join Constants
M.MITER = cd.MITER
M.BEVEL = cd.BEVEL
M.ROUND = cd.ROUND
-- Line Cap constants
M.CAPFLAT = cd.CAPFLAT
M.CAPSQUARE = cd.CAPSQUARE
M.CAPROUND = cd.CAPROUND
-- Back Opacity
M.OPAQUE = cd.OPAQUE
M.TRANSPARENT = cd.TRANSPARENT
-- Fill style
M.SOLID = cd.SOLID
M.HOLLOW = cd.HOLLOW
M.STIPPLE = cd.STIPPLE
M.HATCH = cd.HATCH
M.PATTERN = cd.PATTERN
-- Hatch styles
M.HORIZONTAL = cd.HORIZONTAL
M.VERTICAL = cd.VERTICAL
M.FDIAGONAL = cd.FDIAGNOL
M.BDIAGONAL = cd.BDIAGNOL
M.CROSS = cd.CROSS
M.DIAGCROSS = cd.DIAGCROSS
-- Font styles
M.PLAIN = cd.PLAIN
M.BOLD = cd.BOLD
M.ITALIC = cd.ITALIC
M.UNDERLINE = cd.UNDERLINE
M.STRIKEOUT = cd.STRIKEOUT
-- Font Alignment
M.NORTH = cd.NORTH
M.SOUTH = cd.SOUTH
M.EAST = cd.EAST
M.WEST = cd.WEST
M.NORTH_EAST = cd.NORTH_EAST
M.NORTH_WEST = cd.NORTH_WEST
M.SOUTH_EAST = cd.SOUTH_EAST
M.SOUTH_WEST = cd.SOUTH_WEST
M.CENTER = cd.CENTER
M.BASE_LEFT = cd.BASE_LEFT
M.BASE_CENTER = cd.BASE_CENTER
M.BASE_RIGHT = cd.BASE_RIGHT
function mapCB(cnvobj)
--local cd_Canvas = cd.CreateCanvas(cd.IUP, cnvobj.cnv)
local cd_bCanvas = cd.CreateCanvas(cd.IUPDBUFFER,cnvobj.cnv) --cd_Canvas)
--cnvobj.cdCanvas = cd_Canvas
cnvobj.cdbCanvas = cd_bCanvas
end
function unmapCB(cnvobj)
local cd_bCanvas = cnvobj.cdbCanvas
--local cd_Canvas = cnvobj.cdCanvas
cd_bCanvas:Kill()
--cd_Canvas:Kill()
end
function buttonCB(cnvobj,button,pressed,x,y, status)
x,y = M.sCoor2dCoor(cnvobj,x,y) -- Note the coordinates passed to MOUSECLICKPRE and MOUSECLICKPOST are always the database coordinates
cnvobj:processHooks("MOUSECLICKPRE",{button,pressed,x,y,status})
cnvobj:processHooks("MOUSECLICKPOST",{button,pressed,x,y,status})
end
function motionCB(cnvobj,x, y, status)
end
function resizeCB(cnvobj,width,height)
cnvobj:processHooks("RESIZED",{width,height})
end
function isctrl(status)
return iup.iscontrol(status)
end
function isshift(status)
return iup.isshift(status)
end
function isdouble(status)
return iup.isdouble(status)
end
function isalt(status)
return iup.isalt(status)
end
function issys(status)
return iup.issys(status)
end
function newCanvas()
return iup.canvas{BORDER="NO"}
end
-- Function to return the mouse position on the canvas. The returned coordinates are the same that would have been returned on the
-- motion_cb or button_cb callback functions
function getMouseOnCanvas(cnvobj)
local gx,gy = iup.GetGlobal("CURSORPOS"):match("^(-?%d%d*)x(-?%d%d*)$")
--print("CURSOR POSITION: ",gx,gy)
local sx,sy = cnvobj.cnv.SCREENPOSITION:match("^(-?%d%d*),(-?%d%d*)$")
return gx-sx,gy-sy
end
-- Function to put the mouse curson on the canvas on the given coordinates.
-- The coordinates x,y should be the coordinates on the canvas equivalent to the ones returned in the motion_cb and button_cb callbacks
function setMouseOnCanvas(cnvobj,x,y)
local sx,sy = cnvobj.cnv.SCREENPOSITION:match("^(-?%d%d*),(-?%d%d*)$")
iup.SetGlobal("CURSORPOS",tostring(sx+x).."x"..tostring(sy+y))
return true
end
-- Function to convert the button_cb/motion_cb returned coordinates to database coordinates
function sCoor2dCoor(cnvobj,x,y)
y = cnvobj.cdbCanvas:UpdateYAxis(y)
local vp = cnvobj.viewPort
local xm = vp.xmin
local ym = vp.ymin
local zoom = (vp.xmax-xm+1)/(cnvobj.width)
y = floor(y*zoom+ym)
x = floor(x*zoom+xm)
return x,y
end
-- Function to convert the database coordinate to the canvas on screen coordinate
function dCoor2sCoor(cnvobj,x,y)
local vp = cnvobj.viewPort
local xm = vp.xmin
local ym = vp.ymin
local zoom = (vp.xmax-xm+1)/(cnvobj.width)
x = floor((x-xm)/zoom)
y = floor((y-ym)/zoom)
y = cnvobj.cdbCanvas:UpdateYAxis(y)
return x,y
end
-- Function to decode the viewport and provide the xmin,xmax,ymin,ymax and zoom parameters
-- viewport has 3 parameters in it:
-- xmin - minimum x coordinate in viewport
-- xmax - maximum x coordinate in viewport
-- ymin - minimum y coordinate in viewport
function viewportPara(cnvobj,vp)
local xm = vp.xmin
local ym = vp.ymin
local xmax = vp.xmax
local zoom = (xmax-xm+1)/(cnvobj.width)
local ymax = floor(zoom*cnvobj.height+ym-1)
return xm,xmax,ym,ymax,zoom
end
-- Set of functions to setup attributes of something that is being drawn. Each function returns a closure (function with associated up values). The rendering loop just calls the function before drawing it
--[[
There are 6 types of items for which attributes need to be set:
- Non filled object (1)
- Blocking rectangle (2) -- attribute set using getNonFilledObjAttrFunc function
- Filled object (3)
- Normal Connector (4) -- attribute set using getNonFilledObjAttrFunc function
- Jumping Connector (5) -- attribute set using getNonFilledObjAttrFunc function
- Text (6) -- attribute set using getTextAttrFunc function
So there are 2 functions below:
]]
-- Function to return closure for setting the attributes for text
--[[ Attributes to set are (given a table (attr) with all these keys and attributes)
* Draw color(color) - Table with RGB e.g. {127,230,111}
* Typeface (typeface) - String containing the name of the font. If cross platform consistency is desired use "Courier", "Times" or "Helvetica".
* Style (style) - should be a combination of M.BOLD, M.ITALIC, M.PLAIN, M.UNDERLINE, M.STRIKEOUT
* Size (size) - should be a number representing the size in pixels (not points as displayed in applications)
* Alignment (align) - should be one of M.NORTH, M.SOUTH, M.EAST, M.WEST, M.NORTH_EAST, M.NORTH_WEST, M.SOUTH_EAST, M.SOUTH_WEST, M.CENTER, M.BASE_LEFT, M.BASE_CENTER, or M.BASE_RIGHT
* Orientation (orient) - angle in degrees
]]
function getTextAttrFunc(attr)
local typeface = attr.typeface
local style = attr.style
local size = attr.size
local align = attr.align
local orient = attr.orient
local color = cd.EncodeColor(attr.color[1],attr.color[2],attr.color[3])
return function(canvas,zoom)
-- Set the font typeface, style and size
canvas:Font(typeface,style,-1*floor(size/zoom))
-- Set the text alignment
canvas:TextAlignment(align)
-- Set the text orientation
canvas:TextOrientation(orient)
-- Set the color of the text
canvas:SetForeground(color)
end
end
-- Function to get the font properties
function getFont(cnv)
return cnv:GetFont()
end
-- Function to convert the font size in points to pixels
function fontPt2Pixel(cnvobj,points,canvas)
canvas = canvas or cnvobj.cdbCanvas
local width,height,widthmm,heightmm = canvas:GetSize()
return floor(width/widthmm*(points/cd.MM2PT)+0.5)
end
-- Function to return closure for setting attributes for non filled objects
--[[ Attributes to set are: (given a table (attr) with all these keys and attributes)
* Draw color(color) - Table with RGB e.g. {127,230,111}
* Line Style(style) - number or a table. Number should be one of M.CONTINUOUS, M.DASHED, M.DOTTED, M.DASH_DOT, M.DASH_DOT_DOT. FOr table it should be array of integers specifying line length in pixels and then space length in pixels. Pattern repeats
* Line width(width) - number for width in pixels
* Line Join style(join) - should be one of the constants M.MITER, M.BEVEL, M.ROUND
* Line Cap style (cap) - should be one of the constants M.CAPFLAT, M.CAPROUND, M.CAPSQUARE
]]
function getNonFilledObjAttrFunc(attr)
local color = cd.EncodeColor(attr.color[1],attr.color[2],attr.color[3])
local style = attr.style
local width = attr.width
local join = attr.join
local cap = attr.cap
-- Function to set the attributes when the line style is a number
local function nfoaNUM(canvas,zoom)
-- Set the foreground color
canvas:SetForeground(color)
-- Set the line style
canvas:LineStyle(style)
-- Set line width
canvas:LineWidth(floor(width/zoom+0.5))
-- Set Line Join
canvas:LineJoin(join)
-- Set Line cap
canvas:LineCap(cap)
end
-- Function to set the attributes when the line style is a table
local function nfoaTAB(canvas,zoom)
-- Set the foreground color
canvas:SetForeground(color)
-- Set the line style
canvas:LineStyleDashes(style, #style)
-- Set line width
canvas:LineWidth(floor(width/zoom+0.5))
-- Set Line Join
canvas:LineJoin(join)
-- Set Line cap
canvas:LineCap(cap)
end
if type(style) == "number" then
return nfoaNUM
else
return nfoaTAB
end
end
-- Function to return closure for setting attributes for non filled objects
--[[
The attributes to be set are:
* Fill Color(color) - Table with RGB e.g. {127,230,111}
* Background Opacity (bopa) - One of the constants M.OPAQUE, M.TRANSPARENT
* Fill interior style (style) - One of the constants M.SOLID, M.HOLLOW, M.STIPPLE, M.HATCH, M.PATTERN
* Hatch style (hatch) (OPTIONAL) - Needed if style == M.HATCH. Must be one of the constants M.HORIZONTAL, M.VERTICAL, M.FDIAGONAL, M.BDIAGONAL, M.CROSS or M.DIAGCROSS
* Stipple style (stipple) (OPTIONAL) - Needed if style = M.STIPPLE. Should be a wxh matrix of zeros (0) and ones (1). The zeros are mapped to the background color or are transparent, according to the background opacity attribute. The ones are mapped to the foreground color.
* Pattern style (pattern) (OPTIONAL) - Needed if style = M.PATTERN. Should be a wxh color matrix of tables with RGB numbers`
]]
function getFilledObjAttrFunc(attr)
local color = cd.EncodeColor(attr.color[1],attr.color[2],attr.color[3])
local bopa = attr.bopa
local style = attr.style
local hatch = attr.hatch
local r,c
if attr.style == M.STIPPLE then
r,c = #attr.stipple,#attr.stipple[1]
local stipple = cd.CreateStipple(r,c)
for i = 0,r do
for j = 0,c do
stipple[i*c+j] = attr.stipple[i+1][j+1]
end
end
end
if attr.style == M.PATTERN then
r,c = #attr.pattern,#attr.pattern[1]
local pattern = cd.CreatePattern(r,c)
for i = 0,r do
for j = 0,c do
pattern[i*c+j] = cd.EncodeColor(attr.pattern[i+1][j+1][1],attr.pattern[i+1][j+1][2],attr.pattern[i+1][j+1][3])
end
end
end
local function foaSOHO(canvas)
-- Set the foreground color
canvas:SetForeground(color)
-- Set the background opacity
canvas:BackOpacity(bopa)
-- Set interior style
canvas:InteriorStyle(style)
end
local function foaST(canvas)
-- Set the foreground color
canvas:SetForeground(color)
-- Set the background opacity
canvas:BackOpacity(bopa)
-- Set the stipple
canvas:Stipple(stipple)
end
local function foaHA(canvas)
-- Set the foreground color
canvas:SetForeground(color)
-- Set the background opacity
canvas:BackOpacity(bopa)
-- Set the hatch style
canvas:Hatch(hatch)
end
local function foaPA(canvas)
-- Set the foreground color
canvas:SetForeground(color)
-- Set the background opacity
canvas:BackOpacity(bopa)
-- Set the pattern style
canvas:Hatch(pattern)
end
if style == M.PATTERN then
return foaPA
elseif style == M.STIPPLE then
return foaST
elseif style == M.HATCH then
return foaHA
else
return foaSOHO
end
end
-- to draw grid
-- One experiment was to draw the grid using a stipple but was told there is no guaranteed way to align the stipple pattern to
-- known canvas coordinates so always drawing the grid manually
local function drawGrid(cnv,cnvobj,bColore,br,bg,bb,xmin,xmax,ymin,ymax,zoom)
--print("DRAWGRID!")
--local w,h = cnvobj.width, cnvobj.height
local w,h = cnv:GetSize()
local x,y
local grid_x = cnvobj.grid.grid_x
local grid_y = cnvobj.grid.grid_y
if cnvobj.viewOptions.gridMode == 1 then
--print("Set dotted grid!")
cnv:SetForeground(cd.EncodeColor(255-br,255-bg,255-bb)) -- Bitwise NOT of the background color
--cnv:LineStyleDashes({1,grid_x-1},2)
-- Set the new custom line style
cnv:LineStyle(M.CONTINUOUS)
cnv:LineWidth(1)
cnv:LineJoin(M.MITER)
cnv:LineCap(M.CAPFLAT)
local yi,yf = floor(ymin/grid_y)*grid_y,ymax
local mult = 1
while floor(mult*grid_y/zoom) < 5 do
mult = mult + 1
end
local yp = floor((yi-ymin)/zoom)
cnv:Line(0,yp,w,yp)
for y=yi+mult*grid_y, yf, mult*grid_y do
yp = floor((y-ymin)/zoom)
cnv:Line(0,yp,w,yp)
end
-- Now draw the background rectangles
cnv:SetForeground(bColore)
cnv:BackOpacity(M.OPAQUE)
cnv:InteriorStyle(M.SOLID)
local xi,xf = floor(xmin/grid_x)*grid_x,xmax
local xp = floor((xi-xmin)/zoom)
mult = 1
while floor(mult*grid_x/zoom) < 5 do
mult = mult + 1
end
local fac =mult* grid_x-xmin
cnv:Box(xp+1,floor((xi+fac)/zoom)-1,0,h)
for x = xi+mult*grid_x,xf,mult*grid_x do
xp = floor((x-xmin)/zoom)
cnv:Box(xp+1, floor((x+fac)/zoom)-1, 0, h)
end
else
cnv:SetForeground(cd.EncodeColor(255-br,255-bg,255-bb)) -- Bitwise NOT of the background color
cnv:LineStyle(M.CONTINUOUS)
cnv:LineWidth(1)
cnv:LineJoin(M.MITER)
cnv:LineCap(M.CAPFLAT)
--first for loop to draw horizontal line
local yi,yf = floor(ymin/grid_y)*grid_y,ymax
local mult = 1
while floor(mult*grid_y/zoom) < 5 do
mult = mult + 1
end
local yp = floor((yi-ymin)/zoom)
cnv:Line(0,yp,w,yp)
for y=yi+mult*grid_y, yf, mult*grid_y do
yp = floor((y-ymin)/zoom)
cnv:Line(0,yp,w,yp)
end
-- for loop used to draw vertical line
local xi,xf = floor(xmin/grid_x)*grid_x,xmax
local xp = floor((xi-xmin)/zoom)
mult = 1
while floor(mult*grid_x/zoom) < 5 do
mult = mult + 1
end
local fac =mult* grid_x-xmin
cnv:Line(xp,0,xp,h)
for x = xi+mult*grid_x,xf,mult*grid_x do
xp = floor((x-xmin)/zoom)
cnv:Line(xp,0,xp,h)
end
end
end
function render(cnvobj,cd_bcanvas, vp, showGrid)
cd_bcanvas = cd_bcanvas or cnvobj.cdbCanvas
local attr = cnvobj.attributes
local vOptions = cnvobj.viewOptions
local jdx = vOptions.junction.dx
local jdy = vOptions.junction.dy
local jshape = vOptions.junction.shape
local bColor = vOptions.backgroundColor
local bColore = cd.EncodeColor(bColor[1], bColor[2], bColor[3])
cd_bcanvas:Activate()
cd_bcanvas:Background(bColore)
cd_bcanvas:Clear()
local width,height = cd_bcanvas:GetSize()
vp = vp or cnvobj.viewPort
local xm = vp.xmin
local ym = vp.ymin
local xmax = vp.xmax
local zoom = (xmax-xm+1)/(width)
local ymax = floor(zoom*height+ym-1)
if (type(showGrid) == "boolean" and showGrid) or (type(showGrid) ~= "boolean" and cnvobj.viewOptions.gridVisibility) then
drawGrid(cd_bcanvas,cnvobj,bColore,bColor[1], bColor[2], bColor[3],xm,xmax,ym,ymax,zoom)
end
-- Now loop through the order array to draw every element in order
local vAttr = -1 -- Special case number which forces the run of the next visual attributes run
local shape,cshape
local order = cnvobj.drawn.order
local x1,y1,x2,y2
local item
local segs
local juncs
local s
for i = 1,#order do
item = order[i].item
if order[i].type == "object" then
-- This is an object
--cd_bcanvas:SetForeground(cd.EncodeColor(0, 162, 232))
-- Run the visual attributes
shape = attr.visualAttr[item] or M[item.shape] -- validity is not checked for the registered shape structure
if vAttr == -1 or vAttr ~= shape.vAttr then
vAttr = shape.vAttr
shape.visualAttr(cd_bcanvas,zoom)
end
x1,y1 = item.x,item.y
--[[
y2 = {}
for j = 1,#y1 do
y2[j] = cnvobj.height - y1[j]
end
]]
M[item.shape].draw(cnvobj,cd_bcanvas,x1,y1,item,zoom,xm,ym)
else
-- This is a connector
--cd_bcanvas:SetForeground(cd.EncodeColor(255, 128, 0))
cshape = attr.visualAttr[item] or M.CONN
if vAttr == -1 or vAttr ~= cshape.vAttr then
vAttr = cshape.vAttr
cshape.visualAttr(cd_bcanvas,zoom)
end
segs = item.segments
for j = 1,#segs do
s = segs[j]
shape = attr.visualAttr[s] or M.CONN
if vAttr == -1 or vAttr ~= shape.vAttr then
vAttr = shape.vAttr
shape.visualAttr(cd_bcanvas,zoom)
end
x1,y1,x2,y2 = s.start_x,s.start_y,s.end_x,s.end_y
--y1 = cnvobj.height - y1
--y2 = cnvobj.height - y2
M.CONN.draw(cnvobj,cd_bcanvas,x1,y1,x2,y2,zoom,xm,ym)
end
-- Draw the junctions
if jdx~=0 and jdy~=0 then
if vAttr == -1 or vAttr ~= cshape.vAttr then
vAttr = cshape.vAttr
cshape.visualAttr(cd_bcanvas,zoom)
end
cd_bcanvas:InteriorStyle(M.SOLID) -- This doesn't effect the current vAttr because connector attribute is for non filled object
juncs = item.junction
for j = 1,#juncs do
x1,y1 = {juncs[j].x-jdx,juncs[j].x+jdx},{juncs[j].y-jdy,juncs[j].y+jdy}
--y1[1] = cnvobj.height - y1[1]
--y1[2] = cnvobj.height - y1[2]
M.FILLEDELLIPSE.draw(cnvobj,cd_bcanvas,x1,y1,item,zoom,xm,ym)
end
end
end
end
cd_bcanvas:Flush()
end
function update(cnvobj)
render(cnvobj)
end
-- The margins are provided in mm
function doprint(cnvobj,name,marginLeft,marginRight,marginUp,marginDown)
name = name or "Lua-GL drawing"
-- Figure out the maximum extremes
local xmin,xmax,ymin,ymax
local order = cnvobj.drawn.order
if #order == 0 then return false end
xmin,ymin = order[1].item.x[1],order[1].item.y[1]
xmax,ymax = xmin,ymin
for i = 1,#order do
if order[i].type == "object" then
local x,y = order[i].item.x,order[i].item.y
for j = 1,#x do
if x[j] < xmin then
xmin = x[j]
end
if x[j] > xmax then
xmax = x[j]
end
if y[j] < ymin then
ymin = y[j]
end
if y[j] > ymax then
ymax = y[j]
end
end
elseif order[i].type == "connector" then
local segs = order[i].item.segments
for j = 1,#segs do
if segs[j].start_x < xmin then
xmin = segs[j].start_x
end
if segs[j].start_x > xmax then
xmax = segs[j].start_x
end
if segs[j].end_x < xmin then
xmin = segs[j].end_x
end
if segs[j].end_x > xmax then
xmax = segs[j].end_x
end
if segs[j].start_y < ymin then
ymin = segs[j].start_y
end
if segs[j].start_y > ymax then
ymax = segs[j].start_y
end
if segs[j].end_y < ymin then
ymin = segs[j].end_y
end
if segs[j].end_y > ymax then
ymax = segs[j].end_y
end
end
end
end
local cdpr = cd.CreateCanvas(cd.PRINTER,name.." -d")
if not cdpr then
--print("Could not get the print canvas")
return false
end
local w,h,wm,hm = cdpr:GetSize()
local mL = floor(w/wm*marginLeft+0.5)
local mR = floor(w/wm*marginRight+0.5)
local mU = floor(h/hm*marginUp+0.5)
local mD = floor(h/hm*marginDown+0.5)
local dx = xmax-xmin+1
local dy = ymax-ymin+1
if dy/dx>(h-mU-mD)/(w-mL-mR) then
-- y dimension is more so set xmax so that whole y is visible
-- y direction fits
ymin = ymin - floor(dy/(h-mD-mU)*mD+0.5)
--ymax = ymax + mU
local mLN = floor((w-(h-mU-mD)/dy*dx)/2)
if mLN < mL then
xmin = xmin - floor(dy/(h-mD-mU)*mL+0.5)
xmax = xmax + floor(dy/(h-mD-mU)*(w-mL)+0.5)-dx
else
xmin = xmin - floor(dy/(h-mD-mU)*mLN+0.5)
xmax = xmax + floor(dy/(h-mD-mU)*(w-mLN)+0.5)-dx
end
else
-- x direction fits
xmin = xmin - floor(dx/(w-mL-mR)*mL+0.5)
xmax = xmax + floor(dx/(w-mL-mR)*mR+0.5)
local mDN = floor((h-(w-mL-mR)/dx*dy)/2+0.5)
if mDN < mD then
ymin = ymin - floor(dx/(w-mL-mR)*mD+0.5)
else
ymin = ymin - floor(dx/(w-mL-mR)*mDN+0.5)
end
end
local vp = {
xmin = xmin,
xmax = xmax,
ymin = ymin
}
--print(cdpr.rastersize)
render(cnvobj,cdpr,vp,false)
cdpr:Kill()
end
function init(cnvobj)
local t = {}
for k,v in pairs(M) do
if type(v) ~= "function" then
t[k] = v
end
end
cnvobj.viewOptions.constants = t
end
|
local Prop = {}
Prop.Name = "Tower Casino"
Prop.Cat = "Store"
Prop.Price = 25000
Prop.Doors = {
Vector( -3842, -5034, 191 ),
Vector( -3842, -5078, 191 ),
}
GM.Property:Register( Prop ) |
--[[
~ Weapon Store ~ Serverside ~
~ Lexi ~
--]]
function ENT:SpawnFunction(ply, tr)
print(self, self.IsValid, self:IsValid(), self.GetClass, self:GetClass())
if (not tr.Hit) then return end
local ent = ents.Create ("sent_weaponstore");
ent:SetPos (tr.HitPos + tr.HitNormal * 16);
ent:Spawn();
ent:Activate();
return ent;
end
ENT.Weapons = {
{
ent = NULL;
class = "weapon_rpg";
multiplier = 1;
nextspawn = 0;
};
{
ent = NULL;
class = "";
multiplier = 0;
nextspawn = 0;
};
{
ent = NULL;
class = "";
multiplier = 0;
nextspawn = 0;
};
{
ent = NULL;
class = "";
multiplier = 0;
nextspawn = 0;
};
{
ent = NULL;
class = "";
multiplier = 0;
nextspawn = 0;
};
{
ent = NULL;
class = "";
multiplier = 0;
nextspawn = 0;
};
{
ent = NULL;
class = "";
multiplier = 0;
nextspawn = 0;
};
{
ent = NULL;
class = "";
multiplier = 0;
nextspawn = 0;
};
};
-- keyvals
ENT.k_number = 1;
ENT.k_weapon1_class = "weapon_rpg";
ENT.k_weapon1_mul = 1;
local model = Model("models/props_c17/streetsign004f.mdl")
function ENT:Initialize ()
self:SetModel(model);
self:SetMaterial("models/debug/white");
self:SetColor(122, 204, 71, 200);
self:PhysicsInit(SOLID_BBOX);
self:SetMoveType(MOVETYPE_NONE);
self:SetSolid (SOLID_NONE);
local phys = self:GetPhysicsObject();
if (IsValid(phys)) then
phys:EnableMotion(false);
else
ErrorNoHalt("No physics object for ", tostring(self), " using model ", model, "?\n");
end
end
local time,offset;
ENT.PrevTime = 0;
function ENT:Think()
time = CurTime(); -- Rather than RealTime, so if the server slows down, so does the spinning~
offset = time - self.prevtime;
self.prevtime = time;
-- for i = 1, self.k_number do
-- if (
end
-- Using keyvalues allows us to have a callback for each value, should it be needed.
function ENT:KeyValue (key, value)
self["k_"..key] = tonumber(value) or value;
end
function ENT:OnRemove()
-- Remove floating weapons
end
--[[ Make theese dupable ]]--
duplicator.RegisterEntityClass("sent_weaponcache", function(ply, pos, angles, data)
local ent = ents.Create("sent_weaponcache");
ent:SetAngles(angles);
ent:SetPos(angles);
for key, value in pairs(data) do
if (key:sub(1, 2) == "k_") then
ent:SetKeyValue(key:sub(3), value);
end
end
ent:Spawn();
ent:Activate();
end, "Pos", "Angles", "Data"); |
-- Enable relative line numbers
vim.opt_local.number = true
vim.opt_local.relativenumber = true
|
-- Tests here are dedicated to verify that ujit library implementation of
-- variuos functions from 'table' module outperforms naive implementation.
-- Copyright (C) 2020-2022 LuaVela Authors. See Copyright Notice in COPYRIGHT
-- Copyright (C) 2015-2020 IPONWEB Ltd. See Copyright Notice in COPYRIGHT
local utils = require("utils")
local comparators = utils.create_comparators({
keys = ujit.table.keys,
shallowcopy = ujit.table.shallowcopy,
size = ujit.table.size,
toset = ujit.table.toset,
values = ujit.table.values,
})
print("Benchmarking:\n")
for _, ttype in pairs(utils.TABLE_TYPES)
do
print("-- type: " .. ttype)
for _, l in pairs({10, 100, 1000, 100000})
do
local t = utils.generate_table(l, ttype)
print(" length: " .. l)
for _, comp in ipairs(comparators)
do
local t_diff, t_ratio = comp.get_diff_and_ratio(t)
print(" " .. comp.compared_name .. ": diff: " .. t_diff .. " ratio: " .. t_ratio)
-- TODO: These should be investigated later
-- assert(t_diff >= 0.0)
-- assert(t_ratio >= 1.0)
end
print()
end
print()
end
|
Citizen.CreateThread(function()
TriggerEvent("inv:playerSpawned");
end)
RegisterServerEvent("server-item-quality-update")
AddEventHandler("server-item-quality-update", function(player, data)
if data.quality < 1 then
exports.ghmattimysql:execute("UPDATE user_inventory2 SET `quality` = @quality WHERE name = @name AND slot = @slot AND item_id = @item_id", {
['quality'] = "0",
['name'] = 'ply-' ..player,
['slot'] = data.slot,
['item_id'] = data.itemid
})
end
end)
RegisterServerEvent('people-search')
AddEventHandler('people-search', function(target)
local source = source
local user = exports["npc-core"]:getModule("Player"):GetUser(target)
local characterId = user:getVar("character").id
TriggerClientEvent("server-inventory-open", source, "1", 'ply-'.. characterId)
end)
RegisterServerEvent('Stealtheybread')
AddEventHandler('Stealtheybread', function(target)
local src = source
local user = exports["npc-core"]:getModule("Player"):GetUser(src)
local targetply = exports["npc-core"]:getModule("Player"):GetUser(target)
user:addMoney(targetply:getCash())
targetply:removeMoney(targetply:getCash())
end)
RegisterNetEvent('npc-weapons:getAmmo')
AddEventHandler('npc-weapons:getAmmo', function()
local ammoTable = {}
local src = source
local user = exports["npc-core"]:getModule("Player"):GetUser(src)
local char = user:getCurrentCharacter()
exports.ghmattimysql:execute("SELECT type, ammo FROM characters_weapons WHERE id = @id", {['id'] = char.id}, function(result)
for i = 1, #result do
if ammoTable["" .. result[i].type .. ""] == nil then
ammoTable["" .. result[i].type .. ""] = {}
ammoTable["" .. result[i].type .. ""]["ammo"] = result[i].ammo
ammoTable["" .. result[i].type .. ""]["type"] = ""..result[i].type..""
end
end
TriggerClientEvent('npc-items:SetAmmo', src, ammoTable)
end)
end)
RegisterNetEvent('npc-weapons:updateAmmo')
AddEventHandler('npc-weapons:updateAmmo', function(newammo,ammoType,ammoTable)
local src = source
local user = exports["npc-core"]:getModule("Player"):GetUser(src)
local char = user:getCurrentCharacter()
exports.ghmattimysql:execute('SELECT ammo FROM characters_weapons WHERE type = @type AND id = @identifier',{['@type'] = ammoType, ['@identifier'] = char.id}, function(result)
if result[1] == nil then
exports.ghmattimysql:execute('INSERT INTO characters_weapons (id, type, ammo) VALUES (@identifier, @type, @ammo)', {
['@identifier'] = char.id,
['@type'] = ammoType,
['@ammo'] = newammo
}, function()
end)
else
exports.ghmattimysql:execute('UPDATE characters_weapons SET ammo = @newammo WHERE type = @type AND ammo = @ammo AND id = @identifier', {
['@identifier'] = char.id,
['@type'] = ammoType,
['@ammo'] = result[1].ammo,
['@newammo'] = newammo
}, function()
end)
end
end)
end)
RegisterServerEvent("npc-inventory:RetreiveSettings")
AddEventHandler("npc-inventory:RetreiveSettings", function()
local src = source
local user = GetPlayerIdentifiers(src)[1]
exports.ghmattimysql:execute("SELECT `inventory_settings` FROM users WHERE hex_id = @hex_id", {['hex_id'] = user}, function(result)
if (result[1]) then
TriggerClientEvent('npc-core:update:settings', src, result[1].inventory_settings)
end
end)
end)
|
TX_port = 0;
RX_port = 1;
Burst_size = 4;
Rate = RATE;
TX_count = 1000000;
package.path = package.path ..";?.lua;test/?.lua;app/?.lua;";
require "Pktgen";
pktgen.set(TX_port, "burst", Burst_size);
f = assert(io.open("/tmp/Output.txt", "w"));
for i = 1, REPETITIONS
do
-- Flush remaining packets.
pktgen.set(TX_port, "count", 1);
while true do
pktgen.clear("all");
pktgen.start(TX_port);
pktgen.delay(1000);
RX_count = pktgen.portStats(RX_port, "port")[RX_port]["ipackets"];
if RX_count > 0 then
break;
end
end
pktgen.clear("all");
pktgen.set(TX_port, "count", TX_count);
pktgen.set(TX_port, "rate", Rate);
pktgen.start(TX_port);
while pktgen.isSending(TX_port) == "y" or
pktgen.portStats(RX_port, "port")[RX_port]["ipackets"] == 0 do
pktgen.delay(10);
end
pktgen.delay(1000);
RX_count = pktgen.portStats(RX_port, "port")[RX_port]["ipackets"];
Loss = 1 - RX_count / TX_count
printf("Loss: %f\n", Loss);
f:write(", ");
f:write(Loss);
end
f:close();
pktgen.quit();
|
-- import
local EntityModule = require 'candy.Entity'
local Entity = EntityModule.Entity
local AnimatorEventTrackModule = require 'candy.animator.AnimatorEventTrack'
local AnimatorEventKey = AnimatorEventTrackModule.AnimatorEventKey
local AnimatorEventTrack = AnimatorEventTrackModule.AnimatorEventTrack
-- module
local EntityMessageAnimatorTrackModule = {}
---@class EntityMessageAnimatorKey : AnimatorEventKey
local EntityMessageAnimatorKey = CLASS: EntityMessageAnimatorKey ( AnimatorEventKey )
:MODEL {
Field ( "msg" ):string (),
Field ( "data" ):string ()
}
function EntityMessageAnimatorKey:__init ()
self.msg = ""
self.data = ""
end
function EntityMessageAnimatorKey:toString ()
return self.msg
end
---@class EntityMessageAnimatorTrack : AnimatorEventTrack
local EntityMessageAnimatorTrack = CLASS: EntityMessageAnimatorTrack ( AnimatorEventTrack )
:MODEL {}
function EntityMessageAnimatorTrack:getIcon ()
return "track_msg"
end
function EntityMessageAnimatorTrack:toString ()
local pathText = self.targetPath:toString ()
return pathText .. ": ( MSG )"
end
function EntityMessageAnimatorTrack:createKey ( pos, context )
local key = EntityMessageAnimatorKey ()
key:setPos ( pos )
self:addKey ( key )
return key
end
function EntityMessageAnimatorTrack:build ( context )
self.idCurve = self:buildIdCurve ()
context:updateLength ( self:calcLength () )
end
function EntityMessageAnimatorTrack:onStateLoad ( state )
local rootEntity, scene = state:getTargetRoot ()
local entity = self.targetPath:get ( rootEntity, scene )
local playContext = { entity, 0 }
state:addUpdateListenerTrack ( self, playContext )
end
function EntityMessageAnimatorTrack:apply ( state, playContext, t )
local entity = playContext[ 1 ]
local keyId = playContext[ 2 ]
local newId = self.idCurve:getValueAtTime ( t )
if keyId ~= newId then
playContext[ 2 ] = newId
if newId > 0 then
local key = self.keys[ newId ]
local msg = key.msg
local data = key.data
if entity then
return entity:tell ( msg, data, state:getAnimator () )
end
end
end
end
function EntityMessageAnimatorTrack:reset ( state, playContext )
playContext[ 2 ] = 0
end
function EntityMessageAnimatorTrack:isPreviewable ()
return false
end
registerCustomAnimatorTrackType ( Entity, "Message", EntityMessageAnimatorTrack )
EntityMessageAnimatorTrackModule.EntityMessageAnimatorKey = EntityMessageAnimatorKey
EntityMessageAnimatorTrackModule.EntityMessageAnimatorTrack = EntityMessageAnimatorTrack
return EntityMessageAnimatorTrackModule |
--[[
© CloudSixteen.com do not share, re-distribute or modify
without permission of its author ([email protected]).
--]]
local ITEM = Clockwork.item:New("weapon_base");
ITEM.name = "ItemShotgun";
ITEM.cost = 300;
ITEM.model = "models/weapons/w_shotgun.mdl";
ITEM.weight = 4;
ITEM.classes = {CLASS_EOW};
ITEM.uniqueID = "weapon_shotgun";
ITEM.business = true;
ITEM.description = "ItemShotgunDesc";
ITEM.isAttachment = true;
ITEM.hasFlashlight = true;
ITEM.loweredOrigin = Vector(3, 0, -4);
ITEM.loweredAngles = Angle(0, 45, 0);
ITEM.attachmentBone = "ValveBiped.Bip01_Spine";
ITEM.attachmentOffsetAngles = Angle(0, 0, 0);
ITEM.attachmentOffsetVector = Vector(-4, 4, 4);
ITEM:Register(); |
--- The derma library allows you to add custom derma controls and create & modify derma skins.
_G.derma = {}
--- Gets the color from a Derma skin of a panel and returns default color if not found
--- @param name string
--- @param pnl GPanel
--- @param default table @The default color in case of failure.
function derma.Color(name, pnl, default)
end
--- Defines a new Derma control with an optional base.
--- This calls vgui.Register internally, but also does the following:
--- * Adds the control to derma.GetControlList
--- * Adds a key "Derma" - This is returned by derma.GetControlList
--- * Makes a global table with the name of the control (This is technically deprecated and should not be relied upon)
--- * If reloading (i.e. called this function with name of an existing panel), updates all existing instances of panels with this name. (Updates functions, calls PANEL:PreAutoRefresh and PANEL:PostAutoRefresh, etc.)
--- @param name string @Name of the newly created control
--- @param description string @Description of the control
--- @param tab table @Table containing control methods and properties
--- @param base string @Derma control to base the new control off of
--- @return table @A table containing the new control's methods and properties
function derma.DefineControl(name, description, tab, base)
end
--- Defines a new skin so that it is usable by Derma. The default skin can be found in "garrysmod/lua/skins/default.lua"
--- @param name string @Name of the skin
--- @param descriptions string @Description of the skin
--- @param skin table @Table containing skin data
function derma.DefineSkin(name, descriptions, skin)
end
--- Returns the derma.Controls table, a list of all derma controls registered with derma.DefineControl.
--- @return table @A listing of all available derma-based controls
function derma.GetControlList()
end
--- Returns the default skin table, which can be changed with the hook GM:ForceDermaSkin
--- @return table @Skin table
function derma.GetDefaultSkin()
end
--- Returns the skin table of the skin with the supplied name
--- @param name string @Name of skin
--- @return table @Skin table
function derma.GetNamedSkin(name)
end
--- Returns a copy of the table containing every Derma skin
--- @return table @Table of every Derma skin
function derma.GetSkinTable()
end
--- Clears all cached panels so that they reassess which skin they should be using.
function derma.RefreshSkins()
end
--- Returns how many times derma.RefreshSkins has been called.
--- @return number @Amount of times derma.RefreshSkins has been called.
function derma.SkinChangeIndex()
end
--- Calls the specified hook for the given panel
--- @param type string @The type of hook to run
--- @param name string @The name of the hook to run
--- @param panel GPanel @The panel to call the hook for
--- @param w number @The width of the panel
--- @param h number @The height of the panel
--- @return any @The returned variable from the skin hook
function derma.SkinHook(type, name, panel, w, h)
end
--- Returns a function to draw a specified texture of panels skin.
--- @param name string @The identifier of the texture
--- @param pnl GPanel @Panel to get the skin of.
--- @param fallback any @What to return if we failed to retrieve the texture
--- @return function @A function that is created with the GWEN to draw a texture.
function derma.SkinTexture(name, pnl, fallback)
end
|
--------------------------------------------------------------------------------
-- Preconditions
--------------------------------------------------------------------------------
local Preconditions = require('user_modules/shared_testcases/commonPreconditions')
--------------------------------------------------------------------------------
-- Set 4 protocol as default for script
config.defaultProtocolVersion = 4
--------------------------------------------------------------------------------
--Precondition: preparation connecttest_language_parameter.lua
Preconditions:Connecttest_without_ExitBySDLDisconnect_OpenConnection("connecttest_language_parameter.lua")
Test = require('user_modules/connecttest_language_parameter')
require('cardinalities')
local events = require('events')
local mobile_session = require('mobile_session')
local mobile = require('mobile_connection')
local tcp = require('tcp_connection')
local file_connection = require('file_connection')
require('user_modules/AppTypes')
local commonFunctions = require('user_modules/shared_testcases/commonFunctions')
config.deviceMAC = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0"
-- Set EnableProtocol4 to true
commonFunctions:SetValuesInIniFile("EnableProtocol4%s-=%s-[%w]-%s-\n", "EnableProtocol4", "true" )
local function DelayedExp(time)
local event = events.Event()
event.matches = function(self, e) return self == e end
EXPECT_EVENT(event, "Delayed event")
:Timeout(time + 1000)
RUN_AFTER(function()
RAISE_EVENT(event, event)
end, time)
end
local function userPrint( color, message)
print ("\27[" .. tostring(color) .. "m " .. tostring(message) .. " \27[0m")
end
local function RegistrationApp(self)
local CorIdRegister = self.mobileSession:SendRPC("RegisterAppInterface",
{
syncMsgVersion =
{
majorVersion = 4,
minorVersion = 2
},
appName = config.application1.registerAppInterfaceParams.appName,
isMediaApplication = true,
languageDesired = 'EN-US',
hmiDisplayLanguageDesired = 'EN-US',
appHMIType = config.application1.registerAppInterfaceParams.appHMIType,
appID = "8675308",
deviceInfo =
{
os = "Android",
carrier = "Megafon",
firmwareRev = "Name: Linux, Version: 3.4.0-perf",
osVersion = "4.4.2",
maxNumberRFCOMMPorts = 1
}
})
EXPECT_HMINOTIFICATION("BasicCommunication.OnAppRegistered",
{
application =
{
appName = config.application1.registerAppInterfaceParams.appName
}
})
:Do(function(_,data)
self.applications[config.application1.registerAppInterfaceParams.appName] = data.params.application.appID
self.appID = data.params.application.appID
end)
self.mobileSession:ExpectResponse(CorIdRegister, { success = true, resultCode = "SUCCESS"})
self.mobileSession:ExpectNotification("OnHMIStatus",
{ systemContext = "MAIN", hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE"})
DelayedExp(1000)
end
local function UnregisterApp(self)
--request from mobile side
local CorIdUnregisterAppInterface = self.mobileSession:SendRPC("UnregisterAppInterface",{})
EXPECT_HMINOTIFICATION("BasicCommunication.OnAppUnregistered", {unexpectedDisconnect = false})
--response on mobile side
EXPECT_RESPONSE(CorIdUnregisterAppInterface, { success = true, resultCode = "SUCCESS"})
:Timeout(2000)
EXPECT_HMICALL("BasicCommunication.UpdateAppList")
:Do(function(_,data)
self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", { })
end)
end
local n = 1
local function ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, JsonFileName, SystemRequestResultCode, UpdateAppListParams )
-- local UpdateAppListTimes
local successValue
self.mobileSession.correlationId = self.mobileSession.correlationId + 1
local msg =
{
serviceType = 7,
frameInfo = 0,
rpcType = 2,
rpcFunctionId = 32768,
rpcCorrelationId = self.mobileSession.correlationId,
payload = '{"hmiLevel" :"FULL", "audioStreamingState" : "AUDIBLE", "systemContext" : "MAIN"}'
}
self.mobileSession:Send(msg)
local FileFolder
local FileName
FileFolder, FileName = JsonFileName:match("([^/]+)/([^/]+)")
--mobile side: OnSystemRequest notification
EXPECT_NOTIFICATION("OnSystemRequest")
:Do(function()
local CorIdSystemRequest = self.mobileSession:SendRPC("SystemRequest",
{
requestType = "QUERY_APPS",
fileName = FileName
},
"files/jsons/" .. tostring(JsonFileName))
--mobile side: SystemRequest response
self.mobileSession:ExpectResponse(CorIdSystemRequest, { success = successValue, resultCode = SystemRequestResultCode})
end)
--------------------------------------------
--TODO: remove after resolving APPLINK-16052
for i=1,#UpdateAppListParams.applications do
if UpdateAppListParams.applications[i].deviceInfo then
UpdateAppListParams.applications[i].deviceInfo = nil
end
end
--------------------------------------------
--------------------------------------------
--TODO: remove after resolving APPLINK-18305
for i=1,#UpdateAppListParams.applications do
if
UpdateAppListParams.applications[i].ttsName then
UpdateAppListParams.applications[i].ttsName = UpdateAppListParams.applications[i].ttsName[1].text
end
end
--------------------------------------------
--hmi side: BasicCommunication.UpdateAppList
EXPECT_HMICALL("BasicCommunication.UpdateAppList",
UpdateAppListParams)
:ValidIf(function(exp,data)
if
data.params and
data.params.applications and
#data.params.applications == #UpdateAppListParams.applications then
return true
else
print(" \27[36m Application array in BasicCommunication.UpdateAppList contains "..tostring(#data.params.applications)..", expected " .. tostring(#UpdateAppListParams.applications) .. " \27[0m")
return false
end
end)
:Do(function(data)
self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", { })
end)
end
userPrint(33, " Commented SDL defect APPLINK-18305 ")
---------------------------------------------------------------------------------------
--===================================================================================--
-- Check that SDL write a value of "name" to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "language" scruct is omitted
--===================================================================================--
--Precondition: open session
function Test:Precondition_OpenSession()
self.mobileSession = mobile_session.MobileSession(
self,
self.mobileConnection)
self.mobileSession.version = 4
self.mobileSession:StartService(7)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithOmittedLanguageStruct()
RegistrationApp(self)
end
--===================================================================================--
--language struct is ommited in JSON file
function Test:JSONWithOmittedLanguageStruct()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
isMediaApplication = true
},
{
appName = "Classic Music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Classic Music App"
}
},
vrSynonyms = {"Classic Music App"}
},
{
appName = "Rap Music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rap Music App"
}
},
vrSynonyms = {"Rap Music App"}
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithOmittedLanguageStruct.json", "SUCCESS", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a value of "name" to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "language" struct is empty
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithEmptyLanguageStruct()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithEmptyLanguageStruct()
RegistrationApp(self)
end
--===================================================================================--
--language struct is empty in JSON file
function Test:JSONWithEmptyLanguageStruct()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
},
{
appName = "Rap Music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rap Music App"
}
},
vrSynonyms = {"Rap Music App"}
},
{
appName = "Rock music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rock music App"
}
},
vrSynonyms = {"Rock music App"}
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithEmptyLanguageStruct.json", "SUCCESS", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a value of "name" to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "language" scruct has empty element
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithEmptyElementLanguageStruct()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithEmptyElementLanguageStruct()
RegistrationApp(self)
end
--===================================================================================--
--language struct has empty element in JSON file
function Test:JSONWithEmptyElementLanguageStruct()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
},
{
appName = "Rap Music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rap Music App"
}
},
vrSynonyms = {"Rap Music App"}
},
{
appName = "Rock music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rock music App"
}
},
vrSynonyms = {"Rock music App"}
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithEmptyElementInLanguageStruct.json", "SUCCESS", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a value of "name" to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "language" scruct where ttsName and vrSynonyms params are omitted
--=====================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithOmittedttsNamevrSynonyms()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithOmittedttsNamevrSynonyms()
RegistrationApp(self)
end
--===================================================================================--
--JSON file contains 2 elements in array, one element lacks all mandatory parameters
function Test:JSONWithOmittedttsNamevrSynonyms()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
},
{
appName = "Crappy Music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Crappy Music App"
}
},
vrSynonyms = {"Crappy Music App"}
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithOmmitedttsNamevrSynonymsLanguageStruct.json", "SUCCESS", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "language" scruct has only element with current language and without "default" parameter
--===================================================================================--
---Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithcurrentHMIlanElementWithoutDefault()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithcurrentHMIlanElementWithoutDefault()
RegistrationApp(self)
end
--===================================================================================--
--language struct has language element with current HMI language and without "default" parameter
function Test:JSONWithcurrentHMIlanElementWithoutDefault()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
isMediaApplication = true
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithcurrentHMIlanElementWithoutDefault.json", "INVALID_DATA", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "language" scruct has only element with current language and "default" parameter
--===================================================================================--
-- Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithcurrentHMIlanElementWithDefault()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithcurrentHMIlanElementWithDefault()
RegistrationApp(self)
end
--===================================================================================--
--language struct has language element with current HMI language and with "default" parameter
function Test:JSONWithcurrentHMIlanElementWithDefault()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
},
{
appName = "Rap music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rap music App tts name EN"
}
},
vrSynonyms = {"Rap music App 1 EN", "Rap music App 2 EN"}
},
{
appName = "Rock music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rock music App tts name EN"
}
},
vrSynonyms = {"Rock music App 1 EN", "Rock music App 2 EN"}
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithLanguageDefaultCurrentDe.json", "SUCCESS", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "language" scruct has only element with not current language and with "default" parameter
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithNotcurrentHMIlanElementWithDefault()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithNotcurrentHMIlanElementWithDefault()
RegistrationApp(self)
end
--===================================================================================--
--language struct has no language element with current HMI language and has "default" parameter
function Test:JSONWithNotcurrentHMIlanElementWithDefault()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
},
{
appName = "Rap music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rap music App tts name default"
}
},
vrSynonyms = {"Rap music App 1 default", "Rap music App 2 default"}
},
{
appName = "Rock music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rock music App tts name default"
}
},
vrSynonyms = {"Rock music App 1 default", "Rock music App 2 default"}
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithLanguageDefaultNotCurrent.json", "SUCCESS", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "language" scruct has ttsName in default element and vrSynonyms in current HMI language and vice versa
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithTtsNameVrSynonymsInSeparatedStructs()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithTtsNameVrSynonymsInSeparatedStructs()
RegistrationApp(self)
end
--===================================================================================--
--language struct has ttsName and vrSynonyms parameters in separated scructs
function Test:JSONWithTtsNameVrSynonymsInSeparatedStructs()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
},
{
appName = "Rap music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rap music App"
}
},
vrSynonyms = {"Rap music App 1 EN", "Rap music App 2 EN"}
},
{
appName = "Rock music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rock music App tts name EN"
}
},
vrSynonyms = {"Rock music App"}
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithTtsNameVrSynonymsInSeparatedStructs.json", "SUCCESS", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "tts" param and send via UpdateAppList to HMI in case "language" scruct has only ttsName, vrSynonym = name
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithTtsName()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithTtsName()
RegistrationApp(self)
end
--===================================================================================--
--language struct has only ttsName parameters, vrSynonyms is defined by "name" value
function Test:JSONWithTtsName()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
},
{
appName = "Rap music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rap music App tts name default"
}
},
vrSynonyms = {"Rap music App"}
},
{
appName = "Rock music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rock music App tts name default"
}
},
vrSynonyms = {"Rock music App"}
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithTtsName.json", "SUCCESS", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "vrSynonyms" param and send via UpdateAppList to HMI in case "language" scruct has only vrSynonyms, ttsName = name
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithVrSynonyms()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithVrSynonyms()
RegistrationApp(self)
end
--===================================================================================--
--language struct has only vrSynonyms parameters, ttsName is defined by "name" value
function Test:JSONWithVrSynonyms()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
},
{
appName = "Rap music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rap music App"
}
},
vrSynonyms = {"Rap music App 1 default", "Rap music App 2 default"}
},
{
appName = "Rock music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "Rock music App"
}
},
vrSynonyms = {"Rock music App 1 default", "Rock music App 2 default"}
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithVrSynonyms.json", "SUCCESS", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from RegisterAppInterface to the vrSynonyms and ttsName params and send via UpdateAppList to HMI in case "language" scruct has values for ttsName and vrSynonyms
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithOmitedVrSynonymsttsNameForRegisteredApp()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithOmitedVrSynonymsttsNameForRegisteredApp()
local CorIdRegister = self.mobileSession:SendRPC("RegisterAppInterface",
{
syncMsgVersion =
{
majorVersion = 4,
minorVersion = 2
},
appName = "Test Application",
isMediaApplication = true,
languageDesired = 'EN-US',
hmiDisplayLanguageDesired = 'EN-US',
appHMIType = config.application1.registerAppInterfaceParams.appHMIType,
appID = "8675308",
deviceInfo =
{
os = "Android",
carrier = "Megafon",
firmwareRev = "Name: Linux, Version: 3.4.0-perf",
osVersion = "4.4.2",
maxNumberRFCOMMPorts = 1
}
})
EXPECT_HMINOTIFICATION("BasicCommunication.OnAppRegistered",
{
application =
{
appName = config.application1.registerAppInterfaceParams.appName
}
})
:Do(function(_,data)
local appId = data.params.application.appID
self.appId = appId
end)
self.mobileSession:ExpectResponse(CorIdRegister, { success = true, resultCode = "SUCCESS"})
self.mobileSession:ExpectNotification("OnHMIStatus",
{ systemContext = "MAIN", hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE"})
end
--===================================================================================--
--language struct has values for vrSynonyms, ttsName for registered app
function Test:JSONWithOmitedVrSynonymsttsNameForRegisteredApp()
self.mobileSession.correlationId = self.mobileSession.correlationId + 1
local msg =
{
serviceType = 7,
frameInfo = 0,
rpcType = 2,
rpcFunctionId = 32768,
rpcCorrelationId = self.mobileSession.correlationId,
payload = '{"hmiLevel" :"FULL", "audioStreamingState" : "AUDIBLE", "systemContext" : "MAIN"}'
}
self.mobileSession:Send(msg)
--mobile side: OnSystemRequest notification
EXPECT_NOTIFICATION("OnSystemRequest")
:Do(function()
local CorIdSystemRequest = self.mobileSession:SendRPC("SystemRequest",
{
requestType = "QUERY_APPS",
fileName = "JSONWithVrSynonymsttsNameForRegisteredApp"
},
"files/jsons/JSON_Language_parameter/JSONWithVrSynonymsttsNameForRegisteredApp.json")
--mobile side: SystemRequest response
self.mobileSession:ExpectResponse(CorIdSystemRequest, { success = successValue, resultCode = SystemRequestResultCode})
end)
--hmi side: BasicCommunication.UpdateAppList
EXPECT_HMICALL("BasicCommunication.UpdateAppList",
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
--[[TODO: uncomment after resolving APPLINK-16052
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},]]
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
}
}
})
:ValidIf(function(exp,data)
if
data.params and
data.params.applications then
local ReturnValue = true
local ErrorMessage = ""
if #data.params.applications ~= 1 then
ReturnValue = false
ErrorMessage = ErrorMessage .. " \27[31m Application array in BasicCommunication.UpdateAppList contains "..tostring(#data.params.applications)..", expected 1 \27[0m"
end
if data.params.applications[1].ttsName then
ReturnValue = false
ErrorMessage = ErrorMessage .."\n \27[31m BasicCommunication.UpdateAppList contains ttsName value for registered application \27[0m"
end
if data.params.applications[1].vrSynonyms then
ReturnValue = false
ErrorMessage = ErrorMessage .."\n \27[31m BasicCommunication.UpdateAppList contains vrSynonyms value for registered application \27[0m"
end
if ReturnValue == false then
print(ErrorMessage)
return false
else
return true
end
else
print(" \27[36m BasicCommunication.UpdateAppList does not contain applications \27[0m")
return false
end
end)
:Do(function(data)
self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", { })
end)
end
--===================================================================================--
-- Check that SDL write a values from RegisterAppInterface to the vrSynonyms and ttsName params and send via UpdateAppList to HMI in case "language" scruct has different values for ttsName and vrSynonyms
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithVrSynonymsttsNameForRegisteredApp()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithVrSynonymsttsNameForRegisteredApp()
local CorIdRegister = self.mobileSession:SendRPC("RegisterAppInterface",
{
syncMsgVersion =
{
majorVersion = 4,
minorVersion = 2
},
appName = config.application1.registerAppInterfaceParams.appName,
isMediaApplication = true,
languageDesired = 'EN-US',
hmiDisplayLanguageDesired = 'EN-US',
appHMIType = config.application1.registerAppInterfaceParams.appHMIType,
appID = "8675308",
ttsName = {{text = "Test Application chunk 1", type = "TEXT"},{text = "Test Application chunk 2", type = "TEXT"}},
vrSynonyms = {"Test Application vrSynonym"},
deviceInfo =
{
os = "Android",
carrier = "Megafon",
firmwareRev = "Name: Linux, Version: 3.4.0-perf",
osVersion = "4.4.2",
maxNumberRFCOMMPorts = 1
}
})
EXPECT_HMINOTIFICATION("BasicCommunication.OnAppRegistered",
{
application =
{
appName = config.application1.registerAppInterfaceParams.appName
}
})
:Do(function(_,data)
local appId = data.params.application.appID
self.appId = appId
end)
self.mobileSession:ExpectResponse(CorIdRegister, { success = true, resultCode = "SUCCESS"})
self.mobileSession:ExpectNotification("OnHMIStatus",
{ systemContext = "MAIN", hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE"})
end
--===================================================================================--
--language struct has values for vrSynonyms, ttsName for registered app
function Test:JSONWithVrSynonymsttsNameForRegisteredApp()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true,
ttsName = {
{
type = "TEXT",
text = "Test Application chunk 1"
},
{
type = "TEXT",
text = "Test Application chunk 2"
}
},
vrSynonyms = {"Test Application vrSynonym"}
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithVrSynonymsttsNameForRegisteredApp.json", "SUCCESS", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "vrSynonyms", "ttsName" param for current HMI language and send via UpdateAppList
--===================================================================================--
local LanguagesValue = {"ES-MX", "FR-CA", "DE-DE", "ES-ES", "EN-GB", "RU-RU", "TR-TR", "PL-PL", "FR-FR", "IT-IT", "SV-SE", "PT-PT", "NL-NL", "EN-AU", "ZH-CN", "ZH-TW", "JA-JP", "AR-SA", "KO-KR", "PT-BR", "CS-CZ", "DA-DK", "NO-NO", "NL-BE", "EL-GR", "HU-HU", "FI-FI", "SK-SK", "EN-US",}
local vrSynonymsttsNamesValuesRapApp =
{
EN_US = {
ttsName = "Rap music App tts name US",
vrSynonyms = {
"Rap music App 1 US",
"Rap music App 2 US"
}
},
ES_MX = {
ttsName = "La música rap App",
vrSynonyms = {
"La música rap App 1",
"La música rap App 2"
}
},
FR_CA = {
ttsName = "Application de musique de coup sec",
vrSynonyms = {
"Application de musique de coup sec 1",
"Application de musique de coup sec 2"
}
},
DE_DE = {
ttsName = "Rap-Musik App",
vrSynonyms = {
"Rap-Musik App 1",
"Rap-Musik App 2"
}
},
ES_ES = {
ttsName = "La música rap App",
vrSynonyms = {
"La música rap App 1",
"La música rap App 2"
}
},
EN_GB = {
ttsName = "Rap music App tts name GB",
vrSynonyms = {
"Rap music App 1 GB",
"Rap music App 2 GB"
}
},
RU_RU = {
ttsName = "Музыкальное приложение",
vrSynonyms = {
"Приложение 1",
"Приложение 2"
}
},
TR_TR = {
ttsName = "Rap müzik App",
vrSynonyms = {
"Rap müzik App 1",
"Rap müzik App 2"
}
},
PL_PL = {
ttsName = "Muzyki rap aplikacji",
vrSynonyms = {
"Muzyki rap aplikacji 1",
"Muzyki rap aplikacji 2"
}
},
FR_FR = {
ttsName = "Musique rap application de",
vrSynonyms = {
"Musique rap application de 1",
"Musique rap application de 2"
}
},
IT_IT = {
ttsName = "Musica di colpo secco applicazione",
vrSynonyms = {
"Musica di colpo secco applicazione 1",
"Musica di colpo secco applicazione 2"
}
},
SV_SE = {
ttsName = "Rappar musik appen",
vrSynonyms = {
"Rappar musik appen 1",
"Rappar musik appen 2"
}
},
PT_PT = {
ttsName = "Música Rap App PT",
vrSynonyms = {
"Música Rap App 1 PT",
"Música Rap App 2 PT"
}
},
NL_NL = {
ttsName = "Rapmuziek Applicatiegebruikers NL",
vrSynonyms = {
"Rapmuziek Applicatiegebruikers 1 NL",
"Rapmuziek Applicatiegebruikers 2 NL"
}
},
EN_AU = {
ttsName = "Rap music App tts name AU",
vrSynonyms = {
"Rap music App 1 AU",
"Rap music App 2 AU"
}
},
ZH_CN = {
ttsName = "說唱音樂應用程序",
vrSynonyms = {
"說唱音樂應用程序 1",
"說唱音樂應用程序 2"
}
},
ZH_TW = {
ttsName = "说唱音乐应用程序",
vrSynonyms = {
"说唱音乐应用程序 1",
"说唱音乐应用程序 2"
}
},
JA_JP = {
ttsName = "ラップミュージックアプリ",
vrSynonyms = {
"ラップミュージックアプリ 1",
"ラップミュージックアプリ 2"
}
},
AR_SA = {
ttsName = "موسيقى الراب التطبيق",
vrSynonyms = {
"موسيقى الراب التطبيق 1",
"موسيقى الراب التطبيق 2"
}
},
KO_KR = {
ttsName = "랩 음악 앱",
vrSynonyms = {
"랩 음악 앱 1",
"랩 음악 앱 2"
}
},
PT_BR = {
ttsName = "Música Rap App BR",
vrSynonyms = {
"Música Rap App 1 BR",
"Música Rap App 2 BR"
}
},
CS_CZ = {
ttsName = "Rapové hudby aplikace",
vrSynonyms = {
"Rapové hudby aplikace 1",
"Rapové hudby aplikace 2"
}
},
DA_DK = {
ttsName = "Rap-musik App",
vrSynonyms = {
"Rap-musik App 1",
"Rap-musik App 2"
}
},
NO_NO = {
ttsName = "Rap musikk App",
vrSynonyms = {
"Rap musikk App 1",
"Rap musikk App 2"
}
},
NL_BE = {
ttsName = "Rapmuziek Applicatiegebruikers BE",
vrSynonyms = {
"Rapmuziek Applicatiegebruikers 1 BE",
"Rapmuziek Applicatiegebruikers 2 BE"
}
},
EL_GR = {
ttsName = "Κτυπήματος μουσικής εφαρμογή",
vrSynonyms = {
"Κτυπήματος μουσικής 1",
"Κτυπήματος μουσικής 2"
}
},
HU_HU = {
ttsName = "Rap zenét App",
vrSynonyms = {
"Rap zenét App 1",
"Rap zenét App 2"
}
},
FI_FI = {
ttsName = "Rap-musiikkia sovellus",
vrSynonyms = {
"Rap-musiikkia sovellus 1",
"Rap-musiikkia sovellus 2"
}
},
SK_SK = {
ttsName = "Rap music aplikácia",
vrSynonyms = {
"Rap music aplikácia 1",
"Rap music aplikácia 2"
}
}
}
local vrSynonymsttsNamesValuesRockApp =
{
EN_US = {
ttsName = "Rock music App tts name US",
vrSynonyms = {
"Rock music App 1 US",
"Rock music App 2 US"
}
},
ES_MX = {
ttsName = "La música Rock App",
vrSynonyms = {
"La música Rock App 1",
"La música Rock App 2"
}
},
FR_CA = {
ttsName = "La musique rock application de",
vrSynonyms = {
"La musique rock application de 1",
"La musique rock application de 2"
}
},
DE_DE = {
ttsName = "Rock-Musik App",
vrSynonyms = {
"Rock-Musik App 1",
"Rock-Musik App 2"
}
},
ES_ES = {
ttsName = "La música Rock App",
vrSynonyms = {
"La música Rock App 1",
"La música Rock App 2"
}
},
EN_GB = {
ttsName = "Rock music App tts name GB",
vrSynonyms = {
"Rock music App 1 GB",
"Rock music App 2 GB"
}
},
RU_RU = {
ttsName = "Музыкальное рок приложение",
vrSynonyms = {
"Рок приложение 1",
"Рок приложение 2"
}
},
TR_TR = {
ttsName = "Rock müzik App",
vrSynonyms = {
"Rock müzik App 1",
"Rock müzik App 2"
}
},
PL_PL = {
ttsName = "Muzyki Rock aplikacji",
vrSynonyms = {
"Muzyki Rock aplikacji 1",
"Muzyki Rock aplikacji 2"
}
},
FR_FR = {
ttsName = "Musique Rock application de",
vrSynonyms = {
"Musique Rock application de 1",
"Musique Rock application de 2"
}
},
IT_IT = {
ttsName = "La musica rock applicazione",
vrSynonyms = {
"La musica rock applicazione 1",
"La musica rock applicazione 2"
}
},
SV_SE = {
ttsName = "Rockar musik appen",
vrSynonyms = {
"Rockar musik appen 1",
"Rockar musik appen 2"
}
},
PT_PT = {
ttsName = "Música Rock App PT",
vrSynonyms = {
"Música Rock App 1 PT",
"Música Rock App 2 PT"
}
},
NL_NL = {
ttsName = "Rockmuziek Applicatiegebruikers NL",
vrSynonyms = {
"Rockmuziek Applicatiegebruikers 1 NL",
"Rockmuziek Applicatiegebruikers 2 NL"
}
},
EN_AU = {
ttsName = "Rock music App tts name AU",
vrSynonyms = {
"Rock music App 1 AU",
"Rock music App 2 AU"
}
},
ZH_CN = {
ttsName = "搖滾音樂應用",
vrSynonyms = {
"搖滾音樂應用 1",
"搖滾音樂應用 2"
}
},
ZH_TW = {
ttsName = "摇滚音乐应用",
vrSynonyms = {
"摇滚音乐应用 1",
"摇滚音乐应用 2"
}
},
JA_JP = {
ttsName = "ロックミュージックアプリ",
vrSynonyms = {
"ロックミュージックアプリ 1",
"ロックミュージックアプリ 2"
}
},
AR_SA = {
ttsName = "موسيقى الروك التطبيق",
vrSynonyms = {
"موسيقى الروك التطبيق 1",
"موسيقى الروك التطبيق 2"
}
},
KO_KR = {
ttsName = "록 음악 앱",
vrSynonyms = {
"록 음악 앱 1",
"록 음악 앱 2"
}
},
PT_BR = {
ttsName = "Música Rock App BR",
vrSynonyms = {
"Música Rock App 1 BR",
"Música Rock App 2 BR"
}
},
CS_CZ = {
ttsName = "Rockové hudby aplikace",
vrSynonyms = {
"Rockové hudby aplikace 1",
"Rockové hudby aplikace 2"
}
},
DA_DK = {
ttsName = "Rock-musik App",
vrSynonyms = {
"Rock-musik App 1",
"Rock-musik App 2"
}
},
NO_NO = {
ttsName = "Rock musikk App",
vrSynonyms = {
"Rock musikk App 1",
"Rock musikk App 2"
}
},
NL_BE = {
ttsName = "Rockmuziek Applicatiegebruikers BE",
vrSynonyms = {
"Rockmuziek Applicatiegebruikers 1 BE",
"Rockmuziek Applicatiegebruikers 2 BE"
}
},
EL_GR = {
ttsName = "Βράχο μουσική εφαρμογή",
vrSynonyms = {
"Βράχο μουσική 1",
"Βράχο μουσική 2"
}
},
HU_HU = {
ttsName = "Rock zenét App",
vrSynonyms = {
"Rock zenét App 1",
"Rock zenét App 2"
}
},
FI_FI = {
ttsName = "Rock-musiikkia sovellus",
vrSynonyms = {
"Rock-musiikkia sovellus 1",
"Rock-musiikkia sovellus 2"
}
},
SK_SK = {
ttsName = "Rock music aplikácia",
vrSynonyms = {
"Rock music aplikácia 1",
"Rock music aplikácia 2"
}
}
}
for i=1, #LanguagesValue do
--Precondition: Change TTS, VR language
Test["ChangeVRTTSLanguageOnHMI_" .. tostring(LanguagesValue[i])] = function(self)
self.hmiConnection:SendNotification("TTS.OnLanguageChange",{language = LanguagesValue[i]})
self.hmiConnection:SendNotification("VR.OnLanguageChange",{language = LanguagesValue[i]})
EXPECT_NOTIFICATION("OnLanguageChange", {language = LanguagesValue[i], hmiDisplayLanguage = "EN-US"})
if
LanguagesValue[i] == "EN-US" then
local CorIdUnregisterAppInterface = self.mobileSession:SendRPC("UnregisterAppInterface",{})
--response on mobile side
EXPECT_RESPONSE(CorIdUnregisterAppInterface, { success = true, resultCode = "SUCCESS"})
else
EXPECT_NOTIFICATION("OnAppInterfaceUnregistered", {reason = "LANGUAGE_CHANGE"})
end
EXPECT_HMINOTIFICATION("BasicCommunication.OnAppUnregistered", {unexpectedDisconnect = false})
EXPECT_HMICALL("BasicCommunication.UpdateAppList")
:Do(function(_,data)
self.hmiConnection:SendResponse(data.id, data.method, "SUCCESS", { })
end)
-- DelayedExp(2000)
end
--===================================================================================--
--Precondition: Registration of application
Test["Precondition_AppRegistration_ttNameVrSynonymsForCurrentHMILanguage" .. tostring(LanguagesValue[i])] = function(self)
local CorIdRegister = self.mobileSession:SendRPC("RegisterAppInterface",
{
syncMsgVersion =
{
majorVersion = 4,
minorVersion = 2
},
appName = config.application1.registerAppInterfaceParams.appName,
isMediaApplication = true,
languageDesired = 'EN-US',
hmiDisplayLanguageDesired = 'EN-US',
appHMIType = config.application1.registerAppInterfaceParams.appHMIType,
appID = "8675308",
deviceInfo =
{
os = "Android",
carrier = "Megafon",
firmwareRev = "Name: Linux, Version: 3.4.0-perf",
osVersion = "4.4.2",
maxNumberRFCOMMPorts = 1
}
})
EXPECT_HMINOTIFICATION("BasicCommunication.OnAppRegistered",
{
application =
{
appName = config.application1.registerAppInterfaceParams.appName
}
})
:Do(function(_,data)
self.applications[config.application1.registerAppInterfaceParams.appName] = data.params.application.appID
self.appID = data.params.application.appID
end)
local resultCodeValue
if
LanguagesValue[i] == "EN-US" then
resultCodeValue = "SUCCESS"
else
resultCodeValue = "WRONG_LANGUAGE"
end
self.mobileSession:ExpectResponse(CorIdRegister, { success = true, resultCode = resultCodeValue})
self.mobileSession:ExpectNotification("OnHMIStatus",
{ systemContext = "MAIN", hmiLevel = "NONE", audioStreamingState = "NOT_AUDIBLE"})
end
Test["TtNameVrSynonymsForCurrentHMILanguage_" .. tostring(LanguagesValue[i])] = function(self)
local LangValue = string.gsub (LanguagesValue[i], "-", "_")
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
},
{
appName = "Rap music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = vrSynonymsttsNamesValuesRapApp[LangValue].ttsName
}
},
vrSynonyms = vrSynonymsttsNamesValuesRapApp[LangValue].vrSynonyms
},
{
appName = "Rock music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = vrSynonymsttsNamesValuesRockApp[LangValue].ttsName
}
},
vrSynonyms = vrSynonymsttsNamesValuesRockApp[LangValue].vrSynonyms
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithdifferentLanguagesForApp.json", "SUCCESS", UpdateAppListParameters)
end
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "tts" and "vrSynonym" have lower bound values
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithVrSynonymsttsNameLowerBound()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithVrSynonymsttsNameLowerBound()
RegistrationApp(self)
end
--===================================================================================--
--language struct has lower bound values for vrSynonyms, ttsName
function Test:JSONWithVrSynonymsttsNameLowerBound()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
},
{
appName = "Rap music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "1"
}
},
vrSynonyms = {"A"}
},
{
appName = "Rock music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "B"
}
},
vrSynonyms = {"2"}
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithLanguageDefaultVrTtsLowerBound.json", "SUCCESS", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "tts" and "vrSynonym" have upper bound values
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithVrSynonymsttsNameUpperBound()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithVrSynonymsttsNameUpperBound()
RegistrationApp(self)
end
--===================================================================================--
--language struct has upper values for vrSynonyms, ttsName
function Test:JSONWithVrSynonymsttsNameUpperBound()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
},
{
appName = "Rap music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "\\bnn\\fddhjhr567890fghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^*()-_+|~{}[]:,01234567890asdfg01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^*()-_+|~{}[]:,01234567890asdfg01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^*()-_+|~{}[]:,01234567890asdfg01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^*()-_+|~{}[]:,01234567890asdfg01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^*()-_+|~{}[]:,01234567890asdfg0_1"
}
},
vrSynonyms = {
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_1_1",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_1_2",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_1_3",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_1_4",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_1_5",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_1_6",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_1_7",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_1_8",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_1_9",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_10",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_11",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_12",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_13",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_14",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_15",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_16",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_17",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_18",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_19",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_20",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_21",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_22",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_23",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_24",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_25",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_26",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_27",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_28",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_29",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_30",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_31",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_32",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_33",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_34",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_35",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_36",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_37",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_38",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_39",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_40",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_41",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_42",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_43",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_44",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_45",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_46",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_47",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_48",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_49",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_50",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_51",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_52",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_53",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_54",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_55",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_56",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_57",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_58",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_59",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_60",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_61",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_62",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_63",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_64",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_65",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_66",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_67",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_68",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_69",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_70",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_71",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_72",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_73",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_74",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_75",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_76",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_77",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_78",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_79",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_80",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_81",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_82",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_83",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_84",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_85",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_86",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_87",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_88",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_89",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_90",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_91",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_92",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_93",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_94",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_95",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_96",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_97",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_98",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_1_99",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^()_1_100"
}
},
{
appName = "Rock music App",
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
greyOut = false,
ttsName = {
{
type = "TEXT",
text = "\\bnn\\fddhjhr567890fghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^*()-_+|~{}[]:,01234567890asdfg01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^*()-_+|~{}[]:,01234567890asdfg01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^*()-_+|~{}[]:,01234567890asdfg01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^*()-_+|~{}[]:,01234567890asdfg01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^*()-_+|~{}[]:,01234567890asdfg0_2"
}
},
vrSynonyms = {
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_2_1",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_2_2",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_2_3",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_2_4",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_2_5",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_2_6",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_2_7",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_2_8",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&*()_2_9",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_10",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_11",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_12",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_13",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_14",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_15",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_16",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_17",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_18",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_19",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_20",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_21",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_22",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_23",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_24",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_25",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_26",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_27",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_28",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_29",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_30",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_31",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_32",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_33",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_34",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_35",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_36",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_37",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_38",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_39",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_40",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_41",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_42",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_43",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_44",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_45",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_46",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_47",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_48",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_49",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_50",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_51",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_52",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_53",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_54",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_55",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_56",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_57",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_58",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_59",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_60",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_61",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_62",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_63",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_64",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_65",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_66",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_67",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_68",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_69",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_70",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_71",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_72",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_73",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_74",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_75",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_76",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_77",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_78",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_79",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_80",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_81",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_82",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_83",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_84",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_85",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_86",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_87",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_88",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_89",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_90",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_91",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_92",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_93",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_94",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_95",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_96",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_97",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_98",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^&()_2_99",
"QWERTYUIOPASDFGhjklzxcvbnm!?#$%^()_2_100"
}
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithLanguageDefaultVrTtsUpperBound.json", "SUCCESS", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "vrSynonym" have out upper bound element count
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithVrSynonymsOutUpperBoundCount()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithVrSynonymsOutUpperBoundCount()
RegistrationApp(self)
end
--===================================================================================--
--language struct has out upper bound elemet count for vrSynonyms
function Test:JSONWithVrSynonymsOutUpperBoundCount()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithLanguageDefaultVrOutUpperBoundCount.json", "INVALID_DATA", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "vrSynonym" have out lower bound element count
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithVrSynonymsOutLowerBoundCount()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithVrSynonymsOutLowerBoundCount()
RegistrationApp(self)
end
--===================================================================================--
--language struct has out lower bound elemet count for vrSynonyms
function Test:JSONWithVrSynonymsOutUpperBoundCount()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithLanguageDefaultVrOutLowerBoundCount.json", "INVALID_DATA", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "vrSynonym" have out lower bound value
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithVrSynonymsOutLowerBound()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithVrSynonymsOutLowerBound()
RegistrationApp(self)
end
--===================================================================================--
--language struct has out lower bound value for vrSynonyms
function Test:JSONWithVrSynonymsOutLowerBound()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithLanguageDefaultVrOutLowerBound.json", "INVALID_DATA", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "vrSynonym" have out upper bound value
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithVrSynonymsOutUpperBound()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithVrSynonymsOutUpperBound()
RegistrationApp(self)
end
--===================================================================================--
--language struct has out upper bound value for vrSynonyms
function Test:JSONWithVrSynonymsOutUpperBound()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithLanguageDefaultVrOutUpperBound.json", "INVALID_DATA", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "ttsName" have out lower bound value
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithTtsNameOutLowerBound()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithTtsNameOutLowerBound()
RegistrationApp(self)
end
--===================================================================================--
--language struct has out lower bound value for vrSynonyms
function Test:JSONWithTtsNameOutLowerBound()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithLanguageDefaultTtsOutLowerBound.json", "INVALID_DATA", UpdateAppListParameters)
end
--===================================================================================--
-- Check that SDL write a values from language struct to the "tts" and "vrSynonym" params and send them via UpdateAppList to HMI in case "ttsName" have out upper bound value
--===================================================================================--
--Precondition: unregistration of app
function Test:Precondition_UnregisterAppInterface_JSONWithTtsNameOutUpperBound()
UnregisterApp(self)
end
--===================================================================================--
--Precondition: Registration of application
function Test:Precondition_AppRegistration_JSONWithTtsNameOutUpperBound()
RegistrationApp(self)
end
--===================================================================================--
--language struct has out upper bound value for vrSynonyms
function Test:JSONWithTtsNameOutUpperBound()
local UpdateAppListParameters =
{
applications = {
{
appName = config.application1.registerAppInterfaceParams.appName,
appType = config.application1.registerAppInterfaceParams.appHMIType,
deviceInfo = {
id = "12ca17b49af2289436f303e0166030a21e525d266e209267433801a8fd4071a0",
isSDLAllowed = true,
name = "127.0.0.1",
transportType = "WIFI"
},
hmiDisplayLanguageDesired = "EN-US",
isMediaApplication = true
}
}
}
ReceivingUpdateAppListaccordingToJsonInSystemRequest(self, "JSON_Language_parameter/JSONWithLanguageDefaultTtsOutUpperBound.json", "INVALID_DATA", UpdateAppListParameters)
end
function Test:Postcondition_removeCreatedUserConnecttest()
os.execute(" rm -f ./user_modules/connecttest_language_parameter.lua")
end |
-- -*- lua -*-
local help = [[
The Gnu Compiler Collecton
]]
local pkg = Pkg:new{Category = "System Environment/Base",
URL = "http://gcc.gnu.org",
Description = "The Gnu Compiler Collection",
display_name = "GCC",
level = 0,
help = help
}
local base = pkg:pkgBase()
local mdir = pkg:moduleDir()
whatis("Description: Gnu Compiler Collection")
prepend_path('MODULEPATH', mdir)
family("compiler")
|
local skynet = require 'skynet'
local dc = require 'skynet.datacenter'
return {
get = function(self)
local get = ngx.req.get_uri_args()
local inst = get.inst
local app = dc.get('APPS', inst)
if app.islocal then
lwf.json(self, {version=app.version})
return
end
assert(app and app.name)
local data = skynet.call(".upgrader", "lua", "latest_version", app.name, false)
assert(data)
lwf.json(self, {version=data.version, beta=data.beta})
end,
}
|
local class = require 'nelua.utils.class'
local Emitter = require 'nelua.emitter'
local traits = require 'nelua.utils.traits'
local typedefs = require 'nelua.typedefs'
local errorer = require 'nelua.utils.errorer'
local pegger = require 'nelua.utils.pegger'
local bn = require 'nelua.utils.bn'
local CEmitter = class(Emitter)
local primtypes = typedefs.primtypes
function CEmitter:_init(context, depth)
Emitter._init(self, context, depth)
end
function CEmitter:add_one(what)
if traits.is_type(what) then
self:add_ctype(what)
else
Emitter.add_one(self, what)
end
end
----------------------------------------
-- Return string functions
function CEmitter:zeroinit(type)
local s
if type.is_float32 and not self.context.pragmas.nofloatsuffix then
s = '0.0f'
elseif type.is_float then
s = '0.0'
elseif type.is_unsigned then
s = '0U'
elseif type.is_arithmetic then
s = '0'
elseif type.is_comptime or type.is_niltype then
self.context:ensure_runtime_builtin('NLNIL')
s = 'NLNIL'
elseif type.is_pointer or type.is_procedure then
s = 'NULL'
elseif type.is_boolean then
s = 'false'
elseif type.size > 0 then
s = '{0}'
else
s = '{}'
end
return s
end
-------------------------------------
-- add functions
function CEmitter:add_zeroinit(type)
self:add(self:zeroinit(type))
end
function CEmitter:add_ctyped_zerotype(type)
if not (type.is_boolean or type.is_arithmetic or type.is_pointer) then
self:add_ctypecast(type)
end
self:add(self:zeroinit(type))
end
function CEmitter:add_ctype(type)
self:add(self.context:ctype(type))
end
function CEmitter:add_ctypecast(type)
self:add('(')
self:add_ctype(type)
self:add(')')
end
function CEmitter:add_booleanlit(value)
assert(type(value) == 'boolean')
self:add(value and 'true' or 'false')
end
function CEmitter:add_null()
self:add('NULL')
end
function CEmitter:add_val2any(val, valtype)
valtype = valtype or val.attr.type
assert(not valtype.is_any)
self:add('((', primtypes.any, ')')
if valtype.is_niltype then
self:add('{0})')
else
local runctype = self.context:runctype(valtype)
local typename = self.context:typename(valtype)
self:add('{&', runctype, ', {._', typename, ' = ', val, '}})')
end
end
function CEmitter:add_val2boolean(val, valtype)
valtype = valtype or val.attr.type
if valtype.is_boolean then
self:add(val)
elseif valtype.is_any then
self:add_builtin('nlany_to_', typedefs.primtypes.boolean)
self:add('(', val, ')')
elseif valtype.is_niltype or valtype.is_nilptr then
if traits.is_astnode(val) and (val.tag == 'Nil' or val.tag == 'Id') then
self:add('false')
else -- could be a call
self:add('({(void)(', val, '); false;})')
end
elseif valtype.is_pointer or valtype.is_function then
self:add('(', val, ' != NULL)')
else
if traits.is_astnode(val) and (val.tag == 'Nil' or val.tag == 'Id') then
self:add('true')
else -- could be a call
self:add('({(void)(', val, '); true;})')
end
end
end
function CEmitter:add_any2type(type, anyval)
self.context:ctype(primtypes.any) -- ensure any type
self:add_builtin('nlany_to_', type)
self:add('(', anyval, ')')
end
function CEmitter:add_stringview2cstring(val)
self:add('((char*)(', val, '.data', '))')
end
function CEmitter:add_cstring2stringview(val)
self:add_builtin('nelua_cstring2stringview')
self:add('(', val, ')')
end
function CEmitter:add_val2type(type, val, valtype, checkcast)
if type.is_comptime then
self:add_builtin('NLNIL')
return
end
if traits.is_astnode(val) then
if not valtype then
valtype = val.attr.type
end
checkcast = val.checkcast
end
if val then
assert(valtype)
if type == valtype then
self:add(val)
elseif valtype.is_arithmetic and type.is_arithmetic and
(type.is_float or valtype.is_integral) and
traits.is_astnode(val) and val.attr.comptime then
self:add_numeric_literal(val.attr, type)
elseif valtype.is_nilptr and type.is_pointer then
self:add(val)
elseif type.is_any then
self:add_val2any(val, valtype)
elseif type.is_boolean then
self:add_val2boolean(val, valtype)
elseif valtype.is_any then
self:add_any2type(type, val)
elseif valtype.is_stringview and (type.is_cstring or type:is_pointer_of(primtypes.byte)) then
self:add_stringview2cstring(val)
elseif type.is_stringview and valtype.is_cstring then
self:add_cstring2stringview(val)
elseif type.is_pointer and traits.is_astnode(val) and val.attr.autoref then
-- automatic reference
self:add('&', val)
elseif valtype.is_pointer and valtype.subtype == type and
(type.is_record or type.is_array) then
-- automatic dereference
self:add('*')
if checkcast then
self:add_builtin('nelua_assert_deref_', valtype)
self:add('(', val, ')')
else
self:add(val)
end
else
if checkcast and type.is_integral and valtype.is_arithmetic and
not type:is_type_inrange(valtype) then
self:add_builtin('nelua_narrow_cast_', type, valtype)
self:add('(', val, ')')
else
local innertype = type.is_pointer and type.subtype or type
local surround = innertype.is_composite or innertype.is_array
if surround then self:add('(') end
self:add_ctypecast(type)
self:add(val)
if surround then self:add(')') end
end
end
else
self:add_zeroinit(type)
end
end
function CEmitter:add_nil_literal()
self:add_builtin('NLNIL')
end
function CEmitter:add_numeric_literal(valattr, valtype)
assert(bn.isnumeric(valattr.value))
valtype = valtype or valattr.type
local val, base = valattr.value, valattr.base
if valtype.is_integral then
if bn.isneg(val) and valtype.is_unsigned then
val = valtype:wrap_value(val)
elseif not valtype:is_inrange(val) then
val = valtype:wrap_value(val)
end
end
local minusone = false
if valtype.is_float then
if bn.isnan(val) then
if valtype.is_float32 then
self:add('(0.0f/0.0f)')
else
self:add('(0.0/0.0)')
end
return
elseif bn.isinfinite(val) then
self.context:add_include('<math.h>')
if val < 0 then
self:add('-')
end
if valtype.is_float32 then
self:add('HUGE_VALF')
else
self:add('HUGE_VAL')
end
return
else
local valstr = bn.todecsci(val, valtype.maxdigits)
self:add(valstr)
-- make sure it has decimals
if valstr:match('^-?[0-9]+$') then
self:add('.0')
end
end
else
if valtype.is_integral and valtype.is_signed and val == valtype.min then
-- workaround C warning `integer constant is so large that it is unsigned`
minusone = true
val = val + 1
end
if not base or base == 'dec' or val:isneg() then
self:add(bn.todec(val))
else
self:add('0x', bn.tohex(val))
end
end
-- suffixes
if valtype.is_float32 and not valattr.nofloatsuffix then
self:add('f')
elseif valtype.is_unsigned then
self:add('U')
end
if minusone then
self:add('-1')
end
end
function CEmitter:add_string_literal(val, ascstring)
local size = #val
local varname = self.context.stringliterals[val]
if varname then
if ascstring then
self:add(varname)
else
if not self.context.state.ininitializer then
self:add('(')
self:add_ctypecast(primtypes.stringview)
end
self:add('{(uint8_t*)', varname, ', ', size, '}')
if not self.context.state.ininitializer then
self:add(')')
end
end
return
end
varname = self.context:genuniquename('strlit')
self.context.stringliterals[val] = varname
local decemitter = CEmitter(self.context)
local quoted_value = pegger.double_quote_c_string(val)
decemitter:add_indent_ln('static char ', varname, '[', size+1, '] = ', quoted_value, ';')
self.context:add_declaration(decemitter:generate(), varname)
if ascstring then
self:add(varname)
else
if not self.context.state.ininitializer then
self:add('(')
self:add_ctypecast(primtypes.stringview)
end
self:add('{(uint8_t*)', varname, ', ', size, '}')
if not self.context.state.ininitializer then
self:add(')')
end
end
end
function CEmitter:add_literal(valattr)
local valtype = valattr.type
if valtype.is_boolean then
self:add_booleanlit(valattr.value)
elseif valtype.is_arithmetic then
self:add_numeric_literal(valattr)
elseif valtype.is_stringview then
self:add_string_literal(valattr.value, valattr.is_cstring)
--elseif valtype.is_record then
--self:add(valattr)
else --luacov:disable
errorer.errorf('not implemented: `CEmitter:add_literal` for valtype `%s`', valtype)
end --luacov:enable
end
return CEmitter
|
local log = require "log"
local class = require "class"
local co = require "internal.Co"
local wbproto = require "protocol.websocket.protocol"
local _recv_frame = wbproto.recv_frame
local _send_frame = wbproto.send_frame
local co_self = co.self
local co_wait = co.wait
local co_spwan = co.spwan
local co_wakeup = co.wakeup
local type = type
local assert = assert
local setmetatable = setmetatable
local tostring = tostring
local next = next
local pcall = pcall
local ipairs = ipairs
local websocket = class("websocket-server")
function websocket:ctor(opt)
local c = opt.cls
self.on_open = assert(type(c.on_open) == 'function' and c.on_open, "Can't find websocket on_open method")
self.on_message = assert(type(c.on_message) == 'function' and c.on_message, "Can't find websocket on_message method")
self.on_error = assert(type(c.on_error) == 'function' and c.on_error, "Can't find websocket on_error method")
self.on_close = assert(type(c.on_close) == 'function' and c.on_close, "Can't find websocket on_close method")
self.on_ping = c.on_ping
self.on_pong = c.on_pong
self.sock = opt.sock
self.cls = c
self.sock._timeout = nil
self.send_masked = self.cls.sen_masked or false
self.max_payload_len = self.cls.max_payload_len or 65535
end
function websocket:start()
local on_open = self.on_open
local on_message = self.on_message
local on_error = self.on_error
local on_close = self.on_close
local on_ping = self.on_ping
local on_pong = self.on_pong
local sock = self.sock
local write_co
local cls = self.cls
local current_co = co_self()
local send_masked = cls.sen_masked
local max_payload_len = cls.max_payload_len or 65535
local write_list = {}
co_spwan(function (...)
local sock = sock
write_co = co_self()
while 1 do
for index, f in ipairs(write_list) do
local ok, err = pcall(f)
if not ok then
log.error(err)
end
end
write_list = {}
co_wait()
if #write_list == 0 then
write_co = nil
write_list = nil
return
end
end
end)
local ws = setmetatable({}, { __name = "WebSocket", __index = function (t, key)
return function(data, binary)
if not t.CLOSE == true then return end -- 如果已经发送了close则不允许再发送任何协议
if key == 'ping' then
write_list[#write_list + 1] = function() _send_frame(sock, true, 0x9, data, max_payload_len, send_masked) end
elseif key == "pong" then
write_list[#write_list + 1] = function() _send_frame(sock, true, 0xa, data, max_payload_len, send_masked) end
elseif key == 'send' then
if data and type(data) == 'string' then
local code = 0x1
if binary then
code = 0x2
end
write_list[#write_list + 1] = function () _send_frame(sock, true, code, data, max_payload_len, send_masked) end
end
elseif key == "close" then
t.CLOSE = true
write_list[#write_list + 1] = function() _send_frame(sock, true, 0x8, char(((1000 >> 8) & 0xff), (1000 & 0xff))..(data or ""), max_payload_len, send_masked) end
write_list[#write_list + 1] = function() sock:close() end
write_list[#write_list + 1] = function() co_wakeup(current_co) end
end
return co_wakeup(write_co)
end
end})
local ok, err = pcall(on_open, cls, ws)
if not ok then
log.error(err)
return sock:close()
end
while 1 do
local data, typ, err =_recv_frame(sock, max_payload_len, true)
if (not data and not typ) or typ == 'close' then
if ws.CLOSE ~= true then
ws.CLOSE = true
sock:close()
end
if err then
local ok, err = pcall(on_error, cls, ws, err)
if not ok then
log.error(err)
end
end
local ok, err = pcall(on_close, cls, ws, data)
if not ok then
log.error(err)
end
return co_wakeup(write_co)
end
if typ == 'ping' then
if not on_ping then
write_list[#write_list + 1] = {f = ws.pong(data)}
else
co_spwan(on_ping, cls, ws, data, typ == 'binary')
end
elseif typ == 'pong' then
if on_open then
co_spwan(on_pong, cls, ws, data, typ == 'binary')
end
elseif typ == 'text' or typ == 'binary' then
co_spwan(on_message, cls, ws, data, typ == 'binary')
else -- 其他情况与不支持的协议什么都不做.
end
end
end
return websocket |
local Behaviors = {}
Behaviors.Follow = require('pda/behavior/follow')
Behaviors.Alert = require('pda/behavior/alert')
Behaviors.Separation = require('pda/behavior/separation')
Behaviors.PathFollowing = require('pda/behavior/path_following')
return Behaviors
|
C_TaxiMap = {}
---Returns information on taxi nodes at the current flight master.
---[Documentation](https://wowpedia.fandom.com/wiki/API_C_TaxiMap.GetAllTaxiNodes)
---@param uiMapID number
---@return TaxiNodeInfo[] taxiNodes
function C_TaxiMap.GetAllTaxiNodes(uiMapID) end
---Returns information on taxi nodes for a given map, without considering the current flight master.
---[Documentation](https://wowpedia.fandom.com/wiki/API_C_TaxiMap.GetTaxiNodesForMap)
---@param uiMapID number
---@return MapTaxiNodeInfo[] mapTaxiNodes
function C_TaxiMap.GetTaxiNodesForMap(uiMapID) end
---[Documentation](https://wowpedia.fandom.com/wiki/API_C_TaxiMap.ShouldMapShowTaxiNodes)
---@param uiMapID number
---@return boolean shouldShowNodes
function C_TaxiMap.ShouldMapShowTaxiNodes(uiMapID) end
---@class MapTaxiNodeInfo
---@field nodeID number
---@field position Vector2DMixin
---@field name string
---@field atlasName string
---@field faction FlightPathFaction
---@field textureKit string
---@class TaxiNodeInfo
---@field nodeID number
---@field position Vector2DMixin
---@field name string
---@field state FlightPathState
---@field slotIndex number
---@field textureKit string
|
----------------------------------------------------------------------------------------------
-- Client Lua Script for ForgeUI
--
-- name: hui.lua
-- author: Winty Badass@Jabbit
-- about: ForgeUI GUI library
-----------------------------------------------------------------------------------------------
require "Window"
local F = _G["ForgeLibs"]["ForgeUI"] -- ForgeUI API
local ForgeColor
-----------------------------------------------------------------------------------------------
-- ForgeUI Library Definition
-----------------------------------------------------------------------------------------------
local Gui = {
_NAME = "gui",
_API_VERSION = 3,
_VERSION = "1.0",
}
-----------------------------------------------------------------------------------------------
-- ForgeUI Library Initialization
-----------------------------------------------------------------------------------------------
local strPrefix
local xmlDoc = nil
local new = function(self, o)
o = o or {}
setmetatable(o, self)
self.__index = self
o.tDefaults = {
strFont = "Nameplates",
}
return o
end
function Gui:ForgeAPI_Init()
ForgeColor = F:API_GetModule("forgecolor")
strPrefix = Apollo.GetAssetFolder()
local tToc = XmlDoc.CreateFromFile("toc.xml"):ToTable()
for k,v in ipairs(tToc) do
local strPath = string.match(v.Name, "(.*)[\\/]Interface")
if strPath ~= nil and strPath ~= "" then
strPrefix = strPrefix .. "\\" .. strPath .. "\\"
break
end
end
xmlDoc = XmlDoc.CreateFromFile(strPrefix .. "\\interface\\gui.xml")
end
-----------------------------------------------------------------------------------------------
-- ForgeUI GUI elements
-----------------------------------------------------------------------------------------------
local EnumWindowType = {
["Holder"] = 1,
["Text"] = 2,
["ColorBox"] = 3,
["CheckBox"] = 4,
["ComboBox"] = 5,
["ComboBoxItem"] = 6,
["EditBox"] = 7,
["NumberBox"] = 6,
["Button"] = 9,
}
-----------------------------------------------------------------------------------------------
-- Holder
-----------------------------------------------------------------------------------------------
function Gui:API_AddHolder(tModule, wnd, tOptions)
local wndText = Apollo.LoadForm(xmlDoc, "ForgeUI_Holder", wnd, self)
return wndText
end
-----------------------------------------------------------------------------------------------
-- Text
-----------------------------------------------------------------------------------------------
function Gui:API_AddText(tModule, wnd, strText, tOptions)
-- defaults
local strFont = self.tDefaults.strFont
local strText = strText
-- load wnd
local wndText = Apollo.LoadForm(xmlDoc, "ForgeUI_Text", wnd, self)
-- options
if tOptions then
if tOptions.tOffsets then
wndText:SetAnchorOffsets(unpack(tOptions.tOffsets))
end
if tOptions.tMove then
local nLeft, nTop, nRight, nBottom = wndText:GetAnchorOffsets()
nLeft = nLeft + tOptions.tMove[1]
nTop = nTop + tOptions.tMove[2]
nRight = nRight + tOptions.tMove[1]
nBottom = nBottom + tOptions.tMove[2]
wndText:SetAnchorOffsets(nLeft, nTop, nRight, nBottom)
end
if tOptions.strFont then
strFont = tOptions.strFont
end
end
-- set wnd
wndText:SetText(strText)
wndText:SetFont(strFont)
-- calculate width of element
local nTextWidth = Apollo.GetTextWidth(strFont, " " .. strText .. " ")
local nLeft, nTop, nRight, nBottom = wndText:GetAnchorOffsets()
wndText:SetAnchorOffsets(nLeft, nTop, nLeft + nTextWidth, nBottom)
return wndText
end
-----------------------------------------------------------------------------------------------
-- Button
-----------------------------------------------------------------------------------------------
function Gui:API_AddButton(tModule, wnd, strText, tOptions)
-- defaults
local tData = {
tModule = tModule,
eType = EnumWindowType.Button,
}
local strFont = self.tDefaults.strFont
-- load wnd
local wndButton = Apollo.LoadForm(xmlDoc, "ForgeUI_Button", wnd, self)
-- options
if tOptions then
if tOptions.tOffsets then
wndButton:SetAnchorOffsets(unpack(tOptions.tOffsets))
end
if tOptions.tMove then
local nLeft, nTop, nRight, nBottom = wndButton:GetAnchorOffsets()
nLeft = nLeft + tOptions.tMove[1]
nTop = nTop + tOptions.tMove[2]
nRight = nRight + tOptions.tMove[1]
nBottom = nBottom + tOptions.tMove[2]
wndButton:SetAnchorOffsets(nLeft, nTop, nRight, nBottom)
end
if tOptions.strFont then
strFont = tOptions.strFont
end
if tOptions.fnCallback then
tData.fnCallback = tOptions.fnCallback
end
end
-- set wnd
wndButton:SetText(strText)
wndButton:SetFont(strFont)
wndButton:AddEventHandler("ButtonSignal", "OnButtonSignal", self)
wndButton:SetData(tData)
return wndButton
end
function Gui:OnButtonSignal(wndControl)
local tData = wndControl:GetData()
if tData == nil then return end
if tData.fnCallback ~= nil then
tData.fnCallback(tData.tModule)
end
end
-----------------------------------------------------------------------------------------------
-- ColorBox
-----------------------------------------------------------------------------------------------
function Gui:API_AddColorBox(tModule, wnd, strText, tSettings, strKey, tOptions)
-- defaults
local tData = {
tModule = tModule,
tSettings = tSettings,
strKey = strKey,
eType = EnumWindowType.ColorBox,
}
if tSettings ~= nil then
tData.strColor = tSettings[strKey]
end
local strFont = self.tDefaults.strFont
local strText = strText
-- load wnd
local wndColorBox = Apollo.LoadForm(xmlDoc, "ForgeUI_ColorBox", wnd, self)
-- event handlers
wndColorBox:FindChild("ColorBox"):AddEventHandler("MouseButtonDown", "OnColorBoxDown", self)
-- options
if tOptions then
if tOptions.tOffsets then
wndColorBox:SetAnchorOffsets(unpack(tOptions.tOffsets))
end
if tOptions.tMove then
local nLeft, nTop, nRight, nBottom = wndColorBox:GetAnchorOffsets()
nLeft = nLeft + tOptions.tMove[1]
nTop = nTop + tOptions.tMove[2]
nRight = nRight + tOptions.tMove[1]
nBottom = nBottom + tOptions.tMove[2]
wndColorBox:SetAnchorOffsets(nLeft, nTop, nRight, nBottom)
end
if tOptions.fnCallback then
tData.fnCallback = tOptions.fnCallback
end
end
-- set wnd
wndColorBox:FindChild("Text"):SetText(strText)
wndColorBox:FindChild("Text"):SetFont(strFont)
-- data
wndColorBox:SetData(tData)
self:SetColorBox(wndColorBox, true)
return wndColorBox
end
function Gui:SetColorBox(wndControl, bChangeText)
local tData = wndControl:GetData()
wndControl:FindChild("ColorBox"):SetBGColor(tData.strColor)
if tData.tSettings and tData.strKey then
tData.tSettings[tData.strKey] = tData.strColor
end
if tData.tModule and tData.fnCallback then
tData.fnCallback(tData.tModule, tData.strColor, tData.strKey)
end
end
function Gui:OnColorBoxDown(wndHandler, wndControl, eMouseButton)
local tData = wndControl:GetParent():GetParent():GetData()
ForgeColor:API_ShowPicker(tData.tModule, tData.tSettings[tData.strKey], {
tSettings = tData.tSettings,
strKey = tData.strKey,
wndControl = wndControl,
fnCallback = tData.fnCallback,
})
end
-----------------------------------------------------------------------------------------------
-- CheckBox
-----------------------------------------------------------------------------------------------
function Gui:API_AddCheckBox(tModule, wnd, strText, tSettings, strKey, tOptions)
-- defaults
local tData = {
tModule = tModule,
tSettings = tSettings,
strKey = strKey,
eType = EnumWindowType.CheckBox,
}
if tSettings ~= nil then
tData.bCheck = tSettings[strKey]
end
local strFont = self.tDefaults.strFont
local strText = strText
-- load wnd
local wndCheckBox = Apollo.LoadForm(xmlDoc, "ForgeUI_CheckBox", wnd, self)
-- event handlers
wndCheckBox:AddEventHandler("ButtonCheck", "OnCheckBoxCheck", self)
wndCheckBox:AddEventHandler("ButtonUncheck", "OnCheckBoxCheck", self)
-- options
if tOptions then
if tOptions.tOffsets then
wndCheckBox:SetAnchorOffsets(unpack(tOptions.tOffsets))
end
if tOptions.tMove then
local nLeft, nTop, nRight, nBottom = wndCheckBox:GetAnchorOffsets()
nLeft = nLeft + tOptions.tMove[1]
nTop = nTop + tOptions.tMove[2]
nRight = nRight + tOptions.tMove[1]
nBottom = nBottom + tOptions.tMove[2]
wndCheckBox:SetAnchorOffsets(nLeft, nTop, nRight, nBottom)
end
if tOptions.nAddWidth then
local nLeft, nTop, nRight, nBottom = wndCheckBox:GetAnchorOffsets()
wndCheckBox:SetAnchorOffsets(nLeft, nTop, nRight + tOptions.nAddWidth, nBottom)
end
if tOptions.fnCallback then
tData.fnCallback = tOptions.fnCallback
end
if tOptions.strTooltip then
wndCheckBox:SetTooltip(tOptions.strTooltip)
end
end
-- data
wndCheckBox:SetData(tData)
-- set wnd
wndCheckBox:FindChild("Text"):SetFont(strFont)
wndCheckBox:FindChild("Text"):SetText(strText)
self:SetCheckBox(wndCheckBox)
return wndCheckBox
end
function Gui:SetCheckBox(wndControl)
local tData = wndControl:GetData()
wndControl:FindChild("CheckBox"):SetCheck(tData.bCheck)
if tData.tSettings and tData.strKey then
tData.tSettings[tData.strKey] = tData.bCheck
end
end
function Gui:OnCheckBoxCheck(wndHandler, wndControl, eMouseButton)
local tData = wndControl:GetParent():GetData()
tData.bCheck = wndControl:IsChecked()
self:SetCheckBox(wndControl:GetParent())
if tData.fnCallback then
tData.fnCallback(tData.tModule, tData.bCheck)
end
end
-----------------------------------------------------------------------------------------------
-- ComboBox
-----------------------------------------------------------------------------------------------
function Gui:API_AddComboBox(tModule, wnd, strText, tSettings, strKey, tOptions)
-- defaults
local tData = {
tModule = tModule,
tSettings = tSettings,
strKey = strKey,
eType = EnumWindowType.ComboBox,
}
local strFont = self.tDefaults.strFont
local strText = strText
-- load wnd
local wndComboBox = Apollo.LoadForm(xmlDoc, "ForgeUI_ComboBox", wnd, self)
-- event handlers
wndComboBox:FindChild("Button"):AddEventHandler("ButtonSignal", "OnComboBoxButton", self)
-- options
if tOptions then
if tOptions.tOffsets then
wndComboBox:SetAnchorOffsets(unpack(tOptions.tOffsets))
end
if tOptions.tWidths then
local nLeft, nTop, nRight, nBottom = wndComboBox:GetAnchorOffsets()
wndComboBox:SetAnchorOffsets(nLeft, nTop, nLeft + tOptions.tWidths[1] + tOptions.tWidths[2] + 5, nBottom)
nLeft, nTop, nRight, nBottom = wndComboBox:FindChild("ComboBox"):GetAnchorOffsets()
wndComboBox:FindChild("ComboBox"):SetAnchorOffsets(nLeft, nTop, tOptions.tWidths[1], nBottom)
nLeft, nTop, nRight, nBottom = wndComboBox:FindChild("Text"):GetAnchorOffsets()
wndComboBox:FindChild("Text"):SetAnchorOffsets(- tOptions.tWidths[2], nTop, nRight, nBottom)
end
if tOptions.tMove then
local nLeft, nTop, nRight, nBottom = wndComboBox:GetAnchorOffsets()
nLeft = nLeft + tOptions.tMove[1]
nTop = nTop + tOptions.tMove[2]
nRight = nRight + tOptions.tMove[1]
nBottom = nBottom + tOptions.tMove[2]
wndComboBox:SetAnchorOffsets(nLeft, nTop, nRight, nBottom)
end
if tOptions.fnCallback then
tData.fnCallback = tOptions.fnCallback
end
if tOptions.strTooltip then
wndComboBox:SetTooltip(tOptions.strTooltip)
end
end
-- data
wndComboBox:SetData(tData)
-- set wnd
if tOptions and tOptions.bInnerText == true then
wndComboBox:FindChild("EditBox"):SetFont(strFont)
wndComboBox:FindChild("EditBox"):SetText(strText)
else
wndComboBox:FindChild("Text"):SetFont(strFont)
wndComboBox:FindChild("Text"):SetText(strText)
end
return wndComboBox
end
function Gui:API_AddOptionToComboBox(tModule, wnd, strText, vValue, tOptions)
if wnd:GetData().eType ~= EnumWindowType.ComboBox then return end
-- defaults
local tData = {
tModule = tModule,
vValue = vValue,
eType = EnumWindowType.ComboBoxItem,
wndParent = wnd,
tParentData = wnd:GetData(),
}
if wnd:GetData().tSettings and wnd:GetData().strKey then
if vValue == wnd:GetData().tSettings[wnd:GetData().strKey] then
wnd:FindChild("EditBox"):SetText(tostring(strText))
end
elseif tOptions and tOptions.bDefault then
wnd:FindChild("EditBox"):SetText(tostring(strText))
end
local strFont = self.tDefaults.strFont
local strText = strText
-- load wnd
local wndItem = Apollo.LoadForm(xmlDoc, "ForgeUI_ComboBoxItem", wnd:FindChild("Menu"), self)
-- event handlers
wndItem:FindChild("Button"):AddEventHandler("ButtonSignal", "OnComboBoxItemButton", self)
-- data
wndItem:SetData(tData)
-- set wnd
wndItem:FindChild("Button"):SetFont(strFont)
wndItem:FindChild("Button"):SetText(strText)
local wndMenu = wnd:FindChild("Menu")
local nLeft, nTop, nRight, nBottom = wndMenu:GetAnchorOffsets()
wndMenu:SetAnchorOffsets(nLeft, nTop, nRight, nTop + 25 * #wndMenu:GetChildren() + 4)
wndMenu:ArrangeChildrenVert()
return wndItem
end
function Gui:OnComboBoxButton(wndHandler, wndControl, eMouseButton)
wndControl:GetParent():FindChild("Menu"):Show(true)
end
function Gui:OnComboBoxItemButton(wndHandler, wndControl, eMouseButton)
local tData = wndControl:GetParent():GetData()
local tParentData = tData.tParentData
tData.wndParent:FindChild("EditBox"):SetText(wndControl:GetText())
if tParentData.tSettings and tParentData.strKey then
tParentData.tSettings[tParentData.strKey] = tData.vValue
end
if tParentData.fnCallback then
tParentData.fnCallback(tParentData.tModule, tData.vValue, tParentData.strKey)
end
wndControl:GetParent():GetParent():Show(false)
end
-----------------------------------------------------------------------------------------------
-- EditBox
-----------------------------------------------------------------------------------------------
function Gui:API_EditBox(tModule, wnd, strText, tSettings, strKey, tOptions)
-- defaults
local tData = {
tModule = tModule,
tSettings = tSettings,
strKey = strKey,
eType = EnumWindowType.EditBox,
}
local strFont = self.tDefaults.strFont
local strText = strText
-- load wnd
local wndEditBox = Apollo.LoadForm(xmlDoc, "ForgeUI_EditBox", wnd, self)
-- event handlers
wndEditBox:FindChild("EditBox"):AddEventHandler("EditBoxChanged", "OnEditBoxChanged", self)
wndEditBox:FindChild("EditBox"):AddEventHandler("EditBoxReturn", "OnEditBoxReturn", self)
-- options
if tOptions then
if tOptions.tOffsets then
wndEditBox:SetAnchorOffsets(unpack(tOptions.tOffsets))
end
if tOptions.tWidths then
local nLeft, nTop, nRight, nBottom = wndEditBox:GetAnchorOffsets()
wndEditBox:SetAnchorOffsets(nLeft, nTop, nLeft + tOptions.tWidths[1] + tOptions.tWidths[2] + 5, nBottom)
nLeft, nTop, nRight, nBottom = wndEditBox:FindChild("Background"):GetAnchorOffsets()
wndEditBox:FindChild("Background"):SetAnchorOffsets(nLeft, nTop, tOptions.tWidths[1], nBottom)
nLeft, nTop, nRight, nBottom = wndEditBox:FindChild("Text"):GetAnchorOffsets()
wndEditBox:FindChild("Text"):SetAnchorOffsets(- tOptions.tWidths[2], nTop, nRight, nBottom)
end
if tOptions.tMove then
local nLeft, nTop, nRight, nBottom = wndEditBox:GetAnchorOffsets()
nLeft = nLeft + tOptions.tMove[1]
nTop = nTop + tOptions.tMove[2]
nRight = nRight + tOptions.tMove[1]
nBottom = nBottom + tOptions.tMove[2]
wndEditBox:SetAnchorOffsets(nLeft, nTop, nRight, nBottom)
end
if tOptions.fnCallback then
tData.fnCallback = tOptions.fnCallback
end
if tOptions.fnCallbackReturn then
tData.fnCallbackReturn = tOptions.fnCallbackReturn
end
if tOptions.strHint then
wndEditBox:FindChild("EditBox"):SetPrompt(tOptions.strHint)
end
end
-- data
wndEditBox:SetData(tData)
-- set wnd
if tOptions and tOptions.bInnerText then
wndEditBox:FindChild("EditBox"):SetFont(strFont)
wndEditBox:FindChild("EditBox"):SetText(strText)
else
wndEditBox:FindChild("Text"):SetFont(strFont)
wndEditBox:FindChild("Text"):SetText(strText)
end
return wndEditBox
end
function Gui:OnEditBoxChanged(wndHandler, wndControl, strText)
local tData = wndControl:GetParent():GetParent():GetData()
if tData.tModule and tData.fnCallback then
tData.fnCallback(tData.tModule, strText, tData.strKey)
end
end
function Gui:OnEditBoxReturn(wndHandler, wndControl, strText)
local tData = wndControl:GetParent():GetParent():GetData()
if tData.tModule and tData.fnCallbackReturn then
tData.fnCallbackReturn(tData.tModule, strText, tData.strKey)
end
end
-----------------------------------------------------------------------------------------------
-- NumberBox
-----------------------------------------------------------------------------------------------
function Gui:API_AddNumberBox(tModule, wnd, strText, tSettings, strKey, tOptions)
-- defaults
local tData = {
tModule = tModule,
tSettings = tSettings,
strKey = strKey,
eType = EnumWindowType.NumberBox,
nPrevValue = tSettings[strKey],
}
local strFont = self.tDefaults.strFont
local strText = strText
-- load wnd
local wndNumberBox = Apollo.LoadForm(xmlDoc, "ForgeUI_NumberBox", wnd, self)
-- event handlers
wndNumberBox:FindChild("NumberBox"):AddEventHandler("EditBoxChanged", "OnNumberBoxChanged", self)
-- options
if tOptions then
if tOptions.tOffsets then
wndNumberBox:SetAnchorOffsets(unpack(tOptions.tOffsets))
end
if tOptions.tWidths then
local nLeft, nTop, nRight, nBottom = wndNumberBox:GetAnchorOffsets()
wndNumberBox:SetAnchorOffsets(nLeft, nTop, nLeft + tOptions.tWidths[1] + tOptions.tWidths[2] + 5, nBottom)
nLeft, nTop, nRight, nBottom = wndNumberBox:FindChild("Background"):GetAnchorOffsets()
wndNumberBox:FindChild("Background"):SetAnchorOffsets(nLeft, nTop, tOptions.tWidths[1], nBottom)
nLeft, nTop, nRight, nBottom = wndNumberBox:FindChild("Text"):GetAnchorOffsets()
wndNumberBox:FindChild("Text"):SetAnchorOffsets(- tOptions.tWidths[2], nTop, nRight, nBottom)
end
if tOptions.tMove then
local nLeft, nTop, nRight, nBottom = wndNumberBox:GetAnchorOffsets()
nLeft = nLeft + tOptions.tMove[1]
nTop = nTop + tOptions.tMove[2]
nRight = nRight + tOptions.tMove[1]
nBottom = nBottom + tOptions.tMove[2]
wndNumberBox:SetAnchorOffsets(nLeft, nTop, nRight, nBottom)
end
if tOptions.fnCallback then
tData.fnCallback = tOptions.fnCallback
end
if tOptions.fnCallbackReturn then
tData.fnCallbackReturn = tOptions.fnCallbackReturn
end
if tOptions.strHint then
wndNumberBox:FindChild("NumberBox"):SetPrompt(tOptions.strHint)
end
if tOptions.strTooltip then
wndNumberBox:SetTooltip(tOptions.strTooltip)
end
end
-- data
wndNumberBox:SetData(tData)
-- set wnd
wndNumberBox:FindChild("Text"):SetFont(strFont)
wndNumberBox:FindChild("Text"):SetText(strText)
wndNumberBox:FindChild("NumberBox"):SetText(tSettings[strKey])
self:SetNumberBox(wndNumberBox)
return wndNumberBox
end
function Gui:SetNumberBox(wndControl)
local tData = wndControl:GetData()
local wnd = wndControl:FindChild("NumberBox")
if wnd:GetText() == "" then wnd:SetText(0) end
if not tonumber(wnd:GetText()) then
wnd:SetText(tData.nPrevValue)
end
tData.nPrevValue = wnd:GetText()
if tData.tSettings and tData.strKey then
tData.tSettings[tData.strKey] = tonumber(wndControl:FindChild("NumberBox"):GetText())
end
end
function Gui:OnNumberBoxChanged(wndHandler, wndControl, strText)
local tData = wndControl:GetParent():GetParent():GetData()
self:SetNumberBox(wndControl:GetParent():GetParent())
if tData.tModule and tData.fnCallback then
tData.fnCallback(tData.tModule, strText, tData.strKey)
end
end
-----------------------------------------------------------------------------------------------
-- ScrollWindow
-----------------------------------------------------------------------------------------------
function Gui:API_AddVScrollWindow(tModule, wndParent, wndScroll, tOptions)
local wndVScrollWindow = Apollo.LoadForm(xmlDoc, "ForgeUI_VScrollWindow", wndParent, self)
wndVScrollWindow:FindChild("VScrollButton"):AddEventHandler("WindowMove", "OnVScrollButtonMove", self)
wndScroll:AddEventHandler("MouseWheel", "OnVScrollMouseWheel", self)
local tData = {
wndScroll = wndScroll,
}
wndVScrollWindow:SetData(tData)
return wndVScrollWindow
end
function Gui:OnVScrollButtonMove(wndHandler, wndControl)
local nLeft, nTop, nRight, nBottom = wndControl:GetAnchorOffsets()
local tData = wndControl:GetParent():GetParent():GetParent():GetData()
local nHeight = wndControl:GetHeight()
local nParentHeight = wndControl:GetParent():GetHeight()
nLeft = 0
nRight = 0
if nTop < 0 then
nTop = 0
nBottom = nHeight
end
if nBottom > nParentHeight then
nBottom = nParentHeight
nTop = nParentHeight - nHeight
end
local fPos = nTop / (nParentHeight - nHeight)
tData.wndScroll:SetVScrollPos(fPos * tData.wndScroll:GetVScrollRange())
wndControl:SetAnchorOffsets(nLeft, nTop, nRight, nBottom)
end
function Gui:OnVScrollMouseWheel(wndHandler, wndControl, nLastRelativeMouseX, nLastRelativeMouseY, fScrollAmount, bConsumeMouseWheel)
local wndScrollWindow = wndControl:GetParent():FindChild("ForgeUI_VScrollWindow")
if not wndScrollWindow then return end
local wndButton = wndScrollWindow:FindChild("VScrollButton")
local tData = wndButton:GetParent():GetParent():GetParent():GetData()
local nRange = tData.wndScroll:GetVScrollRange()
local nPos = tData.wndScroll:GetVScrollPos()
local nHeight = wndButton:GetHeight()
local nParentHeight = wndButton:GetParent():GetHeight()
local nPercent = nPos / nRange
local nLeft, nTop, nRight, nBottom = wndButton:GetAnchorOffsets()
nTop = nPercent * nParentHeight
nBottom = nPercent * nParentHeight + nHeight
nLeft = 0
nRight = 0
if nTop < 0 then
nTop = 0
nBottom = nHeight
end
if nBottom > nParentHeight then
nBottom = nParentHeight
nTop = nParentHeight - nHeight
end
wndButton:SetAnchorOffsets(nLeft, nTop, nRight, nBottom)
end
_G["ForgeLibs"]["ForgeGUI"] = new(Gui)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.