content
stringlengths 5
1.05M
|
---|
function requestPlayerData(plr)
local ip = plr.ip or "N/A"
local serial = plr.serial or "N/A"
if (isPlayerAdmin(plr)) then
if (isPlayerOwner(plr) and not isPlayerOwner(client)) then ip = "Hidden" serial = "Hidden" end
end
local version = plr.version or "N/A"
local bank = exports.UCDaccounts:GAD(plr, "bankbalance")
local email = exports.UCDaccounts:getAccountEmail(plr.account.name) or "N/A" -- lol
local money = plr:getMoney()
local weapon = tostring(getWeaponNameFromID(getPedWeapon(plr)).." ["..getPedTotalAmmo(plr).."]")
local data = {["ip"] = ip, ["serial"] = serial, ["version"] = version, ["email"] = email or "N/A", ["bank"] = bank, ["money"] = money, ["weapon"] = weapon}
triggerLatentClientEvent(client, "UCDadmin.requestPlayerData:callback", client, data)
end
addEvent("UCDadmin.requestPlayerData", true)
addEventHandler("UCDadmin.requestPlayerData", root, requestPlayerData)
function fetchResources()
local resources = {}
for i, res in ipairs(getResources()) do
resources[i] = {res.name, res.state}
end
--triggerClientEvent(client, "UCDadmin.updateResources", client, resources or {})
end
--addEvent("UCDadmin.getResources", true)
--addEventHandler("UCDadmin.getResources", root, fetchResources)
function saveScreenshot(theResource, status, imageData, _, tag)
if (theResource ~= resource) then return end -- Screenshots taken here only
if (status ~= "ok") then return end
local file = File.new("screenshots/"..tag..".png")
file:write(imageData)
file:close()
end
addEventHandler("onPlayerScreenShot", root, saveScreenshot) |
--|> SIMPLEX | Easy-to-use interaction system <|--
-- ShutoExpressway
-- Registers global variables for the client.
-- Side note: _G IS NOT BAD IN MOST CASES WeirdChamp
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local SIMPLEX_FOLDERS = {
shared = ReplicatedStorage:WaitForChild("Simplex"),
client = script.Parent.Parent
}
local DEBUG_ENABLED = true
local Simplex = {
Shared = {},
Client = {},
Player = game:GetService("Players").LocalPlayer
}
_G.Simplex = Simplex
local function parseDebugString(...)
return ("$SimplexClient:%s -> %s"):format(getfenv(3).script.Name, tostring(...))
end
function Simplex.Debug(_, msgType, ...)
if not DEBUG_ENABLED then return end
local parsed = parseDebugString(...)
if msgType then
if msgType:lower() == "error" then
error(parsed)
return
elseif msgType:lower() == "warn" then
warn(parsed)
return
end
end
print(parsed)
end
Simplex:Debug("warn", "Debug mode is ON. To stop sending these types of messages, set DEBUG_ENABLED to false in both internal handlers.")
function Simplex.Wrap(_, module)
if not module:IsA("ModuleScript") then
return
end
if type(module.Init) == "function" then
module:Init()
end
end
function Simplex.GetCharacter()
local character = Simplex.Player.Character or Simplex.Player.CharacterAdded:Wait()
return character
end
local function initializeEnvironment(name)
local success, err = pcall(function()
for _, resource in ipairs(SIMPLEX_FOLDERS[name:lower()]:GetChildren()) do
if resource:IsA("ModuleScript") then
local requiredResource = require(resource)
Simplex[name][resource.Name] = requiredResource
end
end
end)
if not err then
Simplex:Debug(nil, "Successfully registered resources: args[1]:"..name)
else
Simplex:Debug("warn", ("An error occurred while registering resources:\n%s"):format(err))
end
end
local function initializeAll()
local function init(obj)
for _, object in pairs(obj) do
if type(object) == "table" then
if type(object.Init) == "function" then
coroutine.wrap(function()
object:Init(Simplex)
end)()
end
else
init(object)
end
end
end
init(Simplex.Client)
init(Simplex.Shared)
end
local interactives = {}
local function registerInteractives()
local folder = SIMPLEX_FOLDERS.shared.Interactives
for _, module in ipairs(folder:GetChildren()) do
if module:IsA("ModuleScript") then
local required = require(module)
interactives[module.Name] = required
end
end
Simplex:Debug(nil, "Registered shared interactives")
end
initializeEnvironment("Shared")
initializeEnvironment("Client")
registerInteractives()
Simplex.Interactives = interactives
Simplex.Network = SIMPLEX_FOLDERS.shared:WaitForChild("Network")
initializeAll() |
local endlesstower = {
[100] = {ID=100,Number=1,Monster="300101;300102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[101] = {ID=101,Number=2,Monster="300201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[102] = {ID=102,Number=3,Monster="300301;300302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[103] = {ID=103,Number=4,Monster="300401;300402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[104] = {ID=104,Number=5,Monster="300501;300502;300505;",Reward="4{60000001:1:1;60000002:1:1;60000003:1:1;60000004:1:1;60000005:1:1;60000006:1:1;60000001:2:1;60000002:2:1;60000003:2:1;60000004:2:1;60000005:2:1;60000006:2:1;60000001:3:1;60000002:3:1;60000003:3:1;60000004:3:1;60000005:3:1;60000006:3:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[105] = {ID=105,Number=6,Monster="300601;300602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[106] = {ID=106,Number=7,Monster="300701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[107] = {ID=107,Number=8,Monster="300801;300802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[108] = {ID=108,Number=9,Monster="300901;300902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[109] = {ID=109,Number=10,Monster="301001;301002;301005;",Reward="3{60000001:1:1;60000002:1:1;60000003:1:1;60000004:1:1;60000005:1:1;60000006:1:1;60000001:2:1;60000002:2:1;60000003:2:1;60000004:2:1;60000005:2:1;60000006:2:1;60000001:3:1;60000002:3:1;60000003:3:1;60000004:3:1;60000005:3:1;60000006:3:1;61000001:1:1;61000002:1:1;61000003:1:1;61000004:1:1;61000005:1:1;61000006:1:1;61000007:1:1;61000008:1:1;61000001:2:1;61000002:2:1;61000003:2:1;61000004:2:1;61000005:2:1;61000006:2:1;61000007:2:1;61000008:2:1;61000001:3:1;61000002:3:1;61000003:3:1;61000004:3:1;61000005:3:1;61000006:3:1;61000007:3:1;61000008:3:1;}1{51101000:1:1;51111000:1:1;51121000:1:1;51131000:1:1;51201000:1:1;51211000:1:1;51221000:1:1;51301000:1:1;51311000:1:1;51321000:1:1;51401000:1:1;51411000:1:1;51231000:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[110] = {ID=110,Number=11,Monster="301101;301102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[111] = {ID=111,Number=12,Monster="301201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[112] = {ID=112,Number=13,Monster="301301;301302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[113] = {ID=113,Number=14,Monster="301401;301402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[114] = {ID=114,Number=15,Monster="301501;301502;301505;",Reward="4{60000001:1:1;60000002:1:1;60000003:1:1;60000004:1:1;60000005:1:1;60000006:1:1;60000001:2:1;60000002:2:1;60000003:2:1;60000004:2:1;60000005:2:1;60000006:2:1;60000001:3:1;60000002:3:1;60000003:3:1;60000004:3:1;60000005:3:1;60000006:3:1;61000001:1:1;61000002:1:1;61000003:1:1;61000004:1:1;61000005:1:1;61000006:1:1;61000007:1:1;61000008:1:1;61000001:2:1;61000002:2:1;61000003:2:1;61000004:2:1;61000005:2:1;61000006:2:1;61000007:2:1;61000008:2:1;61000001:3:1;61000002:3:1;61000003:3:1;61000004:3:1;61000005:3:1;61000006:3:1;61000007:3:1;61000008:3:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[115] = {ID=115,Number=16,Monster="301601;301602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[116] = {ID=116,Number=17,Monster="301701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[117] = {ID=117,Number=18,Monster="301801;301802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[118] = {ID=118,Number=19,Monster="301901;301902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[119] = {ID=119,Number=20,Monster="302001;302002;302005;",Reward="3{60000001:1:1;60000002:1:1;60000003:1:1;60000004:1:1;60000005:1:1;60000006:1:1;60000001:2:1;60000002:2:1;60000003:2:1;60000004:2:1;60000005:2:1;60000006:2:1;60000001:3:1;60000002:3:1;60000003:3:1;60000004:3:1;60000005:3:1;60000006:3:1;61000001:1:1;61000002:1:1;61000003:1:1;61000004:1:1;61000005:1:1;61000006:1:1;61000007:1:1;61000008:1:1;61000001:2:1;61000002:2:1;61000003:2:1;61000004:2:1;61000005:2:1;61000006:2:1;61000007:2:1;61000008:2:1;61000001:3:1;61000002:3:1;61000003:3:1;61000004:3:1;61000005:3:1;61000006:3:1;61000007:3:1;61000008:3:1;}1{51101000:1:1;51111000:1:1;51121000:1:1;51131000:1:1;51201000:1:1;51211000:1:1;51221000:1:1;51301000:1:1;51311000:1:1;51321000:1:1;51401000:1:1;51411000:1:1;51231000:1:1;51431000:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[120] = {ID=120,Number=21,Monster="302101;302102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[121] = {ID=121,Number=22,Monster="302201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[122] = {ID=122,Number=23,Monster="302301;302302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[123] = {ID=123,Number=24,Monster="302401;302402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[124] = {ID=124,Number=25,Monster="302501;302502;302505;",Reward="4{60000001:1:1;60000002:1:1;60000003:1:1;60000004:1:1;60000005:1:1;60000006:1:1;60000001:2:1;60000002:2:1;60000003:2:1;60000004:2:1;60000005:2:1;60000006:2:1;60000001:3:1;60000002:3:1;60000003:3:1;60000004:3:1;60000005:3:1;60000006:3:1;61000001:1:1;61000002:1:1;61000003:1:1;61000004:1:1;61000005:1:1;61000006:1:1;61000007:1:1;61000008:1:1;61000001:2:1;61000002:2:1;61000003:2:1;61000004:2:1;61000005:2:1;61000006:2:1;61000007:2:1;61000008:2:1;61000001:3:1;61000002:3:1;61000003:3:1;61000004:3:1;61000005:3:1;61000006:3:1;61000007:3:1;61000008:3:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[125] = {ID=125,Number=26,Monster="302601;302602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[126] = {ID=126,Number=27,Monster="302701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[127] = {ID=127,Number=28,Monster="302801;302802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[128] = {ID=128,Number=29,Monster="302901;302902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[129] = {ID=129,Number=30,Monster="303001;303002;303005;",Reward="3{60000001:1:1;60000002:1:1;60000003:1:1;60000004:1:1;60000005:1:1;60000006:1:1;60000001:2:1;60000002:2:1;60000003:2:1;60000004:2:1;60000005:2:1;60000006:2:1;60000001:3:1;60000002:3:1;60000003:3:1;60000004:3:1;60000005:3:1;60000006:3:1;61000001:1:1;61000002:1:1;61000003:1:1;61000004:1:1;61000005:1:1;61000006:1:1;61000007:1:1;61000008:1:1;61000001:2:1;61000002:2:1;61000003:2:1;61000004:2:1;61000005:2:1;61000006:2:1;61000007:2:1;61000008:2:1;61000001:3:1;61000002:3:1;61000003:3:1;61000004:3:1;61000005:3:1;61000006:3:1;61000007:3:1;61000008:3:1;}1{52101000:1:1;52111000:1:1;52121000:1:1;52131000:1:1;52201000:1:1;52211000:1:1;52221000:1:1;52301000:1:1;52311000:1:1;52321000:1:1;52401000:1:1;52411000:1:1;52231000:1:1;52431000:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[130] = {ID=130,Number=31,Monster="303101;303102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[131] = {ID=131,Number=32,Monster="303201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[132] = {ID=132,Number=33,Monster="303301;303302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[133] = {ID=133,Number=34,Monster="303401;303402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[134] = {ID=134,Number=35,Monster="303501;303502;303505;",Reward="4{60000001:1:1;60000002:1:1;60000003:1:1;60000004:1:1;60000005:1:1;60000006:1:1;60000001:2:1;60000002:2:1;60000003:2:1;60000004:2:1;60000005:2:1;60000006:2:1;60000001:3:1;60000002:3:1;60000003:3:1;60000004:3:1;60000005:3:1;60000006:3:1;61000001:1:1;61000002:1:1;61000003:1:1;61000004:1:1;61000005:1:1;61000006:1:1;61000007:1:1;61000008:1:1;61000001:2:1;61000002:2:1;61000003:2:1;61000004:2:1;61000005:2:1;61000006:2:1;61000007:2:1;61000008:2:1;61000001:3:1;61000002:3:1;61000003:3:1;61000004:3:1;61000005:3:1;61000006:3:1;61000007:3:1;61000008:3:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[135] = {ID=135,Number=36,Monster="303601;303602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[136] = {ID=136,Number=37,Monster="303701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[137] = {ID=137,Number=38,Monster="303801;303802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[138] = {ID=138,Number=39,Monster="303901;303902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[139] = {ID=139,Number=40,Monster="304001;304002;304005;",Reward="3{61000001:1:1;61000002:1:1;61000003:1:1;61000004:1:1;61000005:1:1;61000006:1:1;61000007:1:1;61000008:1:1;61000001:2:1;61000002:2:1;61000003:2:1;61000004:2:1;61000005:2:1;61000006:2:1;61000007:2:1;61000008:2:1;61000001:3:1;61000002:3:1;61000003:3:1;61000004:3:1;61000005:3:1;61000006:3:1;61000007:3:1;61000008:3:1;62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;}1{52101000:1:1;52111000:1:1;52121000:1:1;52131000:1:1;52201000:1:1;52211000:1:1;52221000:1:1;52301000:1:1;52311000:1:1;52321000:1:1;52401000:1:1;52411000:1:1;52231000:1:1;52431000:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[140] = {ID=140,Number=41,Monster="304101;304102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[141] = {ID=141,Number=42,Monster="304201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[142] = {ID=142,Number=43,Monster="304301;304302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[143] = {ID=143,Number=44,Monster="304401;304402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[144] = {ID=144,Number=45,Monster="304501;304502;304505;",Reward="4{61000001:1:1;61000002:1:1;61000003:1:1;61000004:1:1;61000005:1:1;61000006:1:1;61000007:1:1;61000008:1:1;61000001:2:1;61000002:2:1;61000003:2:1;61000004:2:1;61000005:2:1;61000006:2:1;61000007:2:1;61000008:2:1;61000001:3:1;61000002:3:1;61000003:3:1;61000004:3:1;61000005:3:1;61000006:3:1;61000007:3:1;61000008:3:1;62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[145] = {ID=145,Number=46,Monster="304601;304602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[146] = {ID=146,Number=47,Monster="304701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[147] = {ID=147,Number=48,Monster="304801;304802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[148] = {ID=148,Number=49,Monster="304901;304902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[149] = {ID=149,Number=50,Monster="305001;305002;305005;",Reward="3{61000001:1:1;61000002:1:1;61000003:1:1;61000004:1:1;61000005:1:1;61000006:1:1;61000007:1:1;61000008:1:1;61000001:2:1;61000002:2:1;61000003:2:1;61000004:2:1;61000005:2:1;61000006:2:1;61000007:2:1;61000008:2:1;61000001:3:1;61000002:3:1;61000003:3:1;61000004:3:1;61000005:3:1;61000006:3:1;61000007:3:1;61000008:3:1;62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;}1{52101000:1:1;52111000:1:1;52121000:1:1;52131000:1:1;52201000:1:1;52211000:1:1;52221000:1:1;52301000:1:1;52311000:1:1;52321000:1:1;52401000:1:1;52411000:1:1;53101000:1:1;53111000:1:1;53121000:1:1;53131000:1:1;53201000:1:1;53211000:1:1;53221000:1:1;53301000:1:1;53311000:1:1;53321000:1:1;53401000:1:1;53411000:1:1;52231000:1:1;53231000:1:1;52431000:1:1;53431000:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[150] = {ID=150,Number=51,Monster="305101;305102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[151] = {ID=151,Number=52,Monster="305201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[152] = {ID=152,Number=53,Monster="305301;305302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[153] = {ID=153,Number=54,Monster="305401;305402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[154] = {ID=154,Number=55,Monster="305501;305502;305505;",Reward="4{61000001:1:1;61000002:1:1;61000003:1:1;61000004:1:1;61000005:1:1;61000006:1:1;61000007:1:1;61000008:1:1;61000001:2:1;61000002:2:1;61000003:2:1;61000004:2:1;61000005:2:1;61000006:2:1;61000007:2:1;61000008:2:1;61000001:3:1;61000002:3:1;61000003:3:1;61000004:3:1;61000005:3:1;61000006:3:1;61000007:3:1;61000008:3:1;62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[155] = {ID=155,Number=56,Monster="305601;305602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[156] = {ID=156,Number=57,Monster="305701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[157] = {ID=157,Number=58,Monster="305801;305802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[158] = {ID=158,Number=59,Monster="305901;305902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[159] = {ID=159,Number=60,Monster="306001;306002;306005;",Reward="3{61000001:1:1;61000002:1:1;61000003:1:1;61000004:1:1;61000005:1:1;61000006:1:1;61000007:1:1;61000008:1:1;61000001:2:1;61000002:2:1;61000003:2:1;61000004:2:1;61000005:2:1;61000006:2:1;61000007:2:1;61000008:2:1;61000001:3:1;61000002:3:1;61000003:3:1;61000004:3:1;61000005:3:1;61000006:3:1;61000007:3:1;61000008:3:1;62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;}1{52101000:1:1;52111000:1:1;52121000:1:1;52131000:1:1;52201000:1:1;52211000:1:1;52221000:1:1;52301000:1:1;52311000:1:1;52321000:1:1;52401000:1:1;52411000:1:1;53101000:1:1;53111000:1:1;53121000:1:1;53131000:1:1;53201000:1:1;53211000:1:1;53221000:1:1;53301000:1:1;53311000:1:1;53321000:1:1;53401000:1:1;53411000:1:1;52231000:1:1;53231000:1:1;52431000:1:1;53431000:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[160] = {ID=160,Number=61,Monster="306101;306102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[161] = {ID=161,Number=62,Monster="306201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[162] = {ID=162,Number=63,Monster="306301;306302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[163] = {ID=163,Number=64,Monster="306401;306402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[164] = {ID=164,Number=65,Monster="306501;306502;306505;",Reward="4{61000001:1:1;61000002:1:1;61000003:1:1;61000004:1:1;61000005:1:1;61000006:1:1;61000007:1:1;61000008:1:1;61000001:2:1;61000002:2:1;61000003:2:1;61000004:2:1;61000005:2:1;61000006:2:1;61000007:2:1;61000008:2:1;61000001:3:1;61000002:3:1;61000003:3:1;61000004:3:1;61000005:3:1;61000006:3:1;61000007:3:1;61000008:3:1;62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[165] = {ID=165,Number=66,Monster="306601;306602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[166] = {ID=166,Number=67,Monster="306701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[167] = {ID=167,Number=68,Monster="306801;306802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[168] = {ID=168,Number=69,Monster="306901;306902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[169] = {ID=169,Number=70,Monster="307001;307002;307005;",Reward="3{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}1{53101000:1:1;53111000:1:1;53121000:1:1;53131000:1:1;53201000:1:1;53211000:1:1;53221000:1:1;53301000:1:1;53311000:1:1;53321000:1:1;53401000:1:1;53411000:1:1;54101000:1:1;54111000:1:1;54121000:1:1;54131000:1:1;54201000:1:1;54211000:1:1;54221000:1:1;54301000:1:1;54311000:1:1;54321000:1:1;54401000:1:1;54411000:1:1;53231000:1:1;54231000:1:1;53431000:1:1;54431000:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[170] = {ID=170,Number=71,Monster="307101;307102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[171] = {ID=171,Number=72,Monster="307201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[172] = {ID=172,Number=73,Monster="307301;307302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[173] = {ID=173,Number=74,Monster="307401;307402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[174] = {ID=174,Number=75,Monster="307501;307502;307505;",Reward="4{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[175] = {ID=175,Number=76,Monster="307601;307602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[176] = {ID=176,Number=77,Monster="307701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[177] = {ID=177,Number=78,Monster="307801;307802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[178] = {ID=178,Number=79,Monster="307901;307902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[179] = {ID=179,Number=80,Monster="308001;308002;308005;",Reward="3{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}1{53101000:1:1;53111000:1:1;53121000:1:1;53131000:1:1;53201000:1:1;53211000:1:1;53221000:1:1;53301000:1:1;53311000:1:1;53321000:1:1;53401000:1:1;53411000:1:1;54101000:1:1;54111000:1:1;54121000:1:1;54131000:1:1;54201000:1:1;54211000:1:1;54221000:1:1;54301000:1:1;54311000:1:1;54321000:1:1;54401000:1:1;54411000:1:1;53231000:1:1;54231000:1:1;53431000:1:1;54431000:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[180] = {ID=180,Number=81,Monster="308101;308102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[181] = {ID=181,Number=82,Monster="308201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[182] = {ID=182,Number=83,Monster="308301;308302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[183] = {ID=183,Number=84,Monster="308401;308402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[184] = {ID=184,Number=85,Monster="308501;308502;308505;",Reward="4{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[185] = {ID=185,Number=86,Monster="308601;308602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[186] = {ID=186,Number=87,Monster="308701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[187] = {ID=187,Number=88,Monster="308801;308802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[188] = {ID=188,Number=89,Monster="308901;308902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[189] = {ID=189,Number=90,Monster="309001;309002;309005;",Reward="3{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}1{54101000:1:1;54111000:1:1;54121000:1:1;54131000:1:1;54201000:1:1;54211000:1:1;54221000:1:1;54301000:1:1;54311000:1:1;54321000:1:1;54401000:1:1;54411000:1:1;55101000:1:1;55111000:1:1;55121000:1:1;55131000:1:1;55201000:1:1;55211000:1:1;55221000:1:1;55301000:1:1;55311000:1:1;55321000:1:1;55401000:1:1;55411000:1:1;54231000:1:1;55231000:1:1;54431000:1:1;55431000:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[190] = {ID=190,Number=91,Monster="309101;309102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[191] = {ID=191,Number=92,Monster="309201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[192] = {ID=192,Number=93,Monster="309301;309302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[193] = {ID=193,Number=94,Monster="309401;309402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[194] = {ID=194,Number=95,Monster="309501;309502;309505;",Reward="4{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[195] = {ID=195,Number=96,Monster="309601;309602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[196] = {ID=196,Number=97,Monster="309701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[197] = {ID=197,Number=98,Monster="309801;309802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[198] = {ID=198,Number=99,Monster="309901;309902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[199] = {ID=199,Number=100,Monster="310001;310002;310005;",Reward="3{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}1{54101000:1:1;54111000:1:1;54121000:1:1;54131000:1:1;54201000:1:1;54211000:1:1;54221000:1:1;54301000:1:1;54311000:1:1;54321000:1:1;54401000:1:1;54411000:1:1;55101000:1:1;55111000:1:1;55121000:1:1;55131000:1:1;55201000:1:1;55211000:1:1;55221000:1:1;55301000:1:1;55311000:1:1;55321000:1:1;55401000:1:1;55411000:1:1;54231000:1:1;55231000:1:1;54431000:1:1;55431000:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[200] = {ID=200,Number=101,Monster="310101;310102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[201] = {ID=201,Number=102,Monster="310201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[202] = {ID=202,Number=103,Monster="310301;310302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[203] = {ID=203,Number=104,Monster="310401;310402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[204] = {ID=204,Number=105,Monster="310501;310502;310505;",Reward="4{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[205] = {ID=205,Number=106,Monster="310601;310602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[206] = {ID=206,Number=107,Monster="310701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[207] = {ID=207,Number=108,Monster="310801;310802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[208] = {ID=208,Number=109,Monster="310901;310902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[209] = {ID=209,Number=110,Monster="311001;311002;311005;",Reward="3{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}1{55101000:1:1;55111000:1:1;55121000:1:1;55131000:1:1;55201000:1:1;55211000:1:1;55221000:1:1;55301000:1:1;55311000:1:1;55321000:1:1;55401000:1:1;55411000:1:1;56101000:1:1;56111000:1:1;56121000:1:1;56131000:1:1;56201000:1:1;56211000:1:1;56221000:1:1;56301000:1:1;56311000:1:1;56321000:1:1;56401000:1:1;56411000:1:1;54231000:1:1;55231000:1:1;54431000:1:1;55431000:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[210] = {ID=210,Number=111,Monster="311101;311102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[211] = {ID=211,Number=112,Monster="311201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[212] = {ID=212,Number=113,Monster="311301;311302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[213] = {ID=213,Number=114,Monster="311401;311402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[214] = {ID=214,Number=115,Monster="311501;311502;311505;",Reward="4{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[215] = {ID=215,Number=116,Monster="311601;311602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[216] = {ID=216,Number=117,Monster="311701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[217] = {ID=217,Number=118,Monster="311801;311802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[218] = {ID=218,Number=119,Monster="311901;311902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[219] = {ID=219,Number=120,Monster="312001;312002;312005;",Reward="3{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}1{55101000:1:1;55111000:1:1;55121000:1:1;55131000:1:1;55201000:1:1;55211000:1:1;55221000:1:1;55301000:1:1;55311000:1:1;55321000:1:1;55401000:1:1;55411000:1:1;56101000:1:1;56111000:1:1;56121000:1:1;56131000:1:1;56201000:1:1;56211000:1:1;56221000:1:1;56301000:1:1;56311000:1:1;56321000:1:1;56401000:1:1;56411000:1:1;55231000:1:1;56231000:1:1;55431000:1:1;56431000:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[220] = {ID=220,Number=121,Monster="312101;312102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[221] = {ID=221,Number=122,Monster="312201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[222] = {ID=222,Number=123,Monster="312301;312302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[223] = {ID=223,Number=124,Monster="312401;312402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[224] = {ID=224,Number=125,Monster="312501;312502;312505;",Reward="4{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[225] = {ID=225,Number=126,Monster="312601;312602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[226] = {ID=226,Number=127,Monster="312701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[227] = {ID=227,Number=128,Monster="312801;312802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[228] = {ID=228,Number=129,Monster="312901;312902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[229] = {ID=229,Number=130,Monster="313001;313002;313005;",Reward="4{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[230] = {ID=230,Number=131,Monster="313101;313102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[231] = {ID=231,Number=132,Monster="313201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[232] = {ID=232,Number=133,Monster="313301;313302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[233] = {ID=233,Number=134,Monster="313401;313402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[234] = {ID=234,Number=135,Monster="313501;313502;313505;",Reward="4{62000001:1:1;62000002:1:1;62000003:1:1;62000004:1:1;62000005:1:1;62000006:1:1;62000007:1:1;62000008:1:1;62000009:1:1;62000010:1:1;62000001:2:1;62000002:2:1;62000003:2:1;62000004:2:1;62000005:2:1;62000006:2:1;62000007:2:1;62000008:2:1;62000009:2:1;62000010:2:1;64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[235] = {ID=235,Number=136,Monster="313601;313602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[236] = {ID=236,Number=137,Monster="313701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[237] = {ID=237,Number=138,Monster="313801;313802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[238] = {ID=238,Number=139,Monster="313901;313902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[239] = {ID=239,Number=140,Monster="314001;314002;314005;",Reward="4{64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;64000001:2:1;64000002:2:1;64000003:2:1;64000004:2:1;64000005:2:1;64000006:2:1;64000007:2:1;64000008:2:1;64000009:2:1;64000010:2:1;64000011:2:1;64000012:2:1;65000001:1:1;65000002:1:1;65000003:1:1;65000004:1:1;65000005:1:1;65000006:1:1;65000007:1:1;65000008:1:1;65000009:1:1;65000010:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[240] = {ID=240,Number=141,Monster="314101;314102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[241] = {ID=241,Number=142,Monster="314201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[242] = {ID=242,Number=143,Monster="314301;314302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[243] = {ID=243,Number=144,Monster="314401;314402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[244] = {ID=244,Number=145,Monster="314501;314502;314505;",Reward="4{64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;64000001:2:1;64000002:2:1;64000003:2:1;64000004:2:1;64000005:2:1;64000006:2:1;64000007:2:1;64000008:2:1;64000009:2:1;64000010:2:1;64000011:2:1;64000012:2:1;65000001:1:1;65000002:1:1;65000003:1:1;65000004:1:1;65000005:1:1;65000006:1:1;65000007:1:1;65000008:1:1;65000009:1:1;65000010:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[245] = {ID=245,Number=146,Monster="314601;314602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[246] = {ID=246,Number=147,Monster="314701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[247] = {ID=247,Number=148,Monster="314801;314802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[248] = {ID=248,Number=149,Monster="314901;314902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[249] = {ID=249,Number=150,Monster="315001;315002;315005;",Reward="4{64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;64000001:2:1;64000002:2:1;64000003:2:1;64000004:2:1;64000005:2:1;64000006:2:1;64000007:2:1;64000008:2:1;64000009:2:1;64000010:2:1;64000011:2:1;64000012:2:1;65000001:1:1;65000002:1:1;65000003:1:1;65000004:1:1;65000005:1:1;65000006:1:1;65000007:1:1;65000008:1:1;65000009:1:1;65000010:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[250] = {ID=250,Number=151,Monster="315101;315102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[251] = {ID=251,Number=152,Monster="315201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[252] = {ID=252,Number=153,Monster="315301;315302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[253] = {ID=253,Number=154,Monster="315401;315402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[254] = {ID=254,Number=155,Monster="315501;315502;315505;",Reward="4{64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;64000001:2:1;64000002:2:1;64000003:2:1;64000004:2:1;64000005:2:1;64000006:2:1;64000007:2:1;64000008:2:1;64000009:2:1;64000010:2:1;64000011:2:1;64000012:2:1;65000001:1:1;65000002:1:1;65000003:1:1;65000004:1:1;65000005:1:1;65000006:1:1;65000007:1:1;65000008:1:1;65000009:1:1;65000010:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[255] = {ID=255,Number=156,Monster="315601;315602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[256] = {ID=256,Number=157,Monster="315701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[257] = {ID=257,Number=158,Monster="315801;315802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[258] = {ID=258,Number=159,Monster="315901;315902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[259] = {ID=259,Number=160,Monster="316001;316002;316005;",Reward="4{64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;64000001:2:1;64000002:2:1;64000003:2:1;64000004:2:1;64000005:2:1;64000006:2:1;64000007:2:1;64000008:2:1;64000009:2:1;64000010:2:1;64000011:2:1;64000012:2:1;65000001:1:1;65000002:1:1;65000003:1:1;65000004:1:1;65000005:1:1;65000006:1:1;65000007:1:1;65000008:1:1;65000009:1:1;65000010:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[260] = {ID=260,Number=161,Monster="316101;316102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[261] = {ID=261,Number=162,Monster="316201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[262] = {ID=262,Number=163,Monster="316301;316302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[263] = {ID=263,Number=164,Monster="316401;316402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[264] = {ID=264,Number=165,Monster="316501;316502;316505;",Reward="4{64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;64000001:2:1;64000002:2:1;64000003:2:1;64000004:2:1;64000005:2:1;64000006:2:1;64000007:2:1;64000008:2:1;64000009:2:1;64000010:2:1;64000011:2:1;64000012:2:1;65000001:1:1;65000002:1:1;65000003:1:1;65000004:1:1;65000005:1:1;65000006:1:1;65000007:1:1;65000008:1:1;65000009:1:1;65000010:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[265] = {ID=265,Number=166,Monster="316601;316602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[266] = {ID=266,Number=167,Monster="316701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[267] = {ID=267,Number=168,Monster="316801;316802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[268] = {ID=268,Number=169,Monster="316901;316902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[269] = {ID=269,Number=170,Monster="317001;317002;317005;",Reward="4{64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;64000001:2:1;64000002:2:1;64000003:2:1;64000004:2:1;64000005:2:1;64000006:2:1;64000007:2:1;64000008:2:1;64000009:2:1;64000010:2:1;64000011:2:1;64000012:2:1;65000001:1:1;65000002:1:1;65000003:1:1;65000004:1:1;65000005:1:1;65000006:1:1;65000007:1:1;65000008:1:1;65000009:1:1;65000010:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[270] = {ID=270,Number=171,Monster="317101;317102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[271] = {ID=271,Number=172,Monster="317201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[272] = {ID=272,Number=173,Monster="317301;317302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[273] = {ID=273,Number=174,Monster="317401;317402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[274] = {ID=274,Number=175,Monster="317501;317502;317505;",Reward="4{64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;64000001:2:1;64000002:2:1;64000003:2:1;64000004:2:1;64000005:2:1;64000006:2:1;64000007:2:1;64000008:2:1;64000009:2:1;64000010:2:1;64000011:2:1;64000012:2:1;65000001:1:1;65000002:1:1;65000003:1:1;65000004:1:1;65000005:1:1;65000006:1:1;65000007:1:1;65000008:1:1;65000009:1:1;65000010:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[275] = {ID=275,Number=176,Monster="317601;317602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[276] = {ID=276,Number=177,Monster="317701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[277] = {ID=277,Number=178,Monster="317801;317802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[278] = {ID=278,Number=179,Monster="317901;317902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[279] = {ID=279,Number=180,Monster="318001;318002;318005;",Reward="4{64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;64000001:2:1;64000002:2:1;64000003:2:1;64000004:2:1;64000005:2:1;64000006:2:1;64000007:2:1;64000008:2:1;64000009:2:1;64000010:2:1;64000011:2:1;64000012:2:1;65000001:1:1;65000002:1:1;65000003:1:1;65000004:1:1;65000005:1:1;65000006:1:1;65000007:1:1;65000008:1:1;65000009:1:1;65000010:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[280] = {ID=280,Number=181,Monster="318101;318102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[281] = {ID=281,Number=182,Monster="318201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[282] = {ID=282,Number=183,Monster="318301;318302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[283] = {ID=283,Number=184,Monster="318401;318402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[284] = {ID=284,Number=185,Monster="318501;318502;318505;",Reward="4{64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;64000001:2:1;64000002:2:1;64000003:2:1;64000004:2:1;64000005:2:1;64000006:2:1;64000007:2:1;64000008:2:1;64000009:2:1;64000010:2:1;64000011:2:1;64000012:2:1;65000001:1:1;65000002:1:1;65000003:1:1;65000004:1:1;65000005:1:1;65000006:1:1;65000007:1:1;65000008:1:1;65000009:1:1;65000010:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[285] = {ID=285,Number=186,Monster="318601;318602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[286] = {ID=286,Number=187,Monster="318701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[287] = {ID=287,Number=188,Monster="318801;318802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[288] = {ID=288,Number=189,Monster="318901;318902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[289] = {ID=289,Number=190,Monster="319001;319002;319005;",Reward="4{64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;64000001:2:1;64000002:2:1;64000003:2:1;64000004:2:1;64000005:2:1;64000006:2:1;64000007:2:1;64000008:2:1;64000009:2:1;64000010:2:1;64000011:2:1;64000012:2:1;65000001:1:1;65000002:1:1;65000003:1:1;65000004:1:1;65000005:1:1;65000006:1:1;65000007:1:1;65000008:1:1;65000009:1:1;65000010:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[290] = {ID=290,Number=191,Monster="319101;319102;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[291] = {ID=291,Number=192,Monster="319201;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[292] = {ID=292,Number=193,Monster="319301;319302;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[293] = {ID=293,Number=194,Monster="319401;319402;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[294] = {ID=294,Number=195,Monster="319501;319502;319505;",Reward="4{64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;64000001:2:1;64000002:2:1;64000003:2:1;64000004:2:1;64000005:2:1;64000006:2:1;64000007:2:1;64000008:2:1;64000009:2:1;64000010:2:1;64000011:2:1;64000012:2:1;65000001:1:1;65000002:1:1;65000003:1:1;65000004:1:1;65000005:1:1;65000006:1:1;65000007:1:1;65000008:1:1;65000009:1:1;65000010:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[295] = {ID=295,Number=196,Monster="319601;319602;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[296] = {ID=296,Number=197,Monster="319701;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[297] = {ID=297,Number=198,Monster="319801;319802;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[298] = {ID=298,Number=199,Monster="319901;319902;",Reward="",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
[299] = {ID=299,Number=200,Monster="320001;320002;320005;",Reward="4{64000001:1:1;64000002:1:1;64000003:1:1;64000004:1:1;64000005:1:1;64000006:1:1;64000007:1:1;64000008:1:1;64000009:1:1;64000010:1:1;64000011:1:1;64000012:1:1;64000001:2:1;64000002:2:1;64000003:2:1;64000004:2:1;64000005:2:1;64000006:2:1;64000007:2:1;64000008:2:1;64000009:2:1;64000010:2:1;64000011:2:1;64000012:2:1;65000001:1:1;65000002:1:1;65000003:1:1;65000004:1:1;65000005:1:1;65000006:1:1;65000007:1:1;65000008:1:1;65000009:1:1;65000010:1:1;}",Money=100,BUFF=0,Trap=0,Map=0,Quantity=5},
}
return endlesstower
|
local att = {}
att.name = "md_cz52silver"
att.displayName = "Silver and Black"
att.displayNameShort = "Silver"
att.isBG = true
att.statModifiers = {}
if CLIENT then
att.displayIcon = surface.GetTextureID("atts/md_cz52silver")
end
function att:attachFunc()
if SERVER then
return
end
if self.CW_VM then
self.CW_VM:SetSkin(1)
end
if self.WMEnt then
self.WMEnt:SetSkin(1)
end
end
function att:detachFunc()
if SERVER then
return
end
if self.CW_VM then
self.CW_VM:SetSkin(0)
end
if self.WMEnt then
self.WMEnt:SetSkin(0)
end
end
CustomizableWeaponry:registerAttachment(att) |
require('utils')
local image = require("../image")
local item = require("../item")
return {
name = "Meet a cat",
amount = 5,
weight = 0.1,
condition = function (state)
return not (table.contains(state.items, item.cat)) and state.coins >= 5
end,
description = "How cute, a furry little brown cat is purring in front of you.",
heads = {
effectDescription = "+10 coin",
effect = function (state)
state.coins = state.coins + 10
return {
description = "It looks like the cat has a collar. You return the cat to its owner and get $10 in compensation. Yay!",
image = image.houseCat
}
end
},
tails = {
effectDescription = "Get a cat",
effect = function (state)
table.insert(state.items, item.cat)
return {
description = "You bend down and massage the cat under its chin. The cat leaps into your arms.",
image = image.feralCat
}
end
},
beg = {
effectDescription = "-3 hp",
effect = function (state)
state.hp = state.hp - 3
return {
description = "As you bend down to touch the cat, it hisses at you scratches you for 3 hp. OWWW!!!",
image = image.angryCat
}
end
}
}
|
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- file: gui_highlight_unit.lua
-- brief: highlights the unit/feature under the cursor
-- author: Dave Rodgers
--
-- Copyright (C) 2007.
-- Licensed under the terms of the GNU GPL, v2 or later.
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function widget:GetInfo()
local grey = "\255\192\192\192"
local yellow = "\255\255\255\128"
return {
name = "HighlightUnit",
desc = "Highlights the unit or feature under the cursor\n"..
grey.."Hold "..yellow.."META"..grey..
" to show the unit or feature name",
author = "trepan",
date = "Apr 16, 2007",
license = "GNU GPL, v2 or later",
layer = 5,
enabled = false -- loaded by default?
}
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Automatically generated local definitions
local GL_BACK = GL.BACK
local GL_EYE_LINEAR = GL.EYE_LINEAR
local GL_EYE_PLANE = GL.EYE_PLANE
local GL_FILL = GL.FILL
local GL_FRONT = GL.FRONT
local GL_FRONT_AND_BACK = GL.FRONT_AND_BACK
local GL_INVERT = GL.INVERT
local GL_LINE = GL.LINE
local GL_ONE = GL.ONE
local GL_ONE_MINUS_SRC_ALPHA = GL.ONE_MINUS_SRC_ALPHA
local GL_POINT = GL.POINT
local GL_QUAD_STRIP = GL.QUAD_STRIP
local GL_SRC_ALPHA = GL.SRC_ALPHA
local GL_T = GL.T
local GL_TEXTURE_GEN_MODE = GL.TEXTURE_GEN_MODE
local GL_TRIANGLE_FAN = GL.TRIANGLE_FAN
local glBeginEnd = gl.BeginEnd
local glBlending = gl.Blending
local glCallList = gl.CallList
local glColor = gl.Color
local glCreateList = gl.CreateList
local glCulling = gl.Culling
local glDeleteList = gl.DeleteList
local glDeleteTexture = gl.DeleteTexture
local glDepthTest = gl.DepthTest
local glFeature = gl.Feature
local glGetTextWidth = gl.GetTextWidth
local glLineWidth = gl.LineWidth
local glLogicOp = gl.LogicOp
local glPointSize = gl.PointSize
local glPolygonMode = gl.PolygonMode
local glPolygonOffset = gl.PolygonOffset
local glPopMatrix = gl.PopMatrix
local glPushMatrix = gl.PushMatrix
local glScale = gl.Scale
local glTexCoord = gl.TexCoord
local glTexGen = gl.TexGen
local glText = gl.Text
local glTexture = gl.Texture
local glTranslate = gl.Translate
local glUnit = gl.Unit
local glVertex = gl.Vertex
local spDrawUnitCommands = Spring.DrawUnitCommands
local spGetFeatureAllyTeam = Spring.GetFeatureAllyTeam
local spGetFeatureDefID = Spring.GetFeatureDefID
local spGetFeaturePosition = Spring.GetFeaturePosition
local spGetFeatureRadius = Spring.GetFeatureRadius
local spGetFeatureTeam = Spring.GetFeatureTeam
local spGetModKeyState = Spring.GetModKeyState
local spGetMouseState = Spring.GetMouseState
local spGetMyAllyTeamID = Spring.GetMyAllyTeamID
local spGetMyPlayerID = Spring.GetMyPlayerID
local spGetMyTeamID = Spring.GetMyTeamID
local spGetPlayerControlledUnit = Spring.GetPlayerControlledUnit
local spGetPlayerInfo = Spring.GetPlayerInfo
local spGetTeamColor = Spring.GetTeamColor
local spGetTeamInfo = Spring.GetTeamInfo
local spGetUnitAllyTeam = Spring.GetUnitAllyTeam
local spGetUnitDefID = Spring.GetUnitDefID
local spGetUnitIsCloaked = Spring.GetUnitIsCloaked
local spGetUnitTeam = Spring.GetUnitTeam
local spIsCheatingEnabled = Spring.IsCheatingEnabled
local spTraceScreenRay = Spring.TraceScreenRay
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
include("colors.h.lua")
include("fonts.lua")
local font = 'FreeMonoBold'
local fontSize = 16
local fontName = ':n:'..LUAUI_DIRNAME..'Fonts/'..font..'_'..fontSize
local showName = (1 > 0)
local customTex = LUAUI_DIRNAME .. 'Images/highlight_strip.png'
local texName = LUAUI_DIRNAME .. 'Images/highlight_strip.png'
--local texName = 'bitmaps/laserfalloff.tga'
local cylDivs = 64
local cylList = 0
local outlineWidth = 3
local vsx, vsy = widgetHandler:GetViewSizes()
function widget:ViewResize(viewSizeX, viewSizeY)
vsx = viewSizeX
vsy = viewSizeY
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function widget:Initialize()
cylList = glCreateList(DrawCylinder, cylDivs)
end
function widget:Shutdown()
glDeleteList(cylList)
glDeleteTexture(customTex)
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function DrawCylinder(divs)
local cos = math.cos
local sin = math.sin
local divRads = (2.0 * math.pi) / divs
-- top
glBeginEnd(GL_TRIANGLE_FAN, function()
for i = 1, divs do
local a = i * divRads
glVertex(sin(a), 1.0, cos(a))
end
end)
-- bottom
glBeginEnd(GL_TRIANGLE_FAN, function()
for i = 1, divs do
local a = -i * divRads
glVertex(sin(a), -1.0, cos(a))
end
end)
-- sides
glBeginEnd(GL_QUAD_STRIP, function()
for i = 0, divs do
local a = i * divRads
glVertex(sin(a), 1.0, cos(a))
glVertex(sin(a), -1.0, cos(a))
end
end)
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local function HilightModel(drawFunc, drawData, outline)
glDepthTest(true)
glPolygonOffset(-2, -2)
glBlending(GL_SRC_ALPHA, GL_ONE)
local scale = 20
local shift = (2 * widgetHandler:GetHourTimer()) % scale
glTexCoord(0, 0)
glTexGen(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)
glTexGen(GL_T, GL_EYE_PLANE, 0, (1 / scale), 0, shift)
glTexture(texName)
drawFunc(drawData)
glTexture(false)
glTexGen(GL_T, false)
-- more edge highlighting
if (outline) then
glLineWidth(outlineWidth)
glPointSize(outlineWidth)
glPolygonOffset(10, 100)
glPolygonMode(GL_FRONT_AND_BACK, GL_POINT)
drawFunc(drawData)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
drawFunc(drawData)
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
glPointSize(1)
glLineWidth(1)
end
glBlending(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glPolygonOffset(false)
glDepthTest(false)
end
--------------------------------------------------------------------------------
local function SetUnitColor(unitID, alpha)
local teamID = spGetUnitTeam(unitID)
if (teamID == nil) then
glColor(1.0, 0.0, 0.0, alpha) -- red
elseif (teamID == spGetMyTeamID()) then
glColor(0.0, 1.0, 1.0, alpha) -- cyan
elseif (spGetUnitAllyTeam(unitID) == spGetMyAllyTeamID()) then
glColor(0.0, 1.0, 0.0, alpha) -- green
else
glColor(1.0, 0.0, 0.0, alpha) -- red
end
end
local function SetFeatureColor(featureID, alpha)
glColor(1.0, 0.0, 1.0, alpha) -- purple
do return end -- FIXME -- wait for feature team/allyteam resolution
local allyTeamID = spGetFeatureAllyTeam(featureID)
if ((allyTeamID == nil) or (allyTeamID < 0)) then
glColor(1.0, 1.0, 1.0, alpha) -- white
elseif (allyTeamID == spGetMyAllyTeamID()) then
glColor(0.0, 1.0, 1.0, alpha) -- cyan
else
glColor(1.0, 0.0, 0.0, alpha) -- red
end
end
local function UnitDrawFunc(unitID)
glUnit(unitID, true)
end
local function FeatureDrawFunc(featureID)
glFeature(featureID, true)
end
local function HilightUnit(unitID)
local outline = (spGetUnitIsCloaked(unitID) ~= true)
SetUnitColor(unitID, outline and 0.5 or 0.25)
HilightModel(UnitDrawFunc, unitID, outline)
end
local function HilightFeatureModel(featureID)
SetFeatureColor(featureID, 0.5)
HilightModel(FeatureDrawFunc, featureID, true)
end
local function HilightFeature(featureID)
local fDefID = spGetFeatureDefID(featureID)
local fd = FeatureDefs[fDefID]
if (fd == nil) then return end
if (fd.drawType == 0) then
HilightFeatureModel(featureID)
return
end
local radius = spGetFeatureRadius(featureID)
if (radius == nil) then
return
end
local px, py, pz = spGetFeaturePosition(featureID)
if (px == nil) then return end
local yScale = 4
glPushMatrix()
glTranslate(px, py, pz)
glScale(radius, yScale * radius, radius)
-- FIXME: needs an 'inside' check
glDepthTest(true)
glLogicOp(GL_INVERT)
glCulling(GL_FRONT)
glCallList(cylList)
glCulling(GL_BACK)
glCallList(cylList)
glLogicOp(false)
glCulling(false)
glDepthTest(false)
glPopMatrix()
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local GetPlayerControlledUnit = spGetPlayerControlledUnit
local GetMyPlayerID = spGetMyPlayerID
local TraceScreenRay = spTraceScreenRay
local GetMouseState = spGetMouseState
local GetUnitDefID = spGetUnitDefID
local GetFeatureDefID = spGetFeatureDefID
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local type, data -- for the TraceScreenRay() call
function widget:Update()
local mx, my = GetMouseState()
type, data = TraceScreenRay(mx, my)
end
function widget:DrawWorld()
if (type == 'feature') then
HilightFeature(data)
elseif (type == 'unit') then
local unitID = GetPlayerControlledUnit(GetMyPlayerID())
if (data ~= unitID) then
HilightUnit(data)
-- also draw the unit's command queue
local a,c,m,s = spGetModKeyState()
if (m) then
spDrawUnitCommands(data)
end
end
end
end
widget.DrawWorldReflection = widget.DrawWorld
widget.DrawWorldRefraction = widget.DrawWorld
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local teamNames = {}
local function GetTeamName(teamID)
local name = teamNames[teamID]
if (name) then
return name
end
local teamNum, teamLeader = spGetTeamInfo(teamID)
if (teamLeader == nil) then
return ''
end
name = spGetPlayerInfo(teamLeader)
teamNames[teamID] = name
return name
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
local teamColorStrs = {}
local function GetTeamColorStr(teamID)
local colorSet = teamColorStrs[teamID]
if (colorSet) then
return colorSet[1], colorSet[2]
end
local outlineChar = ''
local r,g,b = spGetTeamColor(teamID)
if (r and g and b) then
local function ColorChar(x)
local c = math.floor(x * 255)
c = ((c <= 1) and 1) or ((c >= 255) and 255) or c
return string.char(c)
end
local colorStr
colorStr = '\255'
colorStr = colorStr .. ColorChar(r)
colorStr = colorStr .. ColorChar(g)
colorStr = colorStr .. ColorChar(b)
local i = (r * 0.299) + (g * 0.587) + (b * 0.114)
outlineChar = ((i > 0.25) and 'o') or 'O'
teamColorStrs[teamID] = { colorStr, outlineChar }
return colorStr, outlineChar
end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function widget:DrawScreen()
local a,c,m,s = spGetModKeyState()
if (not m) then
return
end
local mx, my = GetMouseState()
local type, data = TraceScreenRay(mx, my)
local typeStr = ''
local teamID = nil
local cheat = spIsCheatingEnabled()
if (type == 'unit') then
local udid = GetUnitDefID(data)
if (udid == nil) then return end
local ud = UnitDefs[udid]
if (ud == nil) then return end
typeStr = YellowStr .. ud.humanName -- .. ' ' .. CyanStr .. ud.tooltip
if (cheat) then
typeStr = typeStr
.. ' \255\255\128\255(' .. ud.name
.. ') \255\255\255\255#' .. data
end
teamID = spGetUnitTeam(data)
elseif (type == 'feature') then
local fdid = GetFeatureDefID(data)
if (fdid == nil) then return end
local fd = FeatureDefs[fdid]
if (fd == nil) then return end
typeStr = '\255\255\128\255' .. fd.tooltip
if (cheat) then
typeStr = typeStr
.. ' \255\255\255\1(' .. fd.name
.. ') \255\255\255\255#' .. data
end
teamID = spGetFeatureTeam(data)
end
local pName = nil
local colorStr, outlineChar = nil, nil
if (teamID) then
pName = GetTeamName(teamID)
if (pName) then
colorStr, outlineChar = GetTeamColorStr(teamID)
if ((colorStr == nil) or (outlineChar == nil)) then
pName = nil
end
end
end
local fh = fontHandler
if (fh.UseFont(fontName)) then
local f = fh.GetFontSize() * 0.5
local gx = 12 -- gap x
local gy = 8 -- gap y
local lt = fh.GetTextWidth(typeStr)
local lp = pName and fh.GetTextWidth(pName) or 0
local lm = (lt > lp) and lt or lp -- max len
pName = pName and (colorStr .. pName)
if ((mx + lm + gx) < vsx) then
fh.Draw(typeStr, mx + gx, my + gy)
if (pName) then
fh.Draw(pName, mx + gx, my - gy - f)
end
else
fh.DrawRight(typeStr, mx - gx, my + gy)
if (pName) then
fh.DrawRight(pName, mx - gx, my - gy - f)
end
end
else
local f = 14
local gx = 16
local gy = 8
local lt = f * glGetTextWidth(typeStr)
local lp = pName and (f * glGetTextWidth(pName)) or 0
local lm = (lt > lp) and lt or lp -- max len
pName = pName and (colorStr .. pName)
if ((mx + lm + gx) < vsx) then
glText(typeStr, mx + gx, my + gy, f, 'o')
if (pName) then
glText(pName, mx + gx, my - gy - f, f, outlineChar)
end
else
glText(typeStr, mx - gx, my + gy, f, 'or')
if (pName) then
glText(pName, mx - gx, my - gy - f, f, outlineChar .. 'r')
end
end
end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
|
minetest.register_on_newplayer(function(player)
local pos = player:get_pos()
minetest.add_item(pos, "nodes:rail_straight 99")
minetest.add_item(pos, "nodes:rail_turn 99")
minetest.add_item(pos, "minecart:minecart 99")
end)
--potential: minecarts pushing minecarts, minecart trains, furnace minecart
local minecart = {
initial_properties = {
physical = true, -- otherwise going uphill breaks
collide_with_objects = true,
collisionbox = {-0.295, -1, -0.295, 0.295, 0.5, 0.295},
visual = "mesh",
mesh = "minecart.b3d",
visual_size = {x=1, y=1},
textures = {"minecart_ent.png"},
timer = 0,
speed = 0,
yaw = 0,
automatic_face_movement_dir = 90.0,
automatic_face_movement_max_rotation_per_sec = 10,
furnace = false,
axis = "z",
stepheight = 8/16, --1 pixel height to go up hill
},
}
function minecart:on_activate(staticdata, dtime_s)
if self.axis == nil then
self.axis = "z"
end
if self.timer == nil then
self.timer = 0
end
self.object:set_acceleration({x=0,y=-20,z=0})
if staticdata ~= "" and staticdata ~= nil then
local data = minetest.parse_json(staticdata) or {}
--restore old data
if data then
self.timer = data.timer
self.speed = data.speed
self.old_velocity = data.old_velocity
self.old_pos = data.old_pos
self.furnace = data.furnace
end
end
end
function minecart:on_step(dtime)
self.timer = self.timer + dtime
minecart:repel(self)
minecart:change_direction(self,dtime)
minecart:furnace_minecart(self)
minecart:friction(self)
local vel = self.object:get_velocity()
minecart:set_rotation(self)
minecart:set_axis(self) -- make sure this is last
self.old_velocity = vel
self.old_pos = self.object:get_pos()
end
function minecart:set_axis(self)
local vel = self.object:get_velocity()
if math.abs(vel.x) > math.abs(vel.z) then
self.axis = "x"
else
self.axis = "z"
end
end
--test out furnace minecart mechanics
function minecart:furnace_minecart(self)
if self.furnace == true then
local pos = self.object:get_pos()
minetest.add_particle({
pos = pos,
velocity = {x=0, y=math.random(2,4), z=0},
acceleration = {x=math.random(-1,1), y=math.random(2,4), z=math.random(-1,1)},
expirationtime = math.random(2,5),
size = math.random(1,3),
collisiondetection = false,
vertical = false,
texture = "puff.png",
})
local vel = self.object:get_velocity()
--limit the speed
local speed_limit = 2
if math.abs(vel.x) < speed_limit and math.abs(vel.z) < speed_limit then
self.object:add_velocity(vector.divide(vel,5))
end
end
end
--test out furnace minecart
function minecart:on_rightclick(clicker)
print(self.furnace)
if self.furnace == false or self.furnace == nil then
self.furnace = true
else
self.furnace = false
end
end
function minecart:set_rotation(self)
local pos = self.object:get_pos()
if self.old_pos then
self.object:set_yaw(minetest.dir_to_yaw(vector.direction(pos, self.old_pos)))
end
end
--slow down cart with friction
function minecart:friction(self)
local vel = self.object:get_velocity()
vel = vector.multiply(vel,-1)
vel = vector.divide(vel,100)
self.object:add_velocity({x=vel.x,y=-5,z=vel.z})
end
--push away from players
function minecart:repel(self)
local pos = self.object:get_pos()
local temp_pos = self.object:get_pos()
temp_pos.y = 0
--magnet effect
for _,object in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
--change wether powered or not
--basically if true, the minecart will only repel to players
if self.furnace == false or self.furnace == nil then
if object:is_player() or (object:get_luaentity() and object:get_luaentity().name == "minecart:minecart" and object ~= self.object) then
local pos2 = object:get_pos()
local vec = vector.subtract(pos, pos2)
--the closer in the more it repels
vec = vector.multiply(vec,(vector.distance(pos, pos2)))
--follow the current rail
local x = 0
local z = 0
if self.axis == "x" then
x = vec.x
elseif self.axis == "z" then
z = vec.z
end
self.object:add_velocity({x=x,y=-5,z=z})
end
elseif self.furnace == true then
if object:is_player() then
local pos2 = object:get_pos()
local vec = vector.subtract(pos, pos2)
--the closer in the more it repels
local multiplier = 2
vec = vector.multiply(vec,(vector.distance(pos, pos2)))
--follow the current rail
local x = 0
local z = 0
if self.axis == "x" then
x = vec.x
elseif self.axis == "z" then
z = vec.z
end
self.object:add_velocity({x=x,y=-5,z=z})
end
end
end
end
--turn corners on rails
function minecart:change_direction(self,dtime)
--a cooldown for turn spamming
if self.timer < 0 then
--print("test "..self.timer)
return
end
local vel = self.object:get_velocity()
local pos = self.object:get_pos()
pos.y = pos.y - 0.75
local old = self.old_velocity
--change direction on rail
if old then
--print("what")
if self.axis == "x" and math.floor(math.abs(vel.x)) == 0 then
--print("axis X repeat test")
--if (old.x > 0 and minetest.get_node({x=pos.x+0.52,y=pos.y,z=pos.z}).name == "air") or (old.x < 0 and minetest.get_node({x=pos.x-0.52,y=pos.y,z=pos.z}).name == "air") then
if minecart:testrail({x=pos.x,y=pos.y,z=pos.z+0.52}) ~= 0 then
self.object:add_velocity({x=0,y=-5,z=math.abs(old.x)})
self.timer = 0
elseif minecart:testrail({x=pos.x,y=pos.y,z=pos.z-0.52}) ~= 0 then
self.object:add_velocity({x=0,y=-5,z=math.abs(old.x)*-1})
self.timer = 0
end
--end
elseif self.axis == "z" and math.floor(math.abs(vel.z)) == 0 then
--print("axis Z repeat test")
if minecart:testrail({x=pos.x+0.52,y=pos.y,z=pos.z}) ~= 0 then
self.object:add_velocity({x=math.abs(old.z),y=-5,z=0})
self.timer = 0
elseif minecart:testrail({x=pos.x-0.52,y=pos.y,z=pos.z}) ~= 0 then
self.object:add_velocity({x=math.abs(old.z)*-1,y=-5,z=0})
self.timer = 0
end
end
end
self.old_axis = self.axis
end
--test if a node is rail
function minecart:testrail(pos)
return(minetest.get_item_group(minetest.get_node(pos).name, "rail"))
end
function minecart:on_punch(hitter)
local item = minetest.add_item(self.object:get_pos(), "minecart:minecart")
item:get_luaentity().age = collection_age - 0.35
self.object:remove()
end
function minecart:get_staticdata()
return minetest.write_json({
message = self.message,
timer = self.timer,
speed = self.speed,
old_velocity = self.old_velocity,
old_pos = self.old_pos,
furnace = self.furnace,
})
end
minetest.register_entity("minecart:minecart", minecart)
minetest.register_craftitem("minecart:minecart", {
description = "Minecart",
inventory_image = "minecart.png",
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above
pos.y = pos.y + 1
local test = minetest.add_entity(pos, "minecart:minecart")
itemstack:take_item(1)
return(itemstack)
end,
})
|
fx_version 'bodacious'
game 'gta5'
author 'Badland v3.0 - E&G Vendas'
contact 'Edu#6055 or https://github.com/badlandproject'
version '1.0.0'
ui_page 'nui/badland.html'
client_scripts {
'client-side/*.lua'
}
server_scripts {
'server.lua'
}
files {
'nui/badland.html',
'nui/badland.js',
'nui/badland.css'
}
dependency 'es_extended' |
-- Code by LucasL.#1024
-- coded for LifeV
Config, Locale = {}, {}
Config.locale = "de"
-- Command
Config.Cmd = "startdelvehicles"
-- ESX ja/nein
Config.ESX = true -- Set this to true if you use ESX
-- Wird nicht bei ESX benötigt, ESX greift auf die Gruppen zu (superadmin, admin etc.)
-- Admin Lists: steam: | license: | xbl: | live: | discord: | fivem: | ip:
Config.AdminList = {
'license:2ash123ad1337a15029a21a6s4e3622f91cde1d0', -- Example, change this
'discord:370910283901283929' -- Example, change this
}
-- Zeit nach Commandausgabe -> in Minuten Standard: 3
Config.DeleteVehicleTimer = 3
-- Autos in Safezones löschen?
Config.DeleteVehiclesInSafeZone = false
-- Automatische Löschzeiten nach Uhrzeit
Config.DeleteVehiclesAt = {
{['h'] = 19, ['m'] = 10},
{['h'] = 19, ['m'] = 20},
{['h'] = 19, ['m'] = 30},
}
-- z.B. Garage
Config.SafeZones = {
{ ['x'] = -44.155646565, ['y'] = -1100.155646565, ['z'] = 26.267009735108, ['radius'] = 50.0, ['color'] = 2, ['alpha'] = 0},
{ ['x'] = -1688.43811035156, ['y'] = -1073.62536621094, ['z'] = 13.1521873474121, ['radius'] = 200.0, ['color'] = 2, ['alpha'] = 0},
{ ['x'] = -2195.1352539063, ['y'] = 4288.7290039063, ['z'] = 49.173923492432, ['radius'] = 150.0, ['color'] = 2, ['alpha'] = 0 }
} |
SWEP.Base = "arccw_base"
SWEP.Spawnable = true -- this obviously has to be set to true
SWEP.Category = "ArcCW - Black Ops II" -- edit this if you like
SWEP.AdminOnly = false
SWEP.PrintName = "Saiga 12K"
SWEP.Trivia_Class = "Combat Shotgun"
SWEP.Trivia_Desc = "12 gauge semi automatic combat shotgun based on the AK platform. Unlike many self loading shotguns which run into feeding issues, the Saiga manages to be reliable due to the loser tolerances of the AK platform it was based on."
SWEP.Trivia_Manufacturer = "Lone Star Arms"
SWEP.Trivia_Calibre = "12x70mm"
SWEP.Trivia_Mechanism = "Semi-Automatic"
SWEP.Trivia_Country = "Russia"
SWEP.Trivia_Year = 1990
SWEP.CanBash = false
SWEP.Slot = 3
SWEP.UseHands = true
SWEP.ViewModel = "models/weapons/arccw/c_bo2_s12.mdl"
SWEP.MirrorVMWM = true
SWEP.WorldModelOffset = {
pos = Vector(-3.3, 4, -5.8),
ang = Angle(-7, 1, 180),
bone = "ValveBiped.Bip01_R_Hand",
scale = 1.1,
}
SWEP.WorldModel = "models/weapons/arccw/w_bo2_s12.mdl"
SWEP.MirrorWorldModel = "models/weapons/arccw/w_bo2_s12.mdl"
SWEP.ViewModelFOV = 60
SWEP.DefaultBodygroups = "000000000"
SWEP.Damage = 13
SWEP.DamageMin = 5
SWEP.Range = 50
SWEP.RangeMin = 5
SWEP.HullSize = 2
SWEP.BodyDamageMults = {[HITGROUP_HEAD] = 1,}
SWEP.Penetration = 1
SWEP.DamageType = DMG_BUCKSHOT
SWEP.ShootEntity = nil -- entity to fire, if any
SWEP.MuzzleVelocity = 1000 -- projectile or phys bullet muzzle velocity
-- IN M/S
SWEP.TracerNum = 1 -- tracer every X
SWEP.TracerCol = Color(255, 25, 25)
SWEP.TracerWidth = 3
SWEP.ChamberSize = 0 -- how many rounds can be chambered.
SWEP.Primary.ClipSize = 10 -- DefaultClip is automatically set.
SWEP.ExtendedClipSize = 20
SWEP.ReducedClipSize = 5
SWEP.Recoil = 3
SWEP.RecoilSide = 4
SWEP.MaxRecoilBlowback = 4
SWEP.Delay = 60 / 468 -- 60 / RPM.
SWEP.Num = 8 -- number of shots per trigger pull.
SWEP.RunawayBurst = false
SWEP.Firemodes = {
{
Printname = "SEMI-AUTO",
Mode = 1,
},
{
Mode = 0
}
}
SWEP.NPCWeaponType = "weapon_shotgun"
SWEP.NPCWeight = 100
SWEP.AccuracyMOA = 40 -- accuracy in Minutes of Angle. There are 60 MOA in a degree.
SWEP.HipDispersion = 650 -- inaccuracy added by hip firing.
SWEP.MoveDispersion = 200
SWEP.Primary.Ammo = "buckshot" -- what ammo type the gun uses
SWEP.ShootVol = 120 -- volume of shoot sound
SWEP.ShootPitch = 100 -- pitch of shoot sound
SWEP.ShootSound = "ArcCW_BO2.1216_Fire"
SWEP.ShootSoundSilenced = "ArcCW_BO2.S12_Sil"
SWEP.DistantShootSound = {"^weapons/arccw/bo2_generic_shotgun/dist/0.wav", "^weapons/arccw/bo2_generic_shotgun/dist/1.wav"}
SWEP.MuzzleEffect = "muzzleflash_shotgun"
SWEP.ShellModel = "models/shells/shell_12gauge.mdl"
SWEP.ShellPitch = 100
SWEP.ShellSounds = ArcCW.ShotgunShellSoundsTable
SWEP.ShellScale = 1.5
SWEP.MuzzleEffectAttachment = 1 -- which attachment to put the muzzle on
SWEP.CaseEffectAttachment = 2 -- which attachment to put the case effect on
SWEP.ProceduralViewBobAttachment = 1
SWEP.CamAttachment = 3
SWEP.SpeedMult = 0.95
SWEP.SightedSpeedMult = 0.75
SWEP.SightTime = 0.27
SWEP.BulletBones = { -- the bone that represents bullets in gun/mag
-- [0] = "bulletchamber",
-- [1] = "bullet1"
}
SWEP.CaseBones = {}
SWEP.IronSightStruct = {
Pos = Vector(-2.7, 0, 0.5),
Ang = Angle(00, 0, 0),
Magnification = 1.1,
CrosshairInSights = false,
SwitchToSound = "", -- sound that plays when switching to this sight
}
SWEP.HoldtypeHolstered = "passive"
SWEP.HoldtypeActive = "ar2"
SWEP.HoldtypeSights = "ar2"
SWEP.AnimShoot = ACT_HL2MP_GESTURE_RANGE_ATTACK_AR2
SWEP.ActivePos = Vector(1, 3, 0.25)
SWEP.ActiveAng = Angle(0, 0, 0)
SWEP.SprintPos = Vector(0, 3, 0)
SWEP.SprintAng = Angle(0, 0, 0)
SWEP.CustomizePos = Vector(17, 6.5, -2)
SWEP.CustomizeAng = Angle(15, 40, 20)
SWEP.HolsterPos = Vector(0.532, -6, 0)
SWEP.HolsterAng = Angle(-7.036, 30.016, 0)
SWEP.AttachmentElements = {
["spas12_pap"] = {
--VMMaterial = "models/weapons/pap/pap_blue_burn",
NamePriority = 10,
NameChange = "Synthetic Dozen",
},
["solider_stock"] = {
VMBodygroups = {
{ind = 3, bg = 3},
},
},
["solid_stock"] = {
VMBodygroups = {
{ind = 3, bg = 2},
},
},
["light_stock"] = {
VMBodygroups = {
{ind = 3, bg = 1},
}
},
["mount"] = {
VMBodygroups = {
{ind = 2, bg = 1},
},
},
["bo1_mag_fast"] = {
VMBodygroups = {
{ind = 1, bg = 1},
},
},
}
SWEP.ExtraSightDist = 5
SWEP.Attachments = {
{
PrintName = "Optic", -- print name
DefaultAttName = "Iron Sights",
Slot = {"optic"}, -- what kind of attachments can fit here, can be string or table
Bone = "tag_weapon", -- relevant bone any attachments will be mostly referring to
Offset = {
vpos = Vector(0, 0, 2.3), -- offset that the attachment will be relative to the bone
vang = Angle(0, 0, 0),
wpos = Vector(12.5, 1.3, -7),
wang = Angle(172.5, 180, 0)
},
CorrectivePos = Vector(0, 0, 0),
CorrectiveAng = Angle(0, 0, 0),
InstalledEles = {"mount"},
}, --1
{
PrintName = "Muzzle",
DefaultAttName = "Standard Muzzle",
Slot = "muzzle_shotgun",
Bone = "tag_weapon",
VMScale = Vector(1.5, 1.5, 1.5),
Offset = {
vpos = Vector(24, 0, 0.36), -- offset that the attachment will be relative to the bone
vang = Angle(0, 0, 0),
},
}, --2
{
PrintName = "Underbarrel",
Slot = "foregrip",
Bone = "tag_weapon",
Offset = {
vpos = Vector(8.5, 0, -1.25),
vang = Angle(0, 0, 0),
wpos = Vector(21.5, 0.75, -3.25),
wang = Angle(172.5, 0, 0)
},
SlideAmount = false
}, --3
{
PrintName = "Tactical",
Slot = {"bo1_tacprimary"},
Bone = "tag_weapon",
Offset = {
vpos = Vector(12.5, -1, 0.25), -- offset that the attachment will be relative to the bone
vang = Angle(0, 0, 90),
},
}, --4
{
PrintName = "Stock",
Slot = {"bo1_stock", "bo1_mp5stock"},
DefaultAttName = "No Stock",
}, --5
{
PrintName = "Magazine",
DefaultAttName = "Standard Magazine",
Slot = "bo1_mag",
}, --6
{ --6
PrintName = "Fire Group",
Slot = {"bo1_fcg","bo2_fcg_fullauto"}
},
{
PrintName = "Charm",
Slot = "charm",
FreeSlot = true,
Bone = "tag_weapon",
Offset = {
vpos = Vector(4, -0.65, 0), -- offset that the attachment will be relative to the bone
vang = Angle(0, 0, 0),
wpos = Vector(7, 1.6, -4),
wang = Angle(-10, 0, 180)
},
}, --8
}
SWEP.Hook_SelectReloadAnimation = function(wep, curanim)
local fastmag = wep:GetBuff_Override("BO1_FastMag")
if curanim == "reload" and fastmag then
return curanim .. "_fast"
end
if curanim == "reload_empty" and fastmag then
return curanim .. "_fast"
end
end
SWEP.Animations = {
["idle"] = {
Source = "idle",
Time = 1 / 35,
},
["draw"] = {
Source = "draw",
Time = 1,
LHIK = true,
LHIKIn = 0.25,
LHIKOut = 0.25,
},
["holster"] = {
Source = "holster",
Time = 1,
LHIK = true,
LHIKIn = 0.2,
LHIKOut = 0.25,
},
["idle_empty"] = {
Source = "idle_empty",
Time = 1 / 35,
},
["draw_empty"] = {
Source = "draw_empty",
Time = 1,
LHIK = true,
LHIKIn = 0.25,
LHIKOut = 0.25,
},
["holster_empty"] = {
Source = "holster_empty",
Time = 1,
LHIK = true,
LHIKIn = 0.2,
LHIKOut = 0.25,
},
["ready"] = {
Source = "first_draw",
Time = 59 / 30,
LHIK = true,
LHIKIn = 0.2,
LHIKOut = 0.2,
SoundTable = {
{s = "ArcCW_BO2.AR_Back", t = 0.5 / 1.15},
{s = "ArcCW_BO2.AR_Fwd", t = 0.7 / 1.15},
},
},
["fire"] = {
Source = {
"fire",
},
Time = 9 / 30,
ShellEjectAt = 0,
},
["fire_iron"] = {
Source = {
"fire_ads",
},
Time = 9 / 30,
ShellEjectAt = 0,
},
["fire_empty"] = {
Source = {
"fire_last",
},
Time = 9 / 30,
ShellEjectAt = 0,
},
["fire_iron_empty"] = {
Source = {
"fire_ads_last",
},
Time = 9 / 30,
ShellEjectAt = 0,
},
["reload"] = {
Source = "reload",
Time = 3.5 / 1.15,
TPAnim = ACT_HL2MP_GESTURE_RELOAD_AR2,
LHIK = true,
LHIKIn = 0,
LHIKOut = 0.4,
SoundTable = {
{s = "ArcCW_BO2.AR_MagOut", t = 0.5 / 1.15},
{s = "ArcCW_BO2.AR_MagIn", t = 2.4 / 1.15},
},
},
["reload_empty"] = {
Source = "reload_empty",
Time = 4.16 / 1.15,
TPAnim = ACT_HL2MP_GESTURE_RELOAD_AR2,
LHIK = true,
LHIKIn = 0,
LHIKOut = 0.4,
SoundTable = {
{s = "ArcCW_BO2.AR_Back", t = 0.5 / 1.15},
{s = "ArcCW_BO2.AR_MagOut", t = 1.1 / 1.15},
{s = "ArcCW_BO2.AR_MagIn", t = 2.4 / 1.15},
{s = "ArcCW_BO2.AR_Back", t = 2.8 / 1.15},
{s = "ArcCW_BO2.AR_Fwd", t = 3 / 1.15},
},
},
["reload_fast"] = {
Source = "reload_fast",
Time = (1.8 * 1.25) / 1.15,
TPAnim = ACT_HL2MP_GESTURE_RELOAD_AR2,
LHIK = true,
LHIKIn = 0,
LHIKOut = 0.4,
SoundTable = {
{s = "ArcCW_BO2.AR_MagOut", t = 0.5 / 1.15},
{s = "ArcCW_BO2.AR_MagIn", t = 1 / 1.15},
},
MinProgress = 1,
},
["reload_empty_fast"] = {
Source = "reload_empty_fast",
Time = (2.633 * 1.25) / 1.15,
TPAnim = ACT_HL2MP_GESTURE_RELOAD_AR2,
LHIK = true,
LHIKIn = 0,
LHIKOut = 0.4,
MinProgress = 1.8,
SoundTable = {
{s = "ArcCW_BO2.AR_MagOut", t = 0.5 / 1.15},
{s = "ArcCW_BO2.AR_MagIn", t = 1 / 1.15},
{s = "ArcCW_BO2.AR_Back", t = 1.8 / 1.15},
{s = "ArcCW_BO2.AR_Fwd", t = 2 / 1.15},
},
},
["enter_sprint"] = {
Source = "sprint_in",
Time = 10 / 30
},
["idle_sprint"] = {
Source = "sprint_loop",
Time = 30 / 40
},
["exit_sprint"] = {
Source = "sprint_out",
Time = 10 / 30
},
["enter_sprint_empty"] = {
Source = "sprint_in_empty",
Time = 10 / 30
},
["idle_sprint_empty"] = {
Source = "sprint_loop_empty",
Time = 30 / 40
},
["exit_sprint_empty"] = {
Source = "sprint_out_empty",
Time = 10 / 30
},
} |
--// IDU Module Script
--// Script:
|
local api = vim.api
local function get_standup_content(daysBack)
daysBack = daysBack or 1
local result = vim.api.nvim_command_output('!git standup -c -d ' .. daysBack)
result = vim.split(result, '\n')
for i, line in ipairs(result) do
result[i] = string.gsub(line, '\\n', '')
end
return result
end
local function makeScratch()
api.nvim_command('enew')
api.nvim_buf_set_option(0, 'bufhidden', 'wipe')
api.nvim_buf_set_option(0, 'buftype', 'nofile')
api.nvim_buf_set_option(0, 'swapfile', false)
api.nvim_buf_set_option(0, 'syntax', 'on')
api.nvim_command('set filetype=gitstandup')
end
local function show(daysBack)
-- create a new scratch buffer
makeScratch()
local result = get_standup_content(daysBack)
table.remove(result, 1)
table.remove(result, 1)
api.nvim_buf_set_lines(0, 0, -1, false, result)
end
return {
show = show,
}
|
object_mobile_dressed_dark_jedi_elder_male_rodian_02 = object_mobile_shared_dressed_dark_jedi_elder_male_rodian_02:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_dark_jedi_elder_male_rodian_02, "object/mobile/dressed_dark_jedi_elder_male_rodian_02.iff")
|
local util = require 'xlua.util'
App = CS.FairyEditor.App
ProjectType = CS.FairyEditor.ProjectType
fprint = function(msg)
App.consoleView:Log(tostring(msg))
end
function printLeakingReferences()
local str = 'These references from Lua to C# have not been released: \n'
local registry = debug.getregistry()
for k, v in pairs(registry) do
if type(k) == 'number' and type(v) == 'function' and registry[v] == k then
local info = debug.getinfo(v)
str = str..string.format('%s:%d', info.short_src, info.linedefined)..'\n'
end
end
str = str..'Try to solve it in a function with name \'onDestroy\'.'
App.consoleView:LogWarning(str)
end
function fclass()
local cls = {}
cls.__index=cls
function cls.new(...)
local inst=setmetatable({}, cls)
if inst.ctor then
inst.ctor(inst, ...)
end
return inst
end
return cls
end
local codeGenerators = {
[ProjectType.Flash] = require('GenCode_AS3'),
[ProjectType.Starling] = require('GenCode_AS3'),
[ProjectType.Layabox] = require('GenCode_TS'),
[ProjectType.Egret] = require('GenCode_Egret'),
[ProjectType.PIXI] = require('GenCode_PIXI'),
[ProjectType.Unity] = require('GenCode_CSharp'),
[ProjectType.CryEngine] = require('GenCode_CSharp'),
[ProjectType.MonoGame] = require('GenCode_CSharp'),
[ProjectType.Haxe] = require('GenCode_Haxe'),
[ProjectType.Cocos2dx] = require('GenCode_CPP'),
[ProjectType.Vision] = require('GenCode_CPP'),
[ProjectType.CocosCreator] = require('GenCode_TS'),
[ProjectType.ThreeJS] = require('GenCode_TS'),
[ProjectType.CreateJS] = require('GenCode_TS'),
[ProjectType.Unreal] = require('GenCode_Py')
}
function genCodeDefault(handler)
local func = codeGenerators[handler.project.type]
if func~=nil then
func(handler)
end
end
CodeWriter = fclass()
function CodeWriter:ctor(config)
config = config or {}
self.blockStart = config.blockStart or '{'
self.blockEnd = config.blockEnd or '}'
self.blockFromNewLine = config.blockFromNewLine
if self.blockFromNewLine==nil then self.blockFromNewLine = true end
if config.usingTabs then
self.indentStr = '\t'
else
self.indentStr = ' '
end
self.usingTabs = config.usingTabs
self.endOfLine = config.endOfLine or '\n'
self.fileMark = config.fileMark or '# This is an automatically generated class by FairyGUI. Please do not modify it. '
self.lines = {}
self.indent = 0
self:writeMark()
end
function CodeWriter:writeMark()
table.insert(self.lines, self.fileMark)
table.insert(self.lines, '')
end
function CodeWriter:writeln(format, ...)
if not format then
table.insert(self.lines, '')
return
end
local str = ''
for i=0,self.indent-1 do
str = str..self.indentStr
end
str = str..string.format(format, ...)
table.insert(self.lines, str)
return self
end
function CodeWriter:startBlock()
if self.blockFromNewLine or #self.lines==0 then
self:writeln(self.blockStart)
else
local str = self.lines[#self.lines]
self.lines[#self.lines] = str..' '..self.blockStart
end
self.indent = self.indent + 1
return self
end
function CodeWriter:endBlock()
self.indent = self.indent - 1
self:writeln(self.blockEnd)
return self
end
function CodeWriter:incIndent()
self.indent = self.indent + 1
return self
end
function CodeWriter:decIndent()
self.indent = self.indent - 1
return self
end
function CodeWriter:reset()
if #self.lines>0 then self.lines = {} end
self.indent = 0
self:writeMark()
end
function CodeWriter:tostring()
return table.concat(self.lines, self.endOfLine)
end
function CodeWriter:save(filePath)
local str = table.concat(self.lines, self.endOfLine)
CS.System.IO.File.WriteAllText(filePath, str)
-- local file = io.open(filePath, 'w+b')
-- io.output(file)
-- io.write(str)
-- io.close(file)
end |
local unionfind, sizekey = {}, {}
local tree = require "tree" or error ("unionfind module requires tree", 2)
local meta = {__index = unionfind}
function meta.__len (t)
return t[sizekey]
end
local metaset = {__len = function(t) return t.size end}
local function setnew(v)
local r = {rank = 0, size = 1}
local t = tree.new(r)
r.tree = t
return setmetatable(r, metaset)
end
local tree_depth = tree.new(1):depth()
local function setnex(A, S)
local el
S, el = tree_depth (A.tree, S)
if not S then
return
end
el:emancipate()
A.tree:insert(el)
return S, el.node
end
function metaset.__pairs(set)
local _, _, state = set.tree:depth()
return setnex, set, state
end
function unionfind.newsgton(...)
--input is the list of elements
local r, i = {}, {...}
r[sizekey] = #i
for _, v in ipairs (i) do
r[v] = setnew(v).tree
end
return setmetatable(r, meta)
end
function unionfind.new(...)
--input is the list of sets, given as the list of their elements
local r, i = {}, {...}
r[sizekey] = #i
for _, l in ipairs (i) do
local c, s = l[1]
s = setnew(c)
r[c] = s.tree
s.size = #l
if s.size > 1 then
s.rank, s = 1, s.tree
for k = 2, #l do
r[l[k]] = tree.new()
s:insert(r[l[k]])
end
end
end
return setmetatable(r, meta)
end
function unionfind.insert(u, fst, ...)
--add a disjoint set
u[sizekey] = u[sizekey] + 1
local s = setnew(fst)
u[fst] = s.tree
s.size = 1 + select("#", ...)
for _, v in ipairs{...} do
u[v] = tree.new()
s.tree:insert(u[v])
end
return s
end
function unionfind.find (u, a)
a = u[a]
local r = a:root()
while a.parent do
a = a:emancipate(), r:insert(a) --Aurélien, ULM représente, master of the snippet
end
return r.node
end
function unionfind.union (u, a, b)
a, b = u:find (a), u:find (b)
if a ~= b then
if a.rank == b.rank then
a.rank = a.rank + 1
elseif a.rank < b.rank then
a, b = b, a
end
a.tree:insert(b.tree)
b.tree.node = nil --so that (the set) b can be cleaned by the GC
a.size = a.size + b.size
u[sizekey] = u[sizekey] - 1
end
return a
end
return setmetatable({}, {__index = unionfind, __metatable = false})
|
object_ship_ixiyen_s03_tier10 = object_ship_shared_ixiyen_s03_tier10:new {
}
ObjectTemplates:addTemplate(object_ship_ixiyen_s03_tier10, "object/ship/ixiyen_s03_tier10.iff")
|
-- OpenComputers Lib
local cm = require("component")
local os = require("os")
-- My Lib
local EventLoop = require("lib/event_loop")
-- Components
local gpu = cm.gpu
-- Internal Variables
local buttons = {}
local max_x, max_y = gpu.maxResolution()
-- Functions
local function create_button(id, callback, x1, y1, x2, y2, bg_color, fg_color, label)
-- Save color settings
local bg = gpu.getBackground()
local fg = gpu.getForeground()
-- Set default parameters
bg_color = bg_color or 0xFFFFFF
fg_color = fg_color or 0x000000
-- Draw button
gpu.setBackground(bg_color)
gpu.fill(x1, y1, x2 - x1 + 1, y2 - y1 + 1, " ")
-- Draw label
if label then
gpu.setForeground(fg_color)
gpu.set(x1 + (x2 - x1) / 2 - #label / 2, y1 + (y2 - y1) / 2, label)
end
-- Restore color settings
gpu.setBackground(bg)
gpu.setForeground(fg)
-- Record information for button handler
buttons[id] = {}
buttons[id].x1 = x1
buttons[id].y1 = y1
buttons[id].x2 = x2
buttons[id].y2 = y2
buttons[id].fn = callback
end
local function button_handler(_, address, x, y, button, player)
for k, v in pairs(buttons) do
if button == 0 and x >= v.x1 and x <= v.x2 and y >= v.y1 and y <= v.y2 then
v.fn()
end
end
end
-- Set resolution to maximum
gpu.setResolution(max_x, max_y)
-- Set to maximum color depth
gpu.setDepth(gpu.maxDepth())
-- Clear the screen
gpu.fill(1, 1, max_x, max_y, " ")
-- Create test screen
create_button("one", function () gpu.set(8, 4, "Ayy") end, 3, 2, max_x - 2, max_y / 4 - 2, 0x4020FF, 0xFFFFFF, "Begin!")
-- Install button handler
ev = EventLoop()
ev:register("interrupted", function (loop) loop:stop() end)
ev:register("touch", button_handler)
-- Run event loop
ev:run()
|
return {
name = "Magicks/tourmaline-framework",
version = "0.1.0",
dependencies = {
'SinisterRectus/[email protected]'
},
tags = {'discord'},
license = 'MIT',
author = 'Magicks',
files = {'**.lua'}
} |
require('abilities/invoker_base/invoker_base')
function invoker_wex_datadriven_on_spell_start(keys)
invoker_replace_orb(keys, "particles/units/heroes/hero_invoker/invoker_wex_orb.vpcf")
end
|
object_tangible_quest_jawa_droid_r4_powerdown = object_tangible_quest_shared_jawa_droid_r4_powerdown:new {
}
ObjectTemplates:addTemplate(object_tangible_quest_jawa_droid_r4_powerdown, "object/tangible/quest/jawa_droid_r4_powerdown.iff")
|
--[[
Script for testing a human activity estimator.
Available/valid datasets: UCF Sports Action.
--]]
require 'paths'
require 'torch'
require 'string'
require 'optim'
local tnt = require 'torchnet'
local Logger = optim.Logger
--------------------------------------------------------------------------------
-- Load configs (data, model, criterion, optimState)
--------------------------------------------------------------------------------
print('==> (1/3) Load configurations: ')
paths.dofile('configs.lua')
-- load model from disk
print('==> (2/3) Load network from disk: ')
load_model('test')
-- set local vars
local lopt = opt
local nSamples = opt.test_num_videos
-- convert modules to a specified tensor type
local function cast(x) return x:type(opt.dataType) end
--------------------------------------------------------------------------------
-- Setup data generator
--------------------------------------------------------------------------------
local function getIterator(mode)
return tnt.ParallelDatasetIterator{
nthread = opt.nThreads,
ordered = true,
init = function(threadid)
require 'torch'
require 'torchnet'
opt = lopt
paths.dofile('data.lua')
paths.dofile('sample_batch.lua')
torch.manualSeed(threadid+opt.manualSeed)
end,
closure = function()
-- setup data loader
local data_loader = select_dataset_loader(opt.dataset, mode)
local loader = data_loader[mode]
-- setup dataset iterator
return tnt.ListDataset{
list = torch.range(1, nSamples):long(),
load = function(idx)
local input_hms, input_feats, label = getSampleTest(loader, idx)
return {
input_hms = input_hms,
input_feats = input_feats,
target = label
}
end
}:batch(1, 'include-last')
end,
}
end
--------------------------------------------------------------------------------
-- Setup torchnet engine/meters/loggers
--------------------------------------------------------------------------------
local timers = {
featTimer = torch.Timer(),
clsTimer = torch.Timer(),
totalTimer = torch.Timer(),
}
local meters = {
confusion_matrix = tnt.ConfusionMeter{k = opt.num_activities},
clerr = tnt.ClassErrorMeter{topk = {1,5},accuracy=true},
ap = tnt.APMeter(),
}
function meters:reset()
self.confusion_matrix:reset()
self.clerr:reset()
self.ap:reset()
end
local loggers = {
test = Logger(paths.concat(opt.save,'Evaluation_full.log'), opt.continue),
confusion_matrix = Logger(paths.concat(opt.save,'Evaluation_confusion.log'), opt.continue)
}
loggers.test:setNames{'Top-1 accuracy (%)', 'Top-5 accuracy (%)', 'Average Precision'}
loggers.confusion_matrix:setNames{'Test confusion matrix'}
loggers.test.showPlot = false
loggers.confusion_matrix.showPlot = false
-- set up training engine:
local engine = tnt.OptimEngine()
engine.hooks.onStart = function(state)
print('\n*********************************************************')
print(('Start testing the network on the %s dataset: '):format(opt.dataset))
print('*********************************************************')
end
-- copy sample to GPU buffer:
local inputs, targets = cast(torch.Tensor()), cast(torch.Tensor())
local num_imgs_seq
engine.hooks.onSample = function(state)
cutorch.synchronize(); collectgarbage();
timers.featTimer:reset()
if state.sample.input_feats then
if type(state.sample.input_feats[1]) == 'userdata' then
num_imgs_seq = state.sample.input_feats[1]:size(2)
else
num_imgs_seq = state.sample.input_hms[1]:size(2)
end
elseif state.sample.input_hms then
num_imgs_seq = state.sample.input_hms[1]:size(2)
else
error('Error! No features for any nertwork is available!')
end
------
local function process_inputs(model, input)
local inputs_features = {}
if model then
for i=1, num_imgs_seq do
local img = input[1][i]
local img_cuda = img:view(1, unpack(img:size():totable())):cuda() -- extra dimension for cudnn batchnorm
local features = model:forward(img_cuda)
table.insert(inputs_features, features)
end
-- convert table into a single tensor
inputs_features = nn.Unsqueeze(1):cuda():forward(nn.JoinTable(1):cuda():forward(inputs_features))
end
return inputs_features
end
------
local inputs_features, inputs_hms
if model_features then inputs_features = process_inputs(model_features, state.sample.input_feats[1]) end
if model_hms then
inputs_hms = process_inputs(model_hms, state.sample.input_hms[1])
inputs_hms[inputs_hms:lt(0)]=0
inputs_hms = inputs_hms:view(1, inputs_hms:size(2), -1)
end
--local inputs_features = process_inputs(model_features, state.sample.input_feats[1])
--local inputs_hms = process_inputs(model_hms, state.sample.input_hms[1])
targets:resize(state.sample.target[1]:size() ):copy(state.sample.target[1])
if model_features and model_hms then
state.sample.input = {inputs_features, inputs_hms}
elseif model_features then
state.sample.input = inputs_features
elseif model_hms then
state.sample.input = inputs_hms
else
error('Invalid network type: ' .. opt.netType)
end
state.sample.target = targets:view(-1)
timers.featTimer:stop()
timers.clsTimer:reset()
end
local softmax = cast(nn.SoftMax())
engine.hooks.onForward= function(state)
if opt.test_progressbar then
xlua.progress(state.t, nSamples)
else
print(('test: %5d/%-5d ' .. 'seq_length=%d ' ..
'features forward time: %.3fs, classifier forward time: %.3fs, ' ..
'total time: %0.3fs'):format(state.t, nSamples, num_imgs_seq,
timers.featTimer:time().real,
timers.clsTimer:time().real,
timers.totalTimer:time().real))
end
local out = softmax:forward(state.network.output)
if string.find(opt.netType, 'lstm') then
local end_idx = state.sample.target:size(1)
meters.clerr:add(out[{{end_idx}, {}}], state.sample.target[{{end_idx}}])
meters.confusion_matrix:add(out[{{end_idx}, {}}], state.sample.target[{{end_idx}}])
local tar = torch.ByteTensor(out:size(2)):fill(0)
local id = state.sample.target[end_idx]
tar[id] = 1
meters.ap:add(out[end_idx],tar)
elseif string.find(opt.netType, 'convnet') then
out = out:mean(1):squeeze() -- mean
meters.clerr:add(out,state.sample.target[{{1}}])
local tar = torch.ByteTensor(out:size(1)):fill(0)
tar[state.sample.target[1]] = 1
meters.ap:add(out,tar)
else
error('Invalid network type: ' .. opt.netType)
end
collectgarbage()
timers.featTimer:resume()
timers.totalTimer:reset()
end
engine.hooks.onEnd= function(state)
loggers.test:add{meters.clerr:value{k = 1}, meters.clerr:value{k = 5},meters.ap:value():mean()}
print("\nEvaluation complete!")
print("Accuracy: Top 1%", meters.clerr:value{k = 1} .. '%')
print("Accuracy: Top 5%", meters.clerr:value{k = 5} .. '%')
print("mean AP:",meters.ap:value():mean())
if opt.test_printConfusion then
local ts = optim.ConfusionMatrix(opt.activities)
ts.mat = meters.confusion_matrix:value()
loggers.confusion_matrix:add{ts:__tostring__()} -- output the confusion matrix as a string
print(ts)
end
end
--------------------------------------------------------------------------------
-- Test the model
--------------------------------------------------------------------------------
engine:test{
network = model_classifier,
iterator = getIterator('test')
}
print('\nTest script complete.') |
--[[
Copyright (c) 2016 by Marco Lizza ([email protected])
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgement in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
]]--
-- MODULE INCLUSIONS -----------------------------------------------------------
local soop = require('lib.soop')
local utils = require('lib.utils')
-- MODULE DECLARATION ----------------------------------------------------------
local Entity = soop.class()
-- MODULE FUNCTION -------------------------------------------------------------
function Entity:initialize(parameters)
self.position = parameters.position
self.angle = parameters.angle
self.life = 0
end
function Entity:hit(damage)
damage = damage or 1
if self.life > 0 then
self.life = math.max(0, self.life - damage)
end
end
function Entity:kill()
self.life = 0
end
function Entity:is_alive()
return self.life > 0
end
function Entity:collide(other)
local distance = utils.distance(self.position, other.position)
return distance <= (self.radius + other.radius)
end
function Entity:cast(modulo)
local vx, vy = math.cos(self.angle) * modulo, math.sin(self.angle) * modulo
local cx, cy = unpack(self.position)
return cx + vx, cy + vy
end
-- END OF MODULE ---------------------------------------------------------------
return Entity
-- END OF FILE -----------------------------------------------------------------
|
--
-- created with TexturePacker (http://www.codeandweb.com/texturepacker)
--
-- $TexturePacker:SmartUpdate:eb673e0a4c7c2ba5196c6a10c06fb10f:21555c5bf2b2d178c8166fbd454d81c4:18cc0faedb801f0310f07fa32ca9fcf5$
--
-- local sheetInfo = require("mysheet")
-- local myImageSheet = graphics.newImageSheet( "mysheet.png", sheetInfo:getSheet() )
-- local sprite = display.newSprite( myImageSheet , {frames={sheetInfo:getFrameIndex("sprite")}} )
--
local SheetInfo = {}
SheetInfo.sheet =
{
frames = {
{
x=3004,
y=1,
width=128,
height=105,
widthFile=128,
heightFile=105,
pivotx=64,
pivoty=52.5,
sourceX = 0,
sourceY = 0,
sourceWidth = 128,
sourceHeight = 105,
trimmedName = "128cloud00",
},
{
x=3134,
y=1,
width=101,
height=128,
widthFile=101,
heightFile=128,
pivotx=50.5,
pivoty=64,
sourceX = 0,
sourceY = 0,
sourceWidth = 101,
sourceHeight = 128,
trimmedName = "128tree00",
},
{
x=1,
y=891,
width=2048,
height=376,
widthFile=2048,
heightFile=376,
pivotx=1024,
pivoty=188,
sourceX = 0,
sourceY = 0,
sourceWidth = 2048,
sourceHeight = 376,
trimmedName = "2048hills00",
},
{
x=1,
y=1,
width=2048,
height=463,
widthFile=2048,
heightFile=463,
pivotx=1024,
pivoty=231.5,
sourceX = 0,
sourceY = 0,
sourceWidth = 2048,
sourceHeight = 463,
trimmedName = "2048hills01",
},
{
x=1,
y=466,
width=2048,
height=423,
widthFile=2048,
heightFile=423,
pivotx=1024,
pivoty=211.5,
sourceX = 0,
sourceY = 0,
sourceWidth = 2048,
sourceHeight = 423,
trimmedName = "2048hills02",
},
{
x=2507,
y=1,
width=256,
height=209,
widthFile=256,
heightFile=209,
pivotx=128,
pivoty=104.5,
sourceX = 0,
sourceY = 0,
sourceWidth = 256,
sourceHeight = 209,
trimmedName = "256cloud00",
},
{
x=2507,
y=212,
width=233,
height=256,
widthFile=233,
heightFile=256,
pivotx=116.5,
pivoty=128,
sourceX = 0,
sourceY = 0,
sourceWidth = 233,
sourceHeight = 256,
trimmedName = "256house00",
},
{
x=2765,
y=1,
width=237,
height=256,
widthFile=237,
heightFile=256,
pivotx=118.5,
pivoty=128,
sourceX = 0,
sourceY = 0,
sourceWidth = 237,
sourceHeight = 256,
trimmedName = "256tree00",
},
{
x=2051,
y=1,
width=454,
height=512,
widthFile=454,
heightFile=512,
pivotx=227,
pivoty=256,
sourceX = 0,
sourceY = 0,
sourceWidth = 454,
sourceHeight = 512,
trimmedName = "512tree00",
},
{
x=3004,
y=108,
width=32,
height=32,
widthFile=32,
heightFile=32,
pivotx=16,
pivoty=16,
sourceX = 0,
sourceY = 0,
sourceWidth = 32,
sourceHeight = 32,
trimmedName = "8x8",
},
},
fileName = "images/country0.png",
sheetContentWidth = 4096,
sheetContentHeight = 4096,
scale = 1,
shapePadding = 0,
borderPadding = 0,
commonDivisorX = 1,
commonDivisorY = 1,
extrude = 1,
baseFactor = 1,
maxTextureSizeWidth = 4096,
maxTextureSizeHeight = 4096,
fixedTextureSizeWidth = -1,
fixedTextureSizeHeight = -1,
-- smartUpdateKey = $TexturePacker:SmartUpdate:eb673e0a4c7c2ba5196c6a10c06fb10f:21555c5bf2b2d178c8166fbd454d81c4:18cc0faedb801f0310f07fa32ca9fcf5$,
-- settings_autoSDSettings = {
--
-- {
-- settings_autoSDSettings_scale = 1,
-- settings_autoSDSettings_extension = ,
-- settings_autoSDSettings_spriteFilter = ,
-- settings_autoSDSettings_acceptFractionalValues = false,
-- settings_autoSDSettings_maxTextureSize_width = -1,
-- settings_autoSDSettings_maxTextureSize_height = -1,
-- },
--
-- },
-- settings_ditherType = NearestNeighbour,
-- settings_textureFormat = png,
-- settings_outputFormat = RGBA8888,
-- settings_contentProtection_key = ,
-- settings_tpsName = unsaved,
-- settings_allowRotation = false,
-- settings_flipPVR = false,
-- settings_forceIdenticalLayout = false,
-- settings_multiPack = true,
-- settings_shapeDebug = ,
-- settings_trimSpriteNames = false,
-- settings_autoAliasEnabled = true,
-- settings_premultiplyAlpha = false,
-- settings_reduceBorderArtifacts = true,
-- settings_fixedTextureSize_width = -1,
-- settings_fixedTextureSize_height = -1,
-- settings_dataFormat = corona-imagesheet,
-- settings_textureSubPath = ,
-- settings_borderPadding = 0,
-- settings_shapePadding = 0,
-- settings_commonDivisorX = 1,
-- settings_commonDivisorY = 1,
-- settings_dpi = 72,
-- settings_backgroundColor = 0,
-- variantIndex = 0,
-- multipackIndex = ,
-- variantParams_scale = 1,
-- variantParams_shapePadding = 0,
-- variantParams_borderPadding = 0,
-- variantParams_commonDivisorX = 1,
-- variantParams_commonDivisorY = 1,
-- variantParams_extrude = 1,
-- variantParams_baseFactor = 1,
-- variantParams_maxTextureSize_width = 4096,
-- variantParams_maxTextureSize_height = 4096,
-- variantParams_fixedTextureSize_width = -1,
-- variantParams_fixedTextureSize_height = -1,
}
SheetInfo.frameIndex =
{
["128cloud00"] = 1,
["128tree00"] = 2,
["2048hills00"] = 3,
["2048hills01"] = 4,
["2048hills02"] = 5,
["256cloud00"] = 6,
["256house00"] = 7,
["256tree00"] = 8,
["512tree00"] = 9,
["8x8"] = 10,
}
function SheetInfo:getSheet()
return self.sheet;
end
function SheetInfo:getFrameIndex(name)
return self.frameIndex[name];
end
return SheetInfo
|
chung_ryongs_rage = {
cast = function(player)
if (not player:canCast(1, 1, 0)) then
return
end
local aethers = 120000
local duration = 938000
if player.gmLevel ~= 0 then
aethers = 0
end
player:removeDuras(lesserFuries)
if (player:hasDuration("chung_ryongs_rage") == true and player.rage == 8) then
-- cast rage2
if (player.magic < 7200) then
player:sendMinitext("You do not have enough mana.")
return
end
player.rage = 14
player.magic = player.magic - 7200
player:sendAnimation(36)
player:playSound(705)
player:sendMinitext("[Rage 2] Chung Ryong's power grows within you.")
player:sendAction(6, 35)
player.registry["chungryongragelevel"] = 2
player:setAether("chung_ryongs_rage", aethers)
player:calcStat()
elseif (player:hasDuration("chung_ryongs_rage") == true and player.rage == 14) then
-- cast rage3
if (player.magic < 18050) then
player:sendMinitext("You do not have enough mana.")
return
end
player.rage = 20
player.magic = player.magic - 18050
player:sendAnimation(36)
player:playSound(705)
player:sendMinitext("[Rage 3] Great rage inspires you.")
player.registry["chungryongragelevel"] = 3
player:setAether("chung_ryongs_rage", aethers)
player:sendAction(6, 35)
--player.armor = player.armor + 5
player:calcStat()
elseif (player:hasDuration("chung_ryongs_rage") == true and player.rage == 20) then
-- cast rage4
if (player.magic < 33800) then
player:sendMinitext("You do not have enough mana.")
return
end
player.rage = 26
player.magic = player.magic - 33800
player:sendAnimation(36)
player:playSound(705)
player:sendMinitext("[Rage 4] Your body trembles with incredible strength.")
player:sendAction(6, 35)
player.registry["chungryongragelevel"] = 4
player:setAether("chung_ryongs_rage", aethers)
--player.armor = player.armor + 15
player:calcStat()
elseif (player:hasDuration("chung_ryongs_rage") == true and player.rage == 26) then
-- cast rage5
if (player.magic < 72200) then
player:sendMinitext("You do not have enough mana.")
return
end
player.rage = 36
player.magic = player.magic - 72200
player:sendAnimation(36)
player:playSound(705)
player:sendMinitext("[Rage 5] You enter a mindless frenzy.")
player:sendAction(6, 35)
player.registry["chungryongragelevel"] = 5
player:setAether("chung_ryongs_rage", aethers)
--player.armor = player.armor + 30
player:calcStat()
elseif (player:hasDuration("chung_ryongs_rage") == true and player.rage == 36) then
-- cast rage6
if (player.magic < 145800) then
player:sendMinitext("You do not have enough mana.")
return
end
player.rage = 81
--player.magic = player.magic - 145800
player.magic = 0
player:sendAnimation(36)
player:playSound(705)
player:sendMinitext("[Rage 6] Your body is torn apart with Chung Ryong's power.")
player:sendAction(6, 35)
player.registry["chungryongragelevel"] = 6
player:setAether("chung_ryongs_rage", aethers)
--player.armor = player.armor + 50
player:calcStat()
elseif (player:hasDuration("chung_ryongs_rage") == false) then
if (player.magic < 2000) then
player:sendMinitext("You do not have enough mana.")
return
end
player:removeDuras(furies)
player.rage = 8
player.magic = player.magic - 2000
player:sendAnimation(36)
player:playSound(705)
player.registry["chungryongragelevel"] = 1
-- setting this to calculate the end ac and vita
player:setDuration("chung_ryongs_rage", duration)
player:setAether("chung_ryongs_rage", aethers)
player:sendMinitext("[Rage 1] You cast Chung Ryong's rage.")
player:sendAction(6, 35)
player:calcStat()
end
end,
recast = function(player)
-- added to handle if player dc and/or logs off and back on
local rage = 1
local armor = 0
if (player.registry["chungryongragelevel"] == 1) then
rage = 8
end
if (player.registry["chungryongragelevel"] == 2) then
rage = 14
end
if (player.registry["chungryongragelevel"] == 3) then
rage = 20
armor = 5
end
if (player.registry["chungryongragelevel"] == 4) then
rage = 26
armor = 15
end
if (player.registry["chungryongragelevel"] == 5) then
rage = 36
armor = 30
end
if (player.registry["chungryongragelevel"] == 6) then
rage = 81
armor = 50
end
player.rage = rage
player.armor = player.armor + armor
player:sendStatus()
end,
uncast = function(player)
player.rage = 1
if (player.registry["chungryongragelevel"] == 1) then
player.health = player.health *.8
end
if (player.registry["chungryongragelevel"] == 2) then
player.health = player.health *.8
end
if (player.registry["chungryongragelevel"] == 3) then
player.health = player.health *.8
player.armor = player.armor - 5
end
if (player.registry["chungryongragelevel"] == 4) then
player.health = player.health *.6
player.armor = player.armor - 15
end
if (player.registry["chungryongragelevel"] == 5) then
player.health = player.health *.4
player.armor = player.armor - 30
end
if (player.registry["chungryongragelevel"] == 6) then
player.health = player.health *.1
player.armor = player.armor - 50
end
player.registry["chungryongragelevel"] = 0
player:sendStatus()
end,
requirements = function(player)
local level = 99
local items = {
Item("spike").id,
Item("chung_ryong_key").id,
Item("dragons_liver").id,
0
}
local itemAmounts = {1, 1, 1, 50000}
local description = "Fury with incremental power increase."
if (Config.freeNpcSubpathsEnabled) then
items = {}
itemAmounts = {}
end
return level, items, itemAmounts, description
end
}
|
errinj = box.error.injection
fiber = require('fiber')
-- During this test we verify that if dump process is throttled
-- due to error, DDL operations in window between dumps won't
-- break anything.
--
s = box.schema.space.create('test', {engine = 'vinyl'})
_ = s:create_index('pk')
errinj.set('ERRINJ_VY_RUN_WRITE', true)
errinj.set('ERRINJ_VY_SCHED_TIMEOUT', 0.01)
s:replace{2}
box.snapshot()
errinj.set('ERRINJ_VY_RUN_WRITE', false)
s:drop()
s = box.schema.space.create('test1', {engine = 'vinyl'})
i = s:create_index('pk1')
s:replace{1}
-- Unthrottle scheduler.
errinj.set('ERRINJ_VY_SCHED_TIMEOUT', 0)
fiber.sleep(0.1)
s:drop()
|
return {'ersatz','ersatzkoffie','ersoy'} |
local gc = collectgarbage
local SysTime = SysTime
local limit, die = 1 / 300, 0, 0
local create, yield, resume =
coroutine.create, coroutine.yield, coroutine.resume
local timerCreate = timer.Create
local running = false
local function _gc()
while gc('step', 1) do
if SysTime() > die then
yield()
end
end
end
timerCreate('CollectGarbage', 60, 0, function()
if running then return end
running = true
local co = create(_gc)
local Start = SysTime()
timerCreate('CollectGarbage.Process', 0, 0, function()
die = SysTime() + limit
if co == nil or not resume(co) then
timer.Remove('CollectGarbage.Process')
running = false
end
end)
end)
gc'stop'
|
-- Load and set namespace
local addonName, core = ...
core.Config = {}
local Config = core.Config
local f
-- Create the config frame
function Config:Create()
core:Debug("Config: Create")
-- Create ConfigFrame
f = CreateFrame("Frame", "DutyConfigFrame", UIParent)
-- Add to Blizzard Interface Options
f.name = "Duty"
InterfaceOptions_AddCategory(f)
-- Title
f.sectionHeader = Config:CreateSectionFrame("TOPLEFT", f, "TOPLEFT", 17, -16, 100, 30)
f.headerTitle = Config:CreateHeaderText("TOPLEFT", f.sectionHeader, "TOPLEFT", 0, "Duty", 30)
f.headerTitle:SetFont("Fonts/MORPHEUS.ttf", 30) -- override with Diablo font
-- Section system
f.sectionSystem = Config:CreateSectionFrame("TOPLEFT", f.sectionHeader, "BOTTOMLEFT", 0, -20, 285, 150)
f.sectionSystem.header = Config:CreateHeaderText("TOPLEFT", f.sectionSystem, "TOPLEFT", 0, "System", 16)
f.sectionSystem.checkbtnDebug = Config:CreateCheckButton("TOPLEFT", f.sectionSystem.header, "BOTTOMLEFT", -5, "ChkBtnDebug", "Console debug", "Enable to print a lot of internal console debug messages.", core.options.debug, function(self)
core:ToggleDebug()
end)
f.sectionSystem.btnDefaults = Config:CreateButton("TOPLEFT", f.sectionSystem.checkbtnDebug, "BOTTOMLEFT", -10, "Reset to defaults", function()
core:RestoreDefaults()
end)
-- Section gui
f.sectionGUI = Config:CreateSectionFrame("TOPLEFT", f.sectionSystem, "TOPRIGHT", 20, 0, 285, 150)
f.sectionGUI.header = Config:CreateHeaderText("TOPLEFT", f.sectionGUI, "TOPLEFT", 0, "Panel", 16)
f.sectionGUI.btnGUI = Config:CreateButton("TOPLEFT", f.sectionGUI.header, "BOTTOMLEFT", -10, "Toggle", function()
core.Duty:Toggle()
end)
f.sectionGUI.sliderOpacity = Config:CreateSlider("TOPLEFT", f.sectionGUI.btnGUI, "BOTTOMLEFT", -20, "SliderScale", "Opacity", "Adjust to set the opacity of the Duty panel.", "Transparent", "Opaque", 0, 10, core.options.dutyOpacity*10, 1, function(self, value)
local s = math.ceil(value*100)/1000
core.options.dutyOpacity = s
core.Duty:SetOpacity()
core.DutySlave:SetOpacity()
end)
f.sectionGUI.sliderOpacity:SetPoint("TOPLEFT", f.sectionGUI.btnGUI, "BOTTOMLEFT", 10, -20)
f.sectionGUI.sliderOpacity:SetEnabled(true)
end
-- Create a section frame
function Config:CreateSectionFrame(point, relativeFrame, relativePoint, xOffset, yOffset, width, height)
local sf = CreateFrame("Frame", nil, f)
sf:SetSize(width, height)
sf:SetPoint(point, relativeFrame, relativePoint, xOffset, yOffset)
return sf
end
-- Create a header text
function Config:CreateHeaderText(point, relativeFrame, relativePoint, yOffset, text, size)
local t = relativeFrame:CreateFontString(nil, "ARTWORK")
t:SetPoint(point, relativeFrame, relativePoint, 0, yOffset)
-- t:SetFont("Fonts/MORPHEUS.ttf", size)
t:SetFont("Fonts/FRIZQT__.ttf", size)
t:SetJustifyV("CENTER")
t:SetJustifyH("CENTER")
t:SetText(text)
t:SetTextColor(1, 0.9, 0, 1)
return t
end
-- Create text
function Config:CreateText(point, relativeFrame, relativePoint, yOffset, text, size)
local t = relativeFrame:CreateFontString(nil, "ARTWORK")
t:SetPoint(point, relativeFrame, relativePoint, 0, yOffset)
-- t:SetFont("Fonts/MORPHEUS.ttf", size)
t:SetFont("Fonts/FRIZQT__.ttf", size)
t:SetJustifyV("CENTER")
t:SetJustifyH("CENTER")
t:SetText(text)
return t
end
-- Create a check button with title and tooltip
function Config:CreateCheckButton(point, relativeFrame, relativePoint, yOffset, name, text, tooltip, checked, handlerFunc)
local btn = CreateFrame("CheckButton", "DutyConfig" .. name, f, "ChatConfigCheckButtonTemplate")
btn.text = _G[btn:GetName().."Text"]
btn.text:SetText(text)
btn.text:SetPoint("LEFT", btn, "RIGHT", 4, 0)
btn.tooltip = tooltip
btn:SetPoint(point, relativeFrame, relativePoint, 0, yOffset)
btn:SetScale(1.1)
btn:SetChecked(checked)
btn:SetScript("OnClick", function(self) handlerFunc(self) end)
return btn
end
-- Create a clickable button
function Config:CreateButton(point, relativeFrame, relativePoint, yOffset, text, handlerFunc)
local btn = CreateFrame("Button", nil, f, "GameMenuButtonTemplate")
btn:SetPoint(point, relativeFrame, relativePoint, 0, yOffset)
btn:SetSize(145, 22)
btn:SetText(text)
btn.tooltip = "Hejhej"
btn:SetNormalFontObject("GameFontNormal")
btn:SetHighlightFontObject("GameFontHighlight")
btn:SetScript("OnClick", function(self) handlerFunc(self) end)
return btn
end
-- Create a slider with title
function Config:CreateSlider(point, relativeFrame, relativePoint, yOffset, gname, title, tooltip, lowText, highText, minVal, maxVal, initVal, stepVal, handlerFunc)
local slider = CreateFrame("Slider", addonName .. gname, f, "OptionsSliderTemplate")
slider:SetPoint(point, relativeFrame, relativePoint, 0, yOffset)
slider:SetMinMaxValues(minVal, maxVal)
slider:SetValue(initVal)
slider:SetValueStep(stepVal)
slider:SetObeyStepOnDrag(true)
slider.tooltipText = tooltip
slider.lowText = _G[slider:GetName().."Low"]
slider.lowText:SetText(lowText)
slider.highText = _G[slider:GetName().."High"]
slider.highText:SetText(highText)
slider.text = _G[slider:GetName().."Text"]
slider.text:SetText(title)
slider:SetScript("OnValueChanged", function(self, value)
handlerFunc(self, value)
end)
return slider
end
-- Create an input text editing box
function Config:CreateInputBox(point, relativeFrame, relativePoint, yOffset, title, w, initVal, handleFunc)
local e = CreateFrame("EditBox", nil, f)
e:SetPoint(point, relativeFrame, relativePoint, 0, yOffset)
e.title_text = Config:CreateText("TOP", e, "TOP", 12, title, 12)
e:SetBackdrop({
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true,
tileSize = 26,
edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4}
})
e:SetBackdropColor(0.1,0.1,0.1,1)
e:SetFontObject(GameFontNormal)
e:SetJustifyH("CENTER")
e:SetJustifyV("CENTER")
e:SetSize(w, 25)
e:SetMultiLine(false)
e:SetAutoFocus(false)
e:SetMaxLetters(3)
e:SetText(initVal)
e:SetCursorPosition(0)
e:SetScript("OnEnterPressed", function(self)
handleFunc(self)
self:ClearFocus()
end)
e:SetScript("OnEscapePressed", function(self)
self:ClearFocus()
end)
return e
end
|
circle = { x=0, y=0}
k = math.random() * math.pi
function love.draw()
love.graphics.shear(k, k)
love.graphics.circle("fill", circle.x, circle.y, 2, 20)
end
function love.mousepressed(nx, ny, button)
if button == "l" then
circle.y = (ny - nx * k) / (1 - k * k)
circle.x = (nx - ny * k) / (1 - k * k)
end
end |
require 'tclient.tests.single-mode'
require 'tclient.tests.library-ignore-limit'
require 'tclient.tests.multi-workspace'
|
local Assert = require("api.test.Assert")
local Activity = require("api.Activity")
local Feat = require("api.Feat")
function test_Activity_create__params_validation()
Assert.throws_error(function() Activity.create("elona.searching", {feat=42}) end,
"base.activity 'elona.searching' received invalid value for parameter 'feat': Value is not of type \"map_object<base.feat>\": 42")
Assert.throws_error(function() Activity.create("elona.searching", {feat=nil}) end,
"base.activity 'elona.searching' received invalid value for parameter 'feat': Value is not of type \"map_object<base.feat>\": nil")
local feat = Feat.create("elona.material_spot", nil, nil, {ownerless=true, params={material_spot_info="elona.spring"}})
Assert.throws_error(function() Activity.create("elona.searching", {feat=feat, dood=42}) end,
"base.activity 'elona.searching' does not accept parameter 'dood'")
local activity = Activity.create("elona.searching", {feat=feat})
Assert.eq(feat, activity.params.feat)
end
function test_Activity_create__params_reserved_property_name()
local activity = Activity.create("elona.mining", {x=4,y=5})
Assert.eq(4, activity.params.x)
Assert.eq(5, activity.params.y)
end
|
--[[
Name: sv_phone.lua
For: TalosLife
By: TalosLife
]]--
GM.Phone = {}
function GM.Phone:GeneratePlayerNumber( pPlayer )
local saveTable = GAMEMODE.Char:GetCurrentSaveTable( pPlayer )
if not saveTable then return end
saveTable.PhoneNumber = util.CRC( pPlayer:SteamID().. pPlayer:GetCharacterID() )
GAMEMODE.SQL:MarkDiffDirty( pPlayer, "data_store", "PhoneNumber" )
end
--[[ Voice Calls ]]--
function GM.Phone:SetPlayerCallState( pPlayer, strState )
pPlayer.m_strCallState = strState
end
function GM.Phone:GetPlayerCallState( pPlayer )
return pPlayer.m_strCallState
end
--Player wants to call someone
function GM.Phone:PlayerCallNumber( pPlayer, strNumber )
if pPlayer:IsIncapacitated() then return end
if self:GetPlayerCallState( pPlayer ) ~= nil then --already in some stage of a call
return
end
local foundPlayer
for k, v in pairs( player.GetAll() ) do
if GAMEMODE.Player:GetGameVar( v, "phone_number" ) == strNumber then
foundPlayer = v
break
end
end
if not IsValid( foundPlayer ) or foundPlayer == pPlayer or not foundPlayer:Alive() then
self:SendDialFailed( pPlayer )
return
end
if self:GetPlayerCallState( foundPlayer ) ~= nil then
self:SendBusySignal( pPlayer )
return
end
if foundPlayer:IsIncapacitated() then
self:SendBusySignal( pPlayer )
return
end
local callUID = CurTime()
pPlayer.m_pCallingPlayer = foundPlayer
pPlayer.m_intCallStart = callUID
foundPlayer.m_pCallingPlayer = pPlayer
foundPlayer.m_intCallStart = callUID
self:SetPlayerCallState( pPlayer, "call_wait_out" )
self:SetPlayerCallState( foundPlayer, "call_wait_in" )
self:SendOutgoingCall( pPlayer, foundPlayer )
self:SendIncomingCall( foundPlayer, pPlayer )
timer.Simple( 30, function() --If no one picks up after this time, deny the call for them
if not IsValid( pPlayer ) then
if IsValid( foundPlayer ) and foundPlayer.m_intCallStart and foundPlayer.m_intCallStart == callUID then
GAMEMODE.Phone:PlayerDenyCall( foundPlayer )
end
return
end
if pPlayer.m_intCallStart and pPlayer.m_intCallStart == callUID then
GAMEMODE.Phone:PlayerDenyCall( pPlayer )
end
end )
end
--Player wants to pick up the phone
function GM.Phone:PlayerAnswerCall( pPlayer )
if pPlayer:IsIncapacitated() then return end
if self:GetPlayerCallState( pPlayer ) ~= "call_wait_in" then return end
if not IsValid( pPlayer.m_pCallingPlayer ) then --Player left the game after dialing
GAMEMODE.Phone:PlayerDenyCall( pPlayer )
return
end
self:SetPlayerCallState( pPlayer, "in_call" )
self:SetPlayerCallState( pPlayer.m_pCallingPlayer, "in_call" )
pPlayer.m_pInCallWith = pPlayer.m_pCallingPlayer
pPlayer.m_pCallingPlayer.m_pInCallWith = pPlayer
--Clear these so the auto deny doesn't try to end the call
pPlayer.m_intCallStart = nil
pPlayer.m_pCallingPlayer.m_intCallStart = nil
pPlayer.m_pCallingPlayer.m_pCallingPlayer = nil
pPlayer.m_pCallingPlayer = nil
self:SendCallStart( pPlayer )
self:SendCallStart( pPlayer.m_pInCallWith )
end
--Player wants to ignore the call / stop trying to call someone
function GM.Phone:PlayerDenyCall( pPlayer )
if self:GetPlayerCallState( pPlayer ) == "in_call" then
self:PlayerEndCall( pPlayer )
return
end
if self:GetPlayerCallState( pPlayer ) ~= "call_wait_in" and self:GetPlayerCallState( pPlayer ) ~= "call_wait_out" then return end
if IsValid( pPlayer.m_pCallingPlayer ) then
self:SetPlayerCallState( pPlayer.m_pCallingPlayer, nil )
self:SendCallEnd( pPlayer.m_pCallingPlayer )
pPlayer.m_pCallingPlayer.m_pCallingPlayer = nil
pPlayer.m_pCallingPlayer.m_intCallStart = nil
end
pPlayer.m_intCallStart = nil
pPlayer.m_pCallingPlayer = nil
self:SetPlayerCallState( pPlayer, nil )
self:SendCallEnd( pPlayer )
end
--One of the players has hung up
function GM.Phone:PlayerEndCall( pPlayer )
if self:GetPlayerCallState( pPlayer ) ~= "in_call" then return end
if IsValid( pPlayer.m_pInCallWith ) then
self:SetPlayerCallState( pPlayer.m_pInCallWith, nil )
self:SendCallEnd( pPlayer.m_pInCallWith )
pPlayer.m_pInCallWith.m_pInCallWith = nil
end
pPlayer.m_pInCallWith = nil
self:SetPlayerCallState( pPlayer, nil )
self:SendCallEnd( pPlayer )
end
function GM.Phone:PlayerDisconnected( pPlayer )
local state = self:GetPlayerCallState( pPlayer )
if state == "in_call" or state == "call_wait_in" or state == "call_wait_out" then
self:PlayerDenyCall( pPlayer )
end
end
function GM.Phone:PlayerCanHearPlayersVoice( pPlayer1, pPlayer2 )
if self:GetPlayerCallState( pPlayer1 ) ~= "in_call" or self:GetPlayerCallState( pPlayer1 ) ~= "in_call" then return false end
return pPlayer1.m_pInCallWith == pPlayer2 or pPlayer2.m_pInCallWith == pPlayer1
end
--Netcode
--Player called an invalid number
function GM.Phone:SendDialFailed( pPlayer )
GAMEMODE.Net:SendDialFailed( pPlayer )
end
--Player dialed a player that is already in a call
function GM.Phone:SendBusySignal( pPlayer )
GAMEMODE.Net:SendBusySignal( pPlayer )
end
--Player accepted a call
function GM.Phone:SendCallStart( pPlayer )
GAMEMODE.Net:SendCallStart( pPlayer )
if pPlayer.m_strRingTimerID then
timer.Destroy( pPlayer.m_strRingTimerID )
pPlayer.m_strRingTimerID = nil
end
end
--Player has ended the phone call
function GM.Phone:SendCallEnd( pPlayer )
GAMEMODE.Net:SendCallEnd( pPlayer )
if pPlayer.m_strRingTimerID then
timer.Destroy( pPlayer.m_strRingTimerID )
pPlayer.m_strRingTimerID = nil
end
end
--Tell player they are trying to call someone
function GM.Phone:SendOutgoingCall( pPlayer, pCalling )
GAMEMODE.Net:SendOutgoingCall( pPlayer, pCalling )
end
--Tell player that another player is trying to call them
function GM.Phone:SendIncomingCall( pPlayer, pCaller )
GAMEMODE.Net:SendIncomingCall( pPlayer, pCaller )
pPlayer.m_strRingTimerID = "PhoneRing_".. pPlayer:EntIndex()
pPlayer:EmitSound( "taloslife/ringtone.wav" )
timer.Create( pPlayer.m_strRingTimerID, 4, 0, function()
if not IsValid( pPlayer ) then timer.Destroy( pPlayer.m_strRingTimerID or "" ) return end
pPlayer:EmitSound( "taloslife/ringtone.wav" )
end )
end
--[[ Texting ]]--
function GM.Phone:PlayerSendTextMessage( pSender, strText, strNumberSendTo )
if pSender:IsIncapacitated() then return end
strText = string.Trim( strText or "" )
if strText == "" or strText:len() > GAMEMODE.Config.MaxTextMsgLen then return end
if hook.Call( "GamemodePlayerSendTextMessage", GAMEMODE, pSender, strText, strNumberSendTo ) then
return
end
local foundPlayer
for k, v in pairs( player.GetAll() ) do
if GAMEMODE.Player:GetGameVar( v, "phone_number" ) == strNumberSendTo then
foundPlayer = v
break
end
end
if not IsValid( foundPlayer ) or pPlayer == foundPlayer then return end
GAMEMODE.Net:SendTextMessage( foundPlayer, GAMEMODE.Player:GetGameVar(pSender, "phone_number"), strText )
foundPlayer:EmitSound( "taloslife/sms.mp3" )
end
--[[ Image Texting ]]--
function GM.Phone:PlayerSendPlayerImage( pPlayer, strSendNumber, intNumParts )
if pPlayer.m_bSendingImage then return end
if pPlayer:IsIncapacitated() then return end
local foundPlayer
for k, v in pairs( player.GetAll() ) do
if GAMEMODE.Player:GetGameVar( v, "phone_number" ) == strSendNumber then
foundPlayer = v
break
end
end
if not IsValid( foundPlayer ) or pPlayer == foundPlayer then return end
pPlayer.m_bSendingImage = true
pPlayer.m_strSendingImageTo = strSendNumber
pPlayer.m_intNumSendingImageParts = intNumParts
pPlayer.m_intCurSendingImagePart = 0
pPlayer.m_strSendingImageData = ""
GAMEMODE.Net:RequestNextImagePart( pPlayer )
end
function GM.Phone:PlayerSendImagePart( pPlayer, strPartData )
if not pPlayer.m_bSendingImage then return end
pPlayer.m_intCurSendingImagePart = pPlayer.m_intCurSendingImagePart +1
pPlayer.m_strSendingImageData = pPlayer.m_strSendingImageData.. strPartData
if pPlayer.m_intNumSendingImageParts < pPlayer.m_intCurSendingImagePart then
GAMEMODE.Net:RequestNextImagePart( pPlayer )
else
pPlayer.m_bSendingImage = false
GAMEMODE.Net:SendImagePartsDone( pPlayer )
local foundPlayer
for k, v in pairs( player.GetAll() ) do
if GAMEMODE.Player:GetGameVar( v, "phone_number" ) == pPlayer.m_strSendingImageTo then
foundPlayer = v
break
end
end
if not IsValid( foundPlayer ) or pPlayer == foundPlayer then return end
GAMEMODE.Net:SendImageDataToPlayer( foundPlayer, GAMEMODE.Player:GetGameVar(pPlayer, "phone_number"), pPlayer.m_strSendingImageData )
pPlayer.m_strSendingImageData = nil
foundPlayer:EmitSound( "taloslife/sms.mp3" )
end
end
hook.Add( "GamemodeDefineGameVars", "DefinePhoneData", function( pPlayer )
GAMEMODE.Player:DefineGameVar( pPlayer, "phone_number", "", "String", true )
end )
hook.Add( "GamemodePlayerSelectCharacter", "ApplyPhoneData", function( pPlayer )
local saveTable = GAMEMODE.Char:GetCurrentSaveTable( pPlayer )
if not saveTable then return end
if not saveTable.PhoneNumber then
GAMEMODE.Phone:GeneratePlayerNumber( pPlayer )
end
GAMEMODE.Player:SetGameVar( pPlayer, "phone_number", saveTable.PhoneNumber, true )
end )
hook.Add( "PlayerDeath", "HangUp", function( pPlayer )
GAMEMODE.Phone:PlayerDenyCall( pPlayer )
end )
hook.Add( "PlayerCanPickupWeapon", "DetectCuffs", function( pPlayer, entWep )
if entWep:GetClass() == "weapon_handcuffed" or entWep:GetClass() == "weapon_ziptied" then
GAMEMODE.Phone:PlayerDenyCall( pPlayer )
end
end ) |
-- Library for the Helium Atom on-board lps22hb sensor
i2c = he.i2c
lps22hb = {
DEFAULT_ADDRESS = 0x5C,
WHO_AM_I = 0x8F,
CTRL_REG2 = 0x11,
CTRL_REG2_ONESHOT = 0x11,
PRESS_OUT_XL = 0x28,
TEMP_OUT_L = 0xAB
}
function lps22hb:new(address)
address = address or lps22hb.DEFAULT_ADDRESS
-- We use a simple lua object system as defined
-- https://www.lua.org/pil/16.1.html
-- construct the object table
local o = { address = address }
-- ensure that the "class" is the metatable
setmetatable(o, self)
-- and that the metatable's index function is set
-- Refer to https://www.lua.org/pil/16.1.html
self.__index = self
he.power_set(true)
-- Check that the sensor is connected
status, reason = o:is_connected()
if not status then
return status, reason
end
return o
end
function lps22hb:is_connected()
-- get the WHO_AM_I byte - datasheet section 8, table 16
local result = self:_get(self.WHO_AM_I, "B")
-- 0xB1 is the WHO_AM_I value as defined by the datasheet table 16
if not (result == 0xB1) then
return false, "could not locate device"
end
return true
end
function lps22hb:read_temperature()
-- perform a oneshot reading and get the temperature
return self:_oneshot_read(self._temp_get)
end
function lps22hb:read_pressure()
-- perform a oneshot reading and get the pressure
return self:_oneshot_read(self._pressure_get)
end
function lps22hb:_get(reg, pack_fmt, convert)
-- number of bytes to read based on the pack string
local pack_size = string.packsize(pack_fmt)
local status, buffer = i2c.txn(i2c.tx(self.address, reg),
i2c.rx(self.address, pack_size))
if not status then
return false, "failed to get value from device"
end
-- call conversion function if given
if convert then
return convert(string.unpack(pack_fmt, buffer))
end
return string.unpack(pack_fmt, buffer)
end
function lps22hb:_pressure_get()
-- get the pressure data - datasheet section 9.18
-- read 24 bits, the part will conveniently increment the register
-- to do this in one go to cover PRESS_OUT_L and PRESS_OUT_H
local result, reason = self:_get(self.PRESS_OUT_XL, "<i3")
if not result then
return result, reason
end
return result / 40.96 --pascals
end
function lps22hb:_temp_get()
-- get the temperature data - datasheet section 9.19
-- read 16 bits, the part will conveniently increment the register
-- to do this in one go to cover TEMP_OUT_L and TEMP_OUT_H
local result, reason = self:_get(self.TEMP_OUT_L, "<i2")
if not result then
return result, reason
end
return result / 100.0 -- C
end
function lps22hb:_oneshot_read(func)
-- request a one shot reading
-- datasheet section 9.6
local status =
i2c.txn(i2c.tx(self.address, self.CTRL_REG2, self.CTRL_REG2_ONESHOT))
if not status then
return false, "failed to start reading"
end
-- now loop reading the CTRL_REG2 register
-- until the oneshot bit clears
-- datasheet section 9.6 ONE_SHOT documentation
repeat
local result, reason = self:_get(self.CTRL_REG2, "B")
if not result then
return result, reason
end
until (result & 0x01) == 0
-- call the passed in function to actually get the specific value
return func(self)
end
return lps22hb
|
--[[
Copyright 2015 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]
local HostInfo = require('./base').HostInfo
local misc = require('./misc')
local async = require('async')
local fs = require('fs')
local path = require('path')
local Transform = require('stream').Transform
local tableToString = require('virgo/util/misc').tableToString
--------------------------------------------------------------------------------------------------------------------
local Reader = Transform:extend()
function Reader:initialize()
Transform.initialize(self, {objectMode = true})
end
function Reader:_transform(line, cb)
local time, cmd = line:match("(@%l+)%s+(.+)")
if time then
self:push({
time = time,
command = cmd
})
cb()
else
local m, h, dom, mon, dow, command =
line:match("(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(.+)")
self:push({
time = time,
m = m,
h = h,
dom = dom,
mon = mon,
dow = dow,
command = command
})
cb()
end
end
--------------------------------------------------------------------------------------------------------------------
--[[ Cron ]]--
local Info = HostInfo:extend()
function Info:initialize()
HostInfo.initialize(self)
end
function Info:_run(callback)
local errTable, outTable = {}, {}
local deb = {dir = '/var/spool/cron/crontabs' }
local rhel = {dir = '/var/spool/cron'}
local options = {
ubuntu = deb,
debian = deb,
rhel = rhel,
centos = rhel,
fedora = rhel,
default = nil
}
local vendorInfo, dir
vendorInfo = misc.getInfoByVendor(options)
if not vendorInfo.dir then
self._error = string.format("Couldn't decipher linux distro for check %s", self:getType())
return callback()
end
dir = vendorInfo.dir
local function finalCb()
-- We wanna be able to return empty sets for empty crontabs therefore we dont use self:_pushparams
if errTable then
if #errTable ~= 0 and not next(outTable) then
self._error = tableToString(errTable, ' ')
end
end
self._params = outTable
return callback()
end
local function onreadDir(err, files)
if err then misc.safeMerge(errTable, err) end
if not files or #files == 0 then
return finalCb()
end
async.forEachLimit(files, 5, function(file, cb)
local readStream = misc.read(path.join(dir, file))
local reader = Reader:new()
-- Catch no file found errors
readStream:on('error', function(err)
misc.safeMerge(errTable, err)
return cb()
end)
readStream:pipe(reader)
reader:on('data', function(data) misc.safeMerge(outTable, data) end)
reader:on('error', function(err) misc.safeMerge(errTable, err) end)
reader:once('end', cb)
end, finalCb)
end
fs.readdir(dir, onreadDir)
end
function Info:getType()
return 'CRON'
end
function Info:getPlatforms()
return {'linux'}
end
exports.Info = Info
exports.Reader = Reader
|
vim.g.matchup_matchparen_deferred = 1
vim.g.matchup_matchparen_deferred_hide_delay = 300
vim.g.matchup_matchparen_offscreen = { method = 'popup' }
|
object_tangible_quest_empire_day_crash_site_05_crate_04_container = object_tangible_quest_empire_day_shared_crash_site_05_crate_04_container:new {
}
ObjectTemplates:addTemplate(object_tangible_quest_empire_day_crash_site_05_crate_04_container, "object/tangible/quest/empire_day/crash_site_05_crate_04_container.iff")
|
function Utils:ShowHorseSelection()
self.ChooseHorseVisible = true
BeginScaleformMovieMethod(self.Scaleform, 'SHOW_SCREEN')
ScaleformMovieMethodAddParamInt(1)
EndScaleformMovieMethod()
end
function Utils.AddHorses(scaleform)
for i = 1, 6 do
local name = Utils.GetRandomHorseName()
BeginScaleformMovieMethod(scaleform, 'SET_HORSE')
ScaleformMovieMethodAddParamInt(i) -- Horse index
-- Horse name
BeginTextCommandScaleformString(name)
EndTextCommandScaleformString()
ScaleformMovieMethodAddParamPlayerNameString('Cool Horse')
-- Horse style (TODO: Random preset, different one for each horse)
ScaleformMovieMethodAddParamInt(Utils.HorseStyles[i][1])
ScaleformMovieMethodAddParamInt(Utils.HorseStyles[i][2])
ScaleformMovieMethodAddParamInt(Utils.HorseStyles[i][3])
ScaleformMovieMethodAddParamInt(Utils.HorseStyles[i][4])
EndScaleformMovieMethod()
end
end |
#!/usr/bin/env lua5.4
local function _split(str, on, set)
local ret = {};
local s, e;
while str:find(on) do
s, e = str:find(on);
local result = str:sub(0, s - 1);
if set then
ret[result] = "";
else
table.insert(ret, result);
end
str = str:sub(e + 1);
end
if set then
ret[str] = "";
else
table.insert(ret, str);
end
return ret;
end
local function repeats(s,c)
local _,n = s:gsub(c,"")
return n
end
local total = 0
local f = io.input(arg[1])
for line in f:lines() do
local param = _split(line:gsub(":","")," ") -- had to peek for this one
local passRange = _split(param[1], "-")
local targetLetter = param[2]
local password = param[3]
local letterMatch = repeats(password, targetLetter)
if letterMatch >= tonumber(passRange[1]) and letterMatch <= tonumber(passRange[2]) then
total = total + 1
end
end
print(total)
f:close()
|
-- Run this Lua script from the project root.
local lxsh = require 'lxsh'
local delete_intermediates = true
local function readfile(path)
local handle = assert(io.open(path))
local data = assert(handle:read '*a')
assert(handle:close())
return data
end
local function writefile(path, data)
local handle = assert(io.open(path, 'w'))
handle:write(data)
local nbytes = handle:seek()
assert(handle:close())
return nbytes
end
for _, formatter in ipairs { lxsh.formatters.html, lxsh.formatters.rtf, lxsh.formatters.latex } do
for _, colors in ipairs { 'earendel', 'slate', 'wiki' } do
local function demo(infile, outfile, highlighter)
local input = readfile(infile)
local nbytes = writefile(outfile, highlighter(input, {
demo = true,
external = true,
colors = lxsh.colors[colors],
formatter = formatter,
}))
io.stderr:write(('Wrote %iK to %s!\n'):format(nbytes/1024, outfile))
if outfile:find '%.tex$' then
-- Try to run the LaTeX PDF compiler (tested on Ubuntu 10.04 with texlive).
-- Requires "Bera Mono" (try `sudo apt-get install texlive-fonts-extra').
local outdir, filename = outfile:match '^(.-)([^/]*)$'
local command = 'pdflatex -interaction batchmode -halt-on-error ' .. filename -- .. ' >/dev/null 2>&1'
io.stderr:write(" - Compiling ", outfile:gsub('%.tex$', '.pdf'), ": ")
local status = os.execute('cd ' .. outdir .. ' && ' .. command .. ' && ' .. command)
io.stderr:write(status == 0 and "OK" or "Failed! (do you have LaTeX installed?)", "\n")
-- Cleanup temporary files.
if delete_intermediates and status == 0 then os.remove(outfile) end
os.remove((outfile:gsub('%.tex$', '.aux')))
os.remove((outfile:gsub('%.tex$', '.log')))
os.remove((outfile:gsub('%.tex$', '.out')))
end
end
-- Highlight example Lua source code (from my Lua/APR binding).
demo('examples/apr.lua', 'examples/' .. colors .. '/apr.lua' .. formatter.extension, lxsh.highlighters.lua)
-- Highlight example Lua source code copied from the interactive prompt.
demo('examples/prompt.lua', 'examples/' .. colors .. '/prompt.lua' .. formatter.extension, lxsh.highlighters.lua)
-- Highlight example C source code (also from my Lua/APR binding).
demo('examples/lua_apr.c', 'examples/' .. colors .. '/lua_apr.c' .. formatter.extension, lxsh.highlighters.c)
-- Highlight example BibTeX entry (from http://en.wikipedia.org/wiki/BibTeX#Examples).
demo('examples/entry.bib', 'examples/' .. colors .. '/entry.bib' .. formatter.extension, lxsh.highlighters.bib)
-- Highlight example shell script code (something random from my ~/bin).
demo('examples/gvim.sh', 'examples/' .. colors .. '/gvim.sh' .. formatter.extension, lxsh.highlighters.sh)
end
end
|
-----------------------------------------
-- ID: 4762
-- Scroll of Aero
-- Teaches the black magic Aero
-----------------------------------------
function onItemCheck(target)
return target:canLearnSpell(154)
end
function onItemUse(target)
target:addSpell(154)
end
|
--
-- Created by IntelliJ IDEA.
-- User: macbookair
-- Date: 20/04/17
-- Time: 14:43
-- To change this template use File | Settings | File Templates.
--
local Observable = require("lib.util.observable")
GeoLocation = Observable:extend("GeoLocation")
local instance = GeoLocation()
GeoLocation.instance = instance
instance = nil
--[[
-- Notify observers when a location update happens.
-- Should not be called directly.
]]
function locationChanged()
local location = GeoLocation.instance._nativeObject:getLocation()
local event = GeoLocation:getEventFromLocation(location)
GeoLocation.super.notify(GeoLocation.instance, event)
end
function GeoLocation:new()
error("Cannot instantiate Geolocation. Call getInstance() instead")
end
--[[
--
]]
function GeoLocation:getInstance()
if self.instance._nativeObject == nil then
self.instance._nativeObject = GeoLocationNative:newGeoLocationNative()
end
return self.instance
end
function GeoLocation:_retrieveLocation(locationType, callback, options)
if callback ~= nil and type(callback) == "function" then
GeoLocation.super.attach(GeoLocation.instance, callback)
if self.instance ~= nil and type(self.instance) == "table" and
self.instance._nativeObject ~= nil then
-- if not specified, minTime and minDistance will be set to default: 1minute or 200 meters.
options = options or {}
options.minTime = options.minTime or 0
options.minDistance = options.minDistance or 100
options.type = locationType or "oneUpdate"
options.callback = locationChanged
print("vai chamar")
print(locationChanged)
self.instance._nativeObject:retrieveLocation(options)
end
end
end
function GeoLocation:stop()
if self.instance ~= nil and type(self.instance) == "table" and
self.instance._nativeObject ~= nil then
GeoLocation.instance._nativeObject:stop()
end
end
--[[
-- Register your application to receive user's GPS positioning over a period of time or distance.
-- Location updates will be sent to a callback which will receive a parameter with two properties: lat and long.
-- You should use this method only if your application demands continous data about user's geolocation (such a Map application), as it consumes more battery.
--
-- @param callback - a function which will be called to receive user's geolocation.
-- @param options - a table with two keys: minTime and minDistance. minTime is the minimum time interval between location updates in milliseconds (long). minDistance minimum distance between location in meters.
-- @return void.
]]
function GeoLocation:startReceivingLocation(callback, options)
GeoLocation:_retrieveLocation("multipleUpdate", callback, options)
end
function GeoLocation:getCurrentLocation(callback)
GeoLocation:_retrieveLocation("oneUpdate", callback)
end
function GeoLocation:getEventFromLocation(location)
if type(location) == "table" or type(location) == "userdata" then
if location["getLatitude"] ~= nil and location["getLongitude"] ~= nil then
local lat = location:getLatitude()
local long = location:getLongitude()
local event = {lat=lat, long=long}
return event
end
end
return nil
end
return GeoLocation |
-- LuaRocks configuration for use with Lua 5.3
lua_interpreter = "lua5.3"
variables = {
LUA_DIR = "/usr",
LUA_INCDIR = "/usr/include/lua5.3",
LUA_LIBDIR = "/usr/lib/x86_64-linux-gnu",
LUA_BINDIR = "/usr/bin",
}
|
local Networking = script:GetCustomProperty("Networking"):WaitForObject()
local Objects = script:GetCustomProperty("Objects"):WaitForObject()
local Triggers = script:GetCustomProperty("Triggers"):WaitForObject()
local IceVFX = script:GetCustomProperty("IceVFX")
local IceSound = script:GetCustomProperty("IceSound")
local Level1SealFolder = script:GetCustomProperty("1"):WaitForObject()
local Level2SealFolder = script:GetCustomProperty("2"):WaitForObject()
local L1Seal = {}
local L2Seal = {}
local phaseMap = {}
local listeners = {}
local currentPhase = 0
function OnOverlap(trigger, obj, phase)
if currentPhase >= phase and Object.IsValid(obj) and obj:IsA("Player") then
print("Spawned")
World.SpawnAsset(IceVFX, {position = obj:GetWorldPosition()})
World.SpawnAsset(IceSound, {position = obj:GetWorldPosition()})
end
end
function Initialize()
for i, phaseFolder in ipairs(Objects:GetChildren()) do
phaseMap[i] = phaseFolder
end
for i, seal in ipairs(Level1SealFolder:GetChildren()) do
L1Seal[i] = seal
end
for i, seal in ipairs(Level2SealFolder:GetChildren()) do
L2Seal[i] = seal
end
for i, folder in ipairs(Triggers:GetChildren()) do
for _, trigger in ipairs(folder:GetChildren()) do
listeners[trigger] = trigger.beginOverlapEvent:Connect(OnOverlap, i)
end
end
end
Initialize()
function UpdateState(obj, key)
local value = obj:GetCustomProperty(key)
if key == "Level" then
for i, val in ipairs(phaseMap) do
val.visibility = Visibility.FORCE_OFF
end
elseif key == "Phase" then
currentPhase = value
if value > 0 then
phaseMap[value].visibility = Visibility.INHERIT
else
for i, val in ipairs(phaseMap) do
val.visibility = Visibility.FORCE_OFF
end
end
if value == 0 then
Level1SealFolder:StopRotate()
Level2SealFolder:StopRotate()
end
if value == 1 then
Level1SealFolder:RotateContinuous(Rotation.New(0, 0, 30))
Level2SealFolder:RotateContinuous(Rotation.New(0, 0, 30))
end
for i = 1, 7 do
if i >= value then
L1Seal[i].visibility = Visibility.INHERIT
L2Seal[i].visibility = Visibility.INHERIT
else
L1Seal[i].visibility = Visibility.FORCE_OFF
L2Seal[i].visibility = Visibility.FORCE_OFF
end
end
end
end
function OnDestroyed(obj)
for key, listener in pairs(listeners) do
listener:Disconnect()
listeners[key] = nil
end
listeners = nil
end
script.destroyEvent:Connect(OnDestroyed)
UpdateState(Networking, "Level")
UpdateState(Networking, "Phase")
Networking.customPropertyChangedEvent:Connect(UpdateState) |
return function(rt)
--@sec: Style
--@def: type Style
--@doc: Style manages the properties of an object by applying values according
-- to a particular Theme.
local Style = {__index={}}
--@sec: Style.new
--@ord: -1
--@def: Style.new(theme: Theme): Style
--@doc: new returns a new Style that applies styles according to *theme*.
local function new(theme)
assert(theme, "Theme expected")
local self = setmetatable({
theme = theme,
defs = {},
objects = {},
}, Style)
return self
end
local function updateProperty(self, object, property)
local state = self.objects[object]
local map = state.map
if type(map) == "string" then
map = self.def[map]
end
if type(map) == "table" then
local value = self.theme:Field(map[property], state.flagbits)
if value ~= nil then
object[property] = value
end
end
end
local function updateObject(self, object)
local theme = self.theme
local state = self.objects[object]
local flags = state.flagbits
local map = state.map
if type(map) == "string" then
map = self.def[map]
end
if type(map) == "table" then
for property, field in pairs(map) do
local value = theme:Field(field, flags)
if value ~= nil then
object[property] = value
end
end
end
end
local function updateAll(self)
local theme = self.theme
for object, state in pairs(self.objects) do
local flags = state.flagbits
local map = state.map
if type(map) == "string" then
map = self.def[map]
end
if type(map) == "table" then
for property, field in pairs(map) do
local value = theme:Field(field, flags)
if value ~= nil then
object[property] = value
end
end
end
end
end
--@sec: Style.Define
--@def: Style:Define(name: string, map: Dictionary<string>?, update: boolean?)
--@doc: Define assigns to *name* a set of property names mapped to theme fields.
-- If *update* is true, then all objects attached to the style are updated.
function Style.__index:Define(name, map, update)
assert(type(name) == "string")
assert(map == nil or type(map) == "table")
if type(map) == "table" then
local m = {}
for k, v in pairs(map) do
if type(k) == "string" and type(v) == "string" then
m[k] = v
end
end
self.defs[name] = m
else
self.defs[name] = nil
end
if update == true then
updateAll(self)
end
end
--@sec: Style.Attach
--@def: Style:Attach(object: Instance|string, map: string|Dictionary<string|Dictionary<string>>, update: boolean?): Instance
--@doc: Attach attaches *map* to *object*. If *object* is a string, then a new
-- instance of the given class will be created. If *map* is a string, then it
-- indicates the name of a definition. Otherwise, it must be a table of property
-- names mapped to theme fields. If *update* is true or unspecified, then the
-- object will be updated. Returns the object.
function Style.__index:Attach(object, map, update)
assert(type(map) == "string" or type(map) == "table")
local state = self.objects[object]
if state == nil then
state = {
flags = {},
flaglist = {},
flagbits = 0,
map = nil,
}
self.objects[object] = state
end
if type(map) == "string" then
state.map = map
else
local m = {}
for k, v in pairs(map) do
local tv = type(v)
if type(k) == "string" and (tv == "string" or tv == "table" or tv == "function") then
m[k] = v
end
end
state.map = m
end
if update == true or update == nil then
updateObject(self, object)
end
return object
end
--@sec: Style.Detach
--@def: Style:Detach(object: Instance)
--@doc: Detach removes the association of the object.
function Style.__index:Detach(object)
self.objects[object] = nil
end
--@sec: Style.Update
--@def: Style:Update(object: Instance?, property: string?)
--@doc: Update updates the properties of all attached objects. If *object* is
-- specified, then only that attached object is updated. If *property* is also
-- specified, then only that property of *object* is updated.
function Style.__index:Update(object, property)
if self.objects[object] then
if type(property) == "string" then
updateProperty(self, object, property)
return
end
updateObject(self, object)
return
end
updateAll(self)
end
--@sec: Style.Theme
--@def: Style:Theme(): Theme
--@doc: Theme returns the current theme used by the Style.
function Style.__index:Theme()
return self.theme
end
--@sec: Style.SetTheme
--@def: Style:SetTheme(theme: Theme, update: boolean?)
--@doc: SetTheme sets the current theme used by the Style. If *update* is true
-- or unspecified, then all attached objects will be updated.
function Style.__index:SetTheme(theme, update)
assert(theme, "Theme expected")
self.theme = theme
for _, state in pairs(self.objects) do
state.flagbits = self.theme:Flags(state.flaglist)
end
if update == true or update == nil then
updateAll(self)
end
end
--@sec: Style.Flags
--@def: Style:Flags(object: GuiObject): {string}?
--@doc: Flags returns the flags set for *object*. Returns nil if *object* is not
-- attached.
function Style.__index:Flags(object)
local state = self.objects[object]
if state == nil then
return nil
end
local flags = {}
for flag in pairs(state.flags) do
table.insert(flags, flag)
end
table.sort(flags)
return flags
end
--@sec: Style.HasFlags
--@def: Style:HasFlags(object: GuiObject, flags: ...string): bool
--@doc: HasFlags returns true when *object* has all of the given flags, and
-- false otherwise. Flags not known by the style's theme are ignored. Returns
-- false if *object* is not attached.
function Style.__index:HasFlags(object, ...)
local state = self.objects[object]
if state == nil then
return false
end
for _, flag in ipairs({...}) do
if type(flag) == "string" and flag ~= "Default" then
if not state.flags[flag] then
return false
end
end
end
return true
end
local function fastremove(t, value)
local n = #t
if n == 1 and t[1] == value then
t[1] = nil
return
end
local i = table.find(t, value)
if i == nil then
return
end
t[i] = t[n]
t[n] = nil
end
local function fastinsert(t, value)
if table.find(t, value) ~= nil then
return
end
table.insert(t, value)
end
--@sec: Style.SetFlags
--@def: Style:SetFlags(object: GuiObject, flags: ...string)
--@doc: SetFlags sets each of the given flags on *object*. Does nothing if
-- *object* is not attached.
function Style.__index:SetFlags(object, ...)
local state = self.objects[object]
if state == nil then
return
end
for _, flag in ipairs({...}) do
if type(flag) == "string" and flag ~= "Default" then
state.flags[flag] = true
fastinsert(state.flaglist, flag)
end
end
state.flagbits = self.theme:Flags(state.flaglist)
updateObject(self, object)
end
--@sec: Style.UnsetFlags
--@def: Style:UnsetFlags()
--@doc: UnsetFlags unsets each of the given flags on *object*. Does nothing if
-- *object* is not attached.
function Style.__index:UnsetFlags(object, ...)
local state = self.objects[object]
if state == nil then
return
end
for _, flag in ipairs({...}) do
if type(flag) == "string" and flag ~= "Default" then
state.flags[flag] = nil
fastremove(state.flaglist, flag)
end
end
state.flagbits = self.theme:Flags(state.flaglist)
updateObject(self, object)
end
--@sec: Style.SetExclusiveFlags
--@def: Style:SetExclusiveFlags()
--@doc: SetExclusiveFlags unsets all of the flags on *object*, then sets each of
-- the given flags. Does nothing if *object* is not attached.
function Style.__index:SetExclusiveFlags(object, ...)
local state = self.objects[object]
if state == nil then
return
end
state.flags = {}
state.flaglist = {}
for _, flag in ipairs({...}) do
if type(flag) == "string" and flag ~= "Default" then
state.flags[flag] = true
fastinsert(state.flaglist, flag)
end
end
state.flagbits = self.theme:Flags(state.flaglist)
updateObject(self, object)
end
--@sec: Style.Destroy
--@def: Style:Destroy()
--@doc: Destroy releases any resources held by the object.
function Style.__index:Destroy()
self.defs = {}
self.objects = {}
end
return {
new = new,
}
end
|
-- Load scripts required by this pack
ScriptHost:LoadScript("scripts/settings.lua")
ScriptHost:LoadScript("scripts/access.lua")
ScriptHost:LoadScript("scripts/area.lua")
if _VERSION == "Lua 5.3" then
ScriptHost:LoadScript("scripts/autotracking.lua")
else
print("Auto-tracker is unsupported by your tracker version")
function isAutoTracking()
return false
end
function isNotAutoTracking()
return true
end
end
-- Load items
-- Hosted items don't work without this??
Tracker:AddItems("items.json")
-- Load maps
Tracker:AddMaps("maps/maps.json")
if Tracker.ActiveVariantUID == "dungeon_shuffle_hard" then
ScriptHost:LoadScript("scripts/shuffle.lua")
Tracker:AddLocations("maps/hard/locations.json")
Tracker:AddLocations("maps/dungeon_shuffle/hard.json")
end
if Tracker.ActiveVariantUID == "dungeon_shuffle" then
ScriptHost:LoadScript("scripts/shuffle.lua")
Tracker:AddLocations("maps/normal/locations.json")
Tracker:AddLocations("maps/dungeon_shuffle/normal.json")
end
if Tracker.ActiveVariantUID == "hard" then
Tracker:AddLocations("maps/hard/locations.json")
Tracker:AddLocations("maps/hard/dungeons.json")
end
if Tracker.ActiveVariantUID == "standard" then
Tracker:AddLocations("maps/normal/locations.json")
Tracker:AddLocations("maps/normal/dungeons.json")
end
|
data:extend(
{
{
type = "technology",
name = "miner-2",
icon = "__DyTech-Mining__/graphics/technology/miner.png",
effects =
{
{
type = "unlock-recipe",
recipe = "basic-mining-drill-mk2"
},
{
type = "unlock-recipe",
recipe = "rotor1"
},
{
type = "unlock-recipe",
recipe = "blade1"
},
{
type = "unlock-recipe",
recipe = "frame1"
},
{
type = "unlock-recipe",
recipe = "item-exit1"
},
},
prerequisites = {"steel-processing"},
unit =
{
count = 200,
ingredients =
{
{"science-pack-2", 2},
},
time = 15
},
order = "m-2"
},
{
type = "technology",
name = "miner-3",
icon = "__DyTech-Mining__/graphics/technology/miner.png",
effects =
{
{
type = "unlock-recipe",
recipe = "basic-mining-drill-mk3"
},
{
type = "unlock-recipe",
recipe = "rotor2"
},
{
type = "unlock-recipe",
recipe = "blade2"
},
{
type = "unlock-recipe",
recipe = "frame2"
},
{
type = "unlock-recipe",
recipe = "item-exit2"
},
},
prerequisites = {"miner-2"},
unit =
{
count = 400,
ingredients =
{
{"science-pack-2", 2},
{"science-pack-3", 2},
},
time = 30
},
order = "m-3",
upgrade = true,
},
{
type = "technology",
name = "miner-4",
icon = "__DyTech-Mining__/graphics/technology/miner.png",
effects =
{
{
type = "unlock-recipe",
recipe = "basic-mining-drill-mk4"
},
{
type = "unlock-recipe",
recipe = "rotor3"
},
{
type = "unlock-recipe",
recipe = "blade3"
},
{
type = "unlock-recipe",
recipe = "frame3"
},
{
type = "unlock-recipe",
recipe = "item-exit3"
},
},
prerequisites = {"miner-3"},
unit =
{
count = 600,
ingredients =
{
{"science-pack-2", 2},
{"science-pack-2", 2},
{"alien-science-pack", 2},
},
time = 45
},
order = "m-4",
upgrade = true,
},
{
type = "technology",
name = "miner-5",
icon = "__DyTech-Mining__/graphics/technology/miner.png",
effects =
{
{
type = "unlock-recipe",
recipe = "basic-mining-drill-mk5"
},
{
type = "unlock-recipe",
recipe = "rotor4"
},
{
type = "unlock-recipe",
recipe = "frame4"
},
{
type = "unlock-recipe",
recipe = "item-exit4"
},
},
prerequisites = {"miner-4"},
unit =
{
count = 800,
ingredients =
{
{"science-pack-2", 2},
{"science-pack-2", 2},
{"alien-science-pack", 2},
},
time = 60
},
order = "m-5",
upgrade = true,
},
{
type = "technology",
name = "miner-6",
icon = "__DyTech-Mining__/graphics/technology/miner.png",
effects =
{
{
type = "unlock-recipe",
recipe = "basic-mining-drill-mk6"
},
},
prerequisites = {"miner-5"},
unit =
{
count = 1000,
ingredients =
{
{"science-pack-2", 10},
{"science-pack-2", 10},
{"alien-science-pack", 10},
-- {"science-pack-4", 10}, to be added in a future version!
},
time = 150
},
order = "m-6",
upgrade = true,
},
}
) |
-- https://zzamboni.org/post/my-hammerspoon-configuration-with-commentary/
hs.loadSpoon("SpoonInstall")
spoon.SpoonInstall.use_syncinstall = true
Install=spoon.SpoonInstall
Install:andUse("URLDispatcher",
{
config = {
url_patterns = {
{"zoom.us/j/", "us.zoom.xos"}
-- { "https?://3.basecamp.com", "org.mozilla.firefox" },
-- { "https?://basecamp.com", "org.mozilla.firefox" },
-- { "https?://app.everhour.com", "org.mozilla.firefox" },
},
default_handler = "com.apple.Safari"
},
start = true
}
)
hs.loadSpoon('ControlEscape'):start() -- Load Hammerspoon bits from https://github.com/jasonrudolph/ControlEscape.spoon
require('windows')
hs.notify.show("Welcome to Hammerspoon", "Have fun!", "")
|
local screenWidth, screenHeight = guiGetScreenSize()
dxConfig = {
color = {
["button"] = {
Rectangl = tocolor(0,0,0,100); Rectangl_move = tocolor(0,0,0,100);
Line = tocolor(255,255,255,190); Line_move = tocolor(246,194,32,190);
Text = tocolor(255,255,255,255); Text_move = tocolor(246,194,32,255);
},
};
-- Создаем новые шрифт
getFont = function ( name , size )
if assert ( name , 'Error function name font getFont(" name font " , size or default) ' ) then
local type = "dxElement/font/";
local font = {
["default"] = "default-bold",
["Bold"] = "Roboto-Bold.ttf",
["Regular"] = "Roboto-Regular.ttf",
}
if font[name] and fileExists(type..font[name]) then
local size = ( size * 10 )
return dxCreateFont(type..font[name], size ~= nil and size or 1 * 10 )
end
return font["default"]
end
end;
setFont = function ( element , font , size)
if assert ( { isElement(element) , font} , "error" ) then
if dxConfig.getFont (font,size ~= false and size or 1) then
return true
end
return false
end
end;
-- load new element
addElement = function ( class , data )
local element = createElement( class )
element:setData('data',data)
outputDebugString("Add new element class [ ".. tostring ( class ) .. " ] " )
return element
end;
drawRender = function ( )
local cursorx,cursory
if isCursorShowing() then
local mx,my = getCursorPosition ()
cursorx,cursory = mx*screenWidth,my*screenHeight
end
for a,v in ipairs ( getElementsByType ("dxdrawButton", true) ) do
local move = false
local text,x,y,w,h,font = unpack ( v:getData('data') )
if ( cursorx and cursory and cursorx > x and cursorx < x + w and cursory > y and cursory < y + h )then
move = true
end
dxDrawRectangle(x,y,w,h,move and dxConfig.color["button"].Rectangl_move or dxConfig.color["button"].Rectangl)
dxDrawLine(x, y, x, y + h, move and dxConfig.color["button"].Line_move or dxConfig.color["button"].Line, 1)
dxDrawLine(x + w, y, x + w, y + h, move and dxConfig.color["button"].Line_move or dxConfig.color["button"].Line, 1)
dxDrawLine(x, y + h, x + w, y + h, move and dxConfig.color["button"].Line_move or dxConfig.color["button"].Line, 1)
dxDrawLine(x, y, x + w, y, move and dxConfig.color["button"].Line_move or dxConfig.color["button"].Line, 1)
dxDrawText(text,x,y,x + w,y + h, move and dxConfig.color["button"].Text_move or dxConfig.color["button"].Text,1,font,"center","center")
end
end;
}
local call = dxConfig.drawRender
addEventHandler('onClientRender',root,call) |
function check_if_transport_entity(entity)
if (entity.type == "transport-belt" or (entity.type == "entity-ghost" and entity.ghost_type == "transport-belt"))
or (entity.type == "underground-belt" or (entity.type == "entity-ghost" and entity.ghost_type == "underground-belt"))
or (entity.type == "splitter" or (entity.type == "entity-ghost" and entity.ghost_type == "splitter")) then
return true
end
return false
end
function check_if_vacuum_entity(entity)
if entity then
if (entity.name == "vacuum-transport-belt" or (entity.type == "entity-ghost" and entity.ghost_name == "vacuum-transport-belt"))
or (entity.name == "vacuum-underground-belt" or (entity.type == "entity-ghost" and entity.ghost_name == "vacuum-underground-belt"))
or (entity.name == "vacuum-splitter" or (entity.type == "entity-ghost" and entity.ghost_name == "vacuum-splitter")) then
return true
end
end
return false
end
--Orientation - Up = 0 - Right = 2 - Down = 4 - Left = 6
function get_position_in_direction(entity, modifier)
local pos = entity.position
local deltaX = 0
local deltaY = 0
local dir = (entity.direction + modifier) % 8
if dir == 0 then
deltaY = -1
elseif dir == 2 then
deltaX = 1
elseif dir == 4 then
deltaY = 1
elseif dir == 6 then
deltaX = -1
end
pos = {x=pos.x+deltaX, y=pos.y+deltaY}
return pos
end
function get_entity_in_direction(entity, modifier)
local pos = get_position_in_direction(entity, modifier)
ea = game.surfaces[1].find_entities_filtered{position=pos}
if ea then
ea = ea[1]
end
return ea
end
script.on_event({defines.events.on_built_entity},
function(event)
if settings.global["vacuum-remove-restriction"].value then
return
end
local player = game.players[event.player_index]
local entity = event.created_entity
--Inserter placement
if entity.type == "inserter" or (entity.type == "entity-ghost" and entity.ghost_type == "inserter") then
local edp = game.surfaces[1].find_entities_filtered{position=entity.drop_position}
local epp = game.surfaces[1].find_entities_filtered{position=entity.pickup_position}
if edp then
edp = edp[1]
end
if epp then
epp = epp[1]
end
if check_if_vacuum_entity(edp) or check_if_vacuum_entity(epp) then
game.print("Inserters can't interact with vacuum belts.")
if entity.type ~= "entity-ghost" then
player.insert{name=entity.name, health=entity.health}
end
entity.destroy()
end
elseif check_if_vacuum_entity(entity) then
--Check for inserters
for index, inserter in pairs(game.surfaces[1].find_entities_filtered{area={{entity.position.x - 3, entity.position.y - 3}, {entity.position.x + 3, entity.position.y + 3}}, type="inserter"}) do
local edp = game.surfaces[1].find_entities_filtered{position=inserter.drop_position}
local epp = game.surfaces[1].find_entities_filtered{position=inserter.pickup_position}
if edp then
edp = edp[1]
end
if epp then
epp = epp[1]
end
if check_if_vacuum_entity(edp) or check_if_vacuum_entity(epp) then
game.print("Inserters can't interact with vacuum belts.")
if entity.type ~= "entity-ghost" then
player.insert{name=entity.name, health=entity.health}
end
entity.destroy()
return
end
end
--Check for other belts
if entity.name ~= "vacuum-splitter" then
local invalid_placement = false
local entity_ahead = get_entity_in_direction(entity, 0)
if entity_ahead and not check_if_vacuum_entity(entity_ahead, 0) and check_if_transport_entity(entity_ahead) then
invalid_placement = true
end
for i=1, 3 do
local entity_beside = get_entity_in_direction(entity, i*2)
local entity_beside_direction_pos = 0
if entity_beside then
entity_beside_direction_pos = get_position_in_direction(entity_beside, 0)
end
if entity_beside and not check_if_vacuum_entity(entity_beside, 0) and check_if_transport_entity(entity_beside)
and entity_beside_direction_pos.x == entity.position.x and entity_beside_direction_pos.y == entity.position.y then
invalid_placement = true
end
end
if invalid_placement then
game.print("Vacuum belts have to go through a vacuum splitter first in order to interact with belts.")
if entity.type ~= "entity-ghost" then
player.insert{name=entity.name, health=entity.health}
end
entity.destroy()
end
end
--Belt placement
elseif check_if_transport_entity(entity) then
local invalid_placement = false
local entity_ahead = get_entity_in_direction(entity, 0)
if entity_ahead and entity_ahead.name ~= "vacuum-splitter" and check_if_vacuum_entity(entity_ahead, 0) then
invalid_placement = true
end
for i=1, 3 do
local entity_beside = get_entity_in_direction(entity, i*2)
local entity_beside_direction_pos = 0
if entity_beside then
entity_beside_direction_pos = get_position_in_direction(entity_beside, 0)
end
if entity_beside and entity_beside.name ~= "vacuum-splitter" and check_if_vacuum_entity(entity_beside, 0)
and entity_beside_direction_pos.x == entity.position.x and entity_beside_direction_pos.y == entity.position.y then
invalid_placement = true
end
end
if invalid_placement then
game.print("Belts have to go through a vacuum splitter first in order to interact with vacuum belts.")
if entity.type ~= "entity-ghost" then
player.insert{name=entity.name, health=entity.health}
end
entity.destroy()
end
end
end
) |
object_building_content_imperial_theme_park_itp_emperor_merc_bunker = object_building_content_imperial_theme_park_shared_itp_emperor_merc_bunker:new {
}
ObjectTemplates:addTemplate(object_building_content_imperial_theme_park_itp_emperor_merc_bunker, "object/building/content/imperial_theme_park/itp_emperor_merc_bunker.iff")
|
--[[-------------------------------------------------------------------]]--[[
Copyright wiltOS Technologies LLC, 2020
Contact: www.wiltostech.com
----------------------------------------]]--
local MYSQL_DATABASE_PROVISION = 2
wOS = wOS or {}
wOS.ALCS = wOS.ALCS or {}
wOS.ALCS.Character = wOS.ALCS.Character or {}
wOS.ALCS.Character.DataStore = wOS.ALCS.Character.DataStore or {}
require('mysqloo')
local DATA = mysqloo.CreateDatabase( wOS.ALCS.Config.Character.MySQL.Host, wOS.ALCS.Config.Character.MySQL.Username, wOS.ALCS.Config.Character.MySQL.Password, wOS.ALCS.Config.Character.MySQL.Database, wOS.ALCS.Config.Character.MySQL.Port, wOS.ALCS.Config.Character.MySQL.Socket )
if not DATA then
error( "[wOS-ALCS] ALCS Character Preference MySQL Database connection failed." )
else
print( "[wOS-ALCS] ALCS Character Preference MySQL connection was successful!" )
end
local MYSQL_COLUMNS_GENERAL = "( SteamID BIGINT(64), Grip VARCHAR(255), Wield INT, Execution VARCHAR(255), CharID BIGINT(64) DEFAULT 1 )"
local MYSQL_COLUMNS_WL = "( SteamID bigint(64) UNSIGNED, Execution VARCHAR(255), CharID BIGINT(64) DEFAULT 1 )"
function wOS.ALCS.Character.DataStore:UpdateTables( vdat )
vdat = vdat or {}
local version = vdat.DBVersion or 0
if version >= MYSQL_DATABASE_PROVISION then return end
--This is about to be the most cancerous thing ever, but it will be moved to a different file eventually.
if version < 1 then
DATA:RunQuery( "CREATE TABLE IF NOT EXISTS wos_saberpref " .. MYSQL_COLUMNS_GENERAL )
DATA:RunQuery( "ALTER TABLE wos_saberpref ADD COLUMN CharID BIGINT(64) DEFAULT 1" )
DATA:RunQuery( "ALTER TABLE `wos_saberpref` ADD UNIQUE INDEX wos_charpref_UX1 (SteamID,CharID)" )
version = version + 1
end
if version < 2 then
DATA:RunQuery( "CREATE TABLE IF NOT EXISTS wos_execwl " .. MYSQL_COLUMNS_WL )
DATA:RunQuery( "ALTER TABLE wos_execwl ADD UNIQUE INDEX wos_execwl_UX1 (SteamID,Execution,CharID)" )
version = version + 1
end
if version < 3 then
DATA:RunQuery( "ALTER TABLE wos_saberpref DROP PRIMARY KEY" )
version = version + 1
end
DATA:RunQuery( "INSERT INTO wos_alcschar_schema ( ID, DBVersion ) VALUES ( '1', '" .. version .. "' ) ON DUPLICATE KEY UPDATE DBVersion='" .. version .. "'" )
end
function wOS.ALCS.Character.DataStore:Initialize()
local VERSION_CHECK = DATA:CreateTransaction()
VERSION_CHECK:Query( "SHOW TABLES LIKE 'wos_alcschar_schema'" )
VERSION_CHECK:Start( function( transaction, status, err )
if (!status) then print("[MYSQL ERROR] " .. err) end
local queries = transaction:getQueries()
local rows = queries[1]:getData()
local UCHECK = DATA:CreateTransaction()
if table.Count( rows ) < 1 then
UCHECK:Query( "CREATE TABLE IF NOT EXISTS wos_alcschar_schema ( `ID` bigint unsigned NOT NULL AUTO_INCREMENT, DBVersion bigint unsigned, PRIMARY KEY (`ID`) )" )
UCHECK:Start( function(transaction, status, err) if (!status) then print("[MYSQL ERROR] " .. err) end end )
wOS.ALCS.Character.DataStore:UpdateTables()
else
UCHECK:Query( "SELECT * FROM wos_alcschar_schema" )
UCHECK:Start( function( transaction, status, err )
if (!status) then print("[MYSQL ERROR] " .. err) end
local queries = transaction:getQueries()
local dat = queries[1]:getData()
wOS.ALCS.Character.DataStore:UpdateTables( dat[1] )
end )
end
end )
end
function wOS.ALCS.Character.DataStore:LoadPlayerData( ply )
if not ply then return end
if ply:IsBot() then return end
local charid = wOS.ALCS:GetCharacterID( ply ) or 1
if charid < 1 then return end
ply.WOS_Preferences = {
Grip = "Standard",
Wield = false,
Execution = false,
}
ply.WOS_ExecutionWhitelists = {}
ply.WOS_AvailableGrips = {}
local TRANS = DATA:CreateTransaction()
TRANS:Prepare( "SELECT * FROM wos_saberpref WHERE SteamID = ? AND CharID = ?", { ply:SteamID64(), charid } )
TRANS:Prepare( "SELECT * FROM wos_execwl WHERE SteamID = ? AND CharID = ?", { ply:SteamID64(), charid } )
TRANS:Start(function(transaction, status, err)
if (!status) then print("[MYSQL ERROR] " .. err) return end
local queries = transaction:getQueries()
local pref_data = queries[1]:getData()
if table.Count( pref_data ) > 0 then
pref_data = pref_data[1]
local exec = pref_data.Execution
if wOS.ALCS.ExecSys and wOS.ALCS.ExecSys.Executions then
if wOS.ALCS.ExecSys.Executions[ exec ] then
ply.WOS_Preferences.Execution = exec
end
end
local grip = pref_data.Grip
if wOS.ALCS.LightsaberBase.Grips[ grip ] then
ply.WOS_Preferences.Grip = grip
end
ply.WOS_Preferences.Wield = ( pref_data.Wield == 1 )
end
pref_data = queries[2]:getData()
if table.Count( pref_data ) > 0 then
for slot, dat in ipairs( pref_data ) do
local exec = dat.Execution
if not wOS.ALCS.ExecSys.Executions[ exec ] then continue end
ply.WOS_ExecutionWhitelists[ exec ] = true
end
end
wOS.ALCS.Character:SendPlayerData( ply )
wOS.ALCS.ExecSys:SendWhitelists( ply )
end )
return true
end
function wOS.ALCS.Character.DataStore:SavePlayerData( ply )
if not ply then return false end
if not ply.WOS_Preferences then return false end
local steam64 = ply:SteamID64()
local charid = wOS.ALCS:GetCharacterID( ply ) or 1
if charid < 1 then return end
local TRANS = DATA:CreateTransaction()
local exec = DATA:escape( ply.WOS_Preferences.Execution or "" )
local grip = DATA:escape( ply.WOS_Preferences.Grip or "Standard" )
local wield = ( ply.WOS_Preferences.Wield and 1 ) or 0
TRANS:Query( [[ INSERT INTO wos_saberpref (SteamID, Grip, Wield, Execution, CharID ) VALUES( ]] .. steam64 .. [[, ']] .. grip .. [[', ]] .. wield .. [[, ']] .. exec .. [[',']] .. charid .. [[' ) ON DUPLICATE KEY UPDATE Grip = ']] .. grip .. [[', Wield = ]] .. wield .. [[, Execution = ']] .. exec .. [[']] )
TRANS:Start( function(transaction, status, err)
if (!status) then print("[MYSQL ERROR] " .. err) return end
end )
return true
end
function wOS.ALCS.Character.DataStore:AddExecWhitelist( ply, exec )
if not ply then return end
if not ply.WOS_ExecutionWhitelists then return end
if not wOS.ALCS.ExecSys.Executions[ exec ] then return end
local steam64 = ply:SteamID64()
local charid = wOS.ALCS:GetCharacterID( ply ) or 1
if charid < 1 then return end
DATA:RunQuery( [[ INSERT INTO wos_execwl (SteamID, Execution, CharID) VALUES( ']] .. steam64 .. [[',']] .. DATA:escape( exec ) .. [[', ']] .. charid .. [[') ON DUPLICATE KEY UPDATE CharID = ]] .. charid )
end
function wOS.ALCS.Character.DataStore:RemoveExecWhitelist( ply, exec )
if not ply then return end
if not ply.WOS_ExecutionWhitelists then return end
if not wOS.ALCS.ExecSys.Executions[ exec ] then return end
local steam64 = ply:SteamID64()
local charid = wOS.ALCS:GetCharacterID( ply ) or 1
if charid < 1 then return end
DATA:RunQuery( [[ DELETE FROM wos_execwl WHERE SteamID = ']] .. steam64 .. [[' AND CharID = ']] .. charid .. [[' AND Execution = ']] .. DATA:escape( exec ) .. [[']] )
end
function wOS.ALCS.Character.DataStore:DeleteData( ply, charid )
if ply:IsBot() then return end
local steam64 = ply:SteamID64()
if charid < 1 then return end
DATA:RunQuery( "DELETE FROM wos_saberpref WHERE SteamID = '" .. steam64 .. "' AND CharID = " .. charid )
DATA:RunQuery( "DELETE FROM wos_execwl WHERE SteamID = '" .. steam64 .. "' AND CharID = " .. charid )
end
hook.Add("wOS.ALCS.PlayerLoadData", "wOS.ALCS.Character.LoadDataForChar", function( ply )
wOS.ALCS.Character.DataStore:LoadPlayerData( ply )
end )
hook.Add("wOS.ALCS.PlayerDeleteData", "wOS.ALCS.Char.DeleteDataForChar", function( ply, charid )
wOS.ALCS.Character.DataStore:DeleteData( ply, charid )
end ) |
local ffi = require("ffi")
local noise = require("noise")
local map = {
scale = 1;
dx = 0;
dy = 0;
sizeX = 64;
sizeY = 64;
elevation = ffi.new("float[64][64]")
}
-- generate noise
for i = -1,1, 0.001 do
print(noise(i, 0, 0))
end
--[[
for x=0,map.sizeX-1 do
for y=0,map.sizeY-1 do
map.elevation[x][y] = noise(x/map.scale + map.dx, y/map.scale + map.dy,0)
end
end
for x=1,map.sizeX-1 do
for y=1,map.sizeY-1 do
io.write(map.elevation[x][y], '..')
end
io.write("\n")
end
--]] |
local skynet = require "skynet"
local command = {}
function command.PING(hello)
return hello
end
function command.HELLO()
skynet.sleep(100)
return "hello"
end
function command.EXIT()
skynet.exit()
end
function command.ERROR()
error "throw an error"
end
skynet.start(function()
skynet.dispatch("lua", function(session,addr, cmd, ...)
skynet.ret(skynet.pack(command[cmd](...)))
end)
end)
|
--this = SceneNode()
function destroy()
end
function create()
return false
end
function update()
return false
end |
-- This is a part of uJIT's testing suite.
-- Copyright (C) 2020-2022 LuaVela Authors. See Copyright Notice in COPYRIGHT
-- Copyright (C) 2015-2020 IPONWEB Ltd. See Copyright Notice in COPYRIGHT
ujit.dump.bc()
|
local InputController = {
--plugin = nil
}
function InputController:init(plugin)
self.plugin = plugin
end
return InputController |
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by KK47.
--- DateTime: 2019/9/9 22:36
---
---练习3.1 以下哪些值是有效的数值常量?它们的值分别是多少?
-- .0e12 有效 0.0
-- .e12 无效 '.' unexpected
-- 0.0e 无效 malformed number near '0.0e'
-- 0x12 有效 18
-- 0xABFG 无效 syntax error
-- 0xA 有效 10
-- FFFF 无效 变量名
-- 0xFFFFFFFF 有效 4294967295
-- 0x 无效 syntax error
-- 0x1P10 有效 1024.0
-- 0.1e1 有效 1.0
-- 0x0.1p1 有效 0.125
---练习3.2 解释下列表达式之所以得出相应结果的原因。(注意:整型算术运算总是会回环)
print(math.maxinteger * 2) -- => maxinteger + (maxinteger + 1) - 1 => maxinteger + mininteger - 1 => -1 + -1 => -2
print(math.mininteger * 2) -- => mininteger + (mininteger - 1) + 1 => mininteger + maxinteger + 1 => -1 + 1 => 0
print(math.maxinteger * math.maxinteger) -- => maxinteger * (mininteger - 1) => mininteger - maxinteger => 1
print(math.mininteger * math.mininteger) -- => mininteger * (maxinteger + 1) => mininteger + mininteger => 0
---练习3.3 下列代码的输出结果是什么?
for i = -10, 10 do
print(i , i % 3)
end
-- 太长就不贴出来了 运行下即可
-- 注意 : Lua的取整除法向负无穷取整
-- 比如 -10 // 3 等于 -4 而不是 -3
-- 所以 -10 % 3 等于 2 而不是 -1
--若要得到与C++等语言一样的结果请使用 math.fmod
---练习3.4 表达式2^3^4的值是什么?表达式2^-3^4呢?
print(2^3^4) -- 2.4178516392293e+024
print(2^-3^4) -- 4.1359030627651e-025
---练习3.5 当分母是10的整数次幂时,数值 12.7 与表达式 127/10 相等。能否认为当分母是2的整数次幂时,这是一种通用规律? 对于数值 5.5 情况又会怎样?
--PS : 这翻译让我懵了下 看了英文版,意思是问你能把12.7表达为以 2 的整数次幂为分母的分数吗?5.5也可以吗?
--答案是可以得。 12.7 可以用 0x19.6666666666666p-1 表示,5.5 用 11/2 表示。
---练习3.6 请编写一个通过高、母线与轴线的夹角来计算正圆锥体体积的函数。
local function CalculateConeVolume(h,fAngle)
local r = h * math.tan( math.rad(fAngle))
return math.pi * (r^2) * h / 3
end
print(CalculateConeVolume(1,60))
---练习3.7 利用函数 math.random 编写一个生成遵循正态分布(高斯分布)的伪随机数发生器
--Box–Muller
local function gaussian (average, variance)
return math.sqrt(-2 * variance * math.log(math.random())) *
math.cos(2 * math.pi * math.random()) + average
end
--平均值
local function mean (t)
local sum = 0
for _, v in pairs(t) do
sum = sum + v
end
return sum / #t
end
--标准差
local function std (t)
local squares, avg = 0, mean(t)
for _, v in pairs(t) do
squares = squares + ((avg - v) ^ 2)
end
local variance = squares / #t
return math.sqrt(variance)
end
--打印
local function showHistogram (t)
local lo = math.ceil(math.min(table.unpack(t)))
local hi = math.floor(math.max(table.unpack(t)))
local hist, barScale = {}, 200
for i = lo, hi do
hist[i] = 0
for k, v in pairs(t) do
if math.ceil(v - 0.5) == i then
hist[i] = hist[i] + 1
end
end
local n = math.ceil(hist[i] / #t * barScale)
io.write(i .. "\t" .. string.rep('=', n))
print(" " .. hist[i])
end
end
--测试
local function normalDistribution()
math.randomseed(os.time())
local t, average, variance = {}, 50, 10
for i = 1, 1000 do
table.insert(t, gaussian(average, variance))
end
print("Mean:", mean(t) .. ", expected " .. average)
print("StdDev:", std(t) .. ", expected " .. math.sqrt(variance) .. "\n")
showHistogram(t)
end
normalDistribution()
|
--------------------------------------------------------------------------------
-- The base class for all display objects. <br>
-- To inherit MOAIPropUtil, you can use the convenience function. <br>
-- To inherit EventDispatcher, you can use the event notification. <br>
-- <br>
-- Use the MOAIProp class. <br>
-- By changing the M.MOAI_CLASS, you can change to another class. <br>
-- See MOAIProp.<br>
-- Base Classes => EventDispatcher, MOAIPropUtil<br>
--------------------------------------------------------------------------------
-- import
local class = require "hp/lang/class"
local table = require "hp/lang/table"
local EventDispatcher = require "hp/event/EventDispatcher"
local MOAIPropUtil = require "hp/util/MOAIPropUtil"
local PropertyUtil = require "hp/util/PropertyUtil"
-- class
local M = class(EventDispatcher, MOAIPropUtil)
local MOAIPropInterface = MOAIProp.getInterfaceTable()
-- constraints
M.MOAI_CLASS = MOAIProp
M.PRIORITY_PROPERTIES = {
"texture",
}
--------------------------------------------------------------------------------
-- Instance generating functions.<br>
-- Unlike an ordinary class, and based on the MOAI_CLASS.<br>
-- To inherit this function is not recommended.<br>
-- @param ... params.
-- @return instance.
--------------------------------------------------------------------------------
function M:new(...)
local obj = self.MOAI_CLASS.new()
table.copy(self, obj)
EventDispatcher.init(obj)
if obj.init then
obj:init(...)
end
obj.new = nil
obj.init = nil
return obj
end
--------------------------------------------------------------------------------
-- The constructor.
--------------------------------------------------------------------------------
function M:init(...)
self._touchEnabled = true
end
--------------------------------------------------------------------------------
-- Set the name.
-- @param name Object name.<br>
--------------------------------------------------------------------------------
function M:setName(name)
self.name = name
end
--------------------------------------------------------------------------------
-- Returns the name.
-- @return Object name.
--------------------------------------------------------------------------------
function M:getName()
return self.name
end
--------------------------------------------------------------------------------
-- Sets the parent.
-- @return parent object.
--------------------------------------------------------------------------------
function M:getParent()
return self._parent
end
--------------------------------------------------------------------------------
-- Sets the parent.
-- @param parent parent
--------------------------------------------------------------------------------
function M:setParent(parent)
if parent == self:getParent() then
return
end
-- remove
if self._parent and self._parent.isGroup then
self._parent:removeChild(self)
end
-- set
MOAIPropInterface.setParent(self, parent)
self._parent = parent
-- add
if parent and parent.isGroup then
parent:addChild(self)
end
end
--------------------------------------------------------------------------------
-- Set the parameter setter function.
-- @param params Parameter is set to Object.<br>
--------------------------------------------------------------------------------
function M:copyParams(params)
if not params then
return
end
-- copy priority properties
local priorityParams = {}
if self.PRIORITY_PROPERTIES then
for i, v in ipairs(self.PRIORITY_PROPERTIES) do
priorityParams[v] = params[v]
params[v] = nil
end
PropertyUtil.setProperties(self, priorityParams, true)
end
-- priority properties
PropertyUtil.setProperties(self, params, true)
-- reset params
if self.PRIORITY_PROPERTIES then
for i, v in ipairs(self.PRIORITY_PROPERTIES) do
params[v] = priorityParams[v]
end
end
end
--------------------------------------------------------------------------------
-- Set the MOAILayer instance.
--------------------------------------------------------------------------------
function M:setLayer(layer)
if self.layer == layer then
return
end
if self.layer then
self.layer:removeProp(self)
end
self.layer = layer
if self.layer then
layer:insertProp(self)
end
end
--------------------------------------------------------------------------------
-- Returns the MOAILayer.
--------------------------------------------------------------------------------
function M:getLayer()
return self.layer
end
--------------------------------------------------------------------------------
-- Event Handler
--------------------------------------------------------------------------------
function M:getNestLevel()
local parent = self:getParent()
if parent and parent.getNestLevel then
return parent:getNestLevel() + 1
end
return 1
end
--------------------------------------------------------------------------------
-- Sets the touch enabled.
-- @param value touch enabled.
--------------------------------------------------------------------------------
function M:setTouchEnabled(value)
self._touchEnabled = value
end
--------------------------------------------------------------------------------
-- Sets the touch enabled.
-- @param value touch enabled.
--------------------------------------------------------------------------------
function M:isTouchEnabled()
return self._touchEnabled
end
--------------------------------------------------------------------------------
-- Dispose resourece.
--------------------------------------------------------------------------------
function M:dispose()
local parent = self:getParent()
if parent and parent.isGroup then
parent:removeChild(self)
end
self:setLayer(nil)
end
--------------------------------------------------------------------------------
-- If the object will collide with the screen, it returns true.<br>
-- TODO:If you are rotating, it will not work.
-- @param prop MOAIProp object
-- @return If the object is a true conflict
--------------------------------------------------------------------------------
function M:hitTestObject(prop)
local worldX, worldY = prop:getWorldLoc()
local x, y = prop:getLoc()
local diffX, diffY = worldX - x, worldY - y
local left, top = MOAIPropUtil.getLeft(prop) + diffX, MOAIPropUtil.getTop(prop) + diffY
local right, bottom = MOAIPropUtil.getRight(prop) + diffX, MOAIPropUtil.getBottom(prop) + diffY
if self:inside(left, top, 0) then
return true
end
if self:inside(right, top, 0) then
return true
end
if self:inside(left, bottom, 0) then
return true
end
if self:inside(right, bottom, 0) then
return true
end
return false
end
--------------------------------------------------------------------------------
-- If the object will collide with the screen, it returns true.<br>
-- @param screenX x of screen
-- @param screenY y of screen
-- @param screenZ (option)z of screen
-- @return If the object is a true conflict
--------------------------------------------------------------------------------
function M:hitTestScreen(screenX, screenY, screenZ)
assert(self.layer)
screenZ = screenZ or 0
local worldX, worldY, worldZ = self.layer:wndToWorld(screenX, screenY, screenZ)
return self:inside(worldX, worldY, worldZ)
end
--------------------------------------------------------------------------------
-- If the object will collide with the world, it returns true.<br>
-- @param worldX world x of layer
-- @param worldY world y of layer
-- @param worldZ (option)world z of layer
-- @return If the object is a true conflict
--------------------------------------------------------------------------------
function M:hitTestWorld(worldX, worldY, worldZ)
worldZ = worldZ or 0
return self:inside(worldX, worldY, worldZ)
end
return M |
LibRoot.Sqlite = SrcDir() .. "r0.data/sqlite3"
-- ==============================================================================
ModuleRefInclude["sqlite3"] = function()
includedirs
{
LibRoot.Sqlite,
}
defines { "SQLITE_ENABLE_FTS5", "SQLITE_ENABLE_JSON1" }
end
-- ==============================================================================
project "r0-sqlite3"
kind "StaticLib"
language "C"
SetDefaultBuildConfiguration()
SetDefaultOutputDirectories("r0")
ModuleRefInclude["sqlite3"]()
files
{
LibRoot.Sqlite .. "/**.c",
LibRoot.Sqlite .. "/**.h",
}
ModuleRefLink["sqlite3"] = function()
links { "r0-sqlite3" }
end
|
local PackageManager = require 'packagemanager/init'
local xrc = require 'packagemanager-gui/xrc'
local utils = require 'packagemanager-gui/utils'
local Event = require 'packagemanager-gui/Event'
local MainView = require 'packagemanager-gui/MainView'
local Timer = require 'packagemanager-gui/Timer'
local UpdateTimer = require 'packagemanager-gui/UpdateTimer'
local StatusBarPresenter = require 'packagemanager-gui/StatusBarPresenter'
local PackageListPresenter = require 'packagemanager-gui/PackageListPresenter'
local RequirementListPresenter = require 'packagemanager-gui/RequirementListPresenter'
local ChangeListPresenter = require 'packagemanager-gui/ChangeListPresenter'
local RepositoryListPresenter = require 'packagemanager-gui/RepositoryListPresenter'
local MainPresenter = {}
MainPresenter.__index = MainPresenter
function MainPresenter:updateRepositoryIndices()
local tasks = PackageManager.updateRepositoryIndices()
local function update()
local completedTaskCount = 0
for _, task in ipairs(tasks) do
if task.status == 'complete' or
task.status == 'failure' then
completedTaskCount = completedTaskCount + 1
end
end
self.statusBarPresenter:setMessage('indices',
string.format('Downloading repository indices %d/%d ...',
completedTaskCount,
#tasks))
if completedTaskCount == #tasks then
self.statusBarPresenter:setMessage('indices', nil)
PackageManager.buildPackageDB()
self.packageDbUpdated()
end
end
local function completeAndUpdate()
self.updateTimer:removeUser()
update()
end
local function failAndUpdate( task )
self.updateTimer:removeUser()
update()
error(task.error, 0)
end
if #tasks > 0 then
for _, task in ipairs(tasks) do
self.updateTimer:addUser()
task.events.downloadStarted = update
task.events.complete = completeAndUpdate
task.events.fail = failAndUpdate
task:start()
end
update()
else
PackageManager.buildPackageDB()
self.packageDbUpdated()
end
end
function MainPresenter:destroy()
self.statusBarPresenter:destroy()
self.packageListPresenter:destroy()
self.requirementListPresenter:destroy()
self.changeListPresenter:destroy()
self.repositoryListPresenter:destroy()
self.updateTimer:destroy()
self.view:destroy()
end
return function( view )
local self = setmetatable({}, MainPresenter)
self.view = view
Timer.defaultWindow = view.frame
self.packageDbUpdated = Event()
self.updateTimer = UpdateTimer()
self.statusBarPresenter = StatusBarPresenter(view.statusBarView)
self.requirementListPresenter = RequirementListPresenter(view.requirementListView)
self.repositoryListPresenter = RepositoryListPresenter(view.repositoryListView, self)
self.changeListPresenter = ChangeListPresenter(view.changeListView,
self.requirementListPresenter,
self.packageDbUpdated,
self.statusBarPresenter,
view,
self.updateTimer)
self.packageListPresenter = PackageListPresenter(view.packageListView,
self.requirementListPresenter,
self.changeListPresenter,
self.packageDbUpdated,
view)
self:updateRepositoryIndices()
return self
end
|
include('shared.lua')
ENT.OrigMat = ""
function ENT:Initialize()
self.Entity:StartMotionController()
self.Entity:AddToMotionController(self.Entity:GetPhysicsObject())
end
function ENT:Think()
if !self.OrigMat then
self.OrigMat = self.Entity:GetMaterial()
end
end
function ENT:Draw()
local myteam = self:GetTeam()
local fraction = self:GetHealthScalar()
self.Entity:SetMaterial(self.OrigMat)
if self:GetOOB() == 1 then
self.Entity:SetMaterial("models/wireframe")
end
self:DrawModel()
end
function ENT:OnRemove()
end |
local lspconfig = require("lspconfig")
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- Mappings
local opts = {noremap = true, silent = true}
-- See `:help vim.lsp.*` for documentation on any of the below functions
buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
-- C-k conflicts with tmux split navigation
-- buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap("n", "<leader>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
buf_set_keymap("n", "<leader>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
buf_set_keymap("n", "<leader>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
buf_set_keymap("n", "<leader>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
buf_set_keymap("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
buf_set_keymap("n", "<leader>ca", "<Cmd>lua vim.lsp.buf.code_action()<CR>", opts)
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
buf_set_keymap("n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
-- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then
buf_set_keymap("n", "<leader>;", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
elseif client.resolved_capabilities.document_range_formatting then
buf_set_keymap("n", "<leader>;", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
end
-- Set autocommands conditional on server_capabilities
if client.resolved_capabilities.document_highlight then
vim.api.nvim_exec(
[[
hi LspReferenceRead cterm=bold ctermbg=red guibg=DarkSlateGray
hi LspReferenceText cterm=bold ctermbg=red guibg=DarkSlateGray
hi LspReferenceWrite cterm=bold ctermbg=red guibg=DarkSlateGray
hi LspDiagnosticsDefaultHint ctermbg=grey guifg=Grey30 guibg=DarkSlateGray
hi DiagnosticError guifg=White
augroup lsp_document_highlight
autocmd! * <buffer>
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
augroup END
]],
false
)
end
-- require"lsp_signature".on_attach()
end
-- Use a loop to conveniently both setup defined servers
-- and map buffer local keybindings when the language server attaches
local servers = {"bashls", "cssls", "html", "jsonls", "pyright", "tsserver", "vimls"}
local lspsettings = {}
for _, lsp in ipairs(servers) do
local module = lspconfig[lsp]
if module then
module.setup {
on_attach = on_attach,
flags = {
debounce_text_changes = 150
},
settings = lspsettings[lsp]
}
else
print("Can't set up LSP for" .. lsp)
end
end
|
-- a basic tattooshop implementation
local Tunnel = module("vrp", "lib/Tunnel")
local Proxy = module("vrp", "lib/Proxy")
vRPts = {}
vRP = Proxy.getInterface("vRP")
vRPclient = Tunnel.getInterface("vRP","vrp_tattoos")
TSclient = Tunnel.getInterface("vrp_tattoos","vrp_tattoos")
Tunnel.bindInterface("vrp_tattoos",vRPts)
local Lang = module("vrp", "lib/Lang")
local lcfg = module("vrp", "cfg/base")
local lang = Lang.new(module("vrp", "cfg/lang/"..lcfg.lang) or {})
local cfg = module("vrp_tattoos", "cfg/tattoos")
local tattooshop_menus = {}
function vRPts.addTattoo(user_id, tattoo, store)
local player = vRP.getUserSource({user_id})
if player ~= nil then
TSclient.drawTattoo(player,{tattoo,store})
vRP.getUData({user_id,"vRP:tattoos",function(value)
local tattoos = json.decode(value)
if tattoos == nil then
tattoos = {}
end
tattoos[tattoo] = store
vRP.setUData({user_id,"vRP:tattoos",json.encode(tattoos)})
end})
end
end
-- build tattooshop menus
for shop,tattoos in pairs(cfg.tattoos) do
local tattooshop_menu = {
name="Tatovør",
css={top = "75px", header_color="rgba(255,0,0,0.75)"}
}
-- build tattooshop items
local kitems = {}
-- item choice
local tattoshop_choice = function(player,choice)
local tattoo = kitems[choice][1]
local price = kitems[choice][2]
if tattoo then
local user_id = vRP.getUserId({player})
local owned = false
if tattoo == "CLEAR" then -- get player weapons to not rebuy the body
-- payment
if user_id ~= nil and vRP.tryFullPayment({user_id,price}) then
TSclient.cleanPlayer(player,{})
TriggerEvent("vRP:cloakroom:update", player)
vRP.setUData({user_id,"vRP:tattoos",json.encode({})})
TriggerClientEvent("pNotify:SendNotification", player,{text = {lang.money.paid({price})}, type = "success", queue = "global", timeout = 4000, layout = "centerRight",animation = {open = "gta_effects_fade_in", close = "gta_effects_fade_out"},killer = true})
else
TriggerClientEvent("pNotify:SendNotification", player,{text = {lang.money.not_enough()}, type = "error", queue = "global", timeout = 4000, layout = "centerRight",animation = {open = "gta_effects_fade_in", close = "gta_effects_fade_out"},killer = true})
end
else
-- get player tattoos to not rebuy
vRP.getUData({user_id,"vRP:tattoos",function(value)
local tattoos = json.decode(value)
if tattoos ~= nil then
for k,v in pairs(tattoos) do
if k == tattoo then
owned = true
end
end
end
if not owned then
-- payment
if user_id ~= nil and vRP.tryFullPayment({user_id,price}) then
vRPts.addTattoo(user_id, tattoo, shop)
TriggerClientEvent("pNotify:SendNotification", player,{text = {lang.money.paid({price})}, type = "success", queue = "global", timeout = 4000, layout = "centerRight",animation = {open = "gta_effects_fade_in", close = "gta_effects_fade_out"},killer = true})
else
TriggerClientEvent("pNotify:SendNotification", player,{text = {lang.money.not_enough()}, type = "error", queue = "global", timeout = 4000, layout = "centerRight",animation = {open = "gta_effects_fade_in", close = "gta_effects_fade_out"},killer = true})
end
else
TriggerClientEvent("pNotify:SendNotification", player,{text = "Du har allerede denne tattoo", type = "error", queue = "global", timeout = 4000, layout = "centerRight",animation = {open = "gta_effects_fade_in", close = "gta_effects_fade_out"},killer = true})
end
end})
end
end
end
-- add item options
for k,v in pairs(tattoos) do
if k ~= "_config" then -- ignore config property
kitems[v[1]] = {k,math.max(v[2],0)} -- idname/price
tattooshop_menu[v[1]] = {tattoshop_choice,v[3]} -- add description
end
end
tattooshop_menus[shop] = tattooshop_menu
end
local function build_client_tattooshops(source)
local user_id = vRP.getUserId({source})
if user_id ~= nil then
for k,v in pairs(cfg.shops) do
local shop,x,y,z,hidden = table.unpack(v)
local group = cfg.tattoos[shop]
local menu = tattooshop_menus[shop]
if group and menu then
local gcfg = group._config
local function tattooshop_enter()
local user_id = vRP.getUserId({source})
if user_id ~= nil and vRP.hasPermissions({user_id,gcfg.permissions or {}}) then
vRP.openMenu({source,menu})
end
end
local function tattooshop_leave()
vRP.closeMenu({source})
end
if hidden == true then
vRPclient.addMarker(source,{x,y,z-0.87,0.7,0.7,0.5,0,255,125,125,150})
vRP.setArea({source,"vRP:tattooshop"..k,x,y,z,1,1.5,tattooshop_enter,tattooshop_leave})
else
vRPclient.addBlip(source,{x,y,z,gcfg.blipid,gcfg.blipcolor,"Tatovør"})
vRPclient.addMarker(source,{x,y,z-0.87,0.7,0.7,0.5,0,255,125,125,150})
vRP.setArea({source,"vRP:tattooshop"..k,x,y,z,1,1.5,tattooshop_enter,tattooshop_leave})
end
end
end
end
end
AddEventHandler("vRP:playerSpawn",function(user_id, source, first_spawn)
if first_spawn then
build_client_tattooshops(source)
SetTimeout(31000,function() -- increase this if you have problems with tattoos not saving on login has to be >31000
vRP.getUData({user_id,"vRP:tattoos",function(value)
local tattoos = json.decode(value)
if tattoos ~= nil then
for k,v in pairs(tattoos) do
TSclient.drawTattoo(source,{k,v})
end
end
end})
end)
else
SetTimeout(16000,function() -- increase this if you have problems with tattoos not saving after death has to be >16000
vRP.getUData({user_id,"vRP:tattoos",function(value)
local tattoos = json.decode(value)
if tattoos ~= nil then
for k,v in pairs(tattoos) do
TSclient.drawTattoo(source,{k,v})
end
end
end})
end)
end
end) |
require('lspconfig').texlab.setup{ on_attach = require('plugs.nvim-lspconfig').on_attach }
|
return {
mine_medium = {
areaofeffect = 150,
craterboost = 0,
cratermult = 0,
edgeeffectiveness = 0.6,
explosiongenerator = "custom:FLASHMEDIUMBUILDING",
impulseboost = 0,
name = "MediumMine",
range = 480,
reloadtime = 3,
soundhit = "xplomed1",
soundstart = "largegun",
weaponvelocity = 250,
damage = {
default = 750,
minelayers = 20,
mines = 1,
},
},
}
|
yatm_fluid_pipes:require("nodes/inserter_fluid_pipe.lua")
yatm_fluid_pipes:require("nodes/extractor_fluid_pipe.lua")
yatm_fluid_pipes:require("nodes/transporter_fluid_pipe.lua")
|
function onStart()
STATS = {}
STATS.thread = MOAICoroutine.new()
local nIdx = 0
local node = {0}
local action = {0}
local sim = {0}
local render = {0}
local buffer = 10
STATS.thread:run( function()
while true do
local _, a, n, s, r = MOAISim.getPerformance()
nIdx = (nIdx + 1) % buffer
action[nIdx + 1] = a
node[nIdx + 1] = n
sim[nIdx + 1] = s
render[nIdx + 1] = r
local nodeMgrTime = 0
local actionTreeTime = 0
local simTime = 0
local renderTime = 0
for i = 1, #action do
nodeMgrTime = nodeMgrTime + node[i]
actionTreeTime = actionTreeTime + action[i]
simTime = simTime + sim[i]
renderTime = renderTime + render[i]
end
STATS.nodeMgr = 1000 * nodeMgrTime / buffer
STATS.actionTree = 1000 * actionTreeTime / buffer
STATS.simTime = 1000 * simTime / buffer
STATS.renderTime = 1000 * renderTime / buffer
coroutine.yield()
end
end )
end
function onStats()
local fps = MOAISim.getPerformance()
local drawcalls = MOAIGfxDevice.getFrameBuffer():getPerformanceDrawCount()
local luaCount = MOAISim.getLuaObjectCount()
local mem = MOAISim.getMemoryUsage()
local lua, texture = mem.lua, mem.texture
local node = STATS and STATS.nodeMgr or 0
local action = STATS and STATS.actionTree or 0
local sim = STATS and STATS.simTime or 0
local render = STATS and STATS.renderTime or 0
return math.round(fps, 0.1), drawcalls, luaCount, lua, texture,
math.round(node, 0.01), math.round(action, 0.01), math.round(sim, 0.01), math.round(render, 0.01)
end
function onStop()
if STATS and STATS.thread then
STATS.thread:stop()
STATS.thread = nil
end
end |
place = {"pravu", "polupravu", "duž"}
|
-- Copyright (c) 2020 Trevor Redfern
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
local component = require "moonpie.ui.components.component"
component("p", function(props)
local txt
if type(props) == "string" then
txt = props
else
txt = props.text
end
return {
component.text({ text = txt })
}
end) |
local Controller = require 'charon.Controller'
local test = {}
-- Mock
local env = {}
env.requestMethod = function()
return 'GET'
end
env.queryString = function()
return ''
end
test.should_return_http_status_500_if_errors = function()
local c = Controller.new{ _env = env }
local object = { id = 1, name = 'John' }
local status, headers, body = c:render({ output = 'json', value = object })
assert( status == 200 )
end
test.should_return_http_header_application_json = function()
local c = Controller.new{ _env = env }
local object = { id = 1, name = 'John' }
local status, headers, body = c:render({ output = 'json', value = object })
assert( headers[1] == 'Content-Type: application/json; charset=UTF-8', headers[1] )
end
test.should_return_http_body_encoded_json = function()
local c = Controller.new{ _env = env }
local object = { id = 1, name = 'John' }
local status, headers, body = c:render({ output = 'json', value = object })
assert( body == [[{"name":"John","id":1}]], body )
end
test.should_return_with_json_callback = function()
env.queryString = function()
return 'json_callback=mycallback'
end
local c = Controller.new{ _env = env }
local object = { id = 1, name = 'John' }
local status, headers, body = c:render({ output = 'json', value = object })
assert( body == [[mycallback({"name":"John","id":1})]], body )
end
return test
|
local Module = {}
function Module.GetPointOnPath(nodeList, progress) -- catmull-rom cubic hermite interpolation
if progress == 1 then return nodeList[#nodeList] end
local index1 = math.floor(1 + progress * (#nodeList - 1))
local index2 = index1 + 1
local point1 = nodeList[index1]
local point2 = nodeList[index2]
if(not point1 or not point2) then return end
local tangent1 = (point2 - nodeList[math.max(1, index1 - 1)]) / 2
local tangent2 = (nodeList[math.min(#nodeList, index1 + 2)] - point1) / 2
local alpha = (progress * (#nodeList - 1)) % 1
local h1 = 2*alpha^3 - 3*alpha^2 + 1
local h2 = -2*alpha^3 + 3*alpha^2
local h3 = alpha^3 - 2*alpha^2 + alpha
local h4 = alpha^3 - alpha^2
return h1*point1 + h2*point2 + h3*tangent1 + h4*tangent2, index1
end
function Module.GetSplinePositions(group, camera, numberOfSegments)
local referencePositions = {}
for index, point in pairs(group:GetChildren()) do
if(index == 1) then
if((camera:GetWorldPosition() - point:GetWorldPosition()).size >= 1) then
table.insert(referencePositions, camera:GetWorldPosition())
table.insert(referencePositions, point:GetWorldPosition())
else
table.insert(referencePositions, point:GetWorldPosition())
end
else
table.insert(referencePositions, point:GetWorldPosition())
end
end
for i,v in pairs(referencePositions) do
print(i,v)
end
local positions = {}
for index = 1, numberOfSegments do
table.insert(positions, GetPointOnPath(referencePositions, index/numberOfSegments))
end
return positions
end
return Module |
local PLUGINGUI_INPUT_CAPTURER_ZINDEX = 100000
local SLIDER_HEIGHT = 36
local KNOB_HEIGHT = 44
local UserInputService = game:GetService("UserInputService")
local SliderRoot = script.Parent
local CoreRoot = SliderRoot.Parent
local UIBloxRoot = CoreRoot.Parent
local Packages = UIBloxRoot.Parent
local Roact = require(Packages.Roact)
local Cryo = require(Packages.Cryo)
local t = require(Packages.t)
local Gamepad = require(Packages.RoactGamepad)
local ImageSetComponent = require(CoreRoot.ImageSet.ImageSetComponent)
local lerp = require(UIBloxRoot.Utility.lerp)
local UIBloxConfig = require(UIBloxRoot.UIBloxConfig)
local CursorKind = require(UIBloxRoot.App.SelectionImage.CursorKind)
local withSelectionCursorProvider = require(UIBloxRoot.App.SelectionImage.withSelectionCursorProvider)
local DPAD_INITIAL_MOVE_INTERVAL = 0.5
local STICK_INITIAL_MOVE_INTERVAL = 0.2
local STICK_MOVE_DEADZONE = 0.2
local DPAD_SPEED = 8 -- In increments per second
local STICK_SPEED = 12 -- In increments per second
local GenericSlider = Roact.PureComponent:extend("GenericSlider")
GenericSlider.validateProps = t.strictInterface({
--value of the first knob if the slider has two knobs, otherwise value of the only knob
lowerValue = t.number,
--value of the second knob if the slider has two knobs
upperValue = t.optional(t.number),
min = t.number,
max = t.number,
stepInterval = t.numberPositive,
isDisabled = t.optional(t.boolean),
onValueChanged = t.callback,
--drag start function for first knob if the slider has two knobs, otherwise function for only knob
onDragStartLower = t.optional(t.callback),
--drag start function of the second knob if the slider has two knobs
onDragStartUpper = t.optional(t.callback),
onDragEnd = t.optional(t.callback),
trackImage = t.union(t.string, t.table),
-- Allow bindings for style props
trackColor = t.union(t.Color3, t.table),
trackTransparency = t.union(t.number, t.table),
trackSliceCenter = t.optional(t.Rect),
trackFillImage = t.union(t.string, t.table),
trackFillColor = t.union(t.Color3, t.table),
trackFillTransparency = t.union(t.number, t.table),
trackFillSliceCenter = t.optional(t.Rect),
knobImage = t.union(t.string, t.table),
--knob color value of the first knob if the slider has two knobs, otherwise value of the only knob
knobColorLower = t.union(t.Color3, t.table),
--knob color value of the second knob if the slider has two knobs
knobColorUpper = t.optional(t.union(t.Color3, t.table)),
knobTransparency = t.union(t.number, t.table),
knobImagePadding = t.optional(t.numberMin(0)),
knobShadowImage = t.union(t.string, t.table),
--knob shadow transparency value of the first knob if the slider has two knobs, otherwise value of the only knob
knobShadowTransparencyLower = t.union(t.number, t.table),
--knob shadow transparency value of the second knob if the slider has two knobs
knobShadowTransparencyUpper = t.optional(t.union(t.number, t.table)),
width = t.optional(t.UDim),
position = t.optional(t.UDim2),
anchorPoint = t.optional(t.Vector2),
layoutOrder = t.optional(t.integer),
imageButtonRef = t.optional(t.table),
NextSelectionUp = t.optional(t.table),
NextSelectionDown = t.optional(t.table),
focusController = t.optional(t.table),
})
GenericSlider.defaultProps = {
width = UDim.new(1, 0),
knobImagePadding = 0,
}
function GenericSlider:init()
self.rootRef = self.props.imageButtonRef or Roact.createRef()
self.lowerKnobRef = Roact.createRef()
self.upperKnobRef = Roact.createRef()
self.moveDirection = 0
self.lowerKnobDrag = false
self.upperKnobDrag = false
self.totalMoveTime = 0
self.isFirstMove = true
self.unhandledTime = 0
self.state = {
lowerKnobIsSelected = false,
upperKnobIsSelected = false,
}
end
function GenericSlider:onMoveStep(inputObjects, delta)
if not (self.state.lowerKnobIsSelected or self.state.upperKnobIsSelected) then
return
end
local stickInput = inputObjects[Enum.KeyCode.Thumbstick1].Position
local usingStick = stickInput.Magnitude > STICK_MOVE_DEADZONE
local increments = 0
local initialMoveInterval, moveDirection, speed
self.totalMoveTime = self.totalMoveTime + delta
if usingStick then
moveDirection = stickInput.x > 0 and 1 or -1
initialMoveInterval = STICK_INITIAL_MOVE_INTERVAL
speed = STICK_SPEED
else
local leftMovement = inputObjects[Enum.KeyCode.DPadLeft].UserInputState == Enum.UserInputState.Begin and -1 or 0
local rightMovement = inputObjects[Enum.KeyCode.DPadRight].UserInputState == Enum.UserInputState.Begin and 1 or 0
moveDirection = leftMovement + rightMovement
initialMoveInterval = DPAD_INITIAL_MOVE_INTERVAL
speed = DPAD_SPEED
end
if moveDirection ~= 0 then
-- Process input for the first button press
if self.isFirstMove then
self.isFirstMove = false
self.totalMoveTime = 0
self.unhandledTime = 0
increments = 1
-- Process input if enough time has passed.
elseif self.totalMoveTime > initialMoveInterval then
-- How much of delta time that was in the first interval
local initialIntervalOverlap = math.max(initialMoveInterval - self.totalMoveTime - delta, 0)
local timeToHandle = delta - initialIntervalOverlap + self.unhandledTime
increments = math.floor(speed * timeToHandle)
self.unhandledTime = timeToHandle - increments / speed
else
-- Period between first move and subsequent moves
increments = 0
self.unhandledTime = 0
end
else
self.totalMoveTime = 0
self.isFirstMove = true
end
if increments > 0 then
self:processGamepadInput(moveDirection, increments)
end
end
function GenericSlider:processGamepadInput(polarity, increments)
if self:hasTwoKnobs() then
self:processTwoKnobGamepadInput(polarity, increments)
else
self:processOneKnobGamepadInput(polarity, increments)
end
end
function GenericSlider:processTwoKnobGamepadInput(polarity, increments)
local stepInterval = self.props.stepInterval * polarity
local lowerValue = self.props.lowerValue
local upperValue = self.props.upperValue
--[[
If the knobs are overlapping, the gamepad may select either knob.
Set the one that should be selected by the direction of the input.
]]
if lowerValue == upperValue and not self.state.processingGamepad then
if self.state.lowerKnobIsSelected and polarity == 1 and lowerValue ~= self.props.max then
self:setState({
lowerKnobIsSelected = false,
upperKnobIsSelected = true,
processingGamepad = true,
})
self.props.focusController.moveFocusTo(self.upperKnobRef)
elseif self.state.upperKnobIsSelected and polarity == -1 and upperValue ~= self.props.min then
self:setState({
lowerKnobIsSelected = true,
upperKnobIsSelected = false,
processingGamepad = true,
})
self.props.focusController.moveFocusTo(self.lowerKnobRef)
end
elseif not self.state.processingGamepad then
self:setState({
processingGamepad = true,
})
end
if self.state.lowerKnobIsSelected then
local steppedValue = math.max(math.min(lowerValue + (stepInterval * increments), self.props.max), self.props.min)
if steppedValue <= upperValue then
lowerValue = steppedValue
else
lowerValue = upperValue
end
elseif self.state.upperKnobIsSelected then
local steppedValue = math.max(math.min(upperValue + (stepInterval * increments), self.props.max), self.props.min)
if steppedValue >= lowerValue then
upperValue = steppedValue
else
upperValue = lowerValue
end
end
if upperValue ~= self.props.upperValue or lowerValue ~= self.props.lowerValue then
self.props.onValueChanged(lowerValue, upperValue)
end
end
function GenericSlider:processOneKnobGamepadInput(polarity, increments)
local stepInterval = self.props.stepInterval * polarity
local lowerValue = self.props.lowerValue
if self.state.lowerKnobIsSelected then
lowerValue = math.max(math.min(lowerValue + (stepInterval * increments), self.props.max), self.props.min)
end
if lowerValue ~= self.props.lowerValue then
self.props.onValueChanged(lowerValue)
end
end
function GenericSlider:render()
local knobIsSelected = self.state.lowerKnobIsSelected or self.state.upperKnobIsSelected
local isTwoKnobs = self:hasTwoKnobs()
local fillPercentLower = (self.props.lowerValue - self.props.min) / (self.props.max - self.props.min)
local fillPercentUpper = isTwoKnobs and (self.props.upperValue - self.props.min) / (self.props.max - self.props.min)
or nil
local visibleSize = KNOB_HEIGHT - (self.props.knobImagePadding * 2)
local positionOffsetLower = lerp(visibleSize / 2, -visibleSize / 2, fillPercentLower)
local positionOffsetUpper = isTwoKnobs and lerp(visibleSize / 2, -visibleSize / 2, fillPercentUpper) or nil
local knobPositionLower = UDim2.new(fillPercentLower, positionOffsetLower, 0.5, 0)
local knobPositionUpper = isTwoKnobs and UDim2.new(fillPercentUpper, positionOffsetUpper, 0.5, 0) or nil
local fillSize = isTwoKnobs and UDim2.fromScale(fillPercentUpper - fillPercentLower, 1)
or UDim2.fromScale(fillPercentLower, 1)
local selectedKnob = self.state.lowerKnobIsSelected or self.state.upperKnobIsSelected
local imageSetComponent = UIBloxConfig.enableExperimentalGamepadSupport and
Gamepad.Focusable[ImageSetComponent.Button] or ImageSetComponent.Button
return withSelectionCursorProvider(function(getSelectionCursor)
return Roact.createElement(imageSetComponent, {
BackgroundTransparency = 1,
AnchorPoint = self.props.anchorPoint,
Size = UDim2.new(self.props.width.Scale, self.props.width.Offset, 0, SLIDER_HEIGHT),
LayoutOrder = self.props.layoutOrder,
Position = self.props.position,
[Roact.Event.InputBegan] = function(rbx, inputObject)
if self.props.isDisabled then
return
end
self:onInputBegan(inputObject, false)
end,
[Roact.Ref] = self.rootRef,
NextSelectionUp = (not selectedKnob) and self.props.NextSelectionUp or self.rootRef,
NextSelectionDown = (not selectedKnob) and self.props.NextSelectionDown or self.rootRef,
defaultChild = UIBloxConfig.enableExperimentalGamepadSupport and
(self.props.upperValue ~= self.props.min and self.lowerKnobRef or self.upperKnobRef) or nil,
onFocusLost = UIBloxConfig.enableExperimentalGamepadSupport and function()
if self.state.lowerKnobIsSelected or self.state.upperKnobIsSelected then
self:setState({
lowerKnobIsSelected = false,
upperKnobIsSelected = false,
})
end
end or nil,
}, {
Track = Roact.createElement(ImageSetComponent.Label, {
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
ImageColor3 = self.props.trackColor,
ImageTransparency = self.props.trackTransparency,
Image = self.props.trackImage,
Size = UDim2.new(1, 0, 0, 4),
Position = UDim2.fromScale(0.5, 0.5),
ScaleType = Enum.ScaleType.Slice,
SliceCenter = self.props.trackSliceCenter,
}, {
TrackFill = Roact.createElement(ImageSetComponent.Label, {
BackgroundTransparency = 1,
ImageColor3 = self.props.trackFillColor,
ImageTransparency = self.props.trackFillTransparency,
Image = self.props.trackFillImage,
Size = fillSize,
Position = isTwoKnobs and UDim2.new(fillPercentLower, 0, 0, 0) or UDim2.new(0, 0, 0, 0),
ScaleType = Enum.ScaleType.Slice,
SliceCenter = self.props.trackFillSliceCenter,
})
}),
LowerKnob = Roact.createElement(imageSetComponent, {
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
ImageColor3 = self.props.knobColorLower,
ImageTransparency = self.props.knobTransparency,
Image = self.props.knobImage,
Size = UDim2.fromOffset(KNOB_HEIGHT, KNOB_HEIGHT),
Position = knobPositionLower,
ZIndex = 3,
inputBindings = UIBloxConfig.enableExperimentalGamepadSupport and {
OnMoveStep = Gamepad.Input.onMoveStep(function(inputObjects, delta)
self:onMoveStep(inputObjects, delta)
end),
SelectLowerKnob = Gamepad.Input.onBegin(Enum.KeyCode.ButtonA, function()
self:setState(function(state)
return {
lowerKnobIsSelected = not state.lowerKnobIsSelected,
processingGamepad = false,
}
end)
end),
UnselectLowerKnob = knobIsSelected and Gamepad.Input.onBegin(Enum.KeyCode.ButtonB, function()
self:setState({
lowerKnobIsSelected = false,
processingGamepad = false,
})
end) or nil,
} or nil,
NextSelectionLeft = knobIsSelected and self.lowerKnobRef or nil,
NextSelectionRight = (isTwoKnobs and not knobIsSelected and self.props.upperValue ~= self.props.lowerValue)
and self.upperKnobRef or nil,
NextSelectionUp = knobIsSelected and self.lowerKnobRef or nil,
NextSelectionDown = knobIsSelected and self.lowerKnobRef or nil,
SelectionImageObject = knobIsSelected and getSelectionCursor(CursorKind.SelectedKnob)
or getSelectionCursor(CursorKind.UnselectedKnob),
[Roact.Ref] = self.lowerKnobRef,
[Roact.Event.InputBegan] = function(rbx, inputObject)
if self.props.isDisabled then
return
end
self:onInputBegan(inputObject, true)
end,
}),
LowerKnobShadow = Roact.createElement(ImageSetComponent.Label, {
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
ImageTransparency = self.props.knobShadowTransparencyLower,
Image = self.props.knobShadowImage,
Size = UDim2.fromOffset(44, 44),
Position = knobPositionLower,
ZIndex = 2,
}),
UpperKnob = isTwoKnobs and Roact.createElement(imageSetComponent, {
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
ImageColor3 = self.props.knobColorUpper,
ImageTransparency = self.props.knobTransparency,
Image = self.props.knobImage,
Size = UDim2.fromOffset(KNOB_HEIGHT, KNOB_HEIGHT),
Position = knobPositionUpper,
ZIndex = 3,
NextSelectionLeft = (isTwoKnobs and not knobIsSelected and self.props.upperValue ~= self.props.lowerValue)
and self.lowerKnobRef or nil,
NextSelectionRight = knobIsSelected and self.upperKnobRef or nil,
NextSelectionUp = knobIsSelected and self.upperKnobRef or nil,
NextSelectionDown = knobIsSelected and self.upperKnobRef or nil,
SelectionImageObject = knobIsSelected and getSelectionCursor(CursorKind.SelectedKnob)
or getSelectionCursor(CursorKind.UnselectedKnob),
[Roact.Ref] = self.upperKnobRef,
[Roact.Event.InputBegan] = function(rbx, inputObject)
if self.props.isDisabled then
return
end
self:onInputBegan(inputObject, true)
end,
inputBindings = UIBloxConfig.enableExperimentalGamepadSupport and {
OnMoveStep = Gamepad.Input.onMoveStep(function(inputObjects, delta)
self:onMoveStep(inputObjects, delta)
end),
SelectUpperKnob = Gamepad.Input.onBegin(Enum.KeyCode.ButtonA, function()
self:setState(function(state)
return {
upperKnobIsSelected = not state.upperKnobIsSelected,
processingGamepad = false,
}
end)
end),
UnselectUpperKnob = knobIsSelected and Gamepad.Input.onBegin(Enum.KeyCode.ButtonB, function()
self:setState({
upperKnobIsSelected = false,
processingGamepad = false,
})
end) or nil,
} or nil,
}),
UpperKnobShadow = isTwoKnobs and Roact.createElement(ImageSetComponent.Label, {
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
ImageTransparency = self.props.knobShadowTransparencyUpper,
Image = self.props.knobShadowImage,
Size = UDim2.fromOffset(44, 44),
Position = knobPositionUpper,
ZIndex = 2,
}),
})
end)
end
function GenericSlider:didMount()
local root = self.rootRef.current
-- When didMount is first called we're still orphaned; we need to wait until
-- we're in the DataModel before checking whether we can use UserInputService.
-- Using a connection on AncestryChanged means we won't yield a frame to
-- figure this out.
local ancestryChangedConnection
ancestryChangedConnection = root.AncestryChanged:Connect(function()
if not root:IsDescendantOf(game) then
return
end
ancestryChangedConnection:Disconnect()
-- If we're mounted in a PluginGui, we cannot use UserInputService and we
-- need to resort to less clean methods to capture mouse movements.
self.canUseUserInputService = root:FindFirstAncestorWhichIsA("PluginGui") == nil
end)
end
function GenericSlider:didUpdate()
if self.props.disabled then
self:stopListeningForDrag()
end
end
function GenericSlider:willUnmount()
self:stopListeningForDrag()
end
function GenericSlider:onInputBegan(inputObject, isKnob)
if self.props.disabled then
return
end
-- Old touch inputs can trigger onInputBegan when they first touch a GuiElement
-- These are filtered by checking UserInputState
if UIBloxConfig.genericSliderFilterOldTouchInputs and inputObject.UserInputState ~= Enum.UserInputState.Begin then
return
end
local inputType = inputObject.UserInputType
if inputType ~= Enum.UserInputType.MouseButton1 and inputType ~= Enum.UserInputType.Touch then
return
end
if inputType == Enum.UserInputType.Touch and not isKnob then
return
end
local position = inputObject.Position.X
self:processDrag(position)
self:startListeningForDrag()
end
function GenericSlider:startListeningForDrag()
local root = self.rootRef.current
if root == nil then
return
end
if self.dragging then
return
end
if self.canUseUserInputService then
-- This is the nice clean path, where we can just use UserInputService to
-- capture the mouse movements. We will use this path in all production
-- cases (desktop, mobile, console, etc.)
self.moveConnection = UserInputService.InputChanged:Connect(function(inputObject)
-- We don't check whether the input was processed by something else
-- because we don't care about it: when we move the mouse, we want to
-- move the slider to match the movement, regardless of whether the
-- mouse movement was processed by something else.
if not self.dragging then
return
end
local inputType = inputObject.UserInputType
if inputType ~= Enum.UserInputType.MouseMovement and inputType ~= Enum.UserInputType.Touch then
return
end
if inputObject.UserInputState ~= Enum.UserInputState.Change then
return
end
self:processDrag(inputObject.Position.X)
end)
self.releaseConnection = UserInputService.InputEnded:Connect(function(inputObject)
local inputType = inputObject.UserInputType
if inputType ~= Enum.UserInputType.MouseButton1 and inputType ~= Enum.UserInputType.Touch then
return
end
-- Stop listening for drag events before processing the input, since
-- that involves a callback to the user of the slider.
-- Only process one knob slider input because the two knob slider
-- should not move if it is not being dragged (since the track is not clickable)
-- and, therefore, should not process if the drag is ending
self:stopListeningForDrag()
self:processOneKnobDrag(inputObject.Position.X)
end)
-- If the window loses focus the user can release the mouse and we won't
-- know about it, so the slider could get "stuck" to the mouse, even
-- though the user has let go of the mouse button. To resolve this, we
-- stop listening to events when we lose focus.
self.focusLostConnection = UserInputService.WindowFocusReleased:Connect(function()
self:stopListeningForDrag()
end)
else
-- This is the ugly, scary path, where UserInputService isn't available to
-- us and we have to cheat. In a PluginGui, UserInputService doesn't work;
-- its events only fire in the main viewport. The only way, currently, to
-- capture input like this is by creating a fake button at the top level
-- so that it overlays everything, then listening to input events on that.
-- This process is of less importance than the UserInputService connection
-- above, because it will only be run when the slider is used in a
-- Horsecat story or a similar environment.
local pluginGui = root:FindFirstAncestorWhichIsA("PluginGui")
local inputCapturer = Instance.new("ImageButton")
inputCapturer.BackgroundTransparency = 1
inputCapturer.Image = ""
inputCapturer.Name = "SliderPluginGuiInputCapturer"
inputCapturer.Size = UDim2.new(1, 0, 1, 0)
inputCapturer.ZIndex = PLUGINGUI_INPUT_CAPTURER_ZINDEX
self.moveConnection = inputCapturer.MouseMoved:Connect(function(x)
self:processDrag(x)
end)
self.releaseConnection = inputCapturer.MouseButton1Up:Connect(function(x)
self:stopListeningForDrag()
self:processOneKnobDrag(x)
end)
self.focusLostConnection = inputCapturer.MouseLeave:Connect(function(x)
self:stopListeningForDrag()
self:processOneKnobDrag(x)
end)
inputCapturer.Parent = pluginGui
self.inputCapturerButton = inputCapturer
end
self.dragging = true
if self.lowerKnobDrag and self.props.onDragStartLower ~= nil then
self.props.onDragStartLower()
end
if self.upperKnobDrag and self.props.onDragStartUpper ~= nil then
self.props.onDragStartUpper()
end
end
function GenericSlider:getSteppedValue(x)
local root = self.rootRef.current
if root == nil then
return 0
end
local min = self.props.min
local max = self.props.max
local stepInterval = self.props.stepInterval
local absoluteWidth = root.AbsoluteSize.X
local relativeX = x - root.AbsolutePosition.X
local clampedX = math.clamp(relativeX, 0, absoluteWidth)
local fractional = clampedX / absoluteWidth
local unsteppedValue = (fractional * (max - min)) + min
return math.floor(unsteppedValue / stepInterval + 0.5) * stepInterval
end
function GenericSlider:processDrag(x)
if self:hasTwoKnobs() then
self:processTwoKnobDrag(x)
else
self:processOneKnobDrag(x)
end
end
function GenericSlider:processOneKnobDrag(x)
if self:hasTwoKnobs() then
return
end
local steppedValue = self:getSteppedValue(x)
self.lowerKnobDrag = true
if steppedValue ~= self.props.lowerValue then
self.props.onValueChanged(steppedValue)
end
end
function GenericSlider:processTwoKnobDrag(x)
local steppedValue = self:getSteppedValue(x)
local lowerValue = self.props.lowerValue
local upperValue = self.props.upperValue
if not self.lowerKnobDrag and not self.upperKnobDrag then
--Set which knob is being dragged (both if they are at the same position)
if steppedValue == lowerValue then
self.lowerKnobDrag = true
end
if steppedValue == upperValue then
self.upperKnobDrag = true
end
elseif self.lowerKnobDrag and self.upperKnobDrag then
--decides which knob to actually drag and change the value of when both are atop one another
if steppedValue - self.props.stepInterval >= upperValue then
self.upperKnobDrag = true
self.lowerKnobDrag = false
upperValue = steppedValue
elseif steppedValue + self.props.stepInterval <= lowerValue then
self.upperKnobDrag = false
self.lowerKnobDrag = true
lowerValue = steppedValue
end
elseif self.lowerKnobDrag then
--drag the left knob (but not sofar as to surpass the right knob)
if steppedValue <= upperValue then
lowerValue = steppedValue
end
elseif self.upperKnobDrag then
--drag the right knob (but not sofar as to surpass the left knob)
if steppedValue >= lowerValue then
upperValue = steppedValue
end
end
if upperValue ~= self.props.upperValue or lowerValue ~= self.props.lowerValue then
self.props.onValueChanged(lowerValue, upperValue)
end
end
function GenericSlider:stopListeningForDrag()
if self.moveConnection ~= nil then
self.moveConnection:Disconnect()
self.moveConnection = nil
end
if self.releaseConnection ~= nil then
self.releaseConnection:Disconnect()
self.releaseConnection = nil
end
if self.focusLostConnection ~= nil then
self.focusLostConnection:Disconnect()
self.focusLostConnection = nil
end
if self.inputCapturerButton ~= nil then
self.inputCapturerButton:Destroy()
self.inputCapturerButton = nil
end
self.dragging = false
self.lowerKnobDrag = false
self.upperKnobDrag = false
if self.props.onDragEnd ~= nil then
self.props.onDragEnd()
end
end
function GenericSlider:hasTwoKnobs()
return self.props.upperValue ~= nil
end
return Roact.forwardRef(function(props, ref)
return Roact.createElement(GenericSlider, Cryo.Dictionary.join(props, {
imageButtonRef = ref
}))
end) |
local Stdin = {}
function Stdin.new()
return setmetatable({pos = 1, chars = {}, cmds = {}, cmdpos = 1}, {__index = Stdin})
end
function Stdin:tostring()
return table.concat(self.chars)
end
function Stdin:reset()
self.chars = {}
self.pos = 1
end
function Stdin:deletechar(dir)
local delpos = self.pos
if dir < 0 then delpos = delpos - 1 end
if delpos < 1 or delpos > #self.chars then return end
table.remove(self.chars, delpos)
if dir < 0 then
self.pos = self.pos - 1
end
end
function Stdin:gochar(dir)
if dir < 0 then
self.pos = math.max(self.pos - 1, 1)
else
self.pos = math.min(self.pos + 1, #self.chars + 1)
end
end
local function nextwordpos(str, pos)
local _, _, pos = str:find("[%w_]+()", pos)
if pos == nil then pos = str:len() + 1 end
return pos
end
local function prevwordpos(str, pos)
local pos = nextwordpos(str:reverse(), str:len() - pos + 2) - 1
return str:len() - pos + 1
end
function Stdin:goword(dir)
local fn = nextwordpos
if dir < 0 then fn = prevwordpos end
local pos = fn(self:tostring(), self.pos)
self.pos = pos
end
function Stdin:delword(dir)
if dir > 0 then
local pos = nextwordpos(self:tostring(), self.pos)
pos = pos - 1
for i = self.pos, pos do
table.remove(self.chars, self.pos)
end
else
local pos = prevwordpos(self:tostring(), self.pos)
for i = pos, self.pos - 1 do
table.remove(self.chars, pos)
self.pos = self.pos - 1
end
end
end
function Stdin:goline(dir)
if dir < 0 then
self.pos = 1
else
self.pos = #self.chars + 1
end
end
function Stdin:killtoend()
for i = self.pos, #self.chars do
self.chars[i] = nil
end
end
function Stdin:insertchar(char)
table.insert(self.chars, self.pos, char)
self.pos = self.pos + 1
end
function Stdin:addcommand(cmd)
self.partialcmd = nil -- redundant?
table.insert(self.cmds, cmd)
self.cmdpos = #self.cmds + 1
end
function Stdin:maybesavecommand()
if self.cmdpos == #self.cmds + 1 then
self.partialcmd = self:tostring()
end
end
function Stdin:usecurrenthistory()
local partialcmd
if self.cmdpos == #self.cmds + 1 then
partialcmd = self.partialcmd
else
partialcmd = self.cmds[self.cmdpos]
end
self.chars = {}
for i = 1, partialcmd:len() do
local c = partialcmd:sub(i,i)
table.insert(self.chars, c)
end
self.pos = #partialcmd + 1
end
function Stdin:historynext()
self.cmdpos = math.min(self.cmdpos + 1, #self.cmds + 1)
self:usecurrenthistory()
end
function Stdin:historyprev()
self:maybesavecommand()
self.cmdpos = math.max(self.cmdpos - 1, 1)
self:usecurrenthistory()
end
function Stdin:transposechar()
if #self.chars < 2 or self.pos == 1 then return end
local pos = self.pos
if pos > #self.chars then pos = #self.chars end
local tmp = self.chars[pos-1]
self.chars[pos-1] = self.chars[pos]
self.chars[pos] = tmp
end
repl = {}
doc.repl = {__doc = [[
The REPL (Read-Eval-Print-Loop) is excellent for exploring and experiment with Hydra's API.
It has most of the familiar readline-like keybindings, including C-b, C-f, M-b, M-f to navigate your text, C-p and C-n to browse command history, etc.
Type `help` in the REPL for info on how to use the documentation system.]]}
doc.repl.open = {"repl.open([opts]) -> textgrid", "Opens a new REPL; the `opts` parameter is an optional table with keys: inputcolor, stdoutcolor, resultcolor, backgroundcolor; these are 6-digit CSS-like hex strings."}
function repl.open(opts)
local win = textgrid.open()
win:settitle("Hydra REPL")
win:protect()
local inputcolor = opts and opts.inputcolor or "00FF00"
local backgroundcolor = opts and opts.backgroundcolor or "222222"
local stdoutcolor = opts and opts.stdoutcolor or 'FF00FF'
local resultcolor = opts and opts.resultcolor or '00FFFF'
local scrollpos = 0
local stdout = {}
local stdin = Stdin.new()
local function printline(win, line, gridwidth, y)
if line == nil then return end
local chars = utf8.chars(line.str)
for x = 1, math.min(#chars, gridwidth) do
win:setchar(chars[x], x, y)
if line.kind == 'input' then
win:setcharfg(inputcolor, x, y)
elseif line.kind == 'printed' then
win:setcharfg(stdoutcolor, x, y)
elseif line.kind == 'result' then
win:setcharfg(resultcolor, x, y)
end
end
end
local function printscrollback()
local size = win:getsize()
for y = 1, math.min(#stdout, size.h) do
printline(win, stdout[y + scrollpos], size.w, y)
end
local promptlocation = #stdout - scrollpos + 1
if promptlocation <= size.h then
printline(win, {str = "> " .. stdin:tostring(), kind = 'input'}, size.w, promptlocation)
win:setcharfg(backgroundcolor, 2 + stdin.pos, promptlocation)
win:setcharbg(inputcolor, 2 + stdin.pos, promptlocation)
end
end
local function restrictscrollpos()
scrollpos = math.max(scrollpos, 0)
scrollpos = math.min(scrollpos, #stdout)
end
local function redraw()
win:setbg(backgroundcolor)
win:setfg(inputcolor)
win:clear()
printscrollback()
end
local function ensurecursorvisible()
local size = win:getsize()
scrollpos = math.max(scrollpos, (#stdout+1) - size.h)
end
win.resized = redraw
local function appendstdout(line, kind)
line = line:gsub("\t", " ")
table.insert(stdout, {str = line, kind = kind})
end
local function receivedlog(str)
appendstdout(str, 'printed')
redraw()
end
local loghandler = logger.addhandler(receivedlog)
function win.closed()
logger.removehandler(loghandler)
end
local function runcommand()
local command = stdin:tostring()
stdin:reset()
stdin:addcommand(command)
appendstdout("> " .. command, 'input')
local fn, errmsg = load("return " .. command)
if not fn then
-- parsing failed, try without return
fn, errmsg = load(command)
end
local resultstr
if fn then
-- parsed okay, execute it
local results = table.pack(pcall(fn))
local success = results[1]
table.remove(results, 1)
if success then
for i = 1, results.n - 1 do results[i] = tostring(results[i]) end
resultstr = table.concat(results, ", ")
else
resultstr = "error: " .. results[1]
end
else
-- no fn, pass syntax error on
resultstr = "syntax error: " .. errmsg
end
-- add each line separately
for s in string.gmatch(resultstr, "[^\n]+") do
appendstdout(s, 'result')
end
appendstdout("", 'result')
end
local function runprompt()
runcommand()
ensurecursorvisible()
end
local function delcharbackward()
stdin:deletechar(-1)
ensurecursorvisible()
end
local function delcharforward()
stdin:deletechar(1)
ensurecursorvisible()
end
local function scrollcharup()
scrollpos = scrollpos - 1
restrictscrollpos()
end
local function scrollchardown()
scrollpos = scrollpos + 1
restrictscrollpos()
end
local function gocharforward()
stdin:gochar(1)
ensurecursorvisible()
end
local function gocharbackward()
stdin:gochar(-1)
ensurecursorvisible()
end
local function gowordforward()
stdin:goword(1)
ensurecursorvisible()
end
local function gowordbackward()
stdin:goword(-1)
ensurecursorvisible()
end
local function delwordforward()
stdin:delword(1)
ensurecursorvisible()
end
local function delwordbackward()
stdin:delword(-1)
ensurecursorvisible()
end
local function golinefirst()
stdin:goline(-1)
ensurecursorvisible()
end
local function golinelast()
stdin:goline(1)
ensurecursorvisible()
end
local function killtoend(t)
stdin:killtoend()
ensurecursorvisible()
end
local function insertchar(t)
stdin:insertchar(t.key)
ensurecursorvisible()
end
local function historynext()
stdin:historynext()
ensurecursorvisible()
end
local function historyprev()
stdin:historyprev()
ensurecursorvisible()
end
local function transposechar()
stdin:transposechar()
ensurecursorvisible()
end
local mods = {
none = 0,
ctrl = 1,
alt = 2,
cmd = 4,
shift = 8,
}
local keytable = {
{"return", mods.none, runprompt},
{"tab", mods.none, function(t) end},
{"delete", mods.none, delcharbackward},
{"h", mods.ctrl, delcharbackward},
{"d", mods.ctrl, delcharforward},
{"p", mods.alt, scrollcharup},
{"n", mods.alt, scrollchardown},
{"p", mods.ctrl, historyprev},
{"n", mods.ctrl, historynext},
{"b", mods.ctrl, gocharbackward},
{"f", mods.ctrl, gocharforward},
{"b", mods.alt, gowordbackward},
{"f", mods.alt, gowordforward},
{"delete", mods.alt, delwordbackward},
{"w", mods.ctrl, delwordbackward},
{"d", mods.alt, delwordforward},
{"a", mods.ctrl, golinefirst},
{"e", mods.ctrl, golinelast},
{"k", mods.ctrl, killtoend},
{"t", mods.ctrl, transposechar},
{"left", mods.none, gocharbackward},
{"right", mods.none, gocharforward},
}
function win.keydown(t)
local mod = mods.none
if t.ctrl then mod = bit32.bor(mod, mods.ctrl) end
if t.alt then mod = bit32.bor(mod, mods.alt) end
if t.cmd then mod = bit32.bor(mod, mods.cmd) end
if t.shift then mod = bit32.bor(mod, mods.shift) end
local fn
for _, maybe in pairs(keytable) do
if t.key == maybe[1] and mod == maybe[2] then
fn = maybe[3]
break
end
end
if fn == nil and mod == mods.none or mod == mods.shift then
fn = insertchar
end
if fn then
fn(t)
end
redraw()
end
redraw()
win:focus()
return win
end
-- I'm sorry. I'm sorry for writing such ugly code. I know it's a mess. I've always known. But it /works/.
|
local Animation = require 'prefabs/player/playeranimstate'
local State = {}
local DASH_DISTANCE = 60
local DASH_SPEED = 300
local function get_move_dir()
local move_x = Input:keydown('d') - Input:keydown('a')
local move_y = Input:keydown('s') - Input:keydown('w')
return Vec2(move_x, move_y)
end
State.MOVING = {
init = function(self, player)
player:switch_anim(Animation.MOVE)
end,
update = function(self, player, dt)
local movedir = get_move_dir()
if movedir.x == 0 and movedir.y == 0 then
player:switch_state(State.IDLE)
return
end
local velocity = movedir:with_mag(player.speed * dt)
player:move(velocity)
end,
switch = function(self, player, state)
player:set_state(state)
end
}
State.DASHING = {
dash_dist = DASH_DISTANCE,
init = function(self, player)
player.dash_particles:configure({
particle_velocity = player.dash_dir:with_mag(-20),
particle_vel_randomness = 1,
particle_life = 1,
radius = 10
})
end,
update = function(self, player, dt)
local velocity = player.dash_dir:with_mag(DASH_SPEED * dt)
player.dash_particles:emit()
player:move(velocity)
self.dash_dist = self.dash_dist - DASH_SPEED * dt
if self.dash_dist <= 0 then self:switch(player, State.MOVING) end
player.weapon:set_pos(player:get_weapon_pivot())
end,
switch = function(self, player, state)
if self.dash_dist <= 0 then
-- player:set_scale(1, 1)
self.dash_dist = DASH_DISTANCE
player:set_state(state)
end
end
}
State.IDLE = {
init = function(_ --[[self]] , player)
player:switch_anim(Animation.IDLE)
end,
update = function(_ --[[self]] , player, dt)
local movedir = get_move_dir()
if movedir.x ~= 0 or movedir.y ~= 0 then
player:switch_state(State.MOVING)
end
end,
switch = function(_ --[[self]] , player, state)
player:set_state(state)
end
}
return State
|
local numberAdded = false
local secondMissionDone = false
local secondMissionStarted = false
local secondMissionIntroDone = false
--- Event handler for messages sent to the blocked contact (second mission)
RegisterNetEvent(eventNamespace .. blockedContact.namespace)
AddEventHandler(eventNamespace .. blockedContact.namespace, function(anon, message)
if isInSecondMission() then
local responseMsg = ""
if anon then
responseMsg = responseMsg .. _U('intro_msg_text_anon_obv')
end
if message == Locations.LifeInvader.DevPc.machine.ip.address then
completeSecondMission()
secondMissionDone = true;
else
ESX.ShowAdvancedNotification(blockedContact.name, _U('mission_2_msg_subtitle'), -- title, subtitle
responseMsg .. _U('mission_2_msg_text_fail'), -- message
"CHAR_BLOCKED", 1) -- contact photo, symbol
end
end
end)
function _secondMissionLogic()
if (not numberAdded and not secondMissionDone) then
if not secondMissionStarted then
TriggerEvent('esx_phone:addSpecialContact', blockedContact.name, blockedContact.number, blockedContact.base64Icon)
numberAdded = true
secondMissionStarted = true
elseif secondMissionStarted then
TriggerEvent('esx_phone:addSpecialContact', blockedContact.name, blockedContact.number, blockedContact.base64Icon)
numberAdded = true
end
end
if secondMissionStarted and not secondMissionDone and not secondMissionIntroDone then
ESX.ShowAdvancedNotification(blockedContact.name, _U('mission_2_msg_subtitle'), -- title, subtitle
_U('mission_2_msg_text_start'), -- message
"CHAR_BLOCKED", 1) -- contact photo, symbol
secondMissionIntroDone = true
end
end
--- Completes the second mission and advances the job rank
function completeSecondMission()
ESX.ShowAdvancedNotification(blockedContact.name, _U('mission_2_msg_subtitle'), -- title, subtitle
responseMsg .. _U('mission_2_msg_text_final'), -- message
"CHAR_BLOCKED", 1) -- contact photo, symbol
Citizen.Wait(1500)
TriggerServerEvent(eventNamespace .. "advJob", 2)
Citizen.Wait(1500)
TriggerEvent('esx_phone:removeSpecialContact', blockedContact.number)
TriggerEvent(eventNamespace .. "getNextTriggerTime")
end
--- Checks if player is in second mission.
-- @return true if job is hacker and rank is 1
function isInSecondMission()
return isHacker() and ESX.GetPlayerData().job.grade_name == 'scriptkid'
end
|
local geometry = require "hs.geometry"
function moveToCenterOfWindow(window)
-- local window = hs.window.focusedWindow()
local frame = window:frame()
hs.mouse.setAbsolutePosition(geometry.rectMidPoint(frame))
end |
require 'nn'
require './SReLU'
function ShiftedReLU(val, inplace, constant)
val = val or -1
constant = constant or false
if inplace == nil then
inplace = true
end
local m = nn.Sequential()
if constant then
m:add(nn.Threshold(val,val,inplace))
else
m:add(nn.SReLU(val, inplace))
end
return m
end
return ShiftedReLU
|
-- Script by amaurea, andymac and feos for FCEUX 2.2.0 and earlier versions.
-- Allows customizable recording of Frame, Lag, Timer and Input display to AVI dump.
-- Drag and drop HUD items with mouse, use Numpad 1-6 to switch them on/off.
print("Drag and drop HUD items with mouse, use Numpad 1-6 to switch them on/off.")
screen = {w=256,h=231}
move = {object=nil,offx=0,offy=0}
pads = {
{num=1,on=true, color="red", x=9, y=220,w=34,h=10,toggle="numpad1"},
{num=2,on=true, color="yellow",x=54, y=220,w=34,h=10,toggle="numpad2"},
{num=3,on=false,color="green", x=99, y=220,w=34,h=10,toggle="numpad3"},
{num=4,on=false,color="orange",x=144,y=220,w=34,h=10,toggle="numpad4"}
}
buttons = {
A = {x=30,y=5,w=3,h=3},
B = {x=24,y=5,w=3,h=3},
select = {x=18,y=7,w=3,h=1},
start = {x=12,y=7,w=3,h=1},
up = {x=4, y=1,w=2,h=2},
down = {x=4, y=7,w=2,h=2},
left = {x=1, y=4,w=2,h=2},
right = {x=7, y=4,w=2,h=2}
}
text = {on=true,x=1, y=9,w=30,h=16,toggle="numpad5"}
timer = {on=true,x=197,y=9,w=58,h= 7,toggle="numpad6"}
function drawpad(pad)
gui.drawbox( pad.x, pad.y, pad.x+pad.w, pad.y+pad.h, "#3070ffb0" )
gui.drawbox( pad.x+4, pad.y+4, pad.x+6, pad.y+6, "black" )
controller = joypad.read(pad.num)
for name, b in pairs(buttons) do
gui.drawbox( pad.x + b.x, pad.y + b.y, pad.x + b.x + b.w, pad.y + b.y + b.h,
controller[name] and pad.color or "black" )
end
end
function mouseover(pad, margin)
return keys.xmouse >= pad.x-margin and keys.xmouse <= pad.x+pad.w+margin and
keys.ymouse >= pad.y-margin and keys.ymouse <= pad.y+pad.h+margin
end
function inrange(upper, lower, testval)
if testval >= upper then return upper
elseif testval <= lower then return lower
else return testval
end
end
function concat(tables)
local res = {}
for _, tab in ipairs(tables) do
for _, val in ipairs(tab) do
table.insert(res, val)
end
end
return res
end
prev_keys = input.get()
objects = concat({pads, {text, timer}})
function everything()
keys = input.get()
-- Are we moving anything around?
if move.object then
if keys["leftclick"] then
-- Do not go outside screen
local safex = inrange(screen.w - move.object.w, 0, keys.xmouse - move.offx)
local safey = inrange(screen.h - move.object.h, 8, keys.ymouse - move.offy)
move.object.x = safex
move.object.y = safey
else move.object = nil end
-- Try to pick something up
elseif keys["leftclick"] then
for _,object in ipairs(objects) do
if mouseover(object,0) then
move.object = object
move.offx = keys.xmouse - object.x
move.offy = keys.ymouse - object.y
end
end
end
-- Toggle displays
for _, object in ipairs(objects) do
if keys[object.toggle] and not prev_keys[object.toggle] then
object.on = not object.on
end
end
-- Actually draw the stuff
if timer.on then
mins = math.floor(movie.framecount()/3600)
secs = movie.framecount()/60-mins*60
gui.text( timer.x, timer.y, string.format("%s:%05.2f",os.date("!%H:%M",mins*60),secs), "white" )
end
if text.on then
local done = movie.mode() == "finished" or movie.mode() == nil
gui.text( text.x, text.y, movie.framecount(), done and "red" or "white" )
gui.text( text.x, text.y + 9, FCEU.lagcount(), FCEU.lagged() and "red" or "green" )
end
for _, pad in ipairs(pads) do
if pad.on then drawpad(pad) end
end
prev_keys = keys
end
gui.register(everything)
while (true) do
FCEU.frameadvance()
end |
local K, C, L = unpack(KkthnxUI)
local Module = K:GetModule("Infobar")
local _G = _G
local string_format = _G.string.format
local COMBAT_ZONE = _G.COMBAT_ZONE
local CONTESTED_TERRITORY = _G.CONTESTED_TERRITORY
local C_Map_GetBestMapForUnit = _G.C_Map.GetBestMapForUnit
local FACTION_CONTROLLED_TERRITORY = _G.FACTION_CONTROLLED_TERRITORY
local FACTION_STANDING_LABEL4 = _G.FACTION_STANDING_LABEL4
local FREE_FOR_ALL_TERRITORY = _G.FREE_FOR_ALL_TERRITORY
local GameTooltip = _G.GameTooltip
local GetSubZoneText = _G.GetSubZoneText
local GetZonePVPInfo = _G.GetZonePVPInfo
local GetZoneText = _G.GetZoneText
local IsInInstance = _G.IsInInstance
local SANCTUARY_TERRITORY = _G.SANCTUARY_TERRITORY
local UnitExists = _G.UnitExists
local UnitIsPlayer = _G.UnitIsPlayer
local UnitName = _G.UnitName
local ZONE = _G.ZONE
local CoordsDataTextFrame
local coordX = 0
local coordY = 0
local faction
local pvpType
local subzone
local zone
local zoneInfo = {
arena = { FREE_FOR_ALL_TERRITORY, { 0.84, 0.03, 0.03 } },
combat = { COMBAT_ZONE, { 0.84, 0.03, 0.03 } },
contested = { CONTESTED_TERRITORY, { 0.9, 0.85, 0.05 } },
friendly = { FACTION_CONTROLLED_TERRITORY, { 0.05, 0.85, 0.03 } },
hostile = { FACTION_CONTROLLED_TERRITORY, { 0.84, 0.03, 0.03 } },
neutral = { string_format(FACTION_CONTROLLED_TERRITORY, FACTION_STANDING_LABEL4), { 0.9, 0.85, 0.05 } },
sanctuary = { SANCTUARY_TERRITORY, { 0.035, 0.58, 0.84 } },
}
local function formatCoords()
return string_format("%.1f, %.1f", coordX * 100, coordY * 100)
end
local function OnUpdate(self, elapsed)
self.elapsed = (self.elapsed or 0) + elapsed
if self.elapsed > 0.1 then
local x, y = K.GetPlayerMapPos(C_Map_GetBestMapForUnit("player"))
if x then
coordX, coordY = x, y
CoordsDataTextFrame.Text:SetText(string_format("%s", formatCoords()))
CoordsDataTextFrame:SetScript("OnUpdate", OnUpdate)
CoordsDataTextFrame:Show()
else
coordX, coordY = 0, 0
CoordsDataTextFrame.Text:SetText(string_format("%s", formatCoords()))
CoordsDataTextFrame:SetScript("OnUpdate", nil)
CoordsDataTextFrame:Hide()
end
self.elapsed = 0
end
end
local eventList = {
"ZONE_CHANGED",
"ZONE_CHANGED_INDOORS",
"ZONE_CHANGED_NEW_AREA",
"PLAYER_ENTERING_WORLD",
}
local function OnEvent()
subzone = GetSubZoneText()
zone = GetZoneText()
pvpType, _, faction = GetZonePVPInfo()
pvpType = pvpType or "neutral"
end
local function OnEnter()
GameTooltip:SetOwner(CoordsDataTextFrame, "ANCHOR_BOTTOM", 0, -15)
GameTooltip:ClearLines()
if pvpType and not IsInInstance() then
local r, g, b = unpack(zoneInfo[pvpType][2])
if zone and subzone and subzone ~= "" then
GameTooltip:AddLine(K.GreyColor .. ZONE .. ":|r " .. zone, r, g, b)
GameTooltip:AddLine(K.GreyColor .. "SubZone" .. ":|r " .. subzone, r, g, b)
else
GameTooltip:AddLine(K.GreyColor .. ZONE .. ":|r " .. zone, r, g, b)
end
GameTooltip:AddLine(string_format(K.GreyColor .. "PvPType" .. ":|r " .. zoneInfo[pvpType][1], faction or ""), r, g, b)
end
GameTooltip:AddLine(" ")
GameTooltip:AddLine(K.LeftButton .. L["WorldMap"], 0.6, 0.8, 1)
GameTooltip:AddLine(K.RightButton .. "Send My Pos", 0.6, 0.8, 1)
GameTooltip:Show()
end
local function OnLeave()
GameTooltip:Hide()
end
local function OnMouseUp(_, btn)
if btn == "LeftButton" then
ToggleWorldMap()
elseif btn == "RightButton" then
local hasUnit = UnitExists("target") and not UnitIsPlayer("target")
local unitName = nil
if hasUnit then
unitName = UnitName("target")
end
ChatFrame_OpenChat(string_format("%s: %s %s (%s) %s", "My Position", zone, subzone or "", formatCoords(), unitName or ""), SELECTED_DOCK_FRAME)
end
end
function Module:CreateCoordsDataText()
if not C["DataText"].Coords then
return
end
CoordsDataTextFrame = CoordsDataTextFrame or CreateFrame("Button", nil, UIParent)
CoordsDataTextFrame:SetPoint("TOP", UIParent, "TOP", 0, -40)
CoordsDataTextFrame:SetSize(20, 20)
CoordsDataTextFrame.Texture = CoordsDataTextFrame:CreateTexture(nil, "BACKGROUND")
CoordsDataTextFrame.Texture:SetPoint("CENTER", CoordsDataTextFrame, "CENTER", 0, 0)
CoordsDataTextFrame.Texture:SetAtlas("Navigation-Tracked-Icon")
CoordsDataTextFrame.Texture:SetSize(15, 20)
CoordsDataTextFrame.Texture:SetAlpha(0.8)
CoordsDataTextFrame.Text = CoordsDataTextFrame:CreateFontString(nil, "ARTWORK")
CoordsDataTextFrame.Text:SetFontObject(K.GetFont(C["UIFonts"].DataTextFonts))
CoordsDataTextFrame.Text:SetPoint("CENTER", CoordsDataTextFrame.Texture, "CENTER", 0, -14)
for _, event in pairs(eventList) do
CoordsDataTextFrame:RegisterEvent(event)
end
CoordsDataTextFrame:SetScript("OnEvent", OnEvent)
CoordsDataTextFrame:SetScript("OnMouseUp", OnMouseUp)
CoordsDataTextFrame:SetScript("OnUpdate", OnUpdate)
CoordsDataTextFrame:SetScript("OnLeave", OnLeave)
CoordsDataTextFrame:SetScript("OnEnter", OnEnter)
K.Mover(CoordsDataTextFrame, "CoordsDataText", "CoordsDataText", { "TOP", UIParent, "TOP", 0, -40 })
end
|
local modpath = minetest.get_modpath("news")
local md5 = dofile(modpath .. "/md5.lua")
local news = {}
local checksum
local caracteres_max = 5000
local pages_players = {}
local seen_checksum
function load_news()
local newsfile = io.open(minetest.get_worldpath().."/news.txt","r")
local content
if newsfile ~= nil then
content = newsfile:read("*a")
newsfile:close()
end
if content == nil or string.len(content) == 0 then
return
end
checksum = md5.sumhexa(content)
minetest.log("verbose", "[news] checksum is " .. checksum)
local nb = 1
news[nb] = ""
local commit = string.split(content, "\n\n")
for i,line in ipairs(commit) do
if string.len(news[nb]) < caracteres_max then
news[nb] = news[nb]..minetest.formspec_escape(line.."\n\n")
else
nb = nb + 1
news[nb] = minetest.formspec_escape(line.."\n\n")
end
end
end
load_news()
---- Loading/storage of seen news checksums. Write "return nil" into news.seen
---- to disable the feature.
-- Inbefore https://github.com/minetest/minetest/pull/4155
-- Bet this issue won't be fixed before early 2017
do
local file = io.open(minetest.get_worldpath().."/news.seen","r")
if file == nil then
seen_checksum = {}
else
local content = file:read("*a")
file:close()
seen_checksum = minetest.deserialize(content)
end
local type_seen = type(seen_checksum)
if type_seen ~= 'table' and type_seen ~= 'nil' then
minetest.log("error", "[news] Loading news.seen returned a " ..
type_seen .. ", expected table. Disabling \"seen\" feature.")
seen_checksum = nil
end
end
minetest.register_on_shutdown(function()
if seen_checksum then
local file = io.open(minetest.get_worldpath().."/news.seen", "w")
file:write(minetest.serialize(seen_checksum))
file:close()
end
end)
local function show_formspec(player, page)
local name = player:get_player_name()
if not name or (player:get_hp() <= 0) then return end
local nb_pages = #news
local formspec = "size[12,10;]"
formspec = formspec.."background[-0.22,-0.60;13,11.3;news_background.jpg]"
if page > nb_pages then
page = nb_pages
elseif page < 1 then
page = 1
end
pages_players[name] = page
if news[page] ~= nil then
formspec = formspec.."textarea[.50,.50;12,10;news;;"..news[page].."]"
else
formspec = formspec.."label[.50,.50;Pas d'article pour le moment]"
end
formspec = formspec.."button_exit[2,9.25;2,1;exit;Fermer]"..
"button[6,9.25;1,1;page;<<]"..
"button[7,9.25;1,1;page;<]"..
"button[8,9.25;1,1;none;"..page.."/"..nb_pages.."]"..
"button[9,9.25;1,1;page;>]"..
"button[10,9.25;1,1;page;>>]"
minetest.show_formspec(name,"news:news",formspec)
--minetest.log('action','Showing formspec to '..name.."page "..page)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname == "news:news" then
local name = player:get_player_name()
if not name then return end
local page = (pages_players[name] or 1)
if fields["quit"] then
pages_players[name] = nil
return
elseif fields["page"] == "<<" then
page = page - 2
elseif fields["page"] == "<" then
page = page - 1
elseif fields["page"] == ">" then
page = page + 1
elseif fields["page"] == ">>" then
page = page + 2
end
show_formspec(player,page)
end
end)
minetest.register_chatcommand("news",{
params = "<page>",
description="Montre les news du serveur",
func = function (name,params)
local player = minetest.get_player_by_name(name)
local page
if tonumber(params) then
page = tonumber(params)
else
page = 1
end
show_formspec(player, page)
end,
})
minetest.register_on_joinplayer(function (player)
local name = player:get_player_name()
if minetest.get_player_privs(name).interact then
if seen_checksum and seen_checksum[name] ~= checksum then
seen_checksum[name] = checksum
minetest.after(6,show_formspec,player, 1)
end
end
end)
|
-- Items.Lua
-- Item definitions for LoveExtension library
-- Copyright (c) 2011 Robert MacGregor
local Items = { }
Items.imageManager = require("scripts/Image.lua")
-- Shield1
-- 1/15 chance from enemies
local Shield1 =
{
Name = "Shield1",
EnemyPickup = false,
PlayerPickup = true,
Animation = { }
}
local Shield1Animation =
{
Speed = 500, -- In Milliseconds
Frame = { }
}
Shield1Animation.FrameCount = 3
Shield1Animation.Frame[1] = Items.imageManager.loadImage("media/textures/Shield1_1.png")
Shield1Animation.Frame[2] = Items.imageManager.loadImage("media/textures/Shield1_2.png")
Shield1Animation.Frame[3] = Items.imageManager.loadImage("media/textures/Shield1_3.png")
Shield1.Animation["IdleAnimation"] = Shield1Animation
function Shield1.update(dt, Object)
Object.setPosition(vector2d(Object.Position.X - (100 * dt), Object.Position.Y))
end
function Shield1.onPickup()
end
function Shield1.draw(Object)
end
Items["Shield1"] = Shield1
table.insert(Items, Shield1)
-- Shield2
-- 1/15 chance from enemies
local Shield2 =
{
Name = "Shield2",
EnemyPickup = false,
PlayerPickup = true,
Animation = { }
}
local Shield2Animation =
{
Speed = 500, -- In Milliseconds
Frame = { }
}
Shield2Animation.FrameCount = 3
Shield2Animation.Frame[1] = Items.imageManager.loadImage("media/textures/Shield2_1.png")
Shield2Animation.Frame[2] = Items.imageManager.loadImage("media/textures/Shield2_2.png")
Shield2Animation.Frame[3] = Items.imageManager.loadImage("media/textures/Shield2_3.png")
Shield2.Animation["IdleAnimation"] = Shield2Animation
function Shield2.update(dt, Object)
Object.setPosition(vector2d(Object.Position.X - (100 * dt), Object.Position.Y))
end
function Shield2.onPickup()
end
function Shield2.draw(Object)
end
Items["Shield2"] = Shield2
table.insert(Items, Shield2)
-- Money
-- 1/15 chance from enemies
local Money =
{
Name = "Money",
EnemyPickup = false,
PlayerPickup = true,
Animation = { }
}
local MoneyAnimation =
{
Speed = 500, -- In Milliseconds
Frame = { }
}
MoneyAnimation.FrameCount = 2
MoneyAnimation.Frame[1] = Items.imageManager.loadImage("media/textures/Currency_1.png")
MoneyAnimation.Frame[2] = Items.imageManager.loadImage("media/textures/Currency_2.png")
Money.Animation["Animation"] = MoneyAnimation
function Money.update(dt, Object)
Object.setPosition(vector2d(Object.Position.X - (100 * dt), Object.Position.Y))
end
function Money.onPickup()
end
function Money.draw(Object)
end
Items["Money"] = Money
table.insert(Items, Money)
return Items
|
nssm:register_mob("nssm:manticore", "Manticore", {
type = "monster",
hp_max = 55,
hp_min = 34,
collisionbox = {-0.8, -0.85, -0.8, 0.8, 1.9, 0.8},
visual = "mesh",
mesh = "manticore.x",
textures = {{"manticore.png"}},
visual_size = {x=4, y=4},
makes_footstep_sound = true,
view_range = 35,
fear_height = 4,
walk_velocity = 2,
run_velocity = 4,
sounds = {
random = "manticore",
},
damage = 6,
jump = true,
drops = {
{name = "nssm:life_energy",
chance = 1,
min = 3,
max = 4,},
{name = "nssm:manticore_spine",
chance = 3,
min = 2,
max = 5,},
{name = "nssm:manticore_fur",
chance = 3,
min = 1,
max = 2,},
},
armor = 60,
drawtype = "front",
water_damage = 2,
rotate = 270,
lava_damage = 5,
light_damage = 0,
on_rightclick = nil,
attack_type = "dogshoot",
dogshoot_switch = true,
arrow = "nssm:spine",
shoot_interval = 2,
group_attack=true,
attack_animals=true,
knock_back=2,
blood_texture="nssm_blood.png",
stepheight=1.1,
shoot_offset = 1,
animation = {
speed_normal = 25,
speed_run = 25,
stand_start = 1,
stand_end = 40,
walk_start = 240,
walk_end = 280,
run_start = 91,
run_end = 108,
punch_start = 110,
punch_end = 143,
shoot_start =180,
shoot_end=230,
},
})
|
local VehicleUI = {
rootPath = "plugins.cyber_engine_tweaks.mods.cityhack.",
LightStateCurrent = 0,
LightStates = {"Off", "Normal", "High Beams"},
ValidVehicleTypes = {
"vehicleCarBaseObject",
"vehicleBikeBaseObject",
"vehicleAVBaseObject"
}
}
local Theme = require(VehicleUI.rootPath.."ui.theme")
local Util = require(VehicleUI.rootPath.."hacks.modules.utility")
function VehicleUI.Create(CityHack, Style, Observer)
if Util.IfArrayHasValue(VehicleUI.ValidVehicleTypes, Observer.LookedObject()) then
Theme.TabStart()
if ImGui.BeginTabItem("Vehicles") then
Theme.TabInner()
ImGui.SetWindowSize(280, 630)
---------------- CAR DOORS ----------------
Theme.DisplayLabel("Doors")
ImGui.Columns(2, "CarDoors", false)
if ImGui.Button("Open All", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.Doors("open") then
CityHack.Util.Response("car doors", "open", true, false)
else
CityHack.Util.Response("car doors", "open", false, false)
end
end
if ImGui.Button("Close All", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.Doors("close") then
CityHack.Util.Response("car doors", "close", true, false)
else
CityHack.Util.Response("car doors", "close", false, false)
end
end
ImGui.NextColumn()
if ImGui.Button("Lock All", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.Doors("lock") then
CityHack.Util.Response("car doors", "lock", true, false)
else
CityHack.Util.Response("car doors", "lock", false, false)
end
end
if ImGui.Button("Unlock All", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.Doors("lock") then
CityHack.Util.Response("car doors", "unlock", true, false)
else
CityHack.Util.Response("car doors", "unlock", false, false)
end
end
ImGui.Columns(1)
ImGui.Spacing()
ImGui.Separator()
ImGui.Spacing()
---------------- CAR WINDOWS ----------------
ImGui.Columns(2, "CarWindows", false)
Theme.DisplayLabel("Windows")
ImGui.PushID("CarWindowOpenAll")
if ImGui.Button("Open All", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.Windows("open") then
CityHack.Util.Response("car windows", "open", true, false)
else
CityHack.Util.Response("car windows", "open", false, false)
end
end
ImGui.PopID()
ImGui.PushID("CarWindowCloseAll")
if ImGui.Button("Close All", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.Windows("close") then
CityHack.Util.Response("car windows", "close", true, false)
else
CityHack.Util.Response("car windows", "close", false, false)
end
end
ImGui.PopID()
ImGui.NextColumn()
---------------- CAR LIGHTS ----------------
Theme.PushStyleColor(ImGuiCol.Text, Theme.CustomToggleOn)
ImGui.LabelText("##","LIGHTS")
ImGui.PopStyleColor()
ImGui.Spacing()
local lights = table.concat(VehicleUI.LightStates, "\0")
ImGui.PushItemWidth(Style.buttonWidth)
VehicleUI.LightStateCurrent = ImGui.Combo("##Car Light State", VehicleUI.LightStateCurrent, lights, 3)
ImGui.PopItemWidth()
if ImGui.Button("Set Lights", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.Lights(VehicleUI.LightStateCurrent) then
CityHack.Util.Response("car lights", "set", true, false)
else
CityHack.Util.Response("car lights", "set", false, false)
end
end
ImGui.Spacing()
ImGui.Spacing()
ImGui.Spacing()
ImGui.Spacing()
ImGui.Separator()
ImGui.Spacing()
ImGui.Columns(1)
---------------- CAR ENGINE ----------------
ImGui.Columns(2, "CarEngine", false)
Theme.DisplayLabel("Engine")
if ImGui.Button("Turn On", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.Engine("on") then
CityHack.Util.Response("vehicle engine", "on", true, false)
else
CityHack.Util.Response("vehicle engine", "on", false, false)
end
end
if ImGui.Button("Turn Off", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.Engine("off") then
CityHack.Util.Response("vehicle engine", "off", true, false)
else
CityHack.Util.Response("vehicle engine", "off", false, false)
end
end
ImGui.Spacing()
ImGui.Spacing()
---------------- CAR MAYHEM ----------------
Theme.DisplayLabel("Mayhem")
if ImGui.Button("Detach All Parts", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.DetachAll() then
CityHack.Util.Response("vehicle", "detach all", true, false)
else
CityHack.Util.Response("vehicle", "detach all", false, false)
end
end
if ImGui.Button("Destroy", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.Destroy() then
CityHack.Util.Response("vehicle", "destroy", true, false)
else
CityHack.Util.Response("vehicle", "destroy", false, false)
end
end
if ImGui.IsItemHovered() then
ImGui.SetTooltip("WARNING: Stand back! The explosion may kill you!")
end
ImGui.NextColumn()
Theme.DisplayLabel("Utility")
---------------- CAR UTILITY ----------------
if ImGui.Button("Repair", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.Repair() then
CityHack.Util.Response("vehicle", "repair", true, false)
else
CityHack.Util.Response("vehicle", "repair", false, false)
end
end
if ImGui.IsItemHovered() then
ImGui.SetTooltip("This will visually repair the vehicle but will\r\nnot re-attach missing parts or fix broken lights.")
end
if ImGui.Button("Honk & Flash", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.HonkFlash() then
CityHack.Util.Response("vehicle", "honk & flash", true, false)
else
CityHack.Util.Response("vehicle", "honk & flash", false, false)
end
end
if ImGui.Button("Set Immortal", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.SetGod() then
CityHack.Util.Response("vehicle", "set immortal", true, false)
else
CityHack.Util.Response("vehicle", "set immortal", false, false)
end
end
if ImGui.IsItemHovered() then
ImGui.SetTooltip("Sets vehicle to immortality meaning it can't be fully destroyed.\r\nWill still take visual damage.")
end
if ImGui.Button("Toggle Summon", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.ToggleSummonMode() then
CityHack.Util.Response("vehicle", "toggle summon mode", true, false)
else
CityHack.Util.Response("vehicle", "toggle summon mode", false, false)
end
end
if ImGui.IsItemHovered() then
ImGui.SetTooltip("Toggles between vehicle driving to you and car instant\r\nspawning in front of you when summoned.")
end
if ImGui.Button("! Cycle Look", Style.buttonWidth, Style.buttonHeight) then
if CityHack.Vehicle.CycleAppearance() then
CityHack.Util.Response("vehicle", "cycle appearance", true, false)
else
CityHack.Util.Response("vehicle", "cycle appearance", false, false)
end
end
if ImGui.IsItemHovered() then
ImGui.SetTooltip("! EXPERIMENTAL ! Cycle through vehicle appearances.")
end
-- if ImGui.Button("Despawn", Style.buttonWidth, Style.buttonHeight) then
-- if CityHack.Vehicle.Despawn() then
-- CityHack.Util.Response("vehicle", "cycle appearance", true, false)
-- else
-- CityHack.Util.Response("vehicle", "cycle appearance", false, false)
-- end
-- end
ImGui.Columns(1)
ImGui.EndTabItem()
end
end
end
return VehicleUI |
Hive.kSpecksEffect = PrecacheAsset("cinematics/alien/hive/specks_heavy.cinematic")
Hive.kIdleMistEffect = PrecacheAsset("cinematics/alien/hive/idle_mist_far.cinematic")
|
object_static_structure_military_military_rebel_clone_tent_large = object_static_structure_military_shared_military_rebel_clone_tent_large:new {
}
ObjectTemplates:addTemplate(object_static_structure_military_military_rebel_clone_tent_large, "object/static/structure/military/military_rebel_clone_tent_large.iff")
|
function Parse(tokens)
local root = {id = nil}
for i,t in pairs(tokens) do
if t.id == "CMD" then
local cmdNode = {bin = "", args = {}, children = {}}
cmdNode.id = "CMD"
cmdNode.bin = t.value
cmdNode.args = t.args
if root.id == "AND" or root.id == "OR" or root.id == "PIPE" then
root.children[#root.children+1] = cmdNode
else
root = cmdNode
end
elseif t.id == "AND" then
if root.id == "AND" then
-- continue baby
else
local andNode = {id = "AND", children = {root}}
root = andNode
end
elseif t.id == "OR" then
if root.id == "OR" then
-- continue baby
else
local orNode = {id = "OR", children = {root}}
root = orNode
end
elseif t.id == "PIPE" then
if root.id == "PIPE" then
-- continue baby
else
local pipeNode = {id = "PIPE", children = {root}}
root = pipeNode
end
end
end
return root
end |
function isCoordInPolygon( x, y, boundaryTable, numEdges )
numEdges = numEdges or #boundaryTable + 1
local c, j = 0, numEdges - 1
for i=0, numEdges - 1, 1 do
if i ~= 0 then j = i - 1 end
if leftIntersect( x, y, boundaryTable[i].x, boundaryTable[i].y, boundaryTable[j].x, boundaryTable[j].y ) then c = c + 1 end
end
if numEdges == 0 then return true end
return ( c % 2 ) == 1
end
-- returns 1 if x,y crosses the line on its way to -infinity,y
function leftIntersect( x, y, x1, y1, x2, y2 )
if not ((y1 <= y and y <= y2) or ( y2 <= y and y <= y1 )) then return false end
-- x co-ord of point on the line, at height y
local point = ( y - y1 ) * ( x2 - x1 ) / ( y2 - y1 ) + x1
return x > point
end
function isPointOutOfBounds( x, y )
return not isCoordInPolygon( x, y, data.boundaryCorners, #data.boundaryCorners + 1 )
end
function checkPlayersOutOfBounds()
for _, value in ipairs( getElementsByType( "player" ) ) do
if value and isElement( value ) and getPlayerClassID( value ) then
local x, y, z = getElementPosition( value )
if options.boundariesEnabled and z<1000 and tonumber(getElementInterior(value)) == 0 then
if isPointOutOfBounds( x, y ) then
sendGameText( value, "You are out of bounds!", 5000, sampTextdrawColours.r, nil, 1.2, nil, nil, 2 )
local lastX = getElementData( value, "ptpm.goodX" )
local lastY = getElementData( value, "ptpm.goodY" )
local lastZ = getElementData( value, "ptpm.goodZ" )
--local lastX = playerInfo[value].goodX
--local lastY = playerInfo[value].goodY
--local lastZ = playerInfo[value].goodZ
local vehicle = getPedOccupiedVehicle( value )
if vehicle and getVehicleController( vehicle ) == value then
setElementPosition( vehicle, lastX, lastY, lastZ )
local rx, ry, rz = getVehicleRotation( vehicle )
setVehicleRotation( vehicle, rx, ry, (rz + 180) % 360)
x, y, z = getElementVelocity( vehicle )
setElementVelocity( vehicle, x*-0.5, y*-0.5, z*-1 )
else
setElementPosition( value, lastX, lastY, lastZ )
setElementVelocity( value, 0, 0, 0 )
end
else
setElementData( value, "ptpm.goodX", x, false )
setElementData( value, "ptpm.goodY", y, false )
setElementData( value, "ptpm.goodZ", z, false )
--playerInfo[value].goodX = x
--playerInfo[value].goodY = y
--playerInfo[value].goodZ = z
end
end
if options.vehicleHeightLimit and z > options.vehicleHeightLimit then
local vehicle = getPedOccupiedVehicle( value )
if vehicle then
sendGameText( value, "You are out of bounds!", 5000, sampTextdrawColours.r, nil, 1.2, nil, nil, 2 )
x, y, z = getElementVelocity( vehicle )
setElementVelocity( vehicle, x, y, -0.25 )
end
end
end
end
end |
-----------------------------------
-- Area: Metalworks
-- NPC: Unlucky Rat
-- Starts & Finishes Quest: Mean Machine
-----------------------------------
require("scripts/globals/quests")
require("scripts/globals/settings")
local ID = require("scripts/zones/Metalworks/IDs")
-----------------------------------
function onTrade(player, npc, trade)
local MeanMachine = player:getQuestStatus(BASTOK, tpz.quest.id.bastok.MEAN_MACHINE)
if (MeanMachine == QUEST_ACCEPTED) then
local FreeSlots = player:getFreeSlotsCount()
if (FreeSlots >= 1) then
count = trade:getItemCount()
SlimeOil = trade:hasItemQty(637, 1)
if (SlimeOil == true and count == 1) then
player:startEvent(557)
end
else
player:messageSpecial(ID.text.FULL_INVENTORY_AFTER_TRADE, 4731)
end
end
end
function onTrigger(player, npc)
local MeanMachine = player:getQuestStatus(BASTOK, tpz.quest.id.bastok.MEAN_MACHINE)
local Fame = player:getFameLevel(BASTOK)
if (MeanMachine == QUEST_AVAILABLE and Fame >= 2) then
player:startEvent(556)
elseif (MeanMachine == QUEST_ACCEPTED) then
player:startEvent(559)
else
player:startEvent(550)
end
end
function onEventUpdate(player, csid, option)
-- printf("CSID2: %u", csid)
-- printf("RESULT2: %u", option)
end
function onEventFinish(player, csid, option)
if (csid == 556) then
player:addQuest(BASTOK, tpz.quest.id.bastok.MEAN_MACHINE)
elseif (csid == 557) then
player:completeQuest(BASTOK, tpz.quest.id.bastok.MEAN_MACHINE)
player:addFame(BASTOK, 120)
player:tradeComplete()
player:addItem(4869)
player:messageSpecial(ID.text.ITEM_OBTAINED, 4869)
end
end
|
--Script Name : jlp_Add track separator
--Author : Jean Loup Pecquais
--Description : Add track separator
--v1.0.0
local libPath = reaper.GetExtState("Reaper Evolution", "libPath")
if not libPath or libPath == "" then
reaper.MB("Reaper Evolution library is not found. Please refer to user guide", "Library not found", 0)
return
end
loadfile(libPath .. "reaVolutionLib.lua")()
-------------------------------------------------------------------------------------------------------------
function main()
local frames = 10
reaper.PreventUIRefresh(-1*frames)
local pathTheme = reaper.GetLastColorThemeFile()
local _, pathTheme, _ = parseFilePath(pathTheme)
local track = reaper.GetSelectedTrack2(0, reaper.CountSelectedTracks(0)-1, false)
local idx = nil
if track then
idx = reaper.GetMediaTrackInfo_Value( track, "IP_TRACKNUMBER" ) --or reaper.GetMediaTrackInfo_Value( reaper.GetLastTouchedTrack(), "IP_TRACKNUMBER" )
end
if idx == nil then idx = reaper.CountTracks() end
reaper.InsertTrackAtIndex( idx, false)
local newTrack = reaper.GetTrack(0, idx)
local retval, stringNeedBig = reaper.GetSetMediaTrackInfo_String( newTrack, "P_NAME" , "Separator", true )
if pathTheme == "ReaVolutionTheme.ReaperTheme" then
local retval = reaper.BR_SetMediaTrackLayouts( newTrack, "Separator Thin", "Separator" )
end
reaper.PreventUIRefresh(frames)
end
main() |
-- Copyright 2006-2020 Mitchell. See LICENSE.
-- MediaWiki LPeg lexer.
-- Contributed by Alexander Misel.
local lexer = require('lexer')
local token, word_match = lexer.token, lexer.word_match
local P, S, B = lpeg.P, lpeg.S, lpeg.B
local lex = lexer.new('mediawiki')
-- Comments.
lex:add_rule('comment', token(lexer.COMMENT, lexer.range('<!--', '-->')))
-- HTML-like tags
local tag_start = token('tag_start', '<' * P('/')^-1 * lexer.alnum^1 *
lexer.space^0)
local tag_attr = token('tag_attr', lexer.alpha^1 * lexer.space^0 *
('=' * lexer.space^0 *
('"' * ((lexer.any - S('>"\\')) + ('\\' * lexer.any))^0 * '"' +
(lexer.any - lexer.space - '>')^0)^-1)^0 * lexer.space^0)
local tag_end = token('tag_end', P('/')^-1 * '>')
lex:add_rule('tag', tag_start * tag_attr^0 * tag_end)
lex:add_style('tag_start', lexer.styles.keyword)
lex:add_style('tag_attr', lexer.styles.type)
lex:add_style('tag_end', lexer.styles.keyword)
-- Link
lex:add_rule('link', token(lexer.STRING, S('[]')))
lex:add_rule('internal_link', B('[[') *
token('link_article', (lexer.any - '|' - ']]')^1))
lex:add_style('link_article', lexer.styles.string .. {underlined = true})
-- Templates and parser functions.
lex:add_rule('template', token(lexer.OPERATOR, S('{}')))
lex:add_rule('parser_func', B('{{') *
token('parser_func', P('#') * lexer.alpha^1 + lexer.upper^1 * ':'))
lex:add_rule('template_name', B('{{') *
token('template_name', (lexer.any - S('{}|'))^1))
lex:add_style('parser_func', lexer.styles['function'])
lex:add_style('template_name', lexer.styles.operator .. {underlined = true})
-- Operators.
lex:add_rule('operator', token(lexer.OPERATOR, S('-=|#~!')))
-- Behavior switches
local start_pat = P(function(_, pos) return pos == 1 end)
lex:add_rule('behavior_switch', (B(lexer.space) + start_pat) *
token('behavior_switch', '__' *
(P('TOC') + 'FORCETOC' + 'NOTOC' + 'NOEDITSECTION' + 'NOCC' + 'NOINDEX') *
'__') * #lexer.space)
lex:add_style('behavior_switch', lexer.styles.keyword)
return lex
|
if nil == cc.XMLHttpRequest then
return
end
-- This is the DeprecatedNetworkClass
DeprecatedNetworkClass = {} or DeprecatedNetworkClass
--tip
local function deprecatedTip(old_name,new_name)
print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")
end
--WebSocket class will be Deprecated,begin
function DeprecatedNetworkClass.WebSocket()
deprecatedTip("WebSocket","cc.WebSocket")
return cc.WebSocket
end
_G["WebSocket"] = DeprecatedNetworkClass.WebSocket()
--WebSocket will be Deprecated,end
|
fx_version 'adamant'
game 'gta5'
version '1.0.0'
client_scripts {
'config.lua',
'client.lua'
}
server_scripts {
'@mysql-async/lib/MySQL.lua',
'server.lua'
}
dependencies {
'esx_vehicleshop'
} |
--[[ --------MASTER/CONTROLLER Prog. Board
Setup:
Connect/link the databank that is connected to the worker/slave boards, connect the core (don't forget this, or no custom names shall show up!),
and displays (connect one display per worker/slave board that you'll use/define; and NAME THEM! or use the default slot names, but remmember who is who ffs, you'll need it later).
Edit the lua parameters (right click, advanced>>edit lua parameters; set the refresh/timer/tick rate at what the screens will update; make sure it's >= worker pboard refresh.)
Now comes the somewhat "maybe" tricky part.
If you have more than one worker/slave board, then you'll need
to copy&paste some code, and change a couple lines of code. I'll try my best to lead you on how to do it.
Example, if you have 3 worker/slave boards (make sure their IDs are unique! and note them down. you'll need them) connected and feeding to the databank,
then you'll need 3 displays. each display is going to show you their respective board (1:1 ratio for now; working on this part).
Now, how do you do that, simple. To try and keep it simple for even new players to the game, I tried to keep this realy basic. so, here we go.
duplicate as many times, as many displays/worker boards you've got connected, the following line that you have put into the tick/timer section "screens":
display.setHTML(renderHTML("PB1"))
If you notice the PB1, is the default unique ID for the initial single worker/slave board. and you'll also notice that the display slot is named "display".
So, if you have more displays and you've named their respective slots on the controller board, for example, display1, display2, displayMetalWorks...
You'd change the code in the tick/timer filter, like so:
display1.setHTML(renderHTML("PB1")) it'll show the status of the industries connected to the PB1 worker/slave board on display1.
display2.setHTML(renderHTML("PB2")) it'll show the status of the industries connected to PB2 on the display2... and so on.
displayMetalWorks.setHTML(renderHTML('MetalWorks')) it'll show the status of indy's connected to worker boards MetalWorks on displayMetalWorks... you catch my drift?
|----------------| |----------|
display_slot_name . function ( function ('UID you defined on the worker/slave board') )
There you have it.
So, just make sure, that you are using unique identifiers on the worker/slave boards (check the worker.lua header for info), and that you know where the connected displays are linked to (which slots on the controller board).
Then, put an extra line on the tick/timer filter, with the correct display slot name, and the worker/slave board ID, and you shoul'd be golden.
Insert code below onto unit>>start() filter and the timer/tick.
]]
--// the "magic" starts here...
--
if display1 then
display1.activate()
display1.setCenteredText("Industry Monitor Starting...")
end
if display2 then
display2.activate()
display2.setCenteredText("Industry Monitor Starting...")
end
if display3 then
display3.activate()
display3.setCenteredText("Industry Monitor Starting...")
end
if displayAlerts then
displayAlerts.activate()
displayAlerts.setCenteredText("Industry Monitor Starting...")
end
unit.hide()
--
--variables
_mode = 0 --export: default mode: Industry Monitor (0) alternate mode, Alert Monitor (1), the latter will only exhibit error'd industries.
local refresh = 10 --export: refresh info screen every # seconds (keep it higher than the worker boards)
local _strON = "ON" --export: string to display when industry is ON
local _strOFF = "OFF" --export: string to display when industry is OFF
local _strHLD = "HLD" --export: string to display when industry is on hold/maintain mode
local _strREZ = "REZ" --export: string to display when industry is in need for resources (input)
local _strERR = "ERR" --export: string to display when industry is in fault/error mode
local _colorBGHeader = "red" --export: html color code, that you want the header background to have. can be #ffffff values, or simple colour names (red, yellow, green.... check htmlcolorcodes.com ;] )
local _colorFGHeader = "black" --export: html colour code, that you want the header font to have. can be #ffffff values, or simple colour names (red, yellow, green.... check htmlcolorcodes.com ;] )
local _colorTable = "white" --export: industry names and efficiency font colour
_dbCounter = 0
--
--functions
function tablelenght(input)
local count = 0
for _ in pairs(input) do count = count + 1 end
return count
end
--
function getAlerts()
local _keys = json.decode(databank.getKeys())
local _datum = {}
local strings = {}
if _keys then
for i=1, #_keys do
local _tmp = json.decode(databank.getStringValue(_keys[i]))
for x=1, tablelenght(_tmp) do
if string.match(_tmp[x].status, "ERR") then
table.insert(_datum, core.getElementNameById(_tmp[x].id))
end
end
end
else
system.print("MASTER:DB_ERR:NO_KEYS! Empty Keys!")
end
if #_datum > 0 then
local count = 0
for z=1, tablelenght(_datum) do
local str = ""
count = count + 1
str = str .. [[<th style="text-align: left;">]] .. _datum[z] .. [[</th><th style="color: red; !important;">]] .. _strERR .. "</th>"
table.insert(strings, str)
if count == 9 then
break
end
end
return strings
else
table.insert(strings, [[<td colspan="2" style="text-align: center; color: green; !important; max-width: 100%; font-size: 12rem;">!ALL CLEAR!</td>]])
return strings
end
end
--
function getWorkerDbData(_PBID)
local _data = json.decode(databank.getStringValue(_PBID))
local strings = {}
if _data then
for k,v in pairs(_data) do
local str = ""
if string.match(_data[k].status, "OFF") then
str = str .. [[<th style="text-align: left;">]] .. core.getElementNameById(_data[k].id) .. "</th><th>" .. _strOFF .. "</th><th>NaN</th>"
elseif string.match(_data[k].status, "ON") then
str = str .. [[<th style="text-align: left;">]] .. core.getElementNameById(_data[k].id) .. [[</th><th style="color: green;">]] .. _strON .. "</th><th>" .. string.format("%.1f",_data[k].efficiency * 100) .."</th>"
elseif string.match(_data[k].status, "HLD") then
str = str .. [[<th style="text-align: left;">]] .. core.getElementNameById(_data[k].id) .. [[</th><th style="color: yellow;">]] .. _strHLD .. "</th><th>" .. string.format("%.1f",_data[k].efficiency * 100) .."</th>"
elseif string.match(_data[k].status, "REZ") then
str = str .. [[<th style="text-align: left;">]] .. core.getElementNameById(_data[k].id) .. [[</th><th style="color: orange; !important;">]] .. _strREZ .. "</th><th>" .. string.format("%.1f",_data[k].efficiency * 100) .."</th>"
elseif string.match(_data[k].status, "ERR") then
str = str .. [[<th style="text-align: left;">]] .. core.getElementNameById(_data[k].id) .. [[</th><th style="color: red; !important;">]] .. _strERR .. "</th><th>" .. string.format("%.1f",_data[k].efficiency * 100) .."</th>"
else str = [[<th colspan="3" style="color: red; !important;">FUBAR</th>]]
end
table.insert(strings, str)
end
else system.print("DB_WARN:READ_ERROR!") --you forgot to connect the damned databank, or turn on the worker/slave board :P
end
--
return strings
end
--
function renderHTML(_pbID)
local htmlout = ""
local _status = {}
local header = ""
local table = ""
local div = ""
if _mode == 1 or string.match(_pbID, "lert") then
_status = getAlerts()
header = "<th>ALERT</th><th>CODE</th>"
table = [[<table style="width: 100%; font-size: 8rem;">]]
div = [[<div class="row" style="justify-content: center;">]]
else
_status = getWorkerDbData(_pbID)
header = "<th>Industry</th><th>Status</th><th>%</th>"
table = [[<table style="margin-left: auto; margin-right: auto; width: 98%; font-size: 9rem;">]]
div = [[<div class="row" style="justify-content: center;">]]
end
--
for i=1, #_status do
htmlout = htmlout .. [[<tr style="font-size: 7rem; font-family: roboto">]] .. _status[i] .. "</tr>"
end
--
local html = [[
<style>
body {
border: 3px solid red;
}
.container {
font-size: 10rem;
color:]] .. _colorTable .. [[;
}
</style>
<div class="container">]] .. div .. table ..
[[<tr style="background-color:]] .. _colorBGHeader ..
"; color: " .. _colorFGHeader .. [[; font-size: 10rem; text-align: center;">]]
.. header ..[[</tr>]] .. htmlout .. [[</table></div></div>]]
--
return html
end
--
--runtime
if databank then
databank.clear()
system.print("MASTER: DB_CLEAR!")
unit.setTimer("screens", refresh)
else
system.print("ERROR: DB MISSING!")
end
--[[ insert into unit>>tick("screens") filter]]
--
_dbCounter = _dbCounter + 1
if _dbCounter >= 10 then
databank.clear()
_dbCounter = 0
--this will clear all keys from the DB every 10 cycles (10 x refresh timer; seconds)
--in order to display properly, if you remove/add new industries, during runtime.
else
display1.setHTML(renderHTML('PB1'))
display2.setHTML(renderHTML('PB2'))
display3.setHTML(renderHTML('PB3'))
displayAlerts.setHTML(renderHTML('Alerts'))
--[[insert or remove more above this line, one line per display:pboard combo, example:
display2.setHTML(renderHTML('PB2') -- it'll show the status of the industries connected to
worker prog.broad with UID "PB2" on the display connected to, the named slot "display2".
Notes:
1)if running in Alert Monitor Mode (only), you'll need only one display. so just add/leave a line like this, or leave the default one:
display.setHTML(renderHTML('Alerts') -- make sure there's a display connected and that its slot
is named "display". if not, change the line accordingly. also ensure that the lua parameter for the mode is set to 1.
In this mode, it'll show only industries connected to the worker prog.boards that are in error (failed status; check codex for them.).
2) dual mode (monitor + alerts)
then follow the initial instruction (not note #1), and create another line like this:
displayAlerts.setHTML(renderHTML('Alerts')) -- where displayAlerts is the name of the slot where you have the dedicated monitor connected.
you can have displays to monitor the industry and a added one just for Alerts/Alarms (faulted industries; be advised that it's not yet possible
identify industries with Unknown Server Error. since those do not provide any alarm code via the lua API.).
]]
end
--[[ insert into unit>>stop() filter]]
--
if display1 then
display1.clear()
display1.deactivate()
end
if display2 then
display2.clear()
display2.deactivate()
end
if display3 then
display3.clear()
display3.deactivate()
end
if displayAlerts then
displayAlerts.clear()
displayAlerts.deactivate()
end
--EOF
|
--- @ignore
local tableCopy = table.Copy
local virtualSubmenus = {}
CLGAMEMODEMENU.base = "base_gamemodemenu"
CLGAMEMODEMENU.icon = Material("vgui/ttt/vskin/helpscreen/changelog")
CLGAMEMODEMENU.title = "menu_changelog_title"
CLGAMEMODEMENU.description = "menu_changelog_description"
CLGAMEMODEMENU.priority = 100
function CLGAMEMODEMENU:Initialize()
-- add "virtual" submenus that are treated as real one even without files
local changelog = GetSortedChanges()
local changelogMenuBase = self:GetSubmenuByName("base_changelog")
for i = 1, #changelog do
local change = changelog[i]
virtualSubmenus[i] = tableCopy(changelogMenuBase)
virtualSubmenus[i].title = change.version
virtualSubmenus[i].change = change
end
end
-- overwrite the normal submenu function to return our custom virtual submenus
function CLGAMEMODEMENU:GetSubmenus()
return virtualSubmenus
end
|
local Elona122Map = require("mod.elona_sys.map_loader.Elona122Map")
local util = require("mod.elona.data.map_archetype.util")
local Item = require("api.Item")
local MapEntrance = require("mod.elona_sys.api.MapEntrance")
local HomeMap = require("mod.elona.api.HomeMap")
local Calc = require("mod.elona.api.Calc")
local Enum = require("api.Enum")
local Rand = require("api.Rand")
local Charagen = require("mod.elona.api.Charagen")
local Gui = require("api.Gui")
local ElonaBuilding = require("mod.elona.api.ElonaBuilding")
local Event = require("api.Event")
local Gardening = require("mod.elona.api.Gardening")
local Chara = require("api.Chara")
local ElonaChara = require("mod.elona.api.ElonaChara")
local Rank = require("mod.elona.api.Rank")
--
-- Your Home
--
local your_home = {
_id = "your_home",
_type = "base.map_archetype",
elona_id = 7,
starting_pos = MapEntrance.south,
properties = {
music = "elona.lonely",
types = { "player_owned" },
level = 1,
is_indoor = true,
has_anchored_npcs = true,
default_ai_calm = "base.calm_roam",
tileset = "elona.home",
is_fixed = true,
}
}
data:add(your_home)
data:add {
_type = "base.area_archetype",
_id = "your_home",
types = { "player_owned" },
image = "elona.feat_area_your_dungeon",
on_generate_floor = function(area, floor)
local home_rank = save.elona.home_rank
local map
if floor == 1 then
map = HomeMap.generate(home_rank)
else
map = HomeMap.generate(home_rank, { no_callbacks = true })
end
map:set_archetype("elona.your_home", { set_properties = true })
map.level_text = HomeMap.map_level_text(floor)
return map
end,
parent_area = {
_id = "elona.north_tyris",
on_floor = 1,
x = 22,
y = 21,
starting_floor = 1
}
}
--
-- Buildings from deeds
--
do
local ranch = {
_id = "ranch",
_type = "base.map_archetype",
elona_id = 31,
starting_pos = MapEntrance.south,
properties = {
music = "elona.lonely",
types = { "player_owned" },
is_indoor = false,
item_on_floor_limit = 80,
}
}
function ranch.on_generate_map(area, floor)
local map = Elona122Map.generate("ranch_1")
map:set_archetype("elona.ranch", { set_properties = true })
local item = Item.create("elona.book", 23, 8, nil, map)
item.params.book_id = "elona.breeders_guide"
Item.create("elona.register", 22, 6, nil, map)
return map
end
function ranch.on_map_renew_minor(map, params)
-- >>>>>>>> shade2/map.hsp:2228 if areaId(gArea)=areaRanch : gosub *ranch_update ..
ElonaBuilding.update_ranch(map, params.renew_steps)
-- <<<<<<<< shade2/map.hsp:2228 if areaId(gArea)=areaRanch : gosub *ranch_update ..
end
function ranch.on_map_entered(map)
-- >>>>>>>> elona122/shade2/map.hsp:2128 if areaId(gArea)=areaRanch{ ..
ElonaBuilding.ranch_reset_aggro(map)
-- <<<<<<<< elona122/shade2/map.hsp:2132 } ..
end
data:add(ranch)
data:add {
_type = "base.area_archetype",
_id = "ranch",
elona_id = 31,
types = { "player_owned" },
image = "elona.feat_area_ranch",
floors = {
[1] = "elona.ranch"
},
}
end
do
local dungeon = {
_id = "dungeon",
_type = "base.map_archetype",
elona_id = 39,
starting_pos = MapEntrance.south,
properties = {
music = "elona.lonely",
types = { "player_owned" },
is_indoor = true,
item_on_floor_limit = 350,
}
}
function dungeon.on_generate_map(area, floor)
local map = Elona122Map.generate("dungeon1")
map:set_archetype("elona.dungeon", { set_properties = true })
local item = Item.create("elona.book", 39, 54, nil, map)
item.params.book_id = "elona.dungeon_guide"
return map
end
data:add(dungeon)
data:add {
_type = "base.area_archetype",
_id = "dungeon",
elona_id = 39,
types = { "player_owned" },
image = "elona.feat_area_your_dungeon",
floors = {
[1] = "elona.dungeon"
}
}
end
do
local museum = {
_id = "museum",
_type = "base.map_archetype",
elona_id = 101,
starting_pos = MapEntrance.south,
properties = {
music = "elona.town3",
types = { "player_owned" },
is_indoor = true,
}
}
function museum.on_generate_map(area, floor)
local map = Elona122Map.generate("museum_1")
map:set_archetype("elona.museum", { set_properties = true })
local item = Item.create("elona.book", 15, 17, nil, map)
item.params.book_id = "elona.museum_guide"
return map
end
function museum.chara_filter(map)
local level = Calc.calc_object_level(100, map)
local quality = Calc.calc_object_quality(Enum.Quality.Normal)
local fltselect
if Rand.one_in(1) then
fltselect = Enum.FltSelect.Town
else
fltselect = Enum.FltSelect.Shop
end
return {
level = level,
quality = quality,
fltselect = fltselect
}
end
function museum.on_map_entered(map)
-- >>>>>>>> shade2/map.hsp:2117 if (areaId(gArea)=areaMuseum)or(areaId(gArea)=are ..
for _ = 1, 5 do
ElonaChara.spawn_mobs(map)
end
-- <<<<<<<< shade2/map.hsp:2121 } ..
-- >>>>>>>> shade2/map_user.hsp:656 *museum_update ..
ElonaBuilding.update_museum(map)
-- <<<<<<<< shade2/map_user.hsp:684 return ..
end
museum.events = {}
museum.events[#museum.events+1] = {
id = "elona.before_spawn_mobs",
name = "Spawn more mobs when entering",
priority = 90000,
callback = function(map, params)
-- >>>>>>>> shade2/map.hsp:105 if (areaId(gArea)=areaMuseum)or(areaId(gArea)=are ..
local density = map:calc("max_crowd_density")
if map.crowd_density < density / 2 and Rand.one_in(4) then
local filter = params.chara_filter(map)
filter.id = filter.id or params.chara_id
Charagen.create(nil, nil, filter, map)
end
-- <<<<<<<< shade2/map.hsp:107 } ..
end
}
data:add(museum)
data:add {
_type = "base.area_archetype",
_id = "museum",
elona_id = 101,
types = { "player_owned" },
image = "elona.feat_area_museum",
floors = {
[1] = "elona.museum"
},
}
end
do
local shop = {
_id = "shop",
_type = "base.map_archetype",
elona_id = 102,
starting_pos = MapEntrance.south,
properties = {
music = "elona.town3",
types = { "player_owned" },
is_indoor = true,
item_on_floor_limit = 10,
}
}
function shop.on_generate_map(area, floor)
local map = Elona122Map.generate("shop_1")
map:set_archetype("elona.shop", { set_properties = true })
local item = Item.create("elona.book", 17, 14, nil, map)
item.params.book_id = "elona.shopkeeper_guide"
Item.create("elona.shop_strongbox", 19, 10, nil, map)
Item.create("elona.register", 17, 11, nil, map)
return map
end
function shop.chara_filter(map)
local level = Calc.calc_object_level(100, map)
local quality = Calc.calc_object_quality(Enum.Quality.Normal)
local fltselect
if Rand.one_in(1) then
fltselect = Enum.FltSelect.Town
else
fltselect = Enum.FltSelect.Shop
end
return {
level = level,
quality = quality,
fltselect = fltselect
}
end
function shop.on_map_entered(map)
-- >>>>>>>> shade2/map.hsp:2117 if (areaId(gArea)=areaMuseum)or(areaId(gArea)=are ..
for _ = 1, 5 do
ElonaChara.spawn_mobs(map)
end
-- <<<<<<<< shade2/map.hsp:2121 } ..
-- >>>>>>>> shade2/map_user.hsp:620 *shop_update ..
map.max_crowd_density = math.floor((100 - Rank.get("elona.shop") / 100) / 4 + 1)
for _, item in Item.iter(map) do
item:refresh_cell_on_map()
end
-- <<<<<<<< shade2/map_user.hsp:637 return ..
end
function shop.on_map_pass_turn(map)
if map.crowd_density >= 0 and Rand.one_in(25) then
-- BUG: figure out the automatic text coloring. The color differs
-- depending on if the text starts with a quote, but the localized text
-- is a list with both quoted and non-quoted items...
Gui.mes_c("misc.map.shop.chats", "SkyBlue")
end
end
shop.events = {}
shop.events[#shop.events+1] = {
id = "elona.before_spawn_mobs",
name = "Spawn more mobs when entering",
priority = 90000,
callback = function(map, params)
-- >>>>>>>> shade2/map.hsp:105 if (areaId(gArea)=areaMuseum)or(areaId(gArea)=are ..
local density = map:calc("max_crowd_density")
if map.crowd_density < density / 2 and Rand.one_in(4) then
local filter = params.chara_filter(map)
filter.id = filter.id or params.chara_id
Charagen.create(nil, nil, filter, map)
end
-- <<<<<<<< shade2/map.hsp:107 } ..
end
}
data:add(shop)
data:add {
_type = "base.area_archetype",
_id = "shop",
elona_id = 102,
types = { "player_owned" },
image = "elona.feat_area_shop",
floors = {
[1] = "elona.shop"
},
}
end
do
local crop = {
_id = "crop",
_type = "base.map_archetype",
elona_id = 103,
starting_pos = MapEntrance.south,
properties = {
music = "elona.lonely",
types = { "player_owned" },
is_indoor = false,
item_on_floor_limit = 80,
}
}
function crop.on_generate_map(area, floor)
local map = Elona122Map.generate("crop_1")
map:set_archetype("elona.crop", { set_properties = true })
local item = Item.create("elona.book", 17, 14, nil, map)
item.params.book_id = "elona.easy_gardening"
return map
end
data:add(crop)
data:add {
_type = "base.area_archetype",
_id = "crop",
elona_id = 103,
types = { "player_owned" },
image = "elona.feat_area_crop",
floors = {
[1] = "elona.crop"
},
}
local function grow_plants(map, params)
if map.is_not_renewable then
return
end
Gardening.grow_plants(map, Chara.player(), params.renew_steps)
end
Event.register("base.on_map_renew_minor", "Grow all plants in map", grow_plants)
end
do
local storage_house = {
_id = "storage_house",
_type = "base.map_archetype",
elona_id = 104,
on_generate_map = util.generate_122("storage_1"),
starting_pos = MapEntrance.south,
properties = {
music = "elona.lonely",
types = { "player_owned" },
is_indoor = true,
item_on_floor_limit = 200,
}
}
data:add(storage_house)
data:add {
_type = "base.area_archetype",
_id = "storage_house",
elona_id = 104,
types = { "player_owned" },
image = "elona.feat_area_storage_house",
floors = {
[1] = "elona.storage_house"
},
}
end
|
--- Performs bone merge on client side
EF_BONEMERGE = 1
--- For use with EF_BONEMERGE. If this is set, then it places this ents origin at its parent and uses the parent's bbox + the max extents of the aiment. Otherwise, it sets up the parent's bones every frame to figure out where to place the aiment, which is inefficient because it'll setup the parent's bones even if the parent is not in the PVS.
EF_BONEMERGE_FASTCULL = 128
--- DLIGHT centered at entity origin
EF_BRIGHTLIGHT = 2
--- Player flashlight
EF_DIMLIGHT = 4
--- Don't interpolate the next frame
EF_NOINTERP = 8
--- Disables shadow
EF_NOSHADOW = 16
--- Prevents the entity from drawing and networking.
EF_NODRAW = 32
--- Don't receive shadows
EF_NORECEIVESHADOW = 64
--- Makes the entity blink
EF_ITEM_BLINK = 256
--- Always assume that the parent entity is animating
EF_PARENT_ANIMATES = 512
--- Internal flag that is set by Entity:FollowBone
EF_FOLLOWBONE = 1024
--- This is set on bots that are frozen
EFL_BOT_FROZEN = 256
---
EFL_CHECK_UNTOUCH = 16777216
--- Some dirty bits with respect to abs computations
EFL_DIRTY_ABSANGVELOCITY = 8192
---
EFL_DIRTY_ABSTRANSFORM = 2048
---
EFL_DIRTY_ABSVELOCITY = 4096
--- (Client only) need shadow manager to update the shadow
EFL_DIRTY_SHADOWUPDATE = 32
---
EFL_DIRTY_SPATIAL_PARTITION = 32768
---
EFL_DIRTY_SURROUNDING_COLLISION_BOUNDS = 16384
--- Entity shouldn't block NPC line-of-sight
EFL_DONTBLOCKLOS = 33554432
--- NPCs should not walk on this entity
EFL_DONTWALKON = 67108864
--- Entity is dormant, no updates to client
EFL_DORMANT = 2
--- The default behavior in ShouldTransmit is to not send an entity if it doesn't have a model. Certain entities want to be sent anyway because all the drawing logic is in the client DLL. They can set this flag and the engine will transmit them even if they don't have model
EFL_FORCE_CHECK_TRANSMIT = 128
--- One of the child entities is a player
EFL_HAS_PLAYER_CHILD = 16
--- This is set if the entity detects that it's in the skybox. This forces it to pass the "in PVS" for transmission
EFL_IN_SKYBOX = 131072
---
EFL_IS_BEING_LIFTED_BY_BARNACLE = 1048576
--- This is a special entity that should not be deleted when we restart entities only
EFL_KEEP_ON_RECREATE_ENTITIES = 16
--- This entity is marked for death -- This allows the game to actually delete ents at a safe time. You should never set this flag manually.
EFL_KILLME = 1
--- Lets us know when the noclip command is active
EFL_NOCLIP_ACTIVE = 4
--- Another entity is watching events on this entity (used by teleport)
EFL_NOTIFY = 64
--- Don't attach the edict
EFL_NO_AUTO_EDICT_ATTACH = 1024
--- Doesn't accept forces from physics damage
EFL_NO_DAMAGE_FORCES = -2147483648
--- Entitiy shouldn't dissolve
EFL_NO_DISSOLVE = 134217728
---
EFL_NO_GAME_PHYSICS_SIMULATION = 8388608
--- Mega physcannon can't ragdoll these guys
EFL_NO_MEGAPHYSCANNON_RAGDOLL = 268435456
--- Physcannon can't pick these up or punt them
EFL_NO_PHYSCANNON_INTERACTION = 1073741824
---
EFL_NO_ROTORWASH_PUSH = 2097152
--- Avoid executing the entity's Think
EFL_NO_THINK_FUNCTION = 4194304
--- Don't adjust this entity's velocity when transitioning into water
EFL_NO_WATER_VELOCITY_CHANGE = 536870912
--- Non-networked entity
EFL_SERVER_ONLY = 512
--- Set while a model is setting up its bones
EFL_SETTING_UP_BONES = 8
--- Used to determine if an entity is floating
EFL_TOUCHING_FLUID = 524288
--- Entities with this flag set show up in the partition even when not solid
EFL_USE_PARTITION_WHEN_NOT_SOLID = 262144
--- Is the entity on ground or not
FL_ONGROUND = 1
--- Is player ducking or not
FL_DUCKING = 2
--- Is the player in the process of ducking or standing up
FL_ANIMDUCKING = 4
--- The player is jumping out of water
FL_WATERJUMP = 8
--- This player is controlling a func_train
FL_ONTRAIN = 16
--- Indicates the entity is standing in rain
FL_INRAIN = 32
--- Completely freezes the player Bots will still be able to look around.
FL_FROZEN = 64
--- This player is controlling something UI related in the world, this prevents his movement, but doesn't freeze mouse movement, jumping, etc.
FL_ATCONTROLS = 128
--- Is this entity a player or not
FL_CLIENT = 256
--- Bots have this flag
FL_FAKECLIENT = 512
--- Is the player in water or not
FL_INWATER = 1024
--- This entity can fly
FL_FLY = 2048
--- This entity can swim
FL_SWIM = 4096
--- This entity is a func_conveyor
FL_CONVEYOR = 8192
--- NPCs have this flag (NPC: Ignore player push)
FL_NPC = 16384
--- Whether the player has god mode enabled
FL_GODMODE = 32768
--- Makes the entity invisible to AI
FL_NOTARGET = 65536
--- This entity can be aimed at
FL_AIMTARGET = 131072
--- Not all corners are valid
FL_PARTIALGROUND = 262144
--- It's a static prop
FL_STATICPROP = 524288
--- worldgraph has this ent listed as something that blocks a connection
FL_GRAPHED = 1048576
--- This entity is a grenade, unused
FL_GRENADE = 2097152
--- Changes the SV_Movestep() behavior to not do any processing
FL_STEPMOVEMENT = 4194304
--- Doesn't generate touch functions, calls ENTITY:EndTouch when this flag gets set during a touch callback
FL_DONTTOUCH = 8388608
--- Base velocity has been applied this frame (used to convert base velocity into momentum)
FL_BASEVELOCITY = 16777216
--- This entity is a brush and part of the world
FL_WORLDBRUSH = 33554432
--- This entity can be seen by NPCs
FL_OBJECT = 67108864
--- This entity is about to get removed
FL_KILLME = 134217728
--- This entity is on fire
FL_ONFIRE = 268435456
--- The entity is currently dissolving
FL_DISSOLVING = 536870912
--- This entity is about to become a ragdoll
FL_TRANSRAGDOLL = 1073741824
--- This moving door can't be blocked by the player
FL_UNBLOCKABLE_BY_PLAYER = -2147483648
|
-- Put your information here as the modlue owner/developer --
print( "Example-Module Updated Last on 12/3/2018")
moduleName = "ExampleTest"
yourNameHere = "OwnerName"--This can also be a group of people
yourContactInfoHere = "OwnerContact"
versionNameOrNumber = "ReleaseVersionExample"
print("[PZ-API] Module: " .. moduleName .. " has been found!")
print("[PZ-API] Owner(s): " .. yourNameHere)
print("[PZ-API] Contact: " .. yourContactInfoHere)
print("[PZ-API] Version: " .. versionNameOrNumber)
|
-- boats/documentation.lua
-----Load documentation via doc_helper------------------------
local MP = minetest.get_modpath(minetest.get_current_modname())
local docpath = MP .. DIR_DELIM .. "doc"
doc.add_category("boats",
{
name = "_Boats_",
description = "Boats Documentation",
build_formspec = doc.entry_builders.text_and_square_gallery,
})
doc.build_entries(docpath, "boats") |
local GUI = LibStub('NetEaseGUI-2.0')
local View = GUI:NewEmbed('Refresh', 1)
if not View then
return
end
local function Refresh(self)
self:SetScript('OnUpdate', nil)
self:Update()
if type(self.Fire) == 'function' then
self:Fire('OnRefresh')
end
if type(self._Select_OnRefresh) == 'function' then
self:_Select_OnRefresh()
end
end
function View:Refresh()
if self.notRefreshOnShow and not self:IsVisible() then
return
end
if type(self.Update) == 'function' then
self:SetScript('OnUpdate', Refresh)
end
end
function View:EnableRefreshOnShow(flag)
self.notRefreshOnShow = not flag or nil
self:SetScript('OnUpdate', nil)
end
|
local onAttach = require'lsp/lsp-attach'
require'lspconfig'.tsserver.setup{
on_attach = onAttach
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.