content
stringlengths 5
1.05M
|
---|
-- ========== THIS IS AN AUTOMATICALLY GENERATED FILE! ==========
local _slots = {
{
goto_spot = "",
groups = {
["A"] = true,
},
spots = {
"Visitslide",
},
},
{
attach = "DecorInt_04",
goto_spot = "Pathfind",
groups = {
["B"] = true,
},
spots = {
"Visitbench",
},
},
}
PrgAmbientLife["VisitPlayground"] = function(unit, bld)
local _spot, _obj, _slot_desc, _slot, _slotname, pos
while unit:VisitTimeLeft() > 0 do
if unit:VisitTimeLeft() > 0 then
_spot, _obj, _slot_desc, _slot, _slotname = PrgGetObjRandomSpotFromGroup(bld, nil, "A", _slots, unit)
if _spot then
PrgVisitSlot(unit, bld, _obj, _spot, _slot_desc, _slot, _slotname)
if unit.visit_restart then return end
end
end
if unit:VisitTimeLeft() > 0 then
_spot, _obj, _slot_desc, _slot, _slotname = PrgGetObjRandomSpotFromGroup(bld, nil, "A", _slots, unit)
if _spot then
PrgVisitSlot(unit, bld, _obj, _spot, _slot_desc, _slot, _slotname)
if unit.visit_restart then return end
end
end
if unit:Random(100) < 50 then
if unit:VisitTimeLeft() > 0 then
_spot, _obj, _slot_desc, _slot, _slotname = PrgGetObjRandomSpotFromGroup(bld, nil, "A", _slots, unit)
if _spot then
PrgVisitSlot(unit, bld, _obj, _spot, _slot_desc, _slot, _slotname)
if unit.visit_restart then return end
end
end
end
if unit:VisitTimeLeft() > 0 then
_spot, _obj, _slot_desc, _slot, _slotname = PrgGetObjRandomSpotFromGroup(bld, nil, "B", _slots, unit)
if _spot then
PrgVisitSlot(unit, bld, _obj, _spot, _slot_desc, _slot, _slotname, 60000)
if unit.visit_restart then return end
end
end
if unit.visit_restart then return end
end
_spot = bld:GetNearestSpot("Door", unit)
pos = bld:GetSpotLocPos(_spot)
unit:Goto(pos)
end
|
local st = require "util.stanza";
local json = require "cjson";
-- detect new jibri start recording action and add recorder_identity info to metadata
module:hook("pre-iq/full", function(event)
local stanza = event.stanza;
if stanza.name == "iq" then
local jibri = stanza:get_child('jibri', 'http://jitsi.org/protocol/jibri');
if jibri and jibri.attr.action == 'start' and jibri.attr.recording_mode == 'file' then
local recorder_identity = event.origin.jitsi_meet_context_user;
if recorder_identity then
log('info', "new recording session by: " .. recorder_identity.email);
-- inject recorder_identity info field to file recording metadata
local app_data = json.decode(jibri.attr.app_data);
app_data.file_recording_metadata.recorder_identity = recorder_identity;
jibri.attr.app_data = json.encode(app_data);
else
log('warning', "new recording without recorder_identity info");
end
end
end
end);
|
-- Regex Parser
-- Parses to an internal IL representation used for the construction of an NFA
local parser = {}
function parser.lexRegex(regexStr)
local termEaten
local function peek()
return regexStr:sub(1, 1)
end
local pos = 0
local function eatc()
local c = peek()
termEaten = termEaten .. c
regexStr = regexStr:sub(2)
pos = pos + 1
return c
end
local switchTable = {
["|"] = "union",
["*"] = function()
if peek() == "?" then
eatc()
return "ng-star"
end
return "star"
end,
["+"] = function()
if peek() == "?" then
eatc()
return "ng-plus"
end
return "plus"
end,
["?"] = "optional",
["("] = "l-paren",
[")"] = "r-paren",
["{"] = "l-bracket",
["}"] = "r-bracket",
["."] = "any",
["^"] = "start",
["$"] = "eos",
["\\"] = function()
local metas = {d = "[0-9]", w = "[a-zA-Z]", n = "\n"}
local c = eatc()
if metas[c] then
regexStr = metas[c] .. regexStr
pos = pos - #metas[c]
return false
end
termEaten = termEaten:sub(2)
return "char"
end,
["["] = function()
if peek() == "^" then
eatc()
return "open-negset"
end
return "open-set"
end,
["]"] = "close-set",
["-"] = "range"
}
local tokens = {}
while #regexStr > 0 do
termEaten = ""
local c = eatc()
local lexFn = switchTable[c]
local ret = "char"
if lexFn then
if type(lexFn) == "string" then
ret = lexFn
else
ret = lexFn()
end
end
if ret then
tokens[#tokens + 1] = {
type = ret,
source = termEaten,
position = pos
}
end
end
tokens[#tokens + 1] = {type = "eof", source = "", position = pos + 1}
return tokens
end
--[[
Grammar:
<RE> ::= <simple-RE> <union-list>
<union-list> ::= "|" <simple-RE> <union-list> | <lambda>
<simple-RE> ::= <basic-RE> <basic-RE-list>
<basic-RE-list> ::= <basic-RE> <basic-RE-list> | <lambda>
<basic-RE> ::= <star> | <plus> | <ng-star> | <ng-plus> | <quantifier> | <elementary-RE>
<star> ::= <elementary-RE> "*"
<plus> ::= <elementary-RE> "+"
<ng-star> ::= <elementary-RE> "*?"
<ng-plus> ::= <elementary-RE> "+?"
<quantifier> ::= <elementary-RE> "{" <quantity> "}"
<quantity> ::= <digit> "," <digit> | <digit> ","
<elementary-RE> ::= <group> | <any> | <eos> | <char> | <set>
<group> ::= "(" <RE> ")"
<any> ::= "."
<eos> ::= "$"
<char> ::= any non metacharacter | "\" metacharacter
<set> ::= <positive-set> | <negative-set>
<positive-set> ::= "[" <set-items> "]"
<negative-set> ::= "[^" <set-items> "]"
<set-items> ::= <set-item> | <set-item> <set-items>
<set-item> ::= <range> | <char>
<range> ::= <char> "-" <char>
Special Chars: | * + *? +? ( ) . $ \ [ [^ ] -
]]
function parser.parse(tokenList)
local RE, unionList, simpleRE, basicRE, basicREList, elementaryRE, quantifier, group, set, setItems, setItem
local parseTable = {
unionList = {["union"] = 1, default = 2},
basicREList = {["union"] = 2, ["r-paren"] = 2, ["eof"] = 2, default = 1},
elementaryRE = {["l-paren"] = 1, ["any"] = 2, ["char"] = 3, ["open-set"] = 4, ["open-negset"] = 4},
setItems = {["close-set"] = 1, default = 2}
}
local function eat()
return table.remove(tokenList, 1)
end
local function uneat(token)
table.insert(tokenList, 1, token)
end
local function expect(token, source)
local tok = eat()
if tok.type ~= token then
error("Unexpected token '" .. tok.type .. "' at position " .. tok.position, 0)
end
if source and not tok.source:match(source) then
error("Unexpected '" .. tok.source .. "' at position " .. tok.position, 0)
end
return tok
end
local function getMyType(name, index)
local parseFn = parseTable[name][tokenList[index or 1].type] or parseTable[name].default
if not parseFn then
error("Unexpected token '" .. tokenList[index or 1].type .. "' at position " .. tokenList[index or 1].position, 0)
end
return parseFn
end
local function unrollLoop(container)
local list, i = {}, 1
while container do
list[i], i = container[1], i + 1
container = container[2]
end
return unpack(list)
end
-- <RE> ::= <simple-RE> <union-list>
function RE()
return {type = "RE", simpleRE(), unrollLoop(unionList())}
end
-- <union-list> ::= "|" <simple-RE> <union-list> | <lambda>
function unionList()
local parseFn = getMyType("unionList")
if parseFn == 1 then
eat()
return {type = "unionList", simpleRE(), unionList()}
else
return
end
end
-- <simple-RE> ::= <basic-RE> <basic-RE-list>
function simpleRE()
return {type = "simpleRE", basicRE(), unrollLoop(basicREList())}
end
-- <basic-RE> ::= <star> | <plus> | <ng-star> | <ng-plus> | <quantifier> | <elementary-RE>
function basicRE()
local atom = elementaryRE()
local token = eat()
local type = token.type
if type == "star" then
return {type = "star", atom}
elseif type == "plus" then
return {type = "plus", atom}
elseif type == "ng-star" then
return {type = "ng-star", atom}
elseif type == "ng-plus" then
return {type = "ng-plus", atom}
elseif type == "optional" then
return {type = "optional", atom}
elseif type == "l-bracket" then
uneat(token)
return {type = "quantifier", atom, quantifier = quantifier()}
else
uneat(token)
return {type = "atom", atom}
end
end
-- <quantifier> ::= <elementary-RE> "{" <quantity> "}"
-- <quantity> ::= <digit> "," <digit> | <digit> ","
function quantifier()
expect("l-bracket")
local firstDigit = ""
do
local nextTok = expect("char", "%d")
local src = nextTok.source
repeat
firstDigit = firstDigit .. src
nextTok = eat()
src = nextTok.source
until src:match("%D")
uneat(nextTok)
end
if tokenList[1].type == "r-bracket" then
eat()
local count = tonumber(firstDigit)
return {type = "count", count = count}
end
expect("char", ",")
local secondDigit = ""
if tokenList[1].source:match("%d") then
local src, nextTok = ""
repeat
secondDigit = secondDigit .. src
nextTok = eat()
src = nextTok.source
until src:match("%D")
uneat(nextTok)
end
expect("r-bracket")
return {type = "range", min = tonumber(firstDigit), max = tonumber(secondDigit) or math.huge}
end
-- <basic-RE-list> ::= <basic-RE> <basic-RE-list> | <lambda>
function basicREList()
local parseFn = getMyType("basicREList")
if parseFn == 1 then
return {type = "basicREList", basicRE(), basicREList()}
else
return
end
end
-- <elementary-RE> ::= <group> | <any> | <char> | <set>
function elementaryRE()
local parseFn = getMyType("elementaryRE")
if parseFn == 1 then
return group()
elseif parseFn == 2 then
eat()
return {type = "any"}
elseif parseFn == 3 then
local token = eat()
return {type = "char", value = token.source}
elseif parseFn == 4 then
return set()
end
end
-- <group> ::= "(" <RE> ")"
function group()
eat()
local rexp = RE()
eat()
return {type = "group", rexp}
end
--<set> ::= <positive-set> | <negative-set>
function set()
local openToken = eat()
local ret
if openToken.type == "open-set" then
ret = {type = "set", unrollLoop(setItems())}
else -- open-negset
ret = {type = "negset", unrollLoop(setItems())}
end
eat()
return ret
end
-- <set-items> ::= <set-item> | <set-item> <set-items>
function setItems()
local firstItem = setItem()
local parseFn = getMyType("setItems")
if parseFn == 1 then
return {type = "setItems", firstItem}
else
return {type = "setItems", firstItem, setItems()}
end
end
-- <set-item> ::= <range> | <char>
function setItem()
if tokenList[2].type == "range" then
return {type = "range", start = eat().source, finish = (eat() and eat()).source}
else
return {type = "char", value = eat().source}
end
end
local props = {
clampStart = false,
clampEnd = false
}
if tokenList[1].type == "start" then
props.clampStart = true
table.remove(tokenList, 1)
end
if tokenList[#tokenList - 1].type == "eos" then
props.clampEnd = true
table.remove(tokenList, #tokenList - 1)
end
if #tokenList == 1 then
error("Empty regex", 0)
end
local ret = RE()
ret.properties = props
return ret
end
return parser
|
--[[
Licensed according to the included 'LICENSE' document
Author: Thomas Harning Jr <[email protected]>
--]]
local lpeg = require("lpeg")
local tostring = tostring
local pairs, ipairs = pairs, ipairs
local next, type = next, type
local error = error
local util = require("json.decode.util")
local buildCall = require("json.util").buildCall
local getmetatable = getmetatable
module("json.decode.calls")
local defaultOptions = {
defs = nil,
-- By default, do not allow undefined calls to be de-serialized as call objects
allowUndefined = false
}
-- No real default-option handling needed...
default = nil
strict = nil
local isPattern
if lpeg.type then
function isPattern(value)
return lpeg.type(value) == 'pattern'
end
else
local metaAdd = getmetatable(lpeg.P("")).__add
function isPattern(value)
return getmetatable(value).__add == metaAdd
end
end
local function buildDefinedCaptures(argumentCapture, defs)
local callCapture
if not defs then return end
for name, func in pairs(defs) do
if type(name) ~= 'string' and not isPattern(name) then
error("Invalid functionCalls name: " .. tostring(name) .. " not a string or LPEG pattern")
end
-- Allow boolean or function to match up w/ encoding permissions
if type(func) ~= 'boolean' and type(func) ~= 'function' then
error("Invalid functionCalls item: " .. name .. " not a function")
end
local nameCallCapture
if type(name) == 'string' then
nameCallCapture = lpeg.P(name .. "(") * lpeg.Cc(name)
else
-- Name matcher expected to produce a capture
nameCallCapture = name * "("
end
-- Call func over nameCallCapture and value to permit function receiving name
-- Process 'func' if it is not a function
if type(func) == 'boolean' then
local allowed = func
func = function(name, ...)
if not allowed then
error("Function call on '" .. name .. "' not permitted")
end
return buildCall(name, ...)
end
else
local inner_func = func
func = function(...)
return (inner_func(...))
end
end
local newCapture = (nameCallCapture * argumentCapture) / func * ")"
if not callCapture then
callCapture = newCapture
else
callCapture = callCapture + newCapture
end
end
return callCapture
end
local function buildCapture(options)
if not options -- No ops, don't bother to parse
or not (options.defs and (nil ~= next(options.defs)) or options.allowUndefined) then
return nil
end
-- Allow zero or more arguments separated by commas
local value = lpeg.V(util.types.VALUE)
local argumentCapture = (value * (lpeg.P(",") * value)^0) + 0
local callCapture = buildDefinedCaptures(argumentCapture, options.defs)
if options.allowUndefined then
local function func(name, ...)
return buildCall(name, ...)
end
-- Identifier-type-match
local nameCallCapture = lpeg.C(util.identifier) * "("
local newCapture = (nameCallCapture * argumentCapture) / func * ")"
if not callCapture then
callCapture = newCapture
else
callCapture = callCapture + newCapture
end
end
return callCapture
end
function load_types(options, global_options, grammar)
local capture = buildCapture(options, global_options)
if capture then
util.append_grammar_item(grammar, "VALUE", capture)
end
end
|
CreateListCategory( "Entities", "<insert description>" )
CreateListFunction( "CreateUnit", "Create a unit (squad member)" )
CreateListArgument( "pos", "array<number>", "Spawn position for unit. {x,y}, or {xy} allowed." )
CreateListArgument( "squadID", "int", "ID of squad that the unit will be added to. Default gets squad ID from your unit selection.", true )
CreateListArgument( "playerID", "int", "ID of player that the unit will be added to. Default gets player ID from your unit selection.", true )
function CreateUnit( pos, squadID, playerID )
playerID = playerID or GE_GetSelectedPlayer()
squadID = squadID or GE_GetSelectedSquad()
if #pos == 1 then
pos[2] = pos[1]
end
GE_CreateSquadUnit( pos[1], pos[2], squadID, playerID )
end
CreateListFunction( "CreateTerrain", "Create the terrain." )
function CreateTerrain()
GE_CreateTerrain()
end
CreateListFunction( "CreateResource", "Create a resource that can be consumed by squad units." )
CreateListArgument( "pos", "array<number>", "Spawn position for resource. {x,y}, or {xy} allowed." )
CreateListArgument( "scale", "array<number>", "Scale of the spawned resource. Only {x,y,z} allowed." )
CreateListArgument( "orientation", "array<number>", "Quaternion orientation of the spawned resource. Only {w,x,y,z} allowed. Use {1,0,0,0} for no orientation." )
CreateListArgument( "modelPath", "string", "Path to file containing the visual model of the resource." )
function CreateResource( pos, scale, orientation, modelPath )
if #pos == 1 then
pos[2] = pos[1]
end
GE_CreateResource( pos[1], pos[2], scale[1], scale[2], scale[3], orientation[1], orientation[2], orientation[3], orientation[4], modelPath )
end
CreateListFunction( "CreateProp", "Create an object that can block the path of the squad units" )
CreateListArgument( "pos", "array<number>", "Spawn position for prop. {x,y}, or {xy} allowed." )
CreateListArgument( "scale", "array<number>", "Scale of the spawned prop. Only {x,y,z} allowed." )
CreateListArgument( "orientation", "array<number>", "Quaternion orientation of the spawned prop. Only {w,x,y,z} allowed. Use {1,0,0,0} for no orientation." )
CreateListArgument( "blockPath", "bool", "If the prop should block the AI's pathfinding maybe???" )
CreateListArgument( "modelPath", "string", "Path to file containing the visual model of the prop." )
CreateListArgument( "radius", "int", "How large of a radius should be blocked for the pathfinding maybe???." )
function CreateProp( pos, scale, orientation, blockPath, modelPath, radius )
if #pos == 1 then
pos[2] = pos[1]
end
GE_CreateProp( pos[1], pos[2], scale[1], scale[2], scale[3], orientation[1], orientation[2], orientation[3], orientation[4], blockPath, modelPath, radius )
end
CreateListFunction( "CreateControlPoint", "Create a control point that can be taken over by squad units." )
CreateListArgument( "pos", "array<number>", "Spawn position for control point. {x,y}, or {xy} allowed." )
CreateListArgument( "scale", "array<number>", "Scale of the spawned control point. Only {x,y,z} allowed." )
CreateListArgument( "orientation", "array<number>", "Quaternion orientation of the spawned control point. Only {w,x,y,z} allowed. Use {1,0,0,0} for no orientation." )
CreateListArgument( "playerID", "int", "ID of player that the control point will belong to when spawned. Use -1 for spawning it neutral." )
CreateListArgument( "modelPath", "string", "Path to file containing the visual model of the control point." )
function CreateControlPoint( pos, scale, orientation, playerID, modelPath )
if #pos == 1 then
pos[2] = pos[1]
end
GE_CreateControlPoint( pos[1], pos[2], scale[1], scale[2], scale[3], orientation[1], orientation[2], orientation[3], orientation[4], playerID, modelPath )
end
CreateListFunction( "IncreaseSquadSize", "Create new units and adds them to the squad." )
CreateListArgument( "nrOfUnitsToCreate", "int", "Default is 1.", true )
CreateListArgument( "squadID", "int", "ID of squad that the units will be added to. Default gets squad ID from your unit selection.", true )
CreateListArgument( "playerID", "int", "ID of player that the units will be added to. Default gets player ID from your unit selection.", true )
function IncreaseSquadSize( nrOfUnitsToCreate, squadID, playerID )
playerID = playerID or GE_GetSelectedPlayer()
squadID = squadID or GE_GetSelectedSquad()
nrOfUnitsToCreate = nrOfUnitsToCreate or 1
GE_IncreaseSquadSize( nrOfUnitsToCreate, squadID, playerID )
end
CreateListFunction( "DecreaseSquadSize", "Remove units from the squad." )
CreateListArgument( "nrOfUnitsToRemove", "int", "Default is 1.", true )
CreateListArgument( "squadID", "int", "ID of squad that the units will be removed from. Default gets squad ID from your unit selection.", true )
CreateListArgument( "playerID", "int", "ID of player that the units will be removed from. Default gets player ID from your unit selection.", true )
function DecreaseSquadSize( nrOfUnitsToRemove, squadID, playerID )
playerID = playerID or GE_GetSelectedPlayer()
squadID = squadID or GE_GetSelectedSquad()
nrOfUnitsToRemove = nrOfUnitsToRemove or 1
GE_DecreaseSquadSize( nrOfUnitsToRemove, squadID, playerID )
end
CreateListFunction( "ChangeSquadSize", "Change size of the squad by creating or killing its units." )
CreateListArgument( "newUnitAmount", "int", "Default is doing nothing.", true )
CreateListArgument( "squadID", "int", "ID of squad that will have its size changed. Default gets squad ID from your unit selection.", true )
CreateListArgument( "playerID", "int", "ID of player owning the squad. Default gets player ID from your unit selection.", true )
function ChangeSquadSize( newUnitAmount, squadID, playerID )
playerID = playerID or GE_GetSelectedPlayer()
squadID = squadID or GE_GetSelectedSquad()
if newUnitAmount ~= nil then
GE_ChangeSquadSize( newUnitAmount, squadID, playerID )
end
end
CreateListFunction( "SetSS", "Set size of the squad by creating or killing its units." )
CreateListArgument( "newUnitAmount", "int", "Default is doing nothing.", true )
CreateListArgument( "squadID", "int", "ID of squad that will have its size changed. Default gets squad ID from your unit selection.", true )
CreateListArgument( "playerID", "int", "ID of player owning the squad. Default gets player ID from your unit selection.", true )
function SetSS( newUnitAmount, squadID, playerID )
playerID = playerID or GE_GetSelectedPlayer()
squadID = squadID or GE_GetSelectedSquad()
if newUnitAmount ~= nil then
GE_ChangeSquadSize( newUnitAmount, squadID, playerID )
end
end
CreateListFunction( "CreateSquad", "WARNING!!! NOT IMPLEMENTED YET!!!" )
CreateListArgument( "playerID", "int", "ID of player the squad will be added to. Default gets player ID from your unit selection.", true )
function CreateSquad( playerID )
playerID = playerID or GE_GetSelectedPlayer()
print("This function is not yet implemented")
end
CreateListFunction( "KillPlayer", "Kill all of the players units." )
CreateListArgument( "playerID", "int", "ID of player to be killed. Default gets player ID from your unit selection.", true )
function KillPlayer( playerID )
playerID = playerID or GE_GetSelectedPlayer()
GE_KillPlayer( playerID )
end
CreateListFunction( "KillSquad", "Kills all units in the squad" )
CreateListArgument( "squadID", "int", "ID of squad to be killed. Default gets squad ID from your unit selection.", true )
CreateListArgument( "playerID", "int", "ID of player owning the squad. Default gets player ID from your unit selection.", true )
function KillSquad( squadID, playerID )
playerID = playerID or GE_GetSelectedPlayer()
squadID = squadID or GE_GetSelectedSquad()
ChangeSquadSize( 0, squadID, playerID );
end |
---------------------------------------------
-- Amon Drive
--
-- Description: Performs an area of effect weaponskill. Additional effect: Paralysis + Petrification + Poison
-- Type: Physical
-- 2-3 Shadows?
-- Range: Melee range radial
-- Special weaponskill unique to Ark Angel TT. Deals ~100-400 damage.
---------------------------------------------
require("scripts/globals/settings")
require("scripts/globals/status")
require("scripts/globals/monstertpmoves")
---------------------------------------------
function onMobSkillCheck(target, mob, skill)
return 0
end
function onMobWeaponSkill(target, mob, skill)
local numhits = 1
local accmod = 1
local dmgmod = 2.5
local info = MobPhysicalMove(mob, target, skill, numhits, accmod, dmgmod, TP_NO_EFFECT)
local dmg = MobFinalAdjustments(info.dmg, mob, skill, target, tpz.attackType.PHYSICAL, tpz.damageType.SLASHING, MOBPARAM_3_SHADOW)
MobStatusEffectMove(mob, target, tpz.effect.PARALYSIS, 25, 0, 60)
MobStatusEffectMove(mob, target, tpz.effect.PETRIFICATION, 1, 0, math.random(8, 15) + mob:getMainLvl()/3)
MobStatusEffectMove(mob, target, tpz.effect.POISON, math.ceil(mob:getMainLvl() / 5), 3, 60)
target:takeDamage(dmg, mob, tpz.attackType.PHYSICAL, tpz.damageType.SLASHING)
return dmg
end
|
-- local dbg = require("debugger")
-- dbg.auto_where = 2
local slice = require'tools.list'.slice
local table = {"a", "b", "c"}
describe("empty", function()
it("does nothing", function()
slice({}, 1, 0, function()
error("Never risen")
end)
end)
end)
describe("not empty", function()
it("still may not do anything", function()
slice(table, 2, 1, function()
error("Never risen")
end)
end)
describe("or just return a slice", function()
it("does just this", function()
assert.are.same({"b"}, slice(table, 2, 2))
end)
end)
describe("or returned a mapped slice", function()
it("still just does this", function()
assert.are.same({"A", "B"}, slice(table, 1, 2, string.upper))
end)
end)
end)
describe("edge cases", function()
it("can be off limits, LHS", function()
assert.are.same({"a"}, slice(table, 0, 1))
end)
it("can be off limits, RHS", function()
assert.are.same({"b", "c"}, slice(table, 2, 100))
end)
it("and become empty", function()
assert.are.same({}, slice(table, 4, 1))
end)
it("and become empty, second index does not matter anymore", function()
assert.are.same({}, slice(table, 4, 100))
end)
end)
describe("negative indices", function()
it("works on empty", function()
assert.are.same({}, slice({}, 1, -1))
end)
it("works on singletons", function()
assert.are.same({"a"}, slice({"a"}, 1, -1))
end)
context("general case", function()
it("from the beginning, ... to the end", function()
assert.are.same(table, slice(table, 1, -1))
end)
it("from the end, ... to the end", function()
assert.are.same({"b", "c"}, slice(table, -2, -1))
end)
it("in between", function()
assert.are.same({"a", "b", "c"}, slice({"a", "b", "c", "d"}, -4, -2))
assert.are.same({"b", "c"}, slice({"a", "b", "c", "d"}, -3, -2))
end)
it("still can indicate an empty slot", function()
assert.are.same({}, slice(table, -3, -4))
end)
end)
end)
|
local ok, spellsitter = pcall(require, "spellsitter")
if not ok then
vim.notify "Could not load spellsitter"
return
end
spellsitter.setup {
-- Whether enabled, can be a list of filetypes, e.g. {'python', 'lua'}
enable = true,
-- Highlight to use for bad spellings
hl = "SpellBad",
-- Spellchecker to use. values:
-- * vimfn: built-in spell checker using vim.fn.spellbadword()
-- * ffi: built-in spell checker using the FFI to access the
-- internal spell_check() function
spellchecker = "vimfn",
}
|
local setttings = {}
setttings = {}
return setttings
|
-- AUTO BUILD, DON'T MODIFY!
dofile "autobuild/cocos2d-ui-types.lua"
name = "cocos2d_ui"
path = "../../frameworks/libxgame/src/lua-bindings"
headers = [[
#include "lua-bindings/lua_conv.h"
#include "lua-bindings/lua_conv_manual.h"
#include "lua-bindings/LuaCocosAdapter.h"
#include "cclua/xlua.h"
#include "cocos2d.h"
#include "ui/CocosGUI.h"
#include "ui/UIScrollViewBar.h"
]]
chunk = nil
luaopen = nil
typeconf 'cocos2d::ui::Widget::FocusDirection'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('LEFT', 'cocos2d::ui::Widget::FocusDirection::LEFT')
.enum('RIGHT', 'cocos2d::ui::Widget::FocusDirection::RIGHT')
.enum('UP', 'cocos2d::ui::Widget::FocusDirection::UP')
.enum('DOWN', 'cocos2d::ui::Widget::FocusDirection::DOWN')
typeconf 'cocos2d::ui::Widget::PositionType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('ABSOLUTE', 'cocos2d::ui::Widget::PositionType::ABSOLUTE')
.enum('PERCENT', 'cocos2d::ui::Widget::PositionType::PERCENT')
typeconf 'cocos2d::ui::Widget::SizeType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('ABSOLUTE', 'cocos2d::ui::Widget::SizeType::ABSOLUTE')
.enum('PERCENT', 'cocos2d::ui::Widget::SizeType::PERCENT')
typeconf 'cocos2d::ui::Widget::TouchEventType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('BEGAN', 'cocos2d::ui::Widget::TouchEventType::BEGAN')
.enum('MOVED', 'cocos2d::ui::Widget::TouchEventType::MOVED')
.enum('ENDED', 'cocos2d::ui::Widget::TouchEventType::ENDED')
.enum('CANCELED', 'cocos2d::ui::Widget::TouchEventType::CANCELED')
typeconf 'cocos2d::ui::Widget::TextureResType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('LOCAL', 'cocos2d::ui::Widget::TextureResType::LOCAL')
.enum('PLIST', 'cocos2d::ui::Widget::TextureResType::PLIST')
typeconf 'cocos2d::ui::Widget::BrightStyle'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('NONE', 'cocos2d::ui::Widget::BrightStyle::NONE')
.enum('NORMAL', 'cocos2d::ui::Widget::BrightStyle::NORMAL')
.enum('HIGHLIGHT', 'cocos2d::ui::Widget::BrightStyle::HIGHLIGHT')
typeconf 'cocos2d::ui::Widget::ccWidgetTouchCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
typeconf 'cocos2d::ui::Widget::ccWidgetClickCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
typeconf 'cocos2d::ui::Widget::ccWidgetEventCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
typeconf 'cocos2d::ui::Widget'
.supercls('cocos2d::ProtectedNode')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'Widget()')
.func(nil, 'static cocos2d::ui::Widget *create()')
.func(nil, 'void setEnabled(bool enabled)')
.func(nil, 'bool isEnabled()')
.func(nil, 'void setBright(bool bright)')
.func(nil, 'bool isBright()')
.func(nil, 'void setTouchEnabled(bool enabled)')
.func(nil, 'void setBrightStyle(cocos2d::ui::Widget::BrightStyle style)')
.func(nil, 'bool isTouchEnabled()')
.func(nil, 'bool isHighlighted()')
.func(nil, 'void setHighlighted(bool highlight)')
.func(nil, 'float getLeftBoundary()')
.func(nil, 'float getBottomBoundary()')
.func(nil, 'float getRightBoundary()')
.func(nil, 'float getTopBoundary()')
.func(nil, 'void setPositionPercent(const cocos2d::Vec2 &percent)')
.func(nil, 'const cocos2d::Vec2 &getPositionPercent()')
.func(nil, 'void setPositionType(cocos2d::ui::Widget::PositionType type)')
.func(nil, 'cocos2d::ui::Widget::PositionType getPositionType()')
.func(nil, 'void setFlippedX(bool flippedX)')
.func(nil, 'bool isFlippedX()')
.func(nil, 'void setFlippedY(bool flippedY)')
.func(nil, 'bool isFlippedY()')
.func(nil, 'bool isClippingParentContainsPoint(const cocos2d::Vec2 &pt)')
.func(nil, 'const cocos2d::Vec2 &getTouchBeganPosition()')
.func(nil, 'const cocos2d::Vec2 &getTouchMovePosition()')
.func(nil, 'const cocos2d::Vec2 &getTouchEndPosition()')
.func(nil, 'void setSizePercent(const cocos2d::Vec2 &percent)')
.func(nil, 'void setSizeType(cocos2d::ui::Widget::SizeType type)')
.func(nil, 'cocos2d::ui::Widget::SizeType getSizeType()')
.func(nil, 'const cocos2d::Size &getCustomSize()')
.func(nil, 'const cocos2d::Size &getLayoutSize()')
.func(nil, 'const cocos2d::Vec2 &getSizePercent()')
.func(nil, 'bool onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *unusedEvent)')
.func(nil, 'void onTouchMoved(cocos2d::Touch *touch, cocos2d::Event *unusedEvent)')
.func(nil, 'void onTouchEnded(cocos2d::Touch *touch, cocos2d::Event *unusedEvent)')
.func(nil, 'void onTouchCancelled(cocos2d::Touch *touch, cocos2d::Event *unusedEvent)')
.func(nil, 'void setLayoutParameter(cocos2d::ui::LayoutParameter *parameter)')
.func(nil, 'cocos2d::ui::LayoutParameter *getLayoutParameter()')
.func(nil, 'void ignoreContentAdaptWithSize(bool ignore)')
.func(nil, 'bool isIgnoreContentAdaptWithSize()')
.func(nil, 'cocos2d::Vec2 getWorldPosition()')
.func(nil, '@addref(protectedChildren |) cocos2d::Node *getVirtualRenderer()')
.func(nil, 'cocos2d::Size getVirtualRendererSize()')
.func(nil, 'cocos2d::ui::Widget *clone()')
.func(nil, 'void updateSizeAndPosition()', 'void updateSizeAndPosition(const cocos2d::Size &parentSize)')
.func(nil, 'void setActionTag(int tag)')
.func(nil, 'int getActionTag()')
.func(nil, 'void setPropagateTouchEvents(bool isPropagate)')
.func(nil, 'bool isPropagateTouchEvents()')
.func(nil, 'void setSwallowTouches(bool swallow)')
.func(nil, 'bool isSwallowTouches()')
.func(nil, 'bool isFocused()')
.func(nil, 'void setFocused(bool focus)')
.func(nil, 'bool isFocusEnabled()')
.func(nil, 'void setFocusEnabled(bool enable)')
.func(nil, 'cocos2d::ui::Widget *findNextFocusedWidget(cocos2d::ui::Widget::FocusDirection direction, @nullable cocos2d::ui::Widget *current)')
.func(nil, 'void requestFocus()')
.func(nil, 'static cocos2d::ui::Widget *getCurrentFocusedWidget()')
.func(nil, 'static void enableDpadNavigation(bool enable)')
.func(nil, 'void setUnifySizeEnabled(bool enable)')
.func(nil, 'bool isUnifySizeEnabled()')
.func(nil, 'void setCallbackName(const std::string &callbackName)')
.func(nil, 'const std::string &getCallbackName()')
.func(nil, 'void setCallbackType(const std::string &callbackType)')
.func(nil, 'const std::string &getCallbackType()')
.func(nil, 'void setLayoutComponentEnabled(bool enable)')
.func(nil, 'bool isLayoutComponentEnabled()')
.func(nil, 'void interceptTouchEvent(cocos2d::ui::Widget::TouchEventType event, cocos2d::ui::Widget *sender, cocos2d::Touch *touch)')
.func(nil, 'void propagateTouchEvent(cocos2d::ui::Widget::TouchEventType event, cocos2d::ui::Widget *sender, cocos2d::Touch *touch)')
.func(nil, 'void onFocusChange(@nullable cocos2d::ui::Widget *widgetLostFocus, @nullable cocos2d::ui::Widget *widgetGetFocus)')
.func(nil, 'void dispatchFocusEvent(@nullable cocos2d::ui::Widget *widgetLoseFocus, @nullable cocos2d::ui::Widget *widgetGetFocus)')
.var('onFocusChanged', '@nullable std::function<void (cocos2d::ui::Widget *, cocos2d::ui::Widget *)> onFocusChanged')
.var('onNextFocusedWidget', '@nullable @localvar std::function<cocos2d::ui::Widget * (cocos2d::ui::Widget::FocusDirection)> onNextFocusedWidget')
.callback {
funcs = {
'void addTouchEventListener(@nullable const cocos2d::ui::Widget::ccWidgetTouchCallback &callback)'
},
tag_maker = 'addTouchEventListener',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.callback {
funcs = {
'void addClickEventListener(@nullable const cocos2d::ui::Widget::ccWidgetClickCallback &callback)'
},
tag_maker = 'addClickEventListener',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.callback {
funcs = {
'void addCCSEventListener(@nullable const cocos2d::ui::Widget::ccWidgetEventCallback &callback)'
},
tag_maker = 'addCCSEventListener',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.prop('enabled', nil, nil)
.prop('bright', nil, nil)
.prop('touchEnabled', nil, nil)
.prop('highlighted', nil, nil)
.prop('leftBoundary', nil, nil)
.prop('bottomBoundary', nil, nil)
.prop('rightBoundary', nil, nil)
.prop('topBoundary', nil, nil)
.prop('positionPercent', nil, nil)
.prop('positionType', nil, nil)
.prop('flippedX', nil, nil)
.prop('flippedY', nil, nil)
.prop('touchBeganPosition', nil, nil)
.prop('touchMovePosition', nil, nil)
.prop('touchEndPosition', nil, nil)
.prop('sizeType', nil, nil)
.prop('customSize', nil, nil)
.prop('layoutSize', nil, nil)
.prop('sizePercent', nil, nil)
.prop('layoutParameter', nil, nil)
.prop('ignoreContentAdaptWithSize', nil, nil)
.prop('worldPosition', nil, nil)
.prop('virtualRenderer', nil, nil)
.prop('virtualRendererSize', nil, nil)
.prop('actionTag', nil, nil)
.prop('propagateTouchEvents', nil, nil)
.prop('swallowTouches', nil, nil)
.prop('focused', nil, nil)
.prop('focusEnabled', nil, nil)
.prop('currentFocusedWidget', nil, nil)
.prop('unifySizeEnabled', nil, nil)
.prop('callbackName', nil, nil)
.prop('callbackType', nil, nil)
.prop('layoutComponentEnabled', nil, nil)
typeconf 'cocos2d::ui::Helper'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::ui::Widget *seekWidgetByTag(cocos2d::ui::Widget *root, int tag)')
.func(nil, 'static cocos2d::ui::Widget *seekWidgetByName(cocos2d::ui::Widget *root, const std::string &name)')
.func(nil, 'static cocos2d::ui::Widget *seekActionWidgetByActionTag(cocos2d::ui::Widget *root, int tag)')
.func(nil, 'static std::string getSubStringOfUTF8String(const std::string &str, std::string::size_type start, std::string::size_type length)')
.func(nil, 'static void doLayout(cocos2d::Node *rootNode)')
.func(nil, 'static void changeLayoutSystemActiveState(bool active)')
.func(nil, 'static cocos2d::Rect restrictCapInsetRect(const cocos2d::Rect &capInsets, const cocos2d::Size &textureSize)')
.func(nil, 'static cocos2d::Rect convertBoundingBoxToScreen(cocos2d::Node *node)')
typeconf 'cocos2d::ui::Scale9Sprite::State'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('NORMAL', 'cocos2d::ui::Scale9Sprite::State::NORMAL')
.enum('GRAY', 'cocos2d::ui::Scale9Sprite::State::GRAY')
typeconf 'cocos2d::ui::Scale9Sprite::RenderingType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('SIMPLE', 'cocos2d::ui::Scale9Sprite::RenderingType::SIMPLE')
.enum('SLICE', 'cocos2d::ui::Scale9Sprite::RenderingType::SLICE')
typeconf 'cocos2d::ui::Scale9Sprite'
.supercls('cocos2d::Sprite')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'Scale9Sprite()')
.func(nil, 'static cocos2d::ui::Scale9Sprite *create()', 'static cocos2d::ui::Scale9Sprite *create(const std::string &file, const cocos2d::Rect &rect, const cocos2d::Rect &capInsets)', 'static cocos2d::ui::Scale9Sprite *create(const cocos2d::Rect &capInsets, const std::string &file)', 'static cocos2d::ui::Scale9Sprite *create(const std::string &file, const cocos2d::Rect &rect)', 'static cocos2d::ui::Scale9Sprite *create(const std::string &file)')
.func(nil, 'static cocos2d::ui::Scale9Sprite *createWithSpriteFrame(cocos2d::SpriteFrame *spriteFrame)', 'static cocos2d::ui::Scale9Sprite *createWithSpriteFrame(cocos2d::SpriteFrame *spriteFrame, const cocos2d::Rect &capInsets)')
.func(nil, 'static cocos2d::ui::Scale9Sprite *createWithSpriteFrameName(const std::string &spriteFrameName)', 'static cocos2d::ui::Scale9Sprite *createWithSpriteFrameName(const std::string &spriteFrameName, const cocos2d::Rect &capInsets)')
.func(nil, 'bool initWithFile(const std::string &file, const cocos2d::Rect &rect, const cocos2d::Rect &capInsets)', 'bool initWithFile(const cocos2d::Rect &capInsets, const std::string &file)', '@using bool initWithFile(const std::string &file, const cocos2d::Rect &rect)', '@using bool initWithFile(const std::string &file)')
.func(nil, 'bool initWithSpriteFrame(cocos2d::SpriteFrame *spriteFrame, const cocos2d::Rect &capInsets)', '@using bool initWithSpriteFrame(cocos2d::SpriteFrame *spriteFrame)')
.func(nil, 'bool initWithSpriteFrameName(const std::string &spriteFrameName, const cocos2d::Rect &capInsets)', '@using bool initWithSpriteFrameName(const std::string &spriteFrameName)')
.func(nil, '@using bool init()', 'bool init(cocos2d::Sprite *sprite, const cocos2d::Rect &rect, bool rotated, const cocos2d::Rect &capInsets)', 'bool init(cocos2d::Sprite *sprite, const cocos2d::Rect &rect, const cocos2d::Rect &capInsets)', 'bool init(cocos2d::Sprite *sprite, const cocos2d::Rect &rect, bool rotated, const cocos2d::Vec2 &offset, const cocos2d::Size &originalSize, const cocos2d::Rect &capInsets)')
.func(nil, 'cocos2d::ui::Scale9Sprite *resizableSpriteWithCapInsets(const cocos2d::Rect &capInsets)')
.func(nil, 'bool updateWithSprite(cocos2d::Sprite *sprite, const cocos2d::Rect &rect, bool rotated, const cocos2d::Rect &capInsets)', 'bool updateWithSprite(cocos2d::Sprite *sprite, const cocos2d::Rect &rect, bool rotated, const cocos2d::Vec2 &offset, const cocos2d::Size &originalSize, const cocos2d::Rect &capInsets)')
.func(nil, 'void setSpriteFrame(cocos2d::SpriteFrame *spriteFrame, const cocos2d::Rect &capInsets)', '@using void setSpriteFrame(const std::string &spriteFrameName)', '@using void setSpriteFrame(cocos2d::SpriteFrame *newFrame)')
.func(nil, 'void setState(cocos2d::ui::Scale9Sprite::State state)')
.func(nil, 'cocos2d::ui::Scale9Sprite::State getState()')
.func(nil, 'cocos2d::Size getOriginalSize()')
.func(nil, 'void setPreferredSize(const cocos2d::Size &size)')
.func(nil, 'cocos2d::Size getPreferredSize()')
.func(nil, 'void setInsetLeft(float leftInset)')
.func(nil, 'float getInsetLeft()')
.func(nil, 'void setInsetTop(float topInset)')
.func(nil, 'float getInsetTop()')
.func(nil, 'void setInsetRight(float rightInset)')
.func(nil, 'float getInsetRight()')
.func(nil, 'void setInsetBottom(float bottomInset)')
.func(nil, 'float getInsetBottom()')
.func(nil, 'void setScale9Enabled(bool enabled)')
.func(nil, 'bool isScale9Enabled()')
.func(nil, 'cocos2d::Sprite *getSprite()')
.func(nil, 'void copyTo(cocos2d::ui::Scale9Sprite *copy)')
.func(nil, 'void setRenderingType(cocos2d::ui::Scale9Sprite::RenderingType type)')
.func(nil, 'cocos2d::ui::Scale9Sprite::RenderingType getRenderingType()')
.func(nil, 'void setCapInsets(const cocos2d::Rect &insets)')
.func(nil, 'cocos2d::Rect getCapInsets()')
.func(nil, 'void resetRender()')
.prop('state', nil, nil)
.prop('originalSize', nil, nil)
.prop('preferredSize', nil, nil)
.prop('insetLeft', nil, nil)
.prop('insetTop', nil, nil)
.prop('insetRight', nil, nil)
.prop('insetBottom', nil, nil)
.prop('scale9Enabled', nil, nil)
.prop('sprite', nil, nil)
.prop('renderingType', nil, nil)
.prop('capInsets', nil, nil)
typeconf 'cocos2d::ui::LayoutComponent::HorizontalEdge'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('None', 'cocos2d::ui::LayoutComponent::HorizontalEdge::None')
.enum('Left', 'cocos2d::ui::LayoutComponent::HorizontalEdge::Left')
.enum('Right', 'cocos2d::ui::LayoutComponent::HorizontalEdge::Right')
.enum('Center', 'cocos2d::ui::LayoutComponent::HorizontalEdge::Center')
typeconf 'cocos2d::ui::LayoutComponent::VerticalEdge'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('None', 'cocos2d::ui::LayoutComponent::VerticalEdge::None')
.enum('Bottom', 'cocos2d::ui::LayoutComponent::VerticalEdge::Bottom')
.enum('Top', 'cocos2d::ui::LayoutComponent::VerticalEdge::Top')
.enum('Center', 'cocos2d::ui::LayoutComponent::VerticalEdge::Center')
typeconf 'cocos2d::ui::LayoutComponent'
.supercls('cocos2d::Component')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'LayoutComponent()')
.func(nil, 'static cocos2d::ui::LayoutComponent *create()')
.func(nil, 'static cocos2d::ui::LayoutComponent *bindLayoutComponent(cocos2d::Node *node)')
.func(nil, 'void setUsingPercentContentSize(bool isUsed)')
.func(nil, 'bool getUsingPercentContentSize()')
.func(nil, 'void setPercentContentSize(const cocos2d::Vec2 &percent)')
.func(nil, 'cocos2d::Vec2 getPercentContentSize()')
.func(nil, 'const cocos2d::Point &getAnchorPosition()')
.func(nil, 'void setAnchorPosition(const cocos2d::Point &point)')
.func(nil, 'const cocos2d::Point &getPosition()')
.func(nil, 'void setPosition(const cocos2d::Point &position)')
.func(nil, 'bool isPositionPercentXEnabled()')
.func(nil, 'void setPositionPercentXEnabled(bool isUsed)')
.func(nil, 'float getPositionPercentX()')
.func(nil, 'void setPositionPercentX(float percentMargin)')
.func(nil, 'bool isPositionPercentYEnabled()')
.func(nil, 'void setPositionPercentYEnabled(bool isUsed)')
.func(nil, 'float getPositionPercentY()')
.func(nil, 'void setPositionPercentY(float percentMargin)')
.func(nil, 'cocos2d::ui::LayoutComponent::HorizontalEdge getHorizontalEdge()')
.func(nil, 'void setHorizontalEdge(cocos2d::ui::LayoutComponent::HorizontalEdge hEage)')
.func(nil, 'cocos2d::ui::LayoutComponent::VerticalEdge getVerticalEdge()')
.func(nil, 'void setVerticalEdge(cocos2d::ui::LayoutComponent::VerticalEdge vEage)')
.func(nil, 'float getLeftMargin()')
.func(nil, 'void setLeftMargin(float margin)')
.func(nil, 'float getRightMargin()')
.func(nil, 'void setRightMargin(float margin)')
.func(nil, 'float getTopMargin()')
.func(nil, 'void setTopMargin(float margin)')
.func(nil, 'float getBottomMargin()')
.func(nil, 'void setBottomMargin(float margin)')
.func(nil, 'const cocos2d::Size &getSize()')
.func(nil, 'void setSize(const cocos2d::Size &size)')
.func(nil, 'bool isPercentWidthEnabled()')
.func(nil, 'void setPercentWidthEnabled(bool isUsed)')
.func(nil, 'float getSizeWidth()')
.func(nil, 'void setSizeWidth(float width)')
.func(nil, 'float getPercentWidth()')
.func(nil, 'void setPercentWidth(float percentWidth)')
.func(nil, 'bool isPercentHeightEnabled()')
.func(nil, 'void setPercentHeightEnabled(bool isUsed)')
.func(nil, 'float getSizeHeight()')
.func(nil, 'void setSizeHeight(float height)')
.func(nil, 'float getPercentHeight()')
.func(nil, 'void setPercentHeight(float percentHeight)')
.func(nil, 'bool isStretchWidthEnabled()')
.func(nil, 'void setStretchWidthEnabled(bool isUsed)')
.func(nil, 'bool isStretchHeightEnabled()')
.func(nil, 'void setStretchHeightEnabled(bool isUsed)')
.func(nil, 'void setPercentOnlyEnabled(bool enable)')
.func(nil, 'void setActiveEnabled(bool enable)')
.func(nil, 'void refreshLayout()')
.prop('usingPercentContentSize', nil, nil)
.prop('percentContentSize', nil, nil)
.prop('anchorPosition', nil, nil)
.prop('position', nil, nil)
.prop('positionPercentXEnabled', nil, nil)
.prop('positionPercentX', nil, nil)
.prop('positionPercentYEnabled', nil, nil)
.prop('positionPercentY', nil, nil)
.prop('horizontalEdge', nil, nil)
.prop('verticalEdge', nil, nil)
.prop('leftMargin', nil, nil)
.prop('rightMargin', nil, nil)
.prop('topMargin', nil, nil)
.prop('bottomMargin', nil, nil)
.prop('size', nil, nil)
.prop('percentWidthEnabled', nil, nil)
.prop('sizeWidth', nil, nil)
.prop('percentWidth', nil, nil)
.prop('percentHeightEnabled', nil, nil)
.prop('sizeHeight', nil, nil)
.prop('percentHeight', nil, nil)
.prop('stretchWidthEnabled', nil, nil)
.prop('stretchHeightEnabled', nil, nil)
typeconf 'cocos2d::ui::LayoutParameter::Type'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('NONE', 'cocos2d::ui::LayoutParameter::Type::NONE')
.enum('LINEAR', 'cocos2d::ui::LayoutParameter::Type::LINEAR')
.enum('RELATIVE', 'cocos2d::ui::LayoutParameter::Type::RELATIVE')
typeconf 'cocos2d::ui::LayoutParameter'
.supercls('cocos2d::Ref')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'LayoutParameter()')
.func(nil, 'static cocos2d::ui::LayoutParameter *create()')
.func(nil, 'void setMargin(const cocos2d::ui::Margin &margin)')
.func(nil, 'const cocos2d::ui::Margin &getMargin()')
.func(nil, 'cocos2d::ui::LayoutParameter::Type getLayoutType()')
.func(nil, 'cocos2d::ui::LayoutParameter *clone()')
.func(nil, 'cocos2d::ui::LayoutParameter *createCloneInstance()')
.func(nil, 'void copyProperties(cocos2d::ui::LayoutParameter *model)')
.prop('margin', nil, nil)
.prop('layoutType', nil, nil)
typeconf 'cocos2d::ui::LinearLayoutParameter::LinearGravity'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('NONE', 'cocos2d::ui::LinearLayoutParameter::LinearGravity::NONE')
.enum('LEFT', 'cocos2d::ui::LinearLayoutParameter::LinearGravity::LEFT')
.enum('TOP', 'cocos2d::ui::LinearLayoutParameter::LinearGravity::TOP')
.enum('RIGHT', 'cocos2d::ui::LinearLayoutParameter::LinearGravity::RIGHT')
.enum('BOTTOM', 'cocos2d::ui::LinearLayoutParameter::LinearGravity::BOTTOM')
.enum('CENTER_VERTICAL', 'cocos2d::ui::LinearLayoutParameter::LinearGravity::CENTER_VERTICAL')
.enum('CENTER_HORIZONTAL', 'cocos2d::ui::LinearLayoutParameter::LinearGravity::CENTER_HORIZONTAL')
typeconf 'cocos2d::ui::LinearLayoutParameter'
.supercls('cocos2d::ui::LayoutParameter')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'LinearLayoutParameter()')
.func(nil, 'static cocos2d::ui::LinearLayoutParameter *create()')
.func(nil, 'void setGravity(cocos2d::ui::LinearLayoutParameter::LinearGravity gravity)')
.func(nil, 'cocos2d::ui::LinearLayoutParameter::LinearGravity getGravity()')
.prop('gravity', nil, nil)
typeconf 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('NONE', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::NONE')
.enum('PARENT_TOP_LEFT', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::PARENT_TOP_LEFT')
.enum('PARENT_TOP_CENTER_HORIZONTAL', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::PARENT_TOP_CENTER_HORIZONTAL')
.enum('PARENT_TOP_RIGHT', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::PARENT_TOP_RIGHT')
.enum('PARENT_LEFT_CENTER_VERTICAL', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_CENTER_VERTICAL')
.enum('CENTER_IN_PARENT', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::CENTER_IN_PARENT')
.enum('PARENT_RIGHT_CENTER_VERTICAL', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_CENTER_VERTICAL')
.enum('PARENT_LEFT_BOTTOM', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::PARENT_LEFT_BOTTOM')
.enum('PARENT_BOTTOM_CENTER_HORIZONTAL', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::PARENT_BOTTOM_CENTER_HORIZONTAL')
.enum('PARENT_RIGHT_BOTTOM', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::PARENT_RIGHT_BOTTOM')
.enum('LOCATION_ABOVE_LEFTALIGN', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_LEFTALIGN')
.enum('LOCATION_ABOVE_CENTER', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_CENTER')
.enum('LOCATION_ABOVE_RIGHTALIGN', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::LOCATION_ABOVE_RIGHTALIGN')
.enum('LOCATION_LEFT_OF_TOPALIGN', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_TOPALIGN')
.enum('LOCATION_LEFT_OF_CENTER', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_CENTER')
.enum('LOCATION_LEFT_OF_BOTTOMALIGN', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::LOCATION_LEFT_OF_BOTTOMALIGN')
.enum('LOCATION_RIGHT_OF_TOPALIGN', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_TOPALIGN')
.enum('LOCATION_RIGHT_OF_CENTER', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_CENTER')
.enum('LOCATION_RIGHT_OF_BOTTOMALIGN', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::LOCATION_RIGHT_OF_BOTTOMALIGN')
.enum('LOCATION_BELOW_LEFTALIGN', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_LEFTALIGN')
.enum('LOCATION_BELOW_CENTER', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_CENTER')
.enum('LOCATION_BELOW_RIGHTALIGN', 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign::LOCATION_BELOW_RIGHTALIGN')
typeconf 'cocos2d::ui::RelativeLayoutParameter'
.supercls('cocos2d::ui::LayoutParameter')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'RelativeLayoutParameter()')
.func(nil, 'static cocos2d::ui::RelativeLayoutParameter *create()')
.func(nil, 'void setAlign(cocos2d::ui::RelativeLayoutParameter::RelativeAlign align)')
.func(nil, 'cocos2d::ui::RelativeLayoutParameter::RelativeAlign getAlign()')
.func(nil, 'void setRelativeToWidgetName(const std::string &name)')
.func(nil, 'const std::string &getRelativeToWidgetName()')
.func(nil, 'void setRelativeName(const std::string &name)')
.func(nil, 'const std::string &getRelativeName()')
.prop('align', nil, nil)
.prop('relativeToWidgetName', nil, nil)
.prop('relativeName', nil, nil)
typeconf 'cocos2d::ui::Layout::Type'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('ABSOLUTE', 'cocos2d::ui::Layout::Type::ABSOLUTE')
.enum('VERTICAL', 'cocos2d::ui::Layout::Type::VERTICAL')
.enum('HORIZONTAL', 'cocos2d::ui::Layout::Type::HORIZONTAL')
.enum('RELATIVE', 'cocos2d::ui::Layout::Type::RELATIVE')
typeconf 'cocos2d::ui::Layout::ClippingType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('STENCIL', 'cocos2d::ui::Layout::ClippingType::STENCIL')
.enum('SCISSOR', 'cocos2d::ui::Layout::ClippingType::SCISSOR')
typeconf 'cocos2d::ui::Layout::BackGroundColorType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('NONE', 'cocos2d::ui::Layout::BackGroundColorType::NONE')
.enum('SOLID', 'cocos2d::ui::Layout::BackGroundColorType::SOLID')
.enum('GRADIENT', 'cocos2d::ui::Layout::BackGroundColorType::GRADIENT')
typeconf 'cocos2d::ui::Layout'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'Layout()')
.func(nil, 'static cocos2d::ui::Layout *create()')
.func(nil, 'void setBackGroundImage(const std::string &fileName, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void setBackGroundImageCapInsets(const cocos2d::Rect &capInsets)')
.func(nil, 'const cocos2d::Rect &getBackGroundImageCapInsets()')
.func(nil, 'void setBackGroundColorType(cocos2d::ui::Layout::BackGroundColorType type)')
.func(nil, 'cocos2d::ui::Layout::BackGroundColorType getBackGroundColorType()')
.func(nil, 'void setBackGroundImageScale9Enabled(bool enabled)')
.func(nil, 'bool isBackGroundImageScale9Enabled()')
.func(nil, 'void setBackGroundColor(const cocos2d::Color3B &color)', 'void setBackGroundColor(const cocos2d::Color3B &startColor, const cocos2d::Color3B &endColor)')
.func(nil, 'const cocos2d::Color3B &getBackGroundColor()')
.func(nil, 'const cocos2d::Color3B &getBackGroundStartColor()')
.func(nil, 'const cocos2d::Color3B &getBackGroundEndColor()')
.func(nil, 'void setBackGroundColorOpacity(uint8_t opacity)')
.func(nil, 'uint8_t getBackGroundColorOpacity()')
.func(nil, 'void setBackGroundColorVector(const cocos2d::Vec2 &vector)')
.func(nil, 'const cocos2d::Vec2 &getBackGroundColorVector()')
.func(nil, 'void setBackGroundImageColor(const cocos2d::Color3B &color)')
.func(nil, 'void setBackGroundImageOpacity(uint8_t opacity)')
.func(nil, 'const cocos2d::Color3B &getBackGroundImageColor()')
.func(nil, 'uint8_t getBackGroundImageOpacity()')
.func(nil, 'void removeBackGroundImage()')
.func(nil, 'const cocos2d::Size &getBackGroundImageTextureSize()')
.func(nil, 'void setClippingEnabled(bool enabled)')
.func(nil, 'void setClippingType(cocos2d::ui::Layout::ClippingType type)')
.func(nil, 'cocos2d::ui::Layout::ClippingType getClippingType()')
.func(nil, 'bool isClippingEnabled()')
.func(nil, 'void setLayoutType(cocos2d::ui::Layout::Type type)')
.func(nil, 'cocos2d::ui::Layout::Type getLayoutType()')
.func(nil, 'void forceDoLayout()')
.func(nil, 'void requestDoLayout()')
.func(nil, 'void setLoopFocus(bool loop)')
.func(nil, 'bool isLoopFocus()')
.func(nil, 'void setPassFocusToChild(bool pass)')
.func(nil, 'bool isPassFocusToChild()')
.func(nil, 'cocos2d::ResourceData getRenderFile()')
.var('onPassFocusToChild', '@nullable std::function<int (cocos2d::ui::Widget::FocusDirection, cocos2d::ui::Widget *)> onPassFocusToChild')
.prop('backGroundImageCapInsets', nil, nil)
.prop('backGroundColorType', nil, nil)
.prop('backGroundImageScale9Enabled', nil, nil)
.prop('backGroundColor', nil, nil)
.prop('backGroundStartColor', nil, nil)
.prop('backGroundEndColor', nil, nil)
.prop('backGroundColorOpacity', nil, nil)
.prop('backGroundColorVector', nil, nil)
.prop('backGroundImageColor', nil, nil)
.prop('backGroundImageOpacity', nil, nil)
.prop('backGroundImageTextureSize', nil, nil)
.prop('clippingType', nil, nil)
.prop('clippingEnabled', nil, nil)
.prop('layoutType', nil, nil)
.prop('loopFocus', nil, nil)
.prop('passFocusToChild', nil, nil)
.prop('renderFile', nil, nil)
typeconf 'cocos2d::ui::HBox'
.supercls('cocos2d::ui::Layout')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'HBox()')
.func(nil, 'static cocos2d::ui::HBox *create()', 'static cocos2d::ui::HBox *create(const cocos2d::Size &size)')
.func(nil, 'bool initWithSize(const cocos2d::Size &size)')
typeconf 'cocos2d::ui::VBox'
.supercls('cocos2d::ui::Layout')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'VBox()')
.func(nil, 'static cocos2d::ui::VBox *create()', 'static cocos2d::ui::VBox *create(const cocos2d::Size &size)')
.func(nil, 'bool initWithSize(const cocos2d::Size &size)')
typeconf 'cocos2d::ui::RelativeBox'
.supercls('cocos2d::ui::Layout')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'RelativeBox()')
.func(nil, 'static cocos2d::ui::RelativeBox *create()', 'static cocos2d::ui::RelativeBox *create(const cocos2d::Size &size)')
.func(nil, 'bool initWithSize(const cocos2d::Size &size)')
typeconf 'cocos2d::ui::WebView::ccWebViewCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.ifdef('*', '#if defined(CCLUA_OS_IOS) || defined(CCLUA_OS_ANDROID)')
typeconf 'cocos2d::ui::WebView'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.ifdef('*', '#if defined(CCLUA_OS_IOS) || defined(CCLUA_OS_ANDROID)')
.func(nil, 'static cocos2d::ui::WebView *create()')
.func(nil, 'void setJavascriptInterfaceScheme(const std::string &scheme)')
.func(nil, 'void loadData(const cocos2d::Data &data, const std::string &MIMEType, const std::string &encoding, const std::string &baseURL)')
.func(nil, 'void loadHTMLString(const std::string &string, @optional const std::string &baseURL)')
.func(nil, 'void loadURL(const std::string &url)', 'void loadURL(const std::string &url, bool cleanCachedData)')
.func(nil, 'void loadFile(const std::string &fileName)')
.func(nil, 'void stopLoading()')
.func(nil, 'void reload()')
.func(nil, 'bool canGoBack()')
.func(nil, 'bool canGoForward()')
.func(nil, 'void goBack()')
.func(nil, 'void goForward()')
.func(nil, 'void evaluateJS(const std::string &js)')
.func(nil, 'void setScalesPageToFit(const bool scalesPageToFit)')
.func(nil, 'void setBounces(bool bounce)')
.func(nil, 'void setOpacityWebView(float opacity)')
.func(nil, 'float getOpacityWebView()')
.func(nil, 'void setBackgroundTransparent()')
.func(nil, 'WebView()')
.callback {
funcs = {
'void setOnShouldStartLoading(@nullable const std::function<bool (WebView *, const std::string &)> &callback)'
},
tag_maker = 'OnShouldStartLoading',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.callback {
funcs = {
'void setOnDidFinishLoading(@nullable const cocos2d::ui::WebView::ccWebViewCallback &callback)'
},
tag_maker = 'OnDidFinishLoading',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.callback {
funcs = {
'void setOnDidFailLoading(@nullable const cocos2d::ui::WebView::ccWebViewCallback &callback)'
},
tag_maker = 'OnDidFailLoading',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.callback {
funcs = {
'void setOnJSCallback(@nullable const cocos2d::ui::WebView::ccWebViewCallback &callback)'
},
tag_maker = 'OnJSCallback',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.callback {
funcs = {
'@localvar std::function<bool (cocos2d::ui::WebView *, const std::string &)> getOnShouldStartLoading()'
},
tag_maker = 'OnShouldStartLoading',
tag_mode = 'subequal',
tag_store = 0,
tag_scope = 'object',
}
.callback {
funcs = {
'@localvar cocos2d::ui::WebView::ccWebViewCallback getOnDidFinishLoading()'
},
tag_maker = 'OnDidFinishLoading',
tag_mode = 'subequal',
tag_store = 0,
tag_scope = 'object',
}
.callback {
funcs = {
'@localvar cocos2d::ui::WebView::ccWebViewCallback getOnDidFailLoading()'
},
tag_maker = 'OnDidFailLoading',
tag_mode = 'subequal',
tag_store = 0,
tag_scope = 'object',
}
.callback {
funcs = {
'@localvar cocos2d::ui::WebView::ccWebViewCallback getOnJSCallback()'
},
tag_maker = 'OnJSCallback',
tag_mode = 'subequal',
tag_store = 0,
tag_scope = 'object',
}
.prop('onShouldStartLoading', nil, nil)
.prop('onDidFinishLoading', nil, nil)
.prop('onDidFailLoading', nil, nil)
.prop('onJSCallback', nil, nil)
.prop('opacityWebView', nil, nil)
typeconf 'cocos2d::ui::VideoPlayer::EventType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.ifdef('*', '#if defined(CCLUA_OS_IOS) || defined(CCLUA_OS_ANDROID)')
.enum('PLAYING', 'cocos2d::ui::VideoPlayer::EventType::PLAYING')
.enum('PAUSED', 'cocos2d::ui::VideoPlayer::EventType::PAUSED')
.enum('STOPPED', 'cocos2d::ui::VideoPlayer::EventType::STOPPED')
.enum('COMPLETED', 'cocos2d::ui::VideoPlayer::EventType::COMPLETED')
.enum('ERROR', 'cocos2d::ui::VideoPlayer::EventType::ERROR')
typeconf 'cocos2d::ui::VideoPlayer::ccVideoPlayerCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.ifdef('*', '#if defined(CCLUA_OS_IOS) || defined(CCLUA_OS_ANDROID)')
typeconf 'cocos2d::ui::VideoPlayer::StyleType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.ifdef('*', '#if defined(CCLUA_OS_IOS) || defined(CCLUA_OS_ANDROID)')
.enum('DEFAULT', 'cocos2d::ui::VideoPlayer::StyleType::DEFAULT')
.enum('NONE', 'cocos2d::ui::VideoPlayer::StyleType::NONE')
typeconf 'cocos2d::ui::VideoPlayer'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.ifdef('*', '#if defined(CCLUA_OS_IOS) || defined(CCLUA_OS_ANDROID)')
.func(nil, 'static cocos2d::ui::VideoPlayer *create()')
.func(nil, 'void setFileName(const std::string &videoPath)')
.func(nil, 'const std::string &getFileName()')
.func(nil, 'void setURL(const std::string &_videoURL)')
.func(nil, 'const std::string &getURL()')
.func(nil, 'void setLooping(bool looping)')
.func(nil, 'void setUserInputEnabled(bool enableInput)')
.func(nil, 'void setStyle(cocos2d::ui::VideoPlayer::StyleType style)')
.func(nil, 'void play()')
.func(nil, 'void stop()')
.func(nil, 'void seekTo(float sec)')
.func(nil, 'bool isPlaying()')
.func(nil, 'bool isLooping()')
.func(nil, 'bool isUserInputEnabled()')
.func(nil, 'void setKeepAspectRatioEnabled(bool enable)')
.func(nil, 'bool isKeepAspectRatioEnabled()')
.func(nil, 'void setFullScreenEnabled(bool fullscreen)')
.func(nil, 'bool isFullScreenEnabled()')
.func(nil, 'void onPlayEvent(int event)')
.func(nil, 'VideoPlayer()')
.callback {
funcs = {
'void addEventListener(const cocos2d::ui::VideoPlayer::ccVideoPlayerCallback &callback)'
},
tag_maker = 'videoPlayerCallback',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.prop('fileName', nil, nil)
.prop('url', nil, nil)
.prop('playing', nil, nil)
.prop('looping', nil, nil)
.prop('userInputEnabled', nil, nil)
.prop('keepAspectRatioEnabled', nil, nil)
.prop('fullScreenEnabled', nil, nil)
typeconf 'cocos2d::ui::AbstractCheckButton'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'void loadTextures(const std::string &background, const std::string &backgroundSelected, const std::string &cross, const std::string &backgroundDisabled, const std::string &frontCrossDisabled, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadTextureBackGround(const std::string &backGround, @optional cocos2d::ui::Widget::TextureResType type)')
.func(nil, 'void loadTextureBackGroundSelected(const std::string &backGroundSelected, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadTextureFrontCross(const std::string &crossTextureName, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadTextureBackGroundDisabled(const std::string &backGroundDisabled, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadTextureFrontCrossDisabled(const std::string &frontCrossDisabled, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'bool isSelected()')
.func(nil, 'void setSelected(bool selected)')
.func(nil, 'void setZoomScale(float scale)')
.func(nil, 'float getZoomScale()')
.func(nil, '@addref(protectedChildren |) cocos2d::Sprite *getRendererBackground()')
.func(nil, '@addref(protectedChildren |) cocos2d::Sprite *getRendererBackgroundSelected()')
.func(nil, '@addref(protectedChildren |) cocos2d::Sprite *getRendererFrontCross()')
.func(nil, '@addref(protectedChildren |) cocos2d::Sprite *getRendererBackgroundDisabled()')
.func(nil, '@addref(protectedChildren |) cocos2d::Sprite *getRendererFrontCrossDisabled()')
.func(nil, 'cocos2d::ResourceData getBackNormalFile()')
.func(nil, 'cocos2d::ResourceData getBackPressedFile()')
.func(nil, 'cocos2d::ResourceData getBackDisabledFile()')
.func(nil, 'cocos2d::ResourceData getCrossNormalFile()')
.func(nil, 'cocos2d::ResourceData getCrossDisabledFile()')
.func(nil, '@using bool init()', 'bool init(const std::string &backGround, const std::string &backGroundSelected, const std::string &cross, const std::string &backGroundDisabled, const std::string &frontCrossDisabled, @optional cocos2d::ui::Widget::TextureResType texType)')
.prop('selected', nil, nil)
.prop('zoomScale', nil, nil)
.prop('rendererBackground', nil, nil)
.prop('rendererBackgroundSelected', nil, nil)
.prop('rendererFrontCross', nil, nil)
.prop('rendererBackgroundDisabled', nil, nil)
.prop('rendererFrontCrossDisabled', nil, nil)
.prop('backNormalFile', nil, nil)
.prop('backPressedFile', nil, nil)
.prop('backDisabledFile', nil, nil)
.prop('crossNormalFile', nil, nil)
.prop('crossDisabledFile', nil, nil)
typeconf 'cocos2d::ui::TabHeader::EventType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('SELECTED', 'cocos2d::ui::TabHeader::EventType::SELECTED')
.enum('UNSELECTED', 'cocos2d::ui::TabHeader::EventType::UNSELECTED')
typeconf 'cocos2d::ui::TabHeader'
.supercls('cocos2d::ui::AbstractCheckButton')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::ui::TabHeader *create()', 'static cocos2d::ui::TabHeader *create(const std::string &titleStr, const std::string &backGround, const std::string &cross, @optional cocos2d::ui::Widget::TextureResType texType)', 'static cocos2d::ui::TabHeader *create(const std::string &titleStr, const std::string &backGround, const std::string &backGroundSelected, const std::string &cross, const std::string &backGroundDisabled, const std::string &frontCrossDisabled, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, '@addref(protectedChildren |) cocos2d::Label *getTitleRenderer()')
.func(nil, 'void setTitleText(const std::string &text)')
.func(nil, 'std::string getTitleText()')
.func(nil, 'void setTitleColor(const cocos2d::Color4B &color)')
.func(nil, 'const cocos2d::Color4B &getTitleColor()')
.func(nil, 'void setTitleFontSize(float size)')
.func(nil, 'float getTitleFontSize()')
.func(nil, 'void setTitleFontName(const std::string &fontName)')
.func(nil, 'std::string getTitleFontName()')
.func(nil, 'int getIndexInTabControl()')
.prop('titleRenderer', nil, nil)
.prop('titleText', nil, nil)
.prop('titleColor', nil, nil)
.prop('titleFontSize', nil, nil)
.prop('titleFontName', nil, nil)
.prop('indexInTabControl', nil, nil)
typeconf 'cocos2d::ui::TabControl::Dock'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('TOP', 'cocos2d::ui::TabControl::Dock::TOP')
.enum('LEFT', 'cocos2d::ui::TabControl::Dock::LEFT')
.enum('BOTTOM', 'cocos2d::ui::TabControl::Dock::BOTTOM')
.enum('RIGHT', 'cocos2d::ui::TabControl::Dock::RIGHT')
typeconf 'cocos2d::ui::TabControl::EventType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('SELECT_CHANGED', 'cocos2d::ui::TabControl::EventType::SELECT_CHANGED')
typeconf 'cocos2d::ui::TabControl::ccTabControlCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
typeconf 'cocos2d::ui::TabControl'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::ui::TabControl *create()')
.func(nil, '@delref(protectedChildren ~) void removeTab(int index)')
.func(nil, 'void setSelectTab(int index)', 'void setSelectTab(cocos2d::ui::TabHeader *tabHeader)')
.func(nil, '@addref(protectedChildren |) cocos2d::ui::TabHeader *getTabHeader(int index)')
.func(nil, '@addref(protectedChildren |) cocos2d::ui::Layout *getTabContainer(int index)')
.func(nil, 'void insertTab(int index, @addref(protectedChildren |) cocos2d::ui::TabHeader *header, @addref(protectedChildren |) cocos2d::ui::Layout *container)')
.func(nil, 'size_t getTabCount()')
.func(nil, 'int getSelectedTabIndex()')
.func(nil, 'int indexOfTabHeader(const cocos2d::ui::TabHeader *tabCell)')
.func(nil, 'void setHeaderWidth(float headerWidth)')
.func(nil, 'float getHeaderWidth()')
.func(nil, 'void setHeaderHeight(float headerHeight)')
.func(nil, 'int getHeaderHeight()')
.func(nil, 'void ignoreHeadersTextureSize(bool ignore)')
.func(nil, 'bool isIgnoreHeadersTextureSize()')
.func(nil, 'void setHeaderSelectedZoom(float zoom)')
.func(nil, 'float getHeaderSelectedZoom()')
.func(nil, 'void setHeaderDockPlace(cocos2d::ui::TabControl::Dock dockPlace)')
.func(nil, 'cocos2d::ui::TabControl::Dock getHeaderDockPlace()')
.callback {
funcs = {
'void setTabChangedEventListener(@localvar @nullable const cocos2d::ui::TabControl::ccTabControlCallback &callback)'
},
tag_maker = 'tabChangedEventListener',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.prop('tabCount', nil, nil)
.prop('selectedTabIndex', nil, nil)
.prop('headerWidth', nil, nil)
.prop('headerHeight', nil, nil)
.prop('ignoreHeadersTextureSize', nil, nil)
.prop('headerSelectedZoom', nil, nil)
.prop('headerDockPlace', nil, nil)
typeconf 'cocos2d::ui::ScrollView::Direction'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('NONE', 'cocos2d::ui::ScrollView::Direction::NONE')
.enum('VERTICAL', 'cocos2d::ui::ScrollView::Direction::VERTICAL')
.enum('HORIZONTAL', 'cocos2d::ui::ScrollView::Direction::HORIZONTAL')
.enum('BOTH', 'cocos2d::ui::ScrollView::Direction::BOTH')
typeconf 'cocos2d::ui::ScrollView::EventType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('SCROLL_TO_TOP', 'cocos2d::ui::ScrollView::EventType::SCROLL_TO_TOP')
.enum('SCROLL_TO_BOTTOM', 'cocos2d::ui::ScrollView::EventType::SCROLL_TO_BOTTOM')
.enum('SCROLL_TO_LEFT', 'cocos2d::ui::ScrollView::EventType::SCROLL_TO_LEFT')
.enum('SCROLL_TO_RIGHT', 'cocos2d::ui::ScrollView::EventType::SCROLL_TO_RIGHT')
.enum('SCROLLING', 'cocos2d::ui::ScrollView::EventType::SCROLLING')
.enum('BOUNCE_TOP', 'cocos2d::ui::ScrollView::EventType::BOUNCE_TOP')
.enum('BOUNCE_BOTTOM', 'cocos2d::ui::ScrollView::EventType::BOUNCE_BOTTOM')
.enum('BOUNCE_LEFT', 'cocos2d::ui::ScrollView::EventType::BOUNCE_LEFT')
.enum('BOUNCE_RIGHT', 'cocos2d::ui::ScrollView::EventType::BOUNCE_RIGHT')
.enum('CONTAINER_MOVED', 'cocos2d::ui::ScrollView::EventType::CONTAINER_MOVED')
.enum('SCROLLING_BEGAN', 'cocos2d::ui::ScrollView::EventType::SCROLLING_BEGAN')
.enum('SCROLLING_ENDED', 'cocos2d::ui::ScrollView::EventType::SCROLLING_ENDED')
.enum('AUTOSCROLL_ENDED', 'cocos2d::ui::ScrollView::EventType::AUTOSCROLL_ENDED')
typeconf 'cocos2d::ui::ScrollView::ccScrollViewCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
typeconf 'cocos2d::ui::ScrollView'
.supercls('cocos2d::ui::Layout')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'ScrollView()')
.func(nil, 'static cocos2d::ui::ScrollView *create()')
.func(nil, 'void setDirection(cocos2d::ui::ScrollView::Direction dir)')
.func(nil, 'cocos2d::ui::ScrollView::Direction getDirection()')
.func(nil, '@addref(protectedChildren |) cocos2d::ui::Layout *getInnerContainer()')
.func(nil, 'void stopScroll()')
.func(nil, 'void stopAutoScroll()')
.func(nil, 'void stopOverallScroll()')
.func(nil, 'void scrollToBottom(float timeInSec, bool attenuated)')
.func(nil, 'void scrollToTop(float timeInSec, bool attenuated)')
.func(nil, 'void scrollToLeft(float timeInSec, bool attenuated)')
.func(nil, 'void scrollToRight(float timeInSec, bool attenuated)')
.func(nil, 'void scrollToTopLeft(float timeInSec, bool attenuated)')
.func(nil, 'void scrollToTopRight(float timeInSec, bool attenuated)')
.func(nil, 'void scrollToBottomLeft(float timeInSec, bool attenuated)')
.func(nil, 'void scrollToBottomRight(float timeInSec, bool attenuated)')
.func(nil, 'void scrollToPercentVertical(float percent, float timeInSec, bool attenuated)')
.func(nil, 'void scrollToPercentHorizontal(float percent, float timeInSec, bool attenuated)')
.func(nil, 'void scrollToPercentBothDirection(const cocos2d::Vec2 &percent, float timeInSec, bool attenuated)')
.func(nil, 'float getScrolledPercentVertical()')
.func(nil, 'float getScrolledPercentHorizontal()')
.func(nil, 'cocos2d::Vec2 getScrolledPercentBothDirection()')
.func(nil, 'void jumpToBottom()')
.func(nil, 'void jumpToTop()')
.func(nil, 'void jumpToLeft()')
.func(nil, 'void jumpToRight()')
.func(nil, 'void jumpToTopLeft()')
.func(nil, 'void jumpToTopRight()')
.func(nil, 'void jumpToBottomLeft()')
.func(nil, 'void jumpToBottomRight()')
.func(nil, 'void jumpToPercentVertical(float percent)')
.func(nil, 'void jumpToPercentHorizontal(float percent)')
.func(nil, 'void jumpToPercentBothDirection(const cocos2d::Vec2 &percent)')
.func(nil, 'void setInnerContainerSize(const cocos2d::Size &size)')
.func(nil, 'const cocos2d::Size &getInnerContainerSize()')
.func(nil, 'void setInnerContainerPosition(const cocos2d::Vec2 &pos)')
.func(nil, 'const cocos2d::Vec2 &getInnerContainerPosition()')
.func(nil, 'void setBounceEnabled(bool enabled)')
.func(nil, 'bool isBounceEnabled()')
.func(nil, 'void setInertiaScrollEnabled(bool enabled)')
.func(nil, 'bool isInertiaScrollEnabled()')
.func(nil, 'void setScrollBarEnabled(bool enabled)')
.func(nil, 'bool isScrollBarEnabled()')
.func(nil, 'void setScrollBarPositionFromCorner(const cocos2d::Vec2 &positionFromCorner)')
.func(nil, 'void setScrollBarPositionFromCornerForVertical(const cocos2d::Vec2 &positionFromCorner)')
.func(nil, 'cocos2d::Vec2 getScrollBarPositionFromCornerForVertical()')
.func(nil, 'void setScrollBarPositionFromCornerForHorizontal(const cocos2d::Vec2 &positionFromCorner)')
.func(nil, 'cocos2d::Vec2 getScrollBarPositionFromCornerForHorizontal()')
.func(nil, 'void setScrollBarWidth(float width)')
.func(nil, 'float getScrollBarWidth()')
.func(nil, 'void setScrollBarColor(const cocos2d::Color3B &color)')
.func(nil, 'const cocos2d::Color3B &getScrollBarColor()')
.func(nil, 'void setScrollBarOpacity(uint8_t opacity)')
.func(nil, 'uint8_t getScrollBarOpacity()')
.func(nil, 'void setScrollBarAutoHideEnabled(bool autoHideEnabled)')
.func(nil, 'bool isScrollBarAutoHideEnabled()')
.func(nil, 'void setScrollBarAutoHideTime(float autoHideTime)')
.func(nil, 'float getScrollBarAutoHideTime()')
.func(nil, 'void setTouchTotalTimeThreshold(float touchTotalTimeThreshold)')
.func(nil, 'float getTouchTotalTimeThreshold()')
.func(nil, 'bool isScrolling()')
.func(nil, 'bool isAutoScrolling()')
.callback {
funcs = {
'void addEventListener(const cocos2d::ui::ScrollView::ccScrollViewCallback &callback)'
},
tag_maker = 'scrollViewCallback',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.prop('direction', nil, nil)
.prop('innerContainer', nil, nil)
.prop('scrolledPercentVertical', nil, nil)
.prop('scrolledPercentHorizontal', nil, nil)
.prop('scrolledPercentBothDirection', nil, nil)
.prop('innerContainerSize', nil, nil)
.prop('innerContainerPosition', nil, nil)
.prop('bounceEnabled', nil, nil)
.prop('inertiaScrollEnabled', nil, nil)
.prop('scrollBarEnabled', nil, nil)
.prop('scrollBarPositionFromCornerForVertical', nil, nil)
.prop('scrollBarPositionFromCornerForHorizontal', nil, nil)
.prop('scrollBarWidth', nil, nil)
.prop('scrollBarColor', nil, nil)
.prop('scrollBarOpacity', nil, nil)
.prop('scrollBarAutoHideEnabled', nil, nil)
.prop('scrollBarAutoHideTime', nil, nil)
.prop('touchTotalTimeThreshold', nil, nil)
.prop('scrolling', nil, nil)
.prop('autoScrolling', nil, nil)
typeconf 'cocos2d::ui::ListView::Gravity'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('LEFT', 'cocos2d::ui::ListView::Gravity::LEFT')
.enum('RIGHT', 'cocos2d::ui::ListView::Gravity::RIGHT')
.enum('CENTER_HORIZONTAL', 'cocos2d::ui::ListView::Gravity::CENTER_HORIZONTAL')
.enum('TOP', 'cocos2d::ui::ListView::Gravity::TOP')
.enum('BOTTOM', 'cocos2d::ui::ListView::Gravity::BOTTOM')
.enum('CENTER_VERTICAL', 'cocos2d::ui::ListView::Gravity::CENTER_VERTICAL')
typeconf 'cocos2d::ui::ListView::EventType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('ON_SELECTED_ITEM_START', 'cocos2d::ui::ListView::EventType::ON_SELECTED_ITEM_START')
.enum('ON_SELECTED_ITEM_END', 'cocos2d::ui::ListView::EventType::ON_SELECTED_ITEM_END')
typeconf 'cocos2d::ui::ListView::MagneticType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('NONE', 'cocos2d::ui::ListView::MagneticType::NONE')
.enum('CENTER', 'cocos2d::ui::ListView::MagneticType::CENTER')
.enum('BOTH_END', 'cocos2d::ui::ListView::MagneticType::BOTH_END')
.enum('LEFT', 'cocos2d::ui::ListView::MagneticType::LEFT')
.enum('RIGHT', 'cocos2d::ui::ListView::MagneticType::RIGHT')
.enum('TOP', 'cocos2d::ui::ListView::MagneticType::TOP')
.enum('BOTTOM', 'cocos2d::ui::ListView::MagneticType::BOTTOM')
typeconf 'cocos2d::ui::ListView::ccListViewCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
typeconf 'cocos2d::ui::ListView'
.supercls('cocos2d::ui::ScrollView')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'ListView()')
.func(nil, 'static cocos2d::ui::ListView *create()')
.func(nil, 'void setItemModel(cocos2d::ui::Widget *model)')
.func(nil, 'void pushBackDefaultItem()')
.func(nil, 'void insertDefaultItem(ssize_t index)')
.func(nil, 'void pushBackCustomItem(@addref(children |) cocos2d::ui::Widget *item)')
.func(nil, 'void insertCustomItem(@addref(children |) cocos2d::ui::Widget *item, ssize_t index)')
.func(nil, '@delref(children ~) void removeLastItem()')
.func(nil, '@delref(children ~) void removeItem(ssize_t index)')
.func(nil, '@delref(children ~) void removeAllItems()')
.func(nil, '@addref(children |) cocos2d::ui::Widget *getItem(ssize_t index)')
.func(nil, '@addref(children |) Vector<cocos2d::ui::Widget *> &getItems()')
.func(nil, 'ssize_t getIndex(cocos2d::ui::Widget *item)')
.func(nil, 'void setGravity(cocos2d::ui::ListView::Gravity gravity)')
.func(nil, 'void setMagneticType(cocos2d::ui::ListView::MagneticType magneticType)')
.func(nil, 'cocos2d::ui::ListView::MagneticType getMagneticType()')
.func(nil, 'void setMagneticAllowedOutOfBoundary(bool magneticAllowedOutOfBoundary)')
.func(nil, 'bool getMagneticAllowedOutOfBoundary()')
.func(nil, 'void setItemsMargin(float margin)')
.func(nil, 'float getItemsMargin()')
.func(nil, 'void setPadding(float l, float t, float r, float b)')
.func(nil, 'void setLeftPadding(float l)')
.func(nil, 'void setTopPadding(float t)')
.func(nil, 'void setRightPadding(float r)')
.func(nil, 'void setBottomPadding(float b)')
.func(nil, 'float getLeftPadding()')
.func(nil, 'float getTopPadding()')
.func(nil, 'float getRightPadding()')
.func(nil, 'float getBottomPadding()')
.func(nil, 'void setScrollDuration(float time)')
.func(nil, 'float getScrollDuration()')
.func(nil, 'void doLayout()')
.func(nil, 'cocos2d::ui::Widget *getClosestItemToPosition(const cocos2d::Vec2 &targetPosition, const cocos2d::Vec2 &itemAnchorPoint)')
.func(nil, 'cocos2d::ui::Widget *getClosestItemToPositionInCurrentView(const cocos2d::Vec2 &positionRatioInView, const cocos2d::Vec2 &itemAnchorPoint)')
.func(nil, 'cocos2d::ui::Widget *getCenterItemInCurrentView()')
.func(nil, 'cocos2d::ui::Widget *getLeftmostItemInCurrentView()')
.func(nil, 'cocos2d::ui::Widget *getRightmostItemInCurrentView()')
.func(nil, 'cocos2d::ui::Widget *getTopmostItemInCurrentView()')
.func(nil, 'cocos2d::ui::Widget *getBottommostItemInCurrentView()')
.func(nil, 'void jumpToItem(ssize_t itemIndex, const cocos2d::Vec2 &positionRatioInView, const cocos2d::Vec2 &itemAnchorPoint)')
.func(nil, 'void scrollToItem(ssize_t itemIndex, const cocos2d::Vec2 &positionRatioInView, const cocos2d::Vec2 &itemAnchorPoint)', 'void scrollToItem(ssize_t itemIndex, const cocos2d::Vec2 &positionRatioInView, const cocos2d::Vec2 &itemAnchorPoint, float timeInSec)')
.func(nil, 'ssize_t getCurSelectedIndex()')
.func(nil, 'void setCurSelectedIndex(int itemIndex)')
.callback {
funcs = {
'void addEventListener(const cocos2d::ui::ListView::ccListViewCallback &callback)',
'@using void addEventListener(const cocos2d::ui::ScrollView::ccScrollViewCallback &callback)'
},
tag_maker = 'ListViewCallback',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.prop('items', nil, nil)
.prop('magneticType', nil, nil)
.prop('magneticAllowedOutOfBoundary', nil, nil)
.prop('itemsMargin', nil, nil)
.prop('leftPadding', nil, nil)
.prop('topPadding', nil, nil)
.prop('rightPadding', nil, nil)
.prop('bottomPadding', nil, nil)
.prop('scrollDuration', nil, nil)
.prop('centerItemInCurrentView', nil, nil)
.prop('leftmostItemInCurrentView', nil, nil)
.prop('rightmostItemInCurrentView', nil, nil)
.prop('topmostItemInCurrentView', nil, nil)
.prop('bottommostItemInCurrentView', nil, nil)
.prop('curSelectedIndex', nil, nil)
typeconf 'cocos2d::ui::LoadingBar::Direction'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('LEFT', 'cocos2d::ui::LoadingBar::Direction::LEFT')
.enum('RIGHT', 'cocos2d::ui::LoadingBar::Direction::RIGHT')
typeconf 'cocos2d::ui::LoadingBar'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'LoadingBar()')
.func(nil, 'static cocos2d::ui::LoadingBar *create()', 'static cocos2d::ui::LoadingBar *create(const std::string &textureName, @optional float percentage)', 'static cocos2d::ui::LoadingBar *create(const std::string &textureName, cocos2d::ui::Widget::TextureResType texType, @optional float percentage)')
.func(nil, 'void setDirection(cocos2d::ui::LoadingBar::Direction direction)')
.func(nil, 'cocos2d::ui::LoadingBar::Direction getDirection()')
.func(nil, 'void loadTexture(const std::string &texture, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void setPercent(float percent)')
.func(nil, 'float getPercent()')
.func(nil, 'void setScale9Enabled(bool enabled)')
.func(nil, 'bool isScale9Enabled()')
.func(nil, 'void setCapInsets(const cocos2d::Rect &capInsets)')
.func(nil, 'const cocos2d::Rect &getCapInsets()')
.func(nil, 'cocos2d::ResourceData getRenderFile()')
.prop('direction', nil, nil)
.prop('percent', nil, nil)
.prop('scale9Enabled', nil, nil)
.prop('capInsets', nil, nil)
.prop('renderFile', nil, nil)
typeconf 'cocos2d::ui::PageView::EventType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('TURNING', 'cocos2d::ui::PageView::EventType::TURNING')
typeconf 'cocos2d::ui::PageView::TouchDirection'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('LEFT', 'cocos2d::ui::PageView::TouchDirection::LEFT')
.enum('RIGHT', 'cocos2d::ui::PageView::TouchDirection::RIGHT')
.enum('UP', 'cocos2d::ui::PageView::TouchDirection::UP')
.enum('DOWN', 'cocos2d::ui::PageView::TouchDirection::DOWN')
typeconf 'cocos2d::ui::PageView::ccPageViewCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
typeconf 'cocos2d::ui::PageView'
.supercls('cocos2d::ui::ListView')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'PageView()')
.func(nil, 'static cocos2d::ui::PageView *create()')
.func(nil, 'void addPage(@addref(children |) cocos2d::ui::Widget *page)')
.func(nil, 'void insertPage(@addref(children |) cocos2d::ui::Widget *page, int idx)')
.func(nil, 'void removePage(@delref(children |) cocos2d::ui::Widget *page)')
.func(nil, '@delref(children ~) void removePageAtIndex(ssize_t index)')
.func(nil, '@delref(children *) void removeAllPages()')
.func(nil, 'void scrollToPage(ssize_t idx)', 'void scrollToPage(ssize_t idx, float time)')
.func(nil, 'void scrollToItem(ssize_t itemIndex)', 'void scrollToItem(ssize_t idx, float time)')
.func(nil, 'ssize_t getCurrentPageIndex()')
.func(nil, 'void setCurrentPageIndex(ssize_t index)')
.func(nil, 'void setIndicatorEnabled(bool enabled)')
.func(nil, 'bool getIndicatorEnabled()')
.func(nil, 'void setIndicatorPositionAsAnchorPoint(const cocos2d::Vec2 &positionAsAnchorPoint)')
.func(nil, 'const cocos2d::Vec2 &getIndicatorPositionAsAnchorPoint()')
.func(nil, 'void setIndicatorPosition(const cocos2d::Vec2 &position)')
.func(nil, 'const cocos2d::Vec2 &getIndicatorPosition()')
.func(nil, 'void setIndicatorSpaceBetweenIndexNodes(float spaceBetweenIndexNodes)')
.func(nil, 'float getIndicatorSpaceBetweenIndexNodes()')
.func(nil, 'void setIndicatorSelectedIndexColor(const cocos2d::Color3B &color)')
.func(nil, 'const cocos2d::Color3B &getIndicatorSelectedIndexColor()')
.func(nil, 'void setIndicatorIndexNodesColor(const cocos2d::Color3B &color)')
.func(nil, 'const cocos2d::Color3B &getIndicatorIndexNodesColor()')
.func(nil, 'void setIndicatorSelectedIndexOpacity(uint8_t opacity)')
.func(nil, 'uint8_t getIndicatorSelectedIndexOpacity()')
.func(nil, 'void setIndicatorIndexNodesOpacity(uint8_t opacity)')
.func(nil, 'uint8_t getIndicatorIndexNodesOpacity()')
.func(nil, 'void setIndicatorIndexNodesScale(float indexNodesScale)')
.func(nil, 'void setIndicatorIndexNodesTexture(const std::string &texName, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'float getIndicatorIndexNodesScale()')
.func(nil, 'void setAutoScrollStopEpsilon(float epsilon)')
.callback {
funcs = {
'void addEventListener(const cocos2d::ui::PageView::ccPageViewCallback &callback)',
'@using void addEventListener(const cocos2d::ui::ScrollView::ccScrollViewCallback &callback)'
},
tag_maker = 'PageViewCallback',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.prop('currentPageIndex', nil, nil)
.prop('indicatorEnabled', nil, nil)
.prop('indicatorPositionAsAnchorPoint', nil, nil)
.prop('indicatorPosition', nil, nil)
.prop('indicatorSpaceBetweenIndexNodes', nil, nil)
.prop('indicatorSelectedIndexColor', nil, nil)
.prop('indicatorIndexNodesColor', nil, nil)
.prop('indicatorSelectedIndexOpacity', nil, nil)
.prop('indicatorIndexNodesOpacity', nil, nil)
.prop('indicatorIndexNodesScale', nil, nil)
typeconf 'cocos2d::ui::RichElement::Type'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('TEXT', 'cocos2d::ui::RichElement::Type::TEXT')
.enum('IMAGE', 'cocos2d::ui::RichElement::Type::IMAGE')
.enum('CUSTOM', 'cocos2d::ui::RichElement::Type::CUSTOM')
.enum('NEWLINE', 'cocos2d::ui::RichElement::Type::NEWLINE')
typeconf 'cocos2d::ui::RichElement'
.supercls('cocos2d::Ref')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'RichElement()')
.func(nil, 'bool init(int tag, const cocos2d::Color3B &color, uint8_t opacity)')
.func(nil, 'bool equalType(cocos2d::ui::RichElement::Type type)')
.func(nil, 'void setColor(const cocos2d::Color3B &color)')
typeconf 'cocos2d::ui::RichElementText'
.supercls('cocos2d::ui::RichElement')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'RichElementText()')
.func(nil, 'bool init(int tag, const cocos2d::Color3B &color, uint8_t opacity, const std::string &text, const std::string &fontName, float fontSize, uint32_t flags, const std::string &url, @optional const cocos2d::Color3B &outlineColor, @optional int outlineSize, @optional const cocos2d::Color3B &shadowColor, @optional const cocos2d::Size &shadowOffset, @optional int shadowBlurRadius, @optional const cocos2d::Color3B &glowColor)')
.func(nil, 'static cocos2d::ui::RichElementText *create(int tag, const cocos2d::Color3B &color, uint8_t opacity, const std::string &text, const std::string &fontName, float fontSize, @optional uint32_t flags, @optional const std::string &url, @optional const cocos2d::Color3B &outlineColor, @optional int outlineSize, @optional const cocos2d::Color3B &shadowColor, @optional const cocos2d::Size &shadowOffset, @optional int shadowBlurRadius, @optional const cocos2d::Color3B &glowColor)')
typeconf 'cocos2d::ui::RichElementImage'
.supercls('cocos2d::ui::RichElement')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'RichElementImage()')
.func(nil, 'bool init(int tag, const cocos2d::Color3B &color, uint8_t opacity, const std::string &filePath, @optional const std::string &url, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'static cocos2d::ui::RichElementImage *create(int tag, const cocos2d::Color3B &color, uint8_t opacity, const std::string &filePath, @optional const std::string &url, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void setWidth(int width)')
.func(nil, 'void setHeight(int height)')
.func(nil, 'void setUrl(const std::string &url)')
typeconf 'cocos2d::ui::RichElementCustomNode'
.supercls('cocos2d::ui::RichElement')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'RichElementCustomNode()')
.func(nil, 'bool init(int tag, const cocos2d::Color3B &color, uint8_t opacity, cocos2d::Node *customNode)')
.func(nil, 'static cocos2d::ui::RichElementCustomNode *create(int tag, const cocos2d::Color3B &color, uint8_t opacity, cocos2d::Node *customNode)')
typeconf 'cocos2d::ui::RichElementNewLine'
.supercls('cocos2d::ui::RichElement')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'RichElementNewLine()')
.func(nil, 'static cocos2d::ui::RichElementNewLine *create(int tag, const cocos2d::Color3B &color, uint8_t opacity)')
typeconf 'cocos2d::ui::RichText::WrapMode'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('WRAP_PER_WORD', 'cocos2d::ui::RichText::WrapMode::WRAP_PER_WORD')
.enum('WRAP_PER_CHAR', 'cocos2d::ui::RichText::WrapMode::WRAP_PER_CHAR')
typeconf 'cocos2d::ui::RichText::HorizontalAlignment'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('LEFT', 'cocos2d::ui::RichText::HorizontalAlignment::LEFT')
.enum('CENTER', 'cocos2d::ui::RichText::HorizontalAlignment::CENTER')
.enum('RIGHT', 'cocos2d::ui::RichText::HorizontalAlignment::RIGHT')
typeconf 'cocos2d::ui::RichText::OpenUrlHandler'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
typeconf 'cocos2d::ui::RichText'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.const('KEY_VERTICAL_SPACE', 'cocos2d::ui::RichText::KEY_VERTICAL_SPACE', 'const std::string')
.const('KEY_WRAP_MODE', 'cocos2d::ui::RichText::KEY_WRAP_MODE', 'const std::string')
.const('KEY_HORIZONTAL_ALIGNMENT', 'cocos2d::ui::RichText::KEY_HORIZONTAL_ALIGNMENT', 'const std::string')
.const('KEY_FONT_COLOR_STRING', 'cocos2d::ui::RichText::KEY_FONT_COLOR_STRING', 'const std::string')
.const('KEY_FONT_SIZE', 'cocos2d::ui::RichText::KEY_FONT_SIZE', 'const std::string')
.const('KEY_FONT_SMALL', 'cocos2d::ui::RichText::KEY_FONT_SMALL', 'const std::string')
.const('KEY_FONT_BIG', 'cocos2d::ui::RichText::KEY_FONT_BIG', 'const std::string')
.const('KEY_FONT_FACE', 'cocos2d::ui::RichText::KEY_FONT_FACE', 'const std::string')
.const('KEY_TEXT_BOLD', 'cocos2d::ui::RichText::KEY_TEXT_BOLD', 'const std::string')
.const('KEY_TEXT_ITALIC', 'cocos2d::ui::RichText::KEY_TEXT_ITALIC', 'const std::string')
.const('KEY_TEXT_LINE', 'cocos2d::ui::RichText::KEY_TEXT_LINE', 'const std::string')
.const('VALUE_TEXT_LINE_NONE', 'cocos2d::ui::RichText::VALUE_TEXT_LINE_NONE', 'const std::string')
.const('VALUE_TEXT_LINE_DEL', 'cocos2d::ui::RichText::VALUE_TEXT_LINE_DEL', 'const std::string')
.const('VALUE_TEXT_LINE_UNDER', 'cocos2d::ui::RichText::VALUE_TEXT_LINE_UNDER', 'const std::string')
.const('KEY_TEXT_STYLE', 'cocos2d::ui::RichText::KEY_TEXT_STYLE', 'const std::string')
.const('VALUE_TEXT_STYLE_NONE', 'cocos2d::ui::RichText::VALUE_TEXT_STYLE_NONE', 'const std::string')
.const('VALUE_TEXT_STYLE_OUTLINE', 'cocos2d::ui::RichText::VALUE_TEXT_STYLE_OUTLINE', 'const std::string')
.const('VALUE_TEXT_STYLE_SHADOW', 'cocos2d::ui::RichText::VALUE_TEXT_STYLE_SHADOW', 'const std::string')
.const('VALUE_TEXT_STYLE_GLOW', 'cocos2d::ui::RichText::VALUE_TEXT_STYLE_GLOW', 'const std::string')
.const('KEY_TEXT_OUTLINE_COLOR', 'cocos2d::ui::RichText::KEY_TEXT_OUTLINE_COLOR', 'const std::string')
.const('KEY_TEXT_OUTLINE_SIZE', 'cocos2d::ui::RichText::KEY_TEXT_OUTLINE_SIZE', 'const std::string')
.const('KEY_TEXT_SHADOW_COLOR', 'cocos2d::ui::RichText::KEY_TEXT_SHADOW_COLOR', 'const std::string')
.const('KEY_TEXT_SHADOW_OFFSET_WIDTH', 'cocos2d::ui::RichText::KEY_TEXT_SHADOW_OFFSET_WIDTH', 'const std::string')
.const('KEY_TEXT_SHADOW_OFFSET_HEIGHT', 'cocos2d::ui::RichText::KEY_TEXT_SHADOW_OFFSET_HEIGHT', 'const std::string')
.const('KEY_TEXT_SHADOW_BLUR_RADIUS', 'cocos2d::ui::RichText::KEY_TEXT_SHADOW_BLUR_RADIUS', 'const std::string')
.const('KEY_TEXT_GLOW_COLOR', 'cocos2d::ui::RichText::KEY_TEXT_GLOW_COLOR', 'const std::string')
.const('KEY_URL', 'cocos2d::ui::RichText::KEY_URL', 'const std::string')
.const('KEY_ANCHOR_FONT_COLOR_STRING', 'cocos2d::ui::RichText::KEY_ANCHOR_FONT_COLOR_STRING', 'const std::string')
.const('KEY_ANCHOR_TEXT_BOLD', 'cocos2d::ui::RichText::KEY_ANCHOR_TEXT_BOLD', 'const std::string')
.const('KEY_ANCHOR_TEXT_ITALIC', 'cocos2d::ui::RichText::KEY_ANCHOR_TEXT_ITALIC', 'const std::string')
.const('KEY_ANCHOR_TEXT_LINE', 'cocos2d::ui::RichText::KEY_ANCHOR_TEXT_LINE', 'const std::string')
.const('KEY_ANCHOR_TEXT_STYLE', 'cocos2d::ui::RichText::KEY_ANCHOR_TEXT_STYLE', 'const std::string')
.const('KEY_ANCHOR_TEXT_OUTLINE_COLOR', 'cocos2d::ui::RichText::KEY_ANCHOR_TEXT_OUTLINE_COLOR', 'const std::string')
.const('KEY_ANCHOR_TEXT_OUTLINE_SIZE', 'cocos2d::ui::RichText::KEY_ANCHOR_TEXT_OUTLINE_SIZE', 'const std::string')
.const('KEY_ANCHOR_TEXT_SHADOW_COLOR', 'cocos2d::ui::RichText::KEY_ANCHOR_TEXT_SHADOW_COLOR', 'const std::string')
.const('KEY_ANCHOR_TEXT_SHADOW_OFFSET_WIDTH', 'cocos2d::ui::RichText::KEY_ANCHOR_TEXT_SHADOW_OFFSET_WIDTH', 'const std::string')
.const('KEY_ANCHOR_TEXT_SHADOW_OFFSET_HEIGHT', 'cocos2d::ui::RichText::KEY_ANCHOR_TEXT_SHADOW_OFFSET_HEIGHT', 'const std::string')
.const('KEY_ANCHOR_TEXT_SHADOW_BLUR_RADIUS', 'cocos2d::ui::RichText::KEY_ANCHOR_TEXT_SHADOW_BLUR_RADIUS', 'const std::string')
.const('KEY_ANCHOR_TEXT_GLOW_COLOR', 'cocos2d::ui::RichText::KEY_ANCHOR_TEXT_GLOW_COLOR', 'const std::string')
.func(nil, 'RichText()')
.func(nil, 'static cocos2d::ui::RichText *create()')
.func(nil, 'void insertElement(cocos2d::ui::RichElement *element, int index)')
.func(nil, 'void pushBackElement(cocos2d::ui::RichElement *element)')
.func(nil, 'void removeElement(int index)', 'void removeElement(cocos2d::ui::RichElement *element)')
.func(nil, 'void setVerticalSpace(float space)')
.func(nil, 'void formatText()')
.func(nil, 'void setWrapMode(cocos2d::ui::RichText::WrapMode wrapMode)')
.func(nil, 'cocos2d::ui::RichText::WrapMode getWrapMode()')
.func(nil, 'void setHorizontalAlignment(cocos2d::ui::RichText::HorizontalAlignment a)')
.func(nil, 'cocos2d::ui::RichText::HorizontalAlignment getHorizontalAlignment()')
.func(nil, 'void setFontColor(const std::string &color)')
.func(nil, 'std::string getFontColor()')
.func(nil, 'cocos2d::Color3B getFontColor3B()')
.func(nil, 'void setFontSize(float size)')
.func(nil, 'float getFontSize()')
.func(nil, 'void setFontFace(const std::string &face)')
.func(nil, 'std::string getFontFace()')
.func(nil, 'void setAnchorFontColor(const std::string &color)')
.func(nil, 'std::string getAnchorFontColor()')
.func(nil, 'cocos2d::Color3B getAnchorFontColor3B()')
.func(nil, 'void setAnchorTextBold(bool enable)')
.func(nil, 'bool isAnchorTextBoldEnabled()')
.func(nil, 'void setAnchorTextItalic(bool enable)')
.func(nil, 'bool isAnchorTextItalicEnabled()')
.func(nil, 'void setAnchorTextDel(bool enable)')
.func(nil, 'bool isAnchorTextDelEnabled()')
.func(nil, 'void setAnchorTextUnderline(bool enable)')
.func(nil, 'bool isAnchorTextUnderlineEnabled()')
.func(nil, 'void setAnchorTextOutline(bool enable, @optional const cocos2d::Color3B &outlineColor, @optional int outlineSize)')
.func(nil, 'bool isAnchorTextOutlineEnabled()')
.func(nil, 'cocos2d::Color3B getAnchorTextOutlineColor3B()')
.func(nil, 'int getAnchorTextOutlineSize()')
.func(nil, 'void setAnchorTextShadow(bool enable, @optional const cocos2d::Color3B &shadowColor, @optional const cocos2d::Size &offset, @optional int blurRadius)')
.func(nil, 'bool isAnchorTextShadowEnabled()')
.func(nil, 'cocos2d::Color3B getAnchorTextShadowColor3B()')
.func(nil, 'cocos2d::Size getAnchorTextShadowOffset()')
.func(nil, 'int getAnchorTextShadowBlurRadius()')
.func(nil, 'void setAnchorTextGlow(bool enable, @optional const cocos2d::Color3B &glowColor)')
.func(nil, 'bool isAnchorTextGlowEnabled()')
.func(nil, 'cocos2d::Color3B getAnchorTextGlowColor3B()')
.func(nil, 'void setDefaults(const cocos2d::ValueMap &defaults)')
.func(nil, 'cocos2d::ValueMap getDefaults()')
.func(nil, 'cocos2d::Color3B color3BWithString(const std::string &color)')
.func(nil, 'std::string stringWithColor3B(const cocos2d::Color3B &color3b)')
.func(nil, 'std::string stringWithColor4B(const cocos2d::Color4B &color4b)')
.func(nil, 'static void removeTagDescription(const std::string &tag)')
.func(nil, 'void openUrl(const std::string &url)')
.callback {
funcs = {
'static cocos2d::ui::RichText *createWithXML(const std::string &xml, @optional const cocos2d::ValueMap &defaults, @localvar @optional const cocos2d::ui::RichText::OpenUrlHandler &handleOpenUrl)'
},
tag_maker = 'OpenUrlHandler',
tag_mode = 'replace',
tag_store = -1,
tag_scope = 'object',
}
.callback {
funcs = {
'void setOpenUrlHandler(@localvar const cocos2d::ui::RichText::OpenUrlHandler &handleOpenUrl)'
},
tag_maker = 'OpenUrlHandler',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.prop('wrapMode', nil, nil)
.prop('horizontalAlignment', nil, nil)
.prop('fontColor', nil, nil)
.prop('fontColor3B', nil, nil)
.prop('fontSize', nil, nil)
.prop('fontFace', nil, nil)
.prop('anchorFontColor', nil, nil)
.prop('anchorFontColor3B', nil, nil)
.prop('anchorTextBoldEnabled', nil, nil)
.prop('anchorTextItalicEnabled', nil, nil)
.prop('anchorTextDelEnabled', nil, nil)
.prop('anchorTextUnderlineEnabled', nil, nil)
.prop('anchorTextOutlineEnabled', nil, nil)
.prop('anchorTextOutlineColor3B', nil, nil)
.prop('anchorTextOutlineSize', nil, nil)
.prop('anchorTextShadowEnabled', nil, nil)
.prop('anchorTextShadowColor3B', nil, nil)
.prop('anchorTextShadowOffset', nil, nil)
.prop('anchorTextShadowBlurRadius', nil, nil)
.prop('anchorTextGlowEnabled', nil, nil)
.prop('anchorTextGlowColor3B', nil, nil)
.prop('defaults', nil, nil)
typeconf 'cocos2d::ui::ScrollViewBar'
.supercls('cocos2d::ProtectedNode')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'ScrollViewBar(cocos2d::ui::ScrollView *parent, cocos2d::ui::ScrollView::Direction direction)')
.func(nil, 'static cocos2d::ui::ScrollViewBar *create(cocos2d::ui::ScrollView *parent, cocos2d::ui::ScrollView::Direction direction)')
.func(nil, 'void setPositionFromCorner(const cocos2d::Vec2 &positionFromCorner)')
.func(nil, 'cocos2d::Vec2 getPositionFromCorner()')
.func(nil, 'void setWidth(float width)')
.func(nil, 'float getWidth()')
.func(nil, 'void setAutoHideEnabled(bool autoHideEnabled)')
.func(nil, 'bool isAutoHideEnabled()')
.func(nil, 'void setAutoHideTime(float autoHideTime)')
.func(nil, 'float getAutoHideTime()')
.func(nil, 'void onScrolled(const cocos2d::Vec2 &outOfBoundary)')
.func(nil, 'void onTouchBegan()')
.func(nil, 'void onTouchEnded()')
.prop('positionFromCorner', nil, nil)
.prop('width', nil, nil)
.prop('autoHideEnabled', nil, nil)
.prop('autoHideTime', nil, nil)
typeconf 'cocos2d::ui::Slider::EventType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('ON_PERCENTAGE_CHANGED', 'cocos2d::ui::Slider::EventType::ON_PERCENTAGE_CHANGED')
.enum('ON_SLIDEBALL_DOWN', 'cocos2d::ui::Slider::EventType::ON_SLIDEBALL_DOWN')
.enum('ON_SLIDEBALL_UP', 'cocos2d::ui::Slider::EventType::ON_SLIDEBALL_UP')
.enum('ON_SLIDEBALL_CANCEL', 'cocos2d::ui::Slider::EventType::ON_SLIDEBALL_CANCEL')
typeconf 'cocos2d::ui::Slider::ccSliderCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
typeconf 'cocos2d::ui::Slider'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'Slider()')
.func(nil, 'static cocos2d::ui::Slider *create()', 'static cocos2d::ui::Slider *create(const std::string &barTextureName, const std::string &normalBallTextureName, @optional cocos2d::ui::Widget::TextureResType resType)')
.func(nil, 'void loadBarTexture(const std::string &fileName, @optional cocos2d::ui::Widget::TextureResType resType)')
.func(nil, 'void setScale9Enabled(bool able)')
.func(nil, 'bool isScale9Enabled()')
.func(nil, 'void setCapInsets(const cocos2d::Rect &capInsets)')
.func(nil, 'void setCapInsetsBarRenderer(const cocos2d::Rect &capInsets)')
.func(nil, 'const cocos2d::Rect &getCapInsetsBarRenderer()')
.func(nil, 'void setCapInsetProgressBarRenderer(const cocos2d::Rect &capInsets)')
.func(nil, 'const cocos2d::Rect &getCapInsetsProgressBarRenderer()')
.func(nil, 'void loadSlidBallTextures(const std::string &normal, @optional const std::string &pressed, @optional const std::string &disabled, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadSlidBallTextureNormal(const std::string &normal, @optional cocos2d::ui::Widget::TextureResType resType)')
.func(nil, 'void loadSlidBallTexturePressed(const std::string &pressed, @optional cocos2d::ui::Widget::TextureResType resType)')
.func(nil, 'void loadSlidBallTextureDisabled(const std::string &disabled, @optional cocos2d::ui::Widget::TextureResType resType)')
.func(nil, 'void loadProgressBarTexture(const std::string &fileName, @optional cocos2d::ui::Widget::TextureResType resType)')
.func(nil, 'void setPercent(int percent)')
.func(nil, 'void updateVisualSlider()')
.func(nil, 'int getPercent()')
.func(nil, 'void setMaxPercent(int percent)')
.func(nil, 'int getMaxPercent()')
.func(nil, 'void setZoomScale(float scale)')
.func(nil, 'float getZoomScale()')
.func(nil, '@addref(protectedChildren |) cocos2d::Sprite *getSlidBallNormalRenderer()')
.func(nil, '@addref(protectedChildren |) cocos2d::Sprite *getSlidBallPressedRenderer()')
.func(nil, '@addref(protectedChildren |) cocos2d::Sprite *getSlidBallDisabledRenderer()')
.func(nil, '@addref(protectedChildren |) cocos2d::Node *getSlidBallRenderer()')
.func(nil, 'cocos2d::ResourceData getBackFile()')
.func(nil, 'cocos2d::ResourceData getProgressBarFile()')
.func(nil, 'cocos2d::ResourceData getBallNormalFile()')
.func(nil, 'cocos2d::ResourceData getBallPressedFile()')
.func(nil, 'cocos2d::ResourceData getBallDisabledFile()')
.callback {
funcs = {
'void addEventListener(const cocos2d::ui::Slider::ccSliderCallback &callback)'
},
tag_maker = 'sliderCallback',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.prop('scale9Enabled', nil, nil)
.prop('capInsetsBarRenderer', nil, nil)
.prop('capInsetsProgressBarRenderer', nil, nil)
.prop('percent', nil, nil)
.prop('maxPercent', nil, nil)
.prop('zoomScale', nil, nil)
.prop('slidBallNormalRenderer', nil, nil)
.prop('slidBallPressedRenderer', nil, nil)
.prop('slidBallDisabledRenderer', nil, nil)
.prop('slidBallRenderer', nil, nil)
.prop('backFile', nil, nil)
.prop('progressBarFile', nil, nil)
.prop('ballNormalFile', nil, nil)
.prop('ballPressedFile', nil, nil)
.prop('ballDisabledFile', nil, nil)
typeconf 'cocos2d::ui::Text::Type'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('SYSTEM', 'cocos2d::ui::Text::Type::SYSTEM')
.enum('TTF', 'cocos2d::ui::Text::Type::TTF')
typeconf 'cocos2d::ui::Text'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'Text()')
.func(nil, 'static cocos2d::ui::Text *create()', 'static cocos2d::ui::Text *create(const std::string &textContent, const std::string &fontName, float fontSize)')
.func(nil, 'void setString(const std::string &text)')
.func(nil, 'const std::string &getString()')
.func(nil, 'ssize_t getStringLength()')
.func(nil, 'void setFontSize(float size)')
.func(nil, 'float getFontSize()')
.func(nil, 'void setFontName(const std::string &name)')
.func(nil, 'const std::string &getFontName()')
.func(nil, 'cocos2d::ui::Text::Type getType()')
.func(nil, 'void setTouchScaleChangeEnabled(bool enabled)')
.func(nil, 'bool isTouchScaleChangeEnabled()')
.func(nil, 'cocos2d::Size getAutoRenderSize()')
.func(nil, 'void setTextAreaSize(const cocos2d::Size &size)')
.func(nil, 'const cocos2d::Size &getTextAreaSize()')
.func(nil, 'void setTextHorizontalAlignment(cocos2d::TextHAlignment alignment)')
.func(nil, 'cocos2d::TextHAlignment getTextHorizontalAlignment()')
.func(nil, 'void setTextVerticalAlignment(cocos2d::TextVAlignment alignment)')
.func(nil, 'cocos2d::TextVAlignment getTextVerticalAlignment()')
.func(nil, 'void setTextColor(const cocos2d::Color4B color)')
.func(nil, 'const cocos2d::Color4B &getTextColor()')
.func(nil, 'void enableShadow(@optional const cocos2d::Color4B &shadowColor, @optional const cocos2d::Size &offset, @optional int blurRadius)')
.func(nil, 'void enableOutline(const cocos2d::Color4B &outlineColor, @optional int outlineSize)')
.func(nil, 'void enableGlow(const cocos2d::Color4B &glowColor)')
.func(nil, 'void disableEffect()', 'void disableEffect(cocos2d::LabelEffect effect)')
.func(nil, 'bool isShadowEnabled()')
.func(nil, 'cocos2d::Size getShadowOffset()')
.func(nil, 'float getShadowBlurRadius()')
.func(nil, 'cocos2d::Color4B getShadowColor()')
.func(nil, 'int getOutlineSize()')
.func(nil, 'cocos2d::LabelEffect getLabelEffectType()')
.func(nil, 'cocos2d::Color4B getEffectColor()')
.func(nil, 'cocos2d::Sprite *getLetter(int lettetIndex)')
.func(nil, 'void setBlendFunc(const cocos2d::BlendFunc &blendFunc)')
.func(nil, 'const cocos2d::BlendFunc &getBlendFunc()')
.func(nil, '@using bool init()', 'bool init(const std::string &textContent, const std::string &fontName, float fontSize)')
.prop('string', nil, nil)
.prop('stringLength', nil, nil)
.prop('fontSize', nil, nil)
.prop('fontName', nil, nil)
.prop('type', nil, nil)
.prop('touchScaleChangeEnabled', nil, nil)
.prop('autoRenderSize', nil, nil)
.prop('textAreaSize', nil, nil)
.prop('textHorizontalAlignment', nil, nil)
.prop('textVerticalAlignment', nil, nil)
.prop('textColor', nil, nil)
.prop('shadowEnabled', nil, nil)
.prop('shadowOffset', nil, nil)
.prop('shadowBlurRadius', nil, nil)
.prop('shadowColor', nil, nil)
.prop('outlineSize', nil, nil)
.prop('labelEffectType', nil, nil)
.prop('effectColor', nil, nil)
.prop('blendFunc', nil, nil)
typeconf 'cocos2d::ui::TextAtlas'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'TextAtlas()')
.func(nil, 'static cocos2d::ui::TextAtlas *create()', 'static cocos2d::ui::TextAtlas *create(const std::string &stringValue, const std::string &charMapFile, int itemWidth, int itemHeight, const std::string &startCharMap)')
.func(nil, 'void setProperty(const std::string &stringValue, const std::string &charMapFile, int itemWidth, int itemHeight, const std::string &startCharMap)')
.func(nil, 'void setString(const std::string &value)')
.func(nil, 'const std::string &getString()')
.func(nil, 'ssize_t getStringLength()')
.func(nil, 'void adaptRenderers()')
.func(nil, 'cocos2d::ResourceData getRenderFile()')
.prop('string', nil, nil)
.prop('stringLength', nil, nil)
.prop('renderFile', nil, nil)
typeconf 'cocos2d::ui::TextBMFont'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'TextBMFont()')
.func(nil, 'static cocos2d::ui::TextBMFont *create()', 'static cocos2d::ui::TextBMFont *create(const std::string &text, const std::string &filename)')
.func(nil, 'void setFntFile(const std::string &fileName)')
.func(nil, 'void setString(const std::string &value)')
.func(nil, 'const std::string &getString()')
.func(nil, 'ssize_t getStringLength()')
.func(nil, 'cocos2d::ResourceData getRenderFile()')
.func(nil, 'void resetRender()')
.prop('string', nil, nil)
.prop('stringLength', nil, nil)
.prop('renderFile', nil, nil)
typeconf 'cocos2d::ui::UICCTextField'
.supercls('cocos2d::TextFieldTTF')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::ui::UICCTextField *create()', 'static cocos2d::ui::UICCTextField *create(const std::string &placeholder, const std::string &fontName, float fontSize)')
.func(nil, 'UICCTextField()')
.func(nil, 'bool onTextFieldAttachWithIME(cocos2d::TextFieldTTF *pSender)')
.func(nil, 'bool onTextFieldDetachWithIME(cocos2d::TextFieldTTF *pSender)')
.func(nil, 'bool onTextFieldInsertText(cocos2d::TextFieldTTF *pSender, const char *text, size_t nLen)')
.func(nil, 'bool onTextFieldDeleteBackward(cocos2d::TextFieldTTF *pSender, const char *delText, size_t nLen)')
.func(nil, 'void insertText(const char *text, size_t len)')
.func(nil, 'void openIME()')
.func(nil, 'void closeIME()')
.func(nil, 'void setMaxLengthEnabled(bool enable)')
.func(nil, 'bool isMaxLengthEnabled()')
.func(nil, 'void setMaxLength(int length)')
.func(nil, 'int getMaxLength()')
.func(nil, 'void setPasswordEnabled(bool enable)')
.func(nil, 'bool isPasswordEnabled()')
.func(nil, 'void setPasswordStyleText(const std::string &styleText)')
.func(nil, 'void setPasswordText(const std::string &text)')
.func(nil, 'void setAttachWithIME(bool attach)')
.func(nil, 'bool getAttachWithIME()')
.func(nil, 'void setDetachWithIME(bool detach)')
.func(nil, 'bool getDetachWithIME()')
.func(nil, 'void setInsertText(bool insert)')
.func(nil, 'bool getInsertText()')
.func(nil, 'void setDeleteBackward(bool deleteBackward)')
.func(nil, 'bool getDeleteBackward()')
.prop('maxLengthEnabled', nil, nil)
.prop('maxLength', nil, nil)
.prop('passwordEnabled', nil, nil)
.prop('attachWithIME', nil, nil)
.prop('detachWithIME', nil, nil)
.prop('insertText', nil, nil)
.prop('deleteBackward', nil, nil)
typeconf 'cocos2d::ui::TextField::EventType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('ATTACH_WITH_IME', 'cocos2d::ui::TextField::EventType::ATTACH_WITH_IME')
.enum('DETACH_WITH_IME', 'cocos2d::ui::TextField::EventType::DETACH_WITH_IME')
.enum('INSERT_TEXT', 'cocos2d::ui::TextField::EventType::INSERT_TEXT')
.enum('DELETE_BACKWARD', 'cocos2d::ui::TextField::EventType::DELETE_BACKWARD')
typeconf 'cocos2d::ui::TextField::ccTextFieldCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
typeconf 'cocos2d::ui::TextField'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'TextField()')
.func(nil, 'static cocos2d::ui::TextField *create()', 'static cocos2d::ui::TextField *create(const std::string &placeholder, const std::string &fontName, int fontSize)')
.func(nil, 'void setTouchSize(const cocos2d::Size &size)')
.func(nil, 'cocos2d::Size getTouchSize()')
.func(nil, 'void setTouchAreaEnabled(bool enable)')
.func(nil, 'void setPlaceHolder(const std::string &value)')
.func(nil, 'const std::string &getPlaceHolder()')
.func(nil, 'const cocos2d::Color4B &getPlaceHolderColor()')
.func(nil, 'void setPlaceHolderColor(const cocos2d::Color3B &color)', 'void setPlaceHolderColor(const cocos2d::Color4B &color)')
.func(nil, 'const cocos2d::Color4B &getTextColor()')
.func(nil, 'void setTextColor(const cocos2d::Color4B &textColor)')
.func(nil, 'void setFontSize(int size)')
.func(nil, 'int getFontSize()')
.func(nil, 'void setFontName(const std::string &name)')
.func(nil, 'const std::string &getFontName()')
.func(nil, 'void didNotSelectSelf()')
.func(nil, 'void setString(const std::string &text)')
.func(nil, 'const std::string &getString()')
.func(nil, 'void setMaxLengthEnabled(bool enable)')
.func(nil, 'bool isMaxLengthEnabled()')
.func(nil, 'void setMaxLength(int length)')
.func(nil, 'int getMaxLength()')
.func(nil, 'int getStringLength()')
.func(nil, 'void setPasswordEnabled(bool enable)')
.func(nil, 'bool isPasswordEnabled()')
.func(nil, 'void setPasswordStyleText(const char *styleText)')
.func(nil, 'const char *getPasswordStyleText()')
.func(nil, 'bool getAttachWithIME()')
.func(nil, 'void setAttachWithIME(bool attach)')
.func(nil, 'bool getDetachWithIME()')
.func(nil, 'void setDetachWithIME(bool detach)')
.func(nil, 'bool getInsertText()')
.func(nil, 'void setInsertText(bool insertText)')
.func(nil, 'bool getDeleteBackward()')
.func(nil, 'void setDeleteBackward(bool deleteBackward)')
.func(nil, 'cocos2d::Size getAutoRenderSize()')
.func(nil, 'void attachWithIME()')
.func(nil, 'void setTextAreaSize(const cocos2d::Size &size)')
.func(nil, 'void setTextHorizontalAlignment(cocos2d::TextHAlignment alignment)')
.func(nil, 'cocos2d::TextHAlignment getTextHorizontalAlignment()')
.func(nil, 'void setTextVerticalAlignment(cocos2d::TextVAlignment alignment)')
.func(nil, 'cocos2d::TextVAlignment getTextVerticalAlignment()')
.func(nil, 'void setCursorEnabled(bool enabled)')
.func(nil, 'void setCursorChar(char cursor)')
.func(nil, 'void setCursorPosition(std::size_t cursorPosition)')
.func(nil, 'void setCursorFromPoint(const cocos2d::Vec2 &point, const cocos2d::Camera *camera)')
.callback {
funcs = {
'void addEventListener(const cocos2d::ui::TextField::ccTextFieldCallback &callback)'
},
tag_maker = 'textFieldCallback',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.prop('touchSize', nil, nil)
.prop('placeHolder', nil, nil)
.prop('placeHolderColor', nil, nil)
.prop('textColor', nil, nil)
.prop('fontSize', nil, nil)
.prop('fontName', nil, nil)
.prop('string', nil, nil)
.prop('maxLengthEnabled', nil, nil)
.prop('maxLength', nil, nil)
.prop('stringLength', nil, nil)
.prop('passwordEnabled', nil, nil)
.prop('passwordStyleText', nil, nil)
.prop('attachWithIME', nil, nil)
.prop('detachWithIME', nil, nil)
.prop('insertText', nil, nil)
.prop('deleteBackward', nil, nil)
.prop('autoRenderSize', nil, nil)
.prop('textHorizontalAlignment', nil, nil)
.prop('textVerticalAlignment', nil, nil)
typeconf 'cocos2d::ui::Button'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'Button()')
.func(nil, 'static cocos2d::ui::Button *create()', 'static cocos2d::ui::Button *create(const std::string &normalImage, @optional const std::string &selectedImage, @optional const std::string &disableImage, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadTextures(const std::string &normal, const std::string &selected, @optional const std::string &disabled, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadTextureNormal(const std::string &normal, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadTexturePressed(const std::string &selected, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadTextureDisabled(const std::string &disabled, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void setCapInsets(const cocos2d::Rect &capInsets)')
.func(nil, 'void setCapInsetsNormalRenderer(const cocos2d::Rect &capInsets)')
.func(nil, 'const cocos2d::Rect &getCapInsetsNormalRenderer()')
.func(nil, 'void setCapInsetsPressedRenderer(const cocos2d::Rect &capInsets)')
.func(nil, 'const cocos2d::Rect &getCapInsetsPressedRenderer()')
.func(nil, 'void setCapInsetsDisabledRenderer(const cocos2d::Rect &capInsets)')
.func(nil, 'const cocos2d::Rect &getCapInsetsDisabledRenderer()')
.func(nil, 'void setScale9Enabled(bool enable)')
.func(nil, 'bool isScale9Enabled()')
.func(nil, 'void setPressedActionEnabled(bool enabled)')
.func(nil, '@addref(protectedChildren |) cocos2d::Label *getTitleRenderer()')
.func(nil, 'void setTitleText(const std::string &text)')
.func(nil, 'std::string getTitleText()')
.func(nil, 'void setTitleColor(const cocos2d::Color3B &color)')
.func(nil, 'cocos2d::Color3B getTitleColor()')
.func(nil, 'void setTitleFontSize(float size)')
.func(nil, 'float getTitleFontSize()')
.func(nil, 'void setTitleFontName(const std::string &fontName)')
.func(nil, 'std::string getTitleFontName()')
.func(nil, 'void setTitleAlignment(cocos2d::TextHAlignment hAlignment)', 'void setTitleAlignment(cocos2d::TextHAlignment hAlignment, cocos2d::TextVAlignment vAlignment)')
.func(nil, 'void setTitleLabel(@addref(protectedChildren |) cocos2d::Label *label)')
.func(nil, '@addref(protectedChildren |) cocos2d::Label *getTitleLabel()')
.func(nil, 'void setZoomScale(float scale)')
.func(nil, 'float getZoomScale()')
.func(nil, '@addref(protectedChildren |) cocos2d::ui::Scale9Sprite *getRendererNormal()')
.func(nil, '@addref(protectedChildren |) cocos2d::ui::Scale9Sprite *getRendererClicked()')
.func(nil, '@addref(protectedChildren |) cocos2d::ui::Scale9Sprite *getRendererDisabled()')
.func(nil, 'void resetNormalRender()')
.func(nil, 'void resetPressedRender()')
.func(nil, 'void resetDisabledRender()')
.func(nil, 'cocos2d::ResourceData getNormalFile()')
.func(nil, 'cocos2d::ResourceData getPressedFile()')
.func(nil, 'cocos2d::ResourceData getDisabledFile()')
.func(nil, '@using bool init()', 'bool init(const std::string &normalImage, @optional const std::string &selectedImage, @optional const std::string &disableImage, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'cocos2d::Size getNormalTextureSize()')
.prop('capInsetsNormalRenderer', nil, nil)
.prop('capInsetsPressedRenderer', nil, nil)
.prop('capInsetsDisabledRenderer', nil, nil)
.prop('scale9Enabled', nil, nil)
.prop('titleRenderer', nil, nil)
.prop('titleText', nil, nil)
.prop('titleColor', nil, nil)
.prop('titleFontSize', nil, nil)
.prop('titleFontName', nil, nil)
.prop('titleLabel', nil, nil)
.prop('zoomScale', nil, nil)
.prop('rendererNormal', nil, nil)
.prop('rendererClicked', nil, nil)
.prop('rendererDisabled', nil, nil)
.prop('normalFile', nil, nil)
.prop('pressedFile', nil, nil)
.prop('disabledFile', nil, nil)
.prop('normalTextureSize', nil, nil)
typeconf 'cocos2d::ui::CheckBox::EventType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('SELECTED', 'cocos2d::ui::CheckBox::EventType::SELECTED')
.enum('UNSELECTED', 'cocos2d::ui::CheckBox::EventType::UNSELECTED')
typeconf 'cocos2d::ui::CheckBox::ccCheckBoxCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
typeconf 'cocos2d::ui::CheckBox'
.supercls('cocos2d::ui::AbstractCheckButton')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'CheckBox()')
.func(nil, 'static cocos2d::ui::CheckBox *create()', 'static cocos2d::ui::CheckBox *create(const std::string &backGround, const std::string &backGroundSelected, const std::string &cross, const std::string &backGroundDisabled, const std::string &frontCrossDisabled, @optional cocos2d::ui::Widget::TextureResType texType)', 'static cocos2d::ui::CheckBox *create(const std::string &backGround, const std::string &cross, @optional cocos2d::ui::Widget::TextureResType texType)')
.callback {
funcs = {
'void addEventListener(const cocos2d::ui::CheckBox::ccCheckBoxCallback &callback)'
},
tag_maker = 'checkBoxCallback',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
typeconf 'cocos2d::ui::RadioButton::EventType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('SELECTED', 'cocos2d::ui::RadioButton::EventType::SELECTED')
.enum('UNSELECTED', 'cocos2d::ui::RadioButton::EventType::UNSELECTED')
typeconf 'cocos2d::ui::RadioButton::ccRadioButtonCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
typeconf 'cocos2d::ui::RadioButton'
.supercls('cocos2d::ui::AbstractCheckButton')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'RadioButton()')
.func(nil, 'static cocos2d::ui::RadioButton *create()', 'static cocos2d::ui::RadioButton *create(const std::string &backGround, const std::string &backGroundSelected, const std::string &cross, const std::string &backGroundDisabled, const std::string &frontCrossDisabled, @optional cocos2d::ui::Widget::TextureResType texType)', 'static cocos2d::ui::RadioButton *create(const std::string &backGround, const std::string &cross, @optional cocos2d::ui::Widget::TextureResType texType)')
.callback {
funcs = {
'void addEventListener(const cocos2d::ui::RadioButton::ccRadioButtonCallback &callback)'
},
tag_maker = 'radioButtonCallback',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
typeconf 'cocos2d::ui::RadioButtonGroup::EventType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('SELECT_CHANGED', 'cocos2d::ui::RadioButtonGroup::EventType::SELECT_CHANGED')
typeconf 'cocos2d::ui::RadioButtonGroup::ccRadioButtonGroupCallback'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
typeconf 'cocos2d::ui::RadioButtonGroup'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'RadioButtonGroup()')
.func(nil, 'static cocos2d::ui::RadioButtonGroup *create()')
.func(nil, 'int getSelectedButtonIndex()')
.func(nil, 'void setSelectedButton(int index)', 'void setSelectedButton(cocos2d::ui::RadioButton *radioButton)')
.func(nil, 'void setSelectedButtonWithoutEvent(int index)', 'void setSelectedButtonWithoutEvent(cocos2d::ui::RadioButton *radioButton)')
.func(nil, 'void addRadioButton(cocos2d::ui::RadioButton *radioButton)')
.func(nil, 'void removeRadioButton(cocos2d::ui::RadioButton *radioButton)')
.func(nil, 'void removeAllRadioButtons()')
.func(nil, 'ssize_t getNumberOfRadioButtons()')
.func(nil, 'cocos2d::ui::RadioButton *getRadioButtonByIndex(int index)')
.func(nil, 'void setAllowedNoSelection(bool allowedNoSelection)')
.func(nil, 'bool isAllowedNoSelection()')
.callback {
funcs = {
'void addEventListener(const cocos2d::ui::RadioButtonGroup::ccRadioButtonGroupCallback &callback)'
},
tag_maker = 'radioButtonCallback',
tag_mode = 'replace',
tag_store = 0,
tag_scope = 'object',
}
.prop('selectedButtonIndex', nil, nil)
.prop('numberOfRadioButtons', nil, nil)
.prop('allowedNoSelection', nil, nil)
typeconf 'cocos2d::ui::ImageView'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::Ref *createInstance()')
.func(nil, 'ImageView()')
.func(nil, 'static cocos2d::ui::ImageView *create()', 'static cocos2d::ui::ImageView *create(const std::string &imageFileName, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadTexture(const std::string &fileName, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void setTextureRect(const cocos2d::Rect &rect)')
.func(nil, 'void setScale9Enabled(bool enabled)')
.func(nil, 'bool isScale9Enabled()')
.func(nil, 'void setCapInsets(const cocos2d::Rect &capInsets)')
.func(nil, 'const cocos2d::Rect &getCapInsets()')
.func(nil, 'void setBlendFunc(const cocos2d::BlendFunc &blendFunc)')
.func(nil, 'const cocos2d::BlendFunc &getBlendFunc()')
.func(nil, 'cocos2d::ResourceData getRenderFile()')
.func(nil, '@using bool init()', 'bool init(const std::string &imageFileName, @optional cocos2d::ui::Widget::TextureResType texType)')
.prop('scale9Enabled', nil, nil)
.prop('capInsets', nil, nil)
.prop('blendFunc', nil, nil)
.prop('renderFile', nil, nil)
typeconf 'cocos2d::ui::EditBoxDelegate::EditBoxEndAction'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('UNKNOWN', 'cocos2d::ui::EditBoxDelegate::EditBoxEndAction::UNKNOWN')
.enum('TAB_TO_NEXT', 'cocos2d::ui::EditBoxDelegate::EditBoxEndAction::TAB_TO_NEXT')
.enum('TAB_TO_PREVIOUS', 'cocos2d::ui::EditBoxDelegate::EditBoxEndAction::TAB_TO_PREVIOUS')
.enum('RETURN', 'cocos2d::ui::EditBoxDelegate::EditBoxEndAction::RETURN')
typeconf 'cocos2d::ui::EditBoxDelegate'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'void editBoxEditingDidBegin(cocos2d::ui::EditBox *)')
.func(nil, 'void editBoxTextChanged(cocos2d::ui::EditBox *, const std::string &)')
.func(nil, 'void editBoxReturn(cocos2d::ui::EditBox *editBox)')
.func(nil, 'void editBoxEditingDidEndWithAction(cocos2d::ui::EditBox *, cocos2d::ui::EditBoxDelegate::EditBoxEndAction )')
typeconf 'cocos2d::ui::LuaEditBoxDelegate'
.supercls('cocos2d::ui::EditBoxDelegate')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'LuaEditBoxDelegate()')
.var('onEditingDidBegin', '@nullable @localvar std::function<void (cocos2d::ui::EditBox *)> onEditingDidBegin')
.var('onTextChanged', '@nullable @localvar std::function<void (cocos2d::ui::EditBox *, const std::string &)> onTextChanged')
.var('onReturn', '@nullable @localvar std::function<void (cocos2d::ui::EditBox *)> onReturn')
.var('onEditingDidEndWithAction', '@nullable @localvar std::function<void (cocos2d::ui::EditBox *, EditBoxDelegate::EditBoxEndAction)> onEditingDidEndWithAction')
typeconf 'cocos2d::ui::EditBox::KeyboardReturnType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('DEFAULT', 'cocos2d::ui::EditBox::KeyboardReturnType::DEFAULT')
.enum('DONE', 'cocos2d::ui::EditBox::KeyboardReturnType::DONE')
.enum('SEND', 'cocos2d::ui::EditBox::KeyboardReturnType::SEND')
.enum('SEARCH', 'cocos2d::ui::EditBox::KeyboardReturnType::SEARCH')
.enum('GO', 'cocos2d::ui::EditBox::KeyboardReturnType::GO')
.enum('NEXT', 'cocos2d::ui::EditBox::KeyboardReturnType::NEXT')
typeconf 'cocos2d::ui::EditBox::InputMode'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('ANY', 'cocos2d::ui::EditBox::InputMode::ANY')
.enum('EMAIL_ADDRESS', 'cocos2d::ui::EditBox::InputMode::EMAIL_ADDRESS')
.enum('NUMERIC', 'cocos2d::ui::EditBox::InputMode::NUMERIC')
.enum('PHONE_NUMBER', 'cocos2d::ui::EditBox::InputMode::PHONE_NUMBER')
.enum('URL', 'cocos2d::ui::EditBox::InputMode::URL')
.enum('DECIMAL', 'cocos2d::ui::EditBox::InputMode::DECIMAL')
.enum('SINGLE_LINE', 'cocos2d::ui::EditBox::InputMode::SINGLE_LINE')
typeconf 'cocos2d::ui::EditBox::InputFlag'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.enum('PASSWORD', 'cocos2d::ui::EditBox::InputFlag::PASSWORD')
.enum('SENSITIVE', 'cocos2d::ui::EditBox::InputFlag::SENSITIVE')
.enum('INITIAL_CAPS_WORD', 'cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_WORD')
.enum('INITIAL_CAPS_SENTENCE', 'cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_SENTENCE')
.enum('INITIAL_CAPS_ALL_CHARACTERS', 'cocos2d::ui::EditBox::InputFlag::INITIAL_CAPS_ALL_CHARACTERS')
.enum('LOWERCASE_ALL_CHARACTERS', 'cocos2d::ui::EditBox::InputFlag::LOWERCASE_ALL_CHARACTERS')
typeconf 'cocos2d::ui::EditBox'
.supercls('cocos2d::ui::Widget')
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.func(nil, 'static cocos2d::ui::EditBox *create(const cocos2d::Size &size, cocos2d::ui::Scale9Sprite *normalSprite, @optional cocos2d::ui::Scale9Sprite *pressedSprite, @optional cocos2d::ui::Scale9Sprite *disabledSprite)', 'static cocos2d::ui::EditBox *create(const cocos2d::Size &size, const std::string &normalImage, cocos2d::ui::Widget::TextureResType texType)', 'static cocos2d::ui::EditBox *create(const cocos2d::Size &size, const std::string &normalImage, @optional const std::string &pressedImage, @optional const std::string &disabledImage, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'EditBox()')
.func(nil, 'bool initWithSizeAndBackgroundSprite(const cocos2d::Size &size, const std::string &normal9SpriteBg, @optional cocos2d::ui::Widget::TextureResType texType)', 'bool initWithSizeAndBackgroundSprite(const cocos2d::Size &size, cocos2d::ui::Scale9Sprite *normal9SpriteBg)', 'bool initWithSizeAndBackgroundSprite(const cocos2d::Size &size, cocos2d::ui::Scale9Sprite *normalSprite, cocos2d::ui::Scale9Sprite *pressedSprite, cocos2d::ui::Scale9Sprite *disabledSprite)')
.func(nil, 'bool initWithSizeAndTexture(const cocos2d::Size &size, const std::string &normalImage, @optional const std::string &pressedImage, @optional const std::string &disabledImage, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadTextures(const std::string &normal, const std::string &pressed, @optional const std::string &disabled, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadTextureNormal(const std::string &normal, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadTexturePressed(const std::string &pressed, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void loadTextureDisabled(const std::string &disabled, @optional cocos2d::ui::Widget::TextureResType texType)')
.func(nil, 'void setCapInsets(const cocos2d::Rect &capInsets)')
.func(nil, 'void setCapInsetsNormalRenderer(const cocos2d::Rect &capInsets)')
.func(nil, 'const cocos2d::Rect &getCapInsetsNormalRenderer()')
.func(nil, 'void setCapInsetsPressedRenderer(const cocos2d::Rect &capInsets)')
.func(nil, 'const cocos2d::Rect &getCapInsetsPressedRenderer()')
.func(nil, 'void setCapInsetsDisabledRenderer(const cocos2d::Rect &capInsets)')
.func(nil, 'const cocos2d::Rect &getCapInsetsDisabledRenderer()')
.func(nil, 'void setDelegate(@addref(delegate ^) cocos2d::ui::EditBoxDelegate *delegate)')
.func(nil, '@addref(delegate ^) cocos2d::ui::EditBoxDelegate *getDelegate()')
.func(nil, 'void setText(const char *pText)')
.func(nil, 'const char *getText()')
.func(nil, 'void setFont(const char *pFontName, int fontSize)')
.func(nil, 'void setFontName(const char *pFontName)')
.func(nil, 'const char *getFontName()')
.func(nil, 'void setFontSize(int fontSize)')
.func(nil, 'int getFontSize()')
.func(nil, 'void setFontColor(const cocos2d::Color3B &color)', 'void setFontColor(const cocos2d::Color4B &color)')
.func(nil, 'const cocos2d::Color4B &getFontColor()')
.func(nil, 'void setPlaceholderFont(const char *pFontName, int fontSize)')
.func(nil, 'void setPlaceholderFontName(const char *pFontName)')
.func(nil, 'const char *getPlaceholderFontName()')
.func(nil, 'void setPlaceholderFontSize(int fontSize)')
.func(nil, 'int getPlaceholderFontSize()')
.func(nil, 'void setPlaceholderFontColor(const cocos2d::Color3B &color)', 'void setPlaceholderFontColor(const cocos2d::Color4B &color)')
.func(nil, 'const cocos2d::Color4B &getPlaceholderFontColor()')
.func(nil, 'void setPlaceHolder(const char *pText)')
.func(nil, 'const char *getPlaceHolder()')
.func(nil, 'void setInputMode(cocos2d::ui::EditBox::InputMode inputMode)')
.func(nil, 'cocos2d::ui::EditBox::InputMode getInputMode()')
.func(nil, 'void setMaxLength(int maxLength)')
.func(nil, 'int getMaxLength()')
.func(nil, 'void setInputFlag(cocos2d::ui::EditBox::InputFlag inputFlag)')
.func(nil, 'cocos2d::ui::EditBox::InputFlag getInputFlag()')
.func(nil, 'void setReturnType(cocos2d::ui::EditBox::KeyboardReturnType returnType)')
.func(nil, 'cocos2d::ui::EditBox::KeyboardReturnType getReturnType()')
.func(nil, 'void setTextHorizontalAlignment(cocos2d::TextHAlignment alignment)')
.func(nil, 'cocos2d::TextHAlignment getTextHorizontalAlignment()')
.func(nil, 'void openKeyboard()')
.prop('capInsetsNormalRenderer', nil, nil)
.prop('capInsetsPressedRenderer', nil, nil)
.prop('capInsetsDisabledRenderer', nil, nil)
.prop('delegate', nil, nil)
.prop('text', nil, nil)
.prop('fontName', nil, nil)
.prop('fontSize', nil, nil)
.prop('fontColor', nil, nil)
.prop('placeholderFontName', nil, nil)
.prop('placeholderFontSize', nil, nil)
.prop('placeholderFontColor', nil, nil)
.prop('placeHolder', nil, nil)
.prop('inputMode', nil, nil)
.prop('maxLength', nil, nil)
.prop('inputFlag', nil, nil)
.prop('returnType', nil, nil)
.prop('textHorizontalAlignment', nil, nil)
|
novaorionTravel3ScreenPlay = ScreenPlay:new {
numberOfActs = 1,
}
registerScreenPlay("novaorionTravel3ScreenPlay", true)
function novaorionTravel3ScreenPlay:start()
if (isZoneEnabled("naboo")) then
self:spawnMobiles()
self:spawnSceneObjects()
end
end
function novaorionTravel3ScreenPlay:spawnSceneObjects()
end
function novaorionTravel3ScreenPlay:spawnMobiles()
local pCollector1 = spawnMobile("naboo", "teleporter", 120, 31.2, 7.9, -8, -90, 1692104)
local collector1 = LuaCreatureObject(pCollector1)
collector1:setOptionsBitmask(264)
collector1:setCustomObjectName("\\#FF0000Travel to Nova Orion Station")
createObserver(OBJECTRADIALUSED, "novaorionTravel3ScreenPlay", "teleportNova", pCollector1)
if (pCollecter1~= nil) then
return
end
end
function novaorionTravel3ScreenPlay:teleportNova(pCollector, pPlayer)--current
local player = LuaSceneObject(pPlayer)
player:switchZone("dungeon2", 59.7, 0.8, -43.1, 14200887)
return 0
end
|
--------------------------------
-- @module Waves
-- @extend Grid3DAction
-- @parent_module cc
--------------------------------
-- brief Set the amplitude rate of the effect.<br>
-- param amplitudeRate The value of amplitude rate will be set.
-- @function [parent=#Waves] setAmplitudeRate
-- @param self
-- @param #float amplitudeRate
-- @return Waves#Waves self (return value: cc.Waves)
--------------------------------
-- brief Initializes the action with amplitude, horizontal sin, vertical sin, grid size, waves count and duration.<br>
-- param duration Specify the duration of the Waves action. It's a value in seconds.<br>
-- param gridSize Specify the size of the grid.<br>
-- param waves Specify the waves count of the Waves action.<br>
-- param amplitude Specify the amplitude of the Waves action.<br>
-- param horizontal Specify whether waves on horizontal.<br>
-- param vertical Specify whether waves on vertical.<br>
-- return If the initialization success, return true; otherwise, return false.
-- @function [parent=#Waves] initWithDuration
-- @param self
-- @param #float duration
-- @param #size_table gridSize
-- @param #unsigned int waves
-- @param #float amplitude
-- @param #bool horizontal
-- @param #bool vertical
-- @return bool#bool ret (return value: bool)
--------------------------------
-- brief Get the amplitude of the effect.<br>
-- return Return the amplitude of the effect.
-- @function [parent=#Waves] getAmplitude
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- brief Get the amplitude rate of the effect.<br>
-- return Return the amplitude rate of the effect.
-- @function [parent=#Waves] getAmplitudeRate
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- brief Set the amplitude to the effect.<br>
-- param amplitude The value of amplitude will be set.
-- @function [parent=#Waves] setAmplitude
-- @param self
-- @param #float amplitude
-- @return Waves#Waves self (return value: cc.Waves)
--------------------------------
-- brief Create the action with amplitude, horizontal sin, vertical sin, grid size, waves count and duration.<br>
-- param duration Specify the duration of the Waves action. It's a value in seconds.<br>
-- param gridSize Specify the size of the grid.<br>
-- param waves Specify the waves count of the Waves action.<br>
-- param amplitude Specify the amplitude of the Waves action.<br>
-- param horizontal Specify whether waves on horizontal.<br>
-- param vertical Specify whether waves on vertical.<br>
-- return If the creation success, return a pointer of Waves action; otherwise, return nil.
-- @function [parent=#Waves] create
-- @param self
-- @param #float duration
-- @param #size_table gridSize
-- @param #unsigned int waves
-- @param #float amplitude
-- @param #bool horizontal
-- @param #bool vertical
-- @return Waves#Waves ret (return value: cc.Waves)
--------------------------------
--
-- @function [parent=#Waves] clone
-- @param self
-- @return Waves#Waves ret (return value: cc.Waves)
--------------------------------
--
-- @function [parent=#Waves] update
-- @param self
-- @param #float time
-- @return Waves#Waves self (return value: cc.Waves)
--------------------------------
--
-- @function [parent=#Waves] Waves
-- @param self
-- @return Waves#Waves self (return value: cc.Waves)
return nil
|
--[[
doc - Dig ore chunk
]]
target_ores = {
'minecraft:coal_ore',
'minecraft:iron_ore',
'minecraft:gold_ore',
'minecraft:lapis_ore',
'minecraft:redstone_ore',
'minecraft:lit_redstone_ore',
'minecraft:diamond_ore',
-- 'minecraft:obsidian',
'minecraft:glowstone',
'minecraft:quartz_ore'
}
is_target_ore = function(tbl_inspect)
local ore_name = tbl_inspect.name
for idx, target_ore_name in pairs(target_ores) do
if ore_name == target_ore_name then
return true
end
end
return false
end
move_forward = function()
while not turtle.forward() do
turtle.dig()
sleep(0.1)
end
end
move_back = function()
if not turtle.back() then
turtle.turnLeft()
turtle.turnLeft()
move_forward()
turtle.turnLeft()
turtle.turnLeft()
end
end
move_up = function()
while not turtle.up() do
turtle.digUp()
sleep(0.1)
end
end
move_down = function()
while not turtle.down() do
turtle.digDown()
sleep(0.1)
end
end
turn_left = function()
turtle.turnLeft()
end
turn_right = function()
turtle.turnRight()
end
is_forward_target_ore = function()
local bool, tbl_inspect
bool, tbl_inspect = turtle.inspect()
return bool and is_target_ore(tbl_inspect)
end
is_up_target_ore = function()
local bool, tbl_inspect
bool, tbl_inspect = turtle.inspectUp()
return bool and is_target_ore(tbl_inspect)
end
is_down_target_ore = function()
local bool, tbl_inspect
bool, tbl_inspect = turtle.inspectDown()
return bool and is_target_ore(tbl_inspect)
end
dig_forward_chunk = function()
if is_forward_target_ore() then
move_forward()
dig_forward_chunk()
dig_up_chunk()
dig_down_chunk()
turn_left()
dig_forward_chunk()
turn_right()
turn_right()
dig_forward_chunk()
turn_left()
move_back()
end
end
dig_up_chunk = function()
if is_up_target_ore() then
move_up()
dig_up_chunk()
dig_forward_chunk()
turn_left()
dig_forward_chunk()
turn_left()
dig_forward_chunk()
turn_left()
dig_forward_chunk()
turn_left()
move_down()
end
end
dig_down_chunk = function()
if is_down_target_ore() then
move_down()
dig_down_chunk()
dig_forward_chunk()
turn_left()
dig_forward_chunk()
turn_left()
dig_forward_chunk()
turn_left()
dig_forward_chunk()
turn_left()
move_up()
end
end
-- main routine
dig_forward_chunk()
dig_up_chunk()
dig_down_chunk()
|
return {
summary = 'Create a new Thread.',
description = 'Creates a new Thread from Lua code.',
arguments = {
code = {
type = 'string',
description = 'The code to run in the Thread.'
},
filename = {
type = 'string',
description = 'A file containing code to run in the Thread.'
},
blob = {
type = 'Blob',
description = 'The code to run in the Thread.'
}
},
returns = {
thread = {
type = 'Thread',
description = 'The new Thread.'
}
},
variants = {
{
arguments = { 'code' },
returns = { 'thread' }
},
{
arguments = { 'filename' },
returns = { 'thread' }
},
{
arguments = { 'blob' },
returns = { 'thread' }
}
},
notes = [[
The Thread won\'t start running immediately. Use `Thread:start` to start it.
The string argument is assumed to be a filename if there isn't a newline in the first 1024
characters. For really short thread code, an extra newline can be added to trick LÖVR into
loading it properly.
]],
related = {
'Thread:start',
'lovr.threaderror'
}
}
|
local state = {}
state._NAME = ...
local Body = require'Body'
local timeout = 10.0
local t_entry, t_update, t_exit
function state.entry()
print(state._NAME..' Entry' )
-- Update the time of entry
local t_entry_prev = t_entry -- When entry was previously called
t_entry = Body.get_time()
t_update = t_entry
--hcm.set_ball_approach(0)
wcm.set_robot_reset_pose(1)
end
function state.update()
local role = gcm.get_game_role()
if role==1 then return 'attacker' end
-- print(state._NAME..' Update' )
-- Get the time of update
local t = Body.get_time()
local dt = t - t_update
-- Save this at the last update time
t_update = t
-- if we see ball right now and ball is far away start moving
local ball_elapsed = t - wcm.get_ball_t()
if ball_elapsed < 0.1 then --ball found
return 'ballfound'
end
end
function state.exit()
print(state._NAME..' Exit' )
t_exit = Body.get_time()
end
return state |
include( "shared.lua" )
local function PermWepsVIPShop( )
local pShop = vgui.Create( "DFrame" )
pShop:SetSize( 400, 400 )
pShop:SetPos( ScrW( )*0.5, ScrH( )*0.5 )
pShop:SetTitle( "PermWeps VIP Shop" )
pShop:SetSizable( true )
pShop:SetDeleteOnClose( false )
pShop:Center( )
pShop:MakePopup( )
local button_height = 100
for k, v in pairs( PermWeps.Shop2 ) do
local BuyButton = vgui.Create( "DButton", pShop )
BuyButton:SetText( v.name .. ": " .. v.price )
BuyButton:SetTextColor( Color( 255, 255, 255 ) )
BuyButton:SetPos( 75, button_height )
BuyButton:SetSize( 100, 30 )
BuyButton.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 41, 128, 185, 250 ) ) -- Draw a blue button
end
BuyButton.DoClick = function( )
net.Start( "BuyVIPPermWep" )
net.WriteEntity( LocalPlayer( ) ) --Should write string and pass local player
net.WriteString( k )
net.SendToServer( )
end
local EquipToggle = vgui.Create( "DButton", pShop )
EquipToggle:SetText( "Equip/ Unequip" )
EquipToggle:SetTextColor( Color( 255, 255, 255 ) )
EquipToggle:SetPos( 225, button_height )
EquipToggle:SetSize( 100, 30 )
EquipToggle.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 41, 128, 185, 250 ) ) -- Draw a blue button
end
EquipToggle.DoClick = function( )
net.Start( "EquipPermWep" )
net.WriteEntity( LocalPlayer( ) ) --Should write string and pass local player
net.WriteString( k )
net.SendToServer( )
end
button_height = button_height + 100
end
chat.AddText( PermWeps.NPC2.ChatColor, PermWeps.NPC2.NPCName .. ": ", Color(255,255,255), PermWeps.NPC2.NPCPhrase )
end
usermessage.Hook( "PermWepsVIPShopUsed", PermWepsVIPShop ) |
local st = require "util.stanza";
local services = module:get_option("external_services");
local xmlns_extdisco_1 = "urn:xmpp:extdisco:1";
local xmlns_extdisco_2 = "urn:xmpp:extdisco:2";
module:add_feature(xmlns_extdisco_1);
module:add_feature(xmlns_extdisco_2);
local function handle_services(event)
local origin, stanza = event.origin, event.stanza;
local service = stanza.tags[1];
local service_type = service.attr.type;
local reply = st.reply(stanza):tag("services", { xmlns = service.attr.xmlns });
for host, service_info in pairs(services) do
if not(service_type) or service_info.type == service_type then
reply:tag("service", {
host = host;
port = service_info.port;
transport = service_info.transport;
type = service_info.type;
username = service_info.username;
password = service_info.password;
}):up();
end
end
origin.send(reply);
return true;
end
module:hook("iq-get/host/"..xmlns_extdisco_1..":services", handle_services);
module:hook("iq-get/host/"..xmlns_extdisco_2..":services", handle_services);
local function handle_credentials(event)
local origin, stanza = event.origin, event.stanza;
local credentials = stanza.tags[1];
local host = credentials.attr.host;
if not host then
origin.send(st.error_reply(stanza, "cancel", "bad-request", "No host specified"));
return true;
end
local service_info = services[host];
if not service_info then
origin.send(st.error_reply(stanza, "cancel", "item-not-found", "No such service known"));
return true;
end
local reply = st.reply(stanza)
:tag("credentials", { xmlns = credentials.attr.xmlns })
:tag("service", {
host = host;
username = service_info.username;
password = service_info.password;
}):up();
origin.send(reply);
return true;
end
module:hook("iq-get/host/"..xmlns_extdisco_1..":credentials", handle_credentials);
module:hook("iq-get/host/"..xmlns_extdisco_2..":credentials", handle_credentials);
|
local require_paths =
{"?.lua", "?/init.lua", "vendor/?.lua", "vendor/?/init.lua"}
love.filesystem.setRequirePath(table.concat(require_paths, ";"))
local tick = require("tick")
local typeutils = require("typeutils")
local window = require("window")
local drawing = require("drawing")
local miscutils = require("miscutils")
local Scene = require("objects.scene")
local Controls = require("objects.controls")
local StatsManager = require("stats.statsmanager")
require("gooi")
require("luatable")
require("compat52")
local screen = nil -- models.Rectangle
local scene = nil -- objects.Scene
local controls = nil -- objects.Controls
local stats_manager = nil -- stats.StatsManager
local function _add_impulse()
scene:add_impulse(screen)
stats_manager:add_impulse()
end
function love.load()
math.randomseed(os.time())
love.setDeprecationOutput(true)
assert(window.enter_fullscreen())
screen = window.create_screen()
drawing.set_font(screen)
scene = Scene:new(screen)
controls = Controls:new(screen, "keys_config.json", _add_impulse)
stats_manager = StatsManager:new("stats-db")
miscutils.repeat_at_intervals(2.5, function()
scene:add_target(screen, function(lifes)
assert(typeutils.is_positive_number(lifes))
stats_manager:hit_target(lifes)
end)
end)
miscutils.repeat_at_intervals(2.5, function() scene:add_hole(screen) end)
end
function love.draw()
scene:draw(screen, controls:center_position())
gooi.draw()
stats_manager:draw(screen)
end
function love.update(dt)
scene:update(screen)
controls:update()
stats_manager:update()
tick.update(dt)
gooi.update(dt)
local player_move_direction_x, player_move_direction_y =
controls:player_move_direction()
scene:control_player(
screen,
player_move_direction_x,
player_move_direction_y,
controls:player_angle_delta()
)
end
function love.resize()
screen = window.create_screen()
drawing.set_font(screen)
miscutils.filter_destroyables({scene, controls}, function() return false end)
scene = Scene:new(screen)
controls = Controls:new(screen, "keys_config.json", _add_impulse)
end
function love.keypressed(key)
if key == "escape" then
love.event.quit()
end
end
function love.mousepressed()
gooi.pressed()
end
function love.mousereleased()
gooi.released()
end
|
--[[FDOC
@id CharaTppDemoPuppet
@category Script Character
@brief Demo人形
]]--
CharaTppDemoPuppet = {
----------------------------------------
--各システムとの依存関係の定義
--
-- GeoやGrなどの各システムのJob実行タイミングを
-- 「キャラクタのJob実行後」に合わせ、
-- システムを正常に動作させるために必要。
-- 使用するシステム名を記述してください。
--
-- "Gr" : 描画を使うなら必要
-- "Geo" : 当たりを使うなら必要
-- "Nt" : 通信同期を使うなら必要
-- "Fx" : エフェクトを使うなら必要
-- "Sd" : サウンドを使うなら必要
-- "Noise" : ノイズを使うなら必要
-- "Nav" : 経路探索を使うなら必要
-- "GroupBehavior" : 連携を使うなら必要
-- "Ui" : UIを使うなら必要
----------------------------------------
dependSyncPoints = {
"Gr",
"Geo",
"Sd",
"Fx",
},
pluginIndexEnumInfoName = "TppDemoPuppetPluginDefine",
----------------------------------------
--生成処理 OnCreate()
-- キャラクタ生成時に呼ばれる関数
-- プラグインの生成などを行う
----------------------------------------
OnCreate = function( chara )
chara:InitPluginPriorities {
"Body",
}
--プラグインの生成
chara:AddPlugins{
--Bodyプラグイン
"PLG_BODY",
ChBodyPlugin{
name = "MainBody",
parts = "parts",
motionLayers = {"Lower",},
hasGravity = false,
useCharacterController = false,
hasScaleAnimation = true,
hasTranslations = { true },
maxMotionJoints = {21},
maxMotionPoints = {21},
priority = "Body",
},
--AttachPlugin
"PLG_ATTACH",
ChAttachPlugin {
name = "Attach",
},
--ActionRootPlugin
"PLG_ACTION_ROOT",
ChActionRootPlugin{
name = "ActionRoot",
},
--FacialPlugin
"PLG_FACIAL",
ChFacialPlugin {
name = "Facial",
parent = "MainBody",
maxMotionJoints = { 39, 20 },
maxShaderNodes = { 7, 7 },
maxShaderAnimations = { 2, 2 },
interpTime = 60.0,
},
--EffectPlugin
"PLG_EFFECT",
ChEffectPlugin {
name = "Effect",
parent = "MainBody",
},
}
end,
----------------------------------------
--初期化処理 OnReset()
-- リスポーン時など、パラメータ類の初期化が必要なタイミングで呼ばれる
-- パラメータの初期化などを行う
----------------------------------------
OnReset = function( chara )
end,
}
|
local core = require "sys.core"
local rpc = require "saux.rpcraw"
local rpcproto = require "saux.xproto"
local dns = require "sys.dns"
local serialize = require "sys.serialize"
local rpcDef = require "saux.rpcDef"
local client = {
m_Server = nil
}
local rpcclient
-- global function like getserverfd can be define somewhere.
function client:getserverfd()
return rpcclient.fd
end
function client:close()
rpcclient:close()
end
function client:init(host, port, rpcHandleDef, rpcSenderDef, onClose)
local ip = dns.resolve(host, "A")
local addr = ip..":"..port
local rpcHandle = rpcDef:InitRpcHandle(rpcHandleDef)
rpcclient = rpc.createclient{
addr = addr,
proto = rpcproto,
timeout = 5000,
call = function(fd, cmd, msg)
core.debug(0, "rpc call in", fd, cmd, msg)
return rpcHandle["rpc"](fd, cmd, msg)
end,
close = function(fd, errno)
core.debug(1, "connection closed ", fd, errno)
if onClose then
core.pcall(onClose, fd, addr, errno)
end
end,
}
local bServer = false
rpcDef:AttachRpcSender(rpcSenderDef, rpcclient, bServer)
return rpcclient
end
function client:connect()
local ok = rpcclient:connect()
core.debug(1, "client connect result:", ok)
return ok
end
return client
|
include( "shared.lua" )
AccessorFunc( ENT, "texture", "Texture" )
AccessorFunc( ENT, "drawNextFrame", "DrawNextFrame" )
local rendering = false
local mat = CreateMaterial( "UnlitGeneric", "GMODScreenspace", {
[ "$basetexturetransform" ] = "center .5 .5 scale -1 -1 rotate 0 translate 0 0",
[ "$texturealpha" ] = "0",
[ "$vertexalpha" ] = "1"
} )
function ENT:DrawCircle( x, y, radius, seg )
local circle = {}
table.insert( circle, { x = x, y = y, u = 0.5, v = 0.5 } )
for i = 0, seg do
local a = math.rad( ( i / seg ) * -360 )
table.insert( circle, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) * 0.5 + 0.5, v = math.cos( a ) * 0.5 + 0.5 } )
end
local a = math.rad( 0 )
table.insert( circle, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) * 0.5 + 0.5, v = math.cos( a ) * 0.5 + 0.5 } )
surface.DrawPoly( circle )
end
function ENT:Draw()
local partner = self:GetPartner()
if rendering or not IsValid( partner ) then return end
self:SetDrawNextFrame( true )
render.ClearStencil()
render.SetStencilEnable( true )
render.SetStencilWriteMask( 255 )
render.SetStencilTestMask( 255 )
render.SetStencilReferenceValue( 0 )
render.SetStencilCompareFunction( STENCIL_ALWAYS )
render.SetStencilPassOperation( STENCIL_INCR )
render.SetStencilFailOperation( STENCIL_KEEP )
render.SetStencilZFailOperation( STENCIL_KEEP )
local selfAng = self:GetAngles()
selfAng:RotateAroundAxis( selfAng:Right(), -90 )
cam.Start3D2D( self:GetPos() + self:GetForward(), selfAng, 1 )
draw.NoTexture()
surface.SetDrawColor( 0, 0, 0, 255 )
self:DrawCircle( 0, 0, self:GetSize(), self:GetSize() )
cam.End3D2D()
render.SetStencilReferenceValue( 1 )
render.SetStencilCompareFunction( STENCIL_EQUAL )
local partnerAng = partner:GetAngles()
partnerAng:RotateAroundAxis( partnerAng:Right(), -90 )
partnerAng:RotateAroundAxis( partnerAng:Forward(), 180 )
cam.Start3D2D( partner:GetPos() + partner:GetForward(), partnerAng, 1 )
draw.NoTexture()
cam.IgnoreZ( true )
surface.SetDrawColor( 255, 255, 255, 255 )
partner:DrawCircle( 0, 0, partner:GetSize(), partner:GetSize() )
cam.IgnoreZ( false )
cam.End3D2D()
render.SetStencilReferenceValue( 2 )
render.SetStencilPassOperation( STENCIL_KEEP )
mat:SetTexture( "$basetexture", self:GetTexture() )
render.SetMaterial( mat )
render.DrawScreenQuad()
if IsValid( self:GetCaptive() ) then
cam.Start3D()
cam.IgnoreZ( true )
self:GetCaptive():DrawModel()
cam.IgnoreZ( false )
cam.End3D()
end
render.SetStencilEnable( false )
end |
function pointCloud()
local depthBuffer=sim.getVisionSensorDepthBuffer(depthCam)
local header = {seq=0,stamp=simROS.getTime(), frame_id="k"}
local points = {}
--local point = {x=0,y=0,z=0}
--local ch = {name="distance",values={}}
local channel = {}
for i=1,64,1 do
local xAngle=((32-i-0.5)/32)*camXHalfAngle
for j=1,48,1 do
local yAngle=((j-24+0.5)/24)*camYHalfAngle
local depthValue=depthBuffer[i+(j-1)*64]
local zCoord=nearClippingPlane+depthAmplitude*depthValue
local xCoord=math.tan(xAngle)*zCoord
local yCoord=math.tan(yAngle)*zCoord
local dist=math.sqrt(xCoord*xCoord+yCoord*yCoord+zCoord*zCoord)
local point = {x=xCoord,y=yCoord,z=zCoord}
--point["x"] = xCoord
--point["y"] = yCoord
--point["z"] = zCoord
points[i+(j-1)*64] = point
local ch = {name="distance",values={dist}}
--ch["values"] = {dist}
channel[i+(j-1)*64] = ch
end
end
local point_cloud = {}
point_cloud["header"] = header
point_cloud["points"] = points
point_cloud["channels"] = channel
--print(#points)
--print(#channel)
simROS.publish(pubKinectCloud,point_cloud)
end
if (sim_call_type==sim.childscriptcall_initialization) then
depthCam=sim.getObjectHandle('kinect_depth')
depthView=sim.floatingViewAdd(0.9,0.9,0.2,0.2,0)
sim.adjustView(depthView,depthCam,64)
colorCam=sim.getObjectHandle('kinect_rgb')
print(sim.getObjectName(colorCam))
colorView=sim.floatingViewAdd(0.69,0.9,0.2,0.2,0)
sim.adjustView(colorView,colorCam,64)
-- camera resolution to 64 to improve performance
camXAngleInDegrees = 67
camXResolution = 64
camYResolution = 48
camXHalfAngle=camXAngleInDegrees*0.5*math.pi/180
camYHalfAngle=(camXAngleInDegrees*0.5*math.pi/180)*48/64
nearClippingPlane=0.2
depthAmplitude=3.3
objHandle=sim.getObjectAssociatedWithScript(sim.handle_self)
parentHandle = simGetObjectParent(objHandle)
if parentHandle ~= -1 then
modelBaseName = sim.getObjectName(parentHandle).."/"..sim.getObjectName(objHandle)
else
modelBaseName = sim.getObjectName(objHandle)
end
modelBaseName = string.gsub(modelBaseName,"#","_")
-- ROS Stuff
pubKinectRgb = simROS.advertise(modelBaseName..'/rgb/raw_image','sensor_msgs/Image')
simROS.publisherTreatUInt8ArrayAsString(pubKinectRgb)
pubKinectDepth = simROS.advertise(modelBaseName..'/depth/raw_image','sensor_msgs/Image')
simROS.publisherTreatUInt8ArrayAsString(pubKinectDepth)
pubKinectCloud = simROS.advertise(modelBaseName..'/cloud','sensor_msgs/PointCloud')
simROS.publisherTreatUInt8ArrayAsString(pubKinectCloud)
end
if (sim_call_type==sim.childscriptcall_cleanup) then
simROS.shutdownPublisher(pubKinectRgb)
simROS.shutdownPublisher(pubKinectDepth)
simROS.shutdownPublisher(pubKinectCloud)
end
if (sim_call_type==sim.childscriptcall_sensing) then
-- ROS Kinect
if(sim.getBoolParameter(sim.boolparam_vision_sensor_handling_enabled) == true) then
local data,w,h = sim.getVisionSensorCharImage(colorCam)
d = {}
d['header'] = {seq=0,stamp=simROS.getTime(), frame_id="k"}
d['height'] = h
d['width'] = w
d['encoding'] = 'rgb8'
d['is_bigendian'] = 1
d['step'] = w*3
d['data'] = data
simROS.publish(pubKinectRgb,d)
data,w,h = sim.getVisionSensorCharImage(depthCam)
d = {}
d['header'] = {seq=0,stamp=simROS.getTime(), frame_id="k"}
d['height'] = h
d['width'] = w
d['encoding'] = 'rgb8'
d['is_bigendian'] = 1
d['step'] = w*3
d['data'] = data
simROS.publish(pubKinectDepth,d)
-- point cloud calc
pointCloud()
end
end
|
----
-- Tests for the xlsxwriter.lua.
--
-- Copyright 2014-2015, John McNamara, [email protected]
--
require "Test.More"
plan(5)
----
-- Tests setup.
--
local expected
local got
local caption
local Worksheet = require 'xlsxwriter.worksheet'
local worksheet
----
-- Test the _write_odd_header() method.
--
caption = " \tWorksheet: _write_odd_header()"
expected = '<oddHeader>Page &P of &N</oddHeader>'
worksheet = Worksheet:new()
worksheet:_set_filehandle(io.tmpfile())
worksheet:set_header('Page &P of &N')
worksheet:_write_odd_header()
got = worksheet:_get_data()
is(got, expected, caption)
----
-- Test the _write_odd_footer() method.
--
caption = " \tWorksheet: _write_odd_footer()"
expected = '<oddFooter>&F</oddFooter>'
worksheet = Worksheet:new()
worksheet:_set_filehandle(io.tmpfile())
worksheet:set_footer('&F')
worksheet:_write_odd_footer()
got = worksheet:_get_data()
is(got, expected, caption)
----
-- Test the _write_header_footer() method. Header only.
--
caption = " \tWorksheet: _write_header_footer()"
expected = '<headerFooter><oddHeader>Page &P of &N</oddHeader></headerFooter>'
worksheet = Worksheet:new()
worksheet:_set_filehandle(io.tmpfile())
worksheet:set_header('Page &P of &N')
worksheet:_write_header_footer()
got = worksheet:_get_data()
is(got, expected, caption)
----
-- Test the _write_header_footer() method. Footer only.
--
caption = " \tWorksheet: _write_header_footer()"
expected = '<headerFooter><oddFooter>&F</oddFooter></headerFooter>'
worksheet = Worksheet:new()
worksheet:_set_filehandle(io.tmpfile())
worksheet:set_footer('&F')
worksheet:_write_header_footer()
got = worksheet:_get_data()
is(got, expected, caption)
----
-- Test the _write_header_footer() method. Header and footer.
--
caption = " \tWorksheet: _write_header_footer()"
expected = '<headerFooter><oddHeader>Page &P of &N</oddHeader><oddFooter>&F</oddFooter></headerFooter>'
worksheet = Worksheet:new()
worksheet:_set_filehandle(io.tmpfile())
worksheet:set_header('Page &P of &N')
worksheet:set_footer('&F')
worksheet:_write_header_footer()
got = worksheet:_get_data()
is(got, expected, caption)
|
---
-- @class ENT
-- @desc Dummy ent that just spawns a random TTT weapon and kills itself
-- @section ttt_random_weapon
ENT.Type = "point"
ENT.Base = "base_point"
ENT.autoAmmoAmount = 0
---
-- @param string key
-- @param string|number value
-- @realm shared
function ENT:KeyValue(key, value)
if key == "auto_ammo" then
self.autoAmmoAmount = tonumber(value)
end
end
|
--- original code: https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn/commits/master
--- modify by kevinma
local ScriptHelper = require 'klib/helper/script_helper'
local KC = require 'klib/container/container'
local AUTOFILL_TURRET_AMMO_QUANTITY = 10
local AUTOFILL_VEHICLE_FUEL_QUANTITY = 50
local AUTOFILL_VEHICLE_AMMO_QUANTITY = 100
local SAFE_DISTANCE = 50
local COLOR_RED = { r=1, g=0.1, b=0.1}
local AutoFill = KC.singleton('klib/addon/Autofill', function(self)
end)
-- Transfer Items Between Inventory
-- Returns the number of items that were successfully transferred.
-- Returns -1 if item not available.
-- Returns -2 if can't place item into destInv (ERROR)
function AutoFill:transfer_items(src_inv, dest_entity, item_stack)
-- Check if item is in srcInv
if (src_inv.get_item_count(item_stack.name) == 0) then
return -1
end
-- Check if can insert into destInv
if (not dest_entity.can_insert(item_stack)) then
return -2
end
-- Insert items
local itemsRemoved = src_inv.remove(item_stack)
item_stack.count = itemsRemoved
return dest_entity.insert(item_stack)
end
-- Attempts to transfer at least some of one type of item from an array of items.
-- Use this to try transferring several items in order
-- It returns once it successfully inserts at least some of one type.
function AutoFill:transfer_item_multiple_types(src_inv, dest_entity, item_name_array, item_count)
local ret = 0
for _,itemName in pairs(item_name_array) do
ret = self:transfer_items(src_inv, dest_entity, { name=itemName, count= item_count })
if (ret > 0) then
return ret -- Return the value succesfully transferred
end
end
return ret -- Return the last error code
end
-- Autofills a turret with ammo
function AutoFill:autofill_turret(player, turret)
local mainInv = player.get_inventory(defines.inventory.player_main)
-- Attempt to transfer some ammo
local ret = self:transfer_item_multiple_types(mainInv, turret, {"uranium-rounds-magazine", "piercing-rounds-magazine", "firearm-magazine"}, AUTOFILL_TURRET_AMMO_QUANTITY)
-- Check the result and print the right text to inform the user what happened.
if (ret > 0) then
-- Inserted ammo successfully
-- FlyingText("Inserted ammo x" .. ret, turret.position, my_color_red, player.surface)
elseif (ret == -1) then
ScriptHelper.flying_text("Out of ammo!", turret.position, COLOR_RED, player.surface)
elseif (ret == -2) then
ScriptHelper.flying_text("Autofill ERROR! - Report this bug!", turret.position, COLOR_RED, player.surface)
end
end
-- Autofills a vehicle with fuel, bullets and shells where applicable
function AutoFill:autofill_vehicle(player, vehicle)
local mainInv = player.get_inventory(defines.inventory.player_main)
-- Attempt to transfer some fuel
if ((vehicle.name == "car") or (vehicle.name == "tank") or (vehicle.name == "locomotive")) then
self:transfer_item_multiple_types(mainInv, vehicle, {"nuclear-fuel", "rocket-fuel", "solid-fuel", "coal", "raw-wood"}, AUTOFILL_VEHICLE_FUEL_QUANTITY)
end
-- Attempt to transfer some ammo
if ((vehicle.name == "car") or (vehicle.name == "tank")) then
self:transfer_item_multiple_types(mainInv, vehicle, {"uranium-rounds-magazine", "piercing-rounds-magazine", "firearm-magazine"}, AUTOFILL_VEHICLE_AMMO_QUANTITY)
end
-- Attempt to transfer some tank shells
if (vehicle.name == "tank") then
self:transfer_item_multiple_types(mainInv, vehicle, {"explosive-uranium-cannon-shell", "uranium-cannon-shell", "explosive-cannon-shell", "cannon-shell"}, AUTOFILL_VEHICLE_AMMO_QUANTITY)
end
end
function AutoFill:can_autofill(player, event_entity)
local surface = player.surface
if player.character.in_combat then
ScriptHelper.flying_text("In Combat!", event_entity.position, COLOR_RED, surface)
return false
end
if nil ~= surface.find_nearest_enemy({
position = event_entity.position,
max_distance = SAFE_DISTANCE,
player.force
}) then
ScriptHelper.flying_text("Too Close To Enemy", event_entity.position, COLOR_RED, surface)
return false
end
return true
end
AutoFill:on(defines.events.on_built_entity, function(self, event)
local player = game.players[event.player_index]
local event_entity = event.created_entity
if self:can_autofill(player, event_entity) then
if (event_entity.name == "gun-turret") then
self:autofill_turret(player, event_entity)
end
if ((event_entity.name == "car") or (event_entity.name == "tank") or (event_entity.name == "locomotive")) then
self:autofill_vehicle(player, event_entity)
end
end
end)
return AutoFill
|
toX = {};
toY = {};
eToX = {};
eToY = {};
defX = {};
defY = {};
eDefX = {};
eDefY = {};
mod = -1;
camMod = -1;
mirror = true;
--le robé el codigo al bbpanzu jijijija
local angleshit = 1;
local anglevar = 2;
function onCreate()
for i = 0, 3, 1
do
toX[i] = 0;
toY[i] = 0;
eToX[i] = 0;
eToY[i] = 0;
end
end
function onBeatHit()
if (mod == 1) then
for i = 0, 3, 1
do
toX[i] = math.random(-50 * (3 - i), 20);
if (downscroll) then
toY[i] = math.random(-200, 20);
else
toY[i] = math.random(-20, 200);
end
end
elseif (mod == 3) then
for i = 0, 3, 1
do
toX[i] = 0;
toY[i] = math.random(-60, 60);
end
end
if (camMod == 0) then
if curBeat % 2 == 0 then
angleshit = anglevar;
else
angleshit = -anglevar;
end
setProperty('camHUD.angle',angleshit*3)
doTweenAngle('turn', 'camHUD', angleshit, stepCrochet*0.008, 'circOut')
doTweenX('tuin', 'camHUD', -angleshit*20, crochet*0.001, 'linear')
end
end
function onStepHit()
if (camMod == 0) then
if curStep % 4 == 0 then
doTweenY('rrr', 'camHUD', -12, stepCrochet*0.002, 'circOut')
end
if curStep % 4 == 2 then
doTweenY('rir', 'camHUD', 0, stepCrochet*0.002, 'sineIn')
end
end
end
time = 0;
function onUpdate(elapsed)
--esta mierda va aquí por alguna razón
defX[0] = defaultPlayerStrumX0;
defX[1] = defaultPlayerStrumX1;
defX[2] = defaultPlayerStrumX2;
defX[3] = defaultPlayerStrumX3;
defY[0] = defaultPlayerStrumY0 + 10;
defY[1] = defaultPlayerStrumY1 + 10;
defY[2] = defaultPlayerStrumY2 + 10;
defY[3] = defaultPlayerStrumY3 + 10;
eDefX[0] = defaultOpponentStrumX0;
eDefX[1] = defaultOpponentStrumX1;
eDefX[2] = defaultOpponentStrumX2;
eDefX[3] = defaultOpponentStrumX3;
eDefY[0] = defaultOpponentStrumY0;
eDefY[1] = defaultOpponentStrumY1;
eDefY[2] = defaultOpponentStrumY2;
eDefY[3] = defaultOpponentStrumY3;
time = time + elapsed * 60;
if (mod == -1) then
for i = 0, 3, 1
do
toX[i] = 0;
toY[i] = 0;
end
end
if (camMod == -1) then
setProperty('camHUD.angle', 0);
end
for i = 0, 3, 1
do
local prevX = getPropertyFromGroup('playerStrums', i, 'x');
local realToX = defX[i] + toX[i];
setPropertyFromGroup('playerStrums', i, 'x', prevX + (realToX - prevX) / (8 / (elapsed * 50)));
local prevY = getPropertyFromGroup('playerStrums', i, 'y');
local realToY = defY[i] + toY[i];
setPropertyFromGroup('playerStrums', i, 'y', prevY + (realToY - prevY) / (8 / (elapsed * 50)));
if (mirror) then
prevX = getPropertyFromGroup('opponentStrums', i, 'x');
realToX = eDefX[i] - toX[3 - i];
setPropertyFromGroup('opponentStrums', i, 'x', prevX + (realToX - prevX) / (8 / (elapsed * 50)));
prevY = getPropertyFromGroup('opponentStrums', i, 'y');
realToY = defY[i] + toY[3 - i];
setPropertyFromGroup('opponentStrums', i, 'y', prevY + (realToY - prevY) / (8 / (elapsed * 50)));
end
end
--aparentemente no existe un switch en lua????
if (mod == 0) then
for i = 0, 3, 1
do
toX[i] = math.cos(time / 6 + i) * 20;
toY[i] = math.sin(time / 6 + i) * 20;
end
elseif (mod == 2) then
if (time % 4 > 2) then
for i = 0, 3, 1
do
toX[i] = math.random(-200, 50);
if (downscroll) then
toY[i] = math.random(-200, 40);
else
toY[i] = math.random(-40, 200);
end
end
end
elseif (mod == 3) then
for i = 0, 3, 1
do
toX[i] = math.cos(time / 3 + i) * 20;
end
elseif (mod == 4) then
for i = 0, 3, 1
do
toX[i] = math.cos(time / 6 + i) * 40;
toY[i] = math.sin(time / 3 + i) * 20;
end
end
if (camMod == 1) then
doTweenAngle('turn', 'camHUD', math.sin(time / 8) * 6, stepCrochet*0.002, 'linear');
end
end
function onEvent(name, value1, value2)
if name == 'modChange' then
if (value1 ~= '') then
mod = tonumber(value1);
end
if (value2 ~= '') then
camMod = tonumber(value2);
end
end
end |
-----------------------------------
-- Area: Batok Markets
-- NPC: Zaira
-- Standard Merchant NPC
-- !pos -217.316 -2.824 49.235 235
-----------------------------------
local ID = require("scripts/zones/Bastok_Markets/IDs")
require("scripts/globals/shop")
function onTrigger(player, npc)
local stock =
{
4862, 114, 1, -- Scroll of Blind
4838, 360, 2, -- Scroll of Bio
4828, 82, 2, -- Scroll of Poison
4861, 2250, 2, -- Scroll of Sleep
4767, 61, 3, -- Scroll of Stone
4777, 140, 3, -- Scroll of Water
4762, 324, 3, -- Scroll of Aero
4752, 837, 3, -- Scroll of Fire
4757, 1584, 3, -- Scroll of Blizzard
4772, 3261, 3, -- Scroll of Thunder
4847, 1363, 3, -- Scroll of Shock
4846, 1827, 3, -- Scroll of Rasp
4845, 2250, 3, -- Scroll of Choke
4844, 3688, 3, -- Scroll of Frost
4843, 4644, 3, -- Scroll of Burn
4848, 6366, 3, -- Scroll of Drown
}
player:showText(npc, ID.text.ZAIRA_SHOP_DIALOG)
tpz.shop.nation(player, stock, tpz.nation.BASTOK)
end
|
local _M = {}
local cache = require "resty.gateway.cache"
local get_cache = cache.get
local set_cache = cache.set
local ngx_re_find = ngx.re.find
local util = require("resty.gateway.util")
local function url_routes_sort(a,b)
return a["order_no"] < b["order_no"]
end
-- 根据ratelimit_url的配置返回匹配前缀的table
local function get_ratelimit_key_tab(ratelimit_config)
local ratelimit_tab ={}
for k,v in ipairs(ratelimit_config) do
ratelimit_tab[k] =v["key"]
end
return ratelimit_tab
end
local function get_ratelimit_limit(value,over_time)
local from , to = ngx_re_find(value,",","jo")
local limit = tonumber(string.sub(value,1,from-1))
if limit ~=0 then
return {
limit = limit,
over = over_time,
block = tonumber(string.sub(value,from+1))
}
end
return nil
end
local function get_ratelimit_limit_tab(value)
local ratelimit_tab ={}
local sec_block = get_ratelimit_limit(value["sec_block"],1)
if sec_block then
table.insert(ratelimit_tab,sec_block)
end
local min_block = get_ratelimit_limit(value["min_block"],60)
if min_block then
table.insert(ratelimit_tab,min_block)
end
local hour_block = get_ratelimit_limit(value["hour_block"],3600)
if hour_block then
table.insert(ratelimit_tab,hour_block)
end
local day_block = get_ratelimit_limit(value["day_block"],3600*24)
if day_block then
table.insert(ratelimit_tab,day_block)
end
return ratelimit_tab
end
-- 初始化数据,不能编辑
local function init(urlroutes)
table.sort( urlroutes, url_routes_sort )
local url_prefix = {}
for k,v in ipairs(urlroutes) do
-- 获取所有前缀
url_prefix[k] = v["url_prefix"]
-- 登记每个路由的信息
local url_route = {
url_route = v["url_route"] or "/$1",
jwt_enable = v["jwt_enable"] or true,
header_host = v["header_host"] or "",
order_no = v["order_no"] or 999,
ratelimit_url_enable = v["ratelimit_url_enable"] or false,
ratelimit_ip_enable = v["ratelimit_ip_enable"] or false,
}
set_cache(v["url_prefix"],url_route)
-- 接口服务器信息
local server_host = {}
local weight_sum = 0
for key,value in ipairs(v["server_host"]) do
-- 获取每个服务器的权重进行累计
weight_sum = weight_sum + value["weight"]
server_host[key] = { sum = weight_sum,uri = value["uri"]}
end
-- 接口服务器列表
set_cache(util.get_server_host_key(v["url_prefix"]),server_host)
-- 总权重字段
set_cache(util.get_server_host_sum_key(v["url_prefix"]),weight_sum)
-- jwt例外列表
set_cache(util.get_jwt_ignore_key(v["url_prefix"]),v["jwt_ignore"])
-- 限流的URL设置
local ratelimit_url_key_tab = get_ratelimit_key_tab(v["ratelimit_url"])
set_cache(util.get_ratelimit_url_key(v["url_prefix"]),ratelimit_url_key_tab)
-- 限流的IP设置
local ratelimit_ip_key_tab = get_ratelimit_key_tab(v["ratelimit_ip"])
set_cache(util.get_ratelimit_ip_key(v["url_prefix"]),ratelimit_ip_key_tab)
-- url 限流
local ratelimit_urls = {}
for key,value in ipairs(v["ratelimit_url"]) do
local ratelimit_url = get_ratelimit_limit_tab(value)
if #ratelimit_url >0 then
set_cache(util.get_ratelimit_url_item_key(v["url_prefix"],value["key"]), ratelimit_url)
end
end
-- ip 限流
local ratelimit_ips = {}
for key,value in ipairs(v["ratelimit_ip"]) do
local ratelimit_ip = get_ratelimit_limit_tab(value)
if #ratelimit_ip >0 then
set_cache(util.get_ratelimit_ip_item_key(v["url_prefix"],value["key"]), ratelimit_ip)
end
end
end
set_cache("url_prefix",url_prefix)
end
_M.init = init
return _M |
package("magnum")
set_homepage("https://magnum.graphics/")
set_description("Lightweight and modular C++11/C++14 graphics middleware for games and data visualization.")
set_license("MIT")
add_urls("https://github.com/mosra/magnum/archive/refs/tags/$(version).zip",
"https://github.com/mosra/magnum.git")
add_versions("v2020.06", "78c52bc403cec27b98d8d87186622ca57f8d70ffd64342fe4094c720b7d3b0e3")
add_configs("audio", {description = "Build audio module.", default = false, type = "boolean"})
add_configs("vulkan", {description = "Build vulkan module.", default = false, type = "boolean"})
add_configs("deprecated", {description = "Include deprecated APIs in the build.", default = true, type = "boolean"})
add_configs("plugin_static", {description = "Build plugins as static libraries.", default = false, type = "boolean"})
local applicationlibs = {"android", "emscripten", "glfw", "glx", "sdl2", "xegl", "windowlesscgl", "windowlessegl", "windowlessglx", "windowlessios", "windowlesswgl", "windowlesswindowsegl"}
for _, applicationlib in ipairs(applicationlibs) do
add_configs(applicationlib, {description = "Build the " .. applicationlib .. " application library.", default = false, type = "boolean"})
end
local contexts = {"cgl", "egl", "glx", "wgl"}
for _, context in ipairs(contexts) do
add_configs(context .. "context", {description = "Build the " .. context .. " context handling library.", default = false, type = "boolean"})
end
local testers = {"opengltester", "vulkantester"}
for _, tester in ipairs(testers) do
add_configs(tester, {description = "Build the " .. tester .. " class.", default = false, type = "boolean"})
end
local plugins = {"anyaudioimporter", "anyimageconverter", "anyimageimporter", "anysceneconverter", "anysceneimporter", "anyshaderconverter", "magnumfont", "magnumfontconverter", "objimporter", "tgaimporter", "tgaimageconverter", "wavaudioimporter"}
for _, plugin in ipairs(plugins) do
add_configs(plugin, {description = "Build the " .. plugin .. " plugin.", default = false, type = "boolean"})
end
local utilities = {"gl_info", "vk_info", "al_info", "distancefieldconverter", "fontconverter", "imageconverter", "sceneconverter", "shaderconverter"}
for _, utility in ipairs(utilities) do
add_configs(utility, {description = "Build the " .. utility .. " executable.", default = false, type = "boolean"})
end
add_deps("cmake", "corrade", "opengl")
add_links("MagnumAnyAudioImporter", "MagnumAnyImageConverter", "MagnumAnyImageImporter", "MagnumAnySceneConverter", "MagnumAnySceneImporter", "MagnumMagnumFont", "MagnumMagnumFontConverter", "MagnumObjImporter", "MagnumTgaImageConverter", "MagnumTgaImporter", "MagnumWavAudioImporter")
add_links("MagnumCglContext", "MagnumEglContext", "MagnumGlxContext", "MagnumWglContext", "MagnumOpenGLTester", "MagnumVulkanTester")
add_links("MagnumAndroidApplication", "MagnumEmscriptenApplication", "MagnumGlfwApplication", "MagnumGlxApplication", "MagnumSdl2Application", "MagnumXEglApplication", "MagnumWindowlessCglApplication", "MagnumWindowlessEglApplication", "MagnumWindowlessGlxApplication", "MagnumWindowlessIosApplication", "MagnumWindowlessWglApplication", "MagnumWindowlessWindowsEglApplication")
add_links("MagnumAudio", "MagnumDebugTools", "MagnumGL", "MagnumMeshTools", "MagnumPrimitives", "MagnumSceneGraph", "MagnumShaders", "MagnumText", "MagnumTextureTools", "MagnumTrade", "MagnumVk", "Magnum")
on_load("windows", "linux", "macosx", function (package)
if package:config("audio") then
package:add("deps", "openal-soft", {configs = {shared = true}})
end
if package:config("vulkan") then
package:add("deps", "vulkansdk")
end
if package:config("glfw") then
package:add("deps", "glfw")
end
if package:config("sdl2") then
package:add("deps", "libsdl")
end
if package:config("glx") then
package:add("deps", "libx11")
end
end)
on_install("windows", "linux", "macosx", function (package)
local configs = {"-DBUILD_TESTS=OFF", "-DLIB_SUFFIX="}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
table.insert(configs, "-DWITH_AUDIO=" .. (package:config("audio") and "ON" or "OFF"))
table.insert(configs, "-DWITH_VK=" .. (package:config("vulkan") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_DEPRECATED=" .. (package:config("deprecated") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_PLUGIN_STATIC=" .. (package:config("plugin_static") and "ON" or "OFF"))
for _, applicationlib in ipairs(applicationlibs) do
table.insert(configs, "-DWITH_" .. applicationlib:upper() .. "APPLICATION=" .. (package:config(applicationlib) and "ON" or "OFF"))
end
for _, context in ipairs(contexts) do
table.insert(configs, "-DWITH_" .. context:upper() .. "CONTEXT=" .. (package:config(context) and "ON" or "OFF"))
end
for _, tester in ipairs(testers) do
table.insert(configs, "-DWITH_" .. tester:upper() .. "=" .. (package:config(tester) and "ON" or "OFF"))
end
for _, plugin in ipairs(plugins) do
table.insert(configs, "-DWITH_" .. plugin:upper() .. "=" .. (package:config(plugin) and "ON" or "OFF"))
end
for _, utility in ipairs(utilities) do
table.insert(configs, "-DWITH_" .. utility:upper() .. "=" .. (package:config(utility) and "ON" or "OFF"))
end
import("package.tools.cmake").install(package, configs, {buildir = os.tmpfile() .. ".dir"})
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <Magnum/GL/Buffer.h>
#include <Magnum/Math/Color.h>
using namespace Magnum;
struct TriangleVertex {
Vector2 position;
Color3 color;
};
void test() {
using namespace Math::Literals;
const TriangleVertex data[]{
{{-0.5f, -0.5f}, 0xff0000_rgbf},
{{ 0.5f, -0.5f}, 0x00ff00_rgbf},
{{ 0.0f, 0.5f}, 0x0000ff_rgbf}
};
GL::Buffer buffer;
buffer.setData(data);
}
]]}, {configs = {languages = "c++14"}}))
end)
|
local fail = false
print("Test: unm...")
if -a ~= a*-1 then
print("\tFail: -a")
fail = true
end
if -na ~= a then
print("\tFail: -na")
fail = true
end
if -b ~= bn("-123456789012345678901234567") then
print("\tFail: -b")
fail = true
end
if -nf ~= nf*-1 then
print("\tFail: -nf")
fail = true
end
if not fail then
print("\tPass")
end
|
local ECS = require('wacky-ecs')
local width, height = love.graphics.getDimensions()
-- Create components for position, velocity, size, color
ECS.Component.new('position', function(x, y)
return {x = x, y = y}
end)
ECS.Component.new('velocity', function(vx, vy)
return {vx = vx, vy = vy}
end)
ECS.Component.new('size', function(w, h)
return {w = w, h = h}
end)
ECS.Component.new('color', function(r, g, b, a)
return {r, g, b}
end)
-- Create physics system
ECS.System.new('physics', {'position', 'velocity'}, {
update = function(self, entities, dt)
for _, e in ipairs(entities) do
e.velocity.vy = e.velocity.vy + self.gravity * dt
e.position.x = e.position.x + e.velocity.vx * dt
e.position.y = e.position.y + e.velocity.vy * dt
end
end,
gravity = 9.81 * 60
})
-- Create system that removes offscreen entities
ECS.System.new('remove_offscreen', {'position', 'size'}, {
update = function(self, entities, dt)
for _, e in ipairs(entities) do
if e.position.x > self.screenWidth
or e.position.x + e.size.w < 0
or e.position.y > self.screenHeight
or e.position.y + e.size.h < 0 then
e:destroy()
end
end
end,
screenWidth = width,
screenHeight = height
})
-- Create system that draws rectangles
ECS.System.new('draw_rectangle', {'position', 'size', 'color'}, {
draw = function(self, entities, dt)
for _, e in ipairs(entities) do
love.graphics.setColor(e.color)
love.graphics.rectangle('fill',e.position.x, e.position.y, e.size.w, e.size.h)
end
end
})
-- Create world
local world = ECS.World.new()
:addSystem('physics')
:addSystem('draw_rectangle')
:addSystem('remove_offscreen')
local stats = {
update = 0,
draw = 0,
frames = 0
}
-- Add 50 entities each frame
function love.update(dt)
stats.update = love.timer.getTime()
local angle = love.timer.getTime()*10
local x = width/2 + math.cos(angle) * 100
local y = height/2 + math.sin(angle) * 100
for i=50,1,-1 do
local dir = math.random(0, math.pi * 2 * 100) / 100
local e = ECS.Entity.new(world)
:add('position', x, y, math.random(0, math.pi * 2))
:add('velocity', math.cos(dir) * 200, -400 + math.sin(dir) * 100)
:add('size', math.random(1, 10), math.random(1, 10))
:add('color', math.random(), math.random(), math.random())
end
-- commit changes (added/removed/changed entities) from last update
world:commit()
-- Calls the physics:update() and remove_offscreen:update() functions
world:call('update', dt)
stats.update = love.timer.getTime() - stats.update
end
function love.draw()
stats.draw = love.timer.getTime()
love.graphics.clear()
-- Calls the draw_rectangle:draw() function
world:call('draw')
stats.draw = love.timer.getTime() - stats.draw
love.graphics.setColor(1,1,1,1)
love.graphics.rectangle('fill', 0, 0, 100, 80)
love.graphics.setColor(0,0,0,1)
love.graphics.print("FPS: " .. love.timer.getFPS(), 1, 0)
love.graphics.print("GC: " .. math.floor(collectgarbage("count")/1024) .. "mb", 1, 16)
love.graphics.print("Update: " .. math.floor((stats.update)*1000*100)/100, 1, 32)
love.graphics.print("Draw: " .. math.floor((stats.draw)*1000*100)/100, 1, 48)
love.graphics.print("Entities: " .. world:getEntityCount(), 1, 64)
end
|
return {
PlaceObj("ModItemOptionToggle", {
"name", "NewMinute",
"DisplayName", T(302535920011346, "Each Minute"),
"DefaultValue", false,
}),
PlaceObj("ModItemOptionToggle", {
"name", "NewHour",
"DisplayName", T(302535920011347, "Each Hour"),
"DefaultValue", false,
}),
PlaceObj("ModItemOptionToggle", {
"name", "NewDay",
"DisplayName", T(302535920011348, "Each Sol"),
"DefaultValue", true,
}),
}
|
local profileKeeper = require "profileKeeper"
local accountPool = require "accountPool"
require "customizer"
local customizer = createCustomizer()
function launch()
local profile = profileKeeper.selectedProfile
if customizer.profileName then
if profileKeeper.profiles[customizer.profileName] then
profile = profileKeeper.profiles[customizer.profileName]
end
end
customizer.replace_map["${auth_player_name}"] = "kaniol"
local launcher = require "launcher"
launcher.launch(profile, account, customizer)
end
function download()
-- body
end
local cli = require "cliargs"
cli:set_name("KL_Launcher")
cli:set_description("a Minecraft Launcher written in Lua")
cli:flag("-v, --version", "version info of KL Launcher", false, function()
print[[
KL Launcher v1.0
Copyright by kaniol-lck
Licensed Under BSD 2-Clause "Simplified" License]]
end)
cli
:command("launch", "launch Minecraft")
:option("-p, --profile profileName", "specify a profile to launch", nil, function(_, profileName) print(profileName) customizer.profileName = profileName end)
:option("-v, --version versionId", "specify a version id to launch", nil, function(_, verisnId) customizer.versionId = verisnId end)
:option("-s, --size <width>x<height>", "set window size", nil, function(_, size) customizer.size = { string.match(size, "^(%d+)x(%d+)$") } end)
:option("--server <hostname>:<port>", "enter a server when game launched", nil, function(_, server) customizer.server = { string.match(server, "^([%a.]):(%d+)$") } end)
:flag("-f, --fullscreen", "use full screen to play Minecraft", false, function(_, fullscreen) customizer.fullscreen = fullscreen end)
:action(launch)
cli
:command("download", "download Minecraft")
:option("-v, --version versionId", "specify a version id to download", nil, function(_, verisnId) customizer.versionId = verisnId end)
:action(download)
local profile_cli = cli:command("profile", "manage profiles"):action(function() end)
profile_cli
:command("list", "show all profiles in a list")
:action(profileKeeper.printList)
profile_cli
:command("remove", "remove a profile")
:argument("NAME", "name of the profile to remove")
:action(function(args) profileKeeper.removeProfile(args.NAME) end)
profile_cli
:command("add", "add a profile")
:argument("NAME", "name of the profile to add")
:option("-d, --dir gameDir", "specify game directory of profile")
:option("-v, --version versionId", "specify version id of profile")
:action(function(args) profileKeeper.addProfile(args.NAME, args.dir, args.version) end)
local account_cli = cli:command("account", "manage accounts"):action(function() end)
account_cli
:command("list", "show all profiles in a list")
:action(accountPool.printList)
account_cli
:command("remove", "remove a profile")
:argument("NAME", "name of the profile to remove")
:action(function(options) accountPool.removeAccount(options.NAME) end)
local add_account_cli = account_cli:command("add", "add a profile"):action(function() end)
add_account_cli
:command("mojang", "certified Minecraft account")
:argument("USERNAME", "your username")
:argument("PASSWORD", "your password")
:option("-n, --name custumName", "name of the account to add")
:action(function(options) accountPool.addMojangAccount(options.name, options.USERNAME, options.PASSWORD) end)
add_account_cli
:command("offline", "uncertified offline account")
:argument("PLAYERNAME", "playername used in game")
:option("-n, --name custumName", "name of the account to add")
:action(function(options) accountPool.addOfflineAccount(options.name, options.PLAYERNAME) end)
local args, err = cli:parse()
if not args and err then
return print(err)
elseif args then
end |
return function()
local bindableEvent = Deus:Load("Deus.BindableEvent")
local event
beforeEach(function()
event = bindableEvent.new()
end)
describe("object", function()
it("new() should give a table", function()
expect(event).to.be.a("table")
end)
end)
describe("connect", function()
it("should connect", function()
expect(event:Connect(print)).to.be.ok()
end)
it("should disconnect", function()
expect(function()
event:Connect(print):Disconnect()
end).to.be.ok()
end)
end)
describe("wait", function()
it("should yield", function()
expect(function()
event:Wait()
end).to.be.ok()
end)
end)
describe("fire", function()
it("should fire connections", function()
expect(function()
event:Fire()
end).to.be.ok()
end)
end)
end |
require("http_common")
require("user_model")
require("user_view")
local function getUser(stream, headers)
--Extract user name from URI.
local pattern = "/UserService/Users/(%w+)"
local userName = getKeyFromHeaders(headers,
pattern)
if not userName then
setHeaders(stream, BAD_REQUEST)
end
--Get the user from the database
local user = searchUser(userName)
if not user then
setHeaders(stream, NOT_FOUND)
end
--Render user and send it to le client.
local html = renderUser(user)
if not html then
setHeaders(stream, SERVER_ERROR)
end
--Send the representation to the client.
setHeaders(stream, SUCCESS)
stream:write_chunk(html, true)
end
local t = {
["get"] = getUser,
["pattern"] = "/userservice/users/"
}
return t
|
local M = {}
local dap = require('dap')
M.stop_debugger = function()
dap.disconnect()
dap.close()
end
M.setup = function()
local options = { noremap = true, silent = true }
vim.api.nvim_set_keymap("n", "<leader>b", "<cmd>lua require'dap'.toggle_breakpoint()<cr>", options)
vim.api.nvim_set_keymap("n", "<leader>rc", "<cmd>lua require'dap'.run_to_cursor()<cr>", options)
vim.api.nvim_set_keymap("n", "<F9>", "<cmd>lua require'dap'.continue()<cr>", options)
vim.api.nvim_set_keymap("n", "<F10>", "<cmd>lua require'config.dap'.stop_debugger()<cr>", options)
vim.api.nvim_set_keymap("n", "<F11>", "<cmd>lua require'dap'.repl.open()<cr>", options)
vim.api.nvim_set_keymap("n", "<F6>", "<cmd>lua require'dap'.step_over()<cr>", options)
vim.api.nvim_set_keymap("n", "<F7>", "<cmd>lua require'dap'.step_into()<cr>", options)
local breakpoint = {
text = "",
texthl = "LspDiagnosticsSignHint",
linehl = "",
numhl = "",
}
vim.fn.sign_define("DapBreakpoint", breakpoint)
dap.defaults.fallback.terminal_win_cmd = "50vsplit new"
dap.adapters.python = {
type = 'executable';
command = vim.loop.os_homedir() .. '/.local/debugpy/bin/python';
args = { '-m', 'debugpy.adapter' };
}
dap.configurations.python = {
{
type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
request = 'launch';
name = "Launch file";
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
program = "${workspaceFolder}/${file}"; -- This configuration will launch the current file if used.
pythonPath = function()
-- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
-- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
-- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
return cwd .. '/venv/bin/python'
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
return cwd .. '/.venv/bin/python'
else
return vim.fn.exepath('python3') or vim.fn.exepath('python')
end
end;
},
}
end
return M
|
local actions = require('telescope.actions')
require('telescope').setup {
defaults = {
file_sorter = require'telescope.sorters'.get_fzy_sorter,
file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
mappings = {
i = {
["<C-q>"] = actions.send_to_qflist
}
}
},
extensions = {
fzy_native = {
override_generic_sorter = false,
override_file_sorter = true,
}
}
}
require('telescope').load_extension('fzy_native')
|
if GetBot():IsInvulnerable() or not GetBot():IsHero() or not string.find(GetBot():GetUnitName(), "hero") or GetBot():IsIllusion() then
return;
end
local ability_item_usage_generic = dofile( GetScriptDirectory().."/ability_item_usage_shutnik" )
local utils = require(GetScriptDirectory() .. "/util")
local mutil = require(GetScriptDirectory() .. "/Mylogic")
function AbilityLevelUpThink()
ability_item_usage_generic.AbilityLevelUpThink();
end
function BuybackUsageThink()
ability_item_usage_generic.BuybackUsageThink();
end
function CourierUsageThink()
ability_item_usage_generic.CourierUsageThink();
end
local castWADesire = 0;
local castWBDesire = 0;
local castPRDesire = 0;
local abilityWA = nil;
local abilityWB = nil;
local abilityPR = nil;
local npcBot = nil;
function AbilityUsageThink()
if npcBot == nil then npcBot = GetBot(); end
if mutil.CanNotUseAbility(npcBot) then return end
if abilityWA == nil then abilityWA = npcBot:GetAbilityByName( "beastmaster_wild_axes" ) end
if abilityWB == nil then abilityWB = npcBot:GetAbilityByName( "beastmaster_call_of_the_wild_boar" ) end
if abilityPR == nil then abilityPR = npcBot:GetAbilityByName( "beastmaster_primal_roar" ) end
castPRDesire, castPRTarget = ConsiderPrimalRoar();
castWADesire, castWALocation = ConsiderWildAxes();
castWBDesire = ConsiderWildBoar();
if ( castPRDesire > castWADesire )
then
npcBot:Action_UseAbilityOnEntity( abilityPR, castPRTarget );
return;
end
if ( castWADesire > 0 )
then
npcBot:Action_UseAbilityOnLocation( abilityWA, castWALocation );
return;
end
if ( castWBDesire > 0 )
then
npcBot:Action_UseAbility( abilityWB );
return;
end
end
function ConsiderWildAxes()
if ( not abilityWA:IsFullyCastable() )
then
return BOT_ACTION_DESIRE_NONE, 0;
end
local nRadius = abilityWA:GetSpecialValueInt( "radius" );
local nCastRange = abilityWA:GetCastRange();
local nCastPoint = abilityWA:GetCastPoint( );
local nDamage = abilityWA:GetSpecialValueInt("axe_damage");
if nCastRange > 1600 then nCastRange = 1600 end
if ( npcBot:GetActiveMode() == BOT_MODE_LANING and
npcBot:GetMana() == npcBot:GetMaxMana() )
then
local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( nCastRange, true, BOT_MODE_NONE );
if(tableNearbyEnemyHeroes[1] ~= nil) then
return BOT_ACTION_DESIRE_MODERATE, tableNearbyEnemyHeroes[1]:GetExtrapolatedLocation( (GetUnitToUnitDistance( tableNearbyEnemyHeroes[1], npcBot )/800) + nCastPoint );
end
end
if ( npcBot:GetActiveMode() == BOT_MODE_ROSHAN )
then
local npcTarget = npcBot:GetAttackTarget();
if ( mutil.IsRoshan(npcTarget) and mutil.CanCastOnMagicImmune(npcTarget) and mutil.IsInRange(npcTarget, npcBot, nCastRange) )
then
return BOT_ACTION_DESIRE_LOW, npcTarget:GetLocation();
end
end
local npcTarget = npcBot:GetTarget();
if mutil.IsValidTarget(npcTarget) and mutil.CanCastOnMagicImmune(npcTarget) and
mutil.CanKillTarget(npcTarget, nDamage, DAMAGE_TYPE_PHYSICAL) and mutil.IsInRange(npcTarget, npcBot, nCastRange)
then
return BOT_ACTION_DESIRE_MODERATE, npcTarget:GetExtrapolatedLocation( (GetUnitToUnitDistance(npcTarget, npcBot )/800) + nCastPoint );
end
if ( npcBot:GetActiveMode() == BOT_MODE_FARM ) then
local locationAoE = npcBot:FindAoELocation( true, false, npcBot:GetLocation(), nCastRange, nRadius, 0, 0 );
if ( locationAoE.count >= 3 ) then
return BOT_ACTION_DESIRE_HIGH, locationAoE.targetloc;
end
end
if mutil.IsDefending(npcBot) or mutil.IsPushing(npcBot)
then
local lanecreeps = npcBot:GetNearbyLaneCreeps(nCastRange, true);
local locationAoE = npcBot:FindAoELocation( true, false, npcBot:GetLocation(), nCastRange, nRadius, 0, 0 );
if ( locationAoE.count >= 4 and #lanecreeps >= 4 )
then
return BOT_ACTION_DESIRE_HIGH, locationAoE.targetloc;
end
end
if mutil.IsGoingOnSomeone(npcBot)
then
if mutil.IsValidTarget(npcTarget) and mutil.CanCastOnMagicImmune(npcTarget) and mutil.IsInRange(npcTarget, npcBot, nCastRange)
then
return BOT_ACTION_DESIRE_MODERATE, npcTarget:GetExtrapolatedLocation( (GetUnitToUnitDistance(npcTarget, npcBot )/800) + nCastPoint );
end
end
return BOT_ACTION_DESIRE_NONE, 0;
end
function ConsiderPrimalRoar()
if ( not abilityPR:IsFullyCastable() ) then
return BOT_ACTION_DESIRE_NONE, 0;
end
local nCastRange = abilityPR:GetCastRange();
local nDamage = abilityPR:GetSpecialValueInt( "damage" );
local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( nCastRange, true, BOT_MODE_NONE );
for _,enemy in pairs(tableNearbyEnemyHeroes)
do
if enemy:IsChanneling() and mutil.CanCastOnMagicImmune(enemy) then
return BOT_ACTION_DESIRE_HIGH, enemy;
end
end
local npcTarget = npcBot:GetTarget();
if mutil.IsValidTarget(npcTarget) and mutil.CanCastOnMagicImmune(npcTarget) and mutil.CanKillTarget(npcTarget, nDamage, DAMAGE_TYPE_MAGICAL) and mutil.IsInRange(npcTarget, npcBot, nCastRange)
then
return BOT_ACTION_DESIRE_HIGH, npcTarget;
end
if mutil.IsRetreating(npcBot)
then
local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( nCastRange, true, BOT_MODE_NONE );
for _,npcEnemy in pairs( tableNearbyEnemyHeroes )
do
if npcBot:WasRecentlyDamagedByHero( npcEnemy, 1.0 ) and mutil.CanCastOnMagicImmune(npcEnemy)
then
return BOT_ACTION_DESIRE_MODERATE, npcEnemy;
end
end
end
if mutil.IsInTeamFight(npcBot, 1200)
then
local npcMostDangerousEnemy = nil;
local nMostDangerousDamage = 0;
local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( nCastRange, true, BOT_MODE_NONE );
for _,npcEnemy in pairs( tableNearbyEnemyHeroes )
do
if mutil.CanCastOnMagicImmune(npcEnemy)
then
local nDamage = npcEnemy:GetEstimatedDamageToTarget( false, npcBot, 3.0, DAMAGE_TYPE_ALL );
if ( nDamage > nMostDangerousDamage )
then
nMostDangerousDamage = nDamage;
npcMostDangerousEnemy = npcEnemy;
end
end
end
if ( npcMostDangerousEnemy ~= nil )
then
return BOT_ACTION_DESIRE_HIGH, npcMostDangerousEnemy;
end
end
if mutil.IsGoingOnSomeone(npcBot)
then
if mutil.IsValidTarget(npcTarget) and mutil.CanCastOnMagicImmune(npcTarget) and mutil.IsInRange(npcTarget, npcBot, nCastRange)
then
return BOT_ACTION_DESIRE_HIGH, npcTarget;
end
end
return BOT_ACTION_DESIRE_NONE, 0;
end
function ConsiderWildBoar()
if ( not abilityWB:IsFullyCastable() )
then
return BOT_ACTION_DESIRE_NONE;
end
if ( npcBot:GetActiveMode() == BOT_MODE_ROSHAN )
then
local npcTarget = npcBot:GetAttackTarget();
if ( mutil.IsRoshan(npcTarget) and mutil.CanCastOnMagicImmune(npcTarget) and mutil.IsInRange(npcTarget, npcBot, 800) )
then
return BOT_ACTION_DESIRE_LOW;
end
end
if mutil.IsDefending(npcBot) or mutil.IsPushing(npcBot)
then
local tableNearbyEnemyCreeps = npcBot:GetNearbyLaneCreeps( 800, true );
local tableNearbyEnemyTowers = npcBot:GetNearbyTowers( 800, true );
if ( tableNearbyEnemyCreeps ~= nil and #tableNearbyEnemyCreeps >= 3 ) or ( tableNearbyEnemyTowers ~= nil and #tableNearbyEnemyTowers >= 1 )
then
return BOT_ACTION_DESIRE_LOW;
end
end
if mutil.IsInTeamFight(npcBot, 1200)
then
local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( 1000, true, BOT_MODE_NONE );
if tableNearbyEnemyHeroes ~= nil and #tableNearbyEnemyHeroes >= 1
then
return BOT_ACTION_DESIRE_MODERATE;
end
end
if mutil.IsGoingOnSomeone(npcBot)
then
local npcTarget = npcBot:GetTarget();
if mutil.IsValidTarget(npcTarget) and mutil.IsInRange(npcTarget, npcBot, 800)
then
return BOT_ACTION_DESIRE_MODERATE;
end
end
return BOT_ACTION_DESIRE_NONE;
end
|
--黒の魔導陣
--Dark Magic Circle
--Script by dest
--e1 needs updated files from https://github.com/Fluorohydride/ygopro-scripts/pull/273 in order to work
function c900909057.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,900909057)
e1:SetOperation(c900909057.activate)
c:RegisterEffect(e1)
--remove
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(900909057,1))
e2:SetCategory(CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetRange(LOCATION_SZONE)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,100909157)
e2:SetCondition(c900909057.rmcon)
e2:SetTarget(c900909057.rmtg)
e2:SetOperation(c900909057.rmop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
end
c900909057.dark_magician_list=true
function c900909057.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_DECK)>2 end
end
function c900909057.filter(c)
return (c.dark_magician_list or c:IsCode(13604200) or c:IsCode(46986414) or c:IsCode(38033121) or c:IsCode(21082832) or c:IsCode(82404868) or c:IsCode(100301022) or c:IsCode(100909108) or c:IsCode(48680971) or c:IsCode(13604201) or c:IsCode(511000504) or c:IsCode(100000104) or c:IsCode(900000005) or c:IsCode(900909057) or c:IsCode(100909101) or c:IsCode(100000535) or c:IsCode(100909102) or c:IsCode(2314238) or c:IsCode(48680970) or c:IsCode(63391643) or c:IsCode(67227834) or c:IsCode(68334074) or c:IsCode(69542930) or c:IsCode(75190122) or c:IsCode(87210505) or c:IsCode(810000090) or c:IsCode(99789342) or c:IsCode(49702428)) and c:IsAbleToHand()
end
function c900909057.activate(e,tp,eg,ep,ev,re,r,rp,chk)
if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<3 then return end
local g=Duel.GetDecktopGroup(tp,3)
Duel.ConfirmCards(tp,g)
if g:IsExists(c900909057.filter,1,nil) and e:GetHandler():IsRelateToEffect(e)
and Duel.SelectYesNo(tp,aux.Stringid(900909057,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:FilterSelect(tp,c900909057.filter,1,1,nil)
Duel.DisableShuffleCheck()
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
Duel.ShuffleHand(tp)
Duel.SortDecktop(tp,tp,2)
else Duel.SortDecktop(tp,tp,3) end
end
function c900909057.cfilter(c,tp)
return (c:IsCode(46986414) or c:IsCode(38033121)) and c:IsControler(tp)
end
function c900909057.rmcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c900909057.cfilter,1,nil,tp)
end
function c900909057.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsAbleToRemove() end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
end
function c900909057.rmop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and e:GetHandler():IsRelateToEffect(e) then
Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)
end
end
|
local kernel = {}
kernel.language = "glsl"
kernel.category = "composite"
kernel.name = "yuv420f"
kernel.fragment =
[[
// Using BT.709 which is the standard for HDTV
const P_COLOR mat3 kColorMap = mat3(
1, 1, 1,
0, -.18732, 1.8556,
1.57481, -.46813, 0);
// BT.601, which is the standard for SDTV is provided as a reference
/*
const P_COLOR mat3 kColorMap = mat3(
1, 1, 1,
0, -.34413, 1.772,
1.402, -.71414, 0);
*/
P_COLOR vec4 FragmentKernel( P_UV vec2 texCoord )
{
P_COLOR vec3 yuv;
yuv.x = texture2D(u_FillSampler0, texCoord).r;
yuv.yz = texture2D(u_FillSampler1, texCoord).rg - vec2(0.5, 0.5);
P_COLOR vec3 rgb = kColorMap * yuv;
return vec4(rgb, 1) * v_ColorScale;
}
]]
return kernel
|
Locales['de'] = {
['actions'] = 'Aktionen',
['amount'] = 'Betrag',
['balance'] = 'Kontostand',
['bank'] = 'Bank',
['bill_amount'] = 'Rechnungsbetrag',
['billing'] = 'Rechnung',
['customer'] = 'Kunde',
['customers'] = 'Client',
['deposit'] = 'einzahlen',
['deposit_amount'] = 'Einzahlungsbetrag',
['deposit_society_money'] = 'Geld in Firma einzahlen',
['invalid_amount'] = 'ungültiger Betrag',
['no_player_nearby'] = 'kein Spieler in der Nähe',
['press_input_context_to_open_menu'] = 'Drücke ~INPUT_CONTEXT~ um das Menü zu öffnen',
['property'] = 'Immobilie',
['wash_money'] = 'Geld waschen',
['withdraw'] = 'Abheben',
['withdraw_amount'] = 'Abhebebetrag',
['withdraw_society_money'] = 'Firmengeld abheben',
['bank_customer'] = 'Bankkunde',
}
|
table.max = function(t)
if #t == 0 then
return nil
end
local m = t[1]
for i = 2, #t do
if t[i] > m then
m = t[i]
end
end
return m
end
palindromes = {}
for x = 100, 999, 1 do
for y = 100, 999, 1 do
product = x * y
s = tostring(product)
if s == string.reverse(s) then
table.insert(palindromes, product)
end
end
end
print(table.max(palindromes))
|
i = 0
if i == 0 then
print("test")
end
while i ~= 0 do
print("test")
end
repeat
print("test")
until i == 0
for j = 0, 1, 1 do
print("test")
end
|
--[[
--=====================================================================================================--
Script Name: Force Chat, for SAPP (PC & CE)
Description: Force a player to say something.
Command Examples:
/fchat 1 hello there!
* Forces player #1 to say "hi there" (uses global chat format)
> output: Chalwk: hello there!
/fchat 1 hello there! -team
- output: [Chalwk]: hello there!
* Forces player #1 to say "hi there" (uses team chat format)
/fchat 1 hello there! -vehicle
- output: [Chalwk]: hello there!
* Forces player #1 to say "hi there" (uses vehicle chat format similar to team format)
/fchat 1 hello there! -global
- output: Chalwk: hello there!
* Forces player #1 to say "hi there" (uses global chat format - same as first example)
Copyright (c) 2020, Jericho Crosby <[email protected]>
* Notice: You can use this document subject to the following conditions:
https://github.com/Chalwk77/HALO-SCRIPT-PROJECTS/blob/master/LICENSE
--=====================================================================================================--
]]--
-- Configuration Starts --------------------------------------------------------------
local ForceChat = {
-- Command Syntax: /command <pid> {message} [opt -global, -team, -vehicle]
command = "fchat",
-- Minimum permission level required to execute /command
permission = 1,
-- If you do not specify a message type, this will be the default message format:
default = "%name%: %message%",
-- Message format based on message type:
specific_format = {
-- [-keyword] {"message format", message type}
["-global"] = { "%name%: %message%", 1 },
["-team"] = { "[%name%]: %message%", 2 },
["-vehicle"] = { "[%name%]: %message%", 3 },
},
-- A message relay function temporarily removes the server prefix
-- and will restore it to this when the relay is finished
server_prefix = "**SAPP**",
--
}
-- Configuration Ends --------------------------------------------------------------
local gsub = string.gsub
api_version = "1.12.0.0"
function OnScriptLoad()
register_callback(cb["EVENT_COMMAND"], "OnServerCommand")
end
local function CMDSplit(CMD)
local Args = {}
CMD = CMD:gsub('"', "")
for Params in CMD:gmatch("([^%s]+)") do
Args[#Args + 1] = Params:lower()
end
return Args
end
local function InVehicle(Ply)
local DyN = get_dynamic_player(Ply)
local vehicle = read_dword(DyN + 0x11C)
return ((DyN ~= 0 and vehicle ~= 0xFFFFFFFF)) or false
end
function ForceChat:SendMessage(MSG, Type, Team, Ply, TID)
execute_command("msg_prefix \"\"")
if (Type == 1) then
say_all(MSG)
elseif (Type == 2 or Type == 3) then
for i = 1, 16 do
if player_present(i) then
local team = get_var(i, "$team")
if (Type == 2 and team == Team) then
say(i, MSG)
elseif (Type == 3) then
if InVehicle(TID) then
if (TID == i) then
say(TID, MSG)
elseif (team == Team and InVehicle(i, Team)) then
say(i, MSG)
end
else
local name = get_var(TID, "$name")
self:Respond(Ply, name .. " is not in a vehicle!", 10)
break
end
end
end
end
end
execute_command("msg_prefix \" " .. self.server_prefix .. "\"")
end
function ForceChat:OnCommand(Ply, CMD)
local Args = CMDSplit(CMD)
if (Args and Args[1] == self.command) then
local lvl = tonumber(get_var(Ply, "$lvl"))
if (lvl >= self.permission or Ply == 0) then
if (Args[2] ~= nil and Args[2]:match("^%d+$")) then
local TID = tonumber(Args[2])
if player_present(TID) then
if (TID ~= Ply) then
local str_format = self.default
local cmd_len = self.command:len()
local cmd_to_replace = CMD:sub(1, cmd_len + 1)
local message = CMD:match(cmd_to_replace .. "[%s%d+%s](.*)")
local name = get_var(TID, "$name")
local team = get_var(TID, "$team")
local index = 1
for k, v in pairs(self.specific_format) do
if (CMD:match(k)) then
index = v[2]
str_format = gsub(gsub(v[1], "%%name%%", name), "%%message%%", message)
message = str_format:gsub(k, "")
return false, self:SendMessage(message, index, team, Ply, TID)
end
end
message = gsub(gsub(str_format, "%%name%%", name), "%%message%%", message)
self:SendMessage(message, index, team, Ply, TID)
else
self:Respond(Ply, "You cannot execute this command on yourself!", 10)
end
else
self:Respond(Ply, "Player #" .. TID .. " is not online.", 10)
end
else
self:Respond(Ply, "Please enter a valid player id: [1-16]", 10)
end
else
self:Respond(Ply, "Insufficient Permission", 10)
end
return false
end
end
function ForceChat:Respond(Ply, Message, Color)
Color = Color or 10
if (Ply == 0) then
cprint(Message, Color)
else
rprint(Ply, Message)
end
end
function OnServerCommand(P, C)
return ForceChat:OnCommand(P, C)
end
function OnScriptUnload()
-- N/A
end |
local constant = {}
--庄家模式
constant.BankerMode = {
YING = 1, -- 赢家做庄
LIAN = 2, -- 连庄 按顺序坐庄
RAND = 3, -- 随机庄家
}
constant.OVER_TYPE = {
NORMAL = 1, --正常胡牌
FLOW = 2, --流局
}
constant.TYPE = {
CHI = 1,
PENG = 2,
PENG_GANG = 3,
MING_GANG = 4,
AN_GANG = 5,
HU = 6,
TING = 7
}
constant.FANTYPE = {
QIA_ZHANG = "QIA_ZHANG",
BIAN_ZHANG = "BIAN_ZHANG",
DAN_DIAO = "DAN_DIAO",
QUE_MEN = "QUE_MEN",
MEN_QING = "MEN_QING",
AN_KA = "AN_KA",
QING_YI_SE = "QING_YI_SE",
YI_TIAO_LONG = "YI_TIAO_LONG",
QI_XIAO_DUI = "QI_XIAO_DUI",
HAO_HUA_QI_XIAO_DUI = "HAO_HUA_QI_XIAO_DUI",
SHI_SHAN_YAO = "SHI_SHAN_YAO",
}
return constant |
---@class HairOutfitDefinitions
HairOutfitDefinitions = HairOutfitDefinitions or {};
-- forbid some haircut for later in the apocalypse
-- also make some available only for certain outfit
HairOutfitDefinitions.haircutDefinition = {};
local cat = {};
cat.name = "MohawkShort";
cat.onlyFor = "Punk,Bandit,Redneck,Biker,PrivateMilitia";
table.insert(HairOutfitDefinitions.haircutDefinition, cat);
local cat = {};
cat.name = "MohawkFan";
cat.onlyFor = "Punk,Bandit";
table.insert(HairOutfitDefinitions.haircutDefinition, cat);
local cat = {};
cat.name = "MohawkSpike";
cat.minWorldAge = 180;
cat.onlyFor = "Punk,Bandit";
table.insert(HairOutfitDefinitions.haircutDefinition, cat);
local cat = {};
cat.name = "LibertySpikes";
cat.minWorldAge = 180;
cat.onlyFor = "Punk,Bandit";
table.insert(HairOutfitDefinitions.haircutDefinition, cat);
local cat = {};
cat.name = "Cornrows";
cat.onlyFor = "Punk,Bandit,Redneck,Biker,BaseballPlayer_KY,BaseballPlayer_Rangers,BaseballPlayer_Z,StreetSports";
table.insert(HairOutfitDefinitions.haircutDefinition, cat);
-- define possible haircut based on outfit
-- if nothing is defined for a outfit, we just pick a random one
-- the haircuts in ZombiesZoneDefinitions take precedence over this!
-- this is used mainly for stories, so when i spawn a punk, i want more chance to have a mohawk on him..
HairOutfitDefinitions.haircutOutfitDefinition = {};
local cat = {};
cat.outfit = "Bandit";
cat.haircut = "LibertySpikes:5;MohawkFan:5;MohawkShort:5;MohawkSpike:5"; -- total should not exced 100! anything "left over" will be a random haircut
cat.haircutColor = "0.98,0.87,0:10;0.82,0.15,0.07:10;0.21,0.6,0.3:10;0.26,0.6,0.81:10"; -- forcing a haircut color, total should not exced 100 anything "left over" will be a random color from our default color
table.insert(HairOutfitDefinitions.haircutOutfitDefinition, cat);
local cat = {};
cat.outfit = "Punk";
cat.haircut = "LibertySpikes:7;MohawkFan:10;MohawkShort:10;MohawkSpike:7";
cat.haircutColor = "0.98,0.87,0:10;0.82,0.15,0.07:10;0.21,0.6,0.3:10;0.26,0.6,0.81:10";
table.insert(HairOutfitDefinitions.haircutOutfitDefinition, cat);
local cat = {};
cat.outfit = "PrivateMilitia";
cat.beard = "Long:30;Goatee:10;Full:10;LongScruffy:20";
cat.haircut = "MohawkShort:5";
table.insert(HairOutfitDefinitions.haircutOutfitDefinition, cat);
local cat = {};
cat.outfit = "HockeyPsycho";
cat.haircut = "Bob:100;";
table.insert(HairOutfitDefinitions.haircutOutfitDefinition, cat);
|
local line_height= get_line_height()
local option_set_elements= (SCREEN_HEIGHT / line_height) - 5
local sect_width= SCREEN_WIDTH/2
local sect_height= SCREEN_HEIGHT
local rate_coordinator= setmetatable({}, rate_coordinator_interface_mt)
rate_coordinator:initialize()
dofile(THEME:GetPathO("", "art_helpers.lua"))
dofile(THEME:GetPathO("", "options_menu.lua"))
dofile(THEME:GetPathO("", "sick_options_parts.lua"))
local bpm_disps= {}
local args= {}
local menus= {}
local frames= {}
local in_color_manip= {}
local color_manips= {}
local color_manip_x= (sect_width * .5) + 48
local color_manip_y= 100 + (line_height * 3)
local menu_y= 0
local base_options= get_sick_options(rate_coordinator, color_manips, bpm_disps)
for i, pn in ipairs(GAMESTATE:GetEnabledPlayers()) do
local menu= setmetatable({}, menu_stack_mt)
local bpm= setmetatable({}, bpm_disp_mt)
local frame= setmetatable({}, frame_helper_mt)
local manip= setmetatable({}, color_manipulator_mt)
local mx, my= 0, 0
if pn == PLAYER_2 then
mx= sect_width
end
local pcolor= pn_to_color(pn)
local pname= pn
local pro= PROFILEMAN:GetProfile(pn)
if pro and pro:GetDisplayName() ~= "" then
pname= pro:GetDisplayName()
end
args[#args+1]= Def.ActorFrame{
Name= "decs" .. pn, InitCommand= function(self)
self:xy(mx, my)
manip:hide()
end,
frame:create_actors(
"frame", 2, sect_width, sect_height, pcolor, fetch_color("bg", .5),
sect_width/2, sect_height/2),
normal_text("name", pname, pcolor, nil, 8, line_height / 2, 1, left),
bpm:create_actors("bpm", pn, sect_width/2, line_height*1.5, sect_width),
manip:create_actors("color_manip", color_manip_x, color_manip_y),
}
local status_size= line_height*2.5
menu_y= status_size
args[#args+1]= menu:create_actors(
"m" .. pn, mx, menu_y, sect_width, sect_height-status_size, pn)
menus[pn]= menu
bpm_disps[pn]= bpm
frames[pn]= frame
color_manips[pn]= manip
end
local function refit_cursor_to_color_manip(pn)
local fit= color_manips[pn]:get_cursor_fit()
fit[2]= fit[2] - menu_y
menus[pn]:refit_cursor(fit)
end
function args:InitCommand()
for pn, menu in pairs(menus) do
menu:push_options_set_stack(options_sets.menu, base_options, "Play Song")
menu:update_cursor_pos()
end
end
local function apply_preferred_mods()
GAMESTATE:GetPlayerState(PLAYER_1):ApplyPreferredOptionsToOtherLevels()
GAMESTATE:GetPlayerState(PLAYER_2):ApplyPreferredOptionsToOtherLevels()
GAMESTATE:ApplyPreferredSongOptionsToOtherLevels()
end
local saw_first_press= {}
local function input(event)
input_came_from_keyboard= event.DeviceInput.device == "InputDevice_Key"
local press_type= event.type
if press_type == "InputEventType_FirstPress" then
saw_first_press[event.DeviceInput.button]= true
end
if not saw_first_press[event.DeviceInput.button] then return end
if press_type == "InputEventType_Release" then
saw_first_press[event.DeviceInput.button]= nil
end
if event.type == "InputEventType_Release" then return end
local pn= event.PlayerNumber
local code= event.GameButton
if menus[pn] then
if not menus[pn]:interpret_code(code) then
if code == "Start" then
local all_on_exit= true
for k, m in pairs(menus) do
if not m:can_exit_screen() then
all_on_exit= false
end
end
if all_on_exit then
SOUND:PlayOnce(THEME:GetPathS("Common", "Start"))
if in_edit_mode then
set_speed_from_speed_info(cons_players[PLAYER_1])
apply_preferred_mods()
trans_new_screen("none")
else
trans_new_screen("ScreenStageInformation")
end
end
elseif code == "Back" then
SOUND:PlayOnce(THEME:GetPathS("Common", "cancel"))
if in_edit_mode then
apply_preferred_mods()
trans_new_screen("none")
else
trans_new_screen("ScreenConsSelectMusic")
end
end
end
if menus[pn].external_thing then
refit_cursor_to_color_manip(pn)
end
end
end
if in_edit_mode then
cons_players[PLAYER_1].options_level= 4
cons_players[PLAYER_2].options_level= 4
end
args[#args+1]= Def.Actor{
Name= "code_interpreter", OnCommand= function(self)
SCREENMAN:GetTopScreen():AddInputCallback(input)
end,
went_to_text_entryMessageCommand= function(self)
saw_first_press= {}
end,
}
return Def.ActorFrame(args)
|
-- alnbox, alignment viewer based on the curses library
-- Copyright (C) 2015 Boris Nagaev
-- See the LICENSE file for terms of use
describe("alnbox.columnDigit", function()
it("gets a digit for top header", function()
local columnDigit = require 'alnbox.columnDigit'
local digits = {}
local length = 25
for i = 0, length - 1 do
table.insert(digits, columnDigit(i, length))
end
assert.equal(" 10 20 ",
table.concat(digits))
end)
local function axis(length)
local columnDigit = require 'alnbox.columnDigit'
local digits = {}
for i = 0, length - 1 do
table.insert(digits, columnDigit(i, length))
end
return table.concat(digits)
end
it("gets axis", function()
assert.equal(" 10 20 ", axis(25))
assert.equal(" 10", axis(10))
assert.equal(" ", axis(9))
assert.equal(" ", axis(5))
assert.equal(" 10 20", axis(20))
assert.equal(" 10 20 ", axis(21))
assert.equal(" 10 ", axis(18))
assert.equal(" 10 ", axis(19))
end)
end)
|
object_tangible_collection_deathtrooper_alpha_torn_shirt_01 = object_tangible_collection_shared_deathtrooper_alpha_torn_shirt_01:new {
gameObjectType = 8211,}
ObjectTemplates:addTemplate(object_tangible_collection_deathtrooper_alpha_torn_shirt_01, "object/tangible/collection/deathtrooper_alpha_torn_shirt_01.iff") |
pico-8 cartridge // http://www.pico-8.com
version 18
__lua__
|
-- Source: https://github.com/AmrEldib/cmder-powerline-prompt
--- promptValue is whether the displayed prompt is the full path or only the folder name
-- Use:
-- "full" for full path like C:\Windows\System32
local promptValueFull = "full"
-- "folder" for folder name only like System32
local promptValueFolder = "folder"
-- default is promptValueFull
local promptValue = promptValueFull
local function get_folder_name(path)
local reversePath = string.reverse(path)
local slashIndex = string.find(reversePath, "\\")
return string.sub(path, string.len(path) - slashIndex + 2)
end
-- Resets the prompt
function lambda_prompt_filter()
cwd = clink.get_cwd()
if promptValue == promptValueFolder then
cwd = get_folder_name(cwd)
end
prompt = "\x1b[37;44m{cwd} {git}{hg}\n\x1b[1;30;40m{lamb} \x1b[0m"
new_value = string.gsub(prompt, "{cwd}", cwd)
clink.prompt.value = string.gsub(new_value, "{lamb}", "λ")
end
local arrowSymbol = ""
local branchSymbol = ""
--- copied from clink.lua
-- Resolves closest directory location for specified directory.
-- Navigates subsequently up one level and tries to find specified directory
-- @param {string} path Path to directory will be checked. If not provided
-- current directory will be used
-- @param {string} dirname Directory name to search for
-- @return {string} Path to specified directory or nil if such dir not found
local function get_dir_contains(path, dirname)
-- return parent path for specified entry (either file or directory)
local function pathname(path)
local prefix = ""
local i = path:find("[\\/:][^\\/:]*$")
if i then
prefix = path:sub(1, i-1)
end
return prefix
end
-- Navigates up one level
local function up_one_level(path)
if path == nil then path = '.' end
if path == '.' then path = clink.get_cwd() end
return pathname(path)
end
-- Checks if provided directory contains git directory
local function has_specified_dir(path, specified_dir)
if path == nil then path = '.' end
local found_dirs = clink.find_dirs(path..'/'..specified_dir)
if #found_dirs > 0 then return true end
return false
end
-- Set default path to current directory
if path == nil then path = '.' end
-- If we're already have .git directory here, then return current path
if has_specified_dir(path, dirname) then
return path..'/'..dirname
else
-- Otherwise go up one level and make a recursive call
local parent_path = up_one_level(path)
if parent_path == path then
return nil
else
return get_dir_contains(parent_path, dirname)
end
end
end
-- copied from clink.lua
-- clink.lua is saved under %CMDER_ROOT%\vendor
local function get_hg_dir(path)
return get_dir_contains(path, '.hg')
end
-- adopted from clink.lua
-- clink.lua is saved under %CMDER_ROOT%\vendor
function colorful_hg_prompt_filter()
-- Colors for mercurial status
local colors = {
clean = "\x1b[1;37;40m",
dirty = "\x1b[31;1m",
}
if get_hg_dir() then
-- if we're inside of mercurial repo then try to detect current branch
local branch = get_hg_branch()
if branch then
-- Has branch => therefore it is a mercurial folder, now figure out status
if get_hg_status() then
color = colors.clean
else
color = colors.dirty
end
clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", color.."("..branch..")")
return false
end
end
-- No mercurial present or not in mercurial file
clink.prompt.value = string.gsub(clink.prompt.value, "{hg}", "")
return false
end
-- copied from clink.lua
-- clink.lua is saved under %CMDER_ROOT%\vendor
local function get_git_dir(path)
-- return parent path for specified entry (either file or directory)
local function pathname(path)
local prefix = ""
local i = path:find("[\\/:][^\\/:]*$")
if i then
prefix = path:sub(1, i-1)
end
return prefix
end
-- Checks if provided directory contains git directory
local function has_git_dir(dir)
return #clink.find_dirs(dir..'/.git') > 0 and dir..'/.git'
end
local function has_git_file(dir)
local gitfile = io.open(dir..'/.git')
if not gitfile then return false end
local git_dir = gitfile:read():match('gitdir: (.*)')
gitfile:close()
return git_dir and dir..'/'..git_dir
end
-- Set default path to current directory
if not path or path == '.' then path = clink.get_cwd() end
-- Calculate parent path now otherwise we won't be
-- able to do that inside of logical operator
local parent_path = pathname(path)
return has_git_dir(path)
or has_git_file(path)
-- Otherwise go up one level and make a recursive call
or (parent_path ~= path and get_git_dir(parent_path) or nil)
end
---
-- Get the status of working dir
-- @return {bool}
---
function get_git_status()
local file = io.popen("git status --no-lock-index --porcelain 2>nul")
for line in file:lines() do
file:close()
return false
end
file:close()
return true
end
-- adopted from clink.lua
-- Modified to add colors and arrow symbols
function colorful_git_prompt_filter()
-- Colors for git status
local colors = {
clean = "\x1b[34;42m"..arrowSymbol.."\x1b[37;42m ",
dirty = "\x1b[34;43m"..arrowSymbol.."\x1b[30;43m ",
}
local closingcolors = {
clean = " \x1b[32;40m"..arrowSymbol,
dirty = "± \x1b[33;40m"..arrowSymbol,
}
local git_dir = get_git_dir()
if git_dir then
-- if we're inside of git repo then try to detect current branch
local branch = get_git_branch(git_dir)
if branch then
-- Has branch => therefore it is a git folder, now figure out status
if get_git_status() then
color = colors.clean
closingcolor = closingcolors.clean
else
color = colors.dirty
closingcolor = closingcolors.dirty
end
--clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.." "..branch..closingcolor)
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.." "..branchSymbol.." "..branch..closingcolor)
return false
end
end
-- No git present or not in git file
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", "\x1b[34;40m"..arrowSymbol)
return false
end
-- override the built-in filters
clink.prompt.register_filter(lambda_prompt_filter, 55)
clink.prompt.register_filter(colorful_hg_prompt_filter, 60)
clink.prompt.register_filter(colorful_git_prompt_filter, 60)
|
local id = {}
local ids = {}
function id.get(name)
return ids[name]
end
function id.new(name, newID)
ids[name] = newID
end
return id
|
return PlaceObj("ModDef", {
"title", "Alien Visitors",
"version", 2,
"version_major", 0,
"version_minor", 2,
"saved", 0,
"image", "Preview.png",
"id", "ChoGGi_AlienVisitors",
"steam_id", "1569952407",
"pops_any_uuid", "9be66a96-5731-4b56-8176-1af851ce18c4",
"author", "ChoGGi",
"lua_revision", 249143,
"code", {
"Code/Script.lua",
},
"has_options", true,
"description", [[It'll spawn a few aliens that walk around. Maybe I'll add some sort of ship drop-off anim...
There's a mod options to set the max spawned amount. It'll only work on new games or games that don't have aliens.]],
})
|
local map = require "settings.utils".map
local g = vim.g
g.floaterm_autoclose = 0
g.floaterm_width=0.85
g.floaterm_height=0.65
-- g.floaterm_winblend=0.7
g.floaterm_autoinsert=1
g.floaterm_keymap_kill = '<F10>'
g.floaterm_keymap_toggle = '<F12>'
g.floaterm_title = '[$1/$2]'
-- g.floaterm_title = require"settings.utils".get_toggleterm_name()
-- g.floaterm_borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'}
g.floaterm_rootmarkers = { ".git", ".gitignore", "package.json" }
-- map("n", "<F12>", ":FloatermToggle<CR>")
map("t", "<Esc><Esc>", "<C-\\><C-n>:FloatermToggle<CR>")
|
local mod = DBM:NewMod("d286", "DBM-WorldEvents", 1)
local L = mod:GetLocalizedStrings()
mod:SetRevision(("$Revision: 14030 $"):sub(12, -3))
mod:SetCreatureID(25740)--25740 Ahune, 25755, 25756 the two types of adds
mod:SetModelID(23447)--Frozen Core, ahunes looks pretty bad.
mod:SetZone()
mod:SetReCombatTime(10)
mod:RegisterCombat("combat")
mod:SetMinCombatTime(15)
mod:RegisterEventsInCombat(
"SPELL_AURA_APPLIED 45954",
"SPELL_AURA_REMOVED 45954"
)
local warnSubmerged = mod:NewSpellAnnounce(37751, 2, "Interface\\AddOns\\DBM-Core\\textures\\CryptFiendBurrow.blp")
local warnEmerged = mod:NewAnnounce("Emerged", 2, "Interface\\AddOns\\DBM-Core\\textures\\CryptFiendUnBurrow.blp")
local specWarnAttack = mod:NewSpecialWarning("specWarnAttack")
local timerEmerge = mod:NewTimer(35.5, "EmergeTimer", "Interface\\AddOns\\DBM-Core\\textures\\CryptFiendUnBurrow.blp", nil, nil, 6)
local timerSubmerge = mod:NewTimer(92, "SubmergTimer", "Interface\\AddOns\\DBM-Core\\textures\\CryptFiendBurrow.blp", nil, nil, 6)--Variable, 92-96
function mod:OnCombatStart(delay)
timerSubmerge:Start(95-delay)--first is 95, rest are 92
end
function mod:SPELL_AURA_APPLIED(args)
if args.spellId == 45954 then -- Ahunes Shield
warnEmerged:Show()
timerSubmerge:Start()
end
end
function mod:SPELL_AURA_REMOVED(args)
if args.spellId == 45954 then -- Ahunes Shield
warnSubmerged:Show()
timerEmerge:Start()
specWarnAttack:Show()
end
end |
local capDashCountOnGround = {}
capDashCountOnGround.name = "FrostHelper/CapDashOnGroundTrigger"
capDashCountOnGround.placements = {
name = "normal"
}
return capDashCountOnGround |
local function table_deepcopy_internal(orig, cyclic)
cyclic = cyclic or {}
local copy = orig
if type(orig) == 'table' then
local mt, copy_function = getmetatable(orig), nil
if mt then copy_function = mt.__copy end
if copy_function == nil then
copy = {}
if cyclic[orig] ~= nil then
copy = cyclic[orig]
else
cyclic[orig] = copy
for orig_key, orig_value in pairs(orig) do
local key = table_deepcopy_internal(orig_key, cyclic)
copy[key] = table_deepcopy_internal(orig_value, cyclic)
end
if mt ~= nil then setmetatable(copy, mt) end
end
else
copy = copy_function(orig)
end
end
return copy
end
--- Deepcopy lua table (all levels)
-- Supports __copy metamethod for copying custom tables with metatables
-- @function deepcopy
-- @table inp original table
-- @shallow[opt] sep flag for shallow copy
-- @returns table (copy)
local function table_deepcopy(orig)
return table_deepcopy_internal(orig, nil)
end
--- Copy any table (only top level)
-- Supports __copy metamethod for copying custom tables with metatables
-- @function copy
-- @table inp original table
-- @shallow[opt] sep flag for shallow copy
-- @returns table (copy)
local function table_shallowcopy(orig)
local copy = orig
if type(orig) == 'table' then
local mt, copy_function = getmetatable(orig), nil
if mt then copy_function = mt.__copy end
if copy_function == nil then
copy = {}
for orig_key, orig_value in pairs(orig) do
copy[orig_key] = orig_value
end
if mt ~= nil then setmetatable(copy, mt) end
else
copy = copy_function(orig)
end
end
return copy
end
--- Compare two lua tables
-- Supports __eq metamethod for comparing custom tables with metatables
-- @function equals
-- @return true when the two tables are equal (false otherwise).
local function table_equals(a, b)
if type(a) ~= 'table' or type(b) ~= 'table' then
return type(a) == type(b) and a == b
end
local mta = getmetatable(a)
local mtb = getmetatable(b)
-- Let Lua decide what should happen when at least one of the tables has a
-- metatable.
if mta and mta.__eq or mtb and mtb.__eq then
return a == b
end
for k, v in pairs(a) do
if not table_equals(v, b[k]) then
return false
end
end
for k, _ in pairs(b) do
if not a[k] then
return false
end
end
return true
end
-- table library extension
local table = require('table')
-- require modifies global "table" module and adds functions "clear" and "new".
-- Lua applications like Cartridge rely on it.
require('table.clear')
require('table.new')
table.copy = table_shallowcopy
table.deepcopy = table_deepcopy
table.equals = table_equals
|
require("graphics")
dataref("first_axis", "sim/joystick/joystick_axis_values", "readonly", 0)
dataref("second_axis", "sim/joystick/joystick_axis_values", "readonly", 1)
function draw_some_stuff()
for i=0, 360, 30 do
graphics.set_color(0, 0, 1)
graphics.draw_angle_line(500, 500, i, 200)
graphics.set_color(1, 0, 0)
graphics.draw_angle_arrow(500, 500, i + 15, 100, 20, 2.5)
graphics.set_color(0, 1, 0)
graphics.draw_tick_mark(500, 500, i + 10, 200, 20, 2.5)
graphics.draw_outer_tracer(500, 500, i + 20, 200)
graphics.set_color(1, 1, 0)
graphics.draw_inner_tracer(500, 500, i + 15, 200)
end
graphics.set_color(1, 1, 1)
graphics.draw_circle(500, 500, 200)
graphics.draw_circle(500, 500, 100)
graphics.draw_filled_circle(500, 500, 10)
graphics.set_color(0, 1, 0)
graphics.draw_filled_arc(1000, 500, 20, 80, 200)
graphics.set_color(1, 1, 0)
graphics.draw_filled_arc(1000, 500, 60, 80, 200)
graphics.set_color(1, 0, 0)
graphics.draw_filled_arc(1000, 500, 75, 80, 200)
graphics.set_color(0, 0, 0)
graphics.draw_filled_arc(1000, 500, 20, 80, 190)
graphics.set_color(1, 1, 1)
graphics.draw_arc(1000, 500, 20, 80, 200)
graphics.draw_angle_arrow(1000, 500, first_axis * 60 + 20, 200, 20, 2.5)
graphics.draw_outer_tracer(1000, 500, second_axis * 60 + 20, 200, 15)
graphics.draw_filled_circle(1000, 500, 5)
end
do_every_draw("draw_some_stuff()") |
--------------------------------------------------------------------------------------
-- Simple tile mapper script by Infinite Rain, based on a sample by Unreal Software --
--------------------------------------------------------------------------------------
if not CSample then
require("sys/lua/CS2D-AmplifiedScripting")
CSample = {}
end
CSample.tileMapper = {
player = {}
}
-----------------------------------------------------
-- Table which holds functions, later to be hooked --
-----------------------------------------------------
CSample.tileMapper.hook = {
-- On join, creating a data table for this player.
join = function(player)
CSample.tileMapper.player[player] = {
frame = 0,
x = 0,
y = 0,
mode = 0,
infoHudText = cas.hudText.new(
player,
5,
105,
"left",
cas.color.white,
"Info: ",
cas.color.blue,
"[F2] - Set tile [F3] - Pick tile [F4] - Get tile info")
}
end,
-- On leave, removing the data table of this player.
leave = function(player)
CSample.tileMapper.player[player] = nil
end,
-- On serveraction, request client data and change modes.
serveraction = function(player, action)
if action == 1 then
CSample.tileMapper.player[player].mode = 0
elseif action == 2 then
CSample.tileMapper.player[player].mode = 1
elseif action == 3 then
CSample.tileMapper.player[player].mode = 2
end
player:requestClientData("cursoronmap")
end,
-- On clientdata reception, perform actions.
clientdata = function(player, mode, data1, data2)
if mode == "cursoronmap" then
local tileX, tileY = math.floor(data1 / 32), math.floor(data2 / 32)
if tileX >= 0 and tileY >= 0 and tileX <= cas.map.getXSize() and tileY <= cas.map.getYSize() then
-- Set tile.
if CSample.tileMapper.player[player].mode == 0 then
cas.tile.setTile(tileX, tileY, CSample.tileMapper.player[player].frame)
player:messageToChat("Changed tile at " .. tileX .."|".. tileY ..".")
-- Pick tile.
elseif CSample.tileMapper.player[player].mode == 1 then
CSample.tileMapper.player[player].frame = cas.tile.getFrame(tileX, tileY)
player:messageToChat("Tile frame is now ".. CSample.tileMapper.player[player].frame)
-- Display tile info.
elseif CSample.tileMapper.player[player].mode == 2 then
-- Removing the old text.
if CSample.tileMapper.player[player].tileInfoHudText then
CSample.tileMapper.player[player].tileInfoHudText:free()
end
-- Showing the text on screen.
CSample.tileMapper.player[player].tileInfoHudText = cas.hudText.new(
player,
5,
125,
"left",
cas.color.white,
"Tile on ".. tileX .."|".. tileY .." info: ",
cas.color.blue,
"frame: ".. cas.tile.getFrame(tileX, tileY) .." prop: ".. cas.tile.getProperty(tileX, tileY)
.." custom frame: ".. tostring(cas.tile.isChanged(tileX, tileY)) .." original frame: "
.. cas.tile.getOriginalFrame(tileX, tileY))
end
end
end
end
}
------------------------------------
-- Hooking the declared functions --
------------------------------------
CSample.tileMapper.joinHook = cas.hook.new("join", CSample.tileMapper.hook.join)
CSample.tileMapper.leaveHook = cas.hook.new("leave", CSample.tileMapper.hook.leave)
CSample.tileMapper.serveractionHook = cas.hook.new("serveraction", CSample.tileMapper.hook.serveraction)
CSample.tileMapper.clientdataHook = cas.hook.new("clientdata", CSample.tileMapper.hook.clientdata) |
return
{
"prototypes.angel-petro-additions",
"prototypes.angel-refining-additions",
"prototypes.chrome",
"prototypes.clay",
"prototypes.fluorite",
"prototypes.limestone",
"prototypes.manganese",
"prototypes.platinum",
"prototypes.salt",
"prototypes.sand",
"prototypes.soil",
} |
return {
romMatch = function(name) startsWith(name:lower(), "lsdj") end,
groups = {
{
"Off",
require("MidiSync"),
require("MidiSyncArduinoboy"),
require("MidiMap")
}, {
require("AutoPlay")
}
}
}
|
---@type vm
local vm = require 'vm.vm'
local searcher = require 'core.searcher'
function vm.getRefs(source, field)
return searcher.requestReference(source, field)
end
function vm.getAllRefs(source, field)
return searcher.requestAllReference(source, field)
end
|
local bit = require 'bit'
local M = {}
function M.IPv6(address)
--[[
(c) 2008 Jo-Philipp Wich <[email protected]>
(c) 2008 Steven Barth <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License").
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
]]--
local data = {}
local borderl = address:sub(1, 1) == ":" and 2 or 1
local borderh, zeroh, chunk, block
if #address > 45 then return nil end
repeat
borderh = address:find(":", borderl, true)
if not borderh then break end
block = tonumber(address:sub(borderl, borderh - 1), 16)
if block and block <= 0xFFFF then
data[#data+1] = block
else
if zeroh or borderh - borderl > 1 then return nil end
zeroh = #data + 1
end
borderl = borderh + 1
until #data == 7
chunk = address:sub(borderl)
if #chunk > 0 and #chunk <= 4 then
block = tonumber(chunk, 16)
if not block or block > 0xFFFF then return nil end
data[#data+1] = block
elseif #chunk > 4 then
if #data == 7 or #chunk > 15 then return nil end
borderl = 1
for i=1, 4 do
borderh = chunk:find(".", borderl, true)
if not borderh and i < 4 then return nil end
borderh = borderh and borderh - 1
block = tonumber(chunk:sub(borderl, borderh))
if not block or block > 255 then return nil end
if i == 1 or i == 3 then
data[#data+1] = block * 256
else
data[#data] = data[#data] + block
end
borderl = borderh and borderh + 2
end
end
if zeroh then
if #data == 8 then return nil end
while #data < 8 do
table.insert(data, zeroh, 0)
end
end
if #data == 8 then
return data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]
end
end
function M.mac_to_ip(prefix, mac, firstbyte, secondbyte)
local m1, m2, m3, m6, m7, m8 = string.match(mac, '(%x%x):(%x%x):(%x%x):(%x%x):(%x%x):(%x%x)')
local m4 = firstbyte or 0xff
local m5 = secondbyte or 0xfe
m1 = bit.bxor(tonumber(m1, 16), 0x02)
local h1 = 0x100 * m1 + tonumber(m2, 16)
local h2 = 0x100 * tonumber(m3, 16) + m4
local h3 = 0x100 * m5 + tonumber(m6, 16)
local h4 = 0x100 * tonumber(m7, 16) + tonumber(m8, 16)
prefix = string.match(prefix, '(.*)/%d+')
local p1, p2, p3, p4 = M.IPv6(prefix)
return string.format("%x:%x:%x:%x:%x:%x:%x:%x/%d", p1, p2, p3, p4, h1, h2, h3, h4, 128)
end
return M
|
return {'zojuist','zoja','zojas'} |
msg = {"pravougli", "jednakokraki", "kosougli"}
|
-- Query and log client software
local st = require"util.stanza";
local uuid = require"util.uuid".generate;
local xmlns_iq_version = "jabber:iq:version";
local version_id = uuid();
local xmlns_disco_info = "http://jabber.org/protocol/disco#info";
local disco_id = uuid();
module:hook("presence/bare", function(event)
local origin, stanza = event.origin, event.stanza;
if origin.type == "c2s" and not origin.presence and not stanza.attr.to then
module:add_timer(1, function()
if origin.type ~= "c2s" then return end
origin.log("debug", "Sending version query");
origin.send(st.iq({ id = version_id, type = "get", from = module.host, to = origin.full_jid }):query(xmlns_iq_version));
end);
end
end, 1);
module:hook("iq-result/host/"..version_id, function(event)
local origin, stanza = event.origin, event.stanza;
local query = stanza:get_child("query", xmlns_iq_version);
if query then
local client = query:get_child_text("name");
if client then
local version = query:get_child_text("version");
if version then
client = client .. " version " .. version;
end
origin.log("info", "Running %s", client);
end
end
return true;
end);
module:hook("iq-error/host/"..version_id, function(event)
local origin, stanza = event.origin, event.stanza;
origin.send(st.iq({ id = disco_id, type = "get", from = module.host, to = origin.full_jid }):query(xmlns_disco_info));
return true;
end);
module:hook("iq-result/host/"..disco_id, function(event)
local origin, stanza = event.origin, event.stanza;
local query = stanza:get_child("query", xmlns_disco_info);
if query then
local ident = query:get_child("identity");
if ident and ident.attr.name then
origin.log("info", "Running %s", ident.attr.name);
end
end
return true;
end);
module:hook("iq-error/host/"..disco_id, function()
return true; -- Doesn't reply to disco#info? Weird, but ignore for now.
end);
|
local config = require("config")
local nvim_lsp = require("lspconfig")
local servers = {
"gopls",
"pyright",
"rust_analyzer",
}
local function on_attach(client, bufnr)
config.buf_set_options(bufnr, {
omnifunc = "v:lua.vim.lsp.omnifunc"
})
config.buf_set_keymaps(bufnr, {
n = {
{"<C-c>jb", "<cmd> lua require('jump').jump_back()<CR>", {}},
{"<C-c>jg", "<cmd> lua require('jump').jump_def()<CR>", {}},
{"<C-c>ji", "<cmd> lua require('jump').jump_impl()<CR>", {}},
{"<C-c>jr", "<cmd> lua require('jump').jump_ref()<CR>", {}},
}
})
end
local function init()
for _, server in ipairs(servers) do
nvim_lsp[server].setup {
on_attach = on_attach,
flags = {
debounce_text_changes = 150
}
}
end
end
return {
init = init,
}
|
local M = {}
local height_period = 50 -- period of distance measurements
local height_threshold = 250
local height_histeresis = 3
M.omni = nil
M.apds = assert(require('apds9960'))
local proximity_cb_list = require'cb_list'.get_list()
M.proximity_cb_list = proximity_cb_list --list of callbacks for distance sensor
M.color_cb_list = require'cb_list'.get_list --list of callbacks for color sensor
M.cw_dist = function(b)
if b then
M.omni.drive(0,0,2)
else
M.omni.drive(0,0,0)
end
end
M.init = function()
assert(M.apds.init())
assert(M.apds.proximity.enable())
M.apds.proximity.get_dist_thresh(height_period, height_threshold, height_histeresis, proximity_cb_list.call)
end
return M |
local lsp = vim.lsp
lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
underline = true,
update_in_insert = false,
virtual_text = { spacing = 4, prefix = "●" },
severity_sort = true,
})
lsp.handlers["textDocument/hover"] = lsp.with(lsp.handlers.hover, {
border = O.borders,
})
lsp.handlers["textDocument/signatureHelp"] = lsp.with(lsp.handlers.signature_help, {
border = O.borders,
})
|
RegisterNetEvent("caue-police:purchaseVehicle")
AddEventHandler("caue-police:purchaseVehicle", function(params)
local src = source
local cid = exports["caue-base"]:getChar(src, "id")
if not cid then return end
local accountId = exports["caue-base"]:getChar(src, "bankid")
local bank = exports["caue-financials"]:getBalance(accountId)
if params.price > bank then
TriggerClientEvent("caue-phone:notification", src, "fas fa-exclamation-circle", "Error", "You dont $" .. params.price .. " in your bank account", 5000)
return
end
local comment = "Brought " .. params.name
local success, message = exports["caue-financials"]:transaction(accountId, 1, params.price, comment, cid, 5)
if not success then
TriggerClientEvent("caue-phone:notification", src, "fas fa-exclamation-circle", "Error", message, 5000)
return
end
local vid = exports["caue-vehicles"]:insertVehicle(src, params.model, params.job, params.price, false, true)
if not vid then
TriggerClientEvent("DoLongHudText", src, "Error??", 2)
return
end
exports["caue-vehicles"]:updateVehicle(vid, "garage", "garage", params.garage)
local vehicle = exports["caue-vehicles"]:getVehicle(vid)
TriggerClientEvent("caue-vehicles:spawnVehicle", src, params.model, params.spawn, vehicle.id, vehicle.plate, 100, false, false, false, false, false, true)
end) |
---------------------------------------------
-- Wheel of Impregnability
---------------------------------------------
local ID = require("scripts/zones/Empyreal_Paradox/IDs")
require("scripts/globals/monstertpmoves")
require("scripts/globals/settings")
require("scripts/globals/status")
require("scripts/globals/msg")
---------------------------------------------
function onMobSkillCheck(target, mob, skill)
if (mob:hasStatusEffect(tpz.effect.MAGIC_SHIELD) or mob:hasStatusEffect(tpz.effect.PHYSICAL_SHIELD)) then
return 1
end
mob:showText(mob, ID.text.PROMATHIA_TEXT + 5)
return 0
end
function onMobWeaponSkill(target, mob, skill)
local typeEffect = tpz.effect.MAGIC_SHIELD
mob:addStatusEffect(tpz.effect.MAGIC_SHIELD, 0, 0, 0)
mob:AnimationSub(2)
skill:setMsg(tpz.msg.basic.SKILL_GAIN_EFFECT)
return tpz.effect.MAGIC_SHIELD
end
|
--[[
Food Equipment - Server
by: standardcombo
v1.0
--]]
local EQUIPMENT = script.parent
local STANCE = script:GetCustomProperty("AnimationStance")
local BINDING = script:GetCustomProperty("ActionBinding")
local pressedListener = nil
local releasedListener = nil
local leftListener = nil
function OnBindingPressed(player, action)
if action == BINDING then
EQUIPMENT:SetCustomProperty("isActive", true)
local usesRemaining = EQUIPMENT:GetCustomProperty("usesRemaining")
EQUIPMENT:SetCustomProperty("usesRemaining", usesRemaining - 1)
end
end
function OnBindingReleased(player, action)
if action == BINDING then
EQUIPMENT:SetCustomProperty("isActive", false)
if EQUIPMENT:GetCustomProperty("usesRemaining") <= 0 then
local itemId = EQUIPMENT:GetCustomProperty("itemId")
Events.Broadcast("ItemConsumed", player, itemId)
EQUIPMENT:Destroy()
end
end
end
function OnEquippedEvent(equipment, player)
_G.StanceStack.Add(player, STANCE, script.id)
pressedListener = player.bindingPressedEvent:Connect(OnBindingPressed)
releasedListener = player.bindingReleasedEvent:Connect(OnBindingReleased)
end
EQUIPMENT.equippedEvent:Connect(OnEquippedEvent)
function OnUnequippedEvent(equipment, player)
if not Object.IsValid(player) then return end
if not Object.IsValid(script) then return end
_G.StanceStack.Remove(player, STANCE, script.id)
if Object.IsValid(equipment) then
equipment:Destroy()
end
end
EQUIPMENT.unequippedEvent:Connect(OnUnequippedEvent)
leftListener = Game.playerLeftEvent:Connect(function(player)
if Object.IsValid(EQUIPMENT)
and player == EQUIPMENT.owner then
EQUIPMENT:Destroy()
end
end)
script.destroyEvent:Connect(function()
if Object.IsValid(EQUIPMENT)
and Object.IsValid(EQUIPMENT.owner)
and Object.IsValid(script)
then
_G.StanceStack.Remove(EQUIPMENT.owner, STANCE, script.id)
end
if pressedListener then
pressedListener:Disconnect()
pressedListener = nil
end
if releasedListener then
releasedListener:Disconnect()
releasedListener = nil
end
if leftListener then
leftListener:Disconnect()
leftListener = nil
end
end)
|
net.dns.setdnsserver('8.8.8.8', 0)
net.dns.setdnsserver('4.4.4.4', 1)
function thingspeak_write(key, target_temp, current_temp, cooling_on)
print('updating thingspeak')
net.dns.resolve('api.thingspeak.com', function(_, ip)
if not ip then
print('cannot lookup api.thingspeak.com')
return
end
local url = string.format('https://%s/update?key=%s&field1=%s&field2=%s&field3=%s',
ip,
key,
tostring(target_temp or 0),
tostring(current_temp or 0),
tostring(fif(cooling_on, 1, 0)))
http.get(url, {}, function(code, response)
print('thingspeak update response: ' .. tostring(code) .. ' --- ' .. tostring(response))
end)
end)
end
|
----------------------------------------------------------------
-- Licensed under the GNU General Public License v2
-- (C) 2019, Alexander Koch <[email protected]>
----------------------------------------------------------------
-- environment
local type = type
local tonumber = tonumber
local io = { open = io.open }
local helpers = require"vicious.helpers"
local spawn = require"vicious.spawn"
-- hwmontemp: provides name-indexed temps from /sys/class/hwmon
-- vicious.widgets.hwmontemp
return helpers.setasyncall{
async = function (format, warg, callback)
if type(warg) ~= "table" or type(warg[1]) ~= "string" then
return callback{}
end
local input = warg[2]
if type(input) == "number" then
input = ("temp%d_input"):format(input)
else
input = "temp1_input"
end
spawn.easy_async_with_shell(
"grep " .. warg[1] .. " -wl /sys/class/hwmon/*/name",
function (stdout, stderr, exitreason, exitcode)
if exitreason == "exit" and exitcode == 0 then
local f = io.open(stdout:gsub("name%s+", input), "r")
callback{ tonumber(f:read"*line") / 1000 }
f:close()
else
callback{}
end
end)
end }
-- vim: ts=4:sw=4:expandtab
|
--[[
desc: CowardGoblin, a component of coward goblin.
author: SkyFvcker
since: 2018-9-17
alter: 2019-3-31
]]--
local _STRING = require("lib.string")
local _RESOURCE = require("lib.resource")
local _RESMGR = require("actor.resmgr")
---@class Actor.Component.Duelist.CowardGoblin
---@field public phyDef number
---@field public magDef number
---@field public onlyOne boolean
---@field public soundDataSet SoundData
---@field public marks table
---@field public partnerCount int
---@field public buffDatas table<int, Actor.RESMGR.BuffData>
---@field public talk table<string, string>
local _CowardGoblin = require("core.class")()
function _CowardGoblin.HandleData(data)
data.sound = _RESOURCE.Recur(_RESMGR.GetSoundData, data.sound)
if (data.buff) then
for n=1, #data.buff do
data.buff[n] = _RESMGR.NewBuffData(data.buff[n].path, data.buff[n])
end
end
if (data.talk) then
for k, v in pairs(data.talk) do
data.talk[k] = _STRING.GetVersion(data.talk[k])
end
end
end
function _CowardGoblin:Ctor(data, param)
self.phyDef = data.phyDef
self.magDef = data.magDef
self.soundDataSet = data.sound
self.buffDatas = data.buff
self.talk = data.talk
self.onlyOne = self.buffDatas == nil
self.marks = {}
self.partnerCount = 0
self.partnerMax = 0
end
return _CowardGoblin
|
class 'MeshTriangle'
function MeshTriangle:__init( position, size )
self.angle = Angle()
self.a = position + self.angle * Vector3( 0, 0, 0 )
self.b = position + self.angle * Vector3( -size, 0, -size )
self.c = position + self.angle * Vector3( size, 0, -size )
self.forward_multi = 5
self.width_multi = 1.5
self.size = size
self.position = position
local a,b,c = self.a, self.b, self.c
self.centerPoint = self:GetCenterPoint( self.a, self.b, self.c )
return self
end
function MeshTriangle:SetPosition( position )
self.position = position
local forward_multi = self.forward_multi
local width_multi = self.width_multi
local size = self.size
self.a = position + self.angle * Vector3( 0, 0, 0 )
self.b = position + self.angle * Vector3( -size*width_multi, 0, -size*forward_multi )
self.c = position + self.angle * Vector3( size*width_multi, 0, -size*forward_multi )
self.centerPoint = self:GetCenterPoint( self.a, self.b, self.c )
end
function MeshTriangle:SetAngle( angle )
self.angle = angle
local forward_multi = self.forward_multi
local width_multi = self.width_multi
local size = self.size
self.a = self.position + angle * Vector3( 0, 0, 0 )
self.b = self.position + angle * Vector3( -size*width_multi, 0, -size*forward_multi )
self.c = self.position + angle * Vector3( size*width_multi, 0, -size*forward_multi )
self.centerPoint = self:GetCenterPoint( self.a, self.b, self.c )
end
function MeshTriangle:UpdatePositionAndAngle( position, angle )
self.angle = angle
self.position = position
local size = self.size
local forward_multi = self.forward_multi
local width_multi = self.width_multi
self.a = position + angle * Vector3( 0, 0, 0 )
self.b = position + angle * Vector3( -size*width_multi, 0, -size*forward_multi )
self.c = position + angle * Vector3( size*width_multi, 0, -size*forward_multi )
self.centerPoint = self:GetCenterPoint( self.a, self.b, self.c )
end
function MeshTriangle:IsPointInside( p )
-- local a, b, c = self.a, self.b, self.c
-- if self:SameSide( p, a, b, c ) and self:SameSide( p, b, a, c ) and self:SameSide( p, c, a, b ) then
-- return true
-- else
-- return false
-- end
return self:BarycentricPointInside( p )
end
function MeshTriangle:BarycentricPointInside( p )
local a, b, c = self.a, self.b, self.c
-- compute vectors
local v0 = c - a
local v1 = b - a
local v2 = p - a
-- compute dot products
local dot00 = v0:Dot(v0)
local dot01 = v0:Dot(v1)
local dot02 = v0:Dot(v2)
local dot11 = v1:Dot(v1)
local dot12 = v1:Dot(v2)
-- compute barycentric coordinates
local invDenom = 1 / ( dot00 * dot11 - dot01 * dot01 )
local u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom
local v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom
-- check if the point is inside triangle
return ( u >= 0 ) and ( v >= 0 ) and ( u + v < 1 ) or false
end
function MeshTriangle:SameSide( p1, p2, a, b )
local cp1 = ( b - a ):Cross( p1 - a )
local cp2 = ( b - a ):Cross( p2 - a )
local dot = cp1:Dot( cp2 )
if dot >= 0 then
return true
else
return false
end
end
function MeshTriangle:GetCenterPoint( a, b, c )
return (a + b + c) / 3
end
function AddTriangle( position, size )
local newTriangle = MeshTriangle( position, size )
return newTriangle
end |
data:extend(
{
{
type = "fluid",
name = "tungstic-acid",
subgroup = "tungsten-processing",
default_temperature = 25,
heat_capacity = "1KJ",
base_color = {r=0, g=0.2, b=0.7},
flow_color = {r=0.5, g=0.5, b=0.5},
max_temperature = 100,
icon = "__Engineersvsenvironmentalist__/graphics/icons/chemicals/tungstic-acid.png",
pressure_to_speed_ratio = 0.2,
flow_to_energy_ratio = 0.3,
order = "a[fluid]-g[tungstic-acid]"
},
{
type = "item",
name = "tungsten-crushed",
icon = "__Engineersvsenvironmentalist__/graphics/icons/metalworking/tungsten-crushed.png",
flags = {"goes-to-main-inventory"},
subgroup = "tungsten-processing",
order = "f[tungsten-oxide]",
stack_size = 100
},
{
type = "item",
name = "tungsten-oxide",
icon = "__Engineersvsenvironmentalist__/graphics/icons/chemicals/tungsten-oxide.png",
flags = {"goes-to-main-inventory"},
subgroup = "tungsten-processing",
order = "f[tungsten-oxide]",
stack_size = 100
},
{
type = "item",
name = "powdered-tungsten",
icon = "__Engineersvsenvironmentalist__/graphics/icons/chemicals/powdered-tungsten.png",
flags = {"goes-to-main-inventory"},
subgroup = "tungsten-processing",
order = "f[powdered-tungsten]",
stack_size = 100
},
{
type = "item",
name = "tungsten-plate",
icon = "__Engineersvsenvironmentalist__/graphics/icons/metalworking/tungsten-plate.png",
flags = {"goes-to-main-inventory"},
subgroup = "tungsten-processing",
order = "c-a-i[tungsten-plate]",
stack_size = 200
},
--recipes--
{
type = "recipe",
name = "tungsten-crushing",
icon = "__Engineersvsenvironmentalist__/graphics/icons/metalworking/tungsten-crushed.png",
category = "crusher",
subgroup = "tungsten-processing",
order = "a-1",
enabled = false,
energy_required = 1,
ingredients = {{"tungsten-ore",5}},
results = {{"tungsten-crushed",5},{"gravel",3}},
},
{
type = "recipe",
name = "tungstic-acid",
category = "chemistry",
enabled = false,
energy_required = 2,
ingredients =
{
{type="item", name="tungsten-crushed", amount=2},
{type="fluid", name="hydrogen-chloride", amount=4}
},
results=
{
{type="fluid", name="tungstic-acid", amount=2},
{type="item", name="calcium-chloride", amount=1}
},
main_product= "tungstic-acid",
subgroup = "tungsten-processing",
icon = "__Engineersvsenvironmentalist__/graphics/icons/chemicals/tungstic-acid.png",
order = "a-2",
},
{
type = "recipe",
name = "tungsten-oxide",
category = "chemistry",
subgroup = "tungsten-processing",
order = "a-3",
energy_required = 2,
enabled = false,
ingredients =
{
{type="fluid", name="tungstic-acid", amount=1},
},
result="tungsten-oxide",
},
{
type = "recipe",
name = "powdered-tungsten",
category = "chemistry",
subgroup = "tungsten-processing",
order = "a-4",
energy_required = 3.5,
enabled = false,
ingredients =
{
{type="item", name="tungsten-oxide", amount=1},
{type="fluid", name="hydrogen", amount=3}
},
result="powdered-tungsten",
},
{
type = "recipe",
name = "tungsten-plate",
enabled = false,
category = "chemistry",
subgroup = "tungsten-processing",
order = "a-5",
energy_required = 17.5,
ingredients =
{
{type="item", name="nickel-plate", amount=1},
{type="item", name="powdered-tungsten", amount=4},
},
result = "tungsten-plate",
result_count = 5,
},
}
) |
--[[
Licensed under GNU General Public License v2
* (c) 2013, Luke Bonham
* (c) 2010-2012, Peter Hofmann
--]]
local newtimer = require("lain.helpers").newtimer
local wibox = require("wibox")
local util = require("lain.util")
local io = { popen = io.popen }
local os = { getenv = os.getenv }
local pairs = pairs
local string = { len = string.len,
match = string.match }
local table = { sort = table.sort }
local setmetatable = setmetatable
-- Maildir check
-- lain.widgets.maildir
local maildir = {}
local function worker(args)
local args = args or {}
local timeout = args.timeout or 60
local mailpath = args.mailpath or os.getenv("HOME") .. "/Mail"
local ignore_boxes = args.ignore_boxes or {}
local settings = args.settings or function() end
maildir.widget = wibox.widget.textbox('')
function update()
-- Find pathes to mailboxes.
local p = io.popen("find " .. mailpath ..
" -mindepth 1 -maxdepth 1 -type d" ..
" -not -name .git")
local boxes = {}
repeat
line = p:read("*l")
if line ~= nil
then
-- Find all files in the "new" subdirectory. For each
-- file, print a single character (no newline). Don't
-- match files that begin with a dot.
-- Afterwards the length of this string is the number of
-- new mails in that box.
local np = io.popen("find " .. line ..
"/new -mindepth 1 -type f " ..
"-not -name '.*' -printf a")
local mailstring = np:read("*a")
-- Strip off leading mailpath.
local box = string.match(line, mailpath .. "/*([^/]+)")
local nummails = string.len(mailstring)
if nummails > 0
then
boxes[box] = nummails
end
end
until line == nil
table.sort(boxes)
newmail = "no mail"
--Count the total number of mails irrespective of where it was found
total = 0
for box, number in pairs(boxes)
do
-- Add this box only if it's not to be ignored.
if not util.element_in_table(box, ignore_boxes)
then
total = total + number
if newmail == "no mail"
then
newmail = box .. "(" .. number .. ")"
else
newmail = newmail .. ", " ..
box .. "(" .. number .. ")"
end
end
end
widget = maildir.widget
settings()
end
newtimer(mailpath, timeout, update, true)
return maildir.widget
end
return setmetatable(maildir, { __call = function(_, ...) return worker(...) end })
|
local skynet = require "skynet"
require "skynet.manager"
local mysql = require "skynet.db.mysql"
local backupToMysqlTime = tonumber(skynet.getenv("backupToMysqlTime"))
local CMD = {}
local pool = {}
local queue = {}
local maxconn
local index = 2
local function getconn(sync)
local db
if sync then
db = pool[1]
else
db = pool[index]
assert(db)
index = index + 1
if index > maxconn then
index = 2
end
end
return db
end
-- 写入mysql
local function backupToMysql()
while true do
skynet.sleep(100 * backupToMysqlTime)
local t = table.clone(queue, true)
queue = {}
-- TODO 把字符串全部合并 只写一次数据库
-- TODO 给queue增加标记 比如部分update语句在这里先合并 然后再合并写入数据库
for _, v in ipairs(t) do
local ret = CMD.execute(v, true)
if ret["err"] then
skynet.error("backupToMysql error:" .. ret["err"])
skynet.error(v)
LOG_ERROR("backupToMysql error:" .. ret["err"])
LOG_ERROR(v)
end
end
end
end
function CMD.start()
maxconn = tonumber(skynet.getenv("mysql_maxconn")) or 10
assert(maxconn >= 2)
for i = 1, maxconn do
local db = mysql.connect{
host = skynet.getenv("mysql_host"),
port = tonumber(skynet.getenv("mysql_port")),
database = skynet.getenv("mysql_db"),
user = skynet.getenv("mysql_user"),
password = skynet.getenv("mysql_pwd"),
max_packet_size = 1024 * 1024
}
if db then
table.insert(pool, db)
db:query("set charset utf8")
else
skynet.error("mysql connect error")
end
end
skynet.fork(backupToMysql)
end
-- sync为false或者nil,sql为读操作,如果sync为true用于数据变动时同步数据到mysql,sql为写操作
-- 写操作取连接池中的第一个连接进行操作
function CMD.execute(sql, sync)
local db = getconn(sync)
return db:query(sql)
end
function CMD.stop()
for _, db in pairs(pool) do
db:disconnect()
end
pool = {}
end
function CMD.async(sql)
--table.insert(queue, sql)
-- 前期直接写数据库了 sync=false 多个连接一起写也没事 对核心数据没有影响
CMD.execute(sql, true)
end
skynet.start(function()
skynet.dispatch("lua", function(session, source, cmd, ...)
local f = assert(CMD[cmd], cmd .. "not found")
skynet.retpack(f(...))
end)
skynet.register(SERVICE_NAME)
end)
|
return function()
local config = require("doom.core.config").config
vim.g.dashboard_session_directory = require("doom.core.system").doom_root .. "/sessions"
vim.g.dashboard_default_executive = "telescope"
vim.g.dashboard_custom_section = {
a = {
description = { " Load Last Session SPC s r" },
command = "lua require('persistence').load({ last = true })",
},
b = {
description = { " Recently Opened Files SPC f r" },
command = "Telescope oldfiles",
},
c = {
description = { " Jump to Bookmark SPC s m" },
command = "Telescope marks",
},
d = {
description = { " Find File SPC f f" },
command = "Telescope find_files",
},
e = {
description = { " Find Word SPC s g" },
command = "Telescope live_grep",
},
f = {
description = { " Open Private Configuration SPC d c" },
command = 'lua require("doom.core.functions").edit_config()',
},
g = {
description = { " Open Documentation SPC d d" },
command = 'lua require("doom.core.functions").open_docs()',
},
}
vim.g.dashboard_custom_footer = {
"Doom Nvim loaded in " .. vim.fn.printf(
"%.3f",
vim.fn.reltimefloat(vim.fn.reltime(vim.g.start_time))
) .. " seconds.",
}
vim.g.dashboard_custom_header = vim.tbl_isempty(config.doom.dashboard_custom_header)
and {
" ",
"================= =============== =============== ======== ========",
"\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //",
"||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||",
"|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||",
"||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||",
"|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||",
"||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||",
"|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||",
"||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||",
"|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||",
"|| `' || || `' || || `' || || | \\ / | ||",
"|| .===' `===. .==='.`===. .===' /==. | \\/ | ||",
"|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||",
"|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||",
"|| .==' _-' `-__\\._-' `-_./__-' `' |. /| | ||",
"||.==' _-' `' | /==.||",
"==' _-' N E O V I M \\/ `==",
"\\ _-' `-_ /",
" `'' ``' ",
}
or config.doom.dashboard_custom_header
-- Header color
vim.cmd("hi! dashboardHeader guifg=" .. config.doom.dashboard_custom_colors.header_color)
vim.cmd("hi! dashboardCenter guifg=" .. config.doom.dashboard_custom_colors.center_color)
vim.cmd("hi! dashboardShortcut guifg=" .. config.doom.dashboard_custom_colors.shortcut_color)
vim.cmd("hi! dashboardFooter guifg=" .. config.doom.dashboard_custom_colors.footer_color)
end
|
AddCSLuaFile('cl_init.lua')
AddCSLuaFile('shared.lua')
include('shared.lua')
if CLIENT then return end |
corsec_special_ops_major = Creature:new {
objectName = "@mob/creature_names:corsec_major_aggro",
randomNameType = NAME_GENERIC,
randomNameTag = true,
socialGroup = "corsec",
faction = "corsec",
level = 181,
chanceHit = 13,
damageMin = 1045,
damageMax = 1800,
baseXp = 17178,
baseHAM = 126000,
baseHAMmax = 154000,
armor = 2,
resists = {65,65,30,40,80,30,40,35,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0,
ferocity = 0,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = PACK + KILLER,
optionsBitmask = AIENABLED,
diet = HERBIVORE,
templates = { "object/mobile/dressed_corsec_captain_human_female_01.iff",
"object/mobile/dressed_corsec_captain_human_male_01.iff"},
lootGroups = {
{
groups = {
{group = "color_crystals", chance = 100000},
{group = "junk", chance = 7000000},
{group = "weapons_all", chance = 100000},
{group = "armor_all", chance = 1100000},
{group = "clothing_attachments", chance = 150000},
{group = "armor_attachments", chance = 150000},
{group = "rebel_officer_common", chance = 400000},
{group = "wearables_all", chance = 1000000}
}
}
},
weapons = {"corsec_police_weapons"},
conversationTemplate = "",
reactionStf = "@npc_reaction/military",
attacks = merge(riflemanmaster,pistoleermaster,carbineermaster,brawlermaster)
}
CreatureTemplates:addCreatureTemplate(corsec_special_ops_major, "corsec_special_ops_major")
|
local default_kick_bases = {
{{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0}}; -- 0
{{ 0, 0},{ 1, 0},{ 1,-1},{ 0, 2},{ 1, 2}}; -- R
{{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0}}; -- 2
{{ 0, 0},{-1, 0},{-1,-1},{ 0, 2},{-1, 2}}; -- L
};
local i_kick_bases = {
{{ 0, 0},{-1, 0},{ 2, 0},{-1, 0},{ 2, 0}}; -- 0
{{-1, 0},{ 0, 0},{ 0, 0},{ 0, 1},{ 0,-2}}; -- R
{{-1, 1},{ 1, 1},{-2, 1},{ 1, 0},{-2, 0}}; -- 2
{{ 0, 1},{ 0, 1},{ 0, 1},{ 0,-1},{ 0, 2}}; -- L
};
local o_kick_bases = {
{{ 0, 0}};
{{ 0,-1}};
{{-1,-1}};
{{-1, 0}};
};
local function generate_kick_data(base)
local target = {};
for i = 1, #base do
target[i] = {};
for j = 1, #base do
target[i][j] = {};
for k = 1, #base[j] do
target[i][j][k] = {base[i][k][1] - base[j][k][1], base[i][k][2] - base[j][k][2]};
end
end
end
end
local default_kicks = generate_kick_data(default_kick_bases);
local i_kicks = generate_kick_data(i_kick_bases);
local o_kicks = generate_kick_data(o_kick_bases);
local j_orientations = {
[[
%
%%%
]],
[[
%%
%
%
]],
[[
%%%
%
]],
[[
%
%
%%
]],
};
local l_orientations = {
[[
%
%%%
]],
[[
%
%
%%
]],
[[
%%%
%
]],
[[
%%
%
%
]],
};
local t_orientations = {
[[
%
%%%
]],
[[
%
%%
%
]],
[[
%%%
%
]],
[[
%
%%
%
]],
};
local i_orientations = {
[[
%%%%%
]],
[[
%
%
%
%
]],
[[
%%%%%
]],
[[
%
%
%
%
]],
};
local o_orientations = {
[[
%%
%%
]],
[[
%%
%%
]],
[[
%%
%%
]],
[[
%%
%%
]],
};
local s_orientations = {
[[
%%
%%
]],
[[
%
%%
%
]],
[[
%%
%%
]],
[[
%
%%
%
]],
};
local z_orientations = {
[[
%%
%%
]],
[[
%
%%
%
]],
[[
%%
%%
]],
[[
%
%%
%
]],
};
return {
J = {
orientations = {
{{0,0}, {0,1}, {1,1}, {2,1}};
{{2,0}, {1,0}, {1,1}, {1,2}};
{{2,2}, {2,1}, {1,1}, {0,1}};
{{0,2}, {1,2}, {1,1}, {1,0}};
},
kicks = default_kicks,
},
L = {
orientations = {
{{2,0}, {0,1}, {1,1}, {2,1}};
{{2,2}, {1,0}, {1,1}, {1,2}};
{{0,2}, {2,1}, {1,1}, {0,1}};
{{0,0}, {1,2}, {1,1}, {1,0}};
},
kicks = default_kicks,
},
T = {
orientations = {
{{1,0}, {0,1}, {1,1}, {2,1}};
{{2,1}, {1,0}, {1,1}, {1,2}};
{{1,2}, {2,1}, {1,1}, {0,1}};
{{0,1}, {1,2}, {1,1}, {1,0}};
},
kicks = default_kicks,
},
I = {
orientations = {
{{1,2}, {2,2}, {3,2}, {4,2}};
{{2,1}, {2,2}, {2,3}, {2,4}};
{{0,2}, {1,2}, {2,2}, {3,2}};
{{2,0}, {2,1}, {2,2}, {2,3}};
},
kicks = i_kicks,
},
O = {
orientations = {
{{1,0}, {1,1}, {2,0}, {2,1}};
{{1,1}, {1,2}, {2,1}, {2,2}};
{{0,1}, {0,2}, {1,1}, {1,2}};
{{0,0}, {0,1}, {1,0}, {1,1}};
},
kicks = o_kicks,
},
Z = {
orientations = {
{{0,0}, {1,0}, {1,1}, {2,1}};
{{2,0}, {2,1}, {1,1}, {1,2}};
{{2,2}, {1,2}, {1,1}, {0,1}};
{{0,2}, {0,1}, {1,1}, {1,0}};
},
kicks = default_kicks,
},
S = {
orientations = {
{{0,1}, {1,1}, {1,0}, {2,0}};
{{1,0}, {1,1}, {2,1}, {2,2}};
{{2,1}, {1,1}, {1,2}, {0,2}};
{{1,2}, {1,1}, {0,1}, {0,0}};
},
kicks = default_kicks,
},
};
|
local computer = computer or require("computer")
local component = component or require("component")
local eeprom = component.proxy(component.list("eeprom")())
local fs = component.proxy(eeprom.getData())
local internet = component.proxy(component.list("internet")())
local gpu = component.proxy(component.list("gpu")())
local y = 1
local status = print or function(str)
gpu.set(1, y, str)
y = y + 1
end
function downloadFile(url)
local handle = internet.request(url)
handle.finishConnect()
local buffer = ""
repeat
local data = handle.read(math.huge)
buffer = buffer .. (data or "")
until data == nil
return buffer
end
local urlBase = "https://raw.githubusercontent.com/UniverseSquared/uloader/master"
local fileList = {
"/uloader/init.lua",
"/uloader/config.lua",
"/uloader/modules/01_fs.lua",
"/uloader/modules/02_config.lua",
"/uloader/modules/03_boot_detection.lua",
"/uloader/modules/04_openos_boot.lua",
"/uloader/modules/05_plan9k_boot.lua",
"/uloader/modules/97_updater.lua",
"/uloader/modules/98_internet_boot.lua",
"/uloader/modules/99_menu.lua"
}
fs.makeDirectory("/uloader")
fs.makeDirectory("/uloader/modules")
for _, path in pairs(fileList) do
status("Downloading file " .. path .. "...")
if path == "/uloader/config.lua" and fs.exists(path) then
status("Config not overwritten. You may want to refer to the documentation on GitHub to manually update your config if necessary.")
else
local url = urlBase .. path
local data = downloadFile(url)
if fs.exists(path) then
fs.remove(path)
end
local handle = fs.open(path, "w")
fs.write(handle, data)
fs.close(handle)
end
end
status("Downloading init.lua...")
local init = downloadFile(urlBase .. "/init.lua")
status("Flashing uloader. Do not power off or reboot.")
eeprom.set(init)
status("Completed installation! Press any key to reboot.")
while true do
local signal = { computer.pullSignal() }
if signal[1] == "key_down" then
computer.shutdown(true)
end
end |
package '../snowflakes'
local system = require 'system'
local xpfs = require 'xpfs'
local c = require 'c'
local lua = require 'lua'
local list = require 'list'
local params = require 'commonParams'
local function testedLuaFile(path, host)
local sourceFile = path:gsub('(.+)(%.lua)', '%1_q%2')
if not xpfs.stat(sourceFile) then
return path
end
local requiresHost = list:new {
'xpexec_q.lua',
'xpio_q.lua',
}
local env = requiresHost:find(sourceFile) and {
LUA = host,
PATH = os.getenv 'PATH',
}
return lua.run {
sourceFile = sourceFile,
validates = path,
host = host,
env = env,
}
end
local function main(ps)
local xpfsLib = c.library {
sourceFiles = {'xpfs.c'},
includeDirs = {lua.tools().path .. "/inc"},
flavor = ps.flavor,
}
local xpioLib = c.library {
sourceFiles = {'xpio_c.c'},
includeDirs = {lua.tools().path .. "/inc"},
flags = {'-Wno-missing-braces'},
flavor = ps.flavor,
}
local luaHost = lua.program {
luaLibs = {'xpfs', 'xpio_c'},
libs = {xpfsLib, xpioLib},
}
local function toShipPath(k)
return not k:match '_q%.lua$' and k ~= 'build.lua' and testedLuaFile(k, luaHost) or nil, k
end
local luaFiles = system.find {
pattern = '%.lua'
}
local shipFiles = luaFiles:mapWithKeys(toShipPath)
shipFiles = shipFiles:merge {
['xpfs.lib'] = xpfsLib,
['xpio_c.lib'] = xpioLib,
}
return system.directory {
path = ps.outdir,
contents = shipFiles,
}
end
local function clean(ps)
return system.removeDirectory(ps.outdir)
end
return {
main = main,
clean = clean,
params = params,
}
|
local buffer = {}
local dirs = {
{0, 1},
{1, 0},
{1, 1},
{-1, 1},
{-1, 0},
{1, -1},
{0, -1},
{-1, -1},
}
local W = 40
local H = 30
function math.round(x)
if x > 0 then
return math.ceil(x)
else
return math.floor(x)
end
end
function iround(x)
if x > 0 then
return math.floor(x)
else
return math.ceil(x)
end
end
function genline()
local line = {}
for i=1,W do
local dir = dirs[math.floor(math.random()*#dirs+1)]
table.insert(line, {0, dir[1], dir[2]})
end
return line
end
function init()
for i=1,H do
table.insert(buffer, genline())
end
end
function get(x, y)
if x > 0 and x <= W and
y > 0 and y <= H then
return buffer[math.floor(y)][math.floor(x)]
else
return {0, 0, 0}
end
end
function set(x, y, v)
if x > 0 and x <= W and
y > 0 and y <= H then
buffer[math.floor(y)][math.floor(x)] = v
end
end
local prevx = 0
local prevy = 0
function update()
for x=W,1,-1 do
for y = 1,H do
local i = math.sqrt(buffer[y][x][2]*buffer[y][x][2]+buffer[y][x][3]*buffer[y][x][3])
local ax = x+iround(math.round(buffer[y][x][2]/i*4)/2)
local ay = y+iround(math.round(buffer[y][x][3]/i*4)/2)
if ax >= 1 and ax <= W and
ay >= 1 and ay <= H then
if buffer[y][x][1] > 0 then
buffer[ay][ax][1] = buffer[ay][ax][1]+i*buffer[y][x][1]
buffer[y][x][1] = buffer[y][x][1]-i*buffer[y][x][1]
end
buffer[ay][ax][2] = buffer[ay][ax][2]+buffer[y][x][2]*0.3
buffer[ay][ax][3] = buffer[ay][ax][3]+buffer[y][x][3]*0.3
buffer[y][x][2] = buffer[y][x][2]-buffer[y][x][2]*0.3
buffer[y][x][3] = buffer[y][x][3]-buffer[y][x][3]*0.3
end
if buffer[y][x][1] > 0 then
--buffer[y][x][1] = buffer[y][x][1]-i*buffer[y][x][1]
end
if buffer[y][x][3] > 1 then
buffer[y][x][3] = 1
end
if buffer[y][x][3] < -1 then
buffer[y][x][3] = -1
end
if buffer[y][x][2] > 1 then
buffer[y][x][2] = 1
end
if buffer[y][x][2] < -1 then
buffer[y][x][2] = -1
end
if buffer[y][x][1] > 0 then
local amount = buffer[y][x][1]*0.2
if x+1 <= W then
local cellTo = get( x+1, y)
set(x+1, y, {cellTo[1]+amount, cellTo[2], cellTo[3]})
buffer[y][x][1] = buffer[y][x][1] - amount
end
if x-1 >= 1 then
local cellTo = get(x-1, y)
set(x-1, y, {cellTo[1]+amount, cellTo[2], cellTo[3]})
buffer[y][x][1] = buffer[y][x][1] - amount
end
if y+1 <= H then
local cellTo = get(x, y+1)
set(x, y+1, {cellTo[1]+amount, cellTo[2], cellTo[3]})
buffer[y][x][1] = buffer[y][x][1] - amount
end
if y-1 >= 1 then
local cellTo = get(x, y-1)
set(x, y-1, {cellTo[1]+amount, cellTo[2], cellTo[3]})
buffer[y][x][1] = buffer[y][x][1] - amount
end
end
end
end
local mx = read16(154186)
local my = read16(154188)
if read8(154190) == 2 then
local v = get(mx, my)
local dx, dy = (mx-prevx)*0.5, (my-prevy)*0.5
local w = 320/W
local h = 240/H
set(math.floor(mx/w), math.floor(my/h), {v[1]+100, v[2]+dx, v[3]+dy})
end
if read8(154191) == 2 then
local v = get(mx, my)
local dx, dy = (mx-prevx)*0.5, (my-prevy)*0.5
local w = 320/W
local h = 240/H
set(math.floor(mx/w), math.floor(my/h), {v[1]-50, v[2]+dx, v[3]+dy})
end
prevx = mx
prevy = my
end
function draw()
if #buffer ~= H then
return
end
local w = 320/W
local h = 240/H
clr()
for y=1,H do
for x=1,W do
local v = buffer[y][x][1]
local dx = buffer[y][x][2]
local dy = buffer[y][x][3]
local px = x*w-w/2
local py = y*h-h/2
if v > 15 then
v = 15
elseif v < 0 then
v = 0
else
v = math.floor(v)
end
--rect(px-v/2, py-v/2, v, v, v)
circ(px, py, v/2, v)
--line(px, py, px+dx*v, py+dy*v, v)
end
end
pspr(prevx, prevy, 56, 80, 8, 8)
end
function read16(p)
local data = kernel.read(p, 2)
local value = data:byte(2)
value = value+data:byte(1)*256
return value
end
function read8(p)
local data = kernel.read(p, 1)
return data:byte(1)
end
|
local app = app
-- create system graphic objects
local pMainOverlay = app.Graphic(0, 0, 256, 64)
app.UIThread.setMainOverlay(pMainOverlay)
local pSubOverlay = app.Graphic(0, 0, 128, 64)
app.UIThread.setSubOverlay(pSubOverlay)
local function addMainGraphic(graphic)
if graphic then pMainOverlay:addChildOnce(graphic) end
end
local function removeMainGraphic(graphic)
if graphic then pMainOverlay:removeChild(graphic) end
end
local function addSubGraphic(graphic)
if graphic then pSubOverlay:addChildOnce(graphic) end
end
local function removeSubGraphic(graphic)
if graphic then pSubOverlay:removeChild(graphic) end
end
return {
addMainGraphic = addMainGraphic,
removeMainGraphic = removeMainGraphic,
addSubGraphic = addSubGraphic,
removeSubGraphic = removeSubGraphic,
} |
-- seed.lua
-- Implements the /seed command.
function HandleSeedCommand(Split, Player)
if not(Split[2]) then
Player:SendMessageInfo(cChatColor.LightGray .. "Seed: " .. Player:GetWorld():GetSeed())
else
local World = cRoot:Get():GetWorld(Split[2])
local WorldName = Split[2]
if not(World) then
Player:SendMessage(cChatColor.LightGray .. "Couldn't find that world.")
else
Player:SendMessage(cChatColor.LightGray .. "Seed (" .. WorldName .. "): " .. World:GetSeed())
end
end
return true
end
function HandleConsoleSeed(Split)
if not(Split[2]) then
return true, "Seed: " .. cRoot:Get():GetDefaultWorld():GetSeed()
else
local World = cRoot:Get():GetWorld(Split[2])
local WorldName = Split[2]
if not(World) then
return true, "Couldn't find that world."
else
return true, "Seed (" .. WorldName .. "): " .. World:GetSeed()
end
end
end
|
return {'abma'} |
SR = {
lastError = ""
}
function SR:isAdmin( playerID )
local ids = GetPlayerIdentifiers( playerID )
for k,v in pairs( self.admins ) do
if findi( ids, v ) ~= nil then
return true
end
end
return false
end |
--[[------------------------------------------------------------------------------------------------------
Text for info tab
--------------------------------------------------------------------------------------------------------]]
CQB_VER = 2.2
CQB_ABOUT = [[
Base version 2.2 Aug 7, 2020
Developer: JFAexe (id/jfaexe)
Support and testing: Plague Doctor (id/JustPD)
]]
CQB_CHANGELOG = [[
Version 1.0 July 22, 2020:
- Base release (6 hours version)
Version 1.1 July 23, 2020:
- Spin base
- Auto bhop
Version 1.2 July 24, 2020:
- Base and autorun improvements
Version 1.3 July 26, 2020:
- Burst base
Version 1.4 July 28, 2020:
- Melee and Zoom base
Version 2.0 Aug 2, 2020:
- Projectile and dual weapons support
- Better Melee base with backstabs
- Lua shells
Version 2.1 Aug 5, 2020:
- Server options
- Spawner entity base
- New HUD font
Version 2.2 Aug 21, 2020:
- NPC Support for guns
]]
CQB_LICENSE = [[
MIT Licensed
Copyright (c) 2020 JFAexe
Reusing stolen code since 2017
]] |
object_draft_schematic_furniture_wod_ns_potted_plant_scem_08 = object_draft_schematic_furniture_shared_wod_ns_potted_plant_scem_08:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_furniture_wod_ns_potted_plant_scem_08, "object/draft_schematic/furniture/wod_ns_potted_plant_scem_08.iff")
|
DataMapping = {}
DataMapping.Icons = {};
DataMapping.SearchTypes = {};
DataMapping.SourceFields = {};
DataMapping.ImportFields = {};
DataMapping.ImportFields.Bibliographic = {};
DataMapping.ImportFields.Item = {};
DataMapping.ImportFields.StaticHolding = {};
--Typical Settings that shouldn't need user configuration
DataMapping.LabelName = "Catalog Search";
DataMapping.MmsIdRegex = '(?s)name="mmsId"[^>]*value="(?<mmsId>\\d*)';
-- Icons: Aeon
DataMapping.Icons["Aeon"] = {};
DataMapping.Icons["Aeon"]["Search"] = "srch_32x32";
DataMapping.Icons["Aeon"]["Home"] = "home_32x32";
DataMapping.Icons["Aeon"]["Web"] = "web_32x32";
DataMapping.Icons["Aeon"]["Record"] = "record_32x32";
DataMapping.Icons["Aeon"]["Import"] = "impt_32x32";
-- SearchTypes
DataMapping.SearchTypes["Title"] = "title";
DataMapping.SearchTypes["Author"] = "creator";
DataMapping.SearchTypes["Call Number"] = "lsr01";
DataMapping.SearchTypes["Subject"] = "sub";
DataMapping.SearchTypes["ISBN"] = "isbn";
DataMapping.SearchTypes["ISSN"] = "issn";
-- Catalog Number uses the Any search type because
-- Primo catalogs don't have built in MMS ID searching
DataMapping.SearchTypes["Catalog Number"] = "any";
-- Source Fields: Aeon
DataMapping.SourceFields["Aeon"] = {};
DataMapping.SourceFields["Aeon"]["Title"] = { Table = "Transaction", Field = "ItemTitle" };
DataMapping.SourceFields["Aeon"]["Author"] = { Table = "Transaction", Field = "ItemAuthor" };
DataMapping.SourceFields["Aeon"]["Call Number"] = { Table = "Transaction", Field = "CallNumber" };
DataMapping.SourceFields["Aeon"]["Catalog Number"] = { Table = "Transaction", Field = "ReferenceNumber" };
DataMapping.SourceFields["Aeon"]["TransactionNumber"] = { Table = "Transaction", Field = "TransactionNumber" };
-- Import Fields
DataMapping.ImportFields.Bibliographic["Aeon"] = {
{
Table = "Transaction",
Field = "ItemTitle", MaxSize = 255,
Value = "//datafield[@tag='245']/subfield[@code='a']|//datafield[@tag='245']/subfield[@code='b']"
},
{
Table = "Transaction",
Field = "ItemAuthor", MaxSize = 255,
Value = "//datafield[@tag='100']/subfield[@code='a']|//datafield[@tag='100']/subfield[@code='b'],//datafield[@tag='110']/subfield[@code='a']|//datafield[@tag='110']/subfield[@code='b'],//datafield[@tag='111']/subfield[@code='a']|//datafield[@tag='111']/subfield[@code='b']"
},
{
Table = "Transaction",
Field ="ItemPublisher", MaxSize = 255,
Value = "//datafield[@tag='260']/subfield[@code='b']"
},
{
Table = "Transaction",
Field ="ItemPlace", MaxSize = 255,
Value = "//datafield[@tag='260']/subfield[@code='a']"
},
{
Table = "Transaction",
Field ="ItemDate", MaxSize = 50,
Value = "//datafield[@tag='260']/subfield[@code='c']"
},
{
Table = "Transaction",
Field ="ItemEdition", MaxSize = 50,
Value = "//datafield[@tag='250']/subfield[@code='a']"
},
{
Table = "Transaction",
Field ="ItemIssue", MaxSize = 255,
Value = "//datafield[@tag='773']/subfield[@code='g']"
}
};
DataMapping.ImportFields.Item["Aeon"] = {
{
Table = "Transaction",
Field = "ReferenceNumber", MaxSize = 50,
Value = "ReferenceNumber"
},
{
Table = "Transaction",
Field = "CallNumber", MaxSize = 255,
Value = "CallNumber"
},
{
Table = "Transaction",
Field = "ItemNumber", MaxSize = 255,
Value = "Barcode"
},
{
Table = "Transaction",
Field = "Location", MaxSize = 255,
Value = "Location"
},
{
Table = "Transaction",
Field = "SubLocation", MaxSize = 255,
Value = "Library"
}
}; |
--[[
© CloudSixteen.com do not share, re-distribute or modify
without permission of its author ([email protected]).
Clockwork was created by Conna Wiles (also known as kurozael.)
http://cloudsixteen.com/license/clockwork.html
--]]
local COMMAND = Clockwork.command:New("DoorSetOwnable");
COMMAND.tip = "Set an ownable door.";
COMMAND.text = "<string Name>";
COMMAND.flags = CMD_DEFAULT;
COMMAND.access = "a";
COMMAND.arguments = 1;
-- Called when the command has been run.
function COMMAND:OnRun(player, arguments)
local door = player:GetEyeTraceNoCursor().Entity;
if (IsValid(door) and Clockwork.entity:IsDoor(door)) then
local data = {
customName = true,
position = door:GetPos(),
entity = door,
name = table.concat(arguments or {}, " ") or ""
};
Clockwork.entity:SetDoorUnownable(data.entity, false);
Clockwork.entity:SetDoorText(data.entity, false);
Clockwork.entity:SetDoorName(data.entity, data.name);
cwDoorCmds.doorData[data.entity] = data;
cwDoorCmds:SaveDoorData();
Clockwork.player:Notify(player, {"YouSetOwnableDoor"});
else
Clockwork.player:Notify(player, {"ThisIsNotAValidDoor"});
end;
end;
COMMAND:Register(); |
--import the objects
player = require "objects/player"
Enemy = require "objects/enemy"
local anim8 = require 'lib/anim8'
--some global variables
createEnemyTimerMax = 0.6
createEnemyTimer = createEnemyTimerMax
score = 0
scale_factor = 0.9
-- table to store the enemies
enemies = {}
function love.load()
--define a new player
player = player:new(love.graphics.getWidth()/2 - 50,love.graphics.getHeight()-150)
--initialize the images and sounds
background_music = love.audio.newSource("/assets/sounds/Mecha Collection.wav")
background_image = love.graphics.newImage("/assets/images/space.jpeg")
button_image = love.graphics.newImage("/assets/images/button9090.png")
player.image = love.graphics.newImage("/assets/images/plane.png")
player.fire_audio = love.audio.newSource("/assets/sounds/gun-sound.wav")
player.bullet_image = love.graphics.newImage("/assets/images/bullet.png")
enemy_image = love.graphics.newImage("/assets/images/enemy.png")
direcional_image = love.graphics.newImage("/assets/images/transparentLight49.png")
explosion_animation = love.graphics.newImage("/assets/images/M484ExplosionSet1.png")
-- frame, image, offsets, border
local g32 = anim8.newGrid(32,32, explosion_animation:getWidth(),explosion_animation:getHeight(), 92, 10 , 0)
explosion = anim8.newAnimation(g32('1-7',1), 0.5)
--play the background music
love.audio.play(background_music)
end
-- Returns true if two boxes overlap, false if they don't
-- x1,y1 are the left-top coords of the first box, while w1,h1 are its width and height
-- x2,y2,w2 & h2 are the same, but for the second box
function CheckCollision(x1,y1,w1,h1, x2,y2,w2,h2)
return x1 < x2+w2 and
x2 < x1+w1 and
y1 < y2+h2 and
y2 < y1+h1
end
-- function to key detection and player movement
function detectKey(dt)
if love.keyboard.isDown("right") then
if player.x < (love.graphics.getWidth() - player.image:getWidth()) then
player.x = player.x + (player.speed * dt)
end
elseif love.keyboard.isDown("left") then
if player.x > 0 then
player.x = player.x - (player.speed * dt)
end
end
if love.keyboard.isDown("down") then
if player.y < (love.graphics.getHeight() - player.image:getHeight()) then
player.y = player.y + (player.speed * dt)
end
elseif love.keyboard.isDown("up") then
if player.y > 0 then
player.y = player.y - (player.speed * dt)
end
end
end
-- like keydetected but for touchscreen
function detectTouch(dt)
local touches = love.touch.getTouches()
for i, id in ipairs(touches) do
local x, y = love.touch.getPosition(id)
if button_pressed(x,y) then player:fire()
elseif player.x < x then
player.x = player.x + (player.speed * dt)
if player.x > x then player.x = x end
--touched to left
elseif player.x > x then
player.x = player.x - (player.speed * dt)
if player.x < x then player.x = x end
end
--touched to down
if player.y > y then
player.y = player.y - (player.speed * dt)
if player.y < y then player.y = y end
--touched to up
elseif player.y < y then
player.y = player.y + (player.speed * dt)
if player.y > y then player.y = y end
end
end
end
-- callback when touch is released
function love.touchreleased( id, x, y, dx, dy, pressure )
-- player is died
if not player.isAlive then
reset()
end
-- fire button is pressed
if button_pressed(x,y) then
player:fire()
end
end
-- like touch relased but for keyboard
function love.keyreleased(key)
if (key == "space") then
player:fire()
elseif not player.isAlive and key == 'r' then
reset()
end
end
-- reset the player, enermies table, dificult and score
function reset()
player:reset(300,300)
enemies = {}
score = 0
createEnemyTimerMax = 0.6
end
-- update every frame
function love.update(dt)
--player fire cooldown
player.cooldown = player.cooldown - 1
-- with this timer, will slowly spawn more enermies
createEnemyTimerMax = createEnemyTimerMax - 0.0001
enemySpawn(dt)
detectKey(dt)
detectTouch(dt)
-- update the bullets positions
for i,v in ipairs(player.bullets) do
v.y = v.y - (v.speed * dt)
if(v.y <= 0) then
table.remove(player.bullets, i)
end
end
-- update the positions of enemies
for i, enemy in ipairs(enemies) do
enemy.y = enemy.y + (enemy.speed * dt)
if enemy.y > love.graphics.getHeight() then -- remove enemies when they pass off the screen
table.remove(enemy, i)
end
end
-- since there will be fewer enemies on screen than bullets we'll loop them first
for i, enemy in ipairs(enemies) do
for j, bullet in ipairs(player.bullets) do
if CheckCollision(enemy.x, enemy.y, enemy.image:getWidth(), enemy.image:getHeight(),
bullet.x, bullet.y, player.bullet_image:getWidth(), player.bullet_image:getHeight()) then
table.remove(player.bullets, j)
enemy.dead = true
love.audio.play(love.audio.newSource("/assets/sounds/explosion.wav"))
score = score + 1
end
end
-- check if are collision with player
if CheckCollision(enemy.x, enemy.y, enemy.image:getWidth(), enemy.image:getHeight(),
player.x, player.y, player.image:getWidth(), player.image:getHeight()) and player.isAlive then
table.remove(enemies, i)
player.isAlive = false
end
end
end
--function to spawn enemies, using the timer and random number generator
function enemySpawn(dt)
-- Time out enemy creation
createEnemyTimer = createEnemyTimer - (1 * dt)
if createEnemyTimer < 0 then
createEnemyTimer = createEnemyTimerMax
-- Create an enemy
randomX = math.random(10, love.graphics.getWidth() - 10)
randomSpeed = math.random(70, 150)
enemy = Enemy:new(randomX, -20, randomSpeed, enemy_image)
table.insert(enemies, enemy)
end
end
-- check if the fire button was pressed
function button_pressed(x,y)
if x > love.graphics:getWidth() - 200 and x < love.graphics:getWidth() - 110 and
y > love.graphics:getHeight() - 180 and y < love.graphics:getHeight() - 90 then
return true
end
return false
end
function love.draw()
-- draw the background image, rotated by 90 degree to fit mobile screen
love.graphics.draw(background_image,1024,0,math.rad(90))
-- draw a player
if player.isAlive then
love.graphics.draw(player.image, player.x, player.y,0,scale_factor, scale_factor)
else
love.graphics.print("Press anywhere to restart", love.graphics:getWidth()/2-50, love.graphics:getHeight()/2-10)
end
--draw the enemies
for i, enemy in ipairs(enemies) do
if(enemy.dead == false) then
love.graphics.draw(enemy.image, enemy.x, enemy.y, 0, scale_factor, scale_factor)
else
explosion:draw( explosion_animation, enemy.x + enemy.image:getWidth()/2 - 20, enemy.y + enemy.image:getHeight()/2-20)
table.remove(enemies, i)
end
end
--draw the bullets
for _,v in pairs(player.bullets) do
love.graphics.draw(player.bullet_image, v.x, v.y)
end
--change color and print score
love.graphics.setColor(255, 255, 255)
love.graphics.print("SCORE: " .. tostring(score), 400, 10)
--draw a button
love.graphics.draw(button_image, love.graphics:getWidth() - 200, love.graphics:getHeight() - 160)
love.graphics.draw(direcional_image, 100, love.graphics:getHeight() - 160)
end
|
WonState = State:extend()
local levels = require "data.levels"
local levelNames = { "tutorial", "1", "2", "3" }
local tanks = require "data.tanks"
local tankNames = { "T-18", "T-12", "R-10", "B-47" }
function WonState:init()
WonState.super.init(self)
self.name = "won"
self.hasNext = false
self.next = nil
log.info("Current level: " .. game.level.map)
local i = 1
local n = false
for _, l in pairs(levelNames) do
if n then
self.next = levels[l]
self.hasNext = true
Save[l] = true
break
end
if l == game.level.name then
n = true
if l == "tutorial" then
Save["T-12"] = true
elseif l == "1" then
Save["R-10"] = true
elseif l == "3" then
Save["B-47"] = true
end
end
i = i + 1
end
end
function WonState:update(dt)
WonState.super.update(self, dt)
end
function WonState:draw()
WonState.super.draw(self)
Util.drawTextWithStroke("You won!", 15, 15)
if UI.button("To menu", 10, HEIGHT - 30, 64, 22) then
game:switchState(MenuState())
log.info("Menu")
end
if self.hasNext then
if UI.button("Next level", 10, HEIGHT - 30 - 24, 64, 22) then
game.level = self.next
game:switchState(InGameState())
log.info("Next level")
end
end
end |
-- sort a list of integers
i = 1
int_list = {}
while arg[i] ~= nil do
table.insert(int_list, arg[i])
i = i + 1
end
table.sort(int_list)
io.write(table.concat(int_list, ' ') .. '\n')
|
/*
_ ___ ___ ___
/_\ / __| __| / __|_ __ _____ _ __ ___
/ _ \ (__| _| \__ \ V V / -_) '_ (_-<
/_/ \_\___|_| |___/\_/\_/\___| .__/__/
By Bubbus! |_|
Global configuration for the SWEPs!
//*/
// What accuracy scheme to use? Choose from WOT, Shooter, Static
local AimStyle = "Shooter"
// What reticule should we use? Choose from Circle, Crosshair
local Reticule = "Circle"
// Use ironsights when aiming, or just hug the weapon closer?
local IronSights = true
// Use lag compensation on bullets?
local LagCompensation = true
// Allow shooting while noclipping
local NoclipShooting = false
// Kick up dust on bullet impacts for all guns, or only snipers? Fun but potentially laggy.
local AlwaysDust = false
// Make the weapon tracers match the player's custom colour?
local PlayerTracers = true
// How fast should stamina drain while sprinting? This is a scaling number.
local STAMINA_DRAIN = 0.4
// How fast should stamina recover after sprinting? This is a scaling number.
local STAMINA_RECOVER = 0.09
// How much should velocity affect accuracy? This is a scaling number.
local VEL_SCALE = 60
// In WOT mode, what the inaccuracy shrinking is multiplied by. This balances Shooter with WOT.
local WOT_ACC_SCALE = 1.2
// In WOT mode, what the inaccuracy growth caused my moving your aim is multiplied by.
local WOT_INACC_AIM = 1
// In shooter mode, what the minimum inaccuracy is multiplied by. This balances Shooter with WOT.
local SHOOTER_INACC_MUL = 2
// In shooter mode, how fast should the reticule grow/shrink?
local SHOOTER_LERP_MUL = 2
// In static mode, what fraction of total spread is added to the minimum spread. It's pretty much impossible to balance Static with WOT.
local STATIC_INACC_MUL = 0.05
// Don't edit below this line ok thanks
ACF = ACF or {}
ACF.SWEP = ACF.SWEP or {}
ACF.SWEP.Aim = ACF.SWEP.Aim or {}
ACF.SWEP.IronSights = IronSights
ACF.SWEP.LagComp = LagCompensation
ACF.SWEP.NoclipShooting = NoclipShooting
ACF.SWEP.AlwaysDust = AlwaysDust
ACF.SWEP.PlayerTracers = PlayerTracers
local swep = ACF.SWEP
local aim = ACF.SWEP.Aim
local function biasedapproach(cur, target, incup, incdn)
incdn = math.abs( incdn )
incup = math.abs( incup )
if (cur < target) then
return math.Clamp( cur + incdn, cur, target )
elseif (cur > target) then
return math.Clamp( cur - incup, target, cur )
end
return target
end
function swep.SetInaccuracy(self, val)
ACF.SWEP.AddInaccuracy(self, val - self.Inaccuracy)
end
function swep.AddInaccuracy(self, add)
aim[AimStyle].AddInaccuracy(self, add)
self:SetNetworkedFloat("ServerInacc", self.Inaccuracy)
end
function swep.Think(self)
return aim[AimStyle].Think(self)
end
aim.WOT = {}
local WOT = aim.WOT
function WOT.Think(self)
local timediff = CurTime() - self.LastThink
self.Owner.XCFStamina = self.Owner.XCFStamina or 0
self.LastAim = type(self.LastAim) == "Vector" and self.LastAim or Vector(1, 0, 0)
if self.Owner:GetMoveType() ~= MOVETYPE_WALK and not self.Owner:InVehicle() then
self.Inaccuracy = self.MaxInaccuracy
self.Owner.XCFStamina = 0
end
if isReloading then
self.Inaccuracy = self.MaxInaccuracy
else
local inaccuracydiff = self.MaxInaccuracy - self.MinInaccuracy
//local vel = math.Clamp(math.sqrt(self.Owner:GetVelocity():Length()/400), 0, 1) * inaccuracydiff // max vel possible is 3500
local vel = math.Clamp(self.Owner:GetVelocity():Length()/400, 0, 1) * inaccuracydiff * VEL_SCALE // max vel possible is 3500
local aim = self.Owner:GetAimVector()
local difflimit = self.InaccuracyAimLimit * WOT_INACC_AIM - self.Inaccuracy
difflimit = difflimit < 0 and 0 or difflimit
local diffaim = math.min(aim:Distance(self.LastAim) * 30, difflimit)
local crouching = self.Owner:Crouching()
local jumping = not (self.Owner:OnGround() or inVehicle)
local decay = self.InaccuracyDecay * WOT_ACC_SCALE
local penalty = 0
//print(self.Owner:KeyDown(IN_SPEED), self.Owner:KeyDown(IN_RUN))
local healthFract = self.Owner:Health() / 100
self.MaxStamina = math.Clamp(healthFract, 0.5, 1)
if self.Owner:KeyDown(IN_SPEED) then
self.Owner.XCFStamina = math.Clamp(self.Owner.XCFStamina - self.StaminaDrain * STAMINA_DRAIN, 0, 1)
else
local recover = (crouching and STAMINA_RECOVER * self.InaccuracyCrouchBonus or STAMINA_RECOVER) * timediff
self.Owner.XCFStamina = math.Clamp(self.Owner.XCFStamina + recover, 0, self.MaxStamina)
end
decay = decay * self.Owner.XCFStamina
if crouching then
decay = decay * self.InaccuracyCrouchBonus
end
if self.WasCrouched != crouching then
penalty = penalty + self.InaccuracyDuckPenalty
end
if jumping then
penalty = penalty + self.InaccuracyPerShot
if not self.WasJumping and self.Owner:KeyDown(IN_JUMP) then
self.Owner.XCFStamina = math.Clamp(self.Owner.XCFStamina - self.StaminaJumpDrain, 0, 1)
end
end
//self.Inaccuracy = math.Clamp(self.Inaccuracy + (vel + diffaim + penalty - decay) * timediff, self.MinInaccuracy, self.MaxInaccuracy)
local rawinaccuracy = self.MinInaccuracy + vel * timediff
local idealinaccuracy = biasedapproach(self.Inaccuracy, rawinaccuracy, decay, self.AccuracyDecay) + penalty + diffaim
self.Inaccuracy = math.Clamp(idealinaccuracy, self.MinInaccuracy, self.MaxInaccuracy)
//print("inacc", self.Inaccuracy)
self.LastAim = aim
XCFDBG_ThinkTime = timediff
self.LastThink = CurTime()
self.WasCrouched = self.Owner:Crouching()
self.WasJumping = jumping
//PrintMessage( HUD_PRINTCENTER, "vel = " .. math.Round(vel, 2) .. "inacc = " .. math.Round(rawinaccuracy, 2) )
end
end
function WOT.AddInaccuracy(self, add)
self.Inaccuracy = math.Clamp(self.Inaccuracy + add, self.MinInaccuracy, self.MaxInaccuracy)
end
aim.Shooter = {}
local Shooter = aim.Shooter
function Shooter.Think(self)
self.AddInacc = self.AddInacc or 0
--self.WasJumping = self.WasJumping or true
local timediff = CurTime() - self.LastThink
self.Owner.XCFStamina = self.Owner.XCFStamina or 0
local inVehicle = self.Owner:InVehicle()
if self.Owner:GetMoveType() ~= MOVETYPE_WALK and not inVehicle then
self.Inaccuracy = self.MaxInaccuracy
self.Owner.XCFStamina = 0
end
if isReloading then
self.Inaccuracy = self.MaxInaccuracy
else
local inaccuracydiff = self.MaxInaccuracy - self.MinInaccuracy
local moving = self.Owner:KeyDown(IN_FORWARD) or self.Owner:KeyDown(IN_BACK) or self.Owner:KeyDown(IN_MOVELEFT) or self.Owner:KeyDown(IN_MOVERIGHT)
local sprinting = self.Owner:KeyDown(IN_SPEED)
local walking = self.Owner:KeyDown(IN_WALK)
local crouching = self.Owner:KeyDown(IN_DUCK) or inVehicle
local zoomed = self:GetNetworkedBool("Zoomed")
local jumping = not (self.Owner:OnGround() or inVehicle)
local inacc = 0.25
if zoomed then
if crouching and not moving then
inacc = 0
elseif not moving then
inacc = inacc * 0.08
elseif crouching then
inacc = inacc * 0.33
else
inacc = inacc * 0.66
end
elseif crouching then
inacc = inacc * 0.5
end
if moving then
if sprinting then
inacc = inacc * 4
elseif walking
then inacc = inacc * 1.5
else
inacc = inacc * 2
end
end
if jumping then
inacc = inacc * 4
if not self.WasJumping and self.Owner:KeyDown(IN_JUMP) then
self.Owner.XCFStamina = math.Clamp(self.Owner.XCFStamina - self.StaminaJumpDrain, 0, 1)
end
end
local healthFract = self.Owner:Health() / 100
self.MaxStamina = math.Clamp(healthFract, 0.25, 1)
if self.Owner:KeyDown(IN_SPEED) then
self.Owner.XCFStamina = math.Clamp(self.Owner.XCFStamina - self.StaminaDrain * STAMINA_DRAIN, 0, 1)
else
local recover = (crouching and STAMINA_RECOVER * self.InaccuracyCrouchBonus or STAMINA_RECOVER) * timediff
self.Owner.XCFStamina = math.Clamp(self.Owner.XCFStamina + recover, 0, self.MaxStamina)
end
local accuracycap = ((1 - self.Owner.XCFStamina) * 0.5) ^ 2
local rawinaccuracy = self.MinInaccuracy * SHOOTER_INACC_MUL + math.max(inacc + self.AddInacc, accuracycap) * inaccuracydiff
local idealinaccuracy = biasedapproach(self.Inaccuracy, rawinaccuracy, self.InaccuracyDecay * SHOOTER_LERP_MUL, self.AccuracyDecay * SHOOTER_LERP_MUL)
self.Inaccuracy = math.Clamp(idealinaccuracy, self.MinInaccuracy, self.MaxInaccuracy)
//print("inacc", self.Inaccuracy)
self.LastAim = aim
XCFDBG_ThinkTime = timediff
self.LastThink = CurTime()
self.WasJumping = jumping
//PrintMessage( HUD_PRINTCENTER, "vel = " .. math.Round(vel, 2) .. "inacc = " .. math.Round(rawinaccuracy, 2) )
end
end
function Shooter.AddInaccuracy(self, add)
self.Inaccuracy = math.Clamp(self.Inaccuracy + add, self.MinInaccuracy, self.MaxInaccuracy)
end
aim.Static = {}
local Static = aim.Static
function Static.Think(self)
self.AddInacc = self.AddInacc or 0
self.WasJumping = self.WasJumping or true
local timediff = CurTime() - self.LastThink
self.Owner.XCFStamina = self.Owner.XCFStamina or 0
//print(self.Owner:GetVelocity():Length())
if self.Owner:GetMoveType() ~= MOVETYPE_WALK and not self.Owner:InVehicle() then
self.Inaccuracy = self.MaxInaccuracy
self.Owner.XCFStamina = 0
end
if isReloading then
self.Inaccuracy = self.MaxInaccuracy
else
local inaccuracydiff = self.MaxInaccuracy - self.MinInaccuracy
local inacc = STATIC_INACC_MUL
local zoomed = self:GetNetworkedBool("Zoomed")
if zoomed then inacc = inacc * (self.HasScope and 0.05 or 0.5) end
local healthFract = self.Owner:Health() / 100
self.MaxStamina = math.Clamp(healthFract, 0.25, 1)
if self.Owner:KeyDown(IN_SPEED) then
self.Owner.XCFStamina = math.Clamp(self.Owner.XCFStamina - self.StaminaDrain * STAMINA_DRAIN, 0, 1)
else
local recover = (crouching and STAMINA_RECOVER * self.InaccuracyCrouchBonus or STAMINA_RECOVER) * timediff
self.Owner.XCFStamina = math.Clamp(self.Owner.XCFStamina + recover, 0, self.MaxStamina)
end
local accuracycap = (1 - self.Owner.XCFStamina) ^ 2
local rawinaccuracy = self.MinInaccuracy + (inacc + accuracycap) * inaccuracydiff
//local idealinaccuracy = biasedapproach(self.Inaccuracy, rawinaccuracy, self.InaccuracyDecay * STATIC_LERP_MUL, self.AccuracyDecay * STATIC_LERP_MUL)
self.Inaccuracy = math.Clamp(rawinaccuracy, self.MinInaccuracy, self.MaxInaccuracy)
//print("inacc", self.Inaccuracy)
self.LastAim = aim
XCFDBG_ThinkTime = timediff
self.LastThink = CurTime()
self.WasJumping = jumping
//PrintMessage( HUD_PRINTCENTER, "vel = " .. math.Round(vel, 2) .. "inacc = " .. math.Round(rawinaccuracy, 2) )
end
end
function Static.AddInaccuracy(self, add)
//self.Inaccuracy = math.Clamp(self.Inaccuracy + add, self.MinInaccuracy, self.MaxInaccuracy)
end
if CLIENT then
ACF.SWEP.Reticules = {}
local rets = ACF.SWEP.Reticules
function swep.DrawReticule(self, screenpos, aimRadius, fillFraction, colourFade)
rets[Reticule].Draw(self, screenpos, aimRadius, fillFraction, colourFade)
end
rets.Circle = {}
local Circle = rets.Circle
function Circle.Draw(self, screenpos, radius, progress, colourFade)
screenpos = Vector(math.floor(screenpos.x + 0.5), math.floor(screenpos.y + 0.5), 0)
local alpha = (self:GetNetworkedBool("Zoomed") and ACF.SWEP.IronSights and self.IronSights and not self.HasScope) and 50 or 255
local circlehue = Color(255, colourFade*255, colourFade*255, alpha)
if self.ShotSpread and self.ShotSpread > 0 then
radius = ScrW() / 2 * (self.ShotSpread) / self.Owner:GetFOV()
surface.DrawCircle(screenpos.x, screenpos.y, radius , Color(0, 0, 0, 128) )
radius = ScrW() / 2 * (self.curVisInacc + self.ShotSpread) / self.Owner:GetFOV()
end
draw.Arc(screenpos.x, screenpos.y, radius, -2, (1-progress)*360, 360, 3, Color(0, 0, 0, alpha))
draw.Arc(screenpos.x, screenpos.y, radius, -1, (1-progress)*360, 360, 3, circlehue)
end
rets.Crosshair = {}
local Crosshair = rets.Crosshair
local CrosshairLength = 20
function Crosshair.Draw(self, screenpos, radius, progress, colourFade)
screenpos = Vector(math.floor(screenpos.x + 0.5), math.floor(screenpos.y + 0.5), 0)
local alpha = (self:GetNetworkedBool("Zoomed") and ACF.SWEP.IronSights and self.IronSights and not self.HasScope) and 70 or 255
local circlehue = Color(255, colourFade*255, colourFade*255, alpha)
if self.ShotSpread and self.ShotSpread > 0 then
radius = ScrW() / 2 * (self.ShotSpread) / self.Owner:GetFOV()
draw.Arc(screenpos.x, screenpos.y, radius, 2, 0, 360, 3, Color(0, 0, 0, 128))
--surface.DrawCircle(screenpos.x, screenpos.y, radius , Color(0, 0, 0, 128) )
radius = ScrW() / 2 * (self.curVisInacc + self.ShotSpread) / self.Owner:GetFOV()
end
if progress < 1 then progress = 1 - progress end
radius = radius + 1
surface.SetDrawColor(Color(0, 0, 0, circlehue.a))
surface.DrawRect((screenpos.x - radius - CrosshairLength - 1), screenpos.y - 1, CrosshairLength + 3, 3)
surface.DrawRect((screenpos.x + radius - 1), screenpos.y - 1, CrosshairLength + 2, 3)
surface.DrawRect(screenpos.x - 1, (screenpos.y - radius - CrosshairLength - 1), 3, CrosshairLength + 3)
surface.DrawRect(screenpos.x - 1, (screenpos.y + radius - 1), 3, CrosshairLength + 2)
surface.SetDrawColor(circlehue)
surface.DrawLine((screenpos.x + radius), screenpos.y, (screenpos.x + (radius + CrosshairLength * progress)), screenpos.y)
surface.DrawLine((screenpos.x - radius), screenpos.y, (screenpos.x - (radius + CrosshairLength * progress) - 1), screenpos.y)
surface.DrawLine(screenpos.x, (screenpos.y + radius), screenpos.x, (screenpos.y + (radius + CrosshairLength * progress)))
surface.DrawLine(screenpos.x, (screenpos.y - radius), screenpos.x, (screenpos.y - (radius + CrosshairLength * progress) - 1))
--draw.Arc(screenpos.x, screenpos.y, radius, -1.5, (1-progress)*360, 360, 5, circlehue)
end
if not (Reticule and rets[Reticule]) then
print("ACF SWEPs: Couldn't find the " .. tostring(Reticule) .. " reticule! Please choose a valid reticule in acf_swepconfig.lua. Defaulting to Circle.")
Reticule = "Circle"
end
end
if not (AimStyle and aim[AimStyle]) then
print("ACF SWEPs: Couldn't find the " .. tostring(AimStyle) .. " aim-style! Please choose a valid aim-style in acf_swepconfig.lua. Defaulting to WOT.")
AimStyle = "WOT"
end
if not aim[AimStyle] then error("ACF SWEPs: Couldn't find the " .. tostring(AimStyle) .. " aim-style! Please choose a valid aim-style in acf_swepconfig.lua") end
AddCSLuaFile() |
slot0 = class("HoloLiveLinkLinkSelectMediator", import("view.base.ContextMediator"))
slot0.HUB_ID = 3
slot0.register = function (slot0)
slot0:BindEvent()
slot0:requestDataFromServer()
end
slot0.requestDataFromServer = function (slot0)
pg.ConnectionMgr.GetInstance():Send(26101, {
type = MiniGameRequestCommand.REQUEST_HUB_DATA
}, 26102, function (slot0)
slot1 = getProxy(MiniGameProxy)
for slot5, slot6 in ipairs(slot0.hubs) do
if slot6.id == slot0.HUB_ID then
slot1:UpdataHubData(slot6)
end
end
end)
end
slot0.BindEvent = function (slot0)
return
end
slot0.listNotificationInterests = function (slot0)
return {
MiniGameProxy.ON_HUB_DATA_UPDATE,
GAME.SEND_MINI_GAME_OP_DONE
}
end
slot0.handleNotification = function (slot0, slot1)
slot3 = slot1:getBody()
if slot1:getName() == MiniGameProxy.ON_HUB_DATA_UPDATE then
if slot3.id == HoloLiveLinkLinkSelectScene.HOLOLIVE_LINKGAME_HUB_ID then
slot0.viewComponent:updateData()
slot0.viewComponent:updateUI()
end
elseif slot2 == GAME.SEND_MINI_GAME_OP_DONE and slot3.cmd == MiniGameOPCommand.CMD_ULTIMATE then
slot4 = {
function (slot0)
if #slot0.awards > 0 then
slot1.viewComponent:emit(BaseUI.ON_ACHIEVE, slot1, slot0)
else
slot0()
end
end,
function (slot0)
slot0.viewComponent:updateData()
slot0.viewComponent:updateUI()
end
}
seriesAsync(slot4)
end
end
return slot0
|
include("shared.lua")
surface.CreateFont( "Roboto", {
font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 14,
weight = 500,
})
local function ToggleScoreboard(toggle)
if toggle then
local scrw, scrh = ScrW(), ScrH()
EmberRPScoreboard = vgui.Create("DFrame")
EmberRPScoreboard:SetTitle("")
EmberRPScoreboard:SetSize(scrw * .3, scrh * .6)
EmberRPScoreboard:Center()
EmberRPScoreboard:MakePopup()
EmberRPScoreboard:ShowCloseButton(false)
EmberRPScoreboard:SetDraggable(false)
EmberRPScoreboard:Paint = function(self,w,h)
surface.SetDrawColor(0,0,0,200)
surface.DrawRect(0,0,w,h)
draw.SimpleText("EmberRP Scoreboard","Roboto", w / 2, h * 0.2, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
local scroll = vgui.Create("DscrollPanel", EmberRPScoreboard)
scroll:SetPos(0, EmberRPScoreboard:GetTall() * .03)
scroll:SetSize(EmberRPScoreboard:GetWide(), EmberRPScoreboard:GetTall() * .97)
local ypos = 0
for k, v in pairs(player.GetAll()) do
local PlayerPanel = vgui.Create("DPanel", EmberRPScoreboard)
PlayerPanel:SetPos(0, ypos)
PlayerPanel:SetSize(EmberRPScoreboard:GetWide(), EmberRPScoreboard:GetTall() * 0.5)
local name = v:Name()
PlayerPanel.Paint = function(self,w,h)
if Is IsValid(v) then
surface.SetDrawColor(0,0,0,200)
surface.DrawRect(0,0,w,h)
draw.SimpleText(v:Name(),"Roboto", w / 2, h / 2, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
ypos = ypos + PlayerPanel:GetTall() * 1.1
end
else
if IsValid(EmberRPScoreboard) then
EmberRPScoreboard:Remove()
end
end
hook.Add("ScoreboardShow", "EmberRPOpenScoreboard", funcction()
ToggleScoreboard(true)
return false
end)
hook.Add("ScoreboardHide", "EmberRPHideScoreboard", funcction()
ToggleScoreboard(false)
end)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.