content
stringlengths 5
1.05M
|
|---|
--- Editor module
--- Editor class. Inherit to create custom Editors
-- @type Editor
Editor = LCS.class{}
--- Editor constructor. Make sure you invoke this in your custom editor
-- @see Editor.Finalize
-- @usage
-- MyEditor = Editor:extends{}
-- function MyEditor:init()
-- Editor.init(self)
-- -- rest of code
-- self:Finalize(children, opts)
-- end
function Editor:init()
self.__initializing = true
self.fields = {}
self.fieldOrder = {}
self.stackPanel = StackPanel:New {
y = 0,
x = 0,
right = 0,
centerItems = false,
autosize = true,
resizeItems = false,
preserveChildrenOrder = true,
itemPadding = {0,10,0,0},
padding = {0,0,0,0},
margin = {0,0,0,0},
itemMargin = {5,0,0,0},
}
self.stackPanel:DisableRealign()
end
--- Called when a field starts to change.
--- Override.
-- @tparam string name Name of the field.
function Editor:OnStartChange(name)
end
-- Called when a field stops to change.
--- Override.
-- @tparam string name Name of the field.
function Editor:OnEndChange(name)
end
--- Called when a field value was modified
--- Override.
-- @tparam string name Name of the modified field.
-- @param value New value of the modified field.
function Editor:OnFieldChange(name, value)
end
--- Should return true if state is valid for this editor.
--- Override.
-- @param name state State.
function Editor:IsValidState(state)
return false
end
--- Called when the state was entered.
--- Override.
-- @param name state State.
function Editor:OnEnterState(state)
end
--- Called when the state was left.
--- Override.
-- @param name state State.
function Editor:OnLeaveState(state)
end
function Editor:_OnEnterState(state)
if self:IsValidState(state) then
self:OnEnterState(state)
end
end
function Editor:_OnLeaveState(state)
if self:IsValidState(state) then
self:OnLeaveState(state)
end
end
--- Called at the end of :init(), to finalize the UI
--- Override.
-- @tparam table children List of Chili controls.
-- @tparam table opts Editor options
-- @tparam[opt=false] boolean opts.notMainWindow If true,
-- editor will not be added to the main panel (right side), but will instead be a floating window.
-- @tparam[opt=550] boolean opts.width Specifies window width. Only applicable for floating windows.
-- @tparam[opt=550] boolean opts.height Specifies window height. Only applicable for floating windows.
-- @tparam table opts.buttons Specifies what common buttons should be added to the bottom of the editor.
-- Values include "ok", "cancel" and "close"
-- @tparam boolean opts.disposeOnClose If true, the window will
-- be disposed when closed. Defaults to true if opts.notMainWindow is true, otherwise it defaults to false.
function Editor:Finalize(children, opts)
if not self.__initializing then
Log.Error("\"Editor.init(self)\" wasn't invoked properly.")
Log.Error(debug.traceback())
assert(self.__initializing, "\"Editor.init(self)\" wasn't invoked properly.")
end
opts = opts or {}
self:_FinalizeButtons(children, opts)
local OnShow = {function() self:__OnShow() end}
local OnHide = {function() self:__OnHide() end}
self.__disposeOnClose = opts.disposeOnClose
if not opts.notMainWindow then
if opts.disposeOnClose == nil then
self.__disposeOnClose = false
end
self.window = Control:New {
-- parent = screen0,
-- x = 10,
-- y = 100,
-- width = 550,
-- height = 800,
x = 0,
y = 0,
bottom = 0,
right = 0,
caption = '',
children = children,
padding = {0,0,0,0},
OnParentPost = OnShow,
OnOrphan = OnHide,
classname = opts.classname,
}
SB.view.tabbedWindow:SetMainPanel(self.window)
else
if opts.disposeOnClose == nil then
self.__disposeOnClose = true
end
-- TODO: Make configurable
self.window = Window:New {
parent = screen0,
x = opts.x or "25%",
y = opts.y or "20%",
width = opts.width or 550,
height = opts.height or 500,
resizable = false,
caption = '',
children = children,
OnParentPost = OnShow,
OnOrphan = OnHide,
classname = opts.classname,
}
self.keyListener = function(key)
local currentState = SB.stateManager:GetCurrentState()
if not currentState:is_A(DefaultState) then
return
end
if key == Spring.GetKeyCode("esc") then
self:__MaybeClose()
return true
elseif key == Spring.GetKeyCode("enter") or
key == Spring.GetKeyCode("numpad_enter") then
if self.ConfirmDialog then
if self:ConfirmDialog() then
self:__MaybeClose()
end
return true
else
self:__MaybeClose()
return true
end
end
end
self:__AddKeyListener()
end
self.stackPanel:EnableRealign()
self.stackPanel:Invalidate()
self.__initializing = false
end
function Editor:_FinalizeButtons(children, opts)
if opts.buttons == nil then
assert(not opts.notMainWindow, "Dialogs should probably have some buttons so they can be closed")
return
end
local btnCount = #opts.buttons
-- atm we only support 'ok/cancel' or 'close'.
-- anything else is probably a mistake so we guard against it
assert(btnCount <= 2, "More than two buttons. This is probably a bug")
local btnTable = {
bottom = 0,
width = '40%',
height = SB.conf.B_HEIGHT,
}
local x = 0
for _, btnName in ipairs(opts.buttons) do
assert(type(btnName) == "string", "Editor buttons are specified as string")
if btnName == "ok" then
local btn = Table.DeepCopy(btnTable)
Table.Merge(btn, {
caption = "OK",
classname = "option_button",
x = tostring(x) .. '%',
OnClick = {
function()
if self:ConfirmDialog() then
self:__MaybeClose()
end
end
}
})
table.insert(children, Button:New(btn))
elseif btnName == "cancel" then
local btn = Table.DeepCopy(btnTable)
Table.Merge(btn, {
caption = "Cancel",
classname = "negative_button",
x = tostring(x) .. '%',
OnClick = {
function()
self:__MaybeClose()
end
}
})
table.insert(children, Button:New(btn))
elseif btnName == "close" then
local btn = Table.DeepCopy(btnTable)
Table.Merge(btn, {
caption = 'Close',
right = '10%', -- close seems better on the right
OnClick = {
function()
self:__MaybeClose()
-- FIXME: should be resetting to the default state?
-- SB.stateManager:SetState(DefaultState())
end
},
})
table.insert(children, Button:New(btn))
else
error("Unexpected button name: " .. tostring(btnName))
end
x = x + 50
end
end
-- Don't use this directly because ordering would be messed up.
function Editor:_SetFieldVisible(name, visible)
local field = self.fields[name]
if not field then
Log.Error("Trying to set visibility on an invalid field: " .. tostring(name))
return
end
if visible == nil then
Log.Error("Visible is nil for field: " .. tostring(name))
return
end
local ctrl = field.ctrl
--if ctrl.visible ~= visible then
if ctrl._visible ~= visible then
if visible then
-- self.stackPanel:AddChild(ctrl)
ctrl:Show()
ctrl._visible = true
else
-- self.stackPanel:RemoveChild(ctrl)
ctrl:Hide()
ctrl._visible = false
end
end
end
--- Sets fields which are to be made invisible.
-- @tparam {string, ...} ... Field names to be set invisible
function Editor:SetInvisibleFields(...)
self.stackPanel:DisableRealign()
local fields = {...}
for i = #self.fieldOrder, 1, -1 do
local name = self.fieldOrder[i]
self:_SetFieldVisible(name, false)
end
for i = 1, #self.fieldOrder do
local name = self.fieldOrder[i]
if not table.ifind(fields, name) then
self:_SetFieldVisible(name, true)
end
end
-- HACK: because we're Add/Removing items to the stackPanel instead of using Show/Hide on
-- the control itself, we need to to execute a :_HackSetInvisibleFields later
for _, field in pairs(self.fields) do
if field._HackSetInvisibleFields then
field:_HackSetInvisibleFields(fields)
end
end
self.stackPanel:EnableRealign()
self.stackPanel:Invalidate()
end
--- Remove field by name.
-- @tparam string name Name of field which should be removed.
function Editor:RemoveField(name)
local field = self.fields[name]
assert(field, "Trying to remove field that doesn't exist.")
for i, orderName in pairs(self.fieldOrder) do
if orderName == name then
table.remove(self.fieldOrder, i)
break
end
end
self.stackPanel:RemoveChild(field.ctrl)
self.fields[name] = nil
end
--- Add field.
-- @tparam field.Field field Field to be added.
-- @usage
-- self:AddField(NumericField({
-- name = "size",
-- value = 100,
-- minValue = 40,
-- maxValue = 2000,
-- title = "Size:",
-- tooltip = "Size of the paint brush",
-- }))
function Editor:AddField(field)
if field.components then
field.ctrl = self:_AddControl(field.name, field.components)
end
self:_AddField(field)
field:Added()
end
function Editor:_AddField(field)
self.fields[field.name] = field
field.ev = self
end
function Editor:AddControl(name, children)
self.fields[name] = {
ctrl = self:_AddControl(name, children),
name = name,
}
return self.fields[name]
end
function Editor:_AddControl(name, children)
local ctrl = Control:New {
autosize = true,
padding = {0, 0, 0, 0},
children = children
}
self.stackPanel:AddChild(ctrl)
table.insert(self.fieldOrder, name)
return ctrl
end
function Editor:RenameField(oldName, newName)
if newName == oldName then
return
end
assert(not self.fields[newName], "Field with same name already exists")
local field = self.fields[oldName]
self.fields[newName] = field
self.fields[oldName] = nil
field.name = newName
for i, fname in pairs(self.fieldOrder) do
if fname == oldName then
self.fieldOrder[i] = newName
break
end
end
end
function Editor:Validate(name, value)
local field = self.fields[name]
return field:Validate(value)
end
--- Set value of a field.
-- @tparam string name Field name.
-- @param value New value.
-- @usage
-- self:Set("myNumber", 15)
function Editor:Set(name, value)
local field = self.fields[name]
field:Set(value)
end
function Editor:Update(name, _source)
local field = self.fields[name]
assert(field, "No such field to update: " .. tostring(name))
field:Update(_source)
-- update listeners and current state
if not self.__initializing then
self:OnFieldChange(field.name, field.value)
end
local currentState = SB.stateManager:GetCurrentState()
if self:IsValidState(currentState) then
currentState[field.name] = field.value
end
end
function Editor:_OnStartChange(name)
if not self._startedChanging then
self._startedChanging = true
self:OnStartChange(name)
end
end
function Editor:_OnEndChange(name)
if self._startedChanging then
self._startedChanging = false
self:OnEndChange(name)
end
end
-- START Utility
--- Set default keybinding (binding button actions to 1-9).
-- @param buttons List of Chili Buttons.
function Editor:AddDefaultKeybinding(buttons)
local KEY_ZERO = KEYSYMS.N_0
self.__keybinding = {}
for i, button in ipairs(buttons) do
self:AddKeybinding(KEY_ZERO + i, button.OnClick)
button.tooltip = button.tooltip .. " (" .. tostring(i) .. ")"
end
end
function Editor:AddKeybinding(key, functions)
self.__keybinding[key] = functions
end
function Editor:GetAllControls()
local ctrls = {}
for _, field in pairs(self.fields) do
for _, ctrl in pairs(field.components or {}) do
table.insert(ctrls, ctrl)
end
end
return ctrls
end
-- END Utility
function Editor:KeyPress(key, mods, isRepeat, label, unicode)
if not self.__keybinding then
return
end
local listeners = self.__keybinding[key]
if not listeners then
return
end
CallListeners(listeners)
return true
end
function Editor:__AddKeyListener()
if not self.__addedKeyListener then
self.__addedKeyListener = true
SB.stateManager:AddGlobalKeyListener(self.keyListener)
end
end
function Editor:__RemoveKeyListener()
if self.__addedKeyListener then
self.__addedKeyListener = false
SB.stateManager:RemoveGlobalKeyListener(self.keyListener)
end
end
function Editor:__OnShow()
if self.keyListener then
self:__AddKeyListener()
end
end
function Editor:__OnHide()
if self.keyListener then
self:__RemoveKeyListener()
end
local currentState = SB.stateManager:GetCurrentState()
if self:IsValidState(currentState) then
SB.stateManager:SetState(DefaultState())
end
if SB.currentEditor == self then
SB.currentEditor = nil
end
end
function Editor:__MaybeClose()
self.window:Hide()
if self.__disposeOnClose then
self.window:Dispose()
end
end
--- Serialize editor fields into a table.
-- @return Serialized table of all fields.
function Editor:Serialize()
local retVal = {}
for name, field in pairs(self.fields) do
if field.Serialize then
retVal[name] = field:Serialize()
end
end
return retVal
end
--- Load table into fields.
-- @tparam table tbl Serialized table to load.
function Editor:Load(tbl)
-- set missing fields to nil
for name, field in pairs(self.fields) do
-- some fields (like separator) don't have .Set
if self.fields[name].Set and tbl[name] == nil then
self.fields[name]:Set(nil)
end
end
for name, data in pairs(tbl) do
if self.fields[name] ~= nil then
self.fields[name]:Load(data)
end
end
end
-- Registered editor classes
SB.editorRegistry = {}
-- Globally available editor instances
SB.editors = {}
--- Register editor.
-- @tparam table opts Table
-- @tparam string opts.name Machine name of the editor control.
-- @tparam Editor opts.editor Class inheritng from Editor
-- @tparam string opts.tab Tab in which to place the editor button.
-- @tparam string opts.caption Title of the Editor control.
-- @tparam string opts.tooltip Mouseover tooltip.
-- @tparam string opts.image Path to the Editor icon.
-- @usage
-- MyEditor = Editor:extends{}
-- MyEditor:Register({
-- name = "myEditor",
-- tab = "MyTag",
-- caption = "MyEditor",
-- tooltip = "Edit something",
-- image = SB_IMG_DIR .. "my_icon.png",
-- order = 42,
-- })
function Editor:Register(opts)
-- Prevents invalid invocation with missing opts table
assert(opts ~= nil, "Missing opts table for editor. Did you mean" ..
"MyEditor:Register instead of MyEditor.Register?")
assert(opts.name, "Missing name for editor.")
assert(not SB.editorRegistry[opts.name],
"Editor with name: " .. opts.name .. " already exists")
Log.Notice("Registering: " .. opts.name)
opts.editor = self
opts.tab = opts.tab or "Other"
opts.caption = opts.caption or opts.name
opts.tooltip = opts.tooltip or opts.caption
opts.image = opts.image or ""
opts.order = opts.order or math.huge
opts.no_serialize = opts.no_serialize
SB.editorRegistry[opts.name] = opts
end
--- Deregister the editor.
-- @usage
-- MyEditor:Deregister()
-- -- alternatively
-- Editor.Deregister("my-editor")
function Editor:Deregister()
if type(self) == "string" then
SB.editorRegistry[self] = nil
else
SB.editorRegistry[self.name] = nil
end
-- TODO: Remove the editor from the GUI?
end
-- We load these fields last as they might be/contain subclasses of editor view
SB_VIEW_FIELDS_DIR = SB_VIEW_DIR .. "fields/"
SB.IncludeDir(SB_VIEW_FIELDS_DIR)
|
module 'mock'
--------------------------------------------------------------------
CLASS: ThreadDataTask ( ThreadTask )
:MODEL{}
function ThreadDataTask:__init( filename )
self.filename = filename
end
function ThreadDataTask:onExec( queue )
if not self.filename then return false end
local buffer = MOAIDataBuffer.new()
buffer:loadAsync(
self.filename,
queue:getThread(),
function( result )
return self:complete( result )
end
)
return true
end
|
--[[BASE]]--
MySQL = module("vrp_mysql", "MySQL")
local Tunnel = module("vrp", "lib/Tunnel")
local Proxy = module("vrp", "lib/Proxy")
vRP = Proxy.getInterface("vRP")
vRPclient = Tunnel.getInterface("vRP","vrp_license")
--[[LANG]]--
local Lang = module("vrp", "lib/Lang")
local cfg = module("vrp", "cfg/base")
local lang = Lang.new(module("vrp", "cfg/lang/"..cfg.lang) or {})
--[[SQL]]--
MySQL.createCommand("vRP/gun_column", "ALTER TABLE vrp_users ADD IF NOT EXISTS GunLicense varchar(55) NOT NULL default 'Required'")
MySQL.createCommand("vRP/gun_success", "UPDATE vrp_users SET GunLicense='Passed' WHERE id = @id")
MySQL.createCommand("vRP/gun_search", "SELECT * FROM vrp_users WHERE id = @id AND GunLicense = 'Passed'")
-- init
MySQL.query("vRP/gun_column")
RegisterServerEvent("gun:success")
AddEventHandler("gun:success", function()
local user_id = vRP.getUserId({source})
MySQL.query("vRP/gun_success", {id = user_id})
end)
RegisterServerEvent("gun:buysuccess")
AddEventHandler("gun:buysuccess", function()
local user_id = vRP.getUserId({source})
local player = vRP.getUserSource({user_id})
if vRP.tryPayment({user_id,100000}) then
TriggerClientEvent('gun:EndBuyLicense',player)
else
vRPclient.notify(player,{"~r~Sem dinheiro o suficiente."})
end
end)
--[[ ***** SPAWN CHECK ***** ]]
AddEventHandler("vRP:playerSpawn", function(user_id, source, first_spawn)
MySQL.query("vRP/gun_search", {id = user_id}, function(rows, affected)
if #rows > 0 then
TriggerClientEvent('gun:CheckLicStatus',source)
end
end)
end)
--[[POLICE MENU]]--
local choice_asklc = {function(player,choice)
vRPclient.getNearestPlayer(player,{10},function(nplayer)
local nuser_id = vRP.getUserId({nplayer})
if nuser_id ~= nil then
vRPclient.notify(player,{"Checando porte de armas..."})
vRP.request({nplayer,"Você deseja mostrar o porte de armas?",15,function(nplayer,ok)
if ok then
MySQL.query("vRP/gun_search", {id = nuser_id}, function(rows, affected)
if #rows > 0 then
vRPclient.notify(player,{"Porte de armas: ~g~Possui."})
else
vRPclient.notify(player,{"Porte de armas: ~r~Não possui."})
end
end)
else
vRPclient.notify(player,{lang.common.request_refused()})
end
end})
else
vRPclient.notify(player,{lang.common.no_player_near()})
end
end)
end, "Checar o porte de armas do player mais próximo."}
vRP.registerMenuBuilder({"police", function(add, data)
local player = data.player
local user_id = vRP.getUserId({player})
if user_id ~= nil then
local choices = {}
-- build police menu
if vRP.hasPermission({user_id,"police.weapon_search"}) then
choices["Checar porte de armas"] = choice_asklc
end
add(choices)
end
end})
|
-- Wemo controller config
-- Detect Wemo switch devices and confirm from user and save the host that the Wemo controller can use
local u = require("LuaUPNP")
local stat,msg
local function listTestSave(devs)
for i = 1,#devs do
print("-------- DEVICE #"..i.."--------------")
for l,m in pairs(devs[i]) do
print(" ",l,m)
end
end
io.write("Select Device>")
local opt = io.read()
if tonumber(opt) ~= 0 then
if not devs[tonumber(opt)] then
print("Not a valid choice. Exiting.")
else
print("Reading device control information...")
stat,msg = devs[tonumber(opt)]:getInfo()
if not stat then
print("Cannot read control info from the device: "..msg)
else
print("Testing the Device...")
io.write("Turning the switch ON...")
devs[tonumber(opt)]:send("controllee","basicevent","SetBinaryState",{BinaryState=1})
io.write("DONE\n")
io.write("Waiting 3 seconds...")
local ctime = os.clock()
while os.clock() - ctime < 3 do
end
io.write("DONE\n")
io.write("Turning the switch OFF...")
devs[tonumber(opt)]:send("controllee","basicevent","SetBinaryState",{BinaryState=0})
io.write("DONE\n")
io.write("Waiting 3 seconds...")
ctime = os.clock()
while os.clock() - ctime < 3 do
end
io.write("DONE\n")
-- Save the device info to file
io.write("Enter file name to save device information (Enter to exit) >")
local fName = io.read()
if fName and #fName > 0 then
stat,msg = devs[tonumber(opt)]:saveHost(fName)
if not stat then
print("Could not save file: "..msg)
else
print("File successfully saved")
end
end
end
end
end
end
local uo,err = u.new()
if not uo then
print("Error setting up UPNP connection: "..err)
else
print("Listen passively for UPNP devices on network...")
stat,msg = uo:pcap(3)
print("Searching for UPNP devices on network...")
stat,msg = uo:msearch(3)
if #uo.hosts == 0 then
print("Could not find any UPNP devices on the network.")
else
-- Get the XML file of all the detected hosts 1 by 1 to filter out the Wemo devices
local wemoH = {}
for k,v in pairs(uo.hosts) do
local xfile = uo.httpGetFile(v.xmlFile)
-- Check if this file has Wemo Switch text
if xfile and xfile:lower():match("wemo switch") then
wemoH[#wemoH + 1] = v
end
end
if #wemoH > 0 then
print("The following devices found that seem to be Wemo switches. Please select a device number to save or 0 to exit:")
listTestSave(wemoH)
else
print("Cannot detect Wemo switch devices, here is a list of all the UPNP devices detected. Select a device or 0 to exit:")
listTestSave(uo.hosts)
end
end
end
|
local API_RE = require(script:GetCustomProperty("APIReliableEvents"))
local API = {}
local rectangles = {}
local function pointsAreOnSameSideOfLine(point1, point2, A, B) -- point1 and point2 are on the same side of line AB
return ((B - A) ^ (point1 - A)) .. ((B - A) ^ (point2 - A)) >= 0 -- scalar quadruple product is nonnegative
end
local function pointIsInTriangle(P, A, B, C) -- point P is inside triangle ABC
return pointsAreOnSameSideOfLine(P, A, B, C) -- P and A are on the same side of BC
and pointsAreOnSameSideOfLine(P, B, A, C) -- P and B are on the same side of AC
and pointsAreOnSameSideOfLine(P, C, A, B) -- P and C are on the same side of AB
end
local function closestPointOnLineSegment(point, lineStart, lineEnd)
local alpha = ((point - lineStart) .. (lineEnd - lineStart)) / (lineEnd - lineStart).sizeSquared
return lineStart + (lineEnd - lineStart) * math.max(0, math.min(1, alpha))
end
local function closestPointsBetweenTwoLineSegments(start1, end1, start2, end2)
--[[ the closest two points on two lines define a line that is perpendicular to both
u = end1 - start1 -- line 1
v = end2 - start2 -- line 2
w = (start1 + s*u) - (start2 + t*v) -- the line between them
w .. u = w .. v = 0 -- perpendicular to both
]]
local u = end1 - start1 -- vector representing the first line segment
local v = end2 - start2 -- vector representing the second line segment
local w = start1 - start2 -- vector offset between the two line segments
local numerator1 = (u..v)*(v..w) - v.sizeSquared*(u..w)
local numerator2 = -(u..v)*(u..w) + u.sizeSquared*(v..w)
local denominator = u.sizeSquared * v.sizeSquared - (u..v)^2 -- = (|u||v|sin t)^2 (zero if u and v are collinear)
if denominator == 0 then return end -- line segments are collinear, return nil and let the caller decide what to do
if numerator1 < 0 then -- closest points are not within the bounds of the segments
return start1, closestPointOnLineSegment(start1, start2, end2)
elseif numerator1 > denominator then
return end1, closestPointOnLineSegment(end1, start2, end2)
elseif numerator2 < 0 then
return start2, closestPointOnLineSegment(start2, start1, end1)
elseif numerator2 > denominator then
return end2, closestPointOnLineSegment(end2, start1, end1)
end
local closest1 = start1 + u*numerator1/denominator
local closest2 = start2 + v*numerator2/denominator
return closest1, closest2
end
local function closestPointOnRectangle(point, rectangle)
-- project the point onto the plane. if it's inside the rectangle then that's the closest point, otherwise find the closest point on the closest edge
local vertex1, vertex2, vertex3, vertex4 = table.unpack(rectangle.vertices)
local projection = point - rectangle.normal * (rectangle.normal .. (point - vertex1))
if pointIsInTriangle(projection, vertex1, vertex2, vertex3) or pointIsInTriangle(projection, vertex3, vertex4, vertex1) then
return projection -- projection is already inside of the rectangle
else -- find the closest point on the closest edge of the rectangle
local closestOnEdge1 = closestPointOnLineSegment(point, vertex1, vertex2)
local closestOnEdge2 = closestPointOnLineSegment(point, vertex2, vertex3)
local closestOnEdge3 = closestPointOnLineSegment(point, vertex3, vertex4)
local closestOnEdge4 = closestPointOnLineSegment(point, vertex4, vertex1)
local distanceSquaredToEdge1 = (point - closestOnEdge1).sizeSquared
local distanceSquaredToEdge2 = (point - closestOnEdge2).sizeSquared
local distanceSquaredToEdge3 = (point - closestOnEdge3).sizeSquared
local distanceSquaredToEdge4 = (point - closestOnEdge4).sizeSquared
if distanceSquaredToEdge1 < distanceSquaredToEdge2 and distanceSquaredToEdge1 < distanceSquaredToEdge3 and distanceSquaredToEdge1 < distanceSquaredToEdge4 then
return closestOnEdge1
elseif distanceSquaredToEdge2 < distanceSquaredToEdge3 and distanceSquaredToEdge2 < distanceSquaredToEdge4 then
return closestOnEdge2
elseif distanceSquaredToEdge3 < distanceSquaredToEdge4 then
return closestOnEdge3
else
return closestOnEdge4
end
end
end
local function closestPointsBetweenLineSegmentAndRectangle(lineStart, lineEnd, rectangle)
-- case 1: line and rectangle are parallel. return nil and let the caller decide what to do
-- case 2: line segment intersects rectangle. calculate the intersection
-- case 3: line segment intersects the plane but not the rectangle. find the closest point on the rectangle's perimeter
-- case 4: line segment does not intersect the plane. find the closest point on the rectangle's perimeter and also try point-to-rectangle distances of the endpoints.
local scalarProjection = (lineEnd - lineStart) .. rectangle.normal
if scalarProjection == 0 then -- line is perpendicular to the normal, which means the line and rectangle are parallel
return -- let the caller decide what to do
else
local vertex1, vertex2, vertex3, vertex4 = table.unpack(rectangle.vertices)
local alpha = (rectangle.normal .. (vertex1 - lineStart)) / scalarProjection -- [0, 1] if the intersection is within the line segment
local lineSegmentIntersectsPlane = 0 <= alpha and alpha <= 1
local checkLineSegmentEnds = true
if lineSegmentIntersectsPlane then
local intersection = lineStart + (lineEnd - lineStart) * alpha -- intersection between the line segment and the plane the rectangle is on
lineIntersectsRectangle = pointIsInTriangle(intersection, vertex1, vertex2, vertex3) or pointIsInTriangle(intersection, vertex3, vertex4, vertex1)
if lineIntersectsRectangle then -- intersection is inside the rectangle
return intersection, intersection -- intersection is on the line and on the rectangle, it is the closest point on both
else -- line segment intersects the plane outside of where the rectangle is
checkLineSegmentEnds = false -- only need to check the ends when the line segment doesn't intersect the plane
end
end
local options = { -- pairs of candidate points on the line and rectangle for finding the closest pair
{closestPointsBetweenTwoLineSegments(lineStart, lineEnd, vertex1, vertex2)}, -- line to perimeter edge 1
{closestPointsBetweenTwoLineSegments(lineStart, lineEnd, vertex2, vertex3)}, -- line to perimeter edge 2
{closestPointsBetweenTwoLineSegments(lineStart, lineEnd, vertex3, vertex4)}, -- line to perimeter edge 3
{closestPointsBetweenTwoLineSegments(lineStart, lineEnd, vertex4, vertex1)} -- line to perimeter edge 4
}
if checkLineSegmentEnds then -- the ends of the line segment might be closer to the middle of the rectangle than the edges
options[#options + 1] = {lineStart, closestPointOnRectangle(lineStart, rectangle)} -- line start point to rectangle
options[#options + 1] = {lineEnd, closestPointOnRectangle(lineEnd, rectangle)} -- line end point to rectangle
end
local shortestDistanceSquared, pointOnLine, pointOnRectangle = math.huge
for i = 1, #options do
if options[i][1] and options[i][2] then -- didn't return nil for some edge case
local distance = (options[i][2] - options[i][1]).sizeSquared
if distance < shortestDistanceSquared then
shortestDistanceSquared, pointOnLine, pointOnRectangle = distance, options[i][1], options[i][2]
end
end
end
return pointOnLine, pointOnRectangle
end
end
local function intersectionsBetweenRectangles(rect1, rect2) -- list each 0-dimensional intersection between the two rectangles
local intersectionPoints = {}
local function addIntersectionPoint(point)
local isUnique = true -- check that this intersection point hasn't already been found
for _, other in pairs(intersectionPoints) do
if (other - point).sizeSquared < 1 then
isUnique = false
break
end
end
if isUnique then
intersectionPoints[#intersectionPoints + 1] = point
end
end
if (rect1.normal ^ rect2.normal).sizeSquared < 0.01 then -- rectangles are parallel, just calculate edge-edge intersections
for _, edge1 in pairs(rect1.edges) do
for _, edge2 in pairs(rect2.edges) do
local a, b = closestPointsBetweenTwoLineSegments(edge1[1], edge1[2], edge2[1], edge2[2])
if a and (a - b).sizeSquared < 1 then -- edges intersect, or close enough
addIntersectionPoint(a)
end
end
end
else -- calculate edge-face intersections
for _, edge in pairs(rect1.edges) do
local a, b = closestPointsBetweenLineSegmentAndRectangle(edge[1], edge[2], rect2)
if a and (a - b).sizeSquared < 1 then
addIntersectionPoint(a)
end
end
for _, edge in pairs(rect2.edges) do
local a, b = closestPointsBetweenLineSegmentAndRectangle(edge[1], edge[2], rect1)
if a and (a - b).sizeSquared < 1 then
addIntersectionPoint(a)
end
end
end
return intersectionPoints
end
function pointToNode(point) -- get a "node" from the point by projecting it onto the nearest rectangle
local minDistanceSquared, closestPoint, closestRectangle = math.huge
for _, rectangle in pairs(rectangles) do
local projection = closestPointOnRectangle(point, rectangle)
local distanceSquared = (point - projection).sizeSquared
if distanceSquared < minDistanceSquared then
minDistanceSquared, closestPoint, closestRectangle = distanceSquared, projection, rectangle
end
end
return {position = closestPoint, connectedRectangles = {closestRectangle}}
end
local MinHeap = {New = function()
local heap = {}
return {Insert = function(self, value)
local valueIndex = #heap + 1
while true do -- bubble up
local parentIndex = valueIndex//2
if parentIndex == 0 or value >= heap[parentIndex] then
heap[valueIndex] = value
break
else
heap[valueIndex], valueIndex = heap[parentIndex], parentIndex
end
end
end, Extract = function(self)
local value, parent, parentIndex = heap[1], table.remove(heap), 1
while true do -- bubble down
local leftChild, rightChild = heap[parentIndex*2], heap[parentIndex*2+1]
if not leftChild or (parent <= leftChild and (not rightChild or parent <= rightChild)) then
if parentIndex ~= #heap+1 then heap[parentIndex] = parent end
return value
elseif parent > leftChild and (not rightChild or leftChild <= rightChild) then
heap[parentIndex], parentIndex = leftChild, parentIndex*2
elseif parent > rightChild then
heap[parentIndex], parentIndex = rightChild, parentIndex*2+1
end
end
end, heap = heap}
end}
function API.RegisterRectangles(rectangleFolder)
if #rectangles > 0 then
error("Cannot register rectangles multiple times for pathing.")
return
end
-- turn the cube meshes in rectangleFolder into a list of rectangles
for _, part in pairs(rectangleFolder:GetChildren()) do
local rect = {}
rectangles[#rectangles + 1] = rect
local partCenter = part:GetWorldPosition()
local partRotation = part:GetWorldRotation()
local partSize = part:GetWorldScale() * 100 -- based on cube mesh size
rect.vertices = {
partCenter + partRotation * (partSize * Vector3.New(.5, -.5, 1)), -- front left
partCenter + partRotation * (partSize * Vector3.New(.5, .5, 1)), -- front right
partCenter + partRotation * (partSize * Vector3.New(-.5, .5, 1)), -- back right
partCenter + partRotation * (partSize * Vector3.New(-.5, -.5, 1)) -- back left
}
rect.edges = {}
for i = 1, 4 do
local vertex1 = rect.vertices[i]
local vertex2 = rect.vertices[i%4 + 1] -- wraps around to 1
rect.edges[#rect.edges + 1] = {vertex1, vertex2}
end
rect.nodes = {}
-- the cross product of two adjacent edges of a polygon is perpendicular to its face
rect.normal = ((rect.vertices[2] - rect.vertices[1]) ^ (rect.vertices[3] - rect.vertices[1])):GetNormalized()
end
-- determine intersections between pairs of rectangles, or adjacency within some epsilon distance
local intersectionCount = 0
local generationStart = os.clock()
for i = 1, #rectangles do
local rect1 = rectangles[i]
for j = i+1, #rectangles do
local rect2 = rectangles[j]
local fastSpawnConnection -- don't take any chances with the instruction limit, spam new tasks
fastSpawnConnection = API_RE.Connect("fastSpawn", function()
fastSpawnConnection:Disconnect()
local intersectionPoints = intersectionsBetweenRectangles(rect1, rect2)
for _, point in pairs(intersectionPoints) do
local newNode = {position = point, connectedRectangles = {rect1, rect2}}
rect1.nodes[#rect1.nodes + 1] = newNode
rect2.nodes[#rect2.nodes + 1] = newNode
intersectionCount = intersectionCount + 1
end
end)
API_RE.Broadcast("fastSpawn")
end
end
end
function API.GetPath(startPosition, endPosition)
local startNode = pointToNode(startPosition)
local endNode = pointToNode(endPosition)
local startFlyDistance = (startPosition - startNode.position).size
local endFlyDistance = (endPosition - endNode.position).size
local straightFlyDistance = (endPosition - startPosition).size
-- If we are already flying, don't run back to the navmesh unless that means less flying
if straightFlyDistance < startFlyDistance + endFlyDistance then
return {endPosition}
end
local endRectangle = endNode.connectedRectangles[1]
local pathNodeMetatable = {
__le = function(a, b) return a.lengthPlusHeuristic <= b.lengthPlusHeuristic end,
__lt = function(a, b) return a.lengthPlusHeuristic < b.lengthPlusHeuristic end
}
local priorityQueue = MinHeap.New()
priorityQueue:Insert(setmetatable({path = {startNode}, length = 0, lengthPlusHeuristic = 0}, pathNodeMetatable))
local visitedNodes = {}
local clock = os.clock()
local solutionPath = nil
local iterations = 0
while priorityQueue.heap[1] and not solutionPath do
iterations = iterations + 1
local currentElement = priorityQueue:Extract()
local currentNode = currentElement.path[#currentElement.path]
if not visitedNodes[currentNode] then
visitedNodes[currentNode] = true
for _, rectangle in pairs(currentNode.connectedRectangles) do
if rectangle == endRectangle then
solutionPath = currentElement.path
solutionPath[#solutionPath + 1] = endNode
break
end
for _, node in pairs(rectangle.nodes) do
if not visitedNodes[node] then
local newPath = {table.unpack(currentElement.path)}
newPath[#newPath + 1] = node
local newLength = currentElement.length + (currentNode.position - node.position).size
priorityQueue:Insert(setmetatable({
path = newPath,
length = newLength,
lengthPlusHeuristic = newLength + (node.position - endNode.position).size
}, pathNodeMetatable))
end
end
end
end
end
if solutionPath then
-- remove unnecessary nodes when a straight line is possible
-- changes in elevation like ramps are a complicated edge case. todo
local startNodeIndex = 1
while startNodeIndex <= #solutionPath - 2 do
local node1 = solutionPath[startNodeIndex]
local importantRectangleDict = {}
for _, rect in pairs(node1.connectedRectangles) do
importantRectangleDict[rect] = true
end
while solutionPath[startNodeIndex + 2] do
local node2 = solutionPath[startNodeIndex + 2]
-- check if the line exits the walkable space. if it doesn't then remove the node in-between
for _, rect in pairs(solutionPath[startNodeIndex + 1].connectedRectangles) do
importantRectangleDict[rect] = true -- also list rectangles connected to the in-between node
end
for _, rect in pairs(node2.connectedRectangles) do
importantRectangleDict[rect] = true
end
local intersections = {} -- list all intersections with the rectangles in importantRectangleDict. order them by distance from one end of the line segment.
for rect in pairs(importantRectangleDict) do
local linePoint, rectPoint = closestPointsBetweenLineSegmentAndRectangle(node1.position, node2.position, rect)
if linePoint then -- not coplanar
if (linePoint - rectPoint).sizeSquared < 1 then
intersections[#intersections + 1] = linePoint
end
else -- line is on the same plane as the rectangle, do edge intersection checks instead
for _, edge in pairs(rect.edges) do
local linePoint, edgePoint = closestPointsBetweenTwoLineSegments(node1.position, node2.position, edge[1], edge[2])
if linePoint and (linePoint - edgePoint).sizeSquared < 1 then -- line intersects this edge
intersections[#intersections + 1] = linePoint
end
end
end
end
table.sort(intersections, function(a, b)
return (a - node1.position).sizeSquared < (b - node1.position).sizeSquared
end)
local canSkipNode = true -- iterate over each adjacent pair of intersections and ensure the midpoint between them is on a walkable surface.
for i = 1, #intersections - 1 do
local point1, point2 = intersections[i], intersections[i+1]
local midpoint = (point1 + point2) / 2
local isOnSurface = false
for rect in pairs(importantRectangleDict) do -- check whether the midpoint is on a rectangle
if (closestPointOnRectangle(midpoint, rect) - midpoint).sizeSquared < 1 then
isOnSurface = true -- found a rectangle that the midpoint is on
break
end
end
if not isOnSurface then -- the midpoint of these intersections is outside the walkable space
canSkipNode = false
end
end
if canSkipNode then
table.remove(solutionPath, startNodeIndex + 1)
else
break
end
end
startNodeIndex = startNodeIndex + 1
end
for i = 1, #solutionPath do -- convert nodes to positions
solutionPath[i] = solutionPath[i].position
end
-- We fly to the target if needed
table.insert(solutionPath, endPosition)
return solutionPath
else
return {endPosition}
end
end
return API
|
object_tangible_loot_npc_loot_elect_module_wires = object_tangible_loot_npc_loot_shared_elect_module_wires:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_npc_loot_elect_module_wires, "object/tangible/loot/npc/loot/elect_module_wires.iff")
|
-- Scripts pour tester le sniffer de smartphone qui essaient de se connecter sur des AP WIFI
-- source: https://nodemcu.readthedocs.io/en/dev/modules/wifi/#wifieventmonregister
print("\n b.lua zf190119.1920 \n")
--f= "set_time.lua" if file.exists(f) then dofile(f) end
-- apzuzu6 38:2c:4a:4e:d3:d8
zmac_adrs={}
zmac_adrs["b8:d7:af:a6:bd:86"]={["zname"]="S7 zf"}
zmac_adrs["cc:c0:79:7d:f5:d5"]={["zname"]="S7 Mélanie"}
zmac_adrs["5c:f9:38:a1:f7:f0"]={["zname"]="MAC zf"}
zmac_adrs["d8:30:62:5a:d6:3a"]={["zname"]="IMAC Maman"}
function zshow()
for k, v in pairs(zmac_adrs) do
print(k,zmac_adrs[k]["zname"],zmac_adrs[k]["zrssi"],zmac_adrs[k]["ztime"])
end
end
--[[
zshow()
]]
function zround(num, dec)
local mult = 10^(dec or 0)
return math.floor(num * mult + 0.5) / mult
end
function zsniff(T)
print("\n\tMAC: ".. T.MAC.."\n\tRSSI: "..T.RSSI)
ztime()
if zmac_adrs[T.MAC] == nil then
print("Oh une inconnue !")
zmac_adrs[T.MAC]={}
end
zmac_adrs[T.MAC]["ztime"]=string.format("%04d/%02d/%02d %02d:%02d:%02d", tm["year"], tm["mon"], tm["day"], tm["hour"], tm["min"], tm["sec"])
if zmac_adrs[T.MAC]["zrssi"] == nil then
zmac_adrs[T.MAC]["zrssi"]=T.RSSI
else
zmac_adrs[T.MAC]["zrssi"]=zround((4*zmac_adrs[T.MAC]["zrssi"]+T.RSSI)/5, 0)
end
if zmac_adrs[T.MAC]["zname"] ~= nil then
print("Bonjour "..zmac_adrs[T.MAC]["zname"].." !")
end
end
wifi.eventmon.register(wifi.eventmon.AP_PROBEREQRECVED, zsniff)
--[[
wifi.eventmon.unregister(wifi.eventmon.AP_PROBEREQRECVED)
]]
|
--
-- Component: Colors
--
local Component = {}
Component.__index = Component
local function createComponent(propertyName)
local self = setmetatable({}, Component)
self.propertyName = propertyName
self.gui = false
self.visible = true
self.element = false
self.x = -1
self.y = -1
self.parent = false
self.color = {}
return self
end
createComponentFactory("Color4", createComponent)
local function getARGBFromString(a, r, g, b)
return ("%02X%02X%02X%02X"):format(a, r, g, b)
end
local function getColorsString(tl, tr, bl, br)
tr = tr or tl
bl = bl or tl
br = br or tl
return ("tl:%s tr:%s bl:%s br:%s"):format(tl, tr, bl, br)
end
local function getColorsFromString(colorsString)
return colorsString:match("tl:(%x+) tr:(%x+) bl:(%x+) br:(%x+)")
end
--
-- Public
--
function Component:setElement(element)
if self.element == element then
return
end
self.element = element
if self.gui then
self:refresh()
end
end
function Component:refresh()
if not self.gui then
return
end
local gui = self.gui
local value = guiGetProperty(self.element, self.propertyName)
local tl, tr, bl, br = getColorsFromString(value)
self.color.tl = tl or "FFFFFFFF"
self.color.tr = tr or "FFFFFFFF"
self.color.bl = bl or "FFFFFFFF"
self.color.br = br or "FFFFFFFF"
local colorsString = getColorsString(self.color.tl, self.color.tr, self.color.bl, self.color.br)
guiSetProperty(gui.background, "ImageColours", colorsString)
if self.color.tl ~= self.color.tr or self.color.tl ~= self.color.bl or self.color.tl ~= self.color.br then
if gui.selected == "all" then
gui.selected = "tl"
guiRadioButtonSetSelected(gui.radio.tl, true)
end
local color = self.color[gui.selected]
gui.colorpicker:setColor(color)
else
guiRadioButtonSetSelected(gui.radio.all, true)
gui.colorpicker:setColor(self.color.tl)
end
end
function Component:render(x, y, width, parent)
if not self.gui then
-- Create GUI for the first time
self:_createGUI(x, y, width, parent)
return
end
if self.parent and self.parent ~= parent then
-- Parent has changed, delete everything
self:_destroyGUI()
self:_createGUI(x, y, width, parent)
return
end
if self.x ~= x or self.y ~= y then
-- Component must be moved
self:_moveGUI(x, y, width)
return
end
end
function Component:getHeight()
return self.gui and 105 or 0
end
function Component:show()
if not self.visible then
self.visible = true
self:_updateGUIVisibility()
end
end
function Component:hide()
if self.visible then
self.visible = false
self:_updateGUIVisibility()
end
end
function Component:isVisible()
return self.visible
end
--
-- Private
--
function Component:_createGUI(x, y, width, parent)
if self.gui then
return
end
local gui = {}
local half_width = width / 2
gui.label = guiCreateLabel(x, y + 2, half_width, 20, self.propertyName, false, parent)
guiSetFont(gui.label, "clear-normal")
local value = guiGetProperty(self.element, self.propertyName)
local tl, tr, bl, br = getColorsFromString(value)
self.color.tl = tl or "FFFFFFFF"
self.color.tr = tr or "FFFFFFFF"
self.color.bl = bl or "FFFFFFFF"
self.color.br = br or "FFFFFFFF"
local colorsString = getColorsString(self.color.tl, self.color.tr, self.color.bl, self.color.br)
gui.frame = guiCreateGridList(x, y + 20, 150, 75, false, parent)
addEventHandler("onClientGUIClick", gui.frame, bind(self, self._clickFrame))
gui.background = guiCreateStaticImage(5, 5, 140, 65, "assets/dot.png", false, gui.frame)
guiSetProperty(gui.background, "ImageColours", colorsString)
guiSetEnabled(gui.background, false)
gui.radio = {}
gui.radio.tl = guiCreateRadioButton( 2, 0, 20, 20, "", false, gui.frame)
gui.radio.bl = guiCreateRadioButton( 2, 56, 20, 20, "", false, gui.frame)
gui.radio.tr = guiCreateRadioButton(133, 0, 20, 20, "", false, gui.frame)
gui.radio.br = guiCreateRadioButton(133, 56, 20, 20, "", false, gui.frame)
gui.radio.all = guiCreateRadioButton(65, 28, 20, 20, "", false, gui.frame)
gui.selected = "all"
if self.color.tl ~= self.color.tr or self.color.tl ~= self.color.bl or self.color.tl ~= self.color.br then
gui.selected = "tl"
guiRadioButtonSetSelected(gui.radio.tl, true)
else
guiRadioButtonSetSelected(gui.radio.all, true)
end
gui.colorpicker = guiCreateColorPicker(x + half_width, y, half_width, parent, self.color.tl,
function (color)
if guiRadioButtonGetSelected(gui.radio.all) then
self.color.tl = color
self.color.bl = color
self.color.tr = color
self.color.br = color
elseif guiRadioButtonGetSelected(gui.radio.tl) then
self.color.tl = color
elseif guiRadioButtonGetSelected(gui.radio.bl) then
self.color.bl = color
elseif guiRadioButtonGetSelected(gui.radio.tr) then
self.color.tr = color
elseif guiRadioButtonGetSelected(gui.radio.br) then
self.color.br = color
end
local colorsString = getColorsString(self.color.tl, self.color.tr, self.color.bl, self.color.br)
guiSetProperty(gui.background, "ImageColours", colorsString)
guiSetProperty(self.element, self.propertyName, colorsString)
end
)
self.x = x
self.y = y
self.parent = parent
self.gui = gui
end
function Component:_destroyGUI()
if not self.gui then
return
end
local gui = self.gui
destroyElement(gui.label)
destroyElement(gui.frame)
gui.colorpicker:destroy()
end
function Component:_moveGUI(x, y, width)
if not self.gui then
return
end
local gui = self.gui
local half_width = width / 2
guiSetPosition(gui.label, x, y + 2, false)
guiSetPosition(gui.frame, x, y + 20, false)
gui.colorpicker:move(x + half_width, y)
self.x = x
self.y = y
end
function Component:_updateGUIVisibility()
if not self.gui then
return
end
local gui = self.gui
guiSetVisible(gui.label, self.visible)
guiSetVisible(gui.frame, self.visible)
gui.colorpicker:setVisible(self.visible)
end
function Component:_clickFrame()
local gui = self.gui
if source == gui.frame then
return
end
if guiRadioButtonGetSelected(gui.radio.all) then
if gui.selected == "all" then return end
local color = self.color[gui.selected]
self.color.tl = color
self.color.tr = color
self.color.bl = color
self.color.br = color
gui.colorpicker:setColor(color)
gui.selected = "all"
elseif guiRadioButtonGetSelected(gui.radio.tl) then
if gui.selected == "tl" then return end
gui.colorpicker:setColor(self.color.tl)
gui.selected = "tl"
elseif guiRadioButtonGetSelected(gui.radio.tr) then
if gui.selected == "tr" then return end
gui.colorpicker:setColor(self.color.tr)
gui.selected = "tr"
elseif guiRadioButtonGetSelected(gui.radio.bl) then
if gui.selected == "bl" then return end
gui.colorpicker:setColor(self.color.bl)
gui.selected = "bl"
elseif guiRadioButtonGetSelected(gui.radio.br) then
if gui.selected == "br" then return end
gui.colorpicker:setColor(self.color.br)
gui.selected = "br"
end
end
|
local bitLib = require("plugin.bit" )
local band = bitLib.band
local rshift = bitLib.rshift
local PixelHitTest = class('PixelHitTest', false)
function PixelHitTest.parse(ba)
local t = {}
ba:readInt()
t.pixelWidth = ba:readInt()
t.scale = 1.0 / ba:readByte()
t.pixels = ba:readBuffer()
return t
end
function PixelHitTest:ctor(data, offsetX, offsetY, sourceWidth, sourceHeight)
self.data = data
self.offsetX = offsetX
self.offsetY = offsetY
self.sourceWidth = sourceWidth
self.sourceHeight = sourceHeight
end
function PixelHitTest:hitTest(x, y, width, height)
if x<0 or y<0 or x>width or y>height then
return false
end
local x = math.floor((x * self.sourceWidth / width - self.offsetX) * self.data.scale)
local y = math.floor((y * self.sourceHeight / height - self.offsetY) * self.data.scale)
if x >= self.data.pixelWidth then
return false
end
local pos = y * self.data.pixelWidth + x
local pos2 = pos / 8
local pos3 = pos % 8
if pos2 >= 0 and pos2 < self.data.pixels.length then
self.data.pixels.pos = pos2
local t = self.data.pixels:readByte()
return band(rshift(t, pos3), 1) > 0
else
return false
end
end
return PixelHitTest
|
-- Copyright 2021 Kafka-Tarantool-Loader
--
-- 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.
-- This file is required automatically by luatest.
-- Add common configuration here.
local fio = require('fio')
local t = require('luatest')
local helper = {}
helper.root = fio.dirname(fio.abspath(package.search('init')))
helper.datadir = fio.pathjoin(helper.root, 'tmp', 'db_test')
helper.server_command = fio.pathjoin(helper.root, 'init.lua')
t.before_suite(function()
fio.rmtree(helper.datadir)
fio.mktree(helper.datadir)
end)
return helper
|
--@name Texture Collector v4.5
--@author Vurv
--@client
-- Texture Collector v4.5 by Vurv on Discord (363590853140152321)
-- Allows you to customize the pixel saving / file saving much more easily with an example of a compressed texture, that is ~200kb per 512x512 texture.
-- Takes ~80 seconds to save all of the textures in bigcity as these compressed 200kb text files (512x512 res). (~60MB)
if player() ~= owner() then return end
local CPUMax = 0.9 -- 0-1 as a percentage. Higher is more unstable without extra quota checks.
local FilePath = "textures/@.txt" -- @ will be replaced with the texture name.
local FindMatFunc = function(mat) -- Needs to return width and height
return 512,512
end
-- locals for optimization
local render = render
local readPixel = render.readPixel
local format = string.format
local PixelFunc = function(r,g,b) -- Returns a string representing the r,g,b pixel. This will be pushed to the current pixels table which will be saved in the SaveFunc (unless you return false)
return format("%c%c%c",r,g,b)
end
local SaveFunc = function(Pixels,Path) -- File saving function
local data = fastlz.compress( table.concat(Pixels) )
file.write(Path,data)
end
local Materials = {}
-- init
file.createDir("textures")
render.createRenderTarget("rt")
local function canRun()
return quotaTotalAverage()<quotaMax()*CPUMax
end
local function quotaCheck()
if not canRun() then coroutine.yield() end
end
local usemat = material.create("UnlitGeneric")
usemat:setInt("$flags",0)
local function main()
local Started = timer.systime()
local SurfaceInfo = find.byClass("worldspawn")[1]:getBrushSurfaces()
local MaterialsFound = 0
for K,V in pairs(SurfaceInfo) do
local N = V:getMaterial():getName() -- Locked materials fucking useless !!!! omg!!
quotaCheck()
if not Materials[N] then Materials[N] = true MaterialsFound = MaterialsFound + 1 end
end
print(Color(50,255,255),format("Successfully found [%d] materials!!",MaterialsFound))
print(Color(255,255,50),"Starting to load textures, look in console for more details")
for Name in next,Materials do
printMessage(2,"Loading mat"..Name.."\n")
local FixedName = string.replace(Name,"/","_") -- We have to replace /'s since lua's file system uses forward slashes :v
local Path = string.replace(FilePath,"@",FixedName)
quotaCheck()
if file.exists(Path) then print(Color(255,50,50),"Failed to load mat "..Name..", it already exists!") continue end
usemat:setTexture("$basetexture",material.getTexture(Name,"$basetexture"))
render.setMaterial(usemat)
local Width,Height = FindMatFunc(usemat)
render.selectRenderTarget("rt")
render.drawTexturedRect(0,0,Width,Height)
render.capturePixels()
render.selectRenderTarget()
local Pixels = {}
for Y = 0,Height-1 do
for X = 0,Width-1 do
quotaCheck()
local C = readPixel(X,Y)
local V = PixelFunc(C.r,C.g,C.b)
if V then Pixels[X+Y*Height+1] = V end
quotaCheck()
end
end
SaveFunc(Pixels,Path)
print(Color(50,255,50),"Successfully saved file "..Path)
Pixels = nil
quotaCheck()
end
print("Finished in "..tostring(timer.systime()-Started).."s")
return true
end
co = coroutine.create(main)
local coroutine = coroutine
local coroutine_resume = coroutine.resume
local coroutine_status = coroutine.status
hook.add("renderoffscreen","",function()
if coroutine_status(co) ~= "dead" then
if canRun() then
coroutine_resume(co)
end
end
end)
|
local FOLDER_NAME, private = ...
local L = LibStub("AceLocale-3.0"):NewLocale(FOLDER_NAME, "ruRU", false)
if not L then return end
L["ALT_KEY"] = "Alt-"
L["COLLAPSE_SECTION"] = "Свернуть"
L["COLUMN_LABEL_REALM"] = "Сервер"
L["CONTROL_KEY"] = "Ctrl- "
L["EXPAND_SECTION"] = "Развернуть"
L["LEFT_CLICK"] = "Левый клик"
L["MINIMAP_ICON_DESC"] = "Показать иконку у мини карты."
L["MOVE_SECTION_DOWN"] = "Сдвинуть вниз"
L["MOVE_SECTION_UP"] = "Сдвинуть вверх"
L["NOTES_ARRANGEMENT_COLUMN"] = "Колонки"
L["NOTES_ARRANGEMENT_ROW"] = "Полосы"
L["RIGHT_CLICK"] = "Правый клик"
L["SHIFT_KEY"] = "Shift-"
L["TOOLTIP_HIDEDELAY_DESC"] = "Сколько будет показываться подсказка после перемещения курсора (в секундах)."
L["TOOLTIP_HIDEDELAY_LABEL"] = "Задержка затухания подсказки"
L["TOOLTIP_SCALE_LABEL"] = "Масштаб подсказки"
|
-- Compiling plugin specifications to Lua for lazy-loading
local util = require('packer.util')
local log = require('packer.log')
local fmt = string.format
local config
local function cfg(_config) config = _config end
local feature_guard = [[
if !has('nvim-0.5')
echohl WarningMsg
echom "Invalid Neovim version for packer.nvim!"
echohl None
finish
endif
]]
local vim_loader = [[
function! s:load(names, cause) abort
call luaeval('_packer_load(_A[1], _A[2])', [a:names, a:cause])
endfunction
]]
local lua_loader = [[
local function handle_bufread(names)
for _, name in ipairs(names) do
local path = plugins[name].path
for _, dir in ipairs({ 'ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin' }) do
if #vim.fn.finddir(dir, path) > 0 then
vim.cmd('doautocmd BufRead')
return
end
end
end
end
_packer_load = nil
local function handle_after(name, before)
local plugin = plugins[name]
plugin.load_after[before] = nil
if next(plugin.load_after) == nil then
_packer_load({name}, {})
end
end
_packer_load = function(names, cause)
local some_unloaded = false
for _, name in ipairs(names) do
if not plugins[name].loaded then
some_unloaded = true
break
end
end
if not some_unloaded then return end
local fmt = string.format
local del_cmds = {}
local del_maps = {}
for _, name in ipairs(names) do
if plugins[name].commands then
for _, cmd in ipairs(plugins[name].commands) do
del_cmds[cmd] = true
end
end
if plugins[name].keys then
for _, key in ipairs(plugins[name].keys) do
del_maps[key] = true
end
end
end
for cmd, _ in pairs(del_cmds) do
vim.cmd('silent! delcommand ' .. cmd)
end
for key, _ in pairs(del_maps) do
vim.cmd(fmt('silent! %sunmap %s', key[1], key[2]))
end
for _, name in ipairs(names) do
if not plugins[name].loaded then
vim.cmd('packadd ' .. name)
if plugins[name].config then
for _i, config_line in ipairs(plugins[name].config) do
loadstring(config_line)()
end
end
if plugins[name].after then
for _, after_name in ipairs(plugins[name].after) do
handle_after(after_name, name)
vim.cmd('redraw')
end
end
plugins[name].loaded = true
end
end
handle_bufread(names)
if cause.cmd then
local lines = cause.l1 == cause.l2 and '' or (cause.l1 .. ',' .. cause.l2)
vim.cmd(fmt('%s%s%s %s', lines, cause.cmd, cause.bang, cause.args))
elseif cause.keys then
local keys = cause.keys
local extra = ''
while true do
local c = vim.fn.getchar(0)
if c == 0 then break end
extra = extra .. vim.fn.nr2char(c)
end
if cause.prefix then
local prefix = vim.v.count ~= 0 and vim.v.count or ''
prefix = prefix .. '"' .. vim.v.register .. cause.prefix
if vim.fn.mode('full') == 'no' then
if vim.v.operator == 'c' then
prefix = '' .. prefix
end
prefix = prefix .. vim.v.operator
end
vim.fn.feedkeys(prefix, 'n')
end
-- NOTE: I'm not sure if the below substitution is correct; it might correspond to the literal
-- characters \<Plug> rather than the special <Plug> key.
vim.fn.feedkeys(string.gsub(string.gsub(cause.keys, '^<Plug>', '\\<Plug>') .. extra, '<[cC][rR]>', '\r'))
elseif cause.event then
vim.cmd(fmt('doautocmd <nomodeline> %s', cause.event))
elseif cause.ft then
vim.cmd(fmt('doautocmd <nomodeline> %s FileType %s', 'filetypeplugin', cause.ft))
vim.cmd(fmt('doautocmd <nomodeline> %s FileType %s', 'filetypeindent', cause.ft))
end
end
]]
local function make_loaders(_, plugins)
local loaders = {}
local configs = {}
local rtps = {}
local setup = {}
local fts = {}
local events = {}
local conditions = {}
local commands = {}
local keymaps = {}
local after = {}
for name, plugin in pairs(plugins) do
if not plugin.disable then
local quote_name = "'" .. name .. "'"
if plugin.config and not plugin.executable_config then
plugin.executable_config = {}
if type(plugin.config) ~= 'table' then plugin.config = {plugin.config} end
for i, config_item in ipairs(plugin.config) do
local executable_string = config_item
if type(config_item) == 'function' then
local stringified = string.dump(config_item, true)
plugin.config[i] = stringified
executable_string = 'loadstring(' .. vim.inspect(stringified) .. ')()'
end
table.insert(plugin.executable_config, executable_string)
end
end
if plugin.rtp then table.insert(rtps, util.join_paths(plugin.install_path, plugin.rtp)) end
if plugin.opt then
loaders[name] = {
loaded = false,
config = plugin.config,
path = plugin.install_path .. (plugin.rtp and plugin.rtp or ''),
only_sequence = plugin.manual_opt == nil,
only_setup = false
}
if plugin.setup then
if type(plugin.setup) ~= 'table' then plugin.setup = {plugin.setup} end
for i, setup_item in ipairs(plugin.setup) do
if type(setup_item) == 'function' then
local stringified = vim.inspect(string.dump(setup_item, true))
plugin.setup[i] = 'loadstring(' .. stringified .. ')()'
end
end
loaders[name].only_setup = plugin.manual_opt == nil
setup[name] = plugin.setup
end
if plugin.ft then
loaders[name].only_sequence = false
loaders[name].only_setup = false
if type(plugin.ft) == 'string' then plugin.ft = {plugin.ft} end
for _, ft in ipairs(plugin.ft) do
fts[ft] = fts[ft] or {}
table.insert(fts[ft], quote_name)
end
end
if plugin.event then
loaders[name].only_sequence = false
loaders[name].only_setup = false
if type(plugin.event) == 'string' then plugin.event = {plugin.event} end
for _, event in ipairs(plugin.event) do
events[event] = events[event] or {}
table.insert(events[event], quote_name)
end
end
if plugin.cond then
loaders[name].only_sequence = false
loaders[name].only_setup = false
if type(plugin.cond) == 'string' or type(plugin.cond) == 'function' then
plugin.cond = {plugin.cond}
end
for _, condition in ipairs(plugin.cond) do
if type(condition) == 'function' then
condition = 'loadstring(' .. vim.inspect(string.dump(condition, true)) .. ')()'
end
conditions[condition] = conditions[condition] or {}
table.insert(conditions[condition], name)
end
end
if plugin.cmd then
loaders[name].only_sequence = false
loaders[name].only_setup = false
if type(plugin.cmd) == 'string' then plugin.cmd = {plugin.cmd} end
loaders[name].commands = {}
for _, command in ipairs(plugin.cmd) do
commands[command] = commands[command] or {}
table.insert(loaders[name].commands, command)
table.insert(commands[command], quote_name)
end
end
if plugin.keys then
loaders[name].only_sequence = false
loaders[name].only_setup = false
if type(plugin.keys) == 'string' then plugin.keys = {plugin.keys} end
loaders[name].keys = {}
for _, keymap in ipairs(plugin.keys) do
if type(keymap) == 'string' then keymap = {'', keymap} end
keymaps[keymap] = keymaps[keymap] or {}
table.insert(loaders[name].keys, keymap)
table.insert(keymaps[keymap], quote_name)
end
end
if plugin.after then
loaders[name].only_setup = false
if type(plugin.after) == 'string' then plugin.after = {plugin.after} end
for _, other_plugin in ipairs(plugin.after) do
after[other_plugin] = after[other_plugin] or {}
table.insert(after[other_plugin], name)
end
end
end
if plugin.config and (not plugin.opt or loaders[name].only_setup) then
plugin.only_config = true
configs[name] = plugin.executable_config
end
end
end
local ft_aucmds = {}
for ft, names in pairs(fts) do
table.insert(ft_aucmds, fmt(' au FileType %s ++once call s:load([%s], { "ft": "%s" })', ft,
table.concat(names, ', '), ft))
end
local event_aucmds = {}
for event, names in pairs(events) do
table.insert(event_aucmds, fmt(' au %s ++once call s:load([%s], { "event": "%s" })', event,
table.concat(names, ', '), event))
end
local config_lines = {}
for name, plugin_config in pairs(configs) do
local lines = {'-- Config for: ' .. name}
vim.list_extend(lines, plugin_config)
vim.list_extend(config_lines, lines)
end
local rtp_line = ''
for _, rtp in ipairs(rtps) do rtp_line = rtp_line .. '",' .. vim.fn.escape(rtp, '\\,') .. '"' end
if rtp_line ~= '' then rtp_line = 'vim.o.runtimepath = vim.o.runtimepath .. ' .. rtp_line end
local setup_lines = {}
for name, plugin_setup in pairs(setup) do
local lines = {'-- Setup for: ' .. name}
vim.list_extend(lines, plugin_setup)
if loaders[name].only_setup then table.insert(lines, 'vim.cmd("packadd ' .. name .. '")') end
vim.list_extend(setup_lines, lines)
end
local conditionals = {}
for condition, names in pairs(conditions) do
local conditional_loads = {}
for _, name in ipairs(names) do
table.insert(conditional_loads, '\tvim.cmd("packadd ' .. name .. '")')
if plugins[name].config then
local lines = {'-- Config for: ' .. name}
vim.list_extend(lines, plugins[name].executable_config)
vim.list_extend(conditional_loads, lines)
end
end
local conditional = [[if
]] .. condition .. [[
then
]] .. table.concat(conditional_loads, '\n\t') .. '\nend\n'
table.insert(conditionals, conditional)
end
local command_defs = {}
for command, names in pairs(commands) do
local command_line = fmt(
'command! -nargs=* -range -bang -complete=file %s call s:load([%s], { "cmd": "%s", "l1": <line1>, "l2": <line2>, "bang": <q-bang>, "args": <q-args> })',
command, table.concat(names, ', '), command)
table.insert(command_defs, command_line)
end
local keymap_defs = {}
for keymap, names in pairs(keymaps) do
local prefix = nil
if keymap[1] ~= 'i' then prefix = '' end
local cr_escaped_map = string.gsub(keymap[2], '<[cC][rR]>', '\\<CR\\>')
local keymap_line = fmt(
'%snoremap <silent> %s <cmd>call <SID>load([%s], { "keys": "%s"%s })<cr>',
keymap[1], keymap[2], table.concat(names, ', '), cr_escaped_map,
prefix == nil and '' or (', "prefix": "' .. prefix .. '"'))
table.insert(keymap_defs, keymap_line)
end
local sequence_loads = {}
for pre, posts in pairs(after) do
if plugins[pre].opt then
loaders[pre].after = posts
elseif plugins[pre].only_config then
loaders[pre] = {after = posts, only_sequence = true, only_config = true}
end
if plugins[pre].opt or plugins[pre].only_config then
for _, name in ipairs(posts) do
loaders[name].load_after = {}
sequence_loads[name] = sequence_loads[name] or {}
table.insert(sequence_loads[name], pre)
end
end
end
local sequence_lines = {}
local graph = {}
for name, precedents in pairs(sequence_loads) do
graph[name] = graph[name] or {in_links = {}, out_links = {}}
for _, pre in ipairs(precedents) do
graph[pre] = graph[pre] or {in_links = {}, out_links = {}}
graph[name].in_links[pre] = true
table.insert(graph[pre].out_links, name)
end
end
local frontier = {}
for name, links in pairs(graph) do
if next(links.in_links) == nil then table.insert(frontier, name) end
end
while next(frontier) ~= nil do
local plugin = table.remove(frontier)
if loaders[plugin].only_sequence
and not (loaders[plugin].only_setup or loaders[plugin].only_config) then
table.insert(sequence_lines, 'vim.cmd [[ packadd ' .. plugin .. ' ]]')
if plugins[plugin].config then
local lines = {'', '-- Config for: ' .. plugin}
vim.list_extend(lines, plugins[plugin].executable_config)
table.insert(lines, '')
vim.list_extend(sequence_lines, lines)
end
end
for _, name in ipairs(graph[plugin].out_links) do
if not loaders[plugin].only_sequence then
loaders[name].only_sequence = false
loaders[name].load_after[plugin] = true
end
graph[name].in_links[plugin] = nil
if next(graph[name].in_links) == nil then table.insert(frontier, name) end
end
graph[plugin] = nil
end
if next(graph) then
log.warning('Cycle detected in sequenced loads! Load order may be incorrect')
-- TODO: This should actually just output the cycle, then continue with toposort. But I'm too
-- lazy to do that right now, so.
for plugin, _ in pairs(graph) do
table.insert(sequence_lines, 'vim.cmd [[ packadd ' .. plugin .. ' ]]')
if plugins[plugin].config then
local lines = {'-- Config for: ' .. plugin}
vim.list_extend(lines, plugins[plugin].config)
vim.list_extend(sequence_lines, lines)
end
end
end
-- Output everything:
-- First, the Lua code
local result = {'" Automatically generated packer.nvim plugin loader code\n'}
table.insert(result, feature_guard)
table.insert(result, 'lua << END')
table.insert(result, fmt('local plugins = %s\n', vim.inspect(loaders)))
table.insert(result, lua_loader)
-- Then the runtimepath line
table.insert(result, '-- Runtimepath customization')
table.insert(result, rtp_line)
table.insert(result, '-- Pre-load configuration')
vim.list_extend(result, setup_lines)
table.insert(result, '-- Post-load configuration')
vim.list_extend(result, config_lines)
table.insert(result, '-- Conditional loads')
vim.list_extend(result, conditionals)
-- The sequenced loads
table.insert(result, '-- Load plugins in order defined by `after`')
vim.list_extend(result, sequence_lines)
table.insert(result, 'END\n')
-- Then the Vim loader function
table.insert(result, vim_loader)
-- The command and keymap definitions
table.insert(result, '\n" Command lazy-loads')
vim.list_extend(result, command_defs)
table.insert(result, '')
table.insert(result, '" Keymap lazy-loads')
vim.list_extend(result, keymap_defs)
table.insert(result, '')
-- The filetype and event autocommands
table.insert(result, 'augroup packer_load_aucmds\n au!')
table.insert(result, ' " Filetype lazy-loads')
vim.list_extend(result, ft_aucmds)
table.insert(result, ' " Event lazy-loads')
vim.list_extend(result, event_aucmds)
table.insert(result, 'augroup END\n')
-- And a final package path update
return table.concat(result, '\n')
end
local compile = setmetatable({cfg = cfg}, {__call = make_loaders})
compile.opt_keys = {'after', 'cmd', 'ft', 'keys', 'event', 'cond', 'setup'}
return compile
|
-- Copyright (c) 2021 Kirazy
-- Part of Artisanal Reskins: Bob's Mods
--
-- See LICENSE in the project directory for license information.
-- Check to see if reskinning needs to be done.
if not (reskins.bobs and reskins.bobs.triggers.warfare.entities) then return end
-- Make sure the gate exists
local entity = data.raw["gate"]["reinforced-gate"]
if not entity then return end
-- Set input parameters
local inputs = {
type = "gate",
base_entity = "gate",
mod = "bobs",
particles = {["big"] = 1, ["medium"] = 2},
}
inputs.icon_filename = reskins.bobs.directory.."/graphics/icons/warfare/reinforced-gate/gate.png"
local reinforced_tint_index = {
["big"] = util.color("6f647d"),
["medium"] = util.color("a695ba"),
}
-- Parse inputs
reskins.lib.parse_inputs(inputs)
-- Create particles and explosions
reskins.lib.create_explosion("reinforced-gate", inputs)
for particle, key in pairs(inputs.particles) do
reskins.lib.create_particle("reinforced-gate", inputs.base_entity, reskins.lib.particle_index[particle], key, reinforced_tint_index[particle])
end
-- Create remnants
reskins.lib.create_remnant("reinforced-gate", inputs)
-- Create icons
reskins.lib.construct_icon("reinforced-gate", 0, inputs)
-- Reskin the gate
local remnant = data.raw["corpse"]["reinforced-gate-remnants"]
-- Reskin remnants
remnant.animation = {
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/remnants/reinforced-gate-remnants-var-1.png",
line_length = 1,
width = 44,
height = 42,
frame_count = 1,
variation_count = 1,
axially_symmetrical = false,
direction_count = 4,
shift = util.by_pixel(0, 1),
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/remnants/hr-reinforced-gate-remnants-var-1.png",
line_length = 1,
width = 86,
height = 82,
frame_count = 1,
variation_count = 1,
axially_symmetrical = false,
direction_count = 4,
shift = util.by_pixel(0, 1),
scale = 0.5
}
},
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/remnants/reinforced-gate-remnants-var-2.png",
line_length = 1,
width = 42,
height = 42,
frame_count = 1,
variation_count = 1,
axially_symmetrical = false,
direction_count = 4,
shift = util.by_pixel(-1, 0),
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/remnants/hr-reinforced-gate-remnants-var-2.png",
line_length = 1,
width = 84,
height = 82,
frame_count = 1,
variation_count = 1,
axially_symmetrical = false,
direction_count = 4,
shift = util.by_pixel(-0.5, 0),
scale = 0.5
}
},
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/remnants/reinforced-gate-remnants-var-3.png",
line_length = 1,
width = 42,
height = 42,
frame_count = 1,
variation_count = 1,
axially_symmetrical = false,
direction_count = 4,
shift = util.by_pixel(0, 0),
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/remnants/hr-reinforced-gate-remnants-var-3.png",
line_length = 1,
width = 82,
height = 84,
frame_count = 1,
variation_count = 1,
axially_symmetrical = false,
direction_count = 4,
shift = util.by_pixel(0, 0.5),
scale = 0.5
}
}
}
-- Reskin entity
entity.vertical_animation = {
layers = {
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/reinforced-gate-vertical.png",
line_length = 8,
width = 38,
height = 62,
frame_count = 16,
shift = util.by_pixel(0, -14),
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/hr-reinforced-gate-vertical.png",
line_length = 8,
width = 78,
height = 120,
frame_count = 16,
shift = util.by_pixel(-1, -13),
scale = 0.5
}
},
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/reinforced-gate-vertical-shadow.png",
line_length = 8,
width = 40,
height = 54,
frame_count = 16,
shift = util.by_pixel(10, 8),
draw_as_shadow = true,
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/hr-reinforced-gate-vertical-shadow.png",
line_length = 8,
width = 82,
height = 104,
frame_count = 16,
shift = util.by_pixel(9, 9),
draw_as_shadow = true,
scale = 0.5
}
}
}
}
entity.horizontal_animation = {
layers = {
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/reinforced-gate-horizontal.png",
line_length = 8,
width = 34,
height = 48,
frame_count = 16,
shift = util.by_pixel(0, -4),
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/hr-reinforced-gate-horizontal.png",
line_length = 8,
width = 66,
height = 90,
frame_count = 16,
shift = util.by_pixel(0, -3),
scale = 0.5
}
},
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/reinforced-gate-horizontal-shadow.png",
line_length = 8,
width = 62,
height = 30,
frame_count = 16,
shift = util.by_pixel(12, 10),
draw_as_shadow = true,
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/hr-reinforced-gate-horizontal-shadow.png",
line_length = 8,
width = 122,
height = 60,
frame_count = 16,
shift = util.by_pixel(12, 10),
draw_as_shadow = true,
scale = 0.5
}
}
}
}
entity.horizontal_rail_animation_left = {
layers = {
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/reinforced-gate-rail-horizontal-left.png",
line_length = 8,
width = 34,
height = 40,
frame_count = 16,
shift = util.by_pixel(0, -8),
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/hr-reinforced-gate-rail-horizontal-left.png",
line_length = 8,
width = 66,
height = 74,
frame_count = 16,
shift = util.by_pixel(0, -7),
scale = 0.5
}
},
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/reinforced-gate-rail-horizontal-shadow-left.png",
line_length = 8,
width = 62,
height = 30,
frame_count = 16,
shift = util.by_pixel(12, 10),
draw_as_shadow = true,
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/hr-reinforced-gate-rail-horizontal-shadow-left.png",
line_length = 8,
width = 122,
height = 60,
frame_count = 16,
shift = util.by_pixel(12, 10),
draw_as_shadow = true,
scale = 0.5
}
}
}
}
entity.horizontal_rail_animation_right = {
layers = {
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/reinforced-gate-rail-horizontal-right.png",
line_length = 8,
width = 34,
height = 40,
frame_count = 16,
shift = util.by_pixel(0, -8),
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/hr-reinforced-gate-rail-horizontal-right.png",
line_length = 8,
width = 66,
height = 74,
frame_count = 16,
shift = util.by_pixel(0, -7),
scale = 0.5
}
},
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/reinforced-gate-rail-horizontal-shadow-right.png",
line_length = 8,
width = 62,
height = 30,
frame_count = 16,
shift = util.by_pixel(12, 10),
draw_as_shadow = true,
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/hr-reinforced-gate-rail-horizontal-shadow-right.png",
line_length = 8,
width = 122,
height = 58,
frame_count = 16,
shift = util.by_pixel(12, 11),
draw_as_shadow = true,
scale = 0.5
}
}
}
}
entity.vertical_rail_animation_left = {
layers = {
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/reinforced-gate-rail-vertical-left.png",
line_length = 8,
width = 22,
height = 62,
frame_count = 16,
shift = util.by_pixel(0, -14),
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/hr-reinforced-gate-rail-vertical-left.png",
line_length = 8,
width = 42,
height = 118,
frame_count = 16,
shift = util.by_pixel(0, -13),
scale = 0.5
}
},
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/reinforced-gate-rail-vertical-shadow-left.png",
line_length = 8,
width = 44,
height = 54,
frame_count = 16,
shift = util.by_pixel(8, 8),
draw_as_shadow = true,
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/hr-reinforced-gate-rail-vertical-shadow-left.png",
line_length = 8,
width = 82,
height = 104,
frame_count = 16,
shift = util.by_pixel(9, 9),
draw_as_shadow = true,
scale = 0.5
}
}
}
}
entity.vertical_rail_animation_right = {
layers = {
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/reinforced-gate-rail-vertical-right.png",
line_length = 8,
width = 22,
height = 62,
frame_count = 16,
shift = util.by_pixel(0, -14),
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/hr-reinforced-gate-rail-vertical-right.png",
line_length = 8,
width = 42,
height = 118,
frame_count = 16,
shift = util.by_pixel(0, -13),
scale = 0.5
}
},
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/reinforced-gate-rail-vertical-shadow-right.png",
line_length = 8,
width = 44,
height = 54,
frame_count = 16,
shift = util.by_pixel(8, 8),
draw_as_shadow = true,
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/hr-reinforced-gate-rail-vertical-shadow-right.png",
line_length = 8,
width = 82,
height = 104,
frame_count = 16,
shift = util.by_pixel(9, 9),
draw_as_shadow = true,
scale = 0.5
}
}
}
}
entity.vertical_rail_base = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/reinforced-gate-rail-base-vertical.png",
line_length = 8,
width = 68,
height = 66,
frame_count = 16,
shift = util.by_pixel(0, 0),
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/hr-reinforced-gate-rail-base-vertical.png",
line_length = 8,
width = 138,
height = 130,
frame_count = 16,
shift = util.by_pixel(-1, 0),
scale = 0.5
}
}
entity.horizontal_rail_base = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/reinforced-gate-rail-base-horizontal.png",
line_length = 8,
width = 66,
height = 54,
frame_count = 16,
shift = util.by_pixel(0, 2),
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/hr-reinforced-gate-rail-base-horizontal.png",
line_length = 8,
width = 130,
height = 104,
frame_count = 16,
shift = util.by_pixel(0, 3),
scale = 0.5
}
}
entity.wall_patch = {
layers = {
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/reinforced-gate-wall-patch.png",
line_length = 8,
width = 34,
height = 48,
frame_count = 16,
shift = util.by_pixel(0, 12),
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/hr-reinforced-gate-wall-patch.png",
line_length = 8,
width = 70,
height = 94,
frame_count = 16,
shift = util.by_pixel(-1, 13),
scale = 0.5
}
},
{
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/reinforced-gate-wall-patch-shadow.png",
line_length = 8,
width = 44,
height = 38,
frame_count = 16,
shift = util.by_pixel(8, 32),
draw_as_shadow = true,
hr_version = {
filename = reskins.bobs.directory.."/graphics/entity/warfare/reinforced-gate/shadows/hr-reinforced-gate-wall-patch-shadow.png",
line_length = 8,
width = 82,
height = 72,
frame_count = 16,
shift = util.by_pixel(9, 33),
draw_as_shadow = true,
scale = 0.5
}
}
}
}
|
local AccelerateDecelerate = {}
AccelerateDecelerate.new = function(duration)
return setmetatable(
{duration = duration or 30},
{
__index = function(self, frame)
if frame > self.duration then
return 1
end
local t = frame / self.duration
return (math.cos((t + 1) * math.pi) / 2) + 0.5;
end
}
)
end
return AccelerateDecelerate
|
--[[
优点
1 实例控制
单例模式会阻止其他对象实例化其自己的单例对象副本,从而确保所有对象都访问唯一实例
2 灵活性
因为类控制了实例化过程,所以类可以灵活更改实例化过程
缺点
1 开销
虽然数量很少,但如果每次对象请求引用时都要检查是否存在类实例,将仍然需要一些开销。可以通过使用静态初始化解决此问题
2 可能的开发混淆
使用单例对象 尤其在类库中定义的对象 时,开发人员必须记住自己不能使用new关键字实例化对象。因为可能无法访问库源代码,
因此应用程序开发人员可能会意外发现自己无法直接实例化此类。
3 对象生存周期
不能解决删除单个对象的问题,在提供内存管理语言中,只有单例类能够导致实例被取消分配,因为它包含对该实例私有引用。在某些
语言中,其他类可以删除对象实例,但这样会导致单例类中出现悬浮引用。
]]
Singleton = {}
function Singleton:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
function Singleton:Instance()
if self.instance == nil then
self.instance = self:new()
end
return self.instance
end
s1 = Singleton:Instance()
s2 = Singleton:Instance()
if s1 == s2 then
print("the same object.")
end
|
object_tangible_tcg_series1_decorative_indoor_garden_02 = object_tangible_tcg_series1_shared_decorative_indoor_garden_02:new {
}
ObjectTemplates:addTemplate(object_tangible_tcg_series1_decorative_indoor_garden_02, "object/tangible/tcg/series1/decorative_indoor_garden_02.iff")
|
--[[
Copyright 2014 The Luvit Authors. All Rights Reserved.
Copyright 2016-2020 The Node.lua Authors. All Rights Reserved.
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.
--]]
--[[
The process object is a global object and can be accessed from anywhere. It is
an instance of EventEmitter.
--]]
local meta = {
description = "Node-style process module for lnode"
}
local uv = require('luv')
local lutils = require('lutils')
local lnode = require('lnode')
local version = require('@version')
local process = { meta = meta }
local exports = process
-------------------------------------------------------------------------------
-- stream
if (not exports._stdin) then
local _initStream = function(fd, mode)
if uv.guess_handle(fd) == 'tty' then
local stream = uv.new_tty(fd, mode)
return stream, true
else
local stream = uv.new_pipe(false)
uv.pipe_open(stream, fd)
return stream, false
end
end
exports._stdin, exports.isTTY = _initStream(0, true)
exports._stderr = _initStream(2, false)
exports._stdout = _initStream(1, false)
end
-------------------------------------------------------------------------------
-- env
local lenv = { }
function lenv.get(key)
return lenv[key]
end
setmetatable(lenv, {
__pairs = function(env)
local environ = uv.os_environ()
local keys = {}
for key, value in pairs(environ) do
table.insert(keys, key)
end
local index = 0
return function(...)
index = index + 1
local name = keys[index]
if name then
return name, environ[name]
end
end
end,
__index = function(env, key)
return uv.os_getenv(key)
end,
__newindex = function(env, key, value)
if value then
uv.os_setenv(key, value, 1)
else
uv.os_unsetenv(key)
end
end
})
-------------------------------------------------------------------------------
-- misc
local timer = nil
function process.nextTick(...)
if (not timer) then
timer = require('timer')
end
timer.setImmediate(...)
end
function process.kill(pid, signal)
uv.kill(pid, signal or 'sigterm')
end
function process.memoryUsage()
return {
rss = uv.resident_set_memory()
}
end
-------------------------------------------------------------------------------
-- emitter
local signalWraps = { }
process.emitter = nil
function process:emit(event, ...)
if (self.emitter) then
self.emitter:emit(event, ...)
end
end
function process:exit(code)
local left = 2
code = code or 0
local _onFinish = function()
left = left - 1
if (left > 0) then
return
end
if (self.emitter) then
self.emitter:emit('exit', code)
end
os.exit(code)
end
self.isExit = true
local stdout = rawget(self, 'stdout')
if (stdout) then
stdout:once('finish', _onFinish)
stdout:finish()
else
_onFinish()
end
local stderr = rawget(self, 'stderr')
if (stderr) then
stderr:once('finish', _onFinish)
stderr:finish()
else
_onFinish()
end
end
function process:on(event, listener)
local Emitter = require('core').Emitter
if (not self.emitter) then
self.emitter = Emitter:new()
end
local emitter = self.emitter
if (event == "error") or (event == "exit") then
emitter:on(event, listener)
return
end
if not signalWraps[event] then
local signal = uv.new_signal()
signalWraps[event] = signal
uv.unref(signal)
uv.signal_start(signal, event, function()
emitter:emit(event)
end)
end
emitter:on(event, listener)
end
function process:once(event, listener)
local Emitter = require('core').Emitter
if (not self.emitter) then
self.emitter = Emitter:new()
end
local emitter = self.emitter
if (emitter) then
emitter:once(event, listener)
end
end
function process:removeListener(event, listener)
local signal = signalWraps[event]
if not signal then
return
end
signal:stop()
uv.close(signal)
signalWraps[event] = nil
if (self.emitter) then
self.emitter:removeListener(event, listener)
end
end
-------------------------------------------------------------------------------
-- stream
local metatable = {}
metatable.__index = function(self, key)
if (key == 'title') then
return uv.get_process_title()
end
local ret = rawget(self, key)
if (ret ~= nil) then
return ret
end
if rawget(self, 'isExit') then
return ret
end
if (key == 'stdin') then
local tty = require('tty')
ret = tty.createReadStream(process._stdin)
elseif (key == 'stdout') then
local tty = require('tty')
ret = tty.createWriteStream(process._stdout)
elseif (key == 'stderr') then
local tty = require('tty')
ret = tty.createWriteStream(process._stderr)
end
if (ret) then
rawset(self, key, ret)
end
return ret
end
setmetatable(process, metatable)
-------------------------------------------------------------------------------
--
exports.arch = lutils.os_arch --
exports.argv = arg --
exports.chdir = uv.chdir -- Changes the current working directory of the process or throws an exception if that fails
exports.cwd = uv.cwd -- Returns the current working directory of the process.
exports.env = lenv -- An object containing the user environment. See environ(7).
exports.execPath = uv.exepath() --
exports.exitCode = 0 --
exports.getgid = uv.getgid --
exports.getuid = uv.getuid --
exports.hrtime = uv.hrtime -- Returns the current high-resolution real time
exports.now = uv.now --
exports.pid = uv.getpid() -- The PID of the process.
exports.platform = lutils.os_platform
exports.rootPath = lnode.NODE_LUA_ROOT
exports.nodePath = lnode.NODE_LUA_PATH
exports.setgid = uv.setgid --
exports.setuid = uv.setuid --
exports.umask = lutils.umask --
exports.uptime = uv.uptime -- Number of seconds Node.lua has been running.
exports.version = lnode.version -- A compiled-in property that exposes NODE_VERSION.
exports.versions = lnode.versions -- A property exposing version strings of Node.lua and its dependencies.
--
exports.version = exports.version .. '.' .. version.build
return exports
|
--[[
3p8_computer
Uses: multi-platform uses
History: megaman lotto code enter system like chea codes. like the console, swag everywhere.
Memes: chea code swag
Todo:
--3p8 mobile game will provide "blueprint lookup codes" for a "3d printer"
--display fake, "contacting authorization server" "dispatching file"
--make a way to encode custom codes, like, a large function with params that are encrypted
]]
AddCSLuaFile()
ENT.Base = "3p8_base_ent"
ENT.ItemModel = "models/props/cs_office/computer.mdl"
GLOBAL_chea = {
--one time use codes
{
name="3p8_companion_app",
used=false,
inf=false,
func = function(comp)
end
},
{
name="orange",
used=false,
inf=false,
func = function(comp)
end
},
{
name="template",
used=false,
inf=false,
func = function(comp)
end
},
--infinite use codes
{
name="pepperonipizza",
used=false,
inf=true,
func = function(comp)
if SERVER then
local ent2 =ents.Create("micro_item_secrete_hd")
ent2:SetPos(comp:GetPos()+Vector(0,0,32))
ent2:Spawn()
end
end
},
{
name="rocketsocket",
used=false,
inf=true,
func = function(comp)
if SERVER then
local ent2 =ents.Create("3p8_ammo_rocket_socket")
ent2:SetPos(comp:GetPos()+Vector(0,0,32))
ent2:Spawn()
end
end
},
{
name="exodus",
used=false,
inf=true,
func = function(comp)
--give all weapons and stuff
--print("life")
if SERVER then
local ent1 =ents.Create("3p8_kookospahkina_puu")
ent1:SetPos(comp:GetPos()+Vector(0,0,32))
ent1:Spawn()
local ent2 =ents.Create("3p8_ammo_rocket_socket")
ent2:SetPos(comp:GetPos()+Vector(0,0,64))
ent2:Spawn()
local ent3 =ents.Create("3p8_potato_ent")
ent3:SetPos(comp:GetPos()+Vector(0,0,96))
ent3:Spawn()
local ent4 =ents.Create("3p8_potato_head")
ent4:SetPos(comp:GetPos()+Vector(0,0,128))
ent4:Spawn()
end
end
}
}
function ENT:Initialize()
if SERVER then
self:SetModel(self.ItemModel)
self:SetUseType(SIMPLE_USE)
end
self:PhysicsInitStandard()
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
--self:GetPos()
self.health = 75
end
function ENT:Use(ply)
--bring up chea code entering
ply:SendLua("cheacode(Entity("..self:EntIndex().."))")
end
if SERVER then
concommand.Add("3p8_code",function(ply,_,args)
local computer = Entity(tonumber(args[1]) or 0)
local isHere = tonumber(args[2])
if !ply:Alive() or !isnumber(isHere) or GLOBAL_chea[isHere]==nil or !IsValid(computer) or computer:GetClass()!="3p8_computer" then return end
if computer:GetPos():Distance(ply:GetPos())>200 then return end
local item = GLOBAL_chea[isHere]
if !isfunction(item.func) then return end
--mine
--if is there, use it, else, error
if(isHere != 0 && GLOBAL_chea[isHere].used == false) then
GLOBAL_chea[isHere].func(computer)
GLOBAL_chea[isHere].used = true
computer:EmitSound("ambient/levels/canals/headcrab_canister_ambient".. math.random(1,6) ..".wav")
elseif(isHere != 0 && GLOBAL_chea[isHere].inf == true) then
GLOBAL_chea[isHere].func(computer)
computer:EmitSound("ambient/levels/canals/headcrab_canister_ambient".. math.random(1,6) ..".wav")
else
print("Invalid Code.")
--make error sound
computer:EmitSound("ambient/machines/thumper_shutdown1.wav")
end
end)
else
function cheacode(ent)
local frame = vgui.Create("DFrame", nil, frame)
frame:SetPos( 5, 5 )
frame:SetSize( 300, 150 )
frame:SetTitle( "Name window" )
frame:SetVisible( true )
frame:SetDraggable( false )
frame:ShowCloseButton( true )
frame:MakePopup()
local code = nil
local NameEntry = vgui.Create( "DTextEntry", frame )
NameEntry:SetPos( 25, 50 )
NameEntry:SetSize( 360, 21 )
NameEntry:SetText( "Enter your Material Appearance Program (M.A.P.) Code" )
NameEntry.OnEnter = function( self )
code = self:GetValue()
print("You entered: "..code )
local isHere = 0
--loop through array once value is enter
for i=1,#GLOBAL_chea do
if (GLOBAL_chea[i].name.."" == code.."") then
isHere = i
end
end
--call the new console command, pass in isHere
RunConsoleCommand("3p8_code",ent:EntIndex(),isHere)
end
end
end
if SERVER then
function ENT:OnRemove()
--PRODUCE GIBS HERE
end
end
|
#!/bin/env luajit
dofile("load_dslib.lua")
local mmodules = dslib.mrequire("dslib:mmodules")
-- TODO
mmodules.exists("asd")
|
--- Compare
--- lua_f tst_utf8lib.lua
-- and
--- lua.exe tst_utf8lib.lua | nkf32
for i,c in utf8.codes("あいうえお") do
print(i,c,type(c),utf8.char(c))
end
for c in string.gmatch("あいうえお",utf8.charpattern) do
print(c)
end
|
--- timer.seconds(n) -> sec
--- Returns the number of seconds in seconds.
function timer.seconds(n) return n end
--- timer.minutes(n) -> sec
--- Returns the number of minutes in seconds.
function timer.minutes(n) return 60 * n end
--- timer.hours(n) -> sec
--- Returns the number of hours in seconds.
function timer.hours(n) return 60 * 60 * n end
--- timer.days(n) -> sec
--- Returns the number of days in seconds.
function timer.days(n) return 60 * 60 * 24 * n end
--- timer.weeks(n) -> sec
--- Returns the number of weeks in seconds.
function timer.weeks(n) return 60 * 60 * 24 * 7 * n end
|
position = {x = 48.6988410949707, y = 0.987667322158813, z = 15.5469074249268}
rotation = {x = -2.75089792012295E-06, y = 270.011779785156, z = 0.0016060828929767}
|
-- lua filter for RST-like list-tables in Markdown.
-- Copyright (C) 2021 Martin Fischer, released under MIT license
if PANDOC_VERSION and PANDOC_VERSION.must_be_at_least then
PANDOC_VERSION:must_be_at_least("2.11")
else
error("pandoc version >=2.11 is required")
end
-- Get the list of cells in a row.
local row_cells = function (row) return row.cells end
-- "Polyfill" for older pandoc versions.
if PANDOC_VERSION <= '2.16.2' then
-- previous pandoc versions used simple Attr/list pairs
pandoc.Row = function (cells) return {{}, cells} end
pandoc.TableHead = function (rows) return {{}, rows or {}} end
pandoc.TableFoot = function (rows) return {{}, rows or {}} end
pandoc.Cell = function (contents, align, rowspan, colspan, attr)
return {
attr = attr or pandoc.Attr(),
alignment = align or pandoc.AlignDefault,
contents = contents or {},
col_span = colspan or 1,
row_span = rowspan or 1
}
end
row_cells = function (row) return row[2] end
end
local alignments = {
d = 'AlignDefault',
l = 'AlignLeft',
r = 'AlignRight',
c = 'AlignCenter'
}
local function get_colspecs(div_attributes, column_count)
-- list of (align, width) pairs
local colspecs = {}
for i = 1, column_count do
table.insert(colspecs, {pandoc.AlignDefault, nil})
end
if div_attributes.aligns then
local i = 1
for a in div_attributes.aligns:gmatch('[^,]') do
assert(alignments[a] ~= nil,
"unknown column alignment " .. tostring(a))
colspecs[i][1] = alignments[a]
i = i + 1
end
div_attributes.aligns = nil
end
if div_attributes.widths then
local total = 0
local widths = {}
for w in div_attributes.widths:gmatch('[^,]') do
table.insert(widths, tonumber(w))
total = total + tonumber(w)
end
for i = 1, column_count do
colspecs[i][2] = widths[i] / total
end
div_attributes.widths = nil
end
return colspecs
end
local function new_table_body(rows, header_col_count)
return {
attr = {},
body = rows,
head = {},
row_head_columns = header_col_count
}
end
local function new_cell(contents)
local attr = {}
local colspan = 1
local rowspan = 1
local align = pandoc.AlignDefault
-- At the time of writing this Pandoc does not support attributes
-- on list items, so we use empty spans as a workaround.
if contents[1] and contents[1].content then
if contents[1].content[1] and contents[1].content[1].t == "Span" then
if #contents[1].content[1].content == 0 then
attr = contents[1].content[1].attr
table.remove(contents[1].content, 1)
colspan = attr.attributes.colspan or 1
attr.attributes.colspan = nil
rowspan = attr.attributes.rowspan or 1
attr.attributes.rowspan = nil
align = alignments[attr.attributes.align] or pandoc.AlignDefault
attr.attributes.align = nil
end
end
end
return pandoc.Cell(contents, align, rowspan, colspan, attr)
end
local function process(div)
if div.attr.classes[1] ~= "list-table" then return nil end
table.remove(div.attr.classes, 1)
local caption = {}
if div.content[1].t == "Para" then
local para = table.remove(div.content, 1)
caption = {pandoc.Plain(para.content)}
end
assert(div.content[1].t == "BulletList",
"expected bullet list, found " .. div.content[1].t)
local list = div.content[1]
local rows = {}
for i = 1, #list.content do
assert(#list.content[i] == 1, "expected item to contain only one block")
assert(list.content[i][1].t == "BulletList",
"expected bullet list, found " .. list.content[i][1].t)
local cells = {}
for _, cell_content in pairs(list.content[i][1].content) do
table.insert(cells, new_cell(cell_content))
end
local row = pandoc.Row(cells)
table.insert(rows, row)
end
local header_row_count = tonumber(div.attr.attributes['header-rows']) or 1
div.attr.attributes['header-rows'] = nil
local header_col_count = tonumber(div.attr.attributes['header-cols']) or 0
div.attr.attributes['header-cols'] = nil
local column_count = 0
for i = 1, #row_cells(rows[1] or {}) do
column_count = column_count + row_cells(rows[1])[i].col_span
end
local colspecs = get_colspecs(div.attr.attributes, column_count)
local thead_rows = {}
for i = 1, header_row_count do
table.insert(thead_rows, table.remove(rows, 1))
end
return pandoc.Table(
{long = caption, short = {}},
colspecs,
pandoc.TableHead(thead_rows),
{new_table_body(rows, header_col_count)},
pandoc.TableFoot(),
div.attr
)
end
return {{Div = process}}
|
---------------------------------------------------------------------------------------------------
-- Proposal: https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0216-widget-support.md
--
-- Description: Check "OnHMIStatus" notifications for 1 app in case of changes of widget's level
--
-- Precondition:
-- 1) SDL and HMI are started
-- 2) "CreateWindow" is allowed by policies
-- 3) App is registered
-- 4) App creates 2 widgets
-- 5) Both widgets are activated on the HMI and has FULL level
-- Step:
-- 1) 1st widget became invisible on HMI (FULL->BACKGROUND)
-- SDL does:
-- - send one OnHMIStatus notification for 1st widget window to app
-- - not send OnHMIStatus notifications for the main and 2nd widget windows to app
-- 2) 2nd widget removed from a list on HMI (FULL->NONE)
-- SDL does:
-- - send two OnHMIStatus notifications for the 2nd widget window to app
-- - not send OnHMIStatus notifications for the main and 1st widget windows to app
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local common = require('test_scripts/WidgetSupport/common')
--[[ Local Variables ]]
local params = {
[1] = {
windowID = 1, windowName = "Name1", type = "WIDGET"
},
[2] = {
windowID = 2, windowName = "Name2", type = "WIDGET"
}
}
--[[ Scenario ]]
common.Title("Precondition")
common.Step("Clean environment and Back-up/update PPT", common.precondition)
common.Step("Start SDL, HMI", common.start)
common.Step("App registration", common.registerAppWOPTU)
common.Step("App create the 1st widget", common.createWindow, { params[1] })
common.Step("App create the 2nd widget", common.createWindow, { params[2] })
common.Step("1st widget is activated in the HMI", common.activateWidgetFromNoneToFULL, { params[1].windowID })
common.Step("2nd widget is activated in the HMI", common.activateWidgetFromNoneToFULL, { params[2].windowID })
common.Title("Test")
common.Step("1st widget is deactivated from FULL to BACKGROUND",
common.deactivateWidgetFromFullToBackground, { params[1].windowID })
common.Step("2nd widget is deactivated from FULL to NONE",
common.deactivateWidgetFromFullToNone, { params[2].windowID })
common.Title("Postconditions")
common.Step("Stop SDL, restore SDL settings and PPT", common.postcondition)
|
t = require('ds18b20')
port = 80
pin = 3 -- gpio0 = 3, gpio2 = 4
gconn = {} -- global variable for connection
function readout(temp)
local resp = "HTTP/1.1 200 OK\nContent-Type: text/html\nRefresh: 5\n\n" ..
"<!DOCTYPE HTML>" ..
"<html><body>" ..
"<b>ESP8266</b></br>"
for addr, temp in pairs(temp) do
-- resp = resp .. string.format("Sensor %s: %s ℃</br>", addr, temp)
resp = resp .. string.format("Sensor %s: %s ℃</br>", encoder.toHex(addr), temp) -- readable address with base64 encoding is preferred when encoder module is available
end
resp = resp ..
"Node ChipID: " .. node.chipid() .. "<br>" ..
"Node MAC: " .. wifi.sta.getmac() .. "<br>" ..
"Node Heap: " .. node.heap() .. "<br>" ..
"Timer Ticks: " .. tmr.now() .. "<br>" ..
"</html></body>"
gconn:send(resp)
gconn:on("sent",function(conn) conn:close() end)
end
srv=net.createServer(net.TCP)
srv:listen(port,
function(conn)
gconn = conn
-- t:readTemp(readout) -- default pin value is 3
t:readTemp(readout, pin)
end
)
|
--------------------------------------------------------------------------------
-- ViewCollection
--------------------------------------------------------------------------------
IMPORT(Script.CLASS)
IMPORT(Script.VIEWOBJECT)
--------------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------------
ViewObjectCollection = class(function(viewCollection)
ViewObjectCollection:init()
end)
--------------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------------
function ViewObjectCollection:init()
self.views = {}
self.indexedViews = {}
end
--------------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------------
function ViewObjectCollection:addView(key, viewObject)
if (self.views[key] ~= nil and self.views[key] ~= viewObject) then
PRINT("WARNING: ViewObjectCollection.addView key: ' .. key .. ' contained an object that was overridden.'")
end
self.views[key] == viewObject
table.insert(self.indexedViews, self.views[key])
end
--------------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------------
function ViewObjectCollection:removeView(key)
local view = self:getView(key)
if (type(key) == 'string') then
table.remove(self.indexedViews, self:indexOf(key))
self.views[key] = nil
elseif (type(key) == 'number') then
table.remove(self.indexedViews, key)
key = self:getKey(view)
self.views[key] = nil
end
return view
end
--------------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------------
function ViewObjectCollection:contains(key)
if (self.views[key] ~= nil) then return true end
return false
end
--------------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------------
function ViewObjectCollection:getView(key)
if (type(key) == 'string') then return self.views[key] end
if (type(key) == 'number') then return self.indexedViews[key] end
return nil
end
--------------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------------
function ViewObjectCollection:getKey(viewObject)
for k, v in pairs(self.views) do
if (v == viewObject) then return k end
end
return nil
end
--------------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------------
function ViewObjectCollection:indexOf(search)
if (type(search) == 'string') then
search = self.views[search]
end
for i, v in ipairs(self.indexedViews) do
if (v == search) then return i end
end
return 0
end
--------------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------------
function ViewObjectCollection:clear()
for k, v, in pairs(self.views) do
v:destroy()
end
self.views = {}
self.indexedViews = {}
end
--------------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------------
function ViewObjectCollection:destroy()
self:clear()
end
|
-- Formatting
local formatters = require "lvim.lsp.null-ls.formatters"
formatters.setup {
{
exe = "goimports",
-- args = {},
filetypes = { "go" },
},
}
-- Linting
local linters = require "lvim.lsp.null-ls.linters"
linters.setup {}
-- Debugging
if lvim.builtin.dap.active then
local dap_install = require "dap-install"
dap_install.config("go_delve", {})
end
-- Lsp config
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "gopls" })
local opts = {
settings = {
gopls = {
gofumpt = true, -- A stricter gofmt
codelenses = {
gc_details = true, -- Toggle the calculation of gc annotations
generate = true, -- Runs go generate for a given directory
regenerate_cgo = true, -- Regenerates cgo definitions
test = true,
tidy = true, -- Runs go mod tidy for a module
upgrade_dependency = true, -- Upgrades a dependency in the go.mod file for a module
vendor = true, -- Runs go mod vendor for a module
},
diagnosticsDelay = "500ms",
experimentalWatchedFileDelay = "100ms",
symbolMatcher = "fuzzy",
completeUnimported = true,
staticcheck = true,
matcher = "Fuzzy",
usePlaceholders = true, -- enables placeholders for function parameters or struct fields in completion responses
analyses = {
fieldalignment = true, -- find structs that would use less memory if their fields were sorted
nilness = true, -- check for redundant or impossible nil comparisons
shadow = true, -- check for possible unintended shadowing of variables
unusedparams = true, -- check for unused parameters of functions
unusedwrite = true, -- checks for unused writes, an instances of writes to struct fields and arrays that are never read
},
},
},
}
require("lvim.lsp.manager").setup("gopls", opts)
-- Additional mappings
lvim.lsp.buffer_mappings.normal_mode["gB"] = {
name = "Build helpers",
b = {
"<cmd>lua require('lvim.core.terminal')._exec_toggle({cmd='go build .;read',count=2,direction='horizontal'})<cr>",
"Run go build",
},
v = {
"<cmd>lua require('lvim.core.terminal')._exec_toggle({cmd='go vet .;read',count=2,direction='horizontal'})<cr>",
"Run go vet",
},
t = {
"<cmd>lua require('lvim.core.terminal')._exec_toggle({cmd='go test .;read',count=2,direction='horizontal'})<cr>",
"Run go test",
},
r = {
"<cmd>lua require('lvim.core.terminal')._exec_toggle({cmd='go run .;read',count=2,direction='horizontal'})<cr>",
"Run go run",
},
}
|
print("*************************LUA调用C# 泛型函数相关知识点*************************")
local obj = CS.Lesson12()
local child = CS.Lesson12.TestChild()
local father = CS.Lesson12.TestFather()
--支持有约束有参数的泛型参数
obj:TestFun1(child,father)
obj:TestFun1(father,child)
--Lua中不支持 没有约束的泛型参数
--obj:TestFun2(child)
--Lua中不支持 有约束但是没有参数的泛型函数
--obj:TestFun3()
--Lua中不支持 非Class的约束
--obj:TestFun4(child)
--有一定的使用限制
--如果使用的是Mono打包,则可以使用
--如果使用iL2cpp打包 如果泛型参数是引用类型才可以使用
--如果使用iL2cpp打包 如果泛型参数是值类型 除非C#那边已经调用过了 同类型的泛型参数 lua中才能够被使用
--补充知识 让上面 不支持使用的泛型参数 变得能用
--得到通用函数
--设置泛型类型再使用
--xlua.get_generic_method(类,"函数名")
local testFun2 = xlua.get_generic_method(CS.Lesson12,"TestFun2")
--声明了指定类型的泛型参数
local testFun2_R = testFun2(CS.System.Int32)
--调用
--成员方法 第一个参数调用函数对象 静态方法不用传自己
testFun2_R(obj,1)
|
-- LOCAL
local main = require(game.Nanoblox)
local Qualifiers = {}
local function isNonadmin(user)
local totalNonadmins = 0
local totalRoles = 0
for roleUID, roleDetails in pairs(user.roles) do
local role = main.services.RoleService.getRoleByUID(roleUID)
if role.nonadmin == true then
totalNonadmins = totalNonadmins + 1
end
totalRoles = totalRoles + 1
end
end
-- ARRAY
Qualifiers.array = {
-----------------------------------
{
name = "users",
aliases = {"user"},
hidden = true,
multi = false,
description = "Default action, returns players with matching shorthand names.",
getTargets = function(caller, shorthandString)
local targets = {}
for i, plr in pairs(main.Players:GetPlayers()) do
local plrName = string.lower(plr.Name)
if string.sub(plrName, 1, #shorthandString) == shorthandString then
table.insert(targets, plr)
end
end
--!!! IF CALLER HAS MULTI DISABLED, ONLY RETURN 1
return targets
end,
};
-----------------------------------
{
name = "me",
aliases = {"you"},
multi = false,
description = "You!",
getTargets = function(caller)
return {caller.player}
end,
};
-----------------------------------
{
name = "all",
aliases = {"everyone"},
multi = true,
description = "Every player in a server.",
getTargets = function(caller)
return main.Players:GetPlayers()
end,
};
-----------------------------------
{
name = "random",
aliases = {},
multi = false,
description = "One randomly selected player from a pool. To define a pool, do ``random(qualifier1,qualifier2,...)``. If not defined, the pool defaults to 'all'.",
getTargets = function(caller, ...)
local subQualifiers = table.pack(...)
if #subQualifiers == 0 then
table.insert(subQualifiers, "all")
end
local pool = {}
for _, subQualifier in pairs(subQualifiers) do
local subPool = ((Qualifiers.dictionary[subQualifier] or Qualifiers.defaultQualifier).getTargets(caller)) or {}
for _, plr in pairs(subPool) do
table.insert(pool, plr)
end
end
local targets = {pool[math.random(1, #pool)]}
return targets
end,
};
-----------------------------------
{
name = "others",
aliases = {},
multi = true,
description = "Every player in a server except you.",
getTargets = function(caller)
local targets = {}
for _, plr in pairs(main.Players:GetPlayers()) do
if plr.Name ~= caller.name then
table.insert(targets, plr)
end
end
return targets
end,
};
-----------------------------------
{
name = "radius",
aliases = {},
multi = true,
description = "Players within x amount of studs from you. To specify studs, do ``radius(studs)``. If not defined, studs defaults to '10'.",
getTargets = function(caller, radiusString)
local targets = {}
local radius = tonumber(radiusString) or 10
local callerHeadPos = main.modules.PlayerUtil.getHeadPos(caller.player) or Vector3.new(0, 0, 0)
for _, plr in pairs(main.Players:GetPlayers()) do
if plr:DistanceFromCharacter(callerHeadPos) <= radius then
table.insert(targets, plr)
end
end
return targets
end,
};
-----------------------------------
{
name = "team",
aliases = {"teams", "$"},
multi = true,
description = "Players within the specified team(s).",
getTargets = function(caller, ...)
local targets = {}
local teamNames = table.pack(...)
local selectedTeams = {}
local validTeams = false
if #teamNames == 0 then return {} end
for _,team in pairs(main.Teams:GetChildren()) do
local teamName = string.lower(team.Name)
for _, selectedTeamName in pairs(teamNames) do
if string.sub(teamName, 1, #selectedTeamName) == selectedTeamName then
selectedTeams[tostring(team.TeamColor)] = true
validTeams = true
end
end
end
if not validTeams then return {} end
for i, plr in pairs(main.Players:GetPlayers()) do
if selectedTeams[tostring(plr.TeamColor)] then
table.insert(targets, plr)
end
end
return targets
end,
};
-----------------------------------
{
name = "role",
aliases = {"roles", "@"},
multi = true,
description = "Players who have the specified role(s).",
getTargets = function(caller, ...)
local targets = {}
local roleNames = table.pack(...)
local selectedRoleUIDs = {}
if #roleNames == 0 then return {} end
for _, role in pairs(main.services.RoleService.getRoles()) do
local roleName = string.lower(role.name)
local roleUID = role.UID
for _, selectedRoleName in pairs(roleNames) do
if string.sub(roleName, 1, #selectedRoleName) == selectedRoleName or roleUID == selectedRoleName then
table.insert(selectedRoleUIDs, roleUID)
end
end
end
if #selectedRoleUIDs == 0 then return {} end
for i, user in pairs(main.modules.PlayerStore:getUsers()) do
local function isValidUser()
for _, roleUID in pairs(selectedRoleUIDs) do
if user.roles[roleUID] then
return true
end
end
return false
end
if isValidUser() then
table.insert(targets, user.player)
end
end
return targets
end,
};
-----------------------------------
{
name = "percent",
aliases = {"percentage", "%"},
multi = true,
description = "Randomly selects x percent of players within a server. To define the percentage, do ``percent(number)``. If not defined, the percent defaults to '50'.",
getTargets = function(caller, percentString)
local targets = {}
local maxPercent = tonumber(percentString) or 50
local players = main.Players:GetPlayers()
local interval = 100/#players
if maxPercent >= (100-(interval*0.1)) then
return players
end
local selectedPercent = 0
repeat
local randomIndex = math.random(1, #players)
local selectedPlayer = players[randomIndex]
table.insert(targets, selectedPlayer)
table.remove(players, randomIndex)
until #players == 0 or selectedPercent >= maxPercent
return targets
end,
};
-----------------------------------
{
name = "admins",
aliases = {},
multi = true,
description = "Selects all admins",
getTargets = function(caller)
local targets = {}
for i, user in pairs(main.modules.PlayerStore:getUsers()) do
if not isNonadmin(user) then
table.insert(targets, user.player)
end
end
return targets
end,
};
-----------------------------------
{
name = "nonadmins",
aliases = {},
multi = true,
description = "Selects all nonadmins",
getTargets = function(caller)
local targets = {}
for i, user in pairs(main.modules.PlayerStore:getUsers()) do
if isNonadmin(user) then
table.insert(targets, user.player)
end
end
return targets
end,
};
-----------------------------------
{
name = "premium",
aliases = {"prem"},
multi = true,
description = "Players with Roblox Premium membership",
getTargets = function(caller)
local targets = {}
for _, plr in pairs(main.Players:GetPlayers()) do
if plr.MembershipType == Enum.MembershipType.Premium then
table.insert(targets, plr)
end
end
return targets
end,
};
-----------------------------------
{
name = "friends",
aliases = {},
multi = true,
description = "Players you are friends with",
getTargets = function(caller)
local targets = {}
for _, plr in pairs(main.Players:GetPlayers()) do
if caller.player:IsFriendsWith(plr.UserId) then
table.insert(targets, plr)
end
end
return targets
end,
};
-----------------------------------
{
name = "nonfriends",
aliases = {},
multi = true,
description = "Players you are not friends with",
getTargets = function(caller)
local targets = {}
for _, plr in pairs(main.Players:GetPlayers()) do
if not caller.player:IsFriendsWith(plr.UserId) and caller.player ~= plr.UserId then
table.insert(targets, plr)
end
end
return targets
end,
};
-----------------------------------
{
name = "r6",
aliases = {},
multi = true,
description = "Players with an R6 character rig",
getTargets = function(caller)
local targets = {}
for _, plr in pairs(main.Players:GetPlayers()) do
local humanoid = main.modules.PlayerUtil.getHumanoid(plr)
if humanoid and humanoid.RigType == Enum.HumanoidRigType.R6 then
table.insert(targets, plr)
end
end
return targets
end,
};
-----------------------------------
{
name = "r15",
aliases = {},
multi = true,
description = "Players with an R15 character rig",
getTargets = function(caller)
local targets = {}
for _, plr in pairs(main.Players:GetPlayers()) do
local humanoid = main.modules.PlayerUtil.getHumanoid(plr)
if humanoid and humanoid.RigType == Enum.HumanoidRigType.R15 then
table.insert(targets, plr)
end
end
return targets
end,
};
-----------------------------------
{
name = "rthro",
aliases = {},
multi = true,
description = "Players with a Body Type value greater than or equal to 90%",
getTargets = function(caller)
local targets = {}
for _, plr in pairs(main.Players:GetPlayers()) do
local humanoid = main.modules.PlayerUtil.getHumanoid(plr)
local bts = humanoid and humanoid:FindFirstChild("BodyTypeScale")
if bts and bts.Value >= 0.9 then
table.insert(targets, plr)
end
end
return targets
end,
};
-----------------------------------
{
name = "nonrthro",
aliases = {},
multi = true,
description = "Players with a Body Type value less than 90%",
getTargets = function(caller)
local targets = {}
for _, plr in pairs(main.Players:GetPlayers()) do
local humanoid = main.modules.PlayerUtil.getHumanoid(plr)
local bts = humanoid and humanoid:FindFirstChild("BodyTypeScale")
if not bts or bts.Value < 0.9 then
table.insert(targets, plr)
end
end
return targets
end,
};
-----------------------------------
};
-- DICTIONARY
-- This means instead of scanning through the array to find a name match
-- you can simply do ``Qualifiers.dictionary.QUALIFIER_NAME`` to return its item
Qualifiers.dictionary = {}
for _, item in pairs(Qualifiers.array) do
Qualifiers.dictionary[item.name] = item
for _, alias in pairs(item.aliases) do
Qualifiers.dictionary[alias] = item
end
end
-- OTHER
Qualifiers.defaultQualifier = Qualifiers.dictionary["user"]
return Qualifiers
|
--[[
Custom component functions for lightline. Mainly LSP/diagnostics related.
--]]
local au = require("au")
local comps = {
opts = {
signs = {
edit = "+",
lock = "-",
git = "↨",
error = "‼",
warning = "!",
filetype = "≡",
spinner = {"-", "\\", "|", "/"}
},
narrow_width = 95,
},
spinner = {
index = 1,
timer = vim.loop.new_timer(),
status = ""
},
string = {},
narrow = {
string = {}
}
}
function comps.get_sign(name)
local sign = comps.opts.signs[name]
return type(sign) == "function" and sign() or sign
end
-- check if the terminal is narrow, can be used to hide components based on
-- window width through components.narrow.* methods
function comps.is_narrow()
return vim.fn.winwidth(0) < comps.opts.narrow_width
end
-- filename in the same format as lightline-bufferline
function comps.filename()
local filename = vim.fn.expand("%:t", false, true)[1] or "*"
local editable = vim.o.modifiable and not vim.o.readonly
local suffix = editable and (vim.o.modified and " " .. comps.get_sign("edit") or "") or " " .. comps.get_sign("lock")
return comps.get_sign("filetype") .. " " .. filename .. suffix
end
-- current git branch
function comps.gitbranch()
return vim.b.gitsigns_head and comps.get_sign("git") .. " " .. vim.b.gitsigns_head or ""
end
-- lsp progress indicator
function comps.progress()
if comps.spinner.timer:get_due_in() == 0 then
local message = vim.lsp.util.get_progress_messages()[1]
if message then
comps.spinner.timer:start(75, 0, vim.schedule_wrap(function()
comps.spinner.index = comps.spinner.index % #comps.get_sign("spinner") + 1
vim.fn['lightline#update']()
end))
local title = vim.tbl_contains({"", "empty title"}, message.title) and "Loading" or message.title
comps.spinner.status = comps.get_sign("spinner")[comps.spinner.index] .. " " .. title
else
comps.spinner.status = ""
end
end
return comps.spinner.status
end
-- error diagnostics
function comps.errors()
local errors = #vim.diagnostic.get(0, {severity=vim.diagnostic.severity.ERROR})
return errors > 0 and comps.get_sign("error") .. " " .. errors or ""
end
-- warning diagnostics
function comps.warnings()
local warnings = #vim.diagnostic.get(0, {severity=vim.diagnostic.severity.WARN})
return warnings > 0 and comps.get_sign("warning") .. " " .. warnings or ""
end
function comps.setup(opts)
comps.opts = vim.tbl_extend("force", comps.opts, opts or {})
-- components.string.* and components.narrow.string.* returns string
-- representations of components.* and components.narrow.* methods in a
-- format that is callable by viml
for _, components in ipairs{comps, comps.narrow} do
setmetatable(components.string, {
__index = function(table, key)
if components[key] and type(components[key]) == "function" then
vim.g["_lightline_" .. key] = components[key]
table[key] = "g:_lightline_" .. key
return table[key]
end
end
})
end
-- components.narrow.* returns wrappers around components.* methods which
-- auto hide components in narrow terminal windows
setmetatable(comps.narrow, {
__index = function(table, key)
if comps[key] then
table[key] = function() return comps.is_narrow() and "" or comps[key]() end
return table[key]
end
end
})
-- update lsp diagnostics information inside lightline
local lightline_diagnostics = au("lightline_diagnostics")
function lightline_diagnostics.DiagnosticChanged()
vim.fn["lightline#update"]()
end
function lightline_diagnostics.User(args)
if args.match == "LspProgressUpdate" then
vim.fn["lightline#update"]()
end
end
end
return comps
|
-- Tests for bfs.lua
local BFS = require 'bfs'
local total, pass = 0, 0
local function dec(str, len)
return #str < len
and str .. (('.'):rep(len-#str))
or str:sub(1,len)
end
local function same(t, p, comp)
for k,v in ipairs(t) do
if not comp(v, p[k]) then return false end
end
return true
end
local function run(message, f)
total = total + 1
local ok, err = pcall(f)
if ok then pass = pass + 1 end
local status = ok and 'PASSED' or 'FAILED'
print(('%02d. %68s: %s'):format(total, dec(message,68), status))
end
run('Testing linear graph', function()
local comp = function(a, b) return a.value == b end
local ln_handler = require 'linear_handler'
ln_handler.init(-2,5)
local bfs = BFS(ln_handler)
local start, goal = ln_handler.getNode(0), ln_handler.getNode(5)
assert(same(bfs:findPath(start, goal), {0,1,2,3,4,5}, comp))
start, goal = ln_handler.getNode(-2), ln_handler.getNode(2)
assert(same(bfs:findPath(start, goal), {-2,-1,0,1,2}, comp))
end)
run('Testing grid graph', function()
local comp = function(a, b) return a.x == b[1] and a.y == b[2] end
local gm_handler = require 'gridmap_handler'
local bfs = BFS(gm_handler)
local map = {{0,0,0,0,0},{0,1,1,1,1},{0,0,0,0,0}}
gm_handler.init(map)
gm_handler.diagonal = false
local start, goal = gm_handler.getNode(1,1), gm_handler.getNode(5,3)
assert(same(bfs:findPath(start, goal), {{1,1},{1,2},{1,3},{2,3},{3,3},{4,3},{5,3}}, comp))
gm_handler.diagonal = true
assert(same(bfs:findPath(start, goal), {{1,1},{1,2},{2,3},{3,3},{4,3},{5,3}}, comp))
end)
run('Testing point graph', function()
local comp = function(a, b) return a.x == b[1] and a.y == b[2] end
local pg_handler = require 'point_graph_handler'
local bfs = BFS(pg_handler)
pg_handler.addNode('a')
pg_handler.addNode('b')
pg_handler.addNode('c')
pg_handler.addNode('d')
pg_handler.addEdge('a', 'b')
pg_handler.addEdge('a', 'c')
pg_handler.addEdge('b', 'd')
local comp = function(a, b) return a.name == b end
local start, goal = pg_handler.getNode('a'), pg_handler.getNode('d')
assert(same(bfs:findPath(start, goal), {'a','b','d'}, comp))
end)
print(('-'):rep(80))
print(('Total : %02d: Pass: %02d - Failed : %02d - Success: %.2f %%')
:format(total, pass, total-pass, (pass*100/total)))
|
--[[
unknown_buyer mod for Minetest
Copyright (C) 2018 Farooq Karimi Zadeh <farooghkarimizadeh at gmail dot com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--]]
local bonus_items = { --[[ each element is {Itemstack, chance} --]]
{ItemStack("default:stone 99"), .5},
{ItemStack("default:mese"), .01},
{ItemStack("default:apple 10"), .3},
{ItemStack("default:obsidian 10"), .9},
{ItemStack("default:dirt 1"), .1}
}
minetest.register_node("unknown_buyer:unknown_buyer",{
description = "Unknown Item Buyer",
tiles = {
"unknown_buyer_chest_top.png",
"unknown_buyer_chest_top.png",
"unknown_buyer_chest_side.png",
"unknown_buyer_chest_side.png",
"unknown_buyer_chest_side.png",
"unknown_buyer_chest_front.png",
},
groups = {cracky = 3},
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local player_name = clicker:get_player_name()
if itemstack:is_known() and itemstack:get_name() ~= "unknown" then
return
end
if itemstack:get_count() < 10 then
minetest.chat_send_player(player_name, "You should have at least 10 of an unknown item.")
return
end
local spawn_pos = {x = pos.x, y = pos.y, z = pos.z -1}
local r = math.random()
local t = 0
local random_item
for _, item in ipairs(bonus_items) do
local t_ = item[2]
if r >= t and r < (t_+t) then
random_item = item[1]
break
end
t = t + t_
end
minetest.spawn_item(spawn_pos, random_item)
itemstack:set_count(itemstack:get_count() - 10)
return itemstack
end
})
|
-- Simple helper function that provides model if it doesnt exist
local function registerSent(class, data)
list.Set("starfall_creatable_sent", class, data)
end
----------------------------------------
-- Sent registering
local checkluatype = SF.CheckLuaType
-- Basic Gmod sents
registerSent("gmod_balloon", {{
["Model"] = {TYPE_STRING, "models/maxofs2d/balloon_classic.mdl"},
["force"] = {TYPE_NUMBER},
["r"] = {TYPE_NUMBER, 255},
["g"] = {TYPE_NUMBER, 255},
["b"] = {TYPE_NUMBER, 255},
}})
registerSent("gmod_button", {{
["Model"] = {TYPE_STRING, "models/maxofs2d/button_05.mdl"},
["description"] = {TYPE_STRING, ""},
["key"] = {TYPE_NUMBER},
["toggle"] = {TYPE_BOOL, true},
}})
registerSent("gmod_cameraprop", {{
["Model"] = {TYPE_STRING, "models/dav0r/camera.mdl"},
["controlkey"] = {TYPE_NUMBER},
["locked"] = {TYPE_BOOL, false},
["toggle"] = {TYPE_BOOL, true},
}})
registerSent("gmod_dynamite", {{
["Model"] = {TYPE_STRING, "models/dav0r/tnt/tnt.mdl"},
["key"] = {TYPE_NUMBER},
["Damage"] = {TYPE_NUMBER, 200},
["delay"] = {TYPE_NUMBER, 0},
["remove"] = {TYPE_BOOL, false},
}})
registerSent("gmod_emitter", {{
["Model"] = {TYPE_STRING, "models/props_lab/tpplug.mdl"},
["effect"] = {TYPE_STRING},
["key"] = {TYPE_NUMBER},
["delay"] = {TYPE_NUMBER, 0},
["scale"] = {TYPE_NUMBER, 1},
["toggle"] = {TYPE_BOOL, true},
["starton"] = {TYPE_BOOL, false},
}})
registerSent("gmod_hoverball", {{
["Model"] = {TYPE_STRING, "models/dav0r/hoverball.mdl"},
["key_u"] = {TYPE_NUMBER, -1},
["key_d"] = {TYPE_NUMBER, -1},
["speed"] = {TYPE_NUMBER, 1},
["resistance"] = {TYPE_NUMBER, 0},
["strength"] = {TYPE_NUMBER, 1},
}})
registerSent("gmod_lamp", {{
["Model"] = {TYPE_STRING, "models/lamps/torch.mdl"},
["Texture"] = {TYPE_STRING, "effects/flashlight001"},
["KeyDown"] = {TYPE_NUMBER, -1},
["fov"] = {TYPE_NUMBER, 90},
["distance"] = {TYPE_NUMBER, 1024},
["brightness"] = {TYPE_NUMBER, 4},
["toggle"] = {TYPE_BOOL, true},
["on"] = {TYPE_BOOL, false},
["r"] = {TYPE_NUMBER, 255},
["g"] = {TYPE_NUMBER, 255},
["b"] = {TYPE_NUMBER, 255},
}})
registerSent("gmod_light", {{
["Model"] = {TYPE_STRING, "models/maxofs2d/light_tubular.mdl"},
["KeyDown"] = {TYPE_NUMBER, -1},
["Size"] = {TYPE_NUMBER, 256},
["Brightness"] = {TYPE_NUMBER, 2},
["toggle"] = {TYPE_BOOL, true},
["on"] = {TYPE_BOOL, false},
["lightr"] = {TYPE_NUMBER, 255},
["lightg"] = {TYPE_NUMBER, 255},
["lightb"] = {TYPE_NUMBER, 255},
}})
registerSent("gmod_thruster", {{
["Model"] = {TYPE_STRING, "models/props_phx2/garbage_metalcan001a.mdl"},
["effect"] = {TYPE_STRING, "fire"},
["soundname"] = {TYPE_STRING, "PhysicsCannister.ThrusterLoop"},
["key"] = {TYPE_NUMBER, -1},
["key_bck"] = {TYPE_NUMBER, -1},
["force"] = {TYPE_NUMBER, 1500},
["toggle"] = {TYPE_BOOL, false},
["damageable"] = {TYPE_BOOL, false},
}})
----------------------------------------
-- Wiremod
-- Timer so that we are sure to check after wiremod initialized, if wire has a hook.run / call when it initialized change this
timer.Simple(0, function()
if WireLib then
registerSent("gmod_wire_spawner", {{
["Model"] = {TYPE_STRING},
["delay"] = {TYPE_NUMBER, 0},
["undo_delay"] = {TYPE_NUMBER, 0},
["spawn_effect"] = {TYPE_NUMBER, 0},
["mat"] = {TYPE_STRING, ""},
["skin"] = {TYPE_NUMBER, 0},
["r"] = {TYPE_NUMBER, 255},
["g"] = {TYPE_NUMBER, 255},
["b"] = {TYPE_NUMBER, 255},
["a"] = {TYPE_NUMBER, 255},
}})
registerSent("gmod_wire_emarker", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
}})
registerSent("gmod_wire_forcer", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["Force"] = {TYPE_NUMBER, 1},
["Length"] = {TYPE_NUMBER, 100},
["ShowBeam"] = {TYPE_BOOL, true},
["Reaction"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_adv_input", {{
["Model"] = {TYPE_STRING, "models/beer/wiremod/numpad.mdl"},
["keymore"] = {TYPE_NUMBER, 3},
["keyless"] = {TYPE_NUMBER, 1},
["toggle"] = {TYPE_BOOL, false},
["value_min"] = {TYPE_NUMBER, 0},
["value_max"] = {TYPE_NUMBER, 10},
["value_start"] = {TYPE_NUMBER, 5},
["speed"] = {TYPE_NUMBER, 1},
}})
registerSent("gmod_wire_oscilloscope", {{
["Model"] = {TYPE_STRING, "models/props_lab/monitor01b.mdl"},
}})
registerSent("gmod_wire_dhdd", {{
["Model"] = {TYPE_STRING},
}})
registerSent("gmod_wire_friendslist", {{
["Model"] = {TYPE_STRING, "models/kobilica/value.mdl"},
["save_on_entity"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_nailer", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["Flim"] = {TYPE_NUMBER, 0},
["Range"] = {TYPE_NUMBER, 100},
["ShowBeam"] = {TYPE_BOOL, true},
}})
registerSent("gmod_wire_grabber", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_range.mdl"},
["Range"] = {TYPE_NUMBER, 100},
["Gravity"] = {TYPE_BOOL, true},
}})
registerSent("gmod_wire_weight", {{
["Model"] = {TYPE_STRING, "models/props_interiors/pot01a.mdl"},
}})
registerSent("gmod_wire_exit_point", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_range.mdl"},
}})
registerSent("gmod_wire_latch", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
}})
registerSent("gmod_wire_dataport", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_gate.mdl"},
}})
registerSent("gmod_wire_colorer", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["outColor"] = {TYPE_BOOL, false},
["Range"] = {TYPE_NUMBER, 2000},
}})
registerSent("gmod_wire_addressbus", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_gate.mdl"},
["Mem1st"] = {TYPE_NUMBER, 0},
["Mem2st"] = {TYPE_NUMBER, 0},
["Mem3st"] = {TYPE_NUMBER, 0},
["Mem4st"] = {TYPE_NUMBER, 0},
["Mem1sz"] = {TYPE_NUMBER, 0},
["Mem2sz"] = {TYPE_NUMBER, 0},
["Mem3sz"] = {TYPE_NUMBER, 0},
["Mem4sz"] = {TYPE_NUMBER, 0},
}})
registerSent("gmod_wire_cd_disk", {{
["Model"] = {TYPE_STRING, "models/venompapa/wirecd_medium.mdl"},
["Precision"] = {TYPE_NUMBER, 4},
["IRadius"] = {TYPE_NUMBER, 10},
["Skin"] = {TYPE_NUMBER, 0},
}})
registerSent("gmod_wire_las_receiver", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_range.mdl"},
}})
registerSent("gmod_wire_lever", {{
["Min"] = {TYPE_NUMBER, 0},
["Max"] = {TYPE_NUMBER, 1},
}})
registerSent("gmod_wire_waypoint", {{
["Model"] = {TYPE_STRING, "models/props_lab/powerbox02d.mdl"},
["range"] = {TYPE_NUMBER, 150},
}})
registerSent("gmod_wire_vehicle", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
}})
registerSent("gmod_wire_vectorthruster", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_speed.mdl"},
["force"] = {TYPE_NUMBER, 1500},
["force_min"] = {TYPE_NUMBER, 0},
["force_max"] = {TYPE_NUMBER, 10000},
["oweffect"] = {TYPE_STRING, "fire"},
["uweffect"] = {TYPE_STRING, "same"},
["owater"] = {TYPE_BOOL, true},
["uwater"] = {TYPE_BOOL, true},
["bidir"] = {TYPE_BOOL, true},
["soundname"] = {TYPE_STRING, ""},
["mode"] = {TYPE_NUMBER, 0},
["angleinputs"] = {TYPE_BOOL, false},
["lengthismul"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_user", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["Range"] = {TYPE_NUMBER, 200},
}})
registerSent("gmod_wire_twoway_radio", {{
["Model"] = {TYPE_STRING, "models/props_lab/binderblue.mdl"},
}})
registerSent("gmod_wire_numpad", {{
["Model"] = {TYPE_STRING, "models/beer/wiremod/numpad.mdl"},
["toggle"] = {TYPE_BOOL, false},
["value_off"] = {TYPE_NUMBER, 0},
["value_on"] = {TYPE_NUMBER, 0},
}})
registerSent("gmod_wire_turret", {{
["Model"] = {TYPE_STRING, "models/weapons/w_smg1.mdl"},
["delay"] = {TYPE_NUMBER, 0.05},
["damage"] = {TYPE_NUMBER, 10},
["force"] = {TYPE_NUMBER, 1},
["sound"] = {TYPE_STRING, "0"},
["numbullets"] = {TYPE_NUMBER, 1},
["spread"] = {TYPE_NUMBER, 0},
["tracer"] = {TYPE_STRING, "Tracer"},
["tracernum"] = {TYPE_NUMBER, 1},
}})
registerSent("gmod_wire_soundemitter", {{
["Model"] = {TYPE_STRING, "models/cheeze/wires/speaker.mdl"},
["sound"] = {TYPE_STRING, "synth/square.wav"},
}})
registerSent("gmod_wire_textscreen", {{
["Model"] = {TYPE_STRING, "models/kobilica/wiremonitorbig.mdl"},
["text"] = {TYPE_STRING, ""},
["chrPerLine"] = {TYPE_NUMBER, 6},
["textJust"] = {TYPE_NUMBER, 1},
["valign"] = {TYPE_NUMBER, 0},
["tfont"] = {TYPE_STRING, "Arial"},
["fgcolor"] = {TYPE_COLOR, Color(255, 255, 255)},
["bgcolor"] = {TYPE_COLOR, Color(0, 0, 0)},
}})
registerSent("gmod_wire_holoemitter", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_range.mdl"},
}})
registerSent("gmod_wire_textreceiver", {
_preFactory = function(ply, self)
local matches = {}
for k, v in pairs(self.Matches) do
checkluatype(v, TYPE_STRING, 3, "Parameter: Matches[" .. k .. "]")
matches[k] = v
end
self.Matches = matches
end,
{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_range.mdl"},
["UseLuaPatterns"] = {TYPE_BOOL, false},
["Matches"] = {TYPE_TABLE},
["CaseInsensitive"] = {TYPE_BOOL, true},
}
})
registerSent("gmod_wire_textentry", {{
["Model"] = {TYPE_STRING, "models/beer/wiremod/keyboard.mdl"},
}})
registerSent("gmod_wire_teleporter", {{
["Model"] = {TYPE_STRING, "models/props_c17/utilityconducter001.mdl"},
["UseSounds"] = {TYPE_BOOL, true},
["UseEffects"] = {TYPE_BOOL, true},
}})
registerSent("gmod_wire_target_finder", {{
["Model"] = {TYPE_STRING, "models/beer/wiremod/targetfinder.mdl"},
["range"] = {TYPE_NUMBER, 1000},
["players"] = {TYPE_BOOL, false},
["npcs"] = {TYPE_BOOL, true},
["npcname"] = {TYPE_STRING, ""},
["beacons"] = {TYPE_BOOL, false},
["hoverballs"] = {TYPE_BOOL, false},
["thrusters"] = {TYPE_BOOL, false},
["props"] = {TYPE_BOOL, false},
["propmodel"] = {TYPE_STRING, ""},
["vehicles"] = {TYPE_BOOL, false},
["playername"] = {TYPE_STRING, ""},
["casesen"] = {TYPE_BOOL, false},
["rpgs"] = {TYPE_BOOL, false},
["painttarget"] = {TYPE_BOOL, true},
["minrange"] = {TYPE_NUMBER, 1},
["maxtargets"] = {TYPE_NUMBER, 1},
["maxbogeys"] = {TYPE_NUMBER, 1},
["notargetowner"] = {TYPE_BOOL, false},
["entity"] = {TYPE_STRING, ""},
["notownersstuff"] = {TYPE_BOOL, false},
["steamname"] = {TYPE_STRING, ""},
["colorcheck"] = {TYPE_BOOL, false},
["colortarget"] = {TYPE_BOOL, false},
["checkbuddylist"] = {TYPE_BOOL, false},
["onbuddylist"] = {TYPE_BOOL, false},
["pcolR"] = {TYPE_NUMBER, 255},
["pcolG"] = {TYPE_NUMBER, 255},
["pcolB"] = {TYPE_NUMBER, 255},
["pcolA"] = {TYPE_NUMBER, 255},
}})
registerSent("gmod_wire_digitalscreen", {{
["Model"] = {TYPE_STRING, "models/props_lab/monitor01b.mdl"},
["ScreenWidth"] = {TYPE_NUMBER, 32},
["ScreenHeight"] = {TYPE_NUMBER, 32},
}})
registerSent("gmod_wire_trail", {
_preFactory = function(ply, self)
self.Trail = {}
end,
_postFactory = function(ply, self, enttbl)
self.Trail = {
Color = enttbl.Color,
Length = enttbl.Length,
StartSize = enttbl.StartSize,
EndSize = enttbl.EndSize,
Material = enttbl.Material
}
end,
{
["Color"] = {TYPE_COLOR, Color(255, 255, 255)},
["Length"] = {TYPE_NUMBER, 5},
["StartSize"] = {TYPE_NUMBER, 32},
["EndSize"] = {TYPE_NUMBER, 0},
["Material"] = {TYPE_STRING, "trails/lol"},
}
})
registerSent("gmod_wire_egp", {
_preFactory = function(ply, self)
self.model = self.Model
end,
{
["Model"] = {TYPE_STRING, "models/kobilica/wiremonitorbig.mdl"},
}
})
registerSent("gmod_wire_egp_hud", {{
["Model"] = {TYPE_STRING, "models/bull/dynamicbutton.mdl"},
}})
registerSent("gmod_wire_egp_emitter", {{
["Model"] = {TYPE_STRING, "models/bull/dynamicbutton.mdl"},
}})
registerSent("gmod_wire_speedometer", {{
["Model"] = {TYPE_STRING},
["z_only"] = {TYPE_BOOL, false},
["AngVel"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_trigger", {
_preFactory = function(ply, self)
self.model = self.Model
end,
{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["filter"] = {TYPE_NUMBER, 0},
["owneronly"] = {TYPE_BOOL, false},
["sizex"] = {TYPE_NUMBER, 64},
["sizey"] = {TYPE_NUMBER, 64},
["sizez"] = {TYPE_NUMBER, 64},
["offsetx"] = {TYPE_NUMBER, 0},
["offsety"] = {TYPE_NUMBER, 0},
["offsetz"] = {TYPE_NUMBER, 0},
}
})
registerSent("gmod_wire_socket", {{
["Model"] = {TYPE_STRING, "models/props_lab/tpplugholder_single.mdl"},
["ArrayInput"] = {TYPE_BOOL, false},
["WeldForce"] = {TYPE_NUMBER, 5000},
["AttachRange"] = {TYPE_NUMBER, 5},
}})
registerSent("gmod_wire_simple_explosive", {{
["Model"] = {TYPE_STRING, "models/props_c17/oildrum001_explosive.mdl"},
["key"] = {TYPE_NUMBER, 1},
["damage"] = {TYPE_NUMBER, 200},
["removeafter"] = {TYPE_BOOL, false},
["radius"] = {TYPE_NUMBER, 300},
}})
registerSent("gmod_wire_sensor", {{
["Model"] = {TYPE_STRING},
["xyz_mode"] = {TYPE_BOOL, false},
["outdist"] = {TYPE_BOOL, true},
["outbrng"] = {TYPE_BOOL, false},
["gpscord"] = {TYPE_BOOL, false},
["direction_vector"] = {TYPE_BOOL, false},
["direction_normalized"] = {TYPE_BOOL, false},
["target_velocity"] = {TYPE_BOOL, false},
["velocity_normalized"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_screen", {{
["Model"] = {TYPE_STRING, "models/props_lab/monitor01b.mdl"},
["SingleValue"] = {TYPE_BOOL, false},
["SingleBigFont"] = {TYPE_BOOL, true},
["TextA"] = {TYPE_STRING, "Value A"},
["TextB"] = {TYPE_STRING, "Value B"},
["LeftAlign"] = {TYPE_BOOL, false},
["Floor"] = {TYPE_BOOL, false},
["FormatNumber"] = {TYPE_BOOL, false},
["FormatTime"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_detonator", {{
["Model"] = {TYPE_STRING, "models/props_combine/breenclock.mdl"},
["damage"] = {TYPE_NUMBER, 1},
}})
registerSent("gmod_wire_relay", {{
["Model"] = {TYPE_STRING, "models/kobilica/relay.mdl"},
["keygroup1"] = {TYPE_NUMBER, 1},
["keygroup2"] = {TYPE_NUMBER, 2},
["keygroup3"] = {TYPE_NUMBER, 3},
["keygroup4"] = {TYPE_NUMBER, 4},
["keygroup5"] = {TYPE_NUMBER, 5},
["keygroupoff"] = {TYPE_NUMBER, 0},
["toggle"] = {TYPE_BOOL, true},
["normclose"] = {TYPE_NUMBER, 0},
["poles"] = {TYPE_NUMBER, 1},
["throws"] = {TYPE_NUMBER, 2},
["nokey"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_ranger", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_range.mdl"},
["range"] = {TYPE_NUMBER, 1500},
["default_zero"] = {TYPE_BOOL, true},
["show_beam"] = {TYPE_BOOL, true},
["ignore_world"] = {TYPE_BOOL, false},
["trace_water"] = {TYPE_BOOL, false},
["out_dist"] = {TYPE_BOOL, true},
["out_pos"] = {TYPE_BOOL, false},
["out_vel"] = {TYPE_BOOL, false},
["out_ang"] = {TYPE_BOOL, false},
["out_col"] = {TYPE_BOOL, false},
["out_val"] = {TYPE_BOOL, false},
["out_sid"] = {TYPE_BOOL, false},
["out_uid"] = {TYPE_BOOL, false},
["out_eid"] = {TYPE_BOOL, false},
["out_hnrm"] = {TYPE_BOOL, false},
["hires"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_radio", {{
["Model"] = {TYPE_STRING, "models/props_lab/binderblue.mdl"},
["Channel"] = {TYPE_STRING, "1"},
["values"] = {TYPE_NUMBER, 4},
["Secure"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_thruster", {{
["Model"] = {TYPE_STRING, "models/props_c17/lampShade001a.mdl"},
["force"] = {TYPE_NUMBER, 1500},
["force_min"] = {TYPE_NUMBER, 0},
["force_max"] = {TYPE_NUMBER, 10000},
["oweffect"] = {TYPE_STRING, "fire"},
["uweffect"] = {TYPE_STRING, "same"},
["owater"] = {TYPE_BOOL, true},
["uwater"] = {TYPE_BOOL, true},
["bidir"] = {TYPE_BOOL, true},
["soundname"] = {TYPE_STRING, ""},
}})
registerSent("gmod_wire_pod", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
}})
registerSent("gmod_wire_data_satellitedish", {{
["Model"] = {TYPE_STRING, "models/props_wasteland/prison_lamp001c.mdl"},
}})
registerSent("gmod_wire_consolescreen", {{
["Model"] = {TYPE_STRING, "models/props_lab/monitor01b.mdl"},
}})
registerSent("gmod_wire_pixel", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
}})
registerSent("gmod_wire_output", {{
["Model"] = {TYPE_STRING, "models/beer/wiremod/numpad.mdl"},
["key"] = {TYPE_NUMBER, 1},
}})
registerSent("gmod_wire_motor", {
_preFactory = function(ply, self)
if not IsValid(self.Ent1) then SF.Throw("Invalid Entity, Parameter: ent1", 3) end
if not IsValid(self.Ent2) then SF.Throw("Invalid Entity, Parameter: ent2", 3) end
self.model = self.Model
self.MyId = "starfall_createsent"
end,
_postFactory = function(ply, self, enttbl)
MakeWireMotor(
ply,
enttbl.Ent1,
enttbl.Ent2,
enttbl.Bone1,
enttbl.Bone2,
enttbl.LPos1,
enttbl.LPos2,
enttbl.friction,
enttbl.torque,
0,
enttbl.torque,
enttbl.MyId
)
end,
{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["Ent1"] = {TYPE_ENTITY, nil},
["Ent2"] = {TYPE_ENTITY, nil},
["Bone1"] = {TYPE_NUMBER, 0},
["Bone2"] = {TYPE_NUMBER, 0},
["LPos1"] = {TYPE_VECTOR, Vector()},
["LPos2"] = {TYPE_VECTOR, Vector()},
["friction"] = {TYPE_NUMBER, 1},
["torque"] = {TYPE_NUMBER, 500},
["forcelimit"] = {TYPE_NUMBER, 0},
}
})
registerSent("gmod_wire_explosive", {{
["Model"] = {TYPE_STRING, "models/props_c17/oildrum001_explosive.mdl"},
["key"] = {TYPE_NUMBER, 1},
["damage"] = {TYPE_NUMBER, 200},
["delaytime"] = {TYPE_NUMBER, 0},
["removeafter"] = {TYPE_BOOL, false},
["radius"] = {TYPE_NUMBER, 300},
["affectother"] = {TYPE_BOOL, false},
["notaffected"] = {TYPE_BOOL, false},
["delayreloadtime"] = {TYPE_NUMBER, 0},
["maxhealth"] = {TYPE_NUMBER, 100},
["bulletproof"] = {TYPE_BOOL, false},
["explosionproof"] = {TYPE_BOOL, false},
["fallproof"] = {TYPE_BOOL, false},
["explodeatzero"] = {TYPE_BOOL, true},
["resetatexplode"] = {TYPE_BOOL, true},
["fireeffect"] = {TYPE_BOOL, true},
["coloreffect"] = {TYPE_BOOL, true},
["invisibleatzero"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_light", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["directional"] = {TYPE_BOOL, false},
["radiant"] = {TYPE_BOOL, false},
["glow"] = {TYPE_BOOL, false},
["brightness"] = {TYPE_NUMBER, 2},
["size"] = {TYPE_NUMBER, 256},
["R"] = {TYPE_NUMBER, 255},
["G"] = {TYPE_NUMBER, 255},
["B"] = {TYPE_NUMBER, 255},
}})
registerSent("gmod_wire_lamp", {{
["Model"] = {TYPE_STRING, "models/lamps/torch.mdl"},
["Texture"] = {TYPE_STRING, "effects/flashlight001"},
["FOV"] = {TYPE_NUMBER, 90},
["Dist"] = {TYPE_NUMBER, 1024},
["Brightness"] = {TYPE_NUMBER, 8},
["on"] = {TYPE_BOOL, false},
["r"] = {TYPE_NUMBER, 255},
["g"] = {TYPE_NUMBER, 255},
["b"] = {TYPE_NUMBER, 255},
}})
registerSent("gmod_wire_keypad", {
_preFactory = function(ply, self)
self.Password = util.CRC(self.Password)
end,
{
["Model"] = {TYPE_STRING, "models/props_lab/keypad.mdl"},
["Password"] = {TYPE_STRING},
["Secure"] = {TYPE_BOOL},
}
})
registerSent("gmod_wire_data_store", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_range.mdl"},
}})
registerSent("gmod_wire_gpulib_controller", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
}})
registerSent("gmod_wire_clutch", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
}})
registerSent("gmod_wire_input", {{
["Model"] = {TYPE_STRING, "models/beer/wiremod/numpad.mdl"},
["keygroup"] = {TYPE_NUMBER, 7},
["toggle"] = {TYPE_BOOL, false},
["value_off"] = {TYPE_NUMBER, 0},
["value_on"] = {TYPE_NUMBER, 1},
}})
registerSent("gmod_wire_indicator", {{
["Model"] = {TYPE_STRING, "models/segment.mdl"},
["a"] = {TYPE_NUMBER, 0},
["b"] = {TYPE_NUMBER, 1},
["ar"] = {TYPE_NUMBER, 255},
["ag"] = {TYPE_NUMBER, 0},
["ab"] = {TYPE_NUMBER, 0},
["aa"] = {TYPE_NUMBER, 255},
["br"] = {TYPE_NUMBER, 0},
["bg"] = {TYPE_NUMBER, 255},
["bb"] = {TYPE_NUMBER, 0},
["ba"] = {TYPE_NUMBER, 255},
}})
registerSent("gmod_wire_igniter", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["TargetPlayers"] = {TYPE_BOOL, false},
["Range"] = {TYPE_NUMBER, 2048},
}})
registerSent("gmod_wire_hydraulic", {
_preFactory = function(ply, self)
if not IsValid(self.Ent1) then SF.Throw("Invalid Entity, Parameter: ent1", 3) end
if not IsValid(self.Ent2) then SF.Throw("Invalid Entity, Parameter: ent2", 3) end
self.model = self.Model
self.MyId = "starfall_createsent"
end,
_postFactory = function(ply, self, enttbl)
MakeWireHydraulic(
ply,
enttbl.Ent1,
enttbl.Ent2,
enttbl.Bone1,
enttbl.Bone2,
enttbl.LPos1,
enttbl.LPos2,
enttbl.width,
enttbl.material,
enttbl.speed,
enttbl.fixed,
enttbl.stretchonly,
enttbl.MyId
)
end,
{
["Model"] = {TYPE_STRING, "models/beer/wiremod/hydraulic.mdl"},
["Ent1"] = {TYPE_ENTITY, nil},
["Ent2"] = {TYPE_ENTITY, nil},
["Bone1"] = {TYPE_NUMBER, 0},
["Bone2"] = {TYPE_NUMBER, 0},
["LPos1"] = {TYPE_VECTOR, Vector()},
["LPos2"] = {TYPE_VECTOR, Vector()},
["width"] = {TYPE_NUMBER, 3},
["material"] = {TYPE_STRING, "cable/rope"},
["speed"] = {TYPE_NUMBER, 16},
["fixed"] = {TYPE_NUMBER, 0},
["stretchonly"] = {TYPE_BOOL, false},
}
})
registerSent("gmod_wire_hudindicator", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["a"] = {TYPE_NUMBER, 0},
["b"] = {TYPE_NUMBER, 1},
["material"] = {TYPE_STRING, "models/debug/debugwhite"},
["showinhud"] = {TYPE_BOOL, false},
["huddesc"] = {TYPE_STRING, ""},
["hudaddname"] = {TYPE_BOOL, false},
["hudshowvalue"] = {TYPE_NUMBER, 0},
["hudstyle"] = {TYPE_NUMBER, 0},
["allowhook"] = {TYPE_BOOL, true},
["fullcircleangle"] = {TYPE_NUMBER, 0},
["ar"] = {TYPE_NUMBER, 255},
["ag"] = {TYPE_NUMBER, 0},
["ab"] = {TYPE_NUMBER, 0},
["aa"] = {TYPE_NUMBER, 255},
["br"] = {TYPE_NUMBER, 0},
["bg"] = {TYPE_NUMBER, 255},
["bb"] = {TYPE_NUMBER, 0},
["ba"] = {TYPE_NUMBER, 255},
}})
registerSent("gmod_wire_hoverball", {{
["Model"] = {TYPE_STRING, "models/dav0r/hoverball.mdl"},
["speed"] = {TYPE_NUMBER, 1},
["resistance"] = {TYPE_NUMBER, 0},
["strength"] = {TYPE_NUMBER, 1},
["starton"] = {TYPE_BOOL, true},
}})
registerSent("gmod_wire_fx_emitter", {
_preFactory = function(ply, self)
self.effect = ComboBox_Wire_FX_Emitter_Options[self.effect]
end,
{
["Model"] = {TYPE_STRING, "models/props_lab/tpplug.mdl"},
["delay"] = {TYPE_NUMBER, 0.07},
["effect"] = {TYPE_STRING, "sparks"},
}
})
registerSent("gmod_wire_hologrid", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["usegps"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_data_transferer", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["Range"] = {TYPE_NUMBER, 25000},
["DefaultZero"] = {TYPE_BOOL, false},
["IgnoreZero"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_graphics_tablet", {{
["Model"] = {TYPE_STRING, "models/kobilica/wiremonitorbig.mdl"},
["gmode"] = {TYPE_BOOL, false},
["draw_background"] = {TYPE_BOOL, true},
}})
registerSent("gmod_wire_gps", {{
["Model"] = {TYPE_STRING, "models/beer/wiremod/gps.mdl"},
}})
registerSent("gmod_wire_gimbal", {{
["Model"] = {TYPE_STRING, "models/props_c17/canister01a.mdl"},
}})
registerSent("gmod_wire_button", {{
["Model"] = {TYPE_STRING, "models/props_c17/clock01.mdl"},
["toggle"] = {TYPE_BOOL, false},
["value_off"] = {TYPE_NUMBER, 0},
["value_on"] = {TYPE_NUMBER, 1},
["description"] = {TYPE_STRING, ""},
["entityout"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_extbus", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_gate.mdl"},
}})
registerSent("gmod_wire_locator", {{
["Model"] = {TYPE_STRING, "models/props_lab/powerbox02d.mdl"},
}})
registerSent("gmod_wire_cameracontroller", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["ParentLocal"] = {TYPE_BOOL, false},
["AutoMove"] = {TYPE_BOOL, false},
["FreeMove"] = {TYPE_BOOL, false},
["LocalMove"] = {TYPE_BOOL, false},
["AllowZoom"] = {TYPE_BOOL, false},
["AutoUnclip"] = {TYPE_BOOL, false},
["DrawPlayer"] = {TYPE_BOOL, true},
["AutoUnclip_IgnoreWater"] = {TYPE_BOOL, false},
["DrawParent"] = {TYPE_BOOL, true},
}})
registerSent("gmod_wire_dual_input", {{
["Model"] = {TYPE_STRING, "models/beer/wiremod/numpad.mdl"},
["keygroup"] = {TYPE_NUMBER, 7},
["keygroup2"] = {TYPE_NUMBER, 4},
["toggle"] = {TYPE_BOOL, false},
["value_off"] = {TYPE_NUMBER, 0},
["value_on"] = {TYPE_NUMBER, 1},
["value_on2"] = {TYPE_NUMBER, -1},
}})
registerSent("gmod_wire_cd_ray", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_beamcaster.mdl"},
["Range"] = {TYPE_NUMBER, 64},
["DefaultZero"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_datarate", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_gate.mdl"},
}})
registerSent("gmod_wire_keyboard", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_input.mdl"},
["AutoBuffer"] = {TYPE_BOOL, true},
["Synchronous"] = {TYPE_BOOL, true},
["EnterKeyAscii"] = {TYPE_BOOL, true},
}})
registerSent("gmod_wire_dynamic_button", {{
["Model"] = {TYPE_STRING, "models/bull/ranger.mdl"},
["toggle"] = {TYPE_BOOL, false},
["value_on"] = {TYPE_NUMBER, 1},
["value_off"] = {TYPE_NUMBER, 0},
["description"] = {TYPE_STRING, ""},
["entityout"] = {TYPE_BOOL, false},
["material_on"] = {TYPE_STRING, "bull/dynamic_button_1"},
["material_off"] = {TYPE_STRING, "bull/dynamic_button_0"},
["on_r"] = {TYPE_NUMBER, 255},
["on_g"] = {TYPE_NUMBER, 255},
["on_b"] = {TYPE_NUMBER, 255},
["off_r"] = {TYPE_NUMBER, 255},
["off_g"] = {TYPE_NUMBER, 255},
["off_b"] = {TYPE_NUMBER, 255},
}})
registerSent("gmod_wire_damage_detector", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["includeconstrained"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_hdd", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_gate.mdl"},
["DriveID"] = {TYPE_NUMBER, 0},
["DriveCap"] = {TYPE_NUMBER, 128},
}})
registerSent("gmod_wire_watersensor", {{
["Model"] = {TYPE_STRING, "models/beer/wiremod/watersensor.mdl"},
}})
registerSent("gmod_wire_value", {
_preFactory = function(ply, self)
local valid_types = {
NORMAL = true,
VECTOR = true,
VECTOR2 = true,
VECTOR4 = true,
ANGLE = true,
STRING = true,
}
local value = {}
for i, val in ipairs(self.value) do
checkluatype(val, TYPE_TABLE, 3, "Parameter: value[" .. i .. "]")
checkluatype(val[1], TYPE_STRING, 3, "Parameter: value[" .. i .. "][1]")
local typ = string.upper(val[1])
if not valid_types[typ] then SF.Throw("value[" .. i .. "] type is invalid " .. typ, 3) end
checkluatype(val[2], TYPE_STRING, 3, "Parameter: value[" .. i .. "][2]")
value[i] = {
DataType = typ,
Value = val[2]
}
end
self.value = value
end,
{
["Model"] = {TYPE_STRING, "models/kobilica/value.mdl"},
["value"] = {TYPE_TABLE},
}
})
registerSent("gmod_wire_adv_emarker", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
}})
registerSent("gmod_wire_wheel", {
_preFactory = function(ply, self)
if not IsValid(self.Base) then SF.Throw("Invalid Entity, Parameter: base", 3) end
end,
_postFactory = function(ply, self, enttbl)
local motor, axis = constraint.Motor(self, enttbl.Base, 0, enttbl.Bone, Vector(), enttbl.LPos, enttbl.friction, 1000, 0, 0, false, ply, enttbl.forcelimit)
self:SetWheelBase(enttbl.Base)
self:SetMotor(motor)
self:SetDirection(motor.direction)
local axis = Vector(enttbl.LAxis[1], enttbl.LAxis[2], enttbl.LAxis[3])
axis:Rotate(self:GetAngles())
self:SetAxis(axis)
self:DoDirectionEffect()
end,
{
["Model"] = {TYPE_STRING, "models/props_vehicles/carparts_wheel01a.mdl"},
["Base"] = {TYPE_ENTITY, nil},
["Bone"] = {TYPE_NUMBER, 0},
["LPos"] = {TYPE_VECTOR, Vector()},
["LAxis"] = {TYPE_VECTOR, Vector(0, 1, 0)},
["fwd"] = {TYPE_NUMBER, 1},
["bck"] = {TYPE_NUMBER, -1},
["stop"] = {TYPE_NUMBER, 0},
["BaseTorque"] = {TYPE_NUMBER, 3000},
["friction"] = {TYPE_NUMBER, 1},
["forcelimit"] = {TYPE_NUMBER, 0},
}
})
registerSent("gmod_wire_gyroscope", {{
["Model"] = {TYPE_STRING, "models/bull/various/gyroscope.mdl"},
["out180"] = {TYPE_BOOL, false},
}})
registerSent("gmod_wire_datasocket", {{
["Model"] = {TYPE_STRING, "models/hammy/pci_slot.mdl"},
["WeldForce"] = {TYPE_NUMBER, 5000},
["AttachRange"] = {TYPE_NUMBER, 5},
}})
registerSent("gmod_wire_eyepod", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
["DefaultToZero"] = {TYPE_NUMBER, 1},
["ShowRateOfChange"] = {TYPE_NUMBER, 1},
["ClampXMin"] = {TYPE_NUMBER, 0},
["ClampXMax"] = {TYPE_NUMBER, 0},
["ClampYMin"] = {TYPE_NUMBER, 0},
["ClampYMax"] = {TYPE_NUMBER, 0},
["ClampX"] = {TYPE_NUMBER, 0},
["ClampY"] = {TYPE_NUMBER, 0},
}})
registerSent("gmod_wire_gate", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_gate.mdl"},
["action"] = {TYPE_STRING, "+"},
}})
registerSent("gmod_wire_freezer", {{
["Model"] = {TYPE_STRING, "models/jaanus/wiretool/wiretool_siren.mdl"},
}})
-- Chip bois
registerSent("gmod_wire_expression2", {
_preFactory = function(ply, self)
self._inputs = {{}, {}}
self._outputs = {{}, {}}
self._vars = {}
self.filepath = "generic_starfall.txt"
local inc_files = {}
for path, code in pairs(self.inc_files) do
checkluatype(path, TYPE_STRING, 3, "Parameter: inc_files[" .. path .. "]")
checkluatype(code, TYPE_STRING, 3, "Parameter: inc_files[" .. path .. "]")
inc_files[path] = code
end
self.inc_files = inc_files
end,
{
["Model"] = {TYPE_STRING, "models/beer/wiremod/gate_e2.mdl"},
["_name"] = {TYPE_STRING, "Generic"},
["_original"] = {TYPE_STRING, "print(\"Hello World!\")"},
["inc_files"] = {TYPE_TABLE, {}},
}
})
end
end)
function SF.PrintCustomSENTDocs()
local tostr = {
string = function(x) return "\"" .. x .. "\"" end,
table = table.ToString,
Vector = function(x) return string.format("Vector(%s, %s, %s)", x[1], x[2], x[3]) end,
Angle = function(x) return string.format("Angle(%s, %s, %s)", x[1], x[2], x[3]) end,
Color = function(x) return string.format("Color(%s, %s, %s)", x.r, x.g, x.b) end,
}
local sorted = {}
for class, data in pairs(list.GetForEdit("starfall_creatable_sent")) do
local params = {}
for param, org in pairs(data[1]) do
params[#params+1] = {paramlower = string.lower(param), param = param, org = org}
end
sorted[#sorted+1] = {class = class, classlower = string.lower(class), params = params}
end
local classes = {"--- "}
for _, data in SortedPairsByMemberValue(sorted, "classlower") do
local str = {"-- > " .. data.class}
for _, params in SortedPairsByMemberValue(data.params, "paramlower") do
local param, org = params.param, params.org
local typ = SF.TypeName(org[1])
local def
if org[2]~=nil then
def = " = " .. (tostr[typ] and tostr[typ](org[2]) or tostring(org[2]))
else
def = ""
end
table.insert(str, "-- " .. typ .. " " .. param .. def)
end
table.insert(str, "-- ")
table.insert(classes, table.concat(str, "\n"))
end
table.insert(classes, "-- @name props_library.SENT_Data_Structures\n-- @class table")
for _, str in ipairs(classes) do
print(str)
end
end
return function() end
---
-- > gmod_balloon
-- number b = 255
-- number force
-- number g = 255
-- string Model = "models/maxofs2d/balloon_classic.mdl"
-- number r = 255
--
-- > gmod_button
-- string description = ""
-- number key
-- string Model = "models/maxofs2d/button_05.mdl"
-- boolean toggle = true
--
-- > gmod_cameraprop
-- number controlkey
-- boolean locked = false
-- string Model = "models/dav0r/camera.mdl"
-- boolean toggle = true
--
-- > gmod_dynamite
-- number Damage = 200
-- number delay = 0
-- number key
-- string Model = "models/dav0r/tnt/tnt.mdl"
-- boolean remove = false
--
-- > gmod_emitter
-- number delay = 0
-- string effect
-- number key
-- string Model = "models/props_lab/tpplug.mdl"
-- number scale = 1
-- boolean starton = false
-- boolean toggle = true
--
-- > gmod_hoverball
-- number key_d = -1
-- number key_u = -1
-- string Model = "models/dav0r/hoverball.mdl"
-- number resistance = 0
-- number speed = 1
-- number strength = 1
--
-- > gmod_lamp
-- number b = 255
-- number brightness = 4
-- number distance = 1024
-- number fov = 90
-- number g = 255
-- number KeyDown = -1
-- string Model = "models/lamps/torch.mdl"
-- boolean on = false
-- number r = 255
-- string Texture = "effects/flashlight001"
-- boolean toggle = true
--
-- > gmod_light
-- number Brightness = 2
-- number KeyDown = -1
-- number lightb = 255
-- number lightg = 255
-- number lightr = 255
-- string Model = "models/maxofs2d/light_tubular.mdl"
-- boolean on = false
-- number Size = 256
-- boolean toggle = true
--
-- > gmod_thruster
-- boolean damageable = false
-- string effect = "fire"
-- number force = 1500
-- number key = -1
-- number key_bck = -1
-- string Model = "models/props_phx2/garbage_metalcan001a.mdl"
-- string soundname = "PhysicsCannister.ThrusterLoop"
-- boolean toggle = false
--
-- > gmod_wire_addressbus
-- number Mem1st = 0
-- number Mem1sz = 0
-- number Mem2st = 0
-- number Mem2sz = 0
-- number Mem3st = 0
-- number Mem3sz = 0
-- number Mem4st = 0
-- number Mem4sz = 0
-- string Model = "models/jaanus/wiretool/wiretool_gate.mdl"
--
-- > gmod_wire_adv_emarker
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
--
-- > gmod_wire_adv_input
-- number keyless = 1
-- number keymore = 3
-- string Model = "models/beer/wiremod/numpad.mdl"
-- number speed = 1
-- boolean toggle = false
-- number value_max = 10
-- number value_min = 0
-- number value_start = 5
--
-- > gmod_wire_button
-- string description = ""
-- boolean entityout = false
-- string Model = "models/props_c17/clock01.mdl"
-- boolean toggle = false
-- number value_off = 0
-- number value_on = 1
--
-- > gmod_wire_cameracontroller
-- boolean AllowZoom = false
-- boolean AutoMove = false
-- boolean AutoUnclip = false
-- boolean AutoUnclip_IgnoreWater = false
-- boolean DrawParent = true
-- boolean DrawPlayer = true
-- boolean FreeMove = false
-- boolean LocalMove = false
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
-- boolean ParentLocal = false
--
-- > gmod_wire_cd_disk
-- number IRadius = 10
-- string Model = "models/venompapa/wirecd_medium.mdl"
-- number Precision = 4
-- number Skin = 0
--
-- > gmod_wire_cd_ray
-- boolean DefaultZero = false
-- string Model = "models/jaanus/wiretool/wiretool_beamcaster.mdl"
-- number Range = 64
--
-- > gmod_wire_clutch
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
--
-- > gmod_wire_colorer
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
-- boolean outColor = false
-- number Range = 2000
--
-- > gmod_wire_consolescreen
-- string Model = "models/props_lab/monitor01b.mdl"
--
-- > gmod_wire_damage_detector
-- boolean includeconstrained = false
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
--
-- > gmod_wire_data_satellitedish
-- string Model = "models/props_wasteland/prison_lamp001c.mdl"
--
-- > gmod_wire_data_store
-- string Model = "models/jaanus/wiretool/wiretool_range.mdl"
--
-- > gmod_wire_data_transferer
-- boolean DefaultZero = false
-- boolean IgnoreZero = false
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
-- number Range = 25000
--
-- > gmod_wire_dataport
-- string Model = "models/jaanus/wiretool/wiretool_gate.mdl"
--
-- > gmod_wire_datarate
-- string Model = "models/jaanus/wiretool/wiretool_gate.mdl"
--
-- > gmod_wire_datasocket
-- number AttachRange = 5
-- string Model = "models/hammy/pci_slot.mdl"
-- number WeldForce = 5000
--
-- > gmod_wire_detonator
-- number damage = 1
-- string Model = "models/props_combine/breenclock.mdl"
--
-- > gmod_wire_dhdd
-- string Model
--
-- > gmod_wire_digitalscreen
-- string Model = "models/props_lab/monitor01b.mdl"
-- number ScreenHeight = 32
-- number ScreenWidth = 32
--
-- > gmod_wire_dual_input
-- number keygroup = 7
-- number keygroup2 = 4
-- string Model = "models/beer/wiremod/numpad.mdl"
-- boolean toggle = false
-- number value_off = 0
-- number value_on = 1
-- number value_on2 = -1
--
-- > gmod_wire_dynamic_button
-- string description = ""
-- boolean entityout = false
-- string material_off = "bull/dynamic_button_0"
-- string material_on = "bull/dynamic_button_1"
-- string Model = "models/bull/ranger.mdl"
-- number off_b = 255
-- number off_g = 255
-- number off_r = 255
-- number on_b = 255
-- number on_g = 255
-- number on_r = 255
-- boolean toggle = false
-- number value_off = 0
-- number value_on = 1
--
-- > gmod_wire_egp
-- string Model = "models/kobilica/wiremonitorbig.mdl"
--
-- > gmod_wire_egp_emitter
-- string Model = "models/bull/dynamicbutton.mdl"
--
-- > gmod_wire_egp_hud
-- string Model = "models/bull/dynamicbutton.mdl"
--
-- > gmod_wire_emarker
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
--
-- > gmod_wire_exit_point
-- string Model = "models/jaanus/wiretool/wiretool_range.mdl"
--
-- > gmod_wire_explosive
-- boolean affectother = false
-- boolean bulletproof = false
-- boolean coloreffect = true
-- number damage = 200
-- number delayreloadtime = 0
-- number delaytime = 0
-- boolean explodeatzero = true
-- boolean explosionproof = false
-- boolean fallproof = false
-- boolean fireeffect = true
-- boolean invisibleatzero = false
-- number key = 1
-- number maxhealth = 100
-- string Model = "models/props_c17/oildrum001_explosive.mdl"
-- boolean notaffected = false
-- number radius = 300
-- boolean removeafter = false
-- boolean resetatexplode = true
--
-- > gmod_wire_expression2
-- string _name = "Generic"
-- string _original = "print("Hello World!")"
-- table inc_files = {}
-- string Model = "models/beer/wiremod/gate_e2.mdl"
--
-- > gmod_wire_extbus
-- string Model = "models/jaanus/wiretool/wiretool_gate.mdl"
--
-- > gmod_wire_eyepod
-- number ClampX = 0
-- number ClampXMax = 0
-- number ClampXMin = 0
-- number ClampY = 0
-- number ClampYMax = 0
-- number ClampYMin = 0
-- number DefaultToZero = 1
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
-- number ShowRateOfChange = 1
--
-- > gmod_wire_forcer
-- number Force = 1
-- number Length = 100
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
-- boolean Reaction = false
-- boolean ShowBeam = true
--
-- > gmod_wire_freezer
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
--
-- > gmod_wire_friendslist
-- string Model = "models/kobilica/value.mdl"
-- boolean save_on_entity = false
--
-- > gmod_wire_fx_emitter
-- number delay = 0.07
-- string effect = "sparks"
-- string Model = "models/props_lab/tpplug.mdl"
--
-- > gmod_wire_gate
-- string action = "+"
-- string Model = "models/jaanus/wiretool/wiretool_gate.mdl"
--
-- > gmod_wire_gimbal
-- string Model = "models/props_c17/canister01a.mdl"
--
-- > gmod_wire_gps
-- string Model = "models/beer/wiremod/gps.mdl"
--
-- > gmod_wire_gpulib_controller
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
--
-- > gmod_wire_grabber
-- boolean Gravity = true
-- string Model = "models/jaanus/wiretool/wiretool_range.mdl"
-- number Range = 100
--
-- > gmod_wire_graphics_tablet
-- boolean draw_background = true
-- boolean gmode = false
-- string Model = "models/kobilica/wiremonitorbig.mdl"
--
-- > gmod_wire_gyroscope
-- string Model = "models/bull/various/gyroscope.mdl"
-- boolean out180 = false
--
-- > gmod_wire_hdd
-- number DriveCap = 128
-- number DriveID = 0
-- string Model = "models/jaanus/wiretool/wiretool_gate.mdl"
--
-- > gmod_wire_holoemitter
-- string Model = "models/jaanus/wiretool/wiretool_range.mdl"
--
-- > gmod_wire_hologrid
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
-- boolean usegps = false
--
-- > gmod_wire_hoverball
-- string Model = "models/dav0r/hoverball.mdl"
-- number resistance = 0
-- number speed = 1
-- boolean starton = true
-- number strength = 1
--
-- > gmod_wire_hudindicator
-- number a = 0
-- number aa = 255
-- number ab = 0
-- number ag = 0
-- boolean allowhook = true
-- number ar = 255
-- number b = 1
-- number ba = 255
-- number bb = 0
-- number bg = 255
-- number br = 0
-- number fullcircleangle = 0
-- boolean hudaddname = false
-- string huddesc = ""
-- number hudshowvalue = 0
-- number hudstyle = 0
-- string material = "models/debug/debugwhite"
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
-- boolean showinhud = false
--
-- > gmod_wire_hydraulic
-- number Bone1 = 0
-- number Bone2 = 0
-- Entity Ent1
-- Entity Ent2
-- number fixed = 0
-- Vector LPos1 = Vector(0, 0, 0)
-- Vector LPos2 = Vector(0, 0, 0)
-- string material = "cable/rope"
-- string Model = "models/beer/wiremod/hydraulic.mdl"
-- number speed = 16
-- boolean stretchonly = false
-- number width = 3
--
-- > gmod_wire_igniter
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
-- number Range = 2048
-- boolean TargetPlayers = false
--
-- > gmod_wire_indicator
-- number a = 0
-- number aa = 255
-- number ab = 0
-- number ag = 0
-- number ar = 255
-- number b = 1
-- number ba = 255
-- number bb = 0
-- number bg = 255
-- number br = 0
-- string Model = "models/segment.mdl"
--
-- > gmod_wire_input
-- number keygroup = 7
-- string Model = "models/beer/wiremod/numpad.mdl"
-- boolean toggle = false
-- number value_off = 0
-- number value_on = 1
--
-- > gmod_wire_keyboard
-- boolean AutoBuffer = true
-- boolean EnterKeyAscii = true
-- string Model = "models/jaanus/wiretool/wiretool_input.mdl"
-- boolean Synchronous = true
--
-- > gmod_wire_keypad
-- string Model = "models/props_lab/keypad.mdl"
-- string Password
-- boolean Secure
--
-- > gmod_wire_lamp
-- number b = 255
-- number Brightness = 8
-- number Dist = 1024
-- number FOV = 90
-- number g = 255
-- string Model = "models/lamps/torch.mdl"
-- boolean on = false
-- number r = 255
-- string Texture = "effects/flashlight001"
--
-- > gmod_wire_las_receiver
-- string Model = "models/jaanus/wiretool/wiretool_range.mdl"
--
-- > gmod_wire_latch
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
--
-- > gmod_wire_lever
-- number Max = 1
-- number Min = 0
--
-- > gmod_wire_light
-- number B = 255
-- number brightness = 2
-- boolean directional = false
-- number G = 255
-- boolean glow = false
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
-- number R = 255
-- boolean radiant = false
-- number size = 256
--
-- > gmod_wire_locator
-- string Model = "models/props_lab/powerbox02d.mdl"
--
-- > gmod_wire_motor
-- number Bone1 = 0
-- number Bone2 = 0
-- Entity Ent1
-- Entity Ent2
-- number forcelimit = 0
-- number friction = 1
-- Vector LPos1 = Vector(0, 0, 0)
-- Vector LPos2 = Vector(0, 0, 0)
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
-- number torque = 500
--
-- > gmod_wire_nailer
-- number Flim = 0
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
-- number Range = 100
-- boolean ShowBeam = true
--
-- > gmod_wire_numpad
-- string Model = "models/beer/wiremod/numpad.mdl"
-- boolean toggle = false
-- number value_off = 0
-- number value_on = 0
--
-- > gmod_wire_oscilloscope
-- string Model = "models/props_lab/monitor01b.mdl"
--
-- > gmod_wire_output
-- number key = 1
-- string Model = "models/beer/wiremod/numpad.mdl"
--
-- > gmod_wire_pixel
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
--
-- > gmod_wire_pod
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
--
-- > gmod_wire_radio
-- string Channel = "1"
-- string Model = "models/props_lab/binderblue.mdl"
-- boolean Secure = false
-- number values = 4
--
-- > gmod_wire_ranger
-- boolean default_zero = true
-- boolean hires = false
-- boolean ignore_world = false
-- string Model = "models/jaanus/wiretool/wiretool_range.mdl"
-- boolean out_ang = false
-- boolean out_col = false
-- boolean out_dist = true
-- boolean out_eid = false
-- boolean out_hnrm = false
-- boolean out_pos = false
-- boolean out_sid = false
-- boolean out_uid = false
-- boolean out_val = false
-- boolean out_vel = false
-- number range = 1500
-- boolean show_beam = true
-- boolean trace_water = false
--
-- > gmod_wire_relay
-- number keygroup1 = 1
-- number keygroup2 = 2
-- number keygroup3 = 3
-- number keygroup4 = 4
-- number keygroup5 = 5
-- number keygroupoff = 0
-- string Model = "models/kobilica/relay.mdl"
-- boolean nokey = false
-- number normclose = 0
-- number poles = 1
-- number throws = 2
-- boolean toggle = true
--
-- > gmod_wire_screen
-- boolean Floor = false
-- boolean FormatNumber = false
-- boolean FormatTime = false
-- boolean LeftAlign = false
-- string Model = "models/props_lab/monitor01b.mdl"
-- boolean SingleBigFont = true
-- boolean SingleValue = false
-- string TextA = "Value A"
-- string TextB = "Value B"
--
-- > gmod_wire_sensor
-- boolean direction_normalized = false
-- boolean direction_vector = false
-- boolean gpscord = false
-- string Model
-- boolean outbrng = false
-- boolean outdist = true
-- boolean target_velocity = false
-- boolean velocity_normalized = false
-- boolean xyz_mode = false
--
-- > gmod_wire_simple_explosive
-- number damage = 200
-- number key = 1
-- string Model = "models/props_c17/oildrum001_explosive.mdl"
-- number radius = 300
-- boolean removeafter = false
--
-- > gmod_wire_socket
-- boolean ArrayInput = false
-- number AttachRange = 5
-- string Model = "models/props_lab/tpplugholder_single.mdl"
-- number WeldForce = 5000
--
-- > gmod_wire_soundemitter
-- string Model = "models/cheeze/wires/speaker.mdl"
-- string sound = "synth/square.wav"
--
-- > gmod_wire_spawner
-- number a = 255
-- number b = 255
-- number delay = 0
-- number g = 255
-- string mat = ""
-- string Model
-- number r = 255
-- number skin = 0
-- number spawn_effect = 0
-- number undo_delay = 0
--
-- > gmod_wire_speedometer
-- boolean AngVel = false
-- string Model
-- boolean z_only = false
--
-- > gmod_wire_target_finder
-- boolean beacons = false
-- boolean casesen = false
-- boolean checkbuddylist = false
-- boolean colorcheck = false
-- boolean colortarget = false
-- string entity = ""
-- boolean hoverballs = false
-- number maxbogeys = 1
-- number maxtargets = 1
-- number minrange = 1
-- string Model = "models/beer/wiremod/targetfinder.mdl"
-- boolean notargetowner = false
-- boolean notownersstuff = false
-- string npcname = ""
-- boolean npcs = true
-- boolean onbuddylist = false
-- boolean painttarget = true
-- number pcolA = 255
-- number pcolB = 255
-- number pcolG = 255
-- number pcolR = 255
-- string playername = ""
-- boolean players = false
-- string propmodel = ""
-- boolean props = false
-- number range = 1000
-- boolean rpgs = false
-- string steamname = ""
-- boolean thrusters = false
-- boolean vehicles = false
--
-- > gmod_wire_teleporter
-- string Model = "models/props_c17/utilityconducter001.mdl"
-- boolean UseEffects = true
-- boolean UseSounds = true
--
-- > gmod_wire_textentry
-- string Model = "models/beer/wiremod/keyboard.mdl"
--
-- > gmod_wire_textreceiver
-- boolean CaseInsensitive = true
-- table Matches
-- string Model = "models/jaanus/wiretool/wiretool_range.mdl"
-- boolean UseLuaPatterns = false
--
-- > gmod_wire_textscreen
-- Color bgcolor = Color(0, 0, 0)
-- number chrPerLine = 6
-- Color fgcolor = Color(255, 255, 255)
-- string Model = "models/kobilica/wiremonitorbig.mdl"
-- string text = ""
-- number textJust = 1
-- string tfont = "Arial"
-- number valign = 0
--
-- > gmod_wire_thruster
-- boolean bidir = true
-- number force = 1500
-- number force_max = 10000
-- number force_min = 0
-- string Model = "models/props_c17/lampShade001a.mdl"
-- boolean owater = true
-- string oweffect = "fire"
-- string soundname = ""
-- boolean uwater = true
-- string uweffect = "same"
--
-- > gmod_wire_trail
-- Color Color = Color(255, 255, 255)
-- number EndSize = 0
-- number Length = 5
-- string Material = "trails/lol"
-- number StartSize = 32
--
-- > gmod_wire_trigger
-- number filter = 0
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
-- number offsetx = 0
-- number offsety = 0
-- number offsetz = 0
-- boolean owneronly = false
-- number sizex = 64
-- number sizey = 64
-- number sizez = 64
--
-- > gmod_wire_turret
-- number damage = 10
-- number delay = 0.05
-- number force = 1
-- string Model = "models/weapons/w_smg1.mdl"
-- number numbullets = 1
-- string sound = "0"
-- number spread = 0
-- string tracer = "Tracer"
-- number tracernum = 1
--
-- > gmod_wire_twoway_radio
-- string Model = "models/props_lab/binderblue.mdl"
--
-- > gmod_wire_user
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
-- number Range = 200
--
-- > gmod_wire_value
-- string Model = "models/kobilica/value.mdl"
-- table value
--
-- > gmod_wire_vectorthruster
-- boolean angleinputs = false
-- boolean bidir = true
-- number force = 1500
-- number force_max = 10000
-- number force_min = 0
-- boolean lengthismul = false
-- number mode = 0
-- string Model = "models/jaanus/wiretool/wiretool_speed.mdl"
-- boolean owater = true
-- string oweffect = "fire"
-- string soundname = ""
-- boolean uwater = true
-- string uweffect = "same"
--
-- > gmod_wire_vehicle
-- string Model = "models/jaanus/wiretool/wiretool_siren.mdl"
--
-- > gmod_wire_watersensor
-- string Model = "models/beer/wiremod/watersensor.mdl"
--
-- > gmod_wire_waypoint
-- string Model = "models/props_lab/powerbox02d.mdl"
-- number range = 150
--
-- > gmod_wire_weight
-- string Model = "models/props_interiors/pot01a.mdl"
--
-- > gmod_wire_wheel
-- Entity Base
-- number BaseTorque = 3000
-- number bck = -1
-- number Bone = 0
-- number forcelimit = 0
-- number friction = 1
-- number fwd = 1
-- Vector LAxis = Vector(0, 1, 0)
-- Vector LPos = Vector(0, 0, 0)
-- string Model = "models/props_vehicles/carparts_wheel01a.mdl"
-- number stop = 0
--
-- @name props_library.SENT_Data_Structures
-- @class table
|
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
this_is_a_map 'yes'
data_file 'DLC_ITYP_REQUEST' 'stream/rdd_main.ityp'
files {
'stream/rdd_airfield_hangers.ybn',
'stream/rdd_airfield_hangers.ydr',
'stream/rdd_axel_garage.ybn',
'stream/rdd_axel_garage.ydr',
'stream/rdd_bar.ybn',
'stream/rdd_bar.ydr',
'stream/rdd_big_house.ybn',
'stream/rdd_big_house.ydr',
'stream/rdd_big_rocks.ybn',
'stream/rdd_big_rocks.ydr',
'stream/rdd_big_telescope.ybn',
'stream/rdd_big_telescope.ydr',
'stream/rdd_buildings.ybn',
'stream/rdd_buildings.ydr',
'stream/rdd_cabins.ybn',
'stream/rdd_cabins.ydr',
'stream/rdd_cafe.ybn',
'stream/rdd_cafe.ydr',
'stream/rdd_cave.ybn',
'stream/rdd_cave.ydr',
'stream/rdd_cave_entrance.ybn',
'stream/rdd_cave_entrance.ydr',
'stream/rdd_cave_water.ybn',
'stream/rdd_cave_water.ydr',
'stream/rdd_church.ybn',
'stream/rdd_church.ydr',
'stream/rdd_cranes.ybn',
'stream/rdd_cranes.ydr',
'stream/rdd_curios_shop.ybn',
'stream/rdd_curios_shop.ydr',
'stream/rdd_entrance.ybn',
'stream/rdd_entrance.ydr',
'stream/rdd_gas_station.ybn',
'stream/rdd_gas_station.ydr',
'stream/rdd_grave_yard.ybn',
'stream/rdd_grave_yard.ydr',
'stream/rdd_iv.ytd',
'stream/rdd_jump_wrecks.ybn',
'stream/rdd_jump_wrecks.ydr',
'stream/rdd_logpiles.ybn',
'stream/rdd_logpiles.ydr',
'stream/rdd_main.ytd',
'stream/rdd_main.ytyp',
'stream/rdd_mine.ydr',
'stream/rdd_mine1.ybn',
'stream/rdd_mine2.ybn',
'stream/rdd_mine3.ybn',
'stream/rdd_motel.ybn',
'stream/rdd_motel.ydr',
'stream/rdd_oil_refinary.ybn',
'stream/rdd_oil_refinary.ydr',
'stream/rdd_oil_pier.ybn',
'stream/rdd_oil_pier.ydr',
'stream/rdd_parking.ybn',
'stream/rdd_parking.ydr',
'stream/rdd_plane_wrecks.ybn',
'stream/rdd_plane_wrecks.ydr',
'stream/rdd_restaurant.ybn',
'stream/rdd_restaurant.ydr',
'stream/rdd_road_fence.ybn',
'stream/rdd_road_fence.ydr',
'stream/rdd_rocks0.ybn',
'stream/rdd_rocks0.ydr',
'stream/rdd_rocks1.ybn',
'stream/rdd_rocks1.ydr',
'stream/rdd_rocks2.ybn',
'stream/rdd_rocks2.ydr',
'stream/rdd_rocks3.ybn',
'stream/rdd_rocks3.ydr',
'stream/rdd_rocks4.ybn',
'stream/rdd_rocks4.ydr',
'stream/rdd_rocks5.ybn',
'stream/rdd_rocks5.ydr',
'stream/rdd_rocks6.ybn',
'stream/rdd_rocks6.ydr',
'stream/rdd_rocks7.ybn',
'stream/rdd_rocks7.ydr',
'stream/rdd_rocks8.ybn',
'stream/rdd_rocks8.ydr',
'stream/rdd_rocks9.ybn',
'stream/rdd_rocks9.ydr',
'stream/rdd_rocks10.ybn',
'stream/rdd_rocks10.ydr',
'stream/rdd_rocks11.ybn',
'stream/rdd_rocks11.ydr',
'stream/rdd_rocks12.ybn',
'stream/rdd_rocks12.ydr',
'stream/rdd_rocks13a.ydr',
'stream/rdd_rocks13b.ydr',
'stream/rdd_rocks13c.ydr',
'stream/rdd_rocks13d.ydr',
'stream/rdd_rocks13_1.ybn',
'stream/rdd_rocks13_2.ybn',
'stream/rdd_rocks14.ybn',
'stream/rdd_rocks14.ydr',
'stream/rdd_rocks15.ybn',
'stream/rdd_rocks15.ydr',
'stream/rdd_rocks16.ydr',
'stream/rdd_rocks16_1.ybn',
'stream/rdd_rocks16_2.ybn',
'stream/rdd_rocks17.ybn',
'stream/rdd_rocks17.ydr',
'stream/rdd_rocks18.ybn',
'stream/rdd_rocks18.ydr',
'stream/rdd_rocks19.ybn',
'stream/rdd_rocks19.ydr',
'stream/rdd_rocks20.ybn',
'stream/rdd_rocks20.ydr',
'stream/rdd_rocks21.ybn',
'stream/rdd_rocks21.ydr',
'stream/rdd_ruins.ybn',
'stream/rdd_ruins.ydr',
'stream/rdd_shelter.ybn',
'stream/rdd_shelter.ydr',
'stream/rdd_ship.ybn',
'stream/rdd_ship.ydr',
'stream/rdd_terrain_1.ybn',
'stream/rdd_terrain_1.ydr',
'stream/rdd_terrain_2.ybn',
'stream/rdd_terrain_2.ydr',
'stream/rdd_terrain_3.ybn',
'stream/rdd_terrain_3.ydr',
'stream/rdd_terrain_4.ybn',
'stream/rdd_terrain_4.ydr',
'stream/rdd_terrain_5.ybn',
'stream/rdd_terrain_5.ydr',
'stream/rdd_terrain_6.ybn',
'stream/rdd_terrain_6.ydr',
'stream/rdd_terrain_7.ybn',
'stream/rdd_terrain_7.ydr',
'stream/rdd_terrain_8.ybn',
'stream/rdd_terrain_8.ydr',
'stream/rdd_terrain_9.ybn',
'stream/rdd_terrain_9.ydr',
'stream/rdd_terrain_10.ybn',
'stream/rdd_terrain_10.ydr',
'stream/rdd_terrain_11.ybn',
'stream/rdd_terrain_11.ydr',
'stream/rdd_terrain_12.ybn',
'stream/rdd_terrain_12.ydr',
'stream/rdd_terrain_13.ybn',
'stream/rdd_terrain_13.ydr',
'stream/rdd_terrain_14.ybn',
'stream/rdd_terrain_14.ydr',
'stream/rdd_terrain_15.ybn',
'stream/rdd_terrain_15.ydr',
'stream/rdd_terrain_16.ybn',
'stream/rdd_terrain_16.ydr',
'stream/rdd_terrain_17.ybn',
'stream/rdd_terrain_17.ydr',
'stream/rdd_terrain_18.ybn',
'stream/rdd_terrain_18.ydr',
'stream/rdd_terrain_19.ybn',
'stream/rdd_terrain_19.ydr',
'stream/rdd_terrain_20.ybn',
'stream/rdd_terrain_20.ydr',
'stream/rdd_terrain_21.ybn',
'stream/rdd_terrain_21.ydr',
'stream/rdd_terrain_22.ybn',
'stream/rdd_terrain_22.ydr',
'stream/rdd_terrain_23.ybn',
'stream/rdd_terrain_23.ydr',
'stream/rdd_terrain_24.ybn',
'stream/rdd_terrain_24.ydr',
'stream/rdd_terrain_25.ybn',
'stream/rdd_terrain_25.ydr',
'stream/rdd_terrain_26.ybn',
'stream/rdd_terrain_26.ydr',
'stream/rdd_terrain_27.ybn',
'stream/rdd_terrain_27.ydr',
'stream/rdd_terrain_28.ybn',
'stream/rdd_terrain_28.ydr',
'stream/rdd_terrain_a1.ybn',
'stream/rdd_terrain_a1.ydr',
'stream/rdd_terrain_a2.ybn',
'stream/rdd_terrain_a2.ydr',
'stream/rdd_terrain_a3.ybn',
'stream/rdd_terrain_a3.ydr',
'stream/rdd_terrain_a4.ybn',
'stream/rdd_terrain_a4.ydr',
'stream/rdd_terrain_a5.ybn',
'stream/rdd_terrain_a5.ydr',
'stream/rdd_terrain_a6.ybn',
'stream/rdd_terrain_a6.ydr',
'stream/rdd_terrain_a7.ybn',
'stream/rdd_terrain_a7.ydr',
'stream/rdd_terrain_a8.ybn',
'stream/rdd_terrain_a8.ydr',
'stream/rdd_terrain_a9.ybn',
'stream/rdd_terrain_a9.ydr',
'stream/rdd_terrain_a10.ybn',
'stream/rdd_terrain_a10.ydr',
'stream/rdd_town1.ybn',
'stream/rdd_town1.ydr',
'stream/rdd_town2.ybn',
'stream/rdd_town2.ydr',
'stream/rdd_w_cabins.ybn',
'stream/rdd_w_cabins.ydr',
'stream/rdd_w_fence_farm.ybn',
'stream/rdd_w_fence_farm.ydr',
'stream/rdd_w_fence_ghost.ybn',
'stream/rdd_w_fence_ghost.ydr',
'stream/rdd_w_fence_town.ybn',
'stream/rdd_w_fence_town.ydr',
'stream/rdd_wreck_villa.ybn',
'stream/rdd_wreck_villa.ydr',
}
|
package.loaded.wvolume = nil
local module_path = (...):match("(.+)%.[^%.]+$") or ""
local module = require(module_path .. "wvolume.main")
return module
|
local drawableSprite = require("structs.drawable_sprite")
local templeMirrorPortal = {}
templeMirrorPortal.name = "templeMirrorPortal"
templeMirrorPortal.depth = -1999
templeMirrorPortal.placements = {
name = "temple_mirror_portal",
}
local frameTexture = "objects/temple/portal/portalframe"
local curtainTexture = "objects/temple/portal/portalcurtain00"
local torchTexture = "objects/temple/portal/portaltorch00"
local torchOffset = 90
function templeMirrorPortal.sprite(room, entity)
local frameSprite = drawableSprite.fromTexture(frameTexture, entity)
local curtainSprite = drawableSprite.fromTexture(curtainTexture, entity)
local torchSpriteLeft = drawableSprite.fromTexture(torchTexture, entity)
local torchSpriteRight = drawableSprite.fromTexture(torchTexture, entity)
torchSpriteLeft:addPosition(-torchOffset, 0)
torchSpriteLeft:setJustification(0.5, 0.75)
torchSpriteRight:addPosition(torchOffset, 0)
torchSpriteRight:setJustification(0.5, 0.75)
local sprites = {
frameSprite,
curtainSprite,
torchSpriteLeft,
torchSpriteRight
}
return sprites
end
return templeMirrorPortal
|
local mechanic = false
local mechanicshop = {}
mechanicshop = { ['x'] = -338.37,['y'] = -137.28,['z'] = 38.25,['h'] = 68.75, ['info'] = ' jajkaj' }
doorleave = { ['x'] = -338.37,['y'] = -137.28,['z'] = 38.25 }
local blipEn = false
local upgrades = {
[1] = "Extractors 5 Scrap Metal", -- increase speed 5% -- $1000
[2] = "Air Filter - 5 Plastic", -- increase speed 2% -- $100
[3] = "Racing Suspension - 5 Rubber", -- increase handling 3% -- $3000
[4] = "Racing Rollbars - 10 Rubber", -- increase handling 3% -- $4000
[5] = "Bored Cyclinders - 5 Scrap Metal", -- increase speed 5% -- $1800
[6] = "Lightened Panels - 30 Plastic", -- $7000
[7] = "Front Left Inventory - 20 Plastic", -- $5000
[8] = "Front Right Inventory - 20 Plastic", -- $5000
[9] = "Back Left Inventory - 20 Plastic", -- $5000
[10] = "Back Right Inventory - 20 Plastic", -- $5000
}
local upgradeItems = {
[1] = { ["itemname"] = "Scrap Metal", ["itemid"] = "scrapmetal", ["count"] = 5},
[2] = { ["itemname"] = "Plastic", ["itemid"] = "plastic", ["count"] = 5},
[3] = { ["itemname"] = "Rubber", ["itemid"] = "rubber", ["count"] = 5},
[4] = { ["itemname"] = "Rubber", ["itemid"] = "rubber", ["count"] = 10},
[5] = { ["itemname"] = "Scrap Metal", ["itemid"] = "scrapmetal", ["count"] = 5},
[6] = { ["itemname"] = "Plastic", ["itemid"] = "plastic", ["count"] = 30},
[7] = { ["itemname"] = "Plastic", ["itemid"] = "plastic", ["count"] = 20},
[8] = { ["itemname"] = "Plastic", ["itemid"] = "plastic", ["count"] = 20},
[9] = { ["itemname"] = "Plastic", ["itemid"] = "plastic", ["count"] = 20},
[10] = { ["itemname"] = "Plastic", ["itemid"] = "plastic", ["count"] = 20},
}
local carsUpgrades = {}
RegisterNetEvent("client:illegal:upgrades")
AddEventHandler("client:illegal:upgrades",function(Extractors,Filter,Suspension,Rollbars,Bored,Carbon,lplate,LFront,RFront,LBack,RBack)
carsUpgrades[lplate] = {}
carsUpgrades[lplate][1] = Extractors
carsUpgrades[lplate][2] = Filter
carsUpgrades[lplate][3] = Suspension
carsUpgrades[lplate][4] = Rollbars
carsUpgrades[lplate][5] = Bored
carsUpgrades[lplate][6] = Carbon
carsUpgrades[lplate][7] = LFront
carsUpgrades[lplate][8] = RFront
carsUpgrades[lplate][9] = LBack
carsUpgrades[lplate][10] = RBack
end)
RegisterNetEvent('whitelist:illegal:mechanic')
AddEventHandler('whitelist:illegal:mechanic', function()
mechanic = not mechanic
end)
RegisterNetEvent('client:illegal:upgrades:accept')
AddEventHandler('client:illegal:upgrades:accept', function(lplate,partnum,resFac)
carsUpgrades[lplate][partnum] = resFac
end)
enteredcar = 0
usingpart = false
partloc = { ['x'] = -341.31,['y'] = -140.92,['z'] = 39.03,['h'] = 180.83, ['info'] = ' Boxes :)' }
function SelectUpgrade()
zz = false
animCar()
end
function GrabParts()
Citizen.Trace("Grabbing Parts")
local curplate = GetVehicleNumberPlateText(enteredcar)
if carsUpgrades[curplate] == nil then
TriggerEvent("DoShortHudText", "Invalid Vehicle Registration.",2)
Citizen.Trace("AI car")
return
end
usingpart = true
for i = 1, 6 do
SetVehicleDoorOpen(enteredcar, i, 0, 0)
end
RequestAnimDict('anim@heists@box_carry@')
while not HasAnimDictLoaded("anim@heists@box_carry@") do
Citizen.Wait(0)
end
TriggerEvent("attachItemChop",'MetalPart')
local pos = GetEntityCoords(PlayerPedId())
local carloc1 = GetOffsetFromEntityInWorldCoords(enteredcar, 0.0, 2.0, 0.0)
local carloc2 = GetOffsetFromEntityInWorldCoords(enteredcar, 1.0, 1.5, 0.0)
local carloc3 = GetOffsetFromEntityInWorldCoords(enteredcar, -1.0, -1.5, 0.0)
local carloc4 = GetOffsetFromEntityInWorldCoords(enteredcar, 1.0, -1.5, 0.0)
local carloc5 = GetOffsetFromEntityInWorldCoords(enteredcar, -1.0, 1.5, 0.0)
local carloc6 = GetOffsetFromEntityInWorldCoords(enteredcar, 0.0, -2.0, 0.0)
--right front
local carloc7 = GetOffsetFromEntityInWorldCoords(enteredcar, -0.55, 0.8, 0.0)
--left front
local carloc8 = GetOffsetFromEntityInWorldCoords(enteredcar, 0.55, 0.8, 0.0)
-- left back
local carloc9 = GetOffsetFromEntityInWorldCoords(enteredcar, -0.7, -0.8, 0.0)
-- right back
local carloc10 = GetOffsetFromEntityInWorldCoords(enteredcar, 0.7, -0.8, 0.0)
local zz1 = true
local pushObj = 0
while zz1 do
pos = GetEntityCoords(PlayerPedId())
local dst1 = #(vector3(carloc1["x"],carloc1["y"],carloc1["z"]) - pos)
local dst2 = #(vector3(carloc2["x"],carloc2["y"],carloc2["z"]) - pos)
local dst3 = #(vector3(carloc3["x"],carloc3["y"],carloc3["z"]) - pos)
local dst4 = #(vector3(carloc4["x"],carloc4["y"],carloc4["z"]) - pos)
local dst5 = #(vector3(carloc5["x"],carloc5["y"],carloc5["z"]) - pos)
local dst6 = #(vector3(carloc6["x"],carloc6["y"],carloc6["z"]) - pos)
local dst7 = #(vector3(partloc["x"],partloc["y"],partloc["z"]) - pos)
local dst8 = #(vector3(carloc7["x"],carloc7["y"],carloc7["z"]) - pos)
local dst9 = #(vector3(carloc8["x"],carloc8["y"],carloc8["z"]) - pos)
local dst10 = #(vector3(carloc9["x"],carloc9["y"],carloc9["z"]) - pos)
local dst11 = #(vector3(carloc10["x"],carloc10["y"],carloc10["z"]) - pos)
Citizen.Wait(1)
if dst7 < 1.5 then
if IsControlJustReleased(2, Controlkey["generalUseThird"][1]) then
pushObj = 0
zz1 = false
end
DrawText3DTest(partloc["x"],partloc["y"],partloc["z"], "["..Controlkey["generalUseThird"][2].."] to cancel adding parts!", 255,true)
elseif dst8 < 1.1 then
if IsControlJustReleased(2, Controlkey["generalUseThird"][1]) then
pushObj = 7
zz1 = false
end
if carsUpgrades[curplate][7] == 0 then
DrawText3DTest(carloc7["x"],carloc7["y"],carloc7["z"], "["..Controlkey["generalUseThird"][2].."] to install " .. upgrades[7] .. "!", 255,true)
else
DrawText3DTest(carloc7["x"],carloc7["y"],carloc7["z"], "["..Controlkey["generalUseThird"][2].."] to remove " .. upgrades[7] .. "!", 255,true)
end
elseif dst9 < 1.1 then
if IsControlJustReleased(2, Controlkey["generalUseThird"][1]) then
pushObj = 8
zz1 = false
end
if carsUpgrades[curplate][8] == 0 then
DrawText3DTest(carloc8["x"],carloc8["y"],carloc8["z"], "["..Controlkey["generalUseThird"][2].."] to install " .. upgrades[8] .. "!", 255,true)
else
DrawText3DTest(carloc8["x"],carloc8["y"],carloc8["z"], "["..Controlkey["generalUseThird"][2].."] to remove " .. upgrades[8] .. "!", 255,true)
end
elseif dst10 < 1.1 then
if GetNumberOfVehicleDoors(enteredcar) >= 5 then
if IsControlJustReleased(2, Controlkey["generalUseThird"][1]) then
pushObj = 9
zz1 = false
end
if carsUpgrades[curplate][9] == 0 then
DrawText3DTest(carloc9["x"],carloc9["y"],carloc9["z"], "["..Controlkey["generalUseThird"][2].."] to install " .. upgrades[9] .. "!", 255,true)
else
DrawText3DTest(carloc9["x"],carloc9["y"],carloc9["z"], "["..Controlkey["generalUseThird"][2].."] to remove " .. upgrades[9] .. "!", 255,true)
end
end
elseif dst11 < 1.1 then
if GetNumberOfVehicleDoors(enteredcar) >= 5 then
if IsControlJustReleased(2, Controlkey["generalUseThird"][1]) then
pushObj = 10
zz1 = false
end
if carsUpgrades[curplate][10] == 0 then
DrawText3DTest(carloc10["x"],carloc10["y"],carloc10["z"], "["..Controlkey["generalUseThird"][2].."] to install " .. upgrades[10] .. "!", 255,true)
else
DrawText3DTest(carloc10["x"],carloc10["y"],carloc10["z"], "["..Controlkey["generalUseThird"][2].."] to remove " .. upgrades[10] .. "!", 255,true)
end
end
elseif dst1 < 1.5 then
if IsControlJustReleased(2, Controlkey["generalUseThird"][1]) then
pushObj = 1
zz1 = false
end
if carsUpgrades[curplate][1] == 0 then
DrawText3DTest(carloc1["x"],carloc1["y"],carloc1["z"], "["..Controlkey["generalUseThird"][2].."] to install " .. upgrades[1] .. "!", 255,true)
else
DrawText3DTest(carloc1["x"],carloc1["y"],carloc1["z"], "["..Controlkey["generalUseThird"][2].."] to remove " .. upgrades[1] .. "!", 255,true)
end
elseif dst2 < 1.5 then
if IsControlJustReleased(2, Controlkey["generalUseThird"][1]) then
pushObj = 2
zz1 = false
end
if carsUpgrades[curplate][2] == 0 then
DrawText3DTest(carloc2["x"],carloc2["y"],carloc2["z"], "["..Controlkey["generalUseThird"][2].."] to install " .. upgrades[2] .. "!", 255,true)
else
DrawText3DTest(carloc2["x"],carloc2["y"],carloc2["z"], "["..Controlkey["generalUseThird"][2].."] to remove " .. upgrades[2] .. "!", 255,true)
end
elseif dst3 < 1.5 then
if IsControlJustReleased(2, Controlkey["generalUseThird"][1]) then
pushObj = 3
zz1 = false
end
if carsUpgrades[curplate][3] == 0 then
DrawText3DTest(carloc3["x"],carloc3["y"],carloc3["z"], "["..Controlkey["generalUseThird"][2].."] to install " .. upgrades[3] .. "!", 255,true)
else
DrawText3DTest(carloc3["x"],carloc3["y"],carloc3["z"], "["..Controlkey["generalUseThird"][2].."] to remove " .. upgrades[3] .. "!", 255,true)
end
elseif dst4 < 1.5 then
if IsControlJustReleased(2, Controlkey["generalUseThird"][1]) then
pushObj = 4
zz1 = false
end
if carsUpgrades[curplate][4] == 0 then
DrawText3DTest(carloc4["x"],carloc4["y"],carloc4["z"], "["..Controlkey["generalUseThird"][2].."] to install " .. upgrades[4] .. "!", 255,true)
else
DrawText3DTest(carloc4["x"],carloc4["y"],carloc4["z"], "["..Controlkey["generalUseThird"][2].."] to remove " .. upgrades[4] .. "!", 255,true)
end
elseif dst5 < 1.5 then
if IsControlJustReleased(2, Controlkey["generalUseThird"][1]) then
pushObj = 5
zz1 = false
end
if carsUpgrades[curplate][5] == 0 then
DrawText3DTest(carloc5["x"],carloc5["y"],carloc5["z"], "["..Controlkey["generalUseThird"][2].."] to install " .. upgrades[5] .. "!", 255,true)
else
DrawText3DTest(carloc5["x"],carloc5["y"],carloc5["z"], "["..Controlkey["generalUseThird"][2].."] to remove " .. upgrades[5] .. "!", 255,true)
end
elseif dst6 < 1.5 then
if IsControlJustReleased(2, Controlkey["generalUseThird"][1]) then
pushObj = 6
zz1 = false
end
if carsUpgrades[curplate][6] == 0 then
DrawText3DTest(carloc6["x"],carloc6["y"],carloc6["z"], "["..Controlkey["generalUseThird"][2].."] to install " .. upgrades[6] .. "!", 255,true)
else
DrawText3DTest(carloc6["x"],carloc6["y"],carloc6["z"], "["..Controlkey["generalUseThird"][2].."] to remove " .. upgrades[6] .. "!", 255,true)
end
else
DrawText3DTest(carloc1["x"],carloc1["y"],carloc1["z"], "Move here to modify " .. upgrades[1] .. "!", 255,true)
DrawText3DTest(carloc2["x"],carloc2["y"],carloc2["z"], "Move here to modify " .. upgrades[2] .. "!", 255,true)
DrawText3DTest(carloc3["x"],carloc3["y"],carloc3["z"], "Move here to modify " .. upgrades[3] .. "!", 255,true)
DrawText3DTest(carloc4["x"],carloc4["y"],carloc4["z"], "Move here to modify " .. upgrades[4] .. "!", 255,true)
DrawText3DTest(carloc5["x"],carloc5["y"],carloc5["z"], "Move here to modify " .. upgrades[5] .. "!", 255,true)
DrawText3DTest(carloc6["x"],carloc6["y"],carloc6["z"], "Move here to modify " .. upgrades[6] .. "!", 255,true)
DrawText3DTest(carloc7["x"],carloc7["y"],carloc7["z"], "Move here to modify " .. upgrades[7] .. "!", 255,true)
DrawText3DTest(carloc8["x"],carloc8["y"],carloc8["z"], "Move here to modify " .. upgrades[8] .. "!", 255,true)
if GetNumberOfVehicleDoors(enteredcar) >= 5 then
DrawText3DTest(carloc9["x"],carloc9["y"],carloc9["z"], "Move here to modify " .. upgrades[9] .. "!", 255,true)
DrawText3DTest(carloc10["x"],carloc10["y"],carloc10["z"], "Move here to modify " .. upgrades[10] .. "!", 255,true)
end
end
if not IsEntityPlayingAnim(PlayerPedId(), "anim@heists@box_carry@", "idle", 3) then
TaskPlayAnim(PlayerPedId(), "anim@heists@box_carry@", "idle", 8.0, -8, -1, 49, 0, 0, 0, 0)
end
end
TriggerEvent("attachRemoveChopShop")
if pushObj ~= 0 then
local itemcount = exports["npc-inventory"]:getQuantity(upgradeItems[pushObj]["itemid"])
if itemcount < upgradeItems[pushObj]["count"] then
TriggerEvent("DoLongHudText","You do not have enough ".. upgradeItems[pushObj]["itemname"] .. "(".. upgradeItems[pushObj]["count"] ..")")
ClearPedTasksImmediately(PlayerPedId())
usingpart = false
return
end
TriggerEvent("inventory:removeItem", upgradeItems[pushObj]["itemid"], upgradeItems[pushObj]["count"])
TriggerServerEvent("upgradeAttempt:illegalparts",pushObj,curplate)
playDrillz()
end
ClearPedTasksImmediately(PlayerPedId())
usingpart = false
end
function animCarz()
Citizen.Trace("anim car")
RequestAnimDict('mp_car_bomb')
while not HasAnimDictLoaded("mp_car_bomb") do
Citizen.Wait(0)
end
if not IsEntityPlayingAnim(PlayerPedId(), "mp_car_bomb", "car_bomb_mechanic", 3) then
TaskPlayAnim(PlayerPedId(), "mp_car_bomb", "car_bomb_mechanic", 8.0, -8, -1, 49, 0, 0, 0, 0)
end
Citizen.Wait(2200)
ClearPedTasks(PlayerPedId())
end
function playDrillz()
FreezeEntityPosition(PlayerPedId(),true)
Citizen.Trace("drilling")
animCarz()
TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 2.0, 'impactdrill', 0.5)
animCarz()
animCarz()
TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 2.0, 'impactdrill', 0.5)
animCarz()
animCarz()
TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 2.0, 'impactdrill', 0.5)
animCarz()
animCarz()
TriggerServerEvent('InteractSound_SV:PlayWithinDistance', 2.0, 'impactdrill', 0.5)
animCarz()
animCarz()
FreezeEntityPosition(PlayerPedId(),false)
end
RegisterNetEvent('illegal_carshop:leave')
AddEventHandler('illegal_carshop:leave', function()
local veh = GetVehiclePedIsIn(PlayerPedId(), false)
if veh == 0 or veh == nil then
veh = PlayerPedId()
end
SetEntityCoords(veh,mechanicshop["x"],mechanicshop["y"],mechanicshop["z"])
end)
RegisterNetEvent('chopshop:leave')
AddEventHandler('chopshop:leave', function()
local pos = GetEntityCoords(PlayerPedId())
local distance2 = #(vector3(-338.37,-137.28,38.25) - pos)
local veh = GetVehiclePedIsIn(PlayerPedId(), false)
local driverPed = GetPedInVehicleSeat(veh, -1)
if distance2 < 30.0 and PlayerPedId() ~= driverPed then
TaskLeaveVehicle(PlayerPedId(), veh, 0)
Citizen.Wait(100)
end
end)
Citizen.CreateThread(function()
while true do
Wait(1)
local pos = GetEntityCoords(PlayerPedId())
local distance = #(vector3(mechanicshop["x"],mechanicshop["y"],mechanicshop["z"]) - pos)
local distance2 = #(vector3(-338.37,-137.28,38.25) - pos)
local distance3 = #(vector3(partloc["x"],partloc["y"],partloc["z"]) - pos)
local distanceoutdoor = #(vector3(doorleave["x"],doorleave["y"],doorleave["z"]) - pos)
if distance < 5 and mechanic and enteredcar == 0 then
if IsControlJustReleased(2, Controlkey["generalUse"][1]) and distance < 5 and GetVehiclePedIsIn(PlayerPedId(), false) ~= 0 then
veh = GetVehiclePedIsIn(PlayerPedId(), false)
enteredcar = veh
if veh == 0 or veh == nil then
veh = PlayerPedId()
end
SetEntityCoords(veh,-338.37,-137.28,38.25)
SetEntityHeading(veh,68.75)
Citizen.Wait(1000)
FreezeEntityPosition(veh,true)
end
DrawText3DTest(mechanicshop["x"],mechanicshop["y"],mechanicshop["z"], "["..Controlkey["generalUse"][2].."] to enter Mechanic Shop!", 255,true)
end
if mechanic and enteredcar ~= 0 then
local rank = exports["isPed"]:GroupRank("illegal_carshop")
if distance2 < 4 and not usingpart then
if IsControlJustReleased(2, Controlkey["generalUse"][1]) and GetVehiclePedIsIn(PlayerPedId(), false) ~= 0 then
veh = GetVehiclePedIsIn(PlayerPedId(), false)
local driverPed = GetPedInVehicleSeat(veh, -1)
if PlayerPedId() == driverPed then
local plt = GetVehicleNumberPlateText(veh)
TriggerServerEvent("respawn:illegalpartveh",plt)
end
--SetEntityCoords(PlayerPedId(),mechanicshop["x"],mechanicshop["y"],mechanicshop["z"])
--SetEntityHeading(PlayerPedId(),353.25765991211)
FreezeEntityPosition(veh,false)
enteredcar = 0
Citizen.Wait(1000)
end
DrawText3DTest(-338.37,-137.28,38.25, "["..Controlkey["generalUse"][2].."] to leave!", 255,true)
end
if distance3 < 1.5 and enteredcar ~= 0 and rank > 3 then
if IsControlJustReleased(2, Controlkey["generalUseThird"][1]) and not usingpart then
GrabParts()
Citizen.Wait(1000)
end
DrawText3DTest(partloc["x"],partloc["y"],partloc["z"], "["..Controlkey["generalUseThird"][2].."] to grab upgrade parts!", 255,true)
end
end
end
end)
RegisterNetEvent('illegal_carshop:signon')
AddEventHandler('illegal_carshop:signon', function()
local rank = exports["isPed"]:GroupRank("illegal_carshop")
if rank > 2 then
TriggerServerEvent("server:pass","illegal_carshop")
end
end)
RegisterNetEvent('illegal_carshop:SpawnVehicle')
AddEventHandler('illegal_carshop:SpawnVehicle', function(vehicle, plate, customized, state, Fuel)
local customized = json.decode(customized)
Citizen.CreateThread(function()
Citizen.Wait(100)
if Fuel < 5 then
Fuel = 5
end
DecorSetInt(veh, "CurrentFuel", Fuel)
SetVehicleOnGroundProperly(veh)
SetEntityInvincible(veh, false)
SetVehicleModKit(veh, 0)
SetVehicleNumberPlateText(veh, plate)
if customized then
SetVehicleWheelType(veh, customized.wheeltype)
SetVehicleNumberPlateTextIndex(veh, 3)
for i = 0, 16 do
SetVehicleMod(veh, i, customized.mods[tostring(i)])
end
for i = 17, 22 do
ToggleVehicleMod(veh, i, customized.mods[tostring(i)])
end
for i = 23, 24 do
SetVehicleMod(veh, i, customized.mods[tostring(i)])
end
for i = 0, 3 do
SetVehicleNeonLightEnabled(veh, i, customized.neon[tostring(i)])
end
SetVehicleColours(veh, customized.colors[1], customized.colors[2])
SetVehicleExtraColours(veh, customized.extracolors[1], customized.extracolors[2])
SetVehicleNeonLightsColour(veh, customized.lights[1], customized.lights[2], customized.lights[3])
SetVehicleTyreSmokeColor(veh, customized.smokecolor[1], customized.smokecolor[2], customized.smokecolor[3])
SetVehicleWindowTint(veh, customized.tint)
else
SetVehicleColours(veh, 0, 0)
SetVehicleExtraColours(veh, 0, 0)
end
TriggerEvent("keys:addNew",veh,plate)
SetVehicleHasBeenOwnedByPlayer(veh,true)
local id = NetworkGetNetworkIdFromEntity(veh)
SetNetworkIdCanMigrate(id, true)
if GetEntityModel(vehicle) == `rumpo` then
SetVehicleLivery(veh,0)
end
FreezeEntityPosition(veh,false)
TriggerServerEvent('garages:SetVehOut', vehicle, plate)
SetPedIntoVehicle(PlayerPedId(), veh, - 1)
TriggerServerEvent('veh.getVehicles', plate, veh)
TriggerServerEvent("garages:CheckGarageForVeh")
SetEntityAsMissionEntity(veh,false,true)
end)
end)
|
local imagine = require('imagine')
local log = require('log')
local KEY_LIFETIME = 60
local function create(key, ...)
box.space.key:insert({key, os.time(), ...})
end
local function delete(key)
box.space.key:delete({key})
end
local function get(key)
return box.space.key:select({key})
end
local function init()
box.schema.create_space('key', {if_not_exists = true})
box.space.key:create_index('pk', {type = 'hash', parts = {1, 'str'}, if_not_exists = true})
require('expirationd').run_task(
'project_expiration_task',
'key',
function (args, t) return t[2] + KEY_LIFETIME < os.time() end,
function (space, args, t) delete(t[1]) end
)
log.info('init ok')
end
imagine.init({
init_func = init,
roles = {
client_role = {
table = 'key',
funcs = {
create = imagine.atomic(create),
delete = imagine.atomic(delete),
get = imagine.atomic(get),
},
},
},
graphite = {
prefix = 'project',
ip = '127.0.0.1',
port = 2003,
},
})
|
project "CppSharp.Parser.Bootstrap"
SetupManagedProject()
kind "ConsoleApp"
language "C#"
debugdir "."
files { "Bootstrap.cs", "*.lua" }
links { "CppSharp", "CppSharp.AST", "CppSharp.Generator", "CppSharp.Parser" }
filter { "action:not netcore" }
links { "System", "System.Core" }
SetupParser()
|
local skillValues = {
plume = 10,
ebony = 65,
daedric = 80
}
local newMaterials = {
trama = {
id = "_trama",
description = "Trama Root",
ingredients = {
{ id = "ingred_trama_root_01", count = 1 },
},
skillReq = skillValues.plume
},
cork = {
id = "_corkbulb",
description = "Corkbulb Root",
ingredients = {
{ id = "ingred_corkbulb_root_01", count = 1 },
},
skillReq = skillValues.plume
},
ebony = {
id = "_ebony",
description = "Ebony",
ingredients = {
{ id = "ingred_raw_ebony_01", count = 1 },
},
skillReq = skillValues.ebony
},
daedric = {
id = "_daedric",
description = "Daedric",
ingredients = {
{ id = "ingred_raw_ebony_01", count = 1 },
{ id = "ingred_daedras_heart_01", count = 1},
},
skillReq = skillValues.daedric
}
}
local recipes = require("mer.goFletch.recipes")
table.copy(newMaterials, recipes.materials)
mwse.log("[Jay's Fletching for Go Fletch] New recipes registered succesfully!")
|
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
client_script 'SimpleCarHUD_cl.lua'
|
slot0 = require("protobuf")
slot1 = require("common_pb")
module("p24_pb")
CS_24002 = slot0.Descriptor()
SC_24003 = slot0.Descriptor()
CS_24004 = slot0.Descriptor()
SC_24005 = slot0.Descriptor()
SC_24010 = slot0.Descriptor()
CS_24011 = slot0.Descriptor()
SC_24012 = slot0.Descriptor()
GROUPINFO = slot0.Descriptor()
CHALLENGEINFO = slot0.Descriptor()
USERCHALLENGEINFO = slot0.Descriptor()
SHIPINCHALLENGE = slot0.Descriptor()
GROUPINFOINCHALLENGE = slot0.Descriptor()
COMMANDERINCHALLENGE = slot0.Descriptor()
({
CS_24002_ACTIVITY_ID_FIELD = slot0.FieldDescriptor(),
CS_24002_GROUP_LIST_FIELD = slot0.FieldDescriptor(),
CS_24002_MODE_FIELD = slot0.FieldDescriptor(),
SC_24003_RESULT_FIELD = slot0.FieldDescriptor(),
CS_24004_ACTIVITY_ID_FIELD = slot0.FieldDescriptor(),
SC_24005_RESULT_FIELD = slot0.FieldDescriptor(),
SC_24005_CURRENT_CHALLENGE_FIELD = slot0.FieldDescriptor(),
SC_24005_USER_CHALLENGE_FIELD = slot0.FieldDescriptor(),
SC_24010_SCORE_FIELD = slot0.FieldDescriptor(),
CS_24011_ACTIVITY_ID_FIELD = slot0.FieldDescriptor(),
CS_24011_MODE_FIELD = slot0.FieldDescriptor(),
SC_24012_RESULT_FIELD = slot0.FieldDescriptor(),
GROUPINFO_ID_FIELD = slot0.FieldDescriptor(),
GROUPINFO_SHIP_LIST_FIELD = slot0.FieldDescriptor(),
GROUPINFO_COMMANDERS_FIELD = slot0.FieldDescriptor(),
CHALLENGEINFO_SEASON_MAX_SCORE_FIELD = slot0.FieldDescriptor(),
CHALLENGEINFO_ACTIVITY_MAX_SCORE_FIELD = slot0.FieldDescriptor(),
CHALLENGEINFO_SEASON_MAX_LEVEL_FIELD = slot0.FieldDescriptor(),
CHALLENGEINFO_ACTIVITY_MAX_LEVEL_FIELD = slot0.FieldDescriptor(),
CHALLENGEINFO_SEASON_ID_FIELD = slot0.FieldDescriptor(),
CHALLENGEINFO_DUNGEON_ID_LIST_FIELD = slot0.FieldDescriptor(),
CHALLENGEINFO_BUFF_LIST_FIELD = slot0.FieldDescriptor(),
USERCHALLENGEINFO_CURRENT_SCORE_FIELD = slot0.FieldDescriptor(),
USERCHALLENGEINFO_LEVEL_FIELD = slot0.FieldDescriptor(),
USERCHALLENGEINFO_GROUPINC_LIST_FIELD = slot0.FieldDescriptor(),
USERCHALLENGEINFO_MODE_FIELD = slot0.FieldDescriptor(),
USERCHALLENGEINFO_ISSL_FIELD = slot0.FieldDescriptor(),
USERCHALLENGEINFO_SEASON_ID_FIELD = slot0.FieldDescriptor(),
USERCHALLENGEINFO_DUNGEON_ID_LIST_FIELD = slot0.FieldDescriptor(),
USERCHALLENGEINFO_BUFF_LIST_FIELD = slot0.FieldDescriptor(),
SHIPINCHALLENGE_ID_FIELD = slot0.FieldDescriptor(),
SHIPINCHALLENGE_HP_RANT_FIELD = slot0.FieldDescriptor(),
SHIPINCHALLENGE_SHIP_INFO_FIELD = slot0.FieldDescriptor(),
GROUPINFOINCHALLENGE_ID_FIELD = slot0.FieldDescriptor(),
GROUPINFOINCHALLENGE_SHIPS_FIELD = slot0.FieldDescriptor(),
GROUPINFOINCHALLENGE_COMMANDERS_FIELD = slot0.FieldDescriptor(),
COMMANDERINCHALLENGE_POS_FIELD = slot0.FieldDescriptor(),
COMMANDERINCHALLENGE_COMMANDERINFO_FIELD = slot0.FieldDescriptor()
})["CS_24002_ACTIVITY_ID_FIELD"].name = "activity_id"
()["CS_24002_ACTIVITY_ID_FIELD"].full_name = "p24.cs_24002.activity_id"
()["CS_24002_ACTIVITY_ID_FIELD"].number = 1
()["CS_24002_ACTIVITY_ID_FIELD"].index = 0
()["CS_24002_ACTIVITY_ID_FIELD"].label = 2
()["CS_24002_ACTIVITY_ID_FIELD"].has_default_value = false
()["CS_24002_ACTIVITY_ID_FIELD"].default_value = 0
()["CS_24002_ACTIVITY_ID_FIELD"].type = 13
()["CS_24002_ACTIVITY_ID_FIELD"].cpp_type = 3
()["CS_24002_GROUP_LIST_FIELD"].name = "group_list"
()["CS_24002_GROUP_LIST_FIELD"].full_name = "p24.cs_24002.group_list"
()["CS_24002_GROUP_LIST_FIELD"].number = 2
()["CS_24002_GROUP_LIST_FIELD"].index = 1
()["CS_24002_GROUP_LIST_FIELD"].label = 3
()["CS_24002_GROUP_LIST_FIELD"].has_default_value = false
()["CS_24002_GROUP_LIST_FIELD"].default_value = {}
()["CS_24002_GROUP_LIST_FIELD"].message_type = GROUPINFO
()["CS_24002_GROUP_LIST_FIELD"].type = 11
()["CS_24002_GROUP_LIST_FIELD"].cpp_type = 10
()["CS_24002_MODE_FIELD"].name = "mode"
()["CS_24002_MODE_FIELD"].full_name = "p24.cs_24002.mode"
()["CS_24002_MODE_FIELD"].number = 3
()["CS_24002_MODE_FIELD"].index = 2
()["CS_24002_MODE_FIELD"].label = 2
()["CS_24002_MODE_FIELD"].has_default_value = false
()["CS_24002_MODE_FIELD"].default_value = 0
()["CS_24002_MODE_FIELD"].type = 13
()["CS_24002_MODE_FIELD"].cpp_type = 3
CS_24002.name = "cs_24002"
CS_24002.full_name = "p24.cs_24002"
CS_24002.nested_types = {}
CS_24002.enum_types = {}
CS_24002.fields = {
()["CS_24002_ACTIVITY_ID_FIELD"],
()["CS_24002_GROUP_LIST_FIELD"],
()["CS_24002_MODE_FIELD"]
}
CS_24002.is_extendable = false
CS_24002.extensions = {}
()["SC_24003_RESULT_FIELD"].name = "result"
()["SC_24003_RESULT_FIELD"].full_name = "p24.sc_24003.result"
()["SC_24003_RESULT_FIELD"].number = 1
()["SC_24003_RESULT_FIELD"].index = 0
()["SC_24003_RESULT_FIELD"].label = 2
()["SC_24003_RESULT_FIELD"].has_default_value = false
()["SC_24003_RESULT_FIELD"].default_value = 0
()["SC_24003_RESULT_FIELD"].type = 13
()["SC_24003_RESULT_FIELD"].cpp_type = 3
SC_24003.name = "sc_24003"
SC_24003.full_name = "p24.sc_24003"
SC_24003.nested_types = {}
SC_24003.enum_types = {}
SC_24003.fields = {
()["SC_24003_RESULT_FIELD"]
}
SC_24003.is_extendable = false
SC_24003.extensions = {}
()["CS_24004_ACTIVITY_ID_FIELD"].name = "activity_id"
()["CS_24004_ACTIVITY_ID_FIELD"].full_name = "p24.cs_24004.activity_id"
()["CS_24004_ACTIVITY_ID_FIELD"].number = 1
()["CS_24004_ACTIVITY_ID_FIELD"].index = 0
()["CS_24004_ACTIVITY_ID_FIELD"].label = 2
()["CS_24004_ACTIVITY_ID_FIELD"].has_default_value = false
()["CS_24004_ACTIVITY_ID_FIELD"].default_value = 0
()["CS_24004_ACTIVITY_ID_FIELD"].type = 13
()["CS_24004_ACTIVITY_ID_FIELD"].cpp_type = 3
CS_24004.name = "cs_24004"
CS_24004.full_name = "p24.cs_24004"
CS_24004.nested_types = {}
CS_24004.enum_types = {}
CS_24004.fields = {
()["CS_24004_ACTIVITY_ID_FIELD"]
}
CS_24004.is_extendable = false
CS_24004.extensions = {}
()["SC_24005_RESULT_FIELD"].name = "result"
()["SC_24005_RESULT_FIELD"].full_name = "p24.sc_24005.result"
()["SC_24005_RESULT_FIELD"].number = 1
()["SC_24005_RESULT_FIELD"].index = 0
()["SC_24005_RESULT_FIELD"].label = 2
()["SC_24005_RESULT_FIELD"].has_default_value = false
()["SC_24005_RESULT_FIELD"].default_value = 0
()["SC_24005_RESULT_FIELD"].type = 13
()["SC_24005_RESULT_FIELD"].cpp_type = 3
()["SC_24005_CURRENT_CHALLENGE_FIELD"].name = "current_challenge"
()["SC_24005_CURRENT_CHALLENGE_FIELD"].full_name = "p24.sc_24005.current_challenge"
()["SC_24005_CURRENT_CHALLENGE_FIELD"].number = 2
()["SC_24005_CURRENT_CHALLENGE_FIELD"].index = 1
()["SC_24005_CURRENT_CHALLENGE_FIELD"].label = 2
()["SC_24005_CURRENT_CHALLENGE_FIELD"].has_default_value = false
()["SC_24005_CURRENT_CHALLENGE_FIELD"].default_value = nil
()["SC_24005_CURRENT_CHALLENGE_FIELD"].message_type = CHALLENGEINFO
()["SC_24005_CURRENT_CHALLENGE_FIELD"].type = 11
()["SC_24005_CURRENT_CHALLENGE_FIELD"].cpp_type = 10
()["SC_24005_USER_CHALLENGE_FIELD"].name = "user_challenge"
()["SC_24005_USER_CHALLENGE_FIELD"].full_name = "p24.sc_24005.user_challenge"
()["SC_24005_USER_CHALLENGE_FIELD"].number = 3
()["SC_24005_USER_CHALLENGE_FIELD"].index = 2
()["SC_24005_USER_CHALLENGE_FIELD"].label = 3
()["SC_24005_USER_CHALLENGE_FIELD"].has_default_value = false
()["SC_24005_USER_CHALLENGE_FIELD"].default_value = {}
()["SC_24005_USER_CHALLENGE_FIELD"].message_type = USERCHALLENGEINFO
()["SC_24005_USER_CHALLENGE_FIELD"].type = 11
()["SC_24005_USER_CHALLENGE_FIELD"].cpp_type = 10
SC_24005.name = "sc_24005"
SC_24005.full_name = "p24.sc_24005"
SC_24005.nested_types = {}
SC_24005.enum_types = {}
SC_24005.fields = {
()["SC_24005_RESULT_FIELD"],
()["SC_24005_CURRENT_CHALLENGE_FIELD"],
()["SC_24005_USER_CHALLENGE_FIELD"]
}
SC_24005.is_extendable = false
SC_24005.extensions = {}
()["SC_24010_SCORE_FIELD"].name = "score"
()["SC_24010_SCORE_FIELD"].full_name = "p24.sc_24010.score"
()["SC_24010_SCORE_FIELD"].number = 1
()["SC_24010_SCORE_FIELD"].index = 0
()["SC_24010_SCORE_FIELD"].label = 2
()["SC_24010_SCORE_FIELD"].has_default_value = false
()["SC_24010_SCORE_FIELD"].default_value = 0
()["SC_24010_SCORE_FIELD"].type = 13
()["SC_24010_SCORE_FIELD"].cpp_type = 3
SC_24010.name = "sc_24010"
SC_24010.full_name = "p24.sc_24010"
SC_24010.nested_types = {}
SC_24010.enum_types = {}
SC_24010.fields = {
()["SC_24010_SCORE_FIELD"]
}
SC_24010.is_extendable = false
SC_24010.extensions = {}
()["CS_24011_ACTIVITY_ID_FIELD"].name = "activity_id"
()["CS_24011_ACTIVITY_ID_FIELD"].full_name = "p24.cs_24011.activity_id"
()["CS_24011_ACTIVITY_ID_FIELD"].number = 1
()["CS_24011_ACTIVITY_ID_FIELD"].index = 0
()["CS_24011_ACTIVITY_ID_FIELD"].label = 2
()["CS_24011_ACTIVITY_ID_FIELD"].has_default_value = false
()["CS_24011_ACTIVITY_ID_FIELD"].default_value = 0
()["CS_24011_ACTIVITY_ID_FIELD"].type = 13
()["CS_24011_ACTIVITY_ID_FIELD"].cpp_type = 3
()["CS_24011_MODE_FIELD"].name = "mode"
()["CS_24011_MODE_FIELD"].full_name = "p24.cs_24011.mode"
()["CS_24011_MODE_FIELD"].number = 2
()["CS_24011_MODE_FIELD"].index = 1
()["CS_24011_MODE_FIELD"].label = 2
()["CS_24011_MODE_FIELD"].has_default_value = false
()["CS_24011_MODE_FIELD"].default_value = 0
()["CS_24011_MODE_FIELD"].type = 13
()["CS_24011_MODE_FIELD"].cpp_type = 3
CS_24011.name = "cs_24011"
CS_24011.full_name = "p24.cs_24011"
CS_24011.nested_types = {}
CS_24011.enum_types = {}
CS_24011.fields = {
()["CS_24011_ACTIVITY_ID_FIELD"],
()["CS_24011_MODE_FIELD"]
}
CS_24011.is_extendable = false
CS_24011.extensions = {}
()["SC_24012_RESULT_FIELD"].name = "result"
()["SC_24012_RESULT_FIELD"].full_name = "p24.sc_24012.result"
()["SC_24012_RESULT_FIELD"].number = 1
()["SC_24012_RESULT_FIELD"].index = 0
()["SC_24012_RESULT_FIELD"].label = 2
()["SC_24012_RESULT_FIELD"].has_default_value = false
()["SC_24012_RESULT_FIELD"].default_value = 0
()["SC_24012_RESULT_FIELD"].type = 13
()["SC_24012_RESULT_FIELD"].cpp_type = 3
SC_24012.name = "sc_24012"
SC_24012.full_name = "p24.sc_24012"
SC_24012.nested_types = {}
SC_24012.enum_types = {}
SC_24012.fields = {
()["SC_24012_RESULT_FIELD"]
}
SC_24012.is_extendable = false
SC_24012.extensions = {}
()["GROUPINFO_ID_FIELD"].name = "id"
()["GROUPINFO_ID_FIELD"].full_name = "p24.groupinfo.id"
()["GROUPINFO_ID_FIELD"].number = 1
()["GROUPINFO_ID_FIELD"].index = 0
()["GROUPINFO_ID_FIELD"].label = 2
()["GROUPINFO_ID_FIELD"].has_default_value = false
()["GROUPINFO_ID_FIELD"].default_value = 0
()["GROUPINFO_ID_FIELD"].type = 13
()["GROUPINFO_ID_FIELD"].cpp_type = 3
()["GROUPINFO_SHIP_LIST_FIELD"].name = "ship_list"
()["GROUPINFO_SHIP_LIST_FIELD"].full_name = "p24.groupinfo.ship_list"
()["GROUPINFO_SHIP_LIST_FIELD"].number = 2
()["GROUPINFO_SHIP_LIST_FIELD"].index = 1
()["GROUPINFO_SHIP_LIST_FIELD"].label = 3
()["GROUPINFO_SHIP_LIST_FIELD"].has_default_value = false
()["GROUPINFO_SHIP_LIST_FIELD"].default_value = {}
()["GROUPINFO_SHIP_LIST_FIELD"].type = 13
()["GROUPINFO_SHIP_LIST_FIELD"].cpp_type = 3
()["GROUPINFO_COMMANDERS_FIELD"].name = "commanders"
()["GROUPINFO_COMMANDERS_FIELD"].full_name = "p24.groupinfo.commanders"
()["GROUPINFO_COMMANDERS_FIELD"].number = 3
()["GROUPINFO_COMMANDERS_FIELD"].index = 2
()["GROUPINFO_COMMANDERS_FIELD"].label = 3
()["GROUPINFO_COMMANDERS_FIELD"].has_default_value = false
()["GROUPINFO_COMMANDERS_FIELD"].default_value = {}
()["GROUPINFO_COMMANDERS_FIELD"].message_type = slot1.COMMANDERSINFO
()["GROUPINFO_COMMANDERS_FIELD"].type = 11
()["GROUPINFO_COMMANDERS_FIELD"].cpp_type = 10
GROUPINFO.name = "groupinfo"
GROUPINFO.full_name = "p24.groupinfo"
GROUPINFO.nested_types = {}
GROUPINFO.enum_types = {}
GROUPINFO.fields = {
()["GROUPINFO_ID_FIELD"],
()["GROUPINFO_SHIP_LIST_FIELD"],
()["GROUPINFO_COMMANDERS_FIELD"]
}
GROUPINFO.is_extendable = false
GROUPINFO.extensions = {}
()["CHALLENGEINFO_SEASON_MAX_SCORE_FIELD"].name = "season_max_score"
()["CHALLENGEINFO_SEASON_MAX_SCORE_FIELD"].full_name = "p24.challengeinfo.season_max_score"
()["CHALLENGEINFO_SEASON_MAX_SCORE_FIELD"].number = 1
()["CHALLENGEINFO_SEASON_MAX_SCORE_FIELD"].index = 0
()["CHALLENGEINFO_SEASON_MAX_SCORE_FIELD"].label = 2
()["CHALLENGEINFO_SEASON_MAX_SCORE_FIELD"].has_default_value = false
()["CHALLENGEINFO_SEASON_MAX_SCORE_FIELD"].default_value = 0
()["CHALLENGEINFO_SEASON_MAX_SCORE_FIELD"].type = 13
()["CHALLENGEINFO_SEASON_MAX_SCORE_FIELD"].cpp_type = 3
()["CHALLENGEINFO_ACTIVITY_MAX_SCORE_FIELD"].name = "activity_max_score"
()["CHALLENGEINFO_ACTIVITY_MAX_SCORE_FIELD"].full_name = "p24.challengeinfo.activity_max_score"
()["CHALLENGEINFO_ACTIVITY_MAX_SCORE_FIELD"].number = 2
()["CHALLENGEINFO_ACTIVITY_MAX_SCORE_FIELD"].index = 1
()["CHALLENGEINFO_ACTIVITY_MAX_SCORE_FIELD"].label = 2
()["CHALLENGEINFO_ACTIVITY_MAX_SCORE_FIELD"].has_default_value = false
()["CHALLENGEINFO_ACTIVITY_MAX_SCORE_FIELD"].default_value = 0
()["CHALLENGEINFO_ACTIVITY_MAX_SCORE_FIELD"].type = 13
()["CHALLENGEINFO_ACTIVITY_MAX_SCORE_FIELD"].cpp_type = 3
()["CHALLENGEINFO_SEASON_MAX_LEVEL_FIELD"].name = "season_max_level"
()["CHALLENGEINFO_SEASON_MAX_LEVEL_FIELD"].full_name = "p24.challengeinfo.season_max_level"
()["CHALLENGEINFO_SEASON_MAX_LEVEL_FIELD"].number = 3
()["CHALLENGEINFO_SEASON_MAX_LEVEL_FIELD"].index = 2
()["CHALLENGEINFO_SEASON_MAX_LEVEL_FIELD"].label = 2
()["CHALLENGEINFO_SEASON_MAX_LEVEL_FIELD"].has_default_value = false
()["CHALLENGEINFO_SEASON_MAX_LEVEL_FIELD"].default_value = 0
()["CHALLENGEINFO_SEASON_MAX_LEVEL_FIELD"].type = 13
()["CHALLENGEINFO_SEASON_MAX_LEVEL_FIELD"].cpp_type = 3
()["CHALLENGEINFO_ACTIVITY_MAX_LEVEL_FIELD"].name = "activity_max_level"
()["CHALLENGEINFO_ACTIVITY_MAX_LEVEL_FIELD"].full_name = "p24.challengeinfo.activity_max_level"
()["CHALLENGEINFO_ACTIVITY_MAX_LEVEL_FIELD"].number = 4
()["CHALLENGEINFO_ACTIVITY_MAX_LEVEL_FIELD"].index = 3
()["CHALLENGEINFO_ACTIVITY_MAX_LEVEL_FIELD"].label = 2
()["CHALLENGEINFO_ACTIVITY_MAX_LEVEL_FIELD"].has_default_value = false
()["CHALLENGEINFO_ACTIVITY_MAX_LEVEL_FIELD"].default_value = 0
()["CHALLENGEINFO_ACTIVITY_MAX_LEVEL_FIELD"].type = 13
()["CHALLENGEINFO_ACTIVITY_MAX_LEVEL_FIELD"].cpp_type = 3
()["CHALLENGEINFO_SEASON_ID_FIELD"].name = "season_id"
()["CHALLENGEINFO_SEASON_ID_FIELD"].full_name = "p24.challengeinfo.season_id"
()["CHALLENGEINFO_SEASON_ID_FIELD"].number = 5
()["CHALLENGEINFO_SEASON_ID_FIELD"].index = 4
()["CHALLENGEINFO_SEASON_ID_FIELD"].label = 2
()["CHALLENGEINFO_SEASON_ID_FIELD"].has_default_value = false
()["CHALLENGEINFO_SEASON_ID_FIELD"].default_value = 0
()["CHALLENGEINFO_SEASON_ID_FIELD"].type = 13
()["CHALLENGEINFO_SEASON_ID_FIELD"].cpp_type = 3
()["CHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].name = "dungeon_id_list"
()["CHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].full_name = "p24.challengeinfo.dungeon_id_list"
()["CHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].number = 6
()["CHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].index = 5
()["CHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].label = 3
()["CHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].has_default_value = false
()["CHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].default_value = {}
()["CHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].type = 13
()["CHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].cpp_type = 3
()["CHALLENGEINFO_BUFF_LIST_FIELD"].name = "buff_list"
()["CHALLENGEINFO_BUFF_LIST_FIELD"].full_name = "p24.challengeinfo.buff_list"
()["CHALLENGEINFO_BUFF_LIST_FIELD"].number = 7
()["CHALLENGEINFO_BUFF_LIST_FIELD"].index = 6
()["CHALLENGEINFO_BUFF_LIST_FIELD"].label = 3
()["CHALLENGEINFO_BUFF_LIST_FIELD"].has_default_value = false
()["CHALLENGEINFO_BUFF_LIST_FIELD"].default_value = {}
()["CHALLENGEINFO_BUFF_LIST_FIELD"].type = 13
()["CHALLENGEINFO_BUFF_LIST_FIELD"].cpp_type = 3
CHALLENGEINFO.name = "challengeinfo"
CHALLENGEINFO.full_name = "p24.challengeinfo"
CHALLENGEINFO.nested_types = {}
CHALLENGEINFO.enum_types = {}
CHALLENGEINFO.fields = {
()["CHALLENGEINFO_SEASON_MAX_SCORE_FIELD"],
()["CHALLENGEINFO_ACTIVITY_MAX_SCORE_FIELD"],
()["CHALLENGEINFO_SEASON_MAX_LEVEL_FIELD"],
()["CHALLENGEINFO_ACTIVITY_MAX_LEVEL_FIELD"],
()["CHALLENGEINFO_SEASON_ID_FIELD"],
()["CHALLENGEINFO_DUNGEON_ID_LIST_FIELD"],
()["CHALLENGEINFO_BUFF_LIST_FIELD"]
}
CHALLENGEINFO.is_extendable = false
CHALLENGEINFO.extensions = {}
()["USERCHALLENGEINFO_CURRENT_SCORE_FIELD"].name = "current_score"
()["USERCHALLENGEINFO_CURRENT_SCORE_FIELD"].full_name = "p24.userchallengeinfo.current_score"
()["USERCHALLENGEINFO_CURRENT_SCORE_FIELD"].number = 1
()["USERCHALLENGEINFO_CURRENT_SCORE_FIELD"].index = 0
()["USERCHALLENGEINFO_CURRENT_SCORE_FIELD"].label = 2
()["USERCHALLENGEINFO_CURRENT_SCORE_FIELD"].has_default_value = false
()["USERCHALLENGEINFO_CURRENT_SCORE_FIELD"].default_value = 0
()["USERCHALLENGEINFO_CURRENT_SCORE_FIELD"].type = 13
()["USERCHALLENGEINFO_CURRENT_SCORE_FIELD"].cpp_type = 3
()["USERCHALLENGEINFO_LEVEL_FIELD"].name = "level"
()["USERCHALLENGEINFO_LEVEL_FIELD"].full_name = "p24.userchallengeinfo.level"
()["USERCHALLENGEINFO_LEVEL_FIELD"].number = 2
()["USERCHALLENGEINFO_LEVEL_FIELD"].index = 1
()["USERCHALLENGEINFO_LEVEL_FIELD"].label = 2
()["USERCHALLENGEINFO_LEVEL_FIELD"].has_default_value = false
()["USERCHALLENGEINFO_LEVEL_FIELD"].default_value = 0
()["USERCHALLENGEINFO_LEVEL_FIELD"].type = 13
()["USERCHALLENGEINFO_LEVEL_FIELD"].cpp_type = 3
()["USERCHALLENGEINFO_GROUPINC_LIST_FIELD"].name = "groupinc_list"
()["USERCHALLENGEINFO_GROUPINC_LIST_FIELD"].full_name = "p24.userchallengeinfo.groupinc_list"
()["USERCHALLENGEINFO_GROUPINC_LIST_FIELD"].number = 3
()["USERCHALLENGEINFO_GROUPINC_LIST_FIELD"].index = 2
()["USERCHALLENGEINFO_GROUPINC_LIST_FIELD"].label = 3
()["USERCHALLENGEINFO_GROUPINC_LIST_FIELD"].has_default_value = false
()["USERCHALLENGEINFO_GROUPINC_LIST_FIELD"].default_value = {}
()["USERCHALLENGEINFO_GROUPINC_LIST_FIELD"].message_type = GROUPINFOINCHALLENGE
()["USERCHALLENGEINFO_GROUPINC_LIST_FIELD"].type = 11
()["USERCHALLENGEINFO_GROUPINC_LIST_FIELD"].cpp_type = 10
()["USERCHALLENGEINFO_MODE_FIELD"].name = "mode"
()["USERCHALLENGEINFO_MODE_FIELD"].full_name = "p24.userchallengeinfo.mode"
()["USERCHALLENGEINFO_MODE_FIELD"].number = 4
()["USERCHALLENGEINFO_MODE_FIELD"].index = 3
()["USERCHALLENGEINFO_MODE_FIELD"].label = 2
()["USERCHALLENGEINFO_MODE_FIELD"].has_default_value = false
()["USERCHALLENGEINFO_MODE_FIELD"].default_value = 0
()["USERCHALLENGEINFO_MODE_FIELD"].type = 13
()["USERCHALLENGEINFO_MODE_FIELD"].cpp_type = 3
()["USERCHALLENGEINFO_ISSL_FIELD"].name = "issl"
()["USERCHALLENGEINFO_ISSL_FIELD"].full_name = "p24.userchallengeinfo.issl"
()["USERCHALLENGEINFO_ISSL_FIELD"].number = 5
()["USERCHALLENGEINFO_ISSL_FIELD"].index = 4
()["USERCHALLENGEINFO_ISSL_FIELD"].label = 2
()["USERCHALLENGEINFO_ISSL_FIELD"].has_default_value = false
()["USERCHALLENGEINFO_ISSL_FIELD"].default_value = 0
()["USERCHALLENGEINFO_ISSL_FIELD"].type = 13
()["USERCHALLENGEINFO_ISSL_FIELD"].cpp_type = 3
()["USERCHALLENGEINFO_SEASON_ID_FIELD"].name = "season_id"
()["USERCHALLENGEINFO_SEASON_ID_FIELD"].full_name = "p24.userchallengeinfo.season_id"
()["USERCHALLENGEINFO_SEASON_ID_FIELD"].number = 6
()["USERCHALLENGEINFO_SEASON_ID_FIELD"].index = 5
()["USERCHALLENGEINFO_SEASON_ID_FIELD"].label = 2
()["USERCHALLENGEINFO_SEASON_ID_FIELD"].has_default_value = false
()["USERCHALLENGEINFO_SEASON_ID_FIELD"].default_value = 0
()["USERCHALLENGEINFO_SEASON_ID_FIELD"].type = 13
()["USERCHALLENGEINFO_SEASON_ID_FIELD"].cpp_type = 3
()["USERCHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].name = "dungeon_id_list"
()["USERCHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].full_name = "p24.userchallengeinfo.dungeon_id_list"
()["USERCHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].number = 7
()["USERCHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].index = 6
()["USERCHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].label = 3
()["USERCHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].has_default_value = false
()["USERCHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].default_value = {}
()["USERCHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].type = 13
()["USERCHALLENGEINFO_DUNGEON_ID_LIST_FIELD"].cpp_type = 3
()["USERCHALLENGEINFO_BUFF_LIST_FIELD"].name = "buff_list"
()["USERCHALLENGEINFO_BUFF_LIST_FIELD"].full_name = "p24.userchallengeinfo.buff_list"
()["USERCHALLENGEINFO_BUFF_LIST_FIELD"].number = 8
()["USERCHALLENGEINFO_BUFF_LIST_FIELD"].index = 7
()["USERCHALLENGEINFO_BUFF_LIST_FIELD"].label = 3
()["USERCHALLENGEINFO_BUFF_LIST_FIELD"].has_default_value = false
()["USERCHALLENGEINFO_BUFF_LIST_FIELD"].default_value = {}
()["USERCHALLENGEINFO_BUFF_LIST_FIELD"].type = 13
()["USERCHALLENGEINFO_BUFF_LIST_FIELD"].cpp_type = 3
USERCHALLENGEINFO.name = "userchallengeinfo"
USERCHALLENGEINFO.full_name = "p24.userchallengeinfo"
USERCHALLENGEINFO.nested_types = {}
USERCHALLENGEINFO.enum_types = {}
USERCHALLENGEINFO.fields = {
()["USERCHALLENGEINFO_CURRENT_SCORE_FIELD"],
()["USERCHALLENGEINFO_LEVEL_FIELD"],
()["USERCHALLENGEINFO_GROUPINC_LIST_FIELD"],
()["USERCHALLENGEINFO_MODE_FIELD"],
()["USERCHALLENGEINFO_ISSL_FIELD"],
()["USERCHALLENGEINFO_SEASON_ID_FIELD"],
()["USERCHALLENGEINFO_DUNGEON_ID_LIST_FIELD"],
()["USERCHALLENGEINFO_BUFF_LIST_FIELD"]
}
USERCHALLENGEINFO.is_extendable = false
USERCHALLENGEINFO.extensions = {}
()["SHIPINCHALLENGE_ID_FIELD"].name = "id"
()["SHIPINCHALLENGE_ID_FIELD"].full_name = "p24.shipinchallenge.id"
()["SHIPINCHALLENGE_ID_FIELD"].number = 1
()["SHIPINCHALLENGE_ID_FIELD"].index = 0
()["SHIPINCHALLENGE_ID_FIELD"].label = 2
()["SHIPINCHALLENGE_ID_FIELD"].has_default_value = false
()["SHIPINCHALLENGE_ID_FIELD"].default_value = 0
()["SHIPINCHALLENGE_ID_FIELD"].type = 13
()["SHIPINCHALLENGE_ID_FIELD"].cpp_type = 3
()["SHIPINCHALLENGE_HP_RANT_FIELD"].name = "hp_rant"
()["SHIPINCHALLENGE_HP_RANT_FIELD"].full_name = "p24.shipinchallenge.hp_rant"
()["SHIPINCHALLENGE_HP_RANT_FIELD"].number = 2
()["SHIPINCHALLENGE_HP_RANT_FIELD"].index = 1
()["SHIPINCHALLENGE_HP_RANT_FIELD"].label = 2
()["SHIPINCHALLENGE_HP_RANT_FIELD"].has_default_value = false
()["SHIPINCHALLENGE_HP_RANT_FIELD"].default_value = 0
()["SHIPINCHALLENGE_HP_RANT_FIELD"].type = 13
()["SHIPINCHALLENGE_HP_RANT_FIELD"].cpp_type = 3
()["SHIPINCHALLENGE_SHIP_INFO_FIELD"].name = "ship_info"
()["SHIPINCHALLENGE_SHIP_INFO_FIELD"].full_name = "p24.shipinchallenge.ship_info"
()["SHIPINCHALLENGE_SHIP_INFO_FIELD"].number = 3
()["SHIPINCHALLENGE_SHIP_INFO_FIELD"].index = 2
()["SHIPINCHALLENGE_SHIP_INFO_FIELD"].label = 2
()["SHIPINCHALLENGE_SHIP_INFO_FIELD"].has_default_value = false
()["SHIPINCHALLENGE_SHIP_INFO_FIELD"].default_value = nil
()["SHIPINCHALLENGE_SHIP_INFO_FIELD"].message_type = slot1.SHIPINFO
()["SHIPINCHALLENGE_SHIP_INFO_FIELD"].type = 11
()["SHIPINCHALLENGE_SHIP_INFO_FIELD"].cpp_type = 10
SHIPINCHALLENGE.name = "shipinchallenge"
SHIPINCHALLENGE.full_name = "p24.shipinchallenge"
SHIPINCHALLENGE.nested_types = {}
SHIPINCHALLENGE.enum_types = {}
SHIPINCHALLENGE.fields = {
()["SHIPINCHALLENGE_ID_FIELD"],
()["SHIPINCHALLENGE_HP_RANT_FIELD"],
()["SHIPINCHALLENGE_SHIP_INFO_FIELD"]
}
SHIPINCHALLENGE.is_extendable = false
SHIPINCHALLENGE.extensions = {}
()["GROUPINFOINCHALLENGE_ID_FIELD"].name = "id"
()["GROUPINFOINCHALLENGE_ID_FIELD"].full_name = "p24.groupinfoinchallenge.id"
()["GROUPINFOINCHALLENGE_ID_FIELD"].number = 1
()["GROUPINFOINCHALLENGE_ID_FIELD"].index = 0
()["GROUPINFOINCHALLENGE_ID_FIELD"].label = 2
()["GROUPINFOINCHALLENGE_ID_FIELD"].has_default_value = false
()["GROUPINFOINCHALLENGE_ID_FIELD"].default_value = 0
()["GROUPINFOINCHALLENGE_ID_FIELD"].type = 13
()["GROUPINFOINCHALLENGE_ID_FIELD"].cpp_type = 3
()["GROUPINFOINCHALLENGE_SHIPS_FIELD"].name = "ships"
()["GROUPINFOINCHALLENGE_SHIPS_FIELD"].full_name = "p24.groupinfoinchallenge.ships"
()["GROUPINFOINCHALLENGE_SHIPS_FIELD"].number = 2
()["GROUPINFOINCHALLENGE_SHIPS_FIELD"].index = 1
()["GROUPINFOINCHALLENGE_SHIPS_FIELD"].label = 3
()["GROUPINFOINCHALLENGE_SHIPS_FIELD"].has_default_value = false
()["GROUPINFOINCHALLENGE_SHIPS_FIELD"].default_value = {}
()["GROUPINFOINCHALLENGE_SHIPS_FIELD"].message_type = SHIPINCHALLENGE
()["GROUPINFOINCHALLENGE_SHIPS_FIELD"].type = 11
()["GROUPINFOINCHALLENGE_SHIPS_FIELD"].cpp_type = 10
()["GROUPINFOINCHALLENGE_COMMANDERS_FIELD"].name = "commanders"
()["GROUPINFOINCHALLENGE_COMMANDERS_FIELD"].full_name = "p24.groupinfoinchallenge.commanders"
()["GROUPINFOINCHALLENGE_COMMANDERS_FIELD"].number = 3
()["GROUPINFOINCHALLENGE_COMMANDERS_FIELD"].index = 2
()["GROUPINFOINCHALLENGE_COMMANDERS_FIELD"].label = 3
()["GROUPINFOINCHALLENGE_COMMANDERS_FIELD"].has_default_value = false
()["GROUPINFOINCHALLENGE_COMMANDERS_FIELD"].default_value = {}
()["GROUPINFOINCHALLENGE_COMMANDERS_FIELD"].message_type = COMMANDERINCHALLENGE
()["GROUPINFOINCHALLENGE_COMMANDERS_FIELD"].type = 11
()["GROUPINFOINCHALLENGE_COMMANDERS_FIELD"].cpp_type = 10
GROUPINFOINCHALLENGE.name = "groupinfoinchallenge"
GROUPINFOINCHALLENGE.full_name = "p24.groupinfoinchallenge"
GROUPINFOINCHALLENGE.nested_types = {}
GROUPINFOINCHALLENGE.enum_types = {}
GROUPINFOINCHALLENGE.fields = {
()["GROUPINFOINCHALLENGE_ID_FIELD"],
()["GROUPINFOINCHALLENGE_SHIPS_FIELD"],
()["GROUPINFOINCHALLENGE_COMMANDERS_FIELD"]
}
GROUPINFOINCHALLENGE.is_extendable = false
GROUPINFOINCHALLENGE.extensions = {}
()["COMMANDERINCHALLENGE_POS_FIELD"].name = "pos"
()["COMMANDERINCHALLENGE_POS_FIELD"].full_name = "p24.commanderinchallenge.pos"
()["COMMANDERINCHALLENGE_POS_FIELD"].number = 1
()["COMMANDERINCHALLENGE_POS_FIELD"].index = 0
()["COMMANDERINCHALLENGE_POS_FIELD"].label = 2
()["COMMANDERINCHALLENGE_POS_FIELD"].has_default_value = false
()["COMMANDERINCHALLENGE_POS_FIELD"].default_value = 0
()["COMMANDERINCHALLENGE_POS_FIELD"].type = 13
()["COMMANDERINCHALLENGE_POS_FIELD"].cpp_type = 3
()["COMMANDERINCHALLENGE_COMMANDERINFO_FIELD"].name = "commanderinfo"
()["COMMANDERINCHALLENGE_COMMANDERINFO_FIELD"].full_name = "p24.commanderinchallenge.commanderinfo"
()["COMMANDERINCHALLENGE_COMMANDERINFO_FIELD"].number = 2
()["COMMANDERINCHALLENGE_COMMANDERINFO_FIELD"].index = 1
()["COMMANDERINCHALLENGE_COMMANDERINFO_FIELD"].label = 2
()["COMMANDERINCHALLENGE_COMMANDERINFO_FIELD"].has_default_value = false
()["COMMANDERINCHALLENGE_COMMANDERINFO_FIELD"].default_value = nil
()["COMMANDERINCHALLENGE_COMMANDERINFO_FIELD"].message_type = slot1.COMMANDERINFO
()["COMMANDERINCHALLENGE_COMMANDERINFO_FIELD"].type = 11
()["COMMANDERINCHALLENGE_COMMANDERINFO_FIELD"].cpp_type = 10
COMMANDERINCHALLENGE.name = "commanderinchallenge"
COMMANDERINCHALLENGE.full_name = "p24.commanderinchallenge"
COMMANDERINCHALLENGE.nested_types = {}
COMMANDERINCHALLENGE.enum_types = {}
COMMANDERINCHALLENGE.fields = {
()["COMMANDERINCHALLENGE_POS_FIELD"],
()["COMMANDERINCHALLENGE_COMMANDERINFO_FIELD"]
}
COMMANDERINCHALLENGE.is_extendable = false
COMMANDERINCHALLENGE.extensions = {}
challengeinfo = slot0.Message(CHALLENGEINFO)
commanderinchallenge = slot0.Message(COMMANDERINCHALLENGE)
cs_24002 = slot0.Message(CS_24002)
cs_24004 = slot0.Message(CS_24004)
cs_24011 = slot0.Message(CS_24011)
groupinfo = slot0.Message(GROUPINFO)
groupinfoinchallenge = slot0.Message(GROUPINFOINCHALLENGE)
sc_24003 = slot0.Message(SC_24003)
sc_24005 = slot0.Message(SC_24005)
sc_24010 = slot0.Message(SC_24010)
sc_24012 = slot0.Message(SC_24012)
shipinchallenge = slot0.Message(SHIPINCHALLENGE)
userchallengeinfo = slot0.Message(USERCHALLENGEINFO)
return
|
require 'src.globals'
function love.directorydropped(path)
end
function love.draw()
if use_effect then
post_effect:draw(function()
State.current():draw()
end)
else
State.current():draw()
end
if DEBUG then
local stats = love.graphics.getStats()
local info = {
'FPS: ' .. love.timer.getFPS(),
'Memory: ' .. Lume.round(collectgarbage('count') / 1024, 0.1) .. 'MB',
}
Lume.push(info,
'Draw calls: ' .. stats.drawcalls,
'Texture memory: ' .. Lume.round(stats.texturememory / 1024 / 1024, 0.01) .. 'MB',
'Images: ' .. stats.images,
'Fonts: ' .. stats.fonts,
'Canvases: ' .. stats.canvases)
love.graphics.push()
love.graphics.setColor(255, 255, 255)
local font = Fonts.mono[18]
love.graphics.setFont(font)
for i, text in ipairs(info) do
love.graphics.print(text, 10, 10 + (i - 1) * font:getHeight() * 1.3)
end
love.graphics.pop()
end
end
function love.filedropped(file)
end
function love.focus(focus)
end
function love.keypressed(key, scancode, isrepeat)
if key == 'f1' and love.keyboard.isDown('lctrl', 'rctrl') then
DEBUG = not DEBUG
elseif key == 'escape' and love.keyboard.isDown('lshift', 'rshift') then
love.event.quit()
elseif key == 'f11' then
local w, h, f = love.window.getMode()
f.fullscreen = not f.fullscreen
love.window.setMode(w, h, f)
elseif key == 'f3' then
use_effect = not use_effect
end
end
function love.keyreleased(key, scancode)
end
function love.load(argv)
local makeFont = function(path)
return setmetatable({}, {
__index = function(t, size)
local font = love.graphics.newFont(path, size)
rawset(t, size, font)
return font
end
})
end
Fonts = {
default = makeFont('assets/fonts/pixel.ttf'),
mono = makeFont('assets/fonts/pixel.ttf'),
}
love.graphics.setFont(Fonts.default[24])
local callbacks = {'update'}
for callback_name in pairs(love.handlers) do
table.insert(callbacks, callback_name)
end
local grain = Shine.filmgrain()
grain.opacity = 0.2
local vignette = Shine.vignette()
local crt = Shine.crt()
vignette.parameters = {radius = 0.9, opacity = 0.7}
local desaturate = Shine.desaturate{strength = 0.6, tint = {255,250,200}}
post_effect = desaturate:chain(grain):chain(vignette):chain(crt)
post_effect.opacity = 0.5
use_effect = false
State.registerEvents(callbacks)
State.switch(main_menu)
end
function love.lowmemory()
end
function love.mousefocus(focus)
end
function love.mousemoved(x, y, dx, dy, istouch)
end
function love.mousepressed(x, y, button, istouch)
end
function love.mousereleased(x, y, button, istouch)
end
function love.quit()
end
function love.resize(w, h)
local sw, sh = love.graphics.getDimensions()
local scale_x = sw / CANVAS_WIDTH
local scale_y = sh / CANVAS_HEIGHT
local scale = math.min(scale_x, scale_y)
CANVAS_SCALE_X = scale
CANVAS_SCALE_Y = scale
local rw, rh = CANVAS_WIDTH * scale, CANVAS_HEIGHT * scale
CANVAS_OFFSET_X = (sw - rw) / 2
CANVAS_OFFSET_Y = (sh - rh) / 2
end
function love.textedited(text, start, length)
end
function love.textinput(text)
end
function love.touchmoved(id, x, y, dx, dy, pressure)
end
function love.touchpressed(id, x, y, dx, dy, pressure)
end
function love.touchreleased(id, x, y, dx, dy, pressure)
end
function love.update(dt)
end
function love.visible(isvisible)
end
function love.wheelmoved(x, y)
end
function love.gamepadaxis(joystick, axis, value)
end
function love.gamepadpressed(joystick, button)
end
function love.gamepadreleased(joystick, button)
end
function love.joystickadded(joystick)
end
function love.joystickaxis(joystick, axis, value)
end
function love.joystickhat(joystick, hat, direction)
end
function love.joystickpressed(joystick, button)
end
function love.joystickreleased(joystick, button)
end
function love.joystickremoved(joystick)
end
|
function GM:SetupMove(ply, mv, cmd)
if ply:isArrested() then
mv:SetMaxClientSpeed(self.Config.arrestspeed)
end
return self.Sandbox.SetupMove(self, ply, mv, cmd)
end
function GM:StartCommand(ply, usrcmd)
-- Used in arrest_stick and unarrest_stick but addons can use it too!
local wep = ply:GetActiveWeapon()
if IsValid(wep) and isfunction(wep.startDarkRPCommand) then
wep:startDarkRPCommand(usrcmd)
end
end
function GM:OnPlayerChangedTeam(ply, oldTeam, newTeam)
if RPExtraTeams[newTeam] and RPExtraTeams[newTeam].OnPlayerChangedTeam then
RPExtraTeams[newTeam].OnPlayerChangedTeam(ply, oldTeam, newTeam)
end
if CLIENT then return end
local agenda = ply:getAgendaTable()
-- Remove agenda text when last manager left
if agenda and agenda.ManagersByKey[oldTeam] then
local found = false
for man, _ in pairs(agenda.ManagersByKey) do
if team.NumPlayers(man) > 0 then found = true break end
end
if not found then agenda.text = nil end
end
ply:setSelfDarkRPVar("agenda", agenda and agenda.text or nil)
end
hook.Add("loadCustomDarkRPItems", "CAMI privs", function()
CAMI.RegisterPrivilege{
Name = "DarkRP_SeeEvents",
MinAccess = "admin"
}
CAMI.RegisterPrivilege{
Name = "DarkRP_GetAdminWeapons",
MinAccess = "admin"
}
CAMI.RegisterPrivilege{
Name = "DarkRP_SetDoorOwner",
MinAccess = "admin"
}
CAMI.RegisterPrivilege{
Name = "DarkRP_ChangeDoorSettings",
MinAccess = "superadmin"
}
CAMI.RegisterPrivilege{
Name = "DarkRP_AdminCommands",
MinAccess = "admin"
}
CAMI.RegisterPrivilege{
Name = "DarkRP_SetMoney",
MinAccess = "superadmin"
}
CAMI.RegisterPrivilege{
Name = "DarkRP_SetLicense",
MinAccess = "superadmin"
}
for k,v in pairs(RPExtraTeams) do
if not v.vote or v.admin and v.admin > 1 then continue end
local toAdmin = {[0] = "admin", [1] = "superadmin"}
CAMI.RegisterPrivilege{
Name = "DarkRP_GetJob_" .. v.command,
MinAccess = toAdmin[v.admin or 0]-- Add privileges for the teams that are voted for
}
end
end)
|
--[[
/////// //////////////////
/////// PROJECT: MTA iLife - German Fun Reallife Gamemode
/////// VERSION: 1.7.2
/////// DEVELOPERS: See DEVELOPERS.md in the top folder
/////// LICENSE: See LICENSE.md in the top folder
/////// /////////////////
]]
-- #######################################
-- ## Project: MTA iLife ##
-- ## Name: TrainHelper.lua ##
-- ## Author: Noneatme ##
-- ## Version: 1.0 ##
-- ## License: See top Folder ##
-- #######################################
-- FUNCTIONS / METHODS --
local cFunc = {}; -- Local Functions
local cSetting = {}; -- Local Settings
TrainHelper = {};
TrainHelper.__index = TrainHelper;
--[[
]]
-- ///////////////////////////////
-- ///// New //////
-- ///// Returns: Object //////
-- ///////////////////////////////
function TrainHelper:New(...)
local obj = setmetatable({}, {__index = self});
if obj.Constructor then
obj:Constructor(...);
end
return obj;
end
-- ///////////////////////////////
-- ///// IsTrain //////
-- ///// Returns: void //////
-- ///////////////////////////////
function TrainHelper:IsTrain(model)
if(self.trainModels[model]) and (self.trainModels[model] == true) then
return true;
end
return false;
end
-- ///////////////////////////////
-- ///// Constructor //////
-- ///// Returns: void //////
-- ///////////////////////////////
function TrainHelper:Constructor(...)
-- Klassenvariablen --
self.trainModels =
{
[449] = true,
[537] = true,
[538] = true,
[569] = true,
[590] = true,
}
-- Methoden --
-- Events --
--logger:OutputInfo("[CALLING] TrainHelper: Constructor");
end
-- EVENT HANDLER --
|
data:extend({
{
type = "recipe",
name = "autonomous-space-mining-drone",
energy_required = 100,
enabled = "false",
ingredients =
{
{"satellite-bus", 30},
{"rocket-fuel", 200},
{"satellite-flight-computer", 50},
{"stack-filter-inserter", 100},
{"satellite-thruster", 10},
{"radioisotope-thermoelectric-generator", 100},
{"satellite-communications", 1},
{"satellite-radar", 10},
{"electric-mining-drill", 1000},
{"assembling-machine-3", 100},
},
result = "autonomous-space-mining-drone",
category = "satellite-crafting",
}
})
|
local invalidPrefixes
if SERVER then invalidPrefixes = { "cl_" } end
if CLIENT then invalidPrefixes = { "sv_" } end
local fileBlacklist = {
"db", "vvd", "phy", "vtf", "vtx", "txt", "ztmp"
}
local function ProcessFolder( path, domain, handle, foldername )
local files, folders = file.Find( path .. "/*", domain )
path = path .. "/"
for _, filename in next, files do
handle( path, filename, foldername )
end
for _, folder in next, folders do
ProcessFolder( path .. folder, domain, handle, folder )
end
end
_G.ProcessFolder = ProcessFolder
local function removeGamemodePrefix( path )
if ( string.find(path, GM.Name .. "/gamemode/") ) then
path = string.sub(path, string.len(GM.Name .. "/gamemode/") + 1)
end
return path
end
local function AddCSFolder( path )
local count = 0
ProcessFolder( path, "LUA", function( foldername, filename )
if ( string.StartWith( filename, "sv_") or filename == "init.lua" ) then return end
AddCSLuaFile( removeGamemodePrefix(foldername) .. filename )
--print(" - added " .. foldername .. filename .. " to Download" )
count = count + 1
end)
print(" - " .. path .. ": Added " .. count .. " LUA-Files to Download" )
end
local function AddResources( path )
ProcessFolder( path, "GAME", function( foldername, filename)
local ext = string.GetExtensionFromFilename( filename )
if ( table.HasValue(fileBlacklist, ext) ) then return end
resource.AddFile( foldername .. filename )
print(" - added " .. foldername .. filename .. " to Download" )
end)
end
local function checkPrefix( filename )
for k, prefix in next, invalidPrefixes do
if ( string.StartWith(filename, prefix) ) then return false end
end
return true
end
local function LoadFolder( path )
local count = 0
ProcessFolder( path, "LUA", function( foldername, filename )
if ( !checkPrefix( filename ) ) then return end
include( removeGamemodePrefix(foldername) .. filename )
--print(" - included " .. foldername .. filename )
count = count + 1
end)
print(" - " .. path .. ": Loaded " .. count .. " LUA-Files" )
end
local function LoadManagedMusic()
local countFiles = 0
local countTracks = 0
local tracks = {}
ProcessFolder( "sound/element/music_managed", "THIRDPARTY", function( path, filename, foldername )
countFiles = countFiles + 1
if (!tracks[foldername]) then
tracks[foldername] = {}
countTracks = countTracks + 1
end
table.insert(tracks[foldername], filename)
end)
for name, files in next, tracks do
music_manager.Feed( name, files )
end
print(" - Loaded " .. countTracks .. " Managed Music Tracks containing " .. countFiles .. " Files" )
end
print("Cataclysm: Setting up Gamemode")
print("# Requiring libraries")
require("classes")
require("pon")
require("netstream")
require("ecall")
if SERVER then
print("# Setup FastDL")
AddCSFolder( GM.Name .. "/gamemode" )
AddCSFolder( GM.Name .. "/entities" )
if !file.Exists("element", "DATA") then file.CreateDir("element", "DATA") end
if !file.Exists("element_backups", "DATA") then file.CreateDir("element_backups", "DATA") end
end
print("# Loading Code")
LoadFolder( GM.Name .. "/gamemode/config" )
LoadFolder( GM.Name .. "/gamemode/resources" )
LoadFolder( GM.Name .. "/gamemode/managers" )
LoadFolder( GM.Name .. "/gamemode/extensions" )
LoadFolder( GM.Name .. "/gamemode/modules/skillsystem" ) --cheating to ensure UI has everything ready
LoadFolder( GM.Name .. "/gamemode/modules" )
LoadFolder( GM.Name .. "/gamemode/skills" )
include("player_class/element/base.lua")
LoadFolder( GM.Name .. "/gamemode/player_class" )
if CLIENT then
require("tdlib")
LoadFolder( GM.Name .. "/gamemode/vgui" )
LoadFolder( GM.Name .. "/gamemode/animations" )
LoadManagedMusic()
end
print("\n\n")
|
-----------------------------------
-- Area: Dynamis-Jeuno_[D]
-----------------------------------
require("scripts/globals/zone")
-----------------------------------
zones = zones or {}
zones[tpz.zone.DYNAMIS_JEUNO_D] =
{
text =
{
},
mob =
{
},
npc =
{
},
}
return zones[tpz.zone.DYNAMIS_JEUNO_D]
|
game = {}
function game:init()
self.canvas = love.graphics.newCanvas(CANVAS_WIDTH, CANVAS_HEIGHT)
love.graphics.setDefaultFilter('nearest', 'nearest')
self.background = love.graphics.newImage('assets/sprites/Backgrounds/bg.png')
self.help = love.graphics.newImage('assets/sprites/hp/help.png')
self:reset()
Signal.emit('music-game-run')
end
function game:reset()
self.players = {
Player('wizard', 95, 92),
Player('warlock', 465, 90),
}
self.arrows = ArrowManager()
self.damages = DamageManager()
self.skills = {}
self.wins = nil
self.shake_timer = nil
self:pause()
self:unpause()
self.timer = Timer()
self.shock_count = nil
self.shock_time = nil
self.shock_alpha = nil
end
function game:pause()
-- if not self.paused and not self.pause_timer then
self.paused = true
self.pause_timer = 3
-- end
Signal.emit('music-game-pause')
end
function game:unpause()
self.paused = false
Signal.emit('music-game-run')
end
function game:toggle_pause()
if self.paused then
self:unpause()
else
self:pause()
end
end
function game:enter(from, level_name)
Signal.emit('game_entered')
end
function game:update(dt)
if not self.paused and not self.pause_timer then
for _, v in ipairs(self.players) do
v:update(dt)
end
self.arrows:update(dt)
self:update_skills(dt)
self.damages:update(dt)
if not self.wins then
self.timer:update(dt)
if self.ai then
self.ai:update(dt)
end
if self.ai and self.players[2]:can_cast() then
if not self.ai:is_plan_ready() then
if self.ai.time_to_attack then
self.ai:attack(self.players[2], self.skills)
else
self.ai:generate_new_plan()
end
end
if self.players[2]:can_cast() then
self.ai:cast(self.players[2], self.arrows)
end
end
end
end
if self.pause_timer and not self.paused then
local int_value = math.ceil(self.pause_timer)
self.pause_timer = self.pause_timer - dt
if math.ceil(self.pause_timer) < int_value then
Signal.emit('sounds-beep')
end
if self.pause_timer <= 0 then
self.pause_timer = nil
end
end
if self.shake_timer then
self.shake_timer = self.shake_timer - dt
if self.shake_timer <= 0 then
self.shake_timer = nil
end
end
if self.shock_count then
if not self.shock_time then
self.shock_alpha = love.math.random(192, 255)
self.shock_time = 0.05
end
self.shock_time = self.shock_time - dt
if self.shock_time <= 0 then
self.shock_time = nil
self.shock_count = self.shock_count - 1
if self.shock_count <= 0 then
self.shock_count = nil
self.shock_time = nil
self.shock_alpha = nil
end
end
end
end
function game:update_skills(dt)
if self.players[1].dead and self.players[2].dead then
self.wins = 0
elseif self.players[1].dead then
self.wins = 2
elseif self.players[2].dead then
self.wins = 1
end
for i = #self.skills, 1, -1 do
local s = self.skills[i]
s:update(dt)
local damage_applied = false
if s.dir == 1 and s.x > self.players[2].x and not s.dead then
if self.players[2]:on_hit(s.damage) then
local x, y = self.players[2]:get_center()
y = y - 32
self.damages:add(s.damage, x, y)
damage_applied = true
end
self.skills[i]:on_collide()
elseif s.dir == -1 and s.x < self.players[1].x + 32 and not s.dead then
if self.players[1]:on_hit(s.damage) then
local x, y = self.players[1]:get_center()
y = y - 32
self.damages:add(s.damage, x, y)
damage_applied = true
end
self.skills[i]:on_collide()
end
if damage_applied then
if s.damage >= 25 then
self.shake_timer = 0.75
end
if s:isInstanceOf(Shock) then
self.shock_count = 15
end
end
end
for i = #self.skills, 1, -1 do
local s1 = self.skills[i]
if s1.collidable and not s1.dead then
for j = #self.skills, 1, -1 do
local s2 = self.skills[j]
if s2.collidable and s1.dir ~= s2.dir and not s2.dead then
local left, right = nil, nil
if s1.dir == 1 then
left, right = s1, s2
else
left, right = s2, s1
end
if left.x + 16 > right.x then
if s1.damage > s2.damage then
s2:on_collide()
elseif s1.damage < s2.damage then
s1:on_collide()
else
s1:on_collide()
s2:on_collide()
end
end
end
end
end
end
for i = #self.skills, 1, -1 do
if self.skills[i].dead and self.skills[i].remove then
table.remove(self.skills, i)
end
end
end
function game:draw()
local draw_function = function()
self.canvas:renderTo(function()
love.graphics.push()
love.graphics.scale(SCALE)
if self.shake_timer then
local offset_x = love.math.random(-10, 10)
local offset_y = love.math.random(-10, 10)
love.graphics.translate(offset_x, offset_y)
end
love.graphics.clear(0, 0, 0, 255)
local bg_x, bg_y = 0, 0
bg_x = -(self.background:getWidth() - CANVAS_WIDTH) / (2 * SCALE)
bg_y = -(self.background:getHeight() - CANVAS_HEIGHT) / (2 * SCALE)
love.graphics.draw(self.background, bg_x, bg_y, 0, 0.5)
self.players[1]:draw()
self.players[2]:draw()
self.arrows:draw()
for _, s in ipairs(self.skills) do
s:draw()
end
self.damages:draw()
if self.shock_count and self.shock_count % 2 ~= 0 then
love.graphics.setColor(255, 255, 255, self.shock_alpha)
love.graphics.rectangle('fill', 0, 0, CANVAS_WIDTH, CANVAS_HEIGHT)
end
love.graphics.pop()
end)
self.canvas:renderTo(function()
if not self.paused and not self.pause_timer then
self:draw_hp()
self:draw_mp()
end
if self.wins then
local text = ''
if self.wins ~= 0 then
text = string.format(locale:get('win_title'), self.wins)
self.players[self.wins].wins = true
else
text = locale:get('dead_heat')
end
local old_font = love.graphics.getFont()
love.graphics.setFont(Fonts.mono[74])
love.graphics.printf(text, 0, 100, CANVAS_WIDTH, 'center')
local secs = self.timer:to_seconds()
love.graphics.setFont(Fonts.mono[36])
love.graphics.printf(string.format(locale:get('elapsed_time_title'), secs), 0, 200, CANVAS_WIDTH, 'center')
love.graphics.setFont(Fonts.mono[24])
love.graphics.setColor(0, 0, 0, 255)
love.graphics.printf(locale:get('win_info'), 0, CANVAS_HEIGHT - 80, CANVAS_WIDTH, 'center')
love.graphics.setFont(old_font)
elseif self.paused then
love.graphics.draw(self.help, (CANVAS_WIDTH - self.help:getWidth()) / 2, CANVAS_HEIGHT - self.help:getHeight() - 20)
local old_font = love.graphics.getFont()
love.graphics.setFont(Fonts.mono[74])
love.graphics.printf(locale:get('paused'), 0, 20, CANVAS_WIDTH, 'center')
love.graphics.setFont(Fonts.mono[24])
love.graphics.setColor(0, 0, 0, 255)
love.graphics.printf(locale:get('pause_info'), 0, CANVAS_HEIGHT - 80, CANVAS_WIDTH, 'center')
love.graphics.setFont(old_font)
elseif self.pause_timer then
love.graphics.draw(self.help, (CANVAS_WIDTH - self.help:getWidth()) / 2, CANVAS_HEIGHT - self.help:getHeight() - 20)
local old_font = love.graphics.getFont()
love.graphics.setFont(Fonts.mono[74])
love.graphics.printf(string.format('%d', math.ceil(self.pause_timer)), 0, 20, CANVAS_WIDTH, 'center')
love.graphics.setFont(old_font)
else
local secs = self.timer:to_seconds()
local old_font = love.graphics.getFont()
love.graphics.setFont(Fonts.mono[24])
love.graphics.printf(string.format('%d', math.ceil(secs)), 0, 20, CANVAS_WIDTH, 'center')
love.graphics.setFont(old_font)
end
end)
love.graphics.setColor(255, 255, 255, 255)
love.graphics.clear(0, 0, 0, 255)
love.graphics.draw(self.canvas, CANVAS_OFFSET_X, CANVAS_OFFSET_Y, 0, CANVAS_SCALE_X, CANVAS_SCALE_Y)
end
-- if self.use_effect then
-- self.post_effect:draw(draw_function)
-- else
-- draw_function()
-- end
draw_function()
end
function game:draw_hp()
local hp_color = {200, 0, 0, 255}
local p1_x = 50
local p2_x = CANVAS_WIDTH - Player.static.hp_foreground_image:getWidth() - 50
local p_y = CANVAS_HEIGHT - 50 - 28
local p1_hp_scale = self.players[1].hp / self.players[1].max_hp
love.graphics.setColor(unpack(hp_color))
love.graphics.rectangle('fill', p1_x + 12, p_y + 8, (256 - 12 * 2) * p1_hp_scale, 32 - 8 * 2)
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(Player.static.hp_foreground_image, p1_x, p_y)
local p2_hp_scale = self.players[2].hp / self.players[2].max_hp
love.graphics.setColor(unpack(hp_color))
love.graphics.rectangle('fill', p2_x + 12, p_y + 8, (256 - 12 * 2) * p2_hp_scale, 32 - 8 * 2)
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(Player.static.hp_foreground_image, p2_x, p_y)
end
function game:draw_mp()
local mp_color = {0, 0, 200, 255}
local p1_x = 50
local p2_x = CANVAS_WIDTH - Player.static.hp_foreground_image:getWidth() - 50
local p_y = CANVAS_HEIGHT - 50
local p1_mp_scale = self.players[1].mp / self.players[1].max_mp
love.graphics.setColor(unpack(mp_color))
love.graphics.rectangle('fill', p1_x + 12, p_y + 8, (256 - 12 * 2) * p1_mp_scale, 32 - 8 * 2)
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(Player.static.hp_foreground_image, p1_x, p_y)
local p2_mp_scale = self.players[2].mp / self.players[2].max_mp
love.graphics.setColor(unpack(mp_color))
love.graphics.rectangle('fill', p2_x + 12, p_y + 8, (256 - 12 * 2) * p2_mp_scale, 32 - 8 * 2)
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(Player.static.hp_foreground_image, p2_x, p_y)
end
function game:keypressed(key, scancode, is_repeat)
local index = 0
local attack = false
local cast = false
if not self.paused and not self.pause_timer then
if key == 'lctrl' or key == 'rctrl' or key == 'lshift' or key == 'rshift' then
attack = true
index = (key == 'lctrl' or key == 'lshift') and 1 or 2
end
if key == 'a' or key == 'w' or key == 's' or key == 'd' then
cast = true
index = 1
end
if key == 'left' or key == 'up' or key == 'down' or key == 'right' then
cast = true
index = 2
end
end
if self.ai and index == 2 then
index = 0
attack = false
cast = false
end
if attack then
local combo = self.players[index]:get_combo()
local SkillCtor = Recipes[combo]
if self.players[index]:attack() then
if not SkillCtor then
self.players[index]:on_hit(0)
else
local x, y = self.players[index]:get_center()
y = y - 16
if index == 2 then
x = x - 32
end
local skill = SkillCtor(x, y, index == 1 and 1 or -1)
table.insert(self.skills, skill)
end
end
end
if cast then
Signal.emit('sounds-cast', index)
if self.players[index]:cast() then
self.players[index]:add_combo(key)
local x, y = self.players[index]:get_center()
y = y - 64
self.arrows:add(key, index, x, y)
end
end
if key == 'escape' then
if self.wins then
State.switch(main_menu)
else
self:toggle_pause()
end
Signal.emit('sounds-beep')
elseif key == 'space' and self.wins then
self:reset()
Signal.emit('sounds-beep')
elseif key == 'space' and self.paused then
State.switch(main_menu)
Signal.emit('sounds-beep')
end
end
--
-- function game:mousepressed(mx, my, button, istouch)
-- print(mx, my)
-- local CW3 = CANVAS_WIDTH / 3
-- local CH3 = CANVAS_HEIGHT / 3
--
-- local areas = {
-- lt = false, t = false, rt = false,
-- l = false, c = false, r = false,
-- lb = false, b = false, rb = false,
-- }
--
-- if mx < CW3 then
-- if my < CH3 then
-- areas.lt = true
-- elseif my > 2 * CH3 then
-- areas.lb = true
-- else
-- areas.l = true
-- end
-- elseif mx > 2 * CW3 then
-- if my < CH3 then
-- areas.rt = true
-- elseif my > 2 * CH3 then
-- areas.rb = true
-- else
-- areas.r = true
-- end
-- else
-- if my < CH3 then
-- areas.t = true
-- elseif my > 2 * CH3 then
-- areas.b = true
-- else
-- areas.c = true
-- end
-- end
--
-- if areas.l then
-- self:keypressed('a', 'a', false)
-- end
-- if areas.r then
-- self:keypressed('d', 'd', false)
-- end
-- if areas.b then
-- self:keypressed('s', 's', false)
-- end
-- if areas.t then
-- self:keypressed('w', 'w', false)
-- end
-- if areas.c then
-- self:keypressed('lctrl', 'lctrl', false)
-- end
-- end
|
camera = entity:extend()
addobjects.register("megacam", function(v)
if v.properties["checkpoint"] == globals.checkpoint then
megautils.add(camera(v.x, v.y, v.properties["doScrollX"], v.properties["doScrollY"]))
camera.once = false
end
end, -1)
addobjects.register("megacam", function(v)
if v.properties["checkpoint"] == globals.checkpoint and not camera.once and camera.main ~= nil then
camera.once = true
camera.main:updateBounds()
end
end, 2)
megautils.resetStateFuncs["camera"] = function() camera.main = nil end
function camera:new(x, y, doScrollX, doScrollY)
camera.super.new(self)
self.transform.y = y
self.transform.x = x
self:setRectangleCollision(view.w, view.h)
self.transition = false
self.transitiondirection = "right"
self.doShift = false
self.freeze = true
self.updateSections = true
self.shiftX = 0
self.shiftY = 0
self.scrollx = 0
self.scrollw = 0
self.scrolly = 0
self.scrollh = 0
self.doScrollY = ternary(doScrollY ~= nil, doScrollY, true)
self.doScrollX = ternary(doScrollX ~= nil, doScrollX, true)
self.transX = 0
self.transY = 0
self.speed = 1
self.toSection = nil
self.once = false
self.updateOnce = false
self.transitionDone = false
camera.main = self
self.player = nil
view.x, view.y = self.transform.x, self.transform.y
self.funcs = {}
end
function camera:updateBounds()
if self.toSection == nil then
self.toSection = self:collisionTable(megautils.state().sectionHandler.sections)[1]
end
if self.toSection ~= nil then
megautils.state().sectionHandler.next = self.toSection
megautils.state().sectionHandler:updateAll()
self.scrollx = self.toSection.transform.x
self.scrollw = self.toSection.collisionShape.w
self.scrolly = self.toSection.transform.y
self.scrollh = self.toSection.collisionShape.h
else
self.scrollx = -math.huge
self.scrollw = math.huge
self.scrolly = -math.huge
self.scrollh = math.huge
end
end
function camera:updateCam(o, offX, offY, w, h, px, py, delay)
if self.transition then
self.transitionDone = false
if not self.once then
if megautils.groups()["removeOnCutscene"] ~= nil then
for k, v in pairs(megautils.groups()["removeOnCutscene"]) do
if not v.dontRemove then
megautils.remove(v, true)
end
end
end
if self.freeze then
megautils.freeze(megautils.groups()["hurtableOther"])
for k, v in pairs(megautils.groups()["hurtableOther"]) do
v.control = false
end
end
if self.player ~= nil then
if self.toSection == nil then self.toSection = megautils.state().sectionHandler.current end
local sx, sy, sw, sh = self.toSection.transform.x, self.toSection.transform.y,
self.toSection.collisionShape.w, self.toSection.collisionShape.h
if self.transitiondirection == "right" then
if self.doScrollY then
self.tween = tween.new(self.speed, self.transform, {x=self.transform.x+self.collisionShape.w,
y=math.clamp(self.player.transform.y
- (view.h/2) + (h/2), sy, (sy+sh)-view.h)})
else
self.tween = tween.new(self.speed, self.transform, {x=self.transform.x+self.collisionShape.w})
end
self.tween2 = tween.new(self.speed, self.player.transform, {x=self.transX})
elseif self.transitiondirection == "left" then
if self.doScrollY then
self.tween = tween.new(self.speed, self.transform, {x=self.transform.x-self.collisionShape.w,
y=math.clamp(self.player.transform.y
- (view.h/2) + (h/2), sy, (sy+sh)-view.h)})
else
self.tween = tween.new(self.speed, self.transform, {x=self.transform.x-self.collisionShape.w})
end
self.tween2 = tween.new(self.speed, self.player.transform, {x=self.transX})
elseif self.transitiondirection == "down" then
if self.doScrollX then
self.tween = tween.new(self.speed, self.transform, {y=self.transform.y+self.collisionShape.h,
x=math.clamp(self.player.transform.x
- (view.w/2) + (w/2), sx, (sx+sw)-view.w)})
else
self.tween = tween.new(self.speed, self.transform, {y=self.transform.y+self.collisionShape.h})
end
self.tween2 = tween.new(self.speed, self.player.transform, {y=self.transY})
elseif self.transitiondirection == "up" then
if self.doScrollX then
self.tween = tween.new(self.speed, self.transform, {y=self.transform.y-self.collisionShape.h,
x=math.clamp(self.player.transform.x
- (view.w/2) + (w/2), sx, (sx+sw)-view.w)})
else
self.tween = tween.new(self.speed, self.transform, {y=self.transform.y-self.collisionShape.h})
end
self.tween2 = tween.new(self.speed, self.player.transform, {y=self.transY})
end
end
if self.player.onMovingFloor then
self.flx = self.player.onMovingFloor.transform.x - self.player.transform.x
end
self.once = true
megautils.state().system.afterUpdate = function(s)
camera.main.tween2:update(1/60)
if camera.main.tween:update(1/60) then
camera.main.transitionDone = true
camera.main.transition = false
camera.main.once = false
camera.main.scrollx, camera.main.scrolly, camera.main.scrollw, camera.main.scrollh = camera.main.toSection.transform.x,
camera.main.toSection.transform.y, camera.main.toSection.collisionShape.w, camera.main.toSection.collisionShape.h
if camera.main.updateSections then
camera.main:updateBounds()
camera.main.toSection = nil
if camera.main.freeze then
megautils.unfreeze(megautils.groups()["hurtableOther"])
for k, v in pairs(megautils.groups()["hurtableOther"]) do
v.control = true
end
end
if camera.main.player ~= nil and camera.main.player.onMovingFloor then
camera.main.player.onMovingFloor.dontRemove = nil
end
end
camera.main.tween = nil
camera.main.tween2 = nil
camera.main.transitionDone = true
megautils.state().system.afterUpdate = nil
end
if camera.main.player ~= nil and camera.main.player.onMovingFloor then
camera.main.player.onMovingFloor.transform.x = camera.main.player.transform.x + camera.main.flx
camera.main.player.onMovingFloor.transform.y = camera.main.player.transform.y + camera.main.player.collisionShape.h
end
camera.main.transform.x = math.round(camera.main.transform.x)
camera.main.transform.y = math.round(camera.main.transform.y)
view.x, view.y = math.round(camera.main.transform.x), math.round(camera.main.transform.y)
camera.main:updateFuncs()
end
end
else
if o ~= nil and self.doScrollX and o.collisionShape ~= nil then
self.transform.x = math.round(o.transform.x) - (view.w/2) + ((w or o.collisionShape.w)/2)
self.transform.x = math.clamp(self.transform.x+(offX or 0), self.scrollx, self.scrollx+self.scrollw-view.w)
end
if o ~= nil and self.doScrollY and o.collisionShape ~= nil then
self.transform.y = math.round(o.transform.y) - (view.h/2) + ((h or o.collisionShape.h)/2)
self.transform.y = math.clamp(self.transform.y+(offY or 0), self.scrolly, self.scrolly+self.scrollh-view.h)
end
view.x, view.y = math.round(self.transform.x), math.round(self.transform.y)
self:updateFuncs()
end
end
function camera:updateFuncs()
for k, v in pairs(self.funcs) do
v(self)
end
end
|
function renderGrantingTicket(gt)
local html = string.format([[
<html>
<body>
<h1>Granting ticket</h1>
<p id="key">%s</p>
<p id="iv">%s</p>
<p id="blob">%s</p>
<p id="owner">%s</p>
</body>
</html>]],
toHex(gt.key),
toHex(gt.IV),
toHex(gt.blob),
gt.user)
return html
end
function renderTicket(ticket)
local html = string.format([[
<html>
<body>
<h1>Ticket</h1>
<p id="id">%d</p>
<p id="blob">%s</p>
</body>
</html>]],
ticket.id,
toHex(ticket.blob))
return html
end
|
pg = pg or {}
pg.enemy_data_statistics_266 = {
[13600304] = {
cannon = 43,
reload = 150,
speed_growth = 0,
cannon_growth = 2200,
battle_unit_type = 60,
air = 0,
base = 126,
dodge = 0,
durability_growth = 70400,
antiaircraft = 105,
speed = 10,
reload_growth = 0,
dodge_growth = 0,
luck = 0,
antiaircraft_growth = 1400,
hit = 10,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 0,
durability = 4930,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
hit_growth = 144,
armor = 0,
id = 13600304,
equipment_list = {
1000632,
1000637,
1000642
}
},
[13600305] = {
cannon = 0,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
battle_unit_type = 65,
air = 48,
base = 127,
dodge = 0,
durability_growth = 65600,
antiaircraft = 115,
speed = 10,
reload_growth = 0,
dodge_growth = 0,
luck = 0,
antiaircraft_growth = 1800,
hit = 10,
antisub_growth = 0,
air_growth = 2000,
antisub = 0,
torpedo = 0,
durability = 4420,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
hit_growth = 144,
armor = 0,
id = 13600305,
equipment_list = {
1000647,
1000652,
1000657,
1000662
}
},
[13600306] = {
cannon = 22,
reload = 150,
speed_growth = 0,
cannon_growth = 626,
battle_unit_type = 50,
air = 0,
base = 248,
dodge = 22,
durability_growth = 21600,
antiaircraft = 72,
speed = 36,
reload_growth = 0,
dodge_growth = 360,
luck = 0,
antiaircraft_growth = 3000,
hit = 25,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 94,
durability = 3060,
armor_growth = 0,
torpedo_growth = 5200,
luck_growth = 0,
hit_growth = 280,
armor = 0,
id = 13600306,
equipment_list = {
1000712,
1000717,
1000722
}
},
[13600307] = {
cannon = 38,
reload = 150,
speed_growth = 0,
cannon_growth = 936,
battle_unit_type = 55,
air = 0,
base = 249,
dodge = 11,
durability_growth = 30400,
antiaircraft = 156,
speed = 25,
reload_growth = 0,
dodge_growth = 162,
luck = 0,
antiaircraft_growth = 3744,
hit = 14,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 76,
durability = 3570,
armor_growth = 0,
torpedo_growth = 3366,
luck_growth = 0,
hit_growth = 210,
armor = 0,
id = 13600307,
equipment_list = {
1000682,
1000687,
1000692,
1000697
}
},
[13600308] = {
cannon = 54,
reload = 150,
speed_growth = 0,
cannon_growth = 1500,
battle_unit_type = 60,
air = 0,
base = 250,
dodge = 11,
durability_growth = 41600,
antiaircraft = 88,
speed = 18,
reload_growth = 0,
dodge_growth = 136,
luck = 0,
antiaircraft_growth = 3380,
hit = 25,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 58,
durability = 4420,
armor_growth = 0,
torpedo_growth = 2800,
luck_growth = 0,
hit_growth = 280,
armor = 0,
id = 13600308,
equipment_list = {
1000742,
1000747,
1000752,
1000757
}
},
[13600309] = {
cannon = 78,
reload = 150,
speed_growth = 0,
cannon_growth = 3400,
battle_unit_type = 65,
air = 0,
base = 251,
dodge = 11,
durability_growth = 65600,
antiaircraft = 106,
speed = 14,
reload_growth = 0,
dodge_growth = 136,
luck = 0,
antiaircraft_growth = 4680,
hit = 25,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 0,
durability = 6630,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
hit_growth = 280,
armor = 0,
id = 13600309,
equipment_list = {
1000777,
1000782,
1000787
},
buff_list = {
{
ID = 50510,
LV = 3
}
}
},
[13600310] = {
cannon = 36,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
battle_unit_type = 70,
air = 86,
base = 252,
dodge = 9,
durability_growth = 58880,
antiaircraft = 134,
speed = 16,
reload_growth = 0,
dodge_growth = 96,
luck = 0,
antiaircraft_growth = 5280,
hit = 25,
antisub_growth = 0,
air_growth = 4127,
antisub = 0,
torpedo = 0,
durability = 5780,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
hit_growth = 280,
armor = 0,
id = 13600310,
equipment_list = {
1000802,
1000807,
1000817,
1000822
}
},
[13600311] = {
cannon = 0,
reload = 150,
hit_growth = 120,
cannon_growth = 0,
pilot_ai_template_id = 20001,
air = 0,
speed_growth = 0,
dodge = 0,
battle_unit_type = 20,
base = 90,
durability_growth = 6800,
reload_growth = 0,
dodge_growth = 0,
antiaircraft = 0,
speed = 30,
hit = 8,
antisub_growth = 0,
air_growth = 0,
luck = 0,
torpedo = 0,
durability = 750,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
antiaircraft_growth = 0,
armor = 0,
antisub = 0,
id = 13600311,
appear_fx = {
"appearsmall"
}
},
[13600312] = {
cannon = 0,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 20001,
air = 0,
battle_unit_type = 35,
dodge = 0,
base = 70,
durability_growth = 2550,
antiaircraft = 0,
reload_growth = 0,
dodge_growth = 0,
speed = 15,
luck = 0,
hit = 8,
antisub_growth = 0,
air_growth = 0,
wave_fx = "danchuanlanghuaxiao2",
torpedo = 70,
durability = 280,
armor_growth = 0,
torpedo_growth = 864,
luck_growth = 0,
hit_growth = 120,
armor = 0,
antiaircraft_growth = 0,
id = 13600312,
antisub = 0,
appear_fx = {
"appearsmall"
},
equipment_list = {
1000862
}
},
[13600313] = {
cannon = 60,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 80000,
air = 0,
battle_unit_type = 15,
dodge = 0,
base = 80,
durability_growth = 2550,
antiaircraft = 0,
reload_growth = 0,
dodge_growth = 0,
speed = 30,
luck = 0,
hit = 81,
antisub_growth = 0,
air_growth = 0,
antiaircraft_growth = 0,
torpedo = 120,
durability = 80,
armor_growth = 0,
torpedo_growth = 900,
luck_growth = 0,
hit_growth = 1200,
armor = 0,
id = 13600313,
antisub = 0,
appear_fx = {
"appearsmall"
},
equipment_list = {
1000867
}
},
[13600321] = {
cannon = 7,
reload = 150,
speed_growth = 0,
cannon_growth = 560,
battle_unit_type = 25,
air = 0,
base = 445,
dodge = 0,
durability_growth = 10000,
antiaircraft = 60,
speed = 15,
reload_growth = 0,
dodge_growth = 0,
luck = 0,
antiaircraft_growth = 1000,
hit = 10,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 33,
durability = 300,
armor_growth = 0,
torpedo_growth = 3250,
luck_growth = 0,
hit_growth = 144,
armor = 0,
id = 13600321,
equipment_list = {
1100072,
1100182,
1100492
}
},
[13600322] = {
cannon = 16,
reload = 150,
speed_growth = 0,
cannon_growth = 880,
battle_unit_type = 30,
air = 0,
base = 446,
dodge = 0,
durability_growth = 19200,
antiaircraft = 120,
speed = 15,
reload_growth = 0,
dodge_growth = 0,
luck = 0,
antiaircraft_growth = 2250,
hit = 10,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 26,
durability = 510,
armor_growth = 0,
torpedo_growth = 2250,
luck_growth = 0,
hit_growth = 144,
armor = 0,
id = 13600322,
equipment_list = {
1100337,
1100272,
1100492
}
},
[13600323] = {
cannon = 18,
reload = 150,
speed_growth = 0,
cannon_growth = 1800,
battle_unit_type = 35,
air = 0,
base = 447,
dodge = 0,
durability_growth = 35200,
antiaircraft = 95,
speed = 12,
reload_growth = 0,
dodge_growth = 0,
luck = 0,
antiaircraft_growth = 1400,
hit = 10,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 17,
durability = 1190,
armor_growth = 0,
torpedo_growth = 1250,
luck_growth = 0,
hit_growth = 144,
armor = 0,
id = 13600323,
equipment_list = {
1100552,
1100587
}
},
[13600324] = {
cannon = 43,
reload = 150,
speed_growth = 0,
cannon_growth = 2200,
battle_unit_type = 60,
air = 0,
base = 448,
dodge = 0,
durability_growth = 70400,
antiaircraft = 105,
speed = 10,
reload_growth = 0,
dodge_growth = 0,
luck = 0,
antiaircraft_growth = 1400,
hit = 10,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 0,
durability = 4930,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
hit_growth = 144,
armor = 0,
id = 13600324,
equipment_list = {
1100052,
1100917,
1100922
}
},
[13600325] = {
cannon = 0,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
battle_unit_type = 65,
air = 48,
base = 449,
dodge = 0,
durability_growth = 65600,
antiaircraft = 115,
speed = 10,
reload_growth = 0,
dodge_growth = 0,
luck = 0,
antiaircraft_growth = 1800,
hit = 10,
antisub_growth = 0,
air_growth = 2000,
antisub = 0,
torpedo = 0,
durability = 4420,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
hit_growth = 144,
armor = 0,
id = 13600325,
equipment_list = {
1100052,
1100387,
1100932,
1100937
}
},
[13600327] = {
cannon = 16,
reload = 150,
speed_growth = 0,
cannon_growth = 880,
battle_unit_type = 30,
air = 0,
base = 446,
dodge = 0,
durability_growth = 19200,
antiaircraft = 160,
speed = 15,
reload_growth = 0,
dodge_growth = 0,
luck = 0,
antiaircraft_growth = 2250,
hit = 10,
antisub_growth = 0,
air_growth = 0,
antisub = 0,
torpedo = 28,
durability = 890,
armor_growth = 0,
torpedo_growth = 2250,
luck_growth = 0,
hit_growth = 144,
armor = 0,
id = 13600327,
equipment_list = {
1100337,
1100272,
1100492,
650207
}
}
}
return
|
--- Class describes system Token object
--
-- @classmod Token
-- @pragma nostrip
setfenv(1, require "sysapi-ns")
require "token.token-windef"
local stringify = require "utils.stringify"
local Sid = require "sid"
local ntdll = ffi.load("ntdll")
assert(ntdll)
local advapi32 = ffi.load("advapi32")
assert(advapi32)
local Token = SysapiMod("Token")
local TokenGetters = {
--- domain name of the token user SID
domain = nil,
--- integrity level
integrityLevel = nil,
--- user name of the token user SID
user = nil
}
local Token_MT = {
__index = function(self, name)
local method = rawget(Token, name)
if method then
return method
end
local getter = rawget(TokenGetters, name)
if getter then
return getter(self, name)
end
end
}
local types = {
cache = function(self, name)
rawset(self, name, ffi.typeof(name))
rawset(self, "P" .. name, ffi.typeof(name .. "*"))
end
}
local SECURITY_MANDATORY_TABLE = stringify.getTable("SECURITY_MANDATORY")
types:cache("TOKEN_USER")
types:cache("TOKEN_MANDATORY_LABEL")
local function getUserAndDomain(obj)
local info = obj:queryInfo(ffi.C.TokenUser, types.TOKEN_USER, types.PTOKEN_USER)
if info then
local sid = Sid.init(info.User.Sid)
local domain, user = sid:getDomainAndUsername()
rawset(obj, "user", user)
rawset(obj, "domain", domain)
end
end
function TokenGetters.user(obj, name)
getUserAndDomain(obj)
return rawget(obj, name)
end
function TokenGetters.domain(obj, name)
getUserAndDomain(obj)
return rawget(obj, name)
end
function TokenGetters.integrityLevel(obj, name)
local info = obj:queryInfo(ffi.C.TokenIntegrityLevel, types.TOKEN_MANDATORY_LABEL, types.PTOKEN_MANDATORY_LABEL)
if info then
local integrityLvl = ntdll.RtlSubAuthoritySid(info.Label.Sid, 0)
if integrityLvl ~= NULL then
integrityLvl = SECURITY_MANDATORY_TABLE[integrityLvl[0]]
rawset(obj, name, integrityLvl)
return integrityLvl
end
end
end
--- Open process token
-- @param procHandle handle of the process
-- @param[opt=TOKEN_ALL_ACCESS] access to token
-- @function Token.open
function Token.open(procHandle, access)
local token = ffi.new("HANDLE[1]")
if advapi32.OpenProcessToken(procHandle, access or TOKEN_ALL_ACCESS, token) then
return setmetatable({handle = ffi.gc(token[0], ffi.C.CloseHandle)}, Token_MT)
end
end
--- Query information about the token
-- @param infoClass `TOKEN_INFORMATION_CLASS`
-- @param ctype C type returned by `ffi.typeof()`
-- @param ctypePtr pointer to the type
-- @return typed pointer depends on `typeName` or `nil`
function Token:queryInfo(infoClass, ctype, ctypePtr)
local data = ctype()
local size = ffi.sizeof(ctype)
local retSize = ffi.new("ULONG[1]")
local err = ntdll.NtQueryInformationToken(self.handle, infoClass, data, size, retSize)
if NT_SUCCESS(err) then
return ffi.cast(ctypePtr, data), retSize[0]
elseif IS_STATUS(err, STATUS_BUFFER_TOO_SMALL) then
size = retSize[0]
data = ffi.new("char[?]", size)
err = ntdll.NtQueryInformationToken(self.handle, infoClass, data, size, retSize)
if NT_SUCCESS(err) then
return ffi.cast(ctypePtr, data), retSize[0]
end
end
end
return Token
|
-----------------------------------
-- Area: Jugner Forest
-- NPC: qm2 (???)
-- Involved in Quest: Sin Hunting - RNG AF1
-- !pos -10.946 -1.000 313.810 104
-----------------------------------
function onTrade(player, npc, trade)
end
function onTrigger(player, npc)
if player:getCharVar("sinHunting") == 4 then
player:startEvent(13, 0, 1107)
end
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
if csid == 13 then
player:setCharVar("sinHunting", 5)
end
end
|
local table = require("__flib__.table")
local util = require("scripts.util")
return function(recipe_book, dictionaries)
for name, prototype in pairs(global.prototypes.lab) do
-- Add to items
for _, item_name in ipairs(prototype.lab_inputs) do
local item_data = recipe_book.item[item_name]
if item_data then
item_data.researched_in[#item_data.researched_in + 1] = {class = "lab", name = name}
end
end
recipe_book.lab[name] = {
class = "lab",
compatible_fuels = {},
fuel_categories = util.process_energy_source(prototype),
hidden = prototype.has_flag("hidden"),
inputs = table.map(prototype.lab_inputs, function(v) return {class = "item", name = v} end),
placed_by = util.process_placed_by(prototype),
prototype_name = name,
researching_speed = prototype.researching_speed,
size = util.get_size(prototype),
unlocked_by = {}
}
dictionaries.lab:add(name, prototype.localised_name)
dictionaries.lab_description:add(name, prototype.localised_description)
end
end
|
--Automatically generated by SWGEmu Spawn Tool v0.12 loot editor.
aakuan_robe = {
minimumLevel = 0,
maximumLevel = -1,
customObjectName = "",
directObjectTemplate = "object/tangible/wearables/robe/aakuan_robe.iff",
craftingValues = {
},
customizationStringNames = {},
customizationValues = {},
skillMods = {{"resistance_poison", 10}}
}
addLootItemTemplate("aakuan_robe", aakuan_robe)
|
RegisterClientScript()
ENTITY.IsNetworked = true
ENTITY.CollisionType = 2
ENTITY.PlayerControlled = false
ENTITY.MaxHealth = 0
ENTITY.Properties = {
{ Name = "modelPath", Type = PropertyType.String, Default = "", Shared = true },
{ Name = "offset", Type = PropertyType.FloatPosition3D, Default = Vec3(0, 0, 0), Shared = true },
{ Name = "renderOrder", Type = PropertyType.Integer, Default = 0, Shared = true },
{ Name = "rotation", Type = PropertyType.FloatPosition3D, Default = Vec3(0, 0, 0), Shared = true }, --TODO: EulerAngles
{ Name = "scale", Type = PropertyType.FloatSize3D, Default = Vec3(1, 1, 1), Shared = true },
}
if (CLIENT) then
function ENTITY:Initialize()
self:AddModel({
ModelPath = self:GetProperty("modelPath"),
Offset = self:GetProperty("offset"),
RenderOrder = self:GetProperty("renderOrder"),
Rotation = self:GetProperty("rotation"),
Scale = self:GetProperty("scale"),
})
end
end
|
local cctest = require "Framework"
local function deepCopy(t)
local t2 = {}
for k, v in pairs(t) do
if type(v) == "table" then
t2[k] = deepCopy(v)
else
t2[k] = v
end
end
return t2
end
local suite = cctest.newSuite "TestExpectations"
"EXPECT_EQ_PASS" (function()
EXPECT_EQ(10, 10)
end)
"EXPECT_EQ_FAIL" (function()
EXPECT_EQ(10, 5)
end)
"EXPECT_UEQ_PASS" (function()
EXPECT_UEQ(10, 5)
end)
"EXPECT_UEQ_FAIL" (function()
EXPECT_UEQ(10, 10)
end)
"EXPECT_FLOAT_EQ_PASS" (function()
local n = math.random(1, 100000000) / 100000000
EXPECT_FLOAT_EQ(n, n)
end)
"EXPECT_FLOAT_EQ_FAIL" (function()
local n = math.random(1, 100000000) / 100000000
EXPECT_FLOAT_EQ(n, n - 0.000005)
end)
"EXPECT_FLOAT_EQ_FAIL2" (function()
local n = math.random(1, 100000000) / 100000000
EXPECT_FLOAT_EQ(n, n, "A")
end)
"EXPECT_DEEP_TABLE_EQ_PASS" (function()
local t1 = {{},{y = "No"},{},n = 43, ["Noot Noot"] = {x = 64, {}}}
local t2 = deepCopy(t1)
EXPECT_DEEP_TABLE_EQ(t1, t2)
end)
"EXPECT_DEEP_TABLE_EQ_FAIL1" (function()
local t1 = {{},{y = "No"},{},n = 43, ["Noot Noot"] = {x = 64, {}}}
local t2 = deepCopy(t1)
t1.sdadsa = ""
EXPECT_DEEP_TABLE_EQ(t1, t2)
end)
"EXPECT_DEEP_TABLE_EQ_FAIL2" (function()
local t1 = {{},{y = "No"},{},n = 43, ["Noot Noot"] = {x = 64, {}}}
local t2 = deepCopy(t1)
t2.sdadsa = ""
EXPECT_DEEP_TABLE_EQ(t1, t2)
end)
"EXPECT_TRUE_PASS" (function()
EXPECT_TRUE(true)
end)
"EXPECT_TRUE_FAIL" (function()
EXPECT_TRUE(false)
end)
"EXPECT_FALSE_PASS" (function()
EXPECT_FALSE(false)
end)
"EXPECT_FALSE_FAIL" (function()
EXPECT_FALSE(true)
end)
"EXPECT_TRUTHY_PASS_ALL" (function()
EXPECT_TRUTHY(true)
EXPECT_TRUTHY("A")
EXPECT_TRUTHY(3)
EXPECT_TRUTHY({})
end)
"EXPECT_TRUTHY_FAIL" (function()
EXPECT_TRUTHY(nil)
end)
"EXPECT_FALSEY_FAIL1" (function()
EXPECT_FALSEY(true)
end)
"EXPECT_FALSEY_FAIL2" (function()
EXPECT_FALSEY(3)
end)
"EXPECT_FALSEY_FAIL3" (function()
EXPECT_FALSEY("a")
end)
"EXPECT_FALSEY_FAIL4" (function()
EXPECT_FALSEY({})
end)
"EXPECT_THROW_PASS" (function()
EXPECT_THROW_ANY_ERROR(function()
error("Hello there.")
end)
end)
"EXPECT_THROW_FAIL" (function()
EXPECT_THROW_ANY_ERROR(function() end)
end)
"EXPECT_THROW_FAIL2" (function()
EXPECT_THROW_ANY_ERROR()
end)
"EXPECT_THROW_MATCHED_ERROR_PASS" (function()
EXPECT_THROW_MATCHED_ERROR(function()
error("Test Test 123")
end, "Test Test %d+")
end)
"EXPECT_THROW_MATCHED_ERROR_FAIL" (function()
EXPECT_THROW_MATCHED_ERROR(function()
error("Test Test 123")
end, "Test Test a")
end)
"EXPECT_THROW_MATCHED_ERROR_FAIL2" (function()
EXPECT_THROW_MATCHED_ERROR(function() end)
end)
"EXPECT_THROW_MATCHED_ERROR_FAIL3" (function()
EXPECT_THROW_MATCHED_ERROR()
end)
"EXPECT_NO_THROW_PASS" (function()
EXPECT_NO_THROW(function() end)
end)
"EXPECT_NO_THROW_FAIL" (function()
EXPECT_NO_THROW(function() error("Yeet") end)
end)
"EXPECT_NO_THROW_FAIL2" (function()
EXPECT_NO_THROW()
end)
local suite2 = cctest.newSuite "AssertionTests"
"DOES_NOT_RUN_PAST" (function()
ASSERT_EQ(10, 5) -- Should stop here.
error("This should not be thrown.")
end)
local suite3 = cctest.newSuite "Short"
"SHORT_NAME" (function()
ASSERT_EQ(10, 5) -- Should stop here.
error("This should not be thrown.")
end)
"EVEN_SHORTER_NAME" (function()
FAIL()
end)
cctest.runAllTests()
|
E2VguiPanels["vgui_elements"]["functions"]["dpropertysheet"] = {}
E2VguiPanels["vgui_elements"]["functions"]["dpropertysheet"]["createFunc"] = function(uniqueID, pnlData, e2EntityID,changes)
local parent = E2VguiLib.GetPanelByID(pnlData["parentID"],e2EntityID)
local panel = vgui.Create("DPropertySheet",parent)
--remove copy here otherwise we add the last panel twice (because its also in the changes table)
pnlData["addsheet"] = nil
E2VguiLib.applyAttributes(panel,pnlData,true)
local data = E2VguiLib.applyAttributes(panel,changes)
table.Merge(pnlData,data)
--notify server of removal and also update client table
function panel:OnRemove()
E2VguiLib.RemovePanelWithChilds(self,e2EntityID)
end
--TODO: Add color hook to make it colorable
panel["uniqueID"] = uniqueID
panel["pnlData"] = pnlData
E2VguiLib.RegisterNewPanel(e2EntityID ,uniqueID, panel)
E2VguiLib.UpdatePosAndSizeServer(e2EntityID,uniqueID,panel)
return true
end
E2VguiPanels["vgui_elements"]["functions"]["dpropertysheet"]["modifyFunc"] = function(uniqueID, e2EntityID, changes)
local panel = E2VguiLib.GetPanelByID(uniqueID,e2EntityID)
if panel == nil or not IsValid(panel) then return end
local data = E2VguiLib.applyAttributes(panel,changes)
table.Merge(panel["pnlData"],data)
E2VguiLib.UpdatePosAndSizeServer(e2EntityID,uniqueID,panel)
return true
end
--[[-------------------------------------------------------------------------
HELPER FUNCTIONS
---------------------------------------------------------------------------]]
E2Helper.Descriptions["dpropertysheet(n)"] = "Creates a new propertysheet with the given index and parents it to the given panel. Can also be a DFrame or DPanel instance."
E2Helper.Descriptions["dpropertysheet(nn)"] = "Creates a new propertysheet with the given index and parents it to the given panel. Can also be a DFrame or DPanel instance."
E2Helper.Descriptions["setColor(xdo:v)"] = "Sets the color of the panel."
E2Helper.Descriptions["setColor(xdo:vn)"] = "Sets the color of the panel."
E2Helper.Descriptions["setColor(xdo:xv4)"] = "Sets the color of the panel."
E2Helper.Descriptions["setColor(xdo:nnn)"] = "Sets the color of the panel."
E2Helper.Descriptions["setColor(xdo:nnnn)"] = "Sets the color of the panel."
E2Helper.Descriptions["addSheet(xdo:sxdps)"] = "name,panel,icon(material name or icon)\nAdds a new tab.Icon names can be found here: http://wiki.garrysmod.com/page/Silkicons \nNote: use \"icon16/<Icon-name>.png\" as material name for icons. E.g. \"icon16/accept.png\""
E2Helper.Descriptions["closeTab(xdo:s)"] = "Closes the tab with the given name."
E2Helper.Descriptions["getColor(xdo:e)"] = "Returns the color of the panel."
E2Helper.Descriptions["getColor4(xdo:e)"] = "Returns the color of the panel."
E2Helper.Descriptions["getColor4(xdo:e)"] = "Returns the color of the panel."
--default functions
E2Helper.Descriptions["setPos(xdo:nn)"] = "Sets the position."
E2Helper.Descriptions["setPos(xdo:xv2)"] = "Sets the position."
E2Helper.Descriptions["getPos(xdo:e)"] = "Returns the position."
E2Helper.Descriptions["setSize(xdo:nn)"] = "Sets the size."
E2Helper.Descriptions["setSize(xdo:xv2)"] = "Sets the size."
E2Helper.Descriptions["getSize(xdo:e)"] = "Returns the size."
E2Helper.Descriptions["setWidth(xdo:n)"] = "Sets only the width."
E2Helper.Descriptions["getWidth(xdo:e)"] = "Returns the width."
E2Helper.Descriptions["setHeight(xdo:n)"] = "Sets only the height."
E2Helper.Descriptions["getHeight(xdo:e)"] = "Returns the height."
E2Helper.Descriptions["setVisible(xdo:n)"] = "Sets whether or not the the element is visible."
E2Helper.Descriptions["setVisible(xdo:ne)"] = "Sets whether or not the the element is visible only for the provided player. This function automatically calls modify internally."
E2Helper.Descriptions["isVisible(xdo:e)"] = "Returns whether or not the the element is visible."
E2Helper.Descriptions["dock(xdo:n)"] = "Sets the docking mode. See _DOCK_* constants."
E2Helper.Descriptions["dockMargin(xdo:nnnn)"] = "Sets the margin when docked."
E2Helper.Descriptions["dockPadding(xdo:nnnn)"] = "Sets the padding when docked."
E2Helper.Descriptions["create(xdo:)"] = "Creates the element for every player in the player list."
E2Helper.Descriptions["create(xdo:r)"] = "Creates the element for every player in the provided list"
E2Helper.Descriptions["modify(xdo:)"] = "Applies all changes made to the element for every player in the player's list.\nDoes not create the element again if it got removed!."
E2Helper.Descriptions["modify(xdo:r)"] = "Applies all changes made to the element for every player in the provided list.\nDoes not create the element again if it got removed!."
E2Helper.Descriptions["closePlayer(xdo:e)"] = "Closes the element on the specified player but keeps the player inside the element's player list. (Also see remove(E))"
E2Helper.Descriptions["closeAll(xdo:)"] = "Closes the element on all players in the player's list. Keeps the players inside the element's player list. (Also see removeAll())"
E2Helper.Descriptions["addPlayer(xdo:e)"] = "Adds a player to the element's player list.\nThese players will see the object when it's created or modified (see create()/modify())."
E2Helper.Descriptions["removePlayer(xdo:e)"] = "Removes a player from the elements's player list."
E2Helper.Descriptions["remove(xdo:e)"] = "Removes this element only on the specified player and also removes the player from the element's player list. (e.g. calling create() again won't target this player anymore)"
E2Helper.Descriptions["removeAll(xdo:)"] = "Removes this element from all players in the player list and clears the element's player list."
E2Helper.Descriptions["getPlayers(xdo:)"] = "Retrieve the current player list of this element."
E2Helper.Descriptions["setPlayers(xdo:r)"] = "Sets the player list for this element."
|
-----------------------------------------
-- ID: 4186
-- Item: Airborne
-- A goblin with a rainbow colored parasail rides in a downward spiral
-----------------------------------------
function onItemCheck(target)
return 0
end
function onItemUse(target)
end
|
-- Addon global
local TheClassicRace = _G.TheClassicRace
-- WoW API
local CreateFrame, GetChannelList, GetNumDisplayChannels = _G.CreateFrame, _G.GetChannelList, _G.GetNumDisplayChannels
-- Libs
local LibStub = _G.LibStub
local Serializer = LibStub:GetLibrary("AceSerializer-3.0")
local AceComm = LibStub:GetLibrary("AceComm-3.0")
local LibCompress = LibStub:GetLibrary("LibCompress")
local EncodeTable = LibCompress:GetAddonEncodeTable()
--[[
TheClassicRaceNetwork uses AceComm to send and receive messages over Addon channels
and broadcast them as events once received fully over our EventBus.
--]]
---@class TheClassicRaceNetwork
---@field Core TheClassicRaceCore
---@field EventBus TheClassicRaceEventBus
local TheClassicRaceNetwork = {}
TheClassicRaceNetwork.__index = TheClassicRaceNetwork
TheClassicRace.Network = TheClassicRaceNetwork
setmetatable(TheClassicRaceNetwork, {
__call = function(cls, ...)
return cls.new(...)
end,
})
---@param Core TheClassicRaceCore
---@param EventBus TheClassicRaceEventBus
function TheClassicRaceNetwork.new(Core, EventBus)
local self = setmetatable({}, TheClassicRaceNetwork)
self.Core = Core
self.EventBus = EventBus
self.MessageBuffer = {}
self.ready = false
-- create a Frame to use as thread to recieve events on
self.Thread = CreateFrame("Frame")
self.Thread:Hide()
self.Thread:SetScript("OnEvent", function(_, event)
TheClassicRace:DebugPrint(event)
if (event == "CHANNEL_UI_UPDATE") then
self:InitChannel()
end
end)
-- register for CHANNEL_UI_UPDATE so we know when our channel might have changed
self.Thread:RegisterEvent("CHANNEL_UI_UPDATE")
AceComm:RegisterComm(TheClassicRace.Config.Network.Prefix, function(...)
self:HandleAddonMessage(...)
end)
return self
end
function TheClassicRaceNetwork:Init()
-- init channel if we're not too early (otherwise we'll wait for CHANNEL_UI_UPDATE)
if GetNumDisplayChannels() > 0 then
self:InitChannel()
end
end
function TheClassicRaceNetwork:InitChannel()
local channelId = nil
local channels = { GetChannelList() }
local i = 2
while i < #channels do
if (channels[i] == TheClassicRace.Config.Network.Channel.Name) then
channelId = channels[i - 1]
break
end
i = i + 3
end
TheClassicRace.Config.Network.Channel.Id = channelId
if not self.ready then
self.ready = true
self.EventBus:PublishEvent(TheClassicRace.Config.Events.NetworkReady)
end
end
function TheClassicRaceNetwork:HandleAddonMessage(...)
-- sender is always full name (name-realm)
local prefix, message, _, sender = ...
-- check if it's our prefix
if prefix ~= TheClassicRace.Config.Network.Prefix then
return
end
-- completely ignore anything from other realms
local _, senderRealm = self.Core:SplitFullPlayer(sender)
if not self.Core:IsMyRealm(senderRealm) then
return
end
-- so we can pretend to be somebody else
if sender == self.Core:RealMe() then
sender = self.Core:Me()
end
-- ignore our own messages
if sender == self.Core:RealMe() then
return
end
local decoded = EncodeTable:Decode(message)
local decompressed, _ = LibCompress:Decompress(decoded)
local _, object = Serializer:Deserialize(decompressed)
local event, payload = object[1], object[2]
TheClassicRace:TracePrint("Received Network Event: " .. event .. " From: " .. sender)
self.EventBus:PublishEvent(event, payload, sender)
end
function TheClassicRaceNetwork:SendObject(event, object, channel, target, prio)
-- default to using the configured channel ID
if channel == "CHANNEL" and target == nil then
target = TheClassicRace.Config.Network.Channel.Id
end
-- no channel, no broadcast
if channel == "CHANNEL" and target == nil then
return
end
-- no priority, BULK
if prio == nil then
prio = "BULK"
end
local payload = Serializer:Serialize({event, object})
local compressed = LibCompress:CompressHuffman(payload)
local encoded = EncodeTable:Encode(compressed)
TheClassicRace:TracePrint("Send Network Event: " .. event .. " Channel: " .. channel ..
" Size: " .. string.len(encoded) .. " / " .. string.len(payload))
AceComm:SendCommMessage(
TheClassicRace.Config.Network.Prefix,
encoded,
channel,
target,
prio)
end
|
resource.AddFile("sound/earthquake.mp3")
util.PrecacheSound("earthquake.mp3")
local next_update_time
local tremor = ents.Create("env_physexplosion")
tremor:SetPos(Vector(0,0,0))
tremor:SetKeyValue("radius",9999999999)
tremor:SetKeyValue("spawnflags", 7)
tremor:Spawn()
if (SERVER) then
CreateConVar("sv_earthquake", 1)
CreateConVar("sv_earthquake_chance_is_1_in", 500)
end
for k, v in pairs(player.GetAll()) do
v:Notify("Earthquake gamescripts have been loaded.");
if v:IsSuperAdmin() then
v:Notify("To send an earthquake use 'perp_earthquake' or set 'sv_earthquake' to 1 for random earthquakes.")
v:ChatPrint("To send an earthquake use 'perp_earthquake' or set 'sv_earthquake' to 1 for random earthquakes.")
end
end
function EarthquakeCMD(pl, cmd, args)
if pl and pl:IsValid() and !pl:IsSuperAdmin() then return false end
Earthquake()
end
concommand.Add('perp_earthquake', EarthquakeCMD)
function Earthquake()
local force = math.random(10,1000)
tremor:SetKeyValue("magnitude",force/6)
for k,v in pairs(plys) do
v:EmitSound("earthquake.mp3", force/6, 100)
end
tremor:Fire("explode","",0.5)
util.ScreenShake(Vector(0,0,0), force, math.random(25,50), math.random(5,12), 9999999999)
for k,e in pairs(en) do
local rand = math.random(650,1000)
if (rand < force and rand % 2 == 0) then
e:Fire("enablemotion","",0)
constraint.RemoveAll(e)
end
if (e:IsOnGround()) then
e:TakeDamage((force / 100) + 5, game.GetWorld())
end
end
end
function EarthquakeRandom()
local en = ents.FindByClass("prop_physics")
local plys = ents.FindByClass("player")
if (math.random(0, GetConVarNumber("sv_earthquake_chance_is_1_in")) < 1) then
Earthquake()
end
next_update_time = CurTime() + 1
end
function EarthquakeThink()
if (GetConVarNumber("sv_earthquakes") ~= 1) then return end
if ( CurTime() > ( next_update_time or 0 ) ) then
EarthquakeRandom()
end
end
hook.Add('Think', 'Earthquake', EarthquakeThink)
|
Account = {}
local mt = {__mode = "k"}
local proxies = {}
setmetatable(proxies, mt)
function Account:new(o)
local o = o or {}
proxies[o] = {balance = 0}
setmetatable(o, self)
self.__index = self
return o
end
function Account:deposit(v)
proxies[self].balance = proxies[self].balance + v
end
function Account:withdraw(v)
if v > proxies[self].balance then error "insufficient funds" end
proxies[self].balance = proxies[self].balance - v
end
function Account:balance()
return proxies[self].balance
end
return Account
|
local I18N = require("core.I18N")
I18N.add {
keybind = {
menu = {
hint = "決定 [キーの変更] ",
topics = {
name = "名前",
primary = "キー1",
alternate = "キー2",
joystick = "ジョイスティック",
},
conflict = {
text = "キー割り当ての衝突があります。",
prompt = "[決定] 衝突の解決 [Esc] キャンセル",
},
prompt = [=[
設定したいキーの組み合わせを押してください。
[決定] クリア [Esc] キャンセル
]=],
},
category = {
default = "◆ デフォルト",
shortcut = "◆ ショートカット",
selection = "◆ 選択",
menu = "◆ メニュー",
game = "◆ ゲーム",
wizard = "◆ ウィザード",
},
escape = "戻る",
cancel = "キャンセル",
enter = "決定",
north = "北",
south = "南",
east = "東",
west = "西",
northwest = "北西",
northeast = "北東",
southwest = "南西",
southeast = "南東",
-- NOTE: has special name formatting behavior
shortcut = "ショートカット",
-- NOTE: has special name formatting behavior
select = "選択",
next_page = "次のページ",
previous_page = "前のページ",
next_menu = "次のメニュー",
previous_menu = "前のメニュー",
switch_mode = "モード変更",
switch_mode_2 = "モード変更2",
identify = "詳細",
portrait = "ポートレイト",
wait = "待機する",
quick_menu = "クイックメニュー",
zap = "振る",
inventory = "アイテムを調べる",
quick_inventory = "クイックアイテム",
get = "拾う",
drop = "置く",
chara_info = "能力・スキル情報",
eat = "食べる",
wear = "装備",
cast = "魔法を唱える",
drink = "飲む",
read = "読む",
fire = "射撃",
go_down = "降りる",
go_up = "上る",
save = "セーブ",
search = "周囲を調べる",
interact = "干渉",
skill = "スキル",
close = "閉じる",
rest = "休憩する",
target = "ターゲット",
dig = "掘る",
use = "使う",
bash = "体当たり",
open = "開く",
dip = "混ぜる",
pray = "祈る",
offer = "捧げる",
journal = "冒険日誌",
material = "マテリアル",
trait = "特徴",
look = "見る",
give = "渡す",
throw = "投げる",
ammo = "装填",
autodig = "Autodig",
quicksave = "クイックセーブ",
quickload = "クイックロード",
help = "ヘルプ",
message_log = "メッセージログ",
chat_box = "チャット",
tcg = "カードゲーム",
update_screen = "スクリーン更新",
dump_player_info = "プレイヤー情報出力",
reload_autopick = "Autopickの再読み込み",
screenshot = "スクリーンショット",
open_console = "コンソールを開く",
wizard_mewmewmew = "うみみゃぁ!",
wizard_wish = "願う",
wizard_advance_time = "時間を進める",
wizard_delete_map = "マップの削除",
},
}
|
--[[This is a lua script for use in conky.
You will need to add the following to your .conkyrc before the TEXT section:
lua_load $HOME/.config/conky/LUA/Full_Conky_Smile_Battery_Gauge.lua (or wherever you put your luas)
lua_draw_hook_pre conky_SmileBattery
I am not even close to being a programmer. It couldn't have been done without the help of the wonderful guide on the #! forums.
http://crunchbang.org/forums/viewtopic.php?id=17246
]]
require 'cairo'
function conky_SmileBattery()
if conky_window == nil then return end
w=conky_window.width
h=conky_window.height
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
cr = cairo_create(cs)
if w<h then
BoxS=w
else
BoxS=h
end
------------------------------------------------------Settings
Batt=1-tonumber(conky_parse('${battery_percent}'))/100
Line_Thickness=10
---------------------Color Settings
Battery_Full_Red=0/256
Battery_Full_Green=256/256
Battery_Full_Blue=0/256
Battery_Empty_Red=256/256
Battery_Empty_Green=0/256
Battery_Empty_Blue=0/256
alpha=256/256
---------------------Color Calculations
DeltaR=Battery_Full_Red-Battery_Empty_Red
DeltaG=Battery_Full_Green-Battery_Empty_Green
DeltaB=Battery_Full_Blue-Battery_Empty_Blue
red=Battery_Full_Red-(Batt*DeltaR)
green=Battery_Full_Green-(Batt*DeltaG)
blue=Battery_Full_Blue-(Batt*DeltaB)
---------------------Circle Settings
Radius=BoxS/2-Line_Thickness
PosX=w/2
PosY=h/2
PosIRX=PosX-BoxS/5
PosILX=PosX+BoxS/5
PosIY=PosY-BoxS/6
EyeSize=BoxS/12
SAngle=0
EAngle=2*math.pi
---------------------Mouth Settings
MouthR=Radius-w/6
if Batt<=.50 then
MouthStart=Batt*math.pi
MouthEnd=math.pi-(Batt*math.pi)
PosMY=PosY+BoxS/16-Batt*MouthR
else
MouthStart=(3*math.pi/2)-(math.pi)*(Batt-.5)
MouthEnd=(3*math.pi/2)+(math.pi)*(Batt-.5)
PosMY=PosY+BoxS/2-Batt*MouthR
end
---------------------Draw
cairo_arc(cr,PosX,PosY,Radius,SAngle,EAngle)
cairo_set_source_rgba(cr,red,green,blue,alpha)
cairo_set_line_width(cr,Line_Thickness)
cairo_stroke(cr)
cairo_arc(cr,PosIRX,PosIY,EyeSize,SAngle,EAngle)
cairo_set_source_rgba(cr,red,green,blue,alpha)
cairo_fill(cr)
cairo_stroke(cr)
cairo_arc(cr,PosILX,PosIY,EyeSize,SAngle,EAngle)
cairo_set_source_rgba(cr,red,green,blue,alpha)
cairo_fill(cr)
cairo_arc(cr,PosX,PosMY,MouthR,MouthStart,MouthEnd)
cairo_set_source_rgba(cr,red,green,blue,alpha)
cairo_fill(cr)
---------------------Finishing up
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function
|
local StringBuffer = require("string_buffer")
-- TODO 親密度の実装
return {
-- 「ねぇねぇ」と肩をたたく感じ。
{
id = "0Poke",
content = function(shiori, ref)
return shiori:talk("m_Key", ref)
end,
},
-- 頭をなでなでする感じ。
{
id = "0Headなで",
content = function(shiori, ref)
local __ = shiori.var
if __("_Quiet") then
return nil
end
local intimacy = __("親密度") or 0
if intimacy < 50 then
return shiori:talk("頭なで親密度低")
elseif intimacy < 100 then
return shiori:talk("頭なで親密度中")
end
end,
},
{
id = "頭なで親密度低",
content = function(shiori, ref)
return
[[\0\s[><]……っ。]],
[[\0\s[きょとん]ど、どしたの急に。]]
end,
},
-- おでこを小突く感じ。
{
id = "0HeadPoke",
content = function(shiori, ref)
local __ = shiori.var
if __("_Quiet") then
return nil
end
return shiori:talk("頭つつき")
end,
},
{
id = "頭つつき",
content = function(shiori, ref)
return [[
\p[0]\s[><]あぅっ!
]]
end,
},
-- おっぱいをモミモミする感じ。
{
id = "0BustPoke",
content = function(shiori, ref)
local __ = shiori.var
if __("_InGame") then
return shiori:talk("胸もみ対局中")
end
local intimacy = __("親密度") or 0
if intimacy < 50 then
return shiori:talk("胸もみ親密度低")
elseif intimacy < 100 then
return shiori:talk("胸もみ親密度中")
end
return nil
end,
},
{
id = "胸もみ親密度低",
content = function(shiori, ref)
local __ = shiori.var
__("_LightningMomer", os.time())
return [[
\p[0]\s[えー]…すけべ。
]]
end,
},
{
id = "胸もみ親密度低",
content = function(shiori, ref)
local __ = shiori.var
local time = __("_LightningMomer") or 0
if os.time() - time < 10 then
__("IsLightningMomer", true)
return [[
\p[0]\s[呆れ]校内で噂になってるライトニングモマーって……
もしかして${User}のこと?
]]
else
return shiori:talk("0BustPoke")
end
end,
},
-- おっぱいをナデナデする感じ。
{
id = "0Bustなで",
content = function(shiori, ref)
local __ = shiori.var
if __("_InGame") then
return shiori:talk("胸なで対局中")
end
local intimacy = __("親密度") or 0
if intimacy < 50 then
return shiori:talk("胸なで親密度低")
end
return nil
end,
},
{
id = "胸なで親密度低",
content = function(shiori, ref)
local __ = shiori.var
__("_LightningMomer", os.time())
return [[
\p[0]\s[呆れ]えっ……わたしにそういうこと求めてるの?@
]]
end,
},
{
id = "0LegPoke",
content = function(shiori, ref)
local __ = shiori.var
local shibire = __("_SeizaShibire") or 0
-- しびれは1分くらい
if os.time() - shibire < 60 then
return [[
\0
\s[照れびっくり]ひゃんっ!@
\s[-1]\_w[1000]
\s[照れ]……バ、バカ!
]]
end
return [[
\0
\s[きょとん]
え、な、何…@?
]]
end,
},
{
id = "0Legなで",
content = function(shiori, ref)
local __ = shiori.var
local shibire = __("_SeizaShibire") or 0
-- しびれは1分くらい
if os.time() - shibire < 60 then
return [[
\0
\s[照れ><]……っ!@……っ!!!@
\s[-1]\_w[2000]
\s[照れ]もう知らないからねっ!@バカ!@\-
]]
end
return [[
\0
\s[呆れ]……${User}って、足フェチ?@\n
\s[ほっ]まぁ、${User}が触りたいなら触って良いけどね…@。
]],
[[
\0
\s[きょとん]マッサージしてくれるの?
]],
[[
\0
\s[きょとん]手つきがちょっとやらしい…?@よ?
]]
end,
},
}
|
--GPU: Shapes Drawing.
--luacheck: push ignore 211
local Config, GPU, yGPU, GPUVars, DevKit = ...
--luacheck: pop
local lg = love.graphics
local VRamVars = GPUVars.VRam
local SharedVars = GPUVars.Shared
local RenderVars = GPUVars.Render
local CalibrationVars = GPUVars.Calibration
--==Varss Constants==--
local UnbindVRAM = VRamVars.UnbindVRAM
local Verify = SharedVars.Verify
local ofs = CalibrationVars.Offsets
--==GPU Shapes API==--
--Clears the whole screen with black or the given color id.
function GPU.clear(c) UnbindVRAM()
c = c or 0
c = Verify(c,"The color id","number",true)
if c > 15 or c < 0 then return error("The color id is out of range.") end --Error
lg.clear(c/255,0,0,1) RenderVars.ShouldDraw = true
end
--Draws a point/s at specific location/s, accepts the colorid as the last args, x and y of points must be provided before the colorid.
function GPU.points(...) UnbindVRAM()
local args = {...} --The table of args
GPU.pushColor() --Push the current color.
if not (#args % 2 == 0) then GPU.color(args[#args]) table.remove(args,#args) end --Extract the colorid (if exists) from the args and apply it.
for k,v in ipairs(args) do Verify(v,"Arg #"..k,"number") end --Error
for k,v in ipairs(args) do if (k % 2 == 1) then args[k] = v + ofs.point[1] else args[k] = v + ofs.point[2] end end --Apply the offset.
lg.points(unpack(args)) RenderVars.ShouldDraw = true --Draw the points and tell that changes has been made.
GPU.popColor() --Pop the last color in the stack.
end
GPU.point = GPU.points --Just an alt name :P.
--Draws a line/s at specific location/s, accepts the colorid as the last args, x1,y1,x2 and y2 of points must be provided before the colorid.
function GPU.lines(...) UnbindVRAM()
local args = {...} --The table of args
GPU.pushColor() --Push the current color.
if not (#args % 2 == 0) then GPU.color(args[#args]) table.remove(args,#args) end --Extract the colorid (if exists) from the args and apply it.
for k,v in ipairs(args) do if type(v) ~= "number" then return false, "Arg #"..k.." must be a number." end end --Error
if #args < 4 then return false, "Need at least two vertices to draw a line." end --Error
args[1], args[2] = args[1] + ofs.line_start[1], args[2] + ofs.line_start[2]
for k=3, #args do if (k % 2 == 1) then args[k] = args[k] + ofs.line[1] else args[k] = args[k] + ofs.line[2] end end --Apply the offset.
lg.line(unpack(args)) RenderVars.ShouldDraw = true --Draw the lines and tell that changes has been made.
GPU.popColor() --Pop the last color in the stack.
end
GPU.line = GPU.lines --Just an alt name :P.
--Draw a rectangle filled, or lines only.
--X pos, Y pos, W width, H height, L linerect, C colorid.
function GPU.rect(x,y,w,h,l,c) UnbindVRAM()
x,y,w,h,l,c = x, y, w, h, l or false, c --In case if they are not provided.
--It accepts all the args as a table.
if type(x) == "table" then
x,y,w,h,l,c = unpack(x)
l,c = l or false, c --In case if they are not provided.
end
--Args types verification
x = Verify(x,"X pos","number")
y = Verify(y,"Y pos","number")
w = Verify(w,"Width","number")
h = Verify(h,"Height","number")
if c then c = Verify(c,"The color id","number",true) end
if c then --If the colorid is provided, pushColor then set the color.
GPU.pushColor()
GPU.color(c)
end
--Apply the offset.
if l then
x,y = x+ofs.rect_line[1], y+ofs.rect_line[2] --Pos
w,h = w+ofs.rectSize_line[1], h+ofs.rectSize_line[2] --Size
else
x,y = x+ofs.rect[1], y+ofs.rect[2] --Pos
w,h = w+ofs.rectSize[1], h+ofs.rectSize[2] --Size
end
lg.rectangle(l and "line" or "fill",x,y,w,h) RenderVars.ShouldDraw = true --Draw and tell that changes has been made.
if c then GPU.popColor() end --Restore the color from the stack.
end
--Draws a circle filled, or lines only.
function GPU.circle(x,y,r,l,c,s) UnbindVRAM()
x,y,r,l,c,s = x, y, r, l or false, c, s --In case if they are not provided.
--It accepts all the args as a table.
if x and type(x) == "table" then
x,y,r,l,c,s = unpack(x)
l,c = l or false, c --In case if they are not provided.
end
--Args types verification
x = Verify(x,"X pos","number")
y = Verify(y,"Y pos","number")
Verify(r,"Radius","number")
if c then c = Verify(c,"The color id","number",true) end
if s then s = Verify(s,"Segments","number",true) end
if c then --If the colorid is provided, pushColor then set the color.
GPU.pushColor()
GPU.color(c)
end
--Apply the offset.
if l then
x,y,r = x+ofs.circle_line[1], y+ofs.circle_line[2], r+ofs.circle_line[3]
else
x,y,r = x+ofs.circle[1], y+ofs.circle[2], r+ofs.circle[3]
end
lg.circle(l and "line" or "fill",x,y,r,s) RenderVars.ShouldDraw = true --Draw and tell that changes has been made.
if c then GPU.popColor() end --Restore the color from the stack.
end
--Draws a triangle
function GPU.triangle(x1,y1,x2,y2,x3,y3,l,col) UnbindVRAM()
x1,y1,x2,y2,x3,y3,l,col = x1,y1,x2,y2,x3,y3,l or false,col --Localize them
if type(x1) == "table" then
x1,y1,x2,y2,x3,y3,l,col = unpack(x1)
end
x1 = Verify(x1,"x1","number")
y1 = Verify(y1,"y1","number")
x2 = Verify(x2,"x2","number")
y2 = Verify(y2,"y2","number")
x3 = Verify(x3,"x3","number")
y3 = Verify(y3,"y3","number")
if col then col = Verify(col,"Color","number",true) end
if col and (col < 0 or col > 15) then return error("color is out of range ("..col..") expected [0,15]") end
if col then GPU.pushColor() GPU.color(col) end
--Apply the offset
if l then
x1,y1,x2,y2,x3,y3 = x1 + ofs.triangle_line[1], y1 + ofs.triangle_line[2], x2 + ofs.triangle_line[1], y2 + ofs.triangle_line[2], x3 + ofs.triangle_line[1], y3 + ofs.triangle_line[2]
else
x1,y1,x2,y2,x3,y3 = x1 + ofs.triangle[1], y1 + ofs.triangle[2], x2 + ofs.triangle[1], y2 + ofs.triangle[2], x3 + ofs.triangle[1], y3 + ofs.triangle[2]
end
lg.polygon(l and "line" or "fill", x1,y1,x2,y2,x3,y3)
if col then GPU.popColor() end
end
--Draw a polygon
function GPU.polygon(...) UnbindVRAM()
local args = {...} --The table of args
GPU.pushColor() --Push the current color.
if not (#args % 2 == 0) then GPU.color(args[#args]) table.remove(args,#args) end --Extract the colorid (if exists) from the args and apply it.
for k,v in ipairs(args) do Verify(v,"Arg #"..k,"number") end --Error
if #args < 6 then return error("Need at least three vertices to draw a polygon.") end --Error
for k,v in ipairs(args) do if (k % 2 == 0) then args[k] = v + ofs.polygon[2] else args[k] = v + ofs.polygon[1] end end --Apply the offset.
lg.polygon("fill",unpack(args)) RenderVars.ShouldDraw = true --Draw the lines and tell that changes has been made.
GPU.popColor() --Pop the last color in the stack.
end
--Draws a ellipse filled, or lines only.
function GPU.ellipse(x,y,rx,ry,l,c,s) UnbindVRAM()
x,y,rx,ry,l,c,s = x or 0, y or 0, rx or 1, ry or 1, l or false, c, s --In case if they are not provided.
--It accepts all the args as a table.
if x and type(x) == "table" then
x,y,rx,ry,l,c,s = unpack(x)
end
--Args types verification
x = Verify(x,"X coord","number")
y = Verify(y,"Y coord","number")
Verify(rx,"X radius","number")
Verify(ry, "Y radius","number")
if c then c = Verify(c,"The color id","number",true) end
if s then s = Verify(s,"Segments","number",true) end
if c then --If the colorid is provided, pushColor then set the color.
GPU.pushColor()
GPU.color(c)
end
--Apply the offset.
if l then
x,y,rx,ry = x+ofs.ellipse_line[1], y+ofs.ellipse_line[2], rx+ofs.ellipse_line[3], ry+ofs.ellipse_line[4]
else
x,y,rx,ry = x+ofs.ellipse[1], y+ofs.ellipse[2], rx+ofs.ellipse[3], ry+ofs.ellipse[4]
end
lg.ellipse(l and "line" or "fill",x,y,rx,ry,s) RenderVars.ShouldDraw = true --Draw and tell that changes has been made.
if c then GPU.popColor() end --Restore the color from the stack.
end
|
local snips = {}
snips = {
s({ trig = 'cha', name = 'Chapter', dscr = 'Insert a new chapter.' }, {
t { '\\chapter{' },
i(1),
t { '}\\label{cha:' },
l(l._1:gsub('[^%w]+', '_'):gsub('_*$', ''):lower(), 1),
t { '}', '', '' },
}, { condition = conds.line_begin }),
s({ trig = 'sec', name = 'Section', dscr = 'Insert a new section.', regTrig = true }, {
t { '\\section{' },
i(1),
t { '}\\label{sec:' },
l(l._1:gsub('[^%w]+', '_'):gsub('_*$', ''):lower(), 1),
t { '}', '', '' },
}, { condition = conds.line_begin }),
s({ trig = 'ssec', name = 'star Section', dscr = 'Insert a section without index.', regTrig = true }, {
t { '\\section*{' },
i(1),
t { '}\\label{sec:' },
l(l._1:gsub('[^%w]+', '_'):gsub('_*$', ''):lower(), 1),
t { '}', '', '' },
}, { condition = conds.line_begin }),
s({ trig = 'sub', name = 'subSection', dscr = 'Insert a new subsection.', regTrig = true }, {
t { '\\subsection{' },
i(1),
t { '}\\label{sub:' },
l(l._1:gsub('[^%w]+', '_'):gsub('_*$', ''):lower(), 1),
t { '}', '', '' },
}, { condition = conds.line_begin }),
s({ trig = 'ssub', name = 'star subSection', dscr = 'Insert a subsection without index.', regTrig = true }, {
t { '\\subsection*{' },
i(1),
t { '}\\label{sub:' },
l(l._1:gsub('[^%w]+', '_'):gsub('_*$', ''):lower(), 1),
t { '}', '', '' },
}, { condition = conds.line_begin }),
}
return snips
|
-- Setup moonscript enviroment
local moonscript = require('moonscript.base')
local loadstring = moonscript.loadstring
load = function(chunk, ...)
if chunk:find('^%a+% *=') then
chunk = 'export ' .. chunk
end
return loadstring(chunk, ...)
end
dofile = moonscript.dofile
loadfile = moonscript.loadfile
local trim = require('moonscript.util').trim
local rewrite_traceback = require('moonscript.errors').rewrite_traceback
local _traceback = debug.traceback
debug.traceback = function(message, level)
original = _traceback('', (level or 1) + 1)
rewritten = rewrite_traceback(trim(original), message or '')
if rewritten then
return trim(rewritten)
elseif message then
return message .. '\n' .. trim(original)
else
return trim(original)
end
end
-- Load moonscript script
dofile('init.moon')
|
--
-- Featherweight
-- Very small functions that implement basic behaviors.
--
-- Where applicable, I refer to tables like so:
-- list: a table where integer keys between 1 and N are non-nil.
-- object: a table with no expected ordering to keys
--
local fw = {}
--- first( a, b, [c...] )
-- Returns first non-nil value from the parameters
-- Slightly optimized: a and b checks are unrolled from the loop
function fw.first(a, b, ...)
if type(a)~="nil" then return a end
if type(b)~="nil" then return b end
for i = 1, select('#', ...) do
local c = select(i, ...)
if type(c)~="nil" then return c end
end
end
--- callable( function )
-- returns true if function appears to be a valid function object
function fw.callable(fn)
return type(fn)=="function" or
(getmetatable(fn) and type(getmetatable(fn).__call)=="function")
end
--- meta( [table], style )
-- Returns a table who's metatable has been set to style
function fw.meta(object, style)
if type(style)=="nil" then
style, object = object, {}
end
return setmetatable(object, style)
end
-- Common weak reference tables
-- Example: x=meta(weakValue)
fw.weakKey = { __mode = "k" }
fw.weakValue = { __mode = "v" }
fw.weakKeyValue = { __mode = "kv" }
--- const( object )
-- Returns a new table where changing values is an error
-- Existing values are inherited from object.
do
local function _constnewindex(_, key)
error("Const table error: "..key, 2)
end
function fw.const(object)
local cont = setmetatable({}, {
__index = object,
__newindex = _constnewindex
})
return cont, object
end
end
--- enum( list )
-- Returns a table where all indexes in list are keys whose value is the index in object
-- Example: enum { "one", "two", "three" } --> { one=1, two=2, three=3 }
function fw.enum(list)
local object = {}
for i = 1, #list do
object[list[i]] = i
end
return object, list
end
-- keys( object )
-- Returns all keys from a table as a list (unsorted)
-- Note: only keys available from pairs, not inherited keys
function fw.keys( object )
local list = {}
for key, _ in pairs(object) do
list[#list+1] = key
end
return list
end
--- shuffle( list )
-- Modifies a list to Fisher-Yates-Randomize its elements
function fw.shuffle(list)
local N = #list
for i = 1, N-1 do
local r = math.random(i, N)
if i ~= r then
list[i], list[r] = list[r], list[i]
end
end
return list
end
--- apply( function, [parameters...] )
-- Returns a function where the parameter list has been partially applied
function fw.apply(func, ...)
local params, args = {}, {}
local N = select('#', ...)
for i = 1, N do params[i] = select(i, ...) end
return function(...)
for k, _ in pairs(args) do args[k] = nil end
local M = select('#', ...)
for i = 1, N do args[i] = params[i] end
local i = N + 1
for j = 1, M do
args[i] = select(j, ...)
i = i + 1
end
local unpack = unpack or table.unpack
return func(unpack(args))
end
end
--- compose( function, function, [functions...] )
-- Returns a callable table that composes function calls together
-- Result is fn1(fn2(fn3(etc(...))))
-- functional composure via metatable
do
-- save on memory by reusing a table and not recursing
local function collect(t, ...)
local M, N = select('#',...), #t
for i = 1, M do t[i] = select(i, ...) end
for i = M+1, N do t[i] = nil end
return t
end
local _mt = {
__call = function(t, ...)
local unpack = unpack or table.unpack
local res = {...}
for i = #t, 1, -1 do
collect(res, t[i](unpack(res)))
end
return unpack(res)
end
}
function fw.compose(...)
return setmetatable({...}, _mt)
end
end
--- fprintf( file, template, [options...] )
function fw.fprintf(file, str, ...)
return f:write(str:format(...))
end
--- printf( template, [options...] )
function fw.printf(str, ...)
return io.stdout:write(str:format(...))
end
--- memoize( function )
-- caches and returns the results of function(key) calls
-- function stored at table-value index to prevent key collision
do
local funcIndex = {}
local _mt = {
__call = function(store, key, ...)
local value = store[key]
if type(value)=="nil" then
value = store[funcIndex](key, ...)
store[key] = value
end
return value
end
}
function fw.memoize(fn)
return setmetatable( {[funcIndex]=fn}, _mt )
end
end
--- copy( object )
-- Returns a shallow copy of a table (metatable also copied)
function fw.copy(object)
local child = {}
for key, value in pairs(object) do
child[key]=value
end
return setmetatable(child, getmetatable(object))
end
--- extend( parent, [child] )
-- returns a shallow copy of a table, without erasing existing keys in child
function fw.extend(parent, child)
child = child or {}
for key, value in pairs(parent) do
if type(rawget(child, key))=="nil" then
child[key]=value
end
end
if not getmetatable(child) then
setmetatable(child, getmetatable(object))
end
return child
end
--- mixin( destination, source, [more_sources...] )
-- Copies key/values from source object to destination object
-- Non-destructive (doesn't overwrite values already in object)
-- Left preference for which value is copied when sources have overlapping keys
-- Returns destination object
function fw.mixin(dst, ...)
for i = 1, select('#', ...) do
for key, value in pairs(select(i, ...)) do
if type(rawget(dst, key))=="nil" then
rawset(dst, key, value)
end
end
end
return dst
end
--- new( class )
-- Implements basic class instantiation (class.__index will be added)
-- Returns new instance object
function fw.new(class, ...)
if type(class.__index)=="nil" then
class.__index = class
end
local object = setmetatable({}, class)
local init = object.init
if init then
init(object, ...)
end
return object
end
-- Convienience object for use as a parent class:
-- Example usage:
-- local myClass = fw.Object:extend { init = function(parameters) end }
-- myClass:mixin( someBehavior, someOtherBehavior )
-- local myInstance = myClass:new( parameters )
fw.Object = { extend = fw.extend, mixin = fw.mixin, new = fw.new }
--- flatten( list, [depth] )
-- Convert a list of lists in-place into a single list
function fw.flatten(list)
local insert, remove = table.insert, table.remove
local i = 1
while i < #list do
if type(list[i])=="table" then
local sub = remove(list, i)
for j = 1, #sub do
insert(list, i, sub[j])
end
else
i = i + 1
end
end
return list
end
--- uniq( list, [comparator] )
-- Removes duplicate items from a list
function fw.uniq(list, cmp)
local remove = table.remove
local i = 1
while i < #list do
for j = #list, i+1 do
if (cmp and cmp(list[i], list[j])) or (list[i]==list[j]) then
remove(list, j)
end
end
i = i + 1
end
return list
end
return fw
|
-----------------------------------------
-- Spell: Klimaform
-- Increases magic accuracy for spells of the same element as current weather
-----------------------------------------
require("scripts/globals/status")
function onMagicCastingCheck(caster, target, spell)
return 0
end
function onSpellCast(caster, target, spell)
target:addStatusEffect(tpz.effect.KLIMAFORM, 1, 0, 180)
return tpz.effect.KLIMAFORM
end
|
huurton_huntress = Creature:new {
objectName = "@mob/creature_names:huurton_huntress",
socialGroup = "huurton",
faction = "",
level = 28,
chanceHit = 0.37,
damageMin = 270,
damageMax = 280,
baseXp = 2914,
baseHAM = 8200,
baseHAMmax = 10000,
armor = 0,
resists = {15,15,15,140,200,-1,-1,-1,-1},
meatType = "meat_wild",
meatAmount = 15,
hideType = "hide_wooly",
hideAmount = 15,
boneType = "bone_mammal",
boneAmount = 15,
milkType = "milk_wild",
milk = 400,
tamingChance = 0.25,
ferocity = 0,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = PACK + KILLER + STALKER,
optionsBitmask = AIENABLED,
diet = CARNIVORE,
templates = {"object/mobile/huurton_hue.iff"},
hues = { 24, 25, 26, 27, 28, 29, 30, 31 },
controlDeviceTemplate = "object/intangible/pet/huurton_hue.iff",
scale = 1.15,
lootGroups = {},
weapons = {},
conversationTemplate = "",
attacks = {
{"knockdownattack",""},
{"stunattack",""}
}
}
CreatureTemplates:addCreatureTemplate(huurton_huntress, "huurton_huntress")
|
--[[
modulo textbox:
responsável por implementar uma textbox simplíssima
--]]
local textboxModule = {}
textboxModule.createTextbox = function(posX, posY, displayText)
textbox = {}
local posX = posX
local posY = posY
local displayText = displayText
local enteredText = ""
local banned_words = {}
--preenche dicionário de palavras banidas
-- para cada linha,
for line in io.lines("bannedwords.txt") do
banned_words[line] = true
end
textbox.textInput = function(textbox, t)
enteredText = enteredText .. t
end
textbox.draw = function(textbox)
love.graphics.printf(displayText .. ": " .. enteredText, posX, posY, love.graphics.getWidth())
end
local max_length = 50
textbox.getTextForSending = function(textbox)
--checa se há alguma palavra banida na mensagem
for word in string.gmatch(enteredText, "%w+") do
if banned_words[word] then
enteredText = ""
return false, "---"
end
end
--já limpa, isso vai ser enviado
old = string.sub(enteredText, 1, max_length)
enteredText = ""
return true, old
end
return textbox
end
return textboxModule
|
--[[--
ui.submit{
name = name, -- optional HTML name
value = value, -- HTML value
text = value -- text on button
}
This function places a HTML form submit button in the active slot. Currently the text displayed on the button and the value attribute are the same, so specifying both a 'value' and a 'text' makes no sense.
--]]--
function ui.submit(args)
if slot.get_state_table().form_readonly == false then
local args = args or {}
local attr = table.new(args.attr)
attr.type = "submit"
attr.name = args.name
attr.value = args.value or args.text
return ui.tag{ tag = "input", attr = attr }
end
end
|
-----------------------------------
-- Area: Aht Urhgan Whitegate
-- NPC: Ahkk Jharcham
-- Quest 'Keeping Notes'
-- !pos 0.1 -1 -76 50
-----------------------------------
require("scripts/globals/npc_util")
require("scripts/globals/quests")
-----------------------------------
function onTrade(player, npc, trade)
local keepingNotes = player:getQuestStatus(AHT_URHGAN, tpz.quest.id.ahtUrhgan.KEEPING_NOTES)
if keepingNotes == QUEST_ACCEPTED and npcUtil.tradeHas(trade, {917, 929}) then -- parchment + black ink
player:startEvent(11)
elseif keepingNotes == QUEST_COMPLETED and npcUtil.tradeHas(trade, 917) then -- parchment
player:startEvent(13) -- Doesn't need any more parchment.
end
end
function onTrigger(player, npc)
local keepingNotes = player:getQuestStatus(AHT_URHGAN, tpz.quest.id.ahtUrhgan.KEEPING_NOTES)
if keepingNotes == QUEST_AVAILABLE then
player:startEvent(9)
elseif keepingNotes == QUEST_ACCEPTED then
player:startEvent(14)
elseif keepingNotes == QUEST_COMPLETED then
player:startEvent(12)
else
player:startEvent(10)
end
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
if csid == 9 then
player:addQuest(AHT_URHGAN, tpz.quest.id.ahtUrhgan.KEEPING_NOTES)
elseif csid == 11 then
player:confirmTrade()
player:moghouseFlag(16)
player:completeQuest(AHT_URHGAN, tpz.quest.id.ahtUrhgan.KEEPING_NOTES)
end
end
|
--[[------------------------------------------------------------------------------
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.
----------------------------------------------------------------------------------
\file DebuggerMain.lua
\brief Main entry point from the CPP debugger and handles all
debugger related actions.
\version
S Panyam 07/Nov/08
- Initial version
--------------------------------------------------------------------------------]]
--
-- Set the package path to where all these files are going to be.
--
--[[------------------------------------------------------------------------------
if string.find(package.path, "libgameengine") == nil then
package.path = package.path .. ";lua/?.lua;shared/libgameengine/lua/debugger/?.lua"
end
--------------------------------------------------------------------------------]]
require "Json"
require "Debugger"
LUA_HOOKCALL = 0
LUA_HOOKRET = 1
LUA_HOOKLINE = 2
LUA_HOOKCOUNT = 3
LUA_HOOKTAILRET = 4
--[[------------------------------------------------------------------------------
\brief Get the global debugger instance and creates one if it does not
exist.
\param pDebugger - The cpp debugger object with which to creat the
debugger if one does not exist.
\version
S Panyam 07/Nov/08
- Initial version
--------------------------------------------------------------------------------]]
function GetDebugger(pDebugger)
if THE_DEBUGGER == nil then
THE_DEBUGGER = Debugger:New(pDebugger)
end
return THE_DEBUGGER
end
--[[------------------------------------------------------------------------------
\brief Called when a new context is added.
\param pDebugger - The debug server that invoked this script.
\param pContext - The debug context of a lua context being added.
\version
S Panyam 12/Nov/08
- Initial version
--------------------------------------------------------------------------------]]
function ContextAdded(pDebugger, pContext, name)
local debugger = GetDebugger(pDebugger)
local debugContext = debugger:GetDebugContext(pContext, name)
debugContext.running = true
-- print("======================================================================")
-- print("Adding Context: " .. name .. " - " .. tostring(pDebgugger) .. ", " .. tostring(pContext))
debugger:SendEvent("ContextAdded",
{["address"] = debugContext["address"],
["name"] = debugContext["name"],
["running"] = debugContext["running"],
["location"] = debugContext["location"]})
end
--[[------------------------------------------------------------------------------
\brief Called when a new context is removed.
\param pDebugger - The debug server that invoked this script.
\param pContext - The debug context of a lua context being removed.
\version
S Panyam 12/Nov/08
- Initial version
--------------------------------------------------------------------------------]]
function ContextRemoved(pDebugger, pContext)
local debugger = GetDebugger(pDebugger)
local debugContext = debugger:RemoveDebugContext(pContext)
if debugContext ~= nil then
-- print("Removed Context: " .. tostring(pDebguger) .. ", " .. tostring(pContext))
debugger:SendEvent("ContextRemoved",
{["address"] = debugContext["address"],
["name"] = debugContext["name"],
["running"] = debugContext["running"],
["location"] = debugContext["location"]})
end
end
--[[------------------------------------------------------------------------------
\brief Called when the debug function is hit.
\param pDebugger - The debug server that invoked this script.
\param pDebug - The debug context of a lua context being debugged.
\version
S Panyam 04/Nov/08
- Initial version
--------------------------------------------------------------------------------]]
function HandleBreakpoint(pDebugger, pContextAddr, contextName, debug_event,
debug_name, debug_namewhat, debug_what,
debug_source, debug_currentline, debug_nups,
debug_linedefined, debug_lastlinedefined)
-- initialise debugger if not already done
local debugger = GetDebugger(pDebugger)
local debugContext = debugger:GetDebugContext(pContextAddr, contextName)
--[[ So waht do we do here?
1. Essentially we need to check whether we should wait here or not.
This is determined by whether there are breakpoints on this line.
There are 2 kinds of breakpoint: Implicit and Explicit.
Explicit ones are ones set by the user.
Implicit ones are the ones resulted from user commands affecting
the flow - eg step, next, continue, until, return and so on.
So we have to check for implicit and explicit breakpoints.
--]]
local lastCommand = debugContext.lastCommand
local handled = true
local bp = nil
if debug_event == LUA_HOOKCALL then
-- A function was entered so only stop here if:
-- A BP exists in the function, or last command was step (but not next)
bp = debugger:GetBPByFunction(debug_name)
if bp ~= nil or (lastCommand ~= nil and lastCommand["type"] == "step") then
handled = false
end
elseif debug_event == LUA_HOOKRET and lastCommand ~= nil then
-- a return from a function only triggers a
-- break if the last command was a "finish" (in the same function)
local cmd_type = lastCommand["type"]
local cmd_data = lastCommand["data"]
if cmd_type == "finish" and cmd_data["function"] == debug_name then
handled = false
end
elseif debug_event == LUA_HOOKLINE then
-- is there an explicit breakpoint?
bp = debugger:GetBPByFile(debug_source, debug_currentline)
-- print("Debugger, Context, BP: " .. tostring(debugger) .. ", " .. tostring(debugContext) .. ", " .. tostring(bp))
if bp ~= nil then
handled = false
elseif lastCommand ~= nil then
-- no look for the implicit breakpoitns - these are tricky!!
-- line changes are the trickiest because they have to take into
-- account "next", "step" and "until" commands which may infact
-- have been set in "other" functions
local cmd_type = lastCommand["type"]
local cmd_data = lastCommand["data"]
if cmd_type == "step" or
(cmd_type == "until" and cmd_data["line"] == debug_currentline and cmd_data["file"] == debug_source) or
(cmd_type == "next" and cmd_data["function"] == debug_name) then
handled = false
end
end
end
if not handled then
--[[--
print("===============================================================")
print("======= BreakPoint: " .. tostring(bp))
if bp ~= nil then
print("======= FileName: " .. tostring(bp.filename))
print("======= Linenum: " .. tostring(bp.linenum))
print("======= Function: " .. tostring(bp.funcname))
print("======= Enabled: " .. tostring(bp.enabled))
end
print("===============================================================")
--]]--
debugContext:Pause()
debugContext:ClearLastCommand()
debugContext.location = {
["event"] = debug_event,
["name"] = debug_name,
["namewhat"] = debug_namewhat,
["what"] = debug_what,
["source"] = debug_source,
["currentline"] = debug_currentline,
["nups"] = debug_nups,
["linedefined"] = debug_linedefined,
["lastlinedefined"] = debug_lastlinedefined,
}
-- tell the client we have stopped!
debugger:SendEvent("ContextPaused", debugContext);
else
debugContext.location = nil
end
-- nope no breakpoints found,
return handled
end
--[[------------------------------------------------------------------------------
\brief Called when the debug client sends the server a message
(ie run, break, step etc).
\param pMessage - The string representing a message. It is
completely our (this script's) responsibility
to decode the message.
\version
S Panyam 04/Nov/08
- Initial version
--------------------------------------------------------------------------------]]
function HandleMessage(pDebugger, pMessage)
local debugger = GetDebugger(pDebugger)
-- local message = Json.Decode(pMessage)
local message = pMessage
local msg_id = message["id"]
local msg_cmd = message["cmd"]
local msg_data = message["data"]
local code, value = -1, "Unknown Error"
if debugger.commandHandlers[msg_cmd] == nil then
print("Invalid message: " .. msg_cmd)
value = "Invalid command"
else
if msg_data == nil then
msg_data = ""
end
code, value = debugger.commandHandlers[msg_cmd](debugger, msg_data)
end
-- simply send back the message along with the type,
-- code and value of the response
-- debugger:SendReply(code, value, message)
return Json.Encode({["type"] = "Reply",
["code"] = code,
["value"] = value,
["original"] = pMessage})
---[[
--]]
end
|
Macro {
area="Shell Info QView Tree"; key="Esc"; flags="EmptyCommandLine"; description="Use Esc to toggle panels on/off"; action = function()
Keys('CtrlO')
end;
}
|
--
-- COINS PILES DEMO 1 - JVP
--
plane = Plane(0,1,0)
plane.col = "#111111"
plane.friction=.7
v:add(plane)
function coins_pile(coin_type,N,xp,zp)
if(coin_type==1) then
coin_width=7.0
coin_height=1.1
end
if(coin_type==2) then
coin_width=6.0
coin_height=1.0
end
if(coin_type==3) then
coin_width=5.0
coin_height=0.9
end
if(coin_type==4) then
coin_width=4.0
coin_height=0.8
end
if(coin_type==5) then
coin_width=3.5
coin_height=0.75
end
for i = 0,N do
q = btQuaternion(1,0,0,1)
o = btVector3(xp-.5+math.random(0,10)*.1,
.6+i*coin_height,
zp-.5+math.random(0,10)*.1)
d = Cylinder(coin_width,coin_width,coin_height,1)
d.mass=coin_width*coin_height*.1
d.col = "#00ff00"
d.trans=btTransform(q,o)
d.friction=.4
d.restitution=.1
d.pre_sdl="object{coin("..coin_type..")"
d.post_sdl="}\n"
v:add(d)
end
end
coins_pile(1,45,0,15)
coins_pile(2,41,0,-15)
coins_pile(3,43,15,0)
coins_pile(4,48,-15,0)
coins_pile(5,46,0,0)
coins_pile(1,45,15,15)
coins_pile(2,41,15,-15)
coins_pile(3,43,-15,15)
coins_pile(4,48,-15,-15)
|
--
-- make_workspace.lua
-- Generate a workspace-level makefile.
-- Copyright (c) 2002-2015 Jason Perkins and the Premake project
--
local p = premake
local make = p.make
local tree = p.tree
local project = p.project
--
-- Generate a GNU make "workspace" makefile, with support for the new platforms API.
--
function make.generate_workspace(wks)
p.eol("\n")
make.header(wks)
make.configmap(wks)
make.projects(wks)
make.workspacePhonyRule(wks)
make.groupRules(wks)
make.projectrules(wks)
make.cleanrules(wks)
make.helprule(wks)
end
--
-- Write out the workspace's configuration map, which maps workspace
-- level configurations to the project level equivalents.
--
function make.configmap(wks)
for cfg in p.workspace.eachconfig(wks) do
_p('ifeq ($(config),%s)', cfg.shortname)
for prj in p.workspace.eachproject(wks) do
local prjcfg = project.getconfig(prj, cfg.buildcfg, cfg.platform)
if prjcfg then
_p(' %s_config = %s', make.tovar(prj.name), prjcfg.shortname)
end
end
_p('endif')
end
_p('')
end
--
-- Write out the rules for the `make clean` action.
--
function make.cleanrules(wks)
_p('clean:')
for prj in p.workspace.eachproject(wks) do
local prjpath = p.filename(prj, make.getmakefilename(prj, true))
local prjdir = path.getdirectory(path.getrelative(wks.location, prjpath))
local prjname = path.getname(prjpath)
_x(1,'@${MAKE} --no-print-directory -C %s -f %s clean', prjdir, prjname)
end
_p('')
end
--
-- Write out the make file help rule and configurations list.
--
function make.helprule(wks)
_p('help:')
_p(1,'@echo "Usage: make [config=name] [target]"')
_p(1,'@echo ""')
_p(1,'@echo "CONFIGURATIONS:"')
for cfg in p.workspace.eachconfig(wks) do
_x(1, '@echo " %s"', cfg.shortname)
end
_p(1,'@echo ""')
_p(1,'@echo "TARGETS:"')
_p(1,'@echo " all (default)"')
_p(1,'@echo " clean"')
for prj in p.workspace.eachproject(wks) do
_p(1,'@echo " %s"', prj.name)
end
_p(1,'@echo ""')
_p(1,'@echo "For more information, see http://industriousone.com/premake/quick-start"')
end
--
-- Write out the list of projects that comprise the workspace.
--
function make.projects(wks)
_p('PROJECTS := %s', table.concat(p.esc(table.extract(wks.projects, "name")), " "))
_p('')
end
--
-- Write out the workspace PHONY rule
--
function make.workspacePhonyRule(wks)
local groups = {}
local tr = p.workspace.grouptree(wks)
tree.traverse(tr, {
onbranch = function(n)
table.insert(groups, n.path)
end
})
_p('.PHONY: all clean help $(PROJECTS) ' .. table.implode(groups, '', '', ' '))
_p('')
_p('all: $(PROJECTS)')
_p('')
end
--
-- Write out the phony rules representing project groups
--
function make.groupRules(wks)
-- Transform workspace groups into target aggregate
local tr = p.workspace.grouptree(wks)
tree.traverse(tr, {
onbranch = function(n)
local rule = n.path .. ":"
local projectTargets = {}
local groupTargets = {}
for i, c in pairs(n.children)
do
if type(i) == "string"
then
if c.project
then
table.insert(projectTargets, c.name)
else
table.insert(groupTargets, c.path)
end
end
end
if #groupTargets > 0 then
rule = rule .. " " .. table.concat(groupTargets, " ")
end
if #projectTargets > 0 then
rule = rule .. " " .. table.concat(projectTargets, " ")
end
_p(rule)
_p('')
end
})
end
--
-- Write out the rules to build each of the workspace's projects.
--
function make.projectrules(wks)
for prj in p.workspace.eachproject(wks) do
local deps = project.getdependencies(prj)
deps = table.extract(deps, "name")
_p('%s:%s', p.esc(prj.name), make.list(deps))
local cfgvar = make.tovar(prj.name)
_p('ifneq (,$(%s_config))', cfgvar)
_p(1,'@echo "==== Building %s ($(%s_config)) ===="', prj.name, cfgvar)
local prjpath = p.filename(prj, make.getmakefilename(prj, true))
local prjdir = path.getdirectory(path.getrelative(wks.location, prjpath))
local prjname = path.getname(prjpath)
_x(1,'@${MAKE} --no-print-directory -C %s -f %s config=$(%s_config)', prjdir, prjname, cfgvar)
_p('endif')
_p('')
end
end
|
-- Run all enabled rc scripts.
-- /boot/*rc was moved before /boot/*filesystem because
-- 1. rc now loads in via the init signal
-- 2. rc used to load directly
-- Thus, for rc to load prior, it needs to register prior
require("event").listen("init", function()
dofile(require("shell").resolve("rc", "lua"))
return false
end)
|
--[[
--=====================================================================================================--
Script Name: Get Object Identity, for SAPP (PC & CE)
Command Syntax:
/getidentity on|off
Point your crosshair at any object and fire your weapon.
The mod will display the following information in the rcon console:
Object Type
Object Name
Object Meta ID
Object X,Y,Z coordinates
Copyright (c) 2016-2018, Jericho Crosby <jericho.crosby227@gmail.com>
Notice: You can use this document subject to the following conditions:
https://github.com/Chalwk77/Halo-Scripts-Phasor-V2-/blob/master/LICENSE
~ Created by Jericho Crosby (Chalwk)
- This script is included in the Velocity Multi-Mod with many improvements.
--=====================================================================================================--
]]
api_version = '1.12.0.0'
portalgun_command = "getidentity"
permission_level = 1
mode = {}
weapon_status = {}
function OnScriptLoad()
register_callback(cb['EVENT_TICK'], "OnTick")
register_callback(cb['EVENT_SPAWN'], "OnPlayerSpawn")
register_callback(cb['EVENT_COMMAND'], "OnServerCommand")
end
function OnScriptUnload()
end
function OnPlayerSpawn(PlayerIndex)
mode[PlayerIndex] = false
weapon_status[PlayerIndex] = 0
end
function OnTick()
for i = 1, 16 do
if (player_present(i) and player_alive(i)) then
if (mode[i] == true) then
local success, target = false, nil
local player_object = get_dynamic_player(i)
local playerX, playerY, playerZ = read_float(player_object + 0x230), read_float(player_object + 0x234), read_float(player_object + 0x238)
local shot_fired
local couching = read_float(player_object + 0x50C)
local px, py, pz = read_vector3d(player_object + 0x5c)
if (couching == 0) then
pz = pz + 0.65
else
pz = pz + (0.35 * couching)
end
local ignore_player = read_dword(get_player(i) + 0x34)
local success, a, b, c, target = intersect(px, py, pz, playerX * 1000, playerY * 1000, playerZ * 1000, ignore_player)
if (success == true and target ~= nil) then
shot_fired = read_float(player_object + 0x490)
if (shot_fired ~= weapon_status[i] and shot_fired == 1) then
local target_object = get_object_memory(target)
if target_object ~= 0 then
local ObjectType = read_byte(target_object + 0xB4)
local ObjectName = read_string(read_dword(read_word(target_object) * 32 + 0x40440038))
local ObjectMeta = read_dword(target_object)
if (ObjectType == 1) then
x, y, z = read_vector3d(target_object + 0x5C)
else
x, y, z = read_vector3d(target_object + 0x5c)
end
if ObjectType == 0 then
SendToPlayer(i, "bipd", ObjectName, ObjectMeta, x, y, z)
elseif ObjectType == 1 then
SendToPlayer(i, "vehi", ObjectName, ObjectMeta, x, y, z)
elseif ObjectType == 3 then
SendToPlayer(i, "eqip", ObjectName, ObjectMeta, x, y, z)
elseif ObjectType == 2 then
SendToPlayer(i, "weap", ObjectName, ObjectMeta, x, y, z)
end
end
end
weapon_status[i] = shot_fired
end
end
end
end
end
function SendToPlayer(player, type, ObjectName, ObjectMeta, x, y, z)
for i = 1, 30 do
rprint(player, " ")
end
rprint(player, "Type: |r" .. tostring(type))
rprint(player, "Name: |r" .. tostring(ObjectName))
rprint(player, "Meta: |r" .. tonumber(ObjectMeta))
rprint(player, "X,Y,Z: |r" .. x .. ", " .. y .. ", " .. z)
cprint("Type: " .. tostring(type))
cprint("Name: " .. tostring(ObjectName))
cprint("Meta: " .. tonumber(ObjectMeta))
cprint("X,Y,Z: " .. x .. ", " .. y .. ", " .. z)
end
function OnServerCommand(PlayerIndex, Command)
local UnknownCMD = nil
local t = tokenizestring(Command)
if t[1] ~= nil then
if t[1] == string.lower(portalgun_command) then
if tonumber(get_var(PlayerIndex, "$lvl")) >= permission_level then
if t[2] ~= nil then
if t[2] == "on" or t[2] == "1" or t[2] == "true" then
mode[PlayerIndex] = true
rprint(PlayerIndex, "GetIdentity Mode enabled.")
UnknownCMD = false
elseif t[2] == "off" or t[2] == "0" or t[2] == "false" then
mode[PlayerIndex] = false
rprint(PlayerIndex, "GetIdentity Mode disabled.")
UnknownCMD = false
end
else
rprint(PlayerIndex, "Invalid Syntax!")
UnknownCMD = false
end
else
rprint(PlayerIndex, "You do not have permission to execute that command!")
UnknownCMD = false
end
end
return UnknownCMD
end
end
function tokenizestring(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t = { };
i = 1
for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do
t[i] = str
i = i + 1
end
return t
end
|
-- vim: ts=2 sw=2 sts=2 et :
-- Testing Bins
-- (c) 2021 Tim Menzies (timm@ieee.org) unlicense.org
package.path = '../src/?.lua;' .. package.path
local r=require
local Lib,Bin,Num=r("lib"),r("bin"),r("num")
do
local n,xy,num=100,{},Num()
for i=1,n do
num:add(i)
xy[#xy+1]= {i, i<n/3} end
local d = num.sd*.3
local lst = Bin.merge(Bin.div(xy,d, n^.5))
print("")
for _,b in pairs(lst) do
print("::",b.down, b.up) end
print("d",d)
end
Lib.rogues()
|
local ComponentGroup = {}
return ComponentGroup
|
local a = {
aaa = 1,
bbb = 2
}
local bbbb = setmetatable({}, {__index = a})
local b = {
ccc = 1,
ddd = 2
}
local eeee = setmetatable(b, {})
local ffff = setmetatable(b, {__index = a})
|
local MIN_FUEL_LEVEL = 100;
write("Dig up or down (u, d): ")
local direction = read():lower()
write("Dig to the left or right (l, r): ")
local turn = read():lower()
write("length: ")
local length = tonumber(read())
write("width: ")
local width = tonumber(read())
write("depth/height: ")
local depth = tonumber(read())
function main()
normalizeUserInput()
digLoop()
positionBackToStart()
os.reboot()
end
function normalizeUserInput()
if turn == "l" or turn == "left" then
turn = "left"
elseif turn == "r" or turn == "right" then
turn = "right"
end
if direction == "u" or direction == "up" then
direction = "up"
elseif direction == "d" or direction == "down" then
direction = "down"
end
end
function digLoop()
for i=1,depth do
for j=1,length do
for k=1,width-1 do
digUpOrDown()
forwardAndDig()
end
digUpOrDown()
if j ~= length then
adjustOrientation()
end
end
verifyFuelLevel()
if direction == "up" then
turtle.up()
else
turtle.down()
end
if turn == "left" then
turtle.turnLeft()
turtle.turnLeft()
else
turtle.turnRight()
turtle.turnRight()
end
end
end
function positionBackToStart()
for i=1,depth do
if direction == "up" then
turtle.down()
else
turtle.up()
end
end
end
-- util functions
function forwardAndDig()
--Digs until the turtle can move forward, to deal with gravel and sand.
repeat
turtle.dig()
until turtle.forward() == true
end
function digUpOrDown()
verifyFuelLevel()
if direction == "up" then
turtle.digUp()
else
turtle.digDown()
end
end
function adjustOrientation()
verifyFuelLevel()
if turn == "left" then
turtle.turnLeft()
forwardAndDig()
turtle.turnLeft()
turn = "right"
else
turtle.turnRight()
forwardAndDig()
turtle.turnRight()
turn = "left"
end
end
function verifyFuelLevel()
local fuelLevel = turtle.getFuelLevel();
if fuelLevel <= MIN_FUEL_LEVEL then
write("Fuel level low. Insert fuel & press enter to continue.\n")
read()
shell.run("refuel", "all")
write("New fuel level: " .. turtle.getFuelLevel() .. "\n")
end
end
main()
|
return function(ASS, ASSFInst, yutilsMissingMsg, createASSClass, re, util, unicode, Common, LineCollection, Line, Log, SubInspector, Yutils)
local Align = createASSClass("Tag.Align", ASS.Tag.Indexed, {"value"}, {"number"}, {range={1,9}, default=5})
function Align:up()
if self.value<7 then return self:add(3)
else return false end
end
function Align:down()
if self.value>3 then return self:add(-3)
else return false end
end
function Align:left()
if self.value%3~=1 then return self:add(-1)
else return false end
end
function Align:right()
if self.value%3~=0 then return self:add(1)
else return false end
end
function Align:centerV()
if self.value<=3 then self:up()
elseif self.value>=7 then self:down() end
end
function Align:centerH()
if self.value%3==1 then self:right()
elseif self.value%3==0 then self:left() end
end
function Align:getSet(pos)
local val = self.value
local set = { top = val>=7, centerV = val>3 and val<7, bottom = val<=3,
left = val%3==1, centerH = val%3==2, right = val%3==0 }
return pos==nil and set or set[pos]
end
function Align:isTop() return self:getSet("top") end
function Align:isCenterV() return self:getSet("centerV") end
function Align:isBottom() return self:getSet("bottom") end
function Align:isLeft() return self:getSet("left") end
function Align:isCenterH() return self:getSet("centerH") end
function Align:isRight() return self:getSet("right") end
function Align:getPositionOffset(w, h, refAlign)
refAlign = default(refAlign, Align{7})
if ASS:instanceOf(w, ASS.Point, nil, true) then
w, h = w:get()
end
local x, y = {w, 0, w/2}, {h, h/2, 0}
local off = ASS.Point{x[self.value%3+1], y[math.ceil(self.value/3)]}
off:sub(x[refAlign.value%3+1], y[math.ceil(refAlign.value/3)])
return off
end
return Align
end
|
local robot = require("robot")
local component = require("component")
--[[
Start:
invt: elec. wrench equipped and configurator in 1
pos: standing infront of redstone torch
]]
while(true) do
--remove:
robot.select(1)
robot.swing() --torch
robot.forward()
robot.suck()
robot.use() --miner
robot.forward()
component.inventory_controller.equip() --configurator
robot.turnLeft()
robot.use(3, true) -- cable1
robot.turnRight()
robot.use(3, true) -- tesseract
robot.forward()
robot.turnLeft()
robot.use(3, true) -- cable2
robot.turnRight()
component.inventory_controller.equip() --elec. wrench
--move:
for i = 1, 32, 1 do
robot.forward()
end
--build:
robot.turnLeft()
robot.select(5)
robot.place() --cable 2
robot.turnRight()
robot.back()
robot.select(6)
robot.place() --tesseract
robot.turnLeft()
robot.select(5)
robot.place() --cable 1
robot.turnRight()
robot.back()
robot.select(4)
robot.place() --miner
robot.select(3)
component.inventory_controller.dropIntoSlot(3, 2) --scannercard
robot.up()
robot.select(2)
robot.placeDown() --torch
robot.back()
robot.down()
--sleep one hour:
os.sleep(3600)
end
|
slot0 = class("ResolveEquipmentLayer", import("..base.BaseUI"))
slot0.getUIName = function (slot0)
return "ResolveEquipmentUI"
end
slot0.setPlayer = function (slot0, slot1)
slot0.player = slot1
end
slot0.setEquipments = function (slot0, slot1)
slot0.equipmentVOs = slot1
slot0:setEquipmentByIds(slot1)
end
slot0.setEquipmentByIds = function (slot0, slot1)
slot0.equipmentVOByIds = {}
for slot5, slot6 in ipairs(slot1) do
slot0.equipmentVOByIds[slot6.id] = slot6
end
end
slot0.init = function (slot0)
slot0.mainPanel = slot0:findTF("main")
setActive(slot0.mainPanel, true)
slot0.viewRect = slot0:findTF("main/frame/view"):GetComponent("LScrollRect")
slot0.backBtn = slot0:findTF("main/top/btnBack")
slot0.cancelBtn = slot0:findTF("main/cancel_btn")
slot0.okBtn = slot0:findTF("main/ok_btn")
pg.UIMgr.GetInstance():BlurPanel(slot0._tf)
slot0.selectedIds = {}
slot0.selecteAllTF = slot0:findTF("main/all_toggle")
slot0.selecteAllToggle = slot0.selecteAllTF:GetComponent(typeof(Toggle))
slot0.destroyConfirm = slot0:findTF("destroy_confirm")
slot0.destroyBonusList = slot0.destroyConfirm:Find("got/scrollview/list")
slot0.destroyBonusItem = slot0.destroyConfirm:Find("got/scrollview/item")
setActive(slot0.destroyConfirm, false)
setActive(slot0.destroyBonusItem, false)
end
slot0.didEnter = function (slot0)
slot0:initEquipments()
onButton(slot0, slot0.backBtn, function ()
slot0:emit(slot1.ON_CLOSE)
end, SFX_CANCEL)
onButton(slot0, slot0.cancelBtn, function ()
slot0:emit(slot1.ON_CLOSE)
end, SFX_CANCEL)
onButton(slot0, slot0.okBtn, function ()
if not _.all(slot0.hasEliteEquips(slot1, slot0.selectedIds, slot0.equipmentVOByIds), function (slot0)
return slot0 == ""
end) then
pg.MsgboxMgr.GetInstance():ShowMsgBox({
content = i18n("destroy_eliteequipment_tip", string.gsub(table.concat(slot1, ""), "$1", (slot1[1] == "" and "") or ",")),
onYes = slot0
})
else
slot0()
end
end, SFX_CONFIRM)
onButton(slot0, findTF(slot0.destroyConfirm, "actions/cancel_button"), function ()
setActive(slot0.destroyConfirm, false)
setActive(slot0.mainPanel, true)
pg.UIMgr.GetInstance():UnblurPanel(slot0.destroyConfirm, slot0._tf)
end, SFX_CANCEL)
onButton(slot0, findTF(slot0.destroyConfirm, "actions/destroy_button"), function ()
seriesAsync({}, function ()
slot0:emit(ResolveEquipmentMediator.ON_RESOLVE, slot0.selectedIds)
end)
end, SFX_UI_EQUIPMENT_RESOLVE)
onToggle(slot0, slot0.selecteAllTF, function (slot0)
if slot0.isManual then
return
end
if slot0 then
slot0:selecteAllEquips()
else
slot0:unselecteAllEquips()
end
end, SFX_PANEL)
end
slot0.OnResolveEquipDone = function (slot0)
setActive(slot0.destroyConfirm, false)
pg.UIMgr.GetInstance():UnblurPanel(slot0.destroyConfirm, slot0._tf)
setActive(slot0.mainPanel, false)
slot0:unselecteAllEquips()
end
slot0.onBackPressed = function (slot0)
pg.CriMgr.GetInstance():PlaySoundEffect_V3(SFX_CANCEL)
if isActive(slot0.destroyConfirm) then
triggerButton(findTF(slot0.destroyConfirm, "actions/cancel_button"))
return
end
triggerButton(slot0.cancelBtn)
end
slot0.selectedLowRarityEquipment = function (slot0)
slot0.selectedIds = {}
for slot4, slot5 in ipairs(slot0.equipmentVOs) do
if slot5.config.level <= 1 and slot5.config.rarity < 4 then
slot0:selectEquip(slot5, slot5.count)
end
end
slot0:updateSelected()
end
slot0.selecteAllEquips = function (slot0)
slot0.selectedIds = {}
for slot4, slot5 in ipairs(slot0.equipmentVOs) do
slot0:selectEquip(slot5, slot5.count)
end
slot0:updateSelected()
end
slot0.unselecteAllEquips = function (slot0)
slot0.selectedIds = {}
slot0:updateSelected()
end
slot0.displayDestroyBonus = function (slot0)
slot1 = {}
slot2 = 0
for slot6, slot7 in ipairs(slot0.selectedIds) do
if pg.equip_data_template[slot7[1]] then
slot9 = slot8.destory_item or {}
slot2 = slot2 + (slot8.destory_gold or 0) * slot7[2]
for slot14, slot15 in ipairs(slot9) do
slot16 = false
for slot20, slot21 in ipairs(slot1) do
if slot15[1] == slot1[slot20].id then
slot1[slot20].count = slot1[slot20].count + slot15[2] * slot7[2]
slot16 = true
break
end
end
if not slot16 then
table.insert(slot1, {
type = DROP_TYPE_ITEM,
id = slot15[1],
count = slot15[2] * slot7[2]
})
end
end
end
end
if slot2 > 0 then
table.insert(slot1, {
id = 1,
type = DROP_TYPE_RESOURCE,
count = slot2
})
end
for slot6 = #slot1, slot0.destroyBonusList.childCount - 1, 1 do
Destroy(slot0.destroyBonusList:GetChild(slot6))
end
for slot6 = slot0.destroyBonusList.childCount, #slot1 - 1, 1 do
cloneTplTo(slot0.destroyBonusItem, slot0.destroyBonusList)
end
for slot6 = 1, #slot1, 1 do
slot7 = slot0.destroyBonusList:GetChild(slot6 - 1)
if slot1[slot6].type == DROP_TYPE_SHIP then
slot0.hasShip = true
end
GetComponent(slot7:Find("icon_bg/icon"), typeof(Image)).enabled = true
if not IsNil(slot7:Find("icon_bg/icon/icon")) then
setActive(slot9, false)
end
updateDrop(slot7, slot8)
slot11, slot12 = contentWrap(slot8.cfg.name, 10, 2)
if slot11 then
slot12 = slot12 .. "..."
end
setText(slot7:Find("name"), slot12)
onButton(slot0, slot7, function ()
if slot0.type == DROP_TYPE_RESOURCE or slot0.type == DROP_TYPE_ITEM then
slot1:emit(slot2.ON_ITEM, slot0.cfg.id)
elseif slot0.type == DROP_TYPE_EQUIP then
slot1:emit(slot2.ON_EQUIPMENT, {
equipmentId = slot0.cfg.id,
type = EquipmentInfoMediator.TYPE_DISPLAY
})
end
end, SFX_PANEL)
end
end
slot0.hasEliteEquips = function (slot0, slot1, slot2)
function slot4(slot0, slot1)
if not _.include(slot0, slot0) then
slot0[slot1] = slot0
end
end
_.each(slot1, function (slot0)
if slot0[slot0[1]].config.level > 1 then
slot1(i18n("destroy_high_intensify_tip"), 2)
end
if slot2.config.rarity >= 4 then
slot1(i18n("destroy_high_rarity_tip"), 1)
end
end)
return {
"",
""
}
end
slot0.initEquipments = function (slot0)
slot0.viewRect.onInitItem = function (slot0)
slot0:onInitItem(slot0)
end
slot0.viewRect.onUpdateItem = function (slot0, slot1)
slot0:onUpdateItem(slot0, slot1)
end
slot0.viewRect.onStart = function ()
slot0:selectedLowRarityEquipment()
end
slot0.cards = {}
slot0.filterEquipments(slot0)
end
slot0.filterEquipments = function (slot0)
table.sort(slot0.equipmentVOs, function (slot0, slot1)
if slot0.config.rarity == slot1.config.rarity then
return slot0.id < slot1.id
else
return slot1.config.rarity < slot0.config.rarity
end
end)
slot0.viewRect.SetTotalCount(slot1, #slot0.equipmentVOs, -1)
end
slot0.onInitItem = function (slot0, slot1)
slot2 = EquipmentItem.New(slot1)
onButton(slot0, slot2.go, function ()
slot0:selectEquip(slot1.equipmentVO, slot1.equipmentVO.count)
end, SFX_PANEL)
onButton(slot0, slot2.reduceBtn, function ()
slot0:selectEquip(slot1.equipmentVO, 1)
end, SFX_PANEL)
slot0.cards[slot1] = slot2
end
slot0.onUpdateItem = function (slot0, slot1, slot2)
if not slot0.cards[slot2] then
slot0:onInitItem(slot2)
slot3 = slot0.cards[slot2]
end
slot3:update(slot0.equipmentVOs[slot1 + 1], true)
end
slot0.isSelectedAll = function (slot0)
for slot4, slot5 in pairs(slot0.equipmentVOByIds) do
slot6 = false
for slot10, slot11 in pairs(slot0.selectedIds) do
if slot11[1] == slot5.id and slot5.count == slot11[2] then
slot6 = true
end
end
if slot6 == false then
return false
end
end
return true
end
slot0.selectEquip = function (slot0, slot1, slot2)
if not slot0:checkDestroyGold(slot1, slot2) then
return
end
slot3 = false
slot4 = nil
slot5 = 0
for slot9, slot10 in pairs(slot0.selectedIds) do
if slot10[1] == slot1.id then
slot3 = true
slot4 = slot9
slot5 = slot10[2]
break
end
end
if not slot3 then
table.insert(slot0.selectedIds, {
slot1.id,
slot2
})
elseif slot5 - slot2 > 0 then
slot0.selectedIds[slot4][2] = slot5 - slot2
else
table.remove(slot0.selectedIds, slot4)
end
slot0:updateSelected()
slot0.isManual = true
triggerToggle(slot0.selecteAllTF, slot0:isSelectedAll())
slot0.isManual = nil
end
slot0.updateSelected = function (slot0)
for slot4, slot5 in pairs(slot0.cards) do
if slot5.equipmentVO then
slot6 = false
slot7 = 0
for slot11, slot12 in pairs(slot0.selectedIds) do
if slot5.equipmentVO.id == slot12[1] then
slot6 = true
slot7 = slot12[2]
break
end
end
slot5:updateSelected(slot6, slot7)
end
end
end
slot0.checkDestroyGold = function (slot0, slot1, slot2)
slot3 = 0
slot4 = false
for slot8, slot9 in pairs(slot0.selectedIds) do
slot10 = slot9[2]
if pg.equip_data_template[slot9[1]] then
slot3 = slot3 + (slot11.destory_gold or 0) * slot10
end
if slot1 and slot9[1] == slot1.configId then
slot4 = true
end
end
if not slot4 and slot1 and slot2 > 0 then
slot3 = slot3 + (pg.equip_data_template[slot1.configId].destory_gold or 0) * slot2
end
if slot0.player:GoldMax(slot3) then
pg.TipsMgr.GetInstance():ShowTips(i18n("gold_max_tip_title") .. i18n("resource_max_tip_destroy"))
return false
end
return true
end
slot0.willExit = function (slot0)
pg.UIMgr.GetInstance():UnblurPanel(slot0._tf, pg.UIMgr.GetInstance().UIMain)
end
return slot0
|
object_tangible_collection_reward_col_photo_durni_reward_01 = object_tangible_collection_reward_shared_col_photo_durni_reward_01:new {
}
ObjectTemplates:addTemplate(object_tangible_collection_reward_col_photo_durni_reward_01, "object/tangible/collection/reward/col_photo_durni_reward_01.iff")
|
my_config = config.app_switcher
hs.application.enableSpotlightForNameSearches(true)
function switchToApp(app_name, key_pressed)
local application = hs.appfinder.appFromName(app_name)
local window = application:allWindows()[1]
window.focus()
end
for key in pairs(my_config.keys) do
hs.hotkey.bind(my_config.modifier, tostring(key), function ()
switchToApp(my_config.keys[key], key)
end)
end
|
data:extend(
{
{
type = "bool-setting",
name = "depleted-uranium",
setting_type = "startup",
default_value = true,
},
{
type = "bool-setting",
name = "fluid-cleanup",
setting_type = "startup",
default_value = true,
},
{
type = "bool-setting",
name = "MCP_enable_centrifuges",
setting_type = "startup",
default_value = true,
},
{
type = "bool-setting",
name = "equipment-group",
setting_type = "startup",
default_value = true,
},
}
)
|
ITEM.name = "Анабиотик (произведено в Зоне)"
ITEM.category = "Медицина"
ITEM.desc = "Экспериментальный медицинский препарат, позволяет пережить Выброс. \n\nХАРАКТЕРИСТКИ: \n-медикамент \n-вызывает долгое помутнение сознание \n\nПозволяет пережить выброс"
ITEM.price = 3498
ITEM.exRender = false
ITEM.weight = 0.12
ITEM.model = "models/kek1ch/drug_anabiotic.mdl"
ITEM.width = 1
ITEM.height = 1
ITEM.iconCam = {
pos = Vector(82.731010437012, 69.455390930176, 51.793571472168),
ang = Angle(25, 220, 0),
fov = 5.6
}
ITEM.functions.Use = {
onRun = function(item)
local client = item.player
client:Freeze(true)
client:GodEnable()
client:ConCommand("say /actinjured")
client:notify("Это займет 135 секунд...")
timer.Create(135, function()
client:Freeze(false)
client:GodDisable()
end)
client:ScreenFade( SCREENFADE.OUT, Color( 0, 0, 0 ), 2, 440 )
timer.Simple(68,function()
client:ScreenFade( SCREENFADE.IN, Color( 0, 0, 0 ), 2, 440 )
end)
end
}
|
-- Copypasted from vanilla with an extra crash guard check
-- Just in case my spawning code still spawns enemies without objectives
function GroupAIStateBesiege:_perform_group_spawning(spawn_task, force, use_last)
local nr_units_spawned = 0
local produce_data = {
name = true,
spawn_ai = {}
}
local group_ai_tweak = tweak_data.group_ai
local spawn_points = spawn_task.spawn_group.spawn_pts
local function _try_spawn_unit(u_type_name, spawn_entry)
if GroupAIStateBesiege._MAX_SIMULTANEOUS_SPAWNS <= nr_units_spawned and not force then
return
end
local hopeless = true
local current_unit_type = tweak_data.levels:get_ai_group_type()
for _, sp_data in ipairs(spawn_points) do
local category = group_ai_tweak.unit_categories[u_type_name]
if (sp_data.accessibility == "any" or category.access[sp_data.accessibility]) and (not sp_data.amount or sp_data.amount > 0) and sp_data.mission_element:enabled() then
hopeless = false
if sp_data.delay_t < self._t then
local units = category.unit_types[current_unit_type]
produce_data.name = units[math.random(#units)]
produce_data.name = managers.modifiers:modify_value("GroupAIStateBesiege:SpawningUnit", produce_data.name)
local spawned_unit = sp_data.mission_element:produce(produce_data)
local u_key = spawned_unit:key()
local objective = nil
if spawn_task.objective then
objective = self.clone_objective(spawn_task.objective)
else
-- They cant do anything without an objective, I dunno why theyre spawning this way
-- Temp fix is to just nuke it for now
-- TODO: Test if this was fixed and remove this whole function override
if not spawn_task or not spawn_task.group or not spawn_task.group.objective or not spawn_task.group.objective.element then
log("[COPSPAWNDEBUG] Fatal error: a cop spawned without an objective set!")
return true
end
objective = spawn_task.group.objective.element:get_random_SO(spawned_unit)
if not objective then
spawned_unit:set_slot(0)
return true
end
objective.grp_objective = spawn_task.group.objective
end
local u_data = self._police[u_key]
self:set_enemy_assigned(objective.area, u_key)
if spawn_entry.tactics then
u_data.tactics = spawn_entry.tactics
u_data.tactics_map = {}
for _, tactic_name in ipairs(u_data.tactics) do
u_data.tactics_map[tactic_name] = true
end
end
spawned_unit:brain():set_spawn_entry(spawn_entry, u_data.tactics_map)
u_data.rank = spawn_entry.rank
self:_add_group_member(spawn_task.group, u_key)
if spawned_unit:brain():is_available_for_assignment(objective) then
if objective.element then
objective.element:clbk_objective_administered(spawned_unit)
end
spawned_unit:brain():set_objective(objective)
else
spawned_unit:brain():set_followup_objective(objective)
end
nr_units_spawned = nr_units_spawned + 1
if spawn_task.ai_task then
spawn_task.ai_task.force_spawned = spawn_task.ai_task.force_spawned + 1
spawned_unit:brain()._logic_data.spawned_in_phase = spawn_task.ai_task.phase
end
sp_data.delay_t = self._t + sp_data.interval
if sp_data.amount then
sp_data.amount = sp_data.amount - 1
end
return true
end
end
end
if hopeless then
debug_pause("[GroupAIStateBesiege:_upd_group_spawning] spawn group", spawn_task.spawn_group.id, "failed to spawn unit", u_type_name)
return true
end
end
for u_type_name, spawn_info in pairs(spawn_task.units_remaining) do
if not group_ai_tweak.unit_categories[u_type_name].access.acrobatic then
for i = spawn_info.amount, 1, -1 do
local success = _try_spawn_unit(u_type_name, spawn_info.spawn_entry)
if success then
spawn_info.amount = spawn_info.amount - 1
end
break
end
end
end
for u_type_name, spawn_info in pairs(spawn_task.units_remaining) do
for i = spawn_info.amount, 1, -1 do
local success = _try_spawn_unit(u_type_name, spawn_info.spawn_entry)
if success then
spawn_info.amount = spawn_info.amount - 1
end
break
end
end
local complete = true
for u_type_name, spawn_info in pairs(spawn_task.units_remaining) do
if spawn_info.amount > 0 then
complete = false
break
end
end
if complete then
spawn_task.group.has_spawned = true
table.remove(self._spawning_groups, use_last and #self._spawning_groups or 1)
if spawn_task.group.size <= 0 then
self._groups[spawn_task.group.id] = nil
end
end
end
function GroupAIStateBesiege:_upd_reenforce_tasks()
local reenforce_tasks = self._task_data.reenforce.tasks
local t = self._t
local i = #reenforce_tasks
while i > 0 do
local task_data = reenforce_tasks[i]
local force_settings = task_data.target_area.factors.force
local force_required = force_settings and force_settings.force
if force_required then
local force_occupied = 0
for group_id, group in pairs(self._groups) do
if (group.objective.target_area or group.objective.area) == task_data.target_area and group.objective.type == "reenforce_area" then
force_occupied = force_occupied + (group.has_spawned and group.size or group.initial_size)
end
end
local undershot = force_required - force_occupied
if undershot > 0 and not self._task_data.regroup.active and self._task_data.assault.phase ~= "fade" and self._task_data.reenforce.next_dispatch_t < t and self:is_area_safe(task_data.target_area) then
local used_event = nil
if task_data.use_spawn_event then
task_data.use_spawn_event = false
if self:_try_use_task_spawn_event(t, task_data.target_area, "reenforce") then
used_event = true
end
end
local used_group, spawning_groups = nil
if not used_event then
if next(self._spawning_groups) then
spawning_groups = true
else
local spawn_group, spawn_group_type = self:_find_spawn_group_near_area(task_data.target_area, self._tweak_data.reenforce.groups, nil, nil, nil)
if spawn_group then
local grp_objective = {
attitude = "avoid",
scan = true,
pose = "stand",
type = "reenforce_area",
stance = "hos",
area = spawn_group.area,
target_area = task_data.target_area
}
self:_spawn_in_group(spawn_group, spawn_group_type, grp_objective)
used_group = true
end
end
end
if used_event or used_group then
self._task_data.reenforce.next_dispatch_t = t + self:_get_difficulty_dependent_value(self._tweak_data.reenforce.interval)
end
elseif undershot < 0 then
local force_defending = 0
for group_id, group in pairs(self._groups) do
if group.objective.area == task_data.target_area and group.objective.type == "reenforce_area" then
force_defending = force_defending + (group.has_spawned and group.size or group.initial_size)
end
end
local overshot = force_defending - force_required
if overshot > 0 then
local closest_group, closest_group_size = nil
for group_id, group in pairs(self._groups) do
if group.has_spawned and (group.objective.target_area or group.objective.area) == task_data.target_area and group.objective.type == "reenforce_area" and (not closest_group_size or closest_group_size < group.size) and group.size <= overshot then
closest_group = group
closest_group_size = group.size
end
end
if closest_group then
self:_assign_group_to_retire(closest_group)
end
end
end
else
for group_id, group in pairs(self._groups) do
if group.has_spawned and (group.objective.target_area or group.objective.area) == task_data.target_area and group.objective.type == "reenforce_area" then
self:_assign_group_to_retire(group)
end
end
reenforce_tasks[i] = reenforce_tasks[#reenforce_tasks]
table.remove(reenforce_tasks)
end
i = i - 1
end
self:_assign_enemy_groups_to_reenforce()
end
|
-- CLIENT CONFIGURATION
config_cl = {
joinProximity = 25, -- Proximity to draw 3D text and join race
joinKeybind = 51, -- Keybind to join race ("E" by default)
joinDuration = 30000, -- Duration in ms to allow players to join the race
freezeDuration = 5000, -- Duration in ms to freeze players and countdown start (set to 0 to disable)
checkpointProximity = 25.0, -- Proximity to trigger checkpoint in meters
checkpointRadius = 25.0, -- Radius of 3D checkpoints in meters (set to 0 to disable cylinder checkpoints)
checkpointHeight = 10.0, -- Height of 3D checkpoints in meters
checkpointBlipColor = 5, -- Color of checkpoint map blips and navigation (see SetBlipColour native reference)
hudEnabled = true, -- Enable racing HUD with time and checkpoints
hudPosition = vec(0.015, 0.725) -- Screen position to draw racing HUD
}
-- SERVER CONFIGURATION
config_sv = {
finishTimeout = 180000, -- Timeout in ms for removing a race after winner finishes
notifyOfWinner = true -- Notify all players of the winner (false will only notify the winner)
}
|
--幻想の黒魔導師
function c900901254.initial_effect(c)
--xyz summon
--aux.AddXyzProcedure(c,nil,7,2,c96471335.ovfilter,aux.Stringid(96471335,0))
c:EnableReviveLimit()
aux.AddFusionProcCodeFun(c,(46986414),aux.FilterBoolFunction(Card.IsRace,RACE_SPELLCASTER),1,false,false)
--spsummon fusion condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.fuslimit)
c:RegisterEffect(e1)
--special summon rule
--local e02=Effect.CreateEffect(c)
--e02:SetType(EFFECT_TYPE_FIELD)
--e02:SetCode(EFFECT_SPSUMMON_PROC)
--e02:SetProperty(EFFECT_FLAG_UNCOPYABLE)
--e02:SetRange(LOCATION_EXTRA)
--e02:SetCondition(c900901254.sprcon)
--e02:SetOperation(c900901254.sprop)
--c:RegisterEffect(e02)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(900901254,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION+EFFECT_TYPE_TRIGGER_O)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
--e2:SetCost(c900901254.cost)
e2:SetTarget(c900901254.target)
e2:SetOperation(c900901254.operation)
c:RegisterEffect(e2)
--remove
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(900901254,2))
e3:SetCategory(CATEGORY_REMOVE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_ATTACK_ANNOUNCE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCondition(c900901254.rmcon)
e3:SetTarget(c900901254.rmtg)
e3:SetOperation(c900901254.rmop)
c:RegisterEffect(e3)
end
--
function c900901254.spfilter1(c,tp)
return c:IsFusionCode(46986414) and c:IsAbleToDeckOrExtraAsCost() and c:IsCanBeFusionMaterial(nil,true)
and Duel.IsExistingMatchingCard(c900901254.spfilter2,tp,LOCATION_MZONE,0,1,c)
end
function c900901254.spfilter2(c)
return c:IsRace(RACE_SPELLCASTER) and c:IsCanBeFusionMaterial() and c:IsAbleToDeckOrExtraAsCost()
end
function c900901254.sprcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>-2
and Duel.IsExistingMatchingCard(c900901254.spfilter1,tp,LOCATION_ONFIELD,0,1,nil,tp)
end
function c900901254.sprop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(900901253,2))
local g1=Duel.SelectMatchingCard(tp,c900901254.spfilter1,tp,LOCATION_ONFIELD,0,1,1,nil,tp)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(900901253,3))
local g2=Duel.SelectMatchingCard(tp,c900901254.spfilter2,tp,LOCATION_MZONE,0,1,1,g1:GetFirst())
g1:Merge(g2)
local tc=g1:GetFirst()
while tc do
if not tc:IsFaceup() then Duel.ConfirmCards(1-tp,tc) end
tc=g1:GetNext()
end
Duel.PayLPCost(tp,1000)
Duel.SendtoGrave(g1,nil,2,REASON_COST)
end
--
function c900901254.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,math.floor(Duel.GetLP(tp)/2)) end
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
end
function c900901254.filter(c,e,tp)
return c:IsType(TYPE_NORMAL) and c:IsRace(RACE_SPELLCASTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c900901254.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c900901254.filter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
end
function c900901254.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c900901254.filter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 then
--Duel.PayLPCost(tp,1000)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c900901254.filter2(c,e,tp)
return c:IsType(TYPE_MONSTER)
end
function c900901254.rmcon(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetAttacker()
return tc:IsType(TYPE_NORMAL) and tc:IsRace(RACE_SPELLCASTER)
end
function c900901254.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsAbleToRemove() end
if chk==0 then return Duel.IsExistingMatchingCard(c900901254.filter2,tp,0,LOCATION_REMOVED,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,c900901254.filter2,tp,0,LOCATION_REMOVED,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
Duel.PayLPCost(tp,500)
end
function c900901254.rmop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)
end
end
|
--
-- Copyright (c) 2018 Milos Tosic. All rights reserved.
-- License: http://www.opensource.org/licenses/BSD-2-Clause
--
function addProject_3rdParty_lib(_name, _libFiles, _exceptions)
if _ACTION == nil then return end
group ("3rd")
project ( _name )
_exceptions = _exceptions or false
_includes = _includes or {}
_additionalDefines = _additionalDefines or {}
language "C++"
kind "StaticLib"
uuid ( os.uuid(project().name) )
files { _libFiles }
flags { Flags_ThirdParty }
if _exceptions == false then
flags { "NoExceptions" }
end
assert(loadfile(RTM_SCRIPTS_DIR .. "configurations.lua"))( _libFiles,
true, -- IS_LIBRARY
false, -- IS_SHARED_LIBRARY
false, -- COPY_QT_DLLS
false, -- WITH_QT
false -- EXECUTABLE
)
addDependencies(project().name)
end
|
SWEP.Base = "weapon_maw_base"
SWEP.Slot = 4
SWEP.PrintName = "XM1014"
SWEP.HoldType = "ar2"
SWEP.ViewModel = "models/weapons/v_shot_xm1014.mdl"
SWEP.WorldModel = "models/weapons/w_shot_xm1014.mdl"
SWEP.Primary.Sound = "Weapon.Fire_xm1014"
SWEP.Primary.Recoil = 0.9
SWEP.Primary.Damage = 16
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0.017
SWEP.Primary.Delay = 0.2
SWEP.Primary.ClipSize = 8
SWEP.Primary.DefaultClip = 8
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "Buckshot"
SWEP.BulletBurst = 6
SWEP.BulletSpread = 0.15
|
--- Schematic serialization and deserialiation.
-- @module worldedit.serialization
worldedit.LATEST_SERIALIZATION_VERSION = 5
local LATEST_SERIALIZATION_HEADER = worldedit.LATEST_SERIALIZATION_VERSION .. ":"
--[[
Serialization version history:
1: Original format. Serialized Lua table with a weird linked format...
2: Position and node seperated into sub-tables in fields `1` and `2`.
3: List of nodes, one per line, with fields seperated by spaces.
Format: <X> <Y> <Z> <Name> <Param1> <Param2>
4: Serialized Lua table containing a list of nodes with `x`, `y`, `z`,
`name`, `param1`, `param2`, and `meta` fields.
5: Added header and made `param1`, `param2`, and `meta` fields optional.
Header format: <Version>,<ExtraHeaderField1>,...:<Content>
--]]
--- Reads the header of serialized data.
-- @param value Serialized WorldEdit data.
-- @return The version as a positive natural number, or 0 for unknown versions.
-- @return Extra header fields as a list of strings, or nil if not supported.
-- @return Content (data after header).
function worldedit.read_header(value)
if value:find("^[0-9]+[%-:]") then
local header_end = value:find(":", 1, true)
local header = value:sub(1, header_end - 1):split(",")
local version = tonumber(header[1])
table.remove(header, 1)
local content = value:sub(header_end + 1)
return version, header, content
end
-- Old versions that didn't include a header with a version number
if value:find("([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)") and not value:find("%{") then -- List format
return 3, nil, value
elseif value:find("^[^\"']+%{%d+%}") then
if value:find("%[\"meta\"%]") then -- Meta flat table format
return 2, nil, value
end
return 1, nil, value -- Flat table format
elseif value:find("%{") then -- Raw nested table format
return 4, nil, value
end
return nil
end
--- Converts the region defined by positions `pos1` and `pos2`
-- into a single string.
-- @return The serialized data.
-- @return The number of nodes serialized.
function worldedit.serialize(pos1, pos2)
pos1, pos2 = worldedit.sort_pos(pos1, pos2)
worldedit.keep_loaded(pos1, pos2)
local pos = {x=pos1.x, y=0, z=0}
local count = 0
local result = {}
local get_node, get_meta = minetest.get_node, minetest.get_meta
while pos.x <= pos2.x do
pos.y = pos1.y
while pos.y <= pos2.y do
pos.z = pos1.z
while pos.z <= pos2.z do
local node = get_node(pos)
if node.name ~= "air" and node.name ~= "ignore" then
count = count + 1
local meta = get_meta(pos):to_table()
local meta_empty = true
-- Convert metadata item stacks to item strings
for name, inventory in pairs(meta.inventory) do
for index, stack in ipairs(inventory) do
meta_empty = false
inventory[index] = stack.to_string and stack:to_string() or stack
end
end
for k in pairs(meta) do
if k ~= "inventory" then
meta_empty = false
break
end
end
result[count] = {
x = pos.x - pos1.x,
y = pos.y - pos1.y,
z = pos.z - pos1.z,
name = node.name,
param1 = node.param1 ~= 0 and node.param1 or nil,
param2 = node.param2 ~= 0 and node.param2 or nil,
meta = not meta_empty and meta or nil,
}
end
pos.z = pos.z + 1
end
pos.y = pos.y + 1
end
pos.x = pos.x + 1
end
-- Serialize entries
result = minetest.serialize(result)
return LATEST_SERIALIZATION_HEADER .. result, count
end
--- Loads the schematic in `value` into a node list in the latest format.
-- Contains code based on [table.save/table.load](http://lua-users.org/wiki/SaveTableToFile)
-- by ChillCode, available under the MIT license.
-- @return A node list in the latest format, or nil on failure.
local function load_schematic(value)
local version, header, content = worldedit.read_header(value)
local nodes = {}
if version == 1 or version == 2 then -- Original flat table format
local tables = minetest.deserialize(content)
if not tables then return nil end
-- Transform the node table into an array of nodes
for i = 1, #tables do
for j, v in pairs(tables[i]) do
if type(v) == "table" then
tables[i][j] = tables[v[1]]
end
end
end
nodes = tables[1]
if version == 1 then --original flat table format
for i, entry in ipairs(nodes) do
local pos = entry[1]
entry.x, entry.y, entry.z = pos.x, pos.y, pos.z
entry[1] = nil
local node = entry[2]
entry.name, entry.param1, entry.param2 = node.name, node.param1, node.param2
entry[2] = nil
end
end
elseif version == 3 then -- List format
for x, y, z, name, param1, param2 in content:gmatch(
"([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)%s+" ..
"([^%s]+)%s+(%d+)%s+(%d+)[^\r\n]*[\r\n]*") do
param1, param2 = tonumber(param1), tonumber(param2)
table.insert(nodes, {
x = originx + tonumber(x),
y = originy + tonumber(y),
z = originz + tonumber(z),
name = name,
param1 = param1 ~= 0 and param1 or nil,
param2 = param2 ~= 0 and param2 or nil,
})
end
elseif version == 4 or version == 5 then -- Nested table format
if not jit then
-- This is broken for larger tables in the current version of LuaJIT
nodes = minetest.deserialize(content)
else
-- XXX: This is a filthy hack that works surprisingly well - in LuaJIT, `minetest.deserialize` will fail due to the register limit
nodes = {}
content = content:gsub("return%s*{", "", 1):gsub("}%s*$", "", 1) -- remove the starting and ending values to leave only the node data
local escaped = content:gsub("\\\\", "@@"):gsub("\\\"", "@@"):gsub("(\"[^\"]*\")", function(s) return string.rep("@", #s) end)
local startpos, startpos1, endpos = 1, 1
while true do -- go through each individual node entry (except the last)
startpos, endpos = escaped:find("},%s*{", startpos)
if not startpos then
break
end
local current = content:sub(startpos1, startpos)
local entry = minetest.deserialize("return " .. current)
table.insert(nodes, entry)
startpos, startpos1 = endpos, endpos
end
local entry = minetest.deserialize("return " .. content:sub(startpos1)) -- process the last entry
table.insert(nodes, entry)
end
else
return nil
end
return nodes
end
--- Determines the volume the nodes represented by string `value` would occupy
-- if deserialized at `origin_pos`.
-- @return Low corner position.
-- @return High corner position.
-- @return The number of nodes.
function worldedit.allocate(origin_pos, value)
local nodes = load_schematic(value)
if not nodes then return nil end
return worldedit.allocate_with_nodes(origin_pos, nodes)
end
-- Internal
function worldedit.allocate_with_nodes(origin_pos, nodes)
local huge = math.huge
local pos1x, pos1y, pos1z = huge, huge, huge
local pos2x, pos2y, pos2z = -huge, -huge, -huge
local origin_x, origin_y, origin_z = origin_pos.x, origin_pos.y, origin_pos.z
for i, entry in ipairs(nodes) do
local x, y, z = origin_x + entry.x, origin_y + entry.y, origin_z + entry.z
if x < pos1x then pos1x = x end
if y < pos1y then pos1y = y end
if z < pos1z then pos1z = z end
if x > pos2x then pos2x = x end
if y > pos2y then pos2y = y end
if z > pos2z then pos2z = z end
end
local pos1 = {x=pos1x, y=pos1y, z=pos1z}
local pos2 = {x=pos2x, y=pos2y, z=pos2z}
return pos1, pos2, #nodes
end
--- Loads the nodes represented by string `value` at position `origin_pos`.
-- @return The number of nodes deserialized.
function worldedit.deserialize(origin_pos, value)
local nodes = load_schematic(value)
if not nodes then return nil end
local pos1, pos2 = worldedit.allocate_with_nodes(origin_pos, nodes)
worldedit.keep_loaded(pos1, pos2)
local origin_x, origin_y, origin_z = origin_pos.x, origin_pos.y, origin_pos.z
local count = 0
local add_node, get_meta = minetest.add_node, minetest.get_meta
for i, entry in ipairs(nodes) do
entry.x, entry.y, entry.z = origin_x + entry.x, origin_y + entry.y, origin_z + entry.z
-- Entry acts as both position and node
add_node(entry, entry)
if entry.meta then
get_meta(entry):from_table(entry.meta)
end
end
return #nodes
end
|
local Days = {
DayOne = require "solution.001",
DayTwo = require "solution.002",
DayThree = require "solution.003",
}
local meta_string = getmetatable("")
meta_string.__index = function ( self, idx )
if (string[idx]) then
return string[idx]
elseif ( tonumber( idx ) ) then
return self:sub( idx, idx )
else
error("attempt to index a string value with bad key ('" .. tostring( idx ) .. "' is not part of the string library)", 2)
end
end
meta_string.__mul = function ( self, num)
return string.rep(self, num)
end
meta_string.__mod = function ( self, arg)
if ( type( arg ) == "string" ) then
return string.format( self, arg )
else
return string.format( self, unpack( arg ) )
end
end
local function main ()
for _, m in pairs( Days ) do
for name, solution in pairs ( m.active ) do
if solution == true then
print "-----------"
m[name]()
print "-----------"
end
end
end
end
main()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.