content
stringlengths 5
1.05M
|
|---|
---@diagnostic disable: undefined-global
-- lush_jsx settings handler
local utils = require("lush_jsx.utils")
local settings = {
contrast_dark = "soft",
contrast_light = "hard",
bold = true,
italic = true,
undercurl = true,
underline = true,
inverse = true,
improved_strings = true,
improved_warnings = true,
invert_signs = false,
invert_selection = true,
invert_tabline = true,
italicize_comments = true,
italicize_strings = false,
invert_intend_guides = false,
}
local styles = {
italic = "italic",
bold = "bold",
underline = "underline",
inverse = "inverse",
undercurl = "undercurl",
invert_signs = "",
invert_selection = "inverse",
invert_tabline = "",
italic_comments = "italic",
italic_strings = "NONE",
}
-- setting default values
for k, val in pairs(settings) do
local key = "lush_jsx_" .. k
if vim.g[key] == nil then
vim.g[key] = val
end
end
-- styles check
if not utils.tobool(vim.g.lush_jsx_bold) then
styles.bold = "NONE"
end
if not utils.tobool(vim.g.lush_jsx_underline) then
styles.underline = "NONE"
end
if not utils.tobool(vim.g.lush_jsx_italic) then
styles.italic = "NONE"
end
if not utils.tobool(vim.g.lush_jsx_inverse) then
styles.inverse = "NONE"
end
if not utils.tobool(vim.g.lush_jsx_inverse) then
styles.inverse = "NONE"
end
if not utils.tobool(vim.g.lush_jsx_undercurl) then
styles.undercurl = "NONE"
end
if utils.tobool(vim.g.lush_jsx_invert_signs) then
styles.invert_signs = "inverse"
end
if not utils.tobool(vim.g.lush_jsx_invert_selection) then
styles.invert_selection = "NONE"
end
if utils.tobool(vim.g.lush_jsx_invert_tabline) then
styles.invert_tabline = "inverse"
end
if not utils.tobool(vim.g.lush_jsx_italicize_comments) then
styles.italic_comments = "NONE"
end
if utils.tobool(vim.g.lush_jsx_italicize_strings) then
styles.italic_strings = "italic"
end
return { settings = settings, styles = styles }
|
object_draft_schematic_vehicle_civilian_hoverlifter_speeder_crafted = object_draft_schematic_vehicle_civilian_shared_hoverlifter_speeder_crafted:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_vehicle_civilian_hoverlifter_speeder_crafted, "object/draft_schematic/vehicle/civilian/hoverlifter_speeder_crafted.iff")
|
--
-- Based heavily on MiddleClick, https://github.com/artginzburg/MiddleClick-Catalina
--
--
-- leaving here because linked to in https://github.com/Hammerspoon/hammerspoon/issues/2057
-- further work, cleanup, etc. being done at https://github.com/asmagill/hs._asm.undocumented.touchdevice/blob/master/Examples/middleButton.lua
--
local touchdevice = require("hs._asm.undocumented.touchdevice")
local menubar = require("hs.menubar")
local eventtap = require("hs.eventtap")
local canvas = require("hs.canvas")
local settings = require("hs.settings")
local caffeinate = require("hs.caffeinate")
local mouse = require("hs.mouse")
local timer = require("hs.timer")
local stext = require("hs.styledtext")
local eventTypes = eventtap.event.types
local eventProperties = eventtap.event.properties
local module = {}
local USERDATA_TAG = "threeFingers"
local settings_fingersLabel = USERDATA_TAG .. "_fingers"
local settings_needToClickLabel = USERDATA_TAG .. "_needClick"
local _menu = nil
local _needToClick = settings.get(settings_needToClickLabel)
local _fingers = settings.get(settings_fingersLabel) or 3
-- if _needToClick was false, the trick above for setting the default _fingers won't work, so explicitly check
if _needToClick == nil then _needToClick = true end
local _attachedDeviceCallbacks = {}
local _threeDown = false
local _wasThreeDown = false
local _leftClickTap = nil
local _sleepWatcher = nil
local _touchStartTime = nil
local _middleclickPoint = nil
local _middleclickPoint2 = nil
local _maybeMiddleClick = false
local _menuIcon = canvas.new{ x = 0, y = 0, h = 128, w = 128}
_menuIcon[#_menuIcon + 1] = {
type = "oval",
action = "fill",
fillColor = { white = 0 },
frame = { x = 1, y = 64, h = 48, w = 28 }
}
_menuIcon[#_menuIcon + 1] = {
type = "oval",
action = "fill",
fillColor = { white = 0 },
frame = { x = 43, y = 32, h = 48, w = 28 }
}
_menuIcon[#_menuIcon + 1] = {
type = "oval",
action = "fill",
fillColor = { white = 0 },
frame = { x = 97, y = 16, h = 48, w = 28 }
}
module.fingers = function(fingers)
if type(fingers) == "nil" then
return _fingers
else
assert(math.type(fingers) == "integer", "expected integer")
assert(fingers > 2, "expected integer greater than 2")
_fingers = fingers
settings.set(settings_fingersLabel, _fingers)
return module
end
end
module.click = function(on)
if type(on) == "nil" then
return _needToClick
else
assert(type(on) == "boolean", "expected boolean")
_needToClick = on
settings.set(settings_needToClickLabel, _needToClick)
if _leftClickTap then
if _needToClick then
_leftClickTap:start()
else
_leftClickTap:stop()
end
end
return module
end
end
-- touchdevice doesn't currently have a way to detect when new devices added/removed
-- but I think I have sample code now, so maybe in the future...
module.rescan = function()
-- clear the current callbacks
for _, v in ipairs(_attachedDeviceCallbacks) do v:stop() end
-- if we're running, start up new callbcaks for all currently attached devices
if _menu then
_attachedDeviceCallbacks = {}
for _, v in ipairs(touchdevice.devices()) do
table.insert(
_attachedDeviceCallbacks,
touchdevice.forDeviceID(v):frameCallback(function(_, touches, _, _)
local nFingers = #touches
if (_needToClick) then
_threeDown = (nFingers == _fingers)
else
if nFingers == 0 then
if _middleclickPoint and _middleclickPoint2 then
local delta = math.abs(_middleclickPoint.x - _middleclickPoint2.x) +
math.abs(_middleclickPoint.y - _middleclickPoint2.y)
if delta < 0.4 then
eventtap.middleClick(mouse.absolutePosition())
end
end
_touchStartTime = nil
_middleclickPoint = nil
_middleclickPoint2 = nil
elseif nFingers > 0 and not _touchStartTime then
_touchStartTime = timer.secondsSinceEpoch()
_maybeMiddleClick = true
_middleclickPoint = { x = 0, y = 0 }
elseif _maybeMiddleClick then
local elapsedTime = timer.secondsSinceEpoch() - _touchStartTime
if elapsedTime > .5 then
_maybeMiddleClick = false
_middleclickPoint = nil
_middleclickPoint2 = nil
end
end
if nFingers > _fingers then
_maybeMiddleClick = false
_middleclickPoint = nil
_middleclickPoint2 = nil
elseif nFingers == _fingers then
local xAggregate = touches[1].absoluteVector.position.x + touches[2].absoluteVector.position.x + touches[3].absoluteVector.position.x
local yAggregate = touches[1].absoluteVector.position.y + touches[2].absoluteVector.position.y + touches[3].absoluteVector.position.y
if _maybeMiddleClick then
_middleclickPoint = { x = xAggregate, y = yAggregate }
_middleclickPoint2 = { x = xAggregate, y = yAggregate }
_maybeMiddleClick = false;
else
_middleclickPoint2 = { x = xAggregate, y = yAggregate }
end
end
end
end):start()
)
end
end
return module
end
module.start = function()
if not _menu then
_menu = menubar.new():setIcon(_menuIcon:imageFromCanvas():template(true):size{ h = 22, w = 22 })
:setTooltip("MiddleClick")
:setMenu(function(_)
return {
{
title = stext.new(USERDATA_TAG .. " for Hammerspoon", {
font = { name = "Arial-BoldItalicMT", size = 13 },
color = { list = "x11", name = "royalblue" },
}),
disabled = true
},
{ title = "-" },
{
title = string.format("%d Finger Click", _fingers),
fn = function(_) module.click(true) end,
checked = (_needToClick == true)
}, {
title = string.format("%d Finger Tap", _fingers),
fn = function(_) module.click(false) end,
checked = (_needToClick == false)
},
{ title = "-" },
{ title = "Rescan Multitouch devices", fn = module.rescan },
{ title = "-" },
{ title = "Quit", fn = module.stop },
}
end)
module.rescan() -- will attach all currently attached devices
_threeDown = false
_wasThreeDown = false
_leftClickTap = eventtap.new({ eventTypes.leftMouseDown, eventTypes.leftMouseUp }, function(event)
if _needToClick then
local eType = event:getType()
if _threeDown and eType == eventTypes.leftMouseDown then
_wasThreeDown = true
_threeDown = false
return true, { eventtap.event.newMouseEvent(
eventTypes.otherMouseDown,
event:location()
):rawFlags(event:rawFlags())
:setProperty(eventProperties.mouseEventButtonNumber, 2) }
elseif _wasThreeDown and eType == eventTypes.leftMouseUp then
_wasThreeDown = false
return true, { eventtap.event.newMouseEvent(
eventTypes.otherMouseUp,
event:location()
):rawFlags(event:rawFlags())
:setProperty(eventProperties.mouseEventButtonNumber, 2) }
end
end
return false
end)
if _needToClick then _leftClickTap:start() end
_sleepWatcher = caffeinate.watcher.new(function(event)
if event == caffeinate.watcher.systemDidWake then
module.rescan()
end
end):start()
end
return module
end
module.stop = function()
if _menu then
_menu:delete()
_menu = nil
module.rescan() -- will clear all device callbacks
_threeDown = false
_wasThreeDown = false
_leftClickTap:stop() ; _leftClickTap = nil
_sleepWatcher:stop() ; _sleepWatcher = nil
end
return module
end
-- remove :start() if you don't want this to auto-start
return module:start()
|
--local variables
local binds = {}
local call_translate_position = false
local cursor_start_x, cursor_start_y
local cursor_translate_x, cursor_translate_y
local moving = false
local PANEL = {PecanEditor = true}
local speed = 1
local translate_position = vector_origin
local think_time = RealTime()
local thinking_binds = {}
--local tables
--optimization: we don't have to make this per panel since only one of this panel should ever be open
local default_frames = {
{
class = "SubmaterialSelector"
}
}
local move_unthinks = {"+back", "+forward", "+jump", "+moveleft", "+moveright"}
local bind_press_functions = {
["+attack"] = function(self)
cursor_start_x, cursor_start_y = ScrW() * 0.5, ScrH() * 0.5
moving = true
RememberCursorPosition()
input.SetCursorPos(cursor_start_x, cursor_start_y)
self:MouseCapture(true)
self:SetCursor("blank")
end,
["+reload"] = function(self) if not moving then hook.Call("PecaneResetCamera", PECAN, false) end end,
toggleconsole = function(self)
self:Remove()
gui.ActivateGameUI()
end
}
local bind_release_functions = {
["+attack"] = function(self)
moving = false
RestoreCursorPosition()
hook.Call("PecaneTranslateAnglesFinish", PECAN, self)
self:MouseCapture(false)
self:SetCursor("arrow")
--release keys for movement, so we don't accidentally move after we release
for index, bind in ipairs(move_unthinks) do
binds[bind] = nil
thinking_binds[bind] = nil
end
end
}
local bind_think_functions = {
["+attack"] = function(self)
--more!
self:SetCursor("blank")
hook.Call("PecaneTranslateAngles", PECAN, self, gui.MouseX() - cursor_start_x, gui.MouseY() - cursor_start_y)
end,
["+back"] = function(self)
call_translate_position = true
if moving then translate_position = translate_position - Vector(speed, 0, 0)
else translate_position = translate_position - Vector(0, 0, speed) end
end,
["+forward"] = function(self)
call_translate_position = true
if moving then translate_position = translate_position + Vector(speed, 0, 0)
else translate_position = translate_position + Vector(0, 0, speed) end
end,
["+jump"] = function(self)
if moving then
call_translate_position = true
translate_position = translate_position + Vector(0, 0, speed)
end
end,
["+moveleft"] = function(self)
call_translate_position = true
translate_position = translate_position + Vector(0, speed, 0)
end,
["+moveright"] = function(self)
call_translate_position = true
translate_position = translate_position - Vector(0, speed, 0)
end
}
--local functions
local function bind_call(self, code, press)
local bind = input.LookupKeyBinding(code)
if bind then
if press then self:OnBindPressed(bind)
else self:OnBindReleased(bind) end
end
end
--panel functions
function PANEL:GenerateExample() end
function PANEL:Init()
local exiting_panel = GetHUDPanel():Find("PecanEditor")
if exiting_panel then exiting_panel:Remove() end
self.HeaderHeight = 24
do --header
local header = vgui.Create("DPanel", self)
header:Dock(TOP)
header:SetHeight(self.HeaderHeight)
header:SetMouseInputEnabled(true)
header.Editor = self
self.Header = header
do --close button
local button = vgui.Create("DButton", header)
button:Dock(RIGHT)
button:DockMargin(0, 2, 4, 2)
button:SetText("#pecane.close")
function button:DoClick() self.Editor:Remove() end
button.Editor = self
header.ButtonClose = button
end
end
do --default frames
for index, frame_data in ipairs(default_frames) do
local class = "Pecan" .. frame_data.class
if vgui.GetControlTable(class) then
local frame = vgui.Create(class, self)
frame:SetKeyboardInputEnabled(true)
frame:SetMouseInputEnabled(true)
if frame_data.pos then
local x, y = unpack(frame_data.pos)
frame:SetPos(x, y + self.HeaderHeight)
else frame:SetPos(hook.Call("PecaneOpenPanel", PECAN, self, frame)) end
if frame_data.size then frame:SetSize(unpack(frame_data.size)) end
end
end
end
self:SetFocusTopLevel(true)
self:SetName("PecanEditor")
self:SetParent(GetHUDPanel())
self:SetPos(0, 0)
self:SetSize(ScrW(), ScrH())
self:SetSkin("Pecan")
self:MakePopup()
self:DoModal()
end
function PANEL:OnBindPressed(bind)
if bind_press_functions[bind] then bind_press_functions[bind](self) end
if bind_think_functions[bind] then thinking_binds[bind] = true end
binds[bind] = true
end
function PANEL:OnBindReleased(bind, closing)
--we don't want releases from other panels
if binds[bind] then
if bind_release_functions[bind] then bind_release_functions[bind](self, closing) end
binds[bind] = nil
thinking_binds[bind] = nil
end
end
function PANEL:OnKeyCodePressed(code) bind_call(self, code, true) end
function PANEL:OnKeyCodeReleased(code) bind_call(self, code, false) end
function PANEL:OnMousePressed(code) bind_call(self, code, true) end
function PANEL:OnMouseReleased(code) bind_call(self, code, false) end
function PANEL:OnRemove()
for bind in pairs(binds) do
if binds[bind] then
self:OnBindReleased(bind, true)
binds[bind] = nil
thinking_binds[bind] = nil
end
end
hook.Call("PecaneClose", PECAN)
end
function PANEL:Paint(width, height)
local clipping = DisableClipping(true)
surface.SetDrawColor(20, 20, 20)
surface.DrawRect(0, 0, width, height)
hook.Call("PecaneRender", PECAN, self, width, height)
DisableClipping(clipping)
end
function PANEL:PerformLayout(width, height)
--more!
self.Header:SetHeight(self.HeaderHeight)
end
function PANEL:SetHeaderHeight(height)
self.Header:SetHeight(height)
self.HeaderHeight = height
end
function PANEL:Think()
for bind in pairs(thinking_binds) do if bind_think_functions[bind] then bind_think_functions[bind](self) end end
if call_translate_position then
local duck_mult = binds["+speed"] and 2 or 1
local speed_mult = binds["+duck"] and 0.2 or 1
translate_position:Normalize()
hook.Call("PecaneTranslatePosition", PECAN, self, RealTime() - think_time, translate_position * speed * duck_mult * speed_mult)
call_translate_position = false
translate_position = vector_origin
end
think_time = RealTime()
end
derma.DefineControl("PecanEditor", "Editor for Pecan", PANEL, "EditablePanel")
|
return [[
#81-717
[cz]
#Cameras:
Train.717.Breakers = Jističe
Train.717.VB = Baterie a OŘO
Train.717.VBD = VBD a UPPS
Train.717.VRD = VRD
Train.717.SOSD = SOSD
Train.717.PUAV = PUAV (RAV)
Train.717.PA = PA (Vlaková aparatura)
Train.717.PAScreen = Obrazovka PA
Train.714.Shunt = Ovládací panel (posun), ventil brzdiče
#Spawner
Spawner.717.Line2 = Souprava z linky MPL
Spawner.717.Line4 = Souprava z linky PBL
Spawner.717.Line5 = Souprava z linky FPL
Spawner.717.Type = Typ soupravy
Spawner.717.BodyType = Plášť vozu
Spawner.717.MVM = MVM (Moskevský)
Spawner.717.LVZ = LVZ (Petrohradský)
Spawner.717.MaskType = Maska čela
Spawner.717.CranType = Brzdič
Spawner.717.LampType = Typ osvětlení
Spawner.717.Lamp1 = LPV-02
Spawner.717.Lamp2 = LLV-01
Spawner.717.SeatType = Typ sedadel
Spawner.717.ARS = Panel ARS
Spawner.717.RingType = Zvonek ARS
Spawner.717.BPSNType = Typ měniče (BPSN)
#######Buttons###########
Train.Buttons.RZP = BPSN converter protection engaged
#Common
Common.717.VBD = Vypínač blokování dveří pomocí ASNP
Common.717.UPPS = Vypínač systému UPPS
Common.717.BPSN = BPSN: Měnič
Common.717.ARS13V = Ověření napětí ARS 13V
Common.717.Radio13V = Ověření napětí Rádio 13V
Common.717.LVD = LVD: Kontrolka 1. vodiče (trakční motory v chodu)
Common.717.LHRK = LHRK: Kontrolka 2. vodiče (rotace reostatu kontroléru)
Common.717.LST = LST: Kontrolka 6. vodiče (Brzda)
Common.717.KVC = LKVC: Kontrolka pomocných elektrických stykačů (vysoké napětí není k dispozici)
Common.717.GLEB = GLEB: Kontrolka aktualizace
Common.717.KVP = LKVP: Kontrolka regulace vysokonapěťového měniče (BPSN)
Common.717.LSP = LSP: Požár
Common.717.LEKK = LEKK: Indikátor kontaktní svorkovnice
Common.717.LPU = LPU: Indikátor redukce parametru RUT
Common.717.OtklBV = Vypnutí BV
Common.717.OtklBVK = Krytka BV
Common.717.ConverterProtection = Tlačítko obnovy chrániče měniče
Common.717.VZ1 = VZ1: Pneumatický ventil č. 1
Common.717.VL1 = Kontrolka zapnutí ventilace
Common.717.V13 = Ventilace nouze
Common.717.V11 = Ventilace 1. skupiny
Common.717.V12 = Ventilace 2. skupiny
Common.717.RZPL = RZP: Vybavení RZP (ochrana BPSN)
Common.717.VPAOn = VPA: Zapnout vlakovou aparaturu
Common.717.VPAOff = VPA: Vypnout vlakovou aparaturu
Common.717.VZD = VZD: Zavření dveří
Common.717.A53 = A53: Vlakové obvody
Common.717.A56 = A56: Baterie
Common.717.A54 = A54: Vypínač řízení
Common.717.A17 = A17: Reflektory, dveře
Common.717.A44 = A44: Nouzové řízení (kompresory NŘ)
Common.717.A39 = A39: Nouzové řízení vozidel
Common.717.A70 = A70: Korekce zátěže relé (automaticky)
Common.717.A14 = A14: Relé nouzového řízení
Common.717.A74 = A74: Vybavení MR
Common.717.A26 = A26: Zdroj VKV
Common.717.AR63 = AР63: Napájení radiostanice (VR)
Common.717.AS1 = AС1: Intercom, ASNP
Common.717.A13 = A13: Signalizace dveří
Common.717.A21 = A21: Ovládání dveří
Common.717.A31 = A31: Otevřít levé dveře
Common.717.A32 = A32: Otevřít pravé dveře
Common.717.A16 = A16: Zavření dveří
Common.717.A12 = A12: Dveře nouze
Common.717.A24 = A24: Dobíjení baterie
Common.717.A49 = A49: Osvětlení nouze
Common.717.A27 = A27: Osv. kabiny, interiéru, kontr. MR, park. brzda
Common.717.A72 = A72: Pneumatický ventil č. 1
Common.717.A50 = A50: Přídrž PBO
Common.717.AV3 = AВ3: Nouzové napájení ventilace
Common.717.AV3S = AВ3: Nouzové napájení radiostanice
Common.717.AV2 = AВ2: Ventilace (napájení)
Common.717.AV4 = AВ4: Ovládání ventilace 1. skupiny
Common.717.AV5 = AВ5: Ovládání ventilace 2. skupiny
Common.717.AV6 = AВ6: Ventilace nouze
Common.717.AV1 = AВ1: Ventilace
Common.717.A29 = A29: Bílá světla (napájení)
Common.717.A46 = A46: Bílá světla (klopená)
Common.717.A47 = A47: Bílá světla (dálková)
Common.717.A71 = A71: Napájení ČR-3, červená světla
Common.717.A7 = A7: Červené světlo pravé
Common.717.A9 = A9: Červené světlo levé
Common.717.A84 = @[Common.ALL.VU]
Common.717.A8 = A8: Pneumatický ventil č. 2
Common.717.A52 = A52: Pedál, ventil č. 2
Common.717.A19 = A19: ČR-3
Common.717.A48 = A48: Pedál bdělosti
Common.717.A10 = A10: Ovládání kompresoru
Common.717.A22 = A22: Stykač kompresoru
Common.717.A30 = A30: Motor HK (SDRK)
Common.717.A1 = A1: Jízda (J-1)
Common.717.A2 = A2: Ovládání HRK (Jízda II/J-2)
Common.717.A3 = A3: Jízda III (J-3)
Common.717.A4 = A4: Jízda vzad
Common.717.A5 = A5: Jízda vpřed
Common.717.A6 = A6: Elektrická brzda
Common.717.A18 = A18: Všeobecná porucha
Common.717.A73 = A73: Napáj. obv. kontroly TO
Common.717.A20 = A20: LS-2, LS-5
Common.717.A25 = A25: Ruční brzdění
Common.717.A11 = A11: Osvětlení kabiny
Common.717.A37 = A37: Vybavení RZP
Common.717.A45 = A45: Ovládání měniče
Common.717.A38 = A38: RZP
Common.717.A51 = A51: Stykač měniče
Common.717.A65 = A65: Měnič
Common.717.A66 = A66: Bezp. signal. VN (BV)
Common.717.A42 = A42: Napájení ARS (75V)
Common.717.A43 = A43: Baterie ARS (12V)
Common.717.A432 = A43: Ovládání EPK/EPV
Common.717.A41 = A41: Pneumatický ventil č. 2 (ARS)
Common.717.A40 = A40: Brzdění ARS
Common.717.A75 = A75: Vytápění kabiny
Common.717.A76 = A76: Protipožární ochrana (ASOTP)
Common.717.A60 = A60: Elektromotory (kontrolka)
Common.717.A58 = A58: Jízda nouze (KAH-1)
Common.717.A57 = A57: Reostat kontroléru (HRK)
Common.717.A59 = A59: Jízda nouze (KAH-2)
Common.717.A28 = A28: Napájení jednotky tyristor. reg. výkonu
Common.717.A55 = A55: Sběrače proudu
Common.717.A68 = A68: Sběrače
Common.717.A80 = A80: Zapnutí BV
Common.717.A81 = A81: Ovládání BV
Common.717.A58PU = A58: Napájení PUAV
Common.717.A59PU = A59: Ovládání PUAV
Common.717.A61PU = A61: Kontrola klíče reversu PUAV
Common.717.A58PA = A58: Napájení PA
Common.717.A59PA = А59: @[Common.ALL.Unsused1]
Common.717.A61PA = A61: Kontrola klíče reversu PA
Common.717.A78 = A78: Přední dveře
Common.717.ABK = A-ВК: Klimatizace kabiny
Common.717.A81 = A81: Ovládání BV
Common.717.A23 = A23: Zapnutí kompresoru
Common.717.A15 = A15: Osvětlení nouze
Common.717.AIS = AIS: Tachograf
Common.717.RC2 = RC-2: Odpojovač řídících obvodů autovedení
Common.717.VAU = VAU: Systém autovedení (RAV)
Common.717.LampDV = DV: Porucha rotačního snímače
Common.717.ARSL20 = Rychlost 20 km/h
Common.717.ARSL40 = @[Common.ARS.40]
Common.717.ARSL60 = @[Common.ARS.60]
Common.717.ARSL70 = @[Common.ARS.70]
Common.717.ARSL80 = @[Common.ARS.80]
Common.PUAV.K16 = LK16: Kontrolka napájení 16. vodiče (zavření dveří)
Common.PUAV.OS = LOS: Režim omezení rychlosti (PUAV)
Common.PUAV.AVT = LAVT: Režim autovedení (PUAV)
Common.PUAV.RS = LRS: Režim regulace rychlosti (PUAV)
Common.PUAV.KI1 = LKI1: Indikátor závady 1. kompletu PUAV
Common.PUAV.KI2 = LKI2: Indikátor závady 2. kompletu PUAV
Common.717.KH = KHZ: Povolit J-3 v režimu RAV
Common.717.KSZD = KSZD: Zavření dveří (Souhlas)
Common.717.VAV = @[Common.ALL.VAV]
Common.717.PAM = PA-M
Common.717.PAKSDM = PA-KSD-M
Common.PA.P = P
Common.PA.F = F
Common.PA.Up = Nahoru
Common.PA.M = M
Common.PA.Left = Doleva
Common.PA.Down = Dolů
Common.PA.Right = Doprava
Common.PA.Esc = Zrušit
Common.PA.Enter = Zadat
Common.714.Start = Zapnout trakční motory
Common.714.RV = Přepínač směru jízdy
#gmod_subway_81-717
Entities.gmod_subway_81-717_mvm.Buttons.Battery_C.1:UOSToggle = @[Common.ALL.UOS]
Entities.gmod_subway_81-717_mvm.Buttons.Battery_R.2:UOSToggle = @[Common.ALL.UOS]
Entities.gmod_subway_81-717_mvm.Buttons.Battery_C.1:VBToggle = @[Common.ALL.VB]
Entities.gmod_subway_81-717_mvm.Buttons.Battery_R.2:VBToggle = @[Common.ALL.VB]
Entities.gmod_subway_81-717_mvm.Buttons.Battery_C.1:RC1Toggle = @[Common.ALL.RC1]
Entities.gmod_subway_81-717_mvm.Buttons.Battery_R.2:RC1Toggle = @[Common.ALL.RC1]
Entities.gmod_subway_81-717_mvm.Buttons.VBD_C.1:VBDToggle = @[Common.717.VBD]
Entities.gmod_subway_81-717_mvm.Buttons.VBD_R.2:VBDToggle = @[Common.717.VBD]
Entities.gmod_subway_81-717_mvm.Buttons.VBD_C.1:UPPS_OnToggle = @[Common.717.UPPS]
Entities.gmod_subway_81-717_mvm.Buttons.VBD_R.2:UPPS_OnToggle = @[Common.717.UPPS]
Entities.gmod_subway_81-717_mvm.Buttons.Block1.VMKToggle = @[Common.ALL.VMK]
Entities.gmod_subway_81-717_mvm.Buttons.Block1.BPSNonToggle = @[Common.717.BPSN]
Entities.gmod_subway_81-717_mvm.Buttons.Block1.RezMKSet = @[Common.ALL.RMK]
Entities.gmod_subway_81-717_mvm.Buttons.Block1.ARS13Set = @[Common.717.ARS13V]
Entities.gmod_subway_81-717_mvm.Buttons.Block1.!BatteryVoltage = @[Common.ALL.BatteryVoltage]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!Speedometer1 = @[Common.ALL.Speedometer]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!Speedometer2 = @[Common.ALL.Speedometer]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!ARSOch = @[Common.ARS.04]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!ARS0 = @[Common.ARS.0]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!ARS40 = @[Common.ARS.40]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!ARS60 = @[Common.ARS.60]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!ARS70 = @[Common.ARS.70]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!ARS80 = @[Common.ARS.80]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!LampLSD1 = @[Common.ALL.LSD]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!LampLSD2 = @[Common.ALL.LSD]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!LampLHRK = @[Common.717.LHRK]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!LampRP = @[Common.ALL.RP]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!LampLSN = @[Common.ALL.SN]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!LampLN = @[Common.ARS.LN]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!LampLKVD = @[Common.ARS.VD]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!LampLKT = @[Common.ARS.KT]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!LampLKVC = @[Common.717.KVC]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!LampLRS = @[Common.ARS.RS]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!LampLVD = @[Common.717.LVD]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_1.!LampLST = @[Common.717.LST]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!Speedometer1 = @[Common.ALL.Speedometer]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!Speedometer2 = @[Common.ALL.Speedometer]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!ARSOch = @[Common.ARS.04]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!ARS0 = @[Common.ARS.0]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!ARS40 = @[Common.ARS.40]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!ARS60 = @[Common.ARS.60]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!ARS70 = @[Common.ARS.70]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!ARS80 = @[Common.ARS.80]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!LampLSD1 = @[Common.ALL.LSD]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!LampLSD2 = @[Common.ALL.LSD]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!LampLVD = @[Common.717.LVD]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!LampLHRK = @[Common.717.LHRK]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!LampLST = @[Common.717.LST]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!LampRP = @[Common.ALL.RP]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!LampLSN = @[Common.ALL.SN]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!LampLKVD = @[Common.ARS.VD]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!LampLKVC = @[Common.717.KVC]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!LampLKT = @[Common.ARS.KT]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!LampLEKK = @[Common.717.GLEB]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!LampLN = @[Common.ARS.LN]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_2.!LampLRS = @[Common.ARS.RS]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!Speedometer2 = @[Common.ALL.Speedometer]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!LSD = @[Common.ALL.LSD]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!LOch = @[Common.ARS.0]\n@[Common.ARS.04]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!LN = @[Common.ARS.LN]\n@[Common.ARS.40]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!60 = @[Common.ARS.60]\n@[Common.ARS.80]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!70 = @[Common.ARS.70]\n@[Common.717.LHRK]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!LEKK = @[Common.717.LEKK]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!LPU = @[Common.717.LPU]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!LKVD = @[Common.ARS.VD]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!LKT = @[Common.ARS.KT]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!LRP = @[Common.ALL.RRP]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!LKVC = @[Common.717.KVC]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!LVD = @[Common.717.LVD]
Entities.gmod_subway_81-717_mvm.Buttons.Block2_3.!LST = @[Common.717.LST]
Entities.gmod_subway_81-717_mvm.Buttons.Block3.!BLTLPressure = @[Common.ALL.BLTLPressure]
Entities.gmod_subway_81-717_mvm.Buttons.Block3.!BCPressure = @[Common.ALL.BCPressure]
Entities.gmod_subway_81-717_mvm.Buttons.Block4.R_ASNPMenuSet = @[Common.ASNP.ASNPMenu]
Entities.gmod_subway_81-717_mvm.Buttons.Block4.R_ASNPUpSet = @[Common.ASNP.ASNPUp]
Entities.gmod_subway_81-717_mvm.Buttons.Block4.R_ASNPDownSet = @[Common.ASNP.ASNPDown]
Entities.gmod_subway_81-717_mvm.Buttons.Block4.R_ASNPOnToggle = @[Common.ASNP.ASNPOn]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.R_UNchToggle = @[Common.ALL.UNCh]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.R_ZSToggle = @[Common.ALL.ES]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.R_GToggle = @[Common.ALL.GCab]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.R_RadioToggle = @[Common.ALL.R_Radio]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.R_Program1Set = @[Common.ALL.Program1]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.R_Program2Set = @[Common.ALL.Program2]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.1:KVTSet = @[Common.ARS.KVT]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.1:KVTRSet = @[Common.ARS.KVTR]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.2:KVTSet = @[Common.ARS.KVT]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.2:KVTRSet = @[Common.ARS.KVTR]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.!L1Light = @[Common.717.VL1]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.VZ1Set = @[Common.717.VZ1]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.V13Toggle = @[Common.717.V13]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.VUD1Toggle = @[Common.ALL.VUD]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.KDLSet = @[Common.ALL.KDL]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.KDLKToggle = @[Common.ALL.KDLK]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.KDLRSet = @[Common.ALL.KDL]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.KDLRKToggle = @[Common.ALL.KDLK]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.DoorSelectToggle = @[Common.ALL.VSD]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.KRZDSet = @[Common.ALL.KRZD]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.R_VPRToggle = @[Common.ALL.VPR]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.VozvratRPSet = @[Common.ALL.VRPBV]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.!GreenRPLight = @[Common.ALL.GRP]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.!AVULight = @[Common.ALL.LAVU]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.!LKVPLight = @[Common.717.KVP]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.!SPLight = @[Common.717.LSP]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.OtklAVUToggle = @[Common.ALL.OAVU]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.OtklBVSet = @[Common.717.OtklBV]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.OtklBVKToggle = @[Common.717.OtklBVK]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.V11Toggle = @[Common.717.V11]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.V12Toggle = @[Common.717.V12]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.ConverterProtectionSet = @[Common.717.ConverterProtection]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.KSNSet = @[Common.ALL.KSN]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.RingSet = @[Common.ALL.Ring]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.ARSToggle = @[Common.ALL.ARS]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.ALSToggle = @[Common.ALL.ALS]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.ARSRToggle = @[Common.ALL.ARSR]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.OVTToggle = @[Common.ALL.OVT]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.ALSFreqToggle = @[Common.ARS.Freq]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.L_1Toggle = @[Common.ALL.PassLights]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.L_2Toggle = @[Common.ALL.CabLights]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.L_3Toggle = @[Common.ALL.PanelLights]
Entities.gmod_subway_81-717_mvm.Buttons.Block5_6.VPToggle = @[Common.ARS.VP]
Entities.gmod_subway_81-717_mvm.Buttons.Block7.L_4Toggle = @[Common.ALL.VF]
Entities.gmod_subway_81-717_mvm.Buttons.Block7.VUSToggle = @[Common.ALL.VUS]
Entities.gmod_subway_81-717_mvm.Buttons.Block7.VADToggle = @[Common.ALL.VAD]
Entities.gmod_subway_81-717_mvm.Buttons.Block7.VAHToggle = @[Common.ALL.VAH]
Entities.gmod_subway_81-717_mvm.Buttons.Block7.KRPSet = @[Common.ALL.KRP]
Entities.gmod_subway_81-717_mvm.Buttons.Block7.KAHSet = @[Common.ALL.KAH]
Entities.gmod_subway_81-717_mvm.Buttons.Block7.KAHKToggle = @[Common.ALL.KAHK]
Entities.gmod_subway_81-717_mvm.Buttons.Block7.!PNT = @[Common.ALL.BrT]
Entities.gmod_subway_81-717_mvm.Buttons.Block7.KDPSet = @[Common.ALL.KDP]
Entities.gmod_subway_81-717_mvm.Buttons.Block7.KDPKToggle = @[Common.ALL.KDPK]
Entities.gmod_subway_81-717_mvm.Buttons.Block7.!PNW = @[Common.ALL.BrW]
Entities.gmod_subway_81-717_mvm.Buttons.HVMeters.!EnginesCurrent = @[Common.ALL.EnginesCurrent]
Entities.gmod_subway_81-717_mvm.Buttons.HVMeters.!HighVoltage = @[Common.ALL.HighVoltage]
Entities.gmod_subway_81-717_mvm.Buttons.HelperPanel_C.VUD2Toggle = @[Common.ALL.VUD2]
Entities.gmod_subway_81-717_mvm.Buttons.HelperPanel_C.VDLSet = @[Common.ALL.KDL]
Entities.gmod_subway_81-717_mvm.Buttons.HelperPanel_C.R_Program1HSet = @[Common.ALL.Program1]
Entities.gmod_subway_81-717_mvm.Buttons.HelperPanel_C.R_Program2HSet = @[Common.ALL.Program2]
Entities.gmod_subway_81-717_mvm.Buttons.HelperPanel_R.1:VUD2Toggle = @[Common.ALL.VUD2]
Entities.gmod_subway_81-717_mvm.Buttons.HelperPanel_R.1:VDLSet = @[Common.ALL.KDL]
Entities.gmod_subway_81-717_mvm.Buttons.HelperPanel_R.1:R_Program1HSet = @[Common.ALL.Program1]
Entities.gmod_subway_81-717_mvm.Buttons.HelperPanel_R.1:R_Program2HSet = @[Common.ALL.Program2]
Entities.gmod_subway_81-717_mvm.Buttons.BZOS_C.SAB1Toggle = @[Common.BZOS.On]
Entities.gmod_subway_81-717_mvm.Buttons.BZOS_C.!VH1 = @[Common.BZOS.VH1]
Entities.gmod_subway_81-717_mvm.Buttons.BZOS_C.!VH2 = @[Common.BZOS.VH2]
Entities.gmod_subway_81-717_mvm.Buttons.BZOS_R.1:SAB1Toggle = @[Common.BZOS.On]
Entities.gmod_subway_81-717_mvm.Buttons.BZOS_R.1:!VH1 = @[Common.BZOS.VH1]
Entities.gmod_subway_81-717_mvm.Buttons.BZOS_R.1:!VH2 = @[Common.BZOS.VH2]
Entities.gmod_subway_81-717_mvm.Buttons.CabVent_C.PVK- = @[Common.CabVent.PVK-]
Entities.gmod_subway_81-717_mvm.Buttons.CabVent_C.PVK+ = @[Common.CabVent.PVK+]
Entities.gmod_subway_81-717_mvm.Buttons.CabVent_R.1:PVK- = @[Common.CabVent.PVK-]
Entities.gmod_subway_81-717_mvm.Buttons.CabVent_R.1:PVK+ = @[Common.CabVent.PVK+]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_C.IGLA1Set = @[Common.IGLA.Button1]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_C.IGLA2Set = @[Common.IGLA.Button2]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_C.IGLA23 = @[Common.IGLA.Button23]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_C.IGLA3Set = @[Common.IGLA.Button3]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_C.IGLA4Set = @[Common.IGLA.Button4]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_C.!IGLAFire = @[Common.IGLA.IGLAPI]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_C.!IGLAErr = @[Common.IGLA.IGLAErr]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_R.1:IGLA1Set = @[Common.IGLA.Button1]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_R.1:IGLA2Set = @[Common.IGLA.Button2]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_R.1:IGLA23 = @[Common.IGLA.Button23]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_R.1:IGLA3Set = @[Common.IGLA.Button3]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_R.1:IGLA4Set = @[Common.IGLA.Button4]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_R.1:!IGLAFire = @[Common.IGLA.IGLAPI]
Entities.gmod_subway_81-717_mvm.Buttons.IGLAButtons_R.1:!IGLAErr = @[Common.IGLA.IGLAErr]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A53Toggle = @[Common.717.A53]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A56Toggle = @[Common.717.A56]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A54Toggle = @[Common.717.A54]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A17Toggle = @[Common.717.A17]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A44Toggle = @[Common.717.A44]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A39Toggle = @[Common.717.A39]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A70Toggle = @[Common.717.A70]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A14Toggle = @[Common.717.A14]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A74Toggle = @[Common.717.A74]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A26Toggle = @[Common.717.A26]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:AR63Toggle = @[Common.717.AR63]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:AS1Toggle = @[Common.717.AS1]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A13Toggle = @[Common.717.A13]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A21Toggle = @[Common.717.A21]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A31Toggle = @[Common.717.A31]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A32Toggle = @[Common.717.A32]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A16Toggle = @[Common.717.A16]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A12Toggle = @[Common.717.A12]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A24Toggle = @[Common.717.A24]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A49Toggle = @[Common.717.A49]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A27Toggle = @[Common.717.A27]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A72Toggle = @[Common.717.A72]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A50Toggle = @[Common.717.A50]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A15Toggle = @[Common.717.A15]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:AV3Toggle = @[Common.717.AV3]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:AV2Toggle = @[Common.717.AV2]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:AV4Toggle = @[Common.717.AV4]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:AV5Toggle = @[Common.717.AV5]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:AV6Toggle = @[Common.717.AV6]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:AV1Toggle = @[Common.717.AV1]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A29Toggle = @[Common.717.A29]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A46Toggle = @[Common.717.A46]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A47Toggle = @[Common.717.A47]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A71Toggle = @[Common.717.A71]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A7Toggle = @[Common.717.A7]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A9Toggle = @[Common.717.A9]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A84Toggle = @[Common.717.A84]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A8Toggle = @[Common.717.A8]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A52Toggle = @[Common.717.A52]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A19Toggle = @[Common.717.A19]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A48Toggle = @[Common.717.A48]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A10Toggle = @[Common.717.A10]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A22Toggle = @[Common.717.A22]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A30Toggle = @[Common.717.A30]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A1Toggle = @[Common.717.A1]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A2Toggle = @[Common.717.A2]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A3Toggle = @[Common.717.A3]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A4Toggle = @[Common.717.A4]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A5Toggle = @[Common.717.A5]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A6Toggle = @[Common.717.A6]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A18Toggle = @[Common.717.A18]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A73Toggle = @[Common.717.A73]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A20Toggle = @[Common.717.A20]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A25Toggle = @[Common.717.A25]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A11Toggle = @[Common.717.A11]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A37Toggle = @[Common.717.A37]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A45Toggle = @[Common.717.A45]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A38Toggle = @[Common.717.A38]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A51Toggle = @[Common.717.A51]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A65Toggle = @[Common.717.A65]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A66Toggle = @[Common.717.A66]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A42Toggle = @[Common.717.A42]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A43Toggle = @[Common.717.A43]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A41Toggle = @[Common.717.A41]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A40Toggle = @[Common.717.A40]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A75Toggle = @[Common.717.A75]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A76Toggle = @[Common.717.A76]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A60Toggle = @[Common.717.A60]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A58Toggle = @[Common.717.A58]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A57Toggle = @[Common.717.A57]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A59Toggle = @[Common.717.A59]
Entities.gmod_subway_81-717_mvm.Buttons.AV_C.1:A28Toggle = @[Common.717.A28]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A11Toggle = @[Common.717.A11]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A17Toggle = @[Common.717.A17]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A44Toggle = @[Common.717.A44]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A26Toggle = @[Common.717.A26]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:AR63Toggle = @[Common.717.AR63]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:AS1Toggle = @[Common.717.AS1]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A21Toggle = @[Common.717.A21]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A49Toggle = @[Common.717.A49]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A27Toggle = @[Common.717.A27]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A10Toggle = @[Common.717.A10]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A53Toggle = @[Common.717.A53]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A54Toggle = @[Common.717.A54]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A84Toggle = @[Common.717.A84]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A76Toggle = @[Common.717.A76]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A48Toggle = @[Common.717.A48]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:AV1Toggle = @[Common.717.AV1]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A29Toggle = @[Common.717.A29]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A46Toggle = @[Common.717.A46]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A47Toggle = @[Common.717.A47]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A43Toggle = @[Common.717.A43]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A42Toggle = @[Common.717.A42]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A74Toggle = @[Common.717.A74]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A73Toggle = @[Common.717.A73]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A71Toggle = @[Common.717.A71]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A41Toggle = @[Common.717.A41]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A45Toggle = @[Common.717.A45]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A75Toggle = @[Common.717.A75]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A8Toggle = @[Common.717.A8]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A52Toggle = @[Common.717.A52]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A72Toggle = @[Common.717.A72]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A31Toggle = @[Common.717.A31]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A32Toggle = @[Common.717.A32]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A13Toggle = @[Common.717.A13]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A1Toggle = @[Common.717.A1]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A20Toggle = @[Common.717.A20]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A25Toggle = @[Common.717.A25]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A30Toggle = @[Common.717.A30]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A56Toggle = @[Common.717.A56]
Entities.gmod_subway_81-717_mvm.Buttons.AV_R.2:A65Toggle = @[Common.717.A65]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A2Toggle = @[Common.717.A2]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A3Toggle = @[Common.717.A3]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A4Toggle = @[Common.717.A4]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A5Toggle = @[Common.717.A5]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A6Toggle = @[Common.717.A6]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A70Toggle = @[Common.717.A70]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A14Toggle = @[Common.717.A14]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A39Toggle = @[Common.717.A39]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A28Toggle = @[Common.717.A28]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A38Toggle = @[Common.717.A38]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A22Toggle = @[Common.717.A22]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.AISToggle = @[Common.717.AIS]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A12Toggle = @[Common.717.A12]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A16Toggle = @[Common.717.A16]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A37Toggle = @[Common.717.A37]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A51Toggle = @[Common.717.A51]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A24Toggle = @[Common.717.A24]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A19Toggle = @[Common.717.A19]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A66Toggle = @[Common.717.A66]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A18Toggle = @[Common.717.A18]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A40Toggle = @[Common.717.A40]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A80Toggle = @[Common.717.A80]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A50Toggle = @[Common.717.A50]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.AV2Toggle = @[Common.717.AV2]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.AV3Toggle = @[Common.717.AV3]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.AV4Toggle = @[Common.717.AV4]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.AV5Toggle = @[Common.717.AV5]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.AV6Toggle = @[Common.717.AV6]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A15Toggle = @[Common.717.A15]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A57Toggle = @[Common.717.A57]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A81Toggle = @[Common.717.A81]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A7Toggle = @[Common.717.A7]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A9Toggle = @[Common.717.A9]
Entities.gmod_subway_81-717_mvm.Buttons.AV_S.A68Toggle = @[Common.717.A68]
Entities.gmod_subway_81-717_mvm.Buttons.Route.RouteNumber1+ = @[Common.ALL.RouteNumber1+]
Entities.gmod_subway_81-717_mvm.Buttons.Route.RouteNumber2+ = @[Common.ALL.RouteNumber2+]
Entities.gmod_subway_81-717_mvm.Buttons.Route.RouteNumber1- = @[Common.ALL.RouteNumber1-]
Entities.gmod_subway_81-717_mvm.Buttons.Route.RouteNumber2- = @[Common.ALL.RouteNumber2-]
Entities.gmod_subway_81-717_mvm.Buttons.LastStation.LastStation+ = @[Common.ALL.LastStation+]
Entities.gmod_subway_81-717_mvm.Buttons.LastStation.LastStation- = @[Common.ALL.LastStation-]
Entities.gmod_subway_81-717_mvm.Buttons.DriverValveDisconnect.DriverValveDisconnectToggle = @[Common.ALL.DriverValveDisconnect]
Entities.gmod_subway_81-717_mvm.Buttons.DriverValveTLDisconnect.DriverValveTLDisconnectToggle = @[Common.ALL.DriverValveTLDisconnect]
Entities.gmod_subway_81-717_mvm.Buttons.DriverValveBLDisconnect.DriverValveBLDisconnectToggle = @[Common.ALL.DriverValveBLDisconnect]
Entities.gmod_subway_81-717_mvm.Buttons.Stopkran.EmergencyBrakeValveToggle = @[Common.ALL.EmergencyBrakeValve]
Entities.gmod_subway_81-717_mvm.Buttons.UAVAPanel.UAVAToggle = @[Common.ALL.UAVA]
Entities.gmod_subway_81-717_mvm.Buttons.UAVAPanel.UAVACToggle = @[Common.ALL.UAVAContact]
Entities.gmod_subway_81-717_mvm.Buttons.FrontPneumatic.FrontBrakeLineIsolationToggle = @[Common.ALL.FrontBrakeLineIsolationToggle]
Entities.gmod_subway_81-717_mvm.Buttons.FrontPneumatic.FrontTrainLineIsolationToggle = @[Common.ALL.FrontTrainLineIsolationToggle]
Entities.gmod_subway_81-717_mvm.Buttons.RearPneumatic.RearTrainLineIsolationToggle = @[Common.ALL.RearTrainLineIsolationToggle]
Entities.gmod_subway_81-717_mvm.Buttons.RearPneumatic.RearBrakeLineIsolationToggle = @[Common.ALL.RearBrakeLineIsolationToggle]
Entities.gmod_subway_81-717_mvm.Buttons.GV.GVToggle = @[Common.ALL.GV]
Entities.gmod_subway_81-717_mvm.Buttons.AirDistributor.AirDistributorDisconnectToggle = @[Common.ALL.AirDistributor]
Entities.gmod_subway_81-717_mvm.Buttons.PassengerDoor.PassengerDoor = @[Common.ALL.PassDoor]
Entities.gmod_subway_81-717_mvm.Buttons.PassengerDoor1.PassengerDoor = @[Common.ALL.PassDoor]
Entities.gmod_subway_81-717_mvm.Buttons.RearDoor.RearDoor = @[Common.ALL.RearDoor]
Entities.gmod_subway_81-717_mvm.Buttons.CabinDoor.CabinDoor = @[Common.ALL.CabinDoor]
Entities.gmod_subway_81-717_mvm.Buttons.OtsekDoor1.OtsekDoor1 = @[Common.ALL.OtsekDoor1]
Entities.gmod_subway_81-717_mvm.Buttons.OtsekDoor2.OtsekDoor2 = @[Common.ALL.OtsekDoor2]
Entities.gmod_subway_81-717_mvm.Buttons.EPKDisconnect.EPKToggle = @[Common.ALL.EPK]
Entities.gmod_subway_81-717_mvm.Buttons.EPVDisconnect.EPKToggle = @[Common.ALL.EPV]
Entities.gmod_subway_81-717_mvm.Buttons.ParkingBrake.ParkingBrakeToggle = @[Common.ALL.ParkingBrake]
#gmod_subway_81-717_lvz
#Buttons:
Entities.gmod_subway_81-717_lvz.Buttons.Battery_C.1:VBToggle = @[Common.ALL.VB]
Entities.gmod_subway_81-717_lvz.Buttons.Battery_R.2:VBToggle = @[Common.ALL.VB]
Entities.gmod_subway_81-717_lvz.Buttons.Battery_C.1:RC1Toggle = @[Common.ALL.RC1]
Entities.gmod_subway_81-717_lvz.Buttons.Battery_R.2:RC1Toggle = @[Common.ALL.RC1]
Entities.gmod_subway_81-717_lvz.Buttons.Battery_C.1:RC2Toggle = @[Common.717.RC2]
Entities.gmod_subway_81-717_lvz.Buttons.Battery_R.2:RC2Toggle = @[Common.717.RC2]
Entities.gmod_subway_81-717_lvz.Buttons.Battery_C.1:VAUToggle = @[Common.717.VAU]
Entities.gmod_subway_81-717_lvz.Buttons.Battery_R.2:VAUToggle = @[Common.717.VAU]
Entities.gmod_subway_81-717_lvz.Buttons.Battery_R.2:VRDToggle = @[Common.ARS.VRD]
Entities.gmod_subway_81-717_lvz.Buttons.VRD_C.1:VRDToggle = @[Common.ARS.VRD]
Entities.gmod_subway_81-717_lvz.Buttons.SOSD_C.1:VSOSDToggle = @[Common.ALL.VSOSD]
Entities.gmod_subway_81-717_lvz.Buttons.SOSD_R.2:VSOSDToggle = @[Common.ALL.VSOSD]
Entities.gmod_subway_81-717_lvz.Buttons.Block1.VMKToggle = @[Common.ALL.VMK]
Entities.gmod_subway_81-717_lvz.Buttons.Block1.BPSNonToggle = @[Common.717.BPSN]
Entities.gmod_subway_81-717_lvz.Buttons.Block1.ARS13Set = @[Common.717.ARS13V]
Entities.gmod_subway_81-717_lvz.Buttons.Block1.Radio13Set = @[Common.717.Radio13V]
Entities.gmod_subway_81-717_lvz.Buttons.Block1.!BatteryVoltage = @[Common.ALL.BatteryVoltage]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!Speedometer1 = @[Common.ALL.Speedometer]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!Speedometer2 = @[Common.ALL.Speedometer]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!ARSOch = @[Common.ARS.N4]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!ARS0 = @[Common.ARS.0]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!ARS40 = @[Common.ARS.40]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!ARS60 = @[Common.ARS.60]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!ARS70 = @[Common.ARS.70]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!ARS80 = @[Common.ARS.80]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!LampLSD1 = @[Common.ALL.LSD]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!LampLSD2 = @[Common.ALL.LSD]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!LampLVD = @[Common.ALL.L1w]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!LampLHRK = @[Common.ALL.L2w]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!LampLST = @[Common.ALL.L6w]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!LampLRD = @[Common.ARS.LRD]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!LampRP = @[Common.ALL.RP]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!LampLSN = @[Common.ALL.SN]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!LampLKVD = @[Common.ARS.VD]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!LampLKT = @[Common.ARS.KT]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!LampDV = @[Common.717.LampDV]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!SpeedFact1 = @[Common.ALL.SpeedCurr]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!SpeedFact2 = @[Common.ALL.SpeedCurr]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!ARSL20 = @[Common.717.ARSL20]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!ARSL40 = @[Common.717.ARSL40]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!ARSL60 = @[Common.717.ARSL60]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!ARSL70 = @[Common.717.ARSL70]
Entities.gmod_subway_81-717_lvz.Buttons.Block2.!ARSL80 = @[Common.717.ARSL80]
Entities.gmod_subway_81-717_lvz.Buttons.Block3.!BLTLPressure = @[Common.ALL.BLTLPressure]
Entities.gmod_subway_81-717_lvz.Buttons.Block3.!BCPressure = @[Common.ALL.BCPressure]
Entities.gmod_subway_81-717_lvz.Buttons.Block3.!NMPressureLow2 = @[Commom.NMnUAVA.NMPressureLow]
Entities.gmod_subway_81-717_lvz.Buttons.Block3.!UAVATriggered2 = @[Commom.NMnUAVA.UAVATriggered]
Entities.gmod_subway_81-717_lvz.Buttons.USS1.!NMPressureLow = @[Commom.NMnUAVA.NMPressureLow]
Entities.gmod_subway_81-717_lvz.Buttons.USS1.!UAVATriggered = @[Commom.NMnUAVA.UAVATriggered]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVO.!OK16 = @[Common.PUAV.K16]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVO.!OLRS = @[Common.PUAV.RS]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVO.!OKI1 = @[Common.PUAV.KI1]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVO.!OKI2 = @[Common.PUAV.KI2]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVO.!OOS = @[Common.PUAV.OS]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVO.!OAVT = @[Common.PUAV.AVT]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVO.1:KHSet = @[Common.717.KH]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVO.1:KSZDSet = @[Common.717.KSZD]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVO.1:VAVToggle = @[Common.717.VAV]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVO.1:VZPToggle = @[Common.ALL.VZP]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.!K16 = @[Common.PUAV.K16]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.!OS = @[Common.PUAV.OS]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.!AVT = @[Common.PUAV.AVT]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.!LRS = @[Common.PUAV.RS]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.!KI1 = @[Common.PUAV.KI1]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.!KI2 = @[Common.PUAV.KI2]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.!ARSOch = @[Common.ARS.N4]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.!ARS0 = @[Common.ARS.0]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.!ARS40 = @[Common.ARS.40]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.!ARS60 = @[Common.ARS.60]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.!ARS70 = @[Common.ARS.70]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.!ARS80 = @[Common.ARS.80]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.KHSet = @[Common.717.KH]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.KSZDSet = @[Common.717.KSZD]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.VAVToggle = @[Common.717.VAV]
Entities.gmod_subway_81-717_lvz.Buttons.PUAVN.VZPToggle = @[Common.ALL.VZP]
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAMPSet = @[Common.717.PAM]: @[Common.PA.P]
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAMFSet = @[Common.717.PAM]: @[Common.PA.F]
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAMUpSet = @[Common.717.PAM]: @[Common.PA.Up]
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAMMSet = @[Common.717.PAM]: @[Common.PA.M]
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAMLeftSet = @[Common.717.PAM]: @[Common.PA.Left]
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAMDownSet = @[Common.717.PAM]: @[Common.PA.Down]
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAMRightSet = @[Common.717.PAM]: @[Common.PA.Right]
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAM1Set = @[Common.717.PAM]: 1
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAM2Set = @[Common.717.PAM]: 2
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAM3Set = @[Common.717.PAM]: 3
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAM4Set = @[Common.717.PAM]: 4
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAM5Set = @[Common.717.PAM]: 5
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAM6Set = @[Common.717.PAM]: 6
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAM7Set = @[Common.717.PAM]: 7
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAM8Set = @[Common.717.PAM]: 8
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAM9Set = @[Common.717.PAM]: 9
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAMEscSet = @[Common.717.PAM]: @[Common.PA.Esc]
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAM0Set = @[Common.717.PAM]: 0
Entities.gmod_subway_81-717_lvz.Buttons.PAM1.PAMEnterSet = @[Common.717.PAM]: @[Common.PA.Enter]
Entities.gmod_subway_81-717_lvz.Buttons.PAM.2:KSZDSet = @[Common.717.KSZD]
Entities.gmod_subway_81-717_lvz.Buttons.PAM.2:VZPToggle = @[Common.ALL.VZP]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:R_VPRToggle = @[Common.ALL.VPR]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:R_GToggle = @[Common.ALL.GCab]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:R_UPOToggle = @[Common.ALL.UPO]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:KVTSet = @[Common.ARS.KVT]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:VZ1Set = @[Common.717.VZ1]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.!OhSigLamp1 = @[Common.BZOS.Engaged]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:VUD1Toggle = @[Common.717.VZD]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:KDLSet = @[Common.ALL.KDL]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:KDLKToggle = @[Common.ALL.KDLK]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:KDLRSet = @[Common.ALL.KDL]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:KDLRKToggle = @[Common.ALL.KDLK]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:DoorSelectToggle = @[Common.ALL.VSD]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:KRZDSet = @[Common.ALL.KRZD]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:VozvratRPSet = @[Common.ALL.VRPBV]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.!GreenRPLight1 = @[Common.ALL.GRP]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.!AVULight1 = @[Common.ALL.LAVU]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.!LKVPLight1 = @[Common.717.KVP]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.!SPLight1 = @[Common.717.LSP]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:ConverterProtectionSet = @[Common.717.ConverterProtection]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:KSNSet = @[Common.ALL.KSN]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:RingSet = @[Common.ALL.Ring]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:ARSToggle = @[Common.ALL.ARS]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:ALSToggle = @[Common.ALL.ALS]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:OVTToggle = @[Common.ALL.OVT]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:OtklAVUToggle = @[Common.ALL.OAVU]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:L_1Toggle = @[Common.ALL.PassLights]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:L_2Toggle = @[Common.ALL.CabLights]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:L_3Toggle = @[Common.ALL.PanelLights]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.1:OhrSigToggle = @[Common.BZOS.On]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:R_VPRToggle = @[Common.ALL.VPR]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:R_GToggle = @[Common.ALL.GCab]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:R_UPOToggle = @[Common.ALL.UPO]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:KVTSet = @[Common.ARS.KVT]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:VZ1Set = @[Common.717.VZ1]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.!OhSigLamp2 = @[Common.BZOS.Engaged]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:VUD1Toggle = @[Common.717.VZD]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:KDLSet = @[Common.ALL.KDL]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.!KDLLight2 = @[Common.ALL.KDLL]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:KDLKToggle = @[Common.ALL.KDLK]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:KDLRSet = @[Common.ALL.KDL]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.!KDLRLight2 = @[Common.ALL.KDLL]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:KDLRKToggle = @[Common.ALL.KDLK]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:DoorSelectToggle = @[Common.ALL.VSD]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:KRZDSet = @[Common.ALL.KRZD]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:VozvratRPSet = @[Common.ALL.VRPBV]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.!GreenRPLight2 = @[Common.ALL.GRP]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.!RZPLight2 = @[Common.717.RZPL]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.!LKVPLight2 = @[Common.717.KVP]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:OhrSigToggle = @[Common.BZOS.On]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:ConverterProtectionSet = @[Common.717.ConverterProtection]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:KSNSet = @[Common.ALL.KSN]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:RingSet = @[Common.ALL.Ring]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:ARSToggle = @[Common.ALL.ARS]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:ALSToggle = @[Common.ALL.ALS]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:VPAOnSet = @[Common.717.VPAOn]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:VPAOffSet = @[Common.717.VPAOff]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:OVTToggle = @[Common.ALL.OVT]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:OtklAVUToggle = @[Common.ALL.OAVU]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.!AVULight2 = @[Common.ALL.LAVU]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:L_1Toggle = @[Common.ALL.PassLights]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:L_2Toggle = @[Common.ALL.CabLights]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_kvr.2:L_3Toggle = @[Common.ALL.PanelLights]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old.!RZPLight1 = @[Common.717.RZPL]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:R_VPRToggle = @[Common.ALL.VPR]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:R_GToggle = @[Common.ALL.GCab]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:R_UPOToggle = @[Common.ALL.UPO]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:KVTSet = @[Common.ARS.KVT]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:VZ1Set = @[Common.717.VZ1]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.!SPLight3 = @[Common.717.LSP]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.!AVULight3 = @[Common.ALL.LAVU]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:VUD1Toggle = @[Common.717.VZD]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:KDLSet = @[Common.ALL.KDL]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:KDLKToggle = @[Common.ALL.KDLK]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:KDLRSet = @[Common.ALL.KDL]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:KDLRKToggle = @[Common.ALL.KDLK]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:DoorSelectToggle = @[Common.ALL.VSD]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:KRZDSet = @[Common.ALL.KRZD]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:VozvratRPSet = @[Common.ALL.VRPBV]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.!GreenRPLight3 = @[Common.ALL.GRP]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.!RZPLight3 = @[Common.717.RZPL]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.!LKVPLight3 = @[Common.717.KVP]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:OtklAVUToggle = @[Common.ALL.OAVU]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:ConverterProtectionSet = @[Common.717.ConverterProtection]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:KSNSet = @[Common.ALL.KSN]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:RingSet = @[Common.ALL.Ring]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.1:VPAOnSet = @[Common.717.VPAOn]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.1:VPAOffSet = @[Common.717.VPAOff]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:OVTToggle = @[Common.ALL.VOVT]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:L_1Toggle = @[Common.ALL.PassLights]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:L_2Toggle = @[Common.ALL.CabLights]
Entities.gmod_subway_81-717_lvz.Buttons.Block5_6_old_paksd.3:L_3Toggle = @[Common.ALL.PanelLights]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_old.1:L_4Toggle = @[Common.ALL.VF]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_old.1:VUSToggle = @[Common.ALL.VUS]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_old.1:VADToggle = @[Common.ALL.VAD]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_old.1:VAHToggle = @[Common.ALL.VAH]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_old.1:KRPSet = @[Common.ALL.KRP]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_old.1:RezMKSet = @[Common.ALL.RMK]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_old.1:KDPSet = @[Common.ALL.KDP]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_old.1:KDPKToggle = @[Common.ALL.KDPK]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_old.!1:PNT = @[Common.ALL.BrT]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_kvr.2:L_4Toggle = @[Common.ALL.VF]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_kvr.2:VUSToggle = @[Common.ALL.VUS]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_kvr.2:VADToggle = @[Common.ALL.VAD]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_kvr.2:VAHToggle = @[Common.ALL.VAH]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_kvr.2:KRPSet = @[Common.ALL.KRP]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_kvr.2:RezMKSet = @[Common.ALL.RMK]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_kvr.!KDPLight2 = @[Common.ALL.KDPL]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_kvr.2:KDPSet = @[Common.ALL.KDP]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_kvr.2:KDPKToggle = @[Common.ALL.KDPK]
Entities.gmod_subway_81-717_lvz.Buttons.Block7_kvr.!2:PNT = @[Common.ALL.BrT]
Entities.gmod_subway_81-717_lvz.Buttons.HelperPanel_C.VUD2Toggle = @[Common.ALL.VUD2]
Entities.gmod_subway_81-717_lvz.Buttons.HelperPanel_C.VDLSet = @[Common.ALL.KDL]
Entities.gmod_subway_81-717_lvz.Buttons.HelperPanel_C.VOPDSet = @[Common.ALL.KDPH]
Entities.gmod_subway_81-717_lvz.Buttons.HelperPanel_R.1:VUD2Toggle = @[Common.ALL.VUD2]
Entities.gmod_subway_81-717_lvz.Buttons.HelperPanel_R.1:VDLSet = @[Common.ALL.KDL]
Entities.gmod_subway_81-717_lvz.Buttons.HelperPanel_R.1:VOPDSet = @[Common.ALL.KDPH]
Entities.gmod_subway_81-717_lvz.Buttons.CabVent_C.PVK- = @[Common.CabVent.PVK-]
Entities.gmod_subway_81-717_lvz.Buttons.CabVent_C.PVK+ = @[Common.CabVent.PVK+]
Entities.gmod_subway_81-717_lvz.Buttons.HVMeters_N.!EnginesCurrent = @[Common.ALL.EnginesCurrent]
Entities.gmod_subway_81-717_lvz.Buttons.HVMeters_N.!HighVoltage = @[Common.ALL.HighVoltage]
Entities.gmod_subway_81-717_lvz.Buttons.HVMeters_O.!EnginesCurrent = @[Common.ALL.EnginesCurrent]
Entities.gmod_subway_81-717_lvz.Buttons.HVMeters_O.!HighVoltage = @[Common.ALL.HighVoltage]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A53Toggle = @[Common.717.A53]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A56Toggle = @[Common.717.A56]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A54Toggle = @[Common.717.A54]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A17Toggle = @[Common.717.A17]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A44Toggle = @[Common.717.A44]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A39Toggle = @[Common.717.A39]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A70Toggle = @[Common.717.A70]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A14Toggle = @[Common.717.A14]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A74Toggle = @[Common.717.A74]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A26Toggle = @[Common.717.A26]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:AR63Toggle = @[Common.717.AR63]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:AS1Toggle = @[Common.717.AS1]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A13Toggle = @[Common.717.A13]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A21Toggle = @[Common.717.A21]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A31Toggle = @[Common.717.A31]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A32Toggle = @[Common.717.A32]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A16Toggle = @[Common.717.A16]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A12Toggle = @[Common.717.A12]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A24Toggle = @[Common.717.A24]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A49Toggle = @[Common.717.A49]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A27Toggle = @[Common.717.A27]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A72Toggle = @[Common.717.A72]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A50Toggle = @[Common.717.A50]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A15Toggle = @[Common.717.A15]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:AISToggle = @[Common.717.AIS]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:AV3Toggle = @[Common.717.AV3S]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:AV1Toggle = @[Common.717.AV1]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A58Toggle = @[Common.717.A58PU]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A59Toggle = @[Common.717.A59PU]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A61Toggle = @[Common.717.A61PU]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:P:A58Toggle = @[Common.717.A58PA]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:P:A59Toggle = @[Common.717.A59PA]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:P:A61Toggle = @[Common.717.A61PA]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A29Toggle = @[Common.717.A29]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A46Toggle = @[Common.717.A46]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A47Toggle = @[Common.717.A47]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A71Toggle = @[Common.717.A71]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A7Toggle = @[Common.717.A7]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A9Toggle = @[Common.717.A9]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A84Toggle = @[Common.717.A84]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A8Toggle = @[Common.717.A8]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A52Toggle = @[Common.717.A52]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A19Toggle = @[Common.717.A19]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A48Toggle = @[Common.717.A48]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A10Toggle = @[Common.717.A10]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A22Toggle = @[Common.717.A22]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A30Toggle = @[Common.717.A30]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A1Toggle = @[Common.717.A1]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A2Toggle = @[Common.717.A2]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A3Toggle = @[Common.717.A3]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A4Toggle = @[Common.717.A4]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A5Toggle = @[Common.717.A5]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A6Toggle = @[Common.717.A6]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A18Toggle = @[Common.717.A18]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A73Toggle = @[Common.717.A73]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A20Toggle = @[Common.717.A20]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A25Toggle = @[Common.717.A25]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A11Toggle = @[Common.717.A11]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A37Toggle = @[Common.717.A37]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A45Toggle = @[Common.717.A45]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A38Toggle = @[Common.717.A38]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A51Toggle = @[Common.717.A51]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A65Toggle = @[Common.717.A65]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A06Toggle = @[Common.ALL.Unsused1]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A42Toggle = @[Common.717.A42]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A43Toggle = @[Common.717.A432]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A41Toggle = @[Common.717.A41]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A40Toggle = @[Common.717.A40]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A75Toggle = @[Common.717.A75]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A76Toggle = @[Common.717.A76]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A60Toggle = @[Common.717.A60]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A55Toggle = @[Common.717.A55]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A57Toggle = @[Common.717.A57]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A66Toggle = @[Common.717.A66]
Entities.gmod_subway_81-717_lvz.Buttons.AV_C.1:A28Toggle = @[Common.717.A28]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A11Toggle = @[Common.717.A11]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A17Toggle = @[Common.717.A17]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A44Toggle = @[Common.717.A44]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A58Toggle = @[Common.717.A58PU]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A59Toggle = @[Common.717.A59PU]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A61Toggle = @[Common.717.A61PU]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.P:A58Toggle = @[Common.717.A58PA]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.P:A59Toggle = @[Common.717.A59PA]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.P:A61Toggle = @[Common.717.A61PA]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A21Toggle = @[Common.717.A21]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A49Toggle = @[Common.717.A49]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A27Toggle = @[Common.717.A27]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A10Toggle = @[Common.717.A10]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A53Toggle = @[Common.717.A53]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A54Toggle = @[Common.717.A54]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A84Toggle = @[Common.717.A84]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A78Toggle = @[Common.717.A78]@[Common.ALL.Unsused2]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A48Toggle = @[Common.717.A48]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.ABKToggle = @[Common.717.ABK]@[Common.ALL.Unsused2]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A29Toggle = @[Common.717.A29]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A46Toggle = @[Common.717.A46]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A47Toggle = @[Common.717.A47]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A43Toggle = @[Common.717.A432]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A42Toggle = @[Common.717.A42]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A74Toggle = @[Common.717.A74]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A73Toggle = @[Common.717.A73]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A71Toggle = @[Common.717.A71]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A41Toggle = @[Common.717.A41]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A45Toggle = @[Common.717.A45]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A75Toggle = @[Common.717.A75]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A8Toggle = @[Common.717.A8]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A52Toggle = @[Common.717.A52]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A72Toggle = @[Common.717.A72]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A31Toggle = @[Common.717.A31]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A32Toggle = @[Common.717.A32]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A13Toggle = @[Common.717.A13]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A1Toggle = @[Common.717.A1]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A20Toggle = @[Common.717.A20]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A25Toggle = @[Common.717.A25]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A30Toggle = @[Common.717.A30]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A56Toggle = @[Common.717.A56]
Entities.gmod_subway_81-717_lvz.Buttons.AV_R.A65Toggle = @[Common.717.A65]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A2Toggle = @[Common.717.A2]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A3Toggle = @[Common.717.A3]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A4Toggle = @[Common.717.A4]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A5Toggle = @[Common.717.A5]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A6Toggle = @[Common.717.A6]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A70Toggle = @[Common.717.A70]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A14Toggle = @[Common.717.A14]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A39Toggle = @[Common.717.A39]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A28Toggle = @[Common.717.A28]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A38Toggle = @[Common.717.A38]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A22Toggle = @[Common.717.A22]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A12Toggle = @[Common.717.A12]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A16Toggle = @[Common.717.A16]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A37Toggle = @[Common.717.A37]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A51Toggle = @[Common.717.A51]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A24Toggle = @[Common.717.A24]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A19Toggle = @[Common.717.A19]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A18Toggle = @[Common.717.A18]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A40Toggle = @[Common.717.A40]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A15Toggle = @[Common.717.A15]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A50Toggle = @[Common.717.A50]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.AISToggle = @[Common.717.AIS]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.AV3Toggle = @[Common.717.AV3S]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.AV1Toggle = @[Common.717.AV1]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A55Toggle = @[Common.717.A55]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A57Toggle = @[Common.717.A57]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A60Toggle = @[Common.717.A60]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A7Toggle = @[Common.717.A7]
Entities.gmod_subway_81-717_lvz.Buttons.AV_S.A9Toggle = @[Common.717.A9]
Entities.gmod_subway_81-717_lvz.Buttons.Route.RouteNumber1+ = @[Common.ALL.RouteNumber1+]
Entities.gmod_subway_81-717_lvz.Buttons.Route.RouteNumber2+ = @[Common.ALL.RouteNumber2+]
Entities.gmod_subway_81-717_lvz.Buttons.Route.RouteNumber3+ = @[Common.ALL.RouteNumber3+]
Entities.gmod_subway_81-717_lvz.Buttons.Route.RouteNumber1- = @[Common.ALL.RouteNumber1-]
Entities.gmod_subway_81-717_lvz.Buttons.Route.RouteNumber2- = @[Common.ALL.RouteNumber2-]
Entities.gmod_subway_81-717_lvz.Buttons.Route.RouteNumber3- = @[Common.ALL.RouteNumber3-]
Entities.gmod_subway_81-717_lvz.Buttons.DriverValveDisconnect.DriverValveDisconnectToggle = @[Common.ALL.DriverValveDisconnect]
Entities.gmod_subway_81-717_lvz.Buttons.DriverValveBLDisconnect.DriverValveBLDisconnectToggle = @[Common.ALL.DriverValveTLDisconnect]
Entities.gmod_subway_81-717_lvz.Buttons.DriverValveTLDisconnect.DriverValveTLDisconnectToggle = @[Common.ALL.DriverValveBLDisconnect]
Entities.gmod_subway_81-717_lvz.Buttons.Stopkran.EmergencyBrakeValveToggle = @[Common.ALL.EmergencyBrakeValve]
Entities.gmod_subway_81-717_lvz.Buttons.UAVAPanel.UAVAToggle = @[Common.ALL.UAVA]
Entities.gmod_subway_81-717_lvz.Buttons.UAVAPanel.UAVACToggle = @[Common.ALL.UAVAContact]
Entities.gmod_subway_81-717_lvz.Buttons.FrontPneumatic.FrontBrakeLineIsolationToggle = @[Common.ALL.FrontBrakeLineIsolationToggle]
Entities.gmod_subway_81-717_lvz.Buttons.FrontPneumatic.FrontTrainLineIsolationToggle = @[Common.ALL.FrontTrainLineIsolationToggle]
Entities.gmod_subway_81-717_lvz.Buttons.RearPneumatic.RearTrainLineIsolationToggle = @[Common.ALL.RearTrainLineIsolationToggle]
Entities.gmod_subway_81-717_lvz.Buttons.RearPneumatic.RearBrakeLineIsolationToggle = @[Common.ALL.RearBrakeLineIsolationToggle]
Entities.gmod_subway_81-717_lvz.Buttons.GV.GVToggle = @[Common.ALL.GV]
Entities.gmod_subway_81-717_lvz.Buttons.AirDistributor.AirDistributorDisconnectToggle = @[Common.ALL.AirDistributor]
Entities.gmod_subway_81-717_lvz.Buttons.PassengerDoor.PassengerDoor = @[Common.ALL.PassDoor]
Entities.gmod_subway_81-717_lvz.Buttons.PassengerDoor1.PassengerDoor = @[Common.ALL.PassDoor]
Entities.gmod_subway_81-717_lvz.Buttons.RearDoor.RearDoor = @[Common.ALL.RearDoor]
Entities.gmod_subway_81-717_lvz.Buttons.CabinDoor.CabinDoor = @[Common.ALL.CabinDoor]
Entities.gmod_subway_81-717_lvz.Buttons.OtsekDoor1.OtsekDoor1 = @[Common.ALL.OtsekDoor1]
Entities.gmod_subway_81-717_lvz.Buttons.OtsekDoor2.OtsekDoor2 = @[Common.ALL.OtsekDoor2]
Entities.gmod_subway_81-717_lvz.Buttons.EPKDisconnect.EPKToggle = @[Common.ALL.EPK]
Entities.gmod_subway_81-717_lvz.Buttons.EPVDisconnect.EPKToggle = @[Common.ALL.EPV]
Entities.gmod_subway_81-717_lvz.Buttons.ParkingBrake.ParkingBrakeToggle = @[Common.ALL.ParkingBrake]
#gmod_subway_81-714_mvm
Entities.gmod_subway_81-714_mvm.Buttons.FrontPneumatic.FrontBrakeLineIsolationToggle = @[Common.ALL.FrontBrakeLineIsolationToggle]
Entities.gmod_subway_81-714_mvm.Buttons.FrontPneumatic.FrontTrainLineIsolationToggle = @[Common.ALL.FrontTrainLineIsolationToggle]
Entities.gmod_subway_81-714_mvm.Buttons.RearPneumatic.RearTrainLineIsolationToggle = @[Common.ALL.RearTrainLineIsolationToggle]
Entities.gmod_subway_81-714_mvm.Buttons.RearPneumatic.RearBrakeLineIsolationToggle = @[Common.ALL.RearBrakeLineIsolationToggle]
Entities.gmod_subway_81-714_mvm.Buttons.RearPneumatic.ParkingBrakeToggle = @[Common.ALL.ParkingBrake]
Entities.gmod_subway_81-714_mvm.Buttons.GV.GVToggle = @[Common.ALL.GV]
Entities.gmod_subway_81-714_mvm.Buttons.AirDistributor.AirDistributorDisconnectToggle = @[Common.ALL.AirDistributor]
Entities.gmod_subway_81-714_mvm.Buttons.RearDoor.RearDoor = @[Common.ALL.RearDoor]
Entities.gmod_subway_81-714_mvm.Buttons.FrontDoor.FrontDoor = @[Common.ALL.FrontDoor]
Entities.gmod_subway_81-714_mvm.Buttons.couch_cap_o.CouchCap = @[Common.ALL.CouchCap]
Entities.gmod_subway_81-714_mvm.Buttons.couch_cap.CouchCap = @[Common.ALL.CouchCap]
Entities.gmod_subway_81-714_mvm.Buttons.Battery.VBToggle = @[Common.ALL.VB]
Entities.gmod_subway_81-714_mvm.Buttons.AV_T.1:A70Toggle = @[Common.717.A70]
Entities.gmod_subway_81-714_mvm.Buttons.AV_T.1:AV2Toggle = @[Common.717.AV2]
Entities.gmod_subway_81-714_mvm.Buttons.AV_T.1:AV3Toggle = @[Common.717.AV3]
Entities.gmod_subway_81-714_mvm.Buttons.AV_T.1:AV4Toggle = @[Common.717.AV4]
Entities.gmod_subway_81-714_mvm.Buttons.AV_T.1:AV5Toggle = @[Common.717.AV5]
Entities.gmod_subway_81-714_mvm.Buttons.AV_T.1:A81Toggle = @[Common.717.A81]
Entities.gmod_subway_81-714_mvm.Buttons.AV_T.1:AV6Toggle = @[Common.717.AV6]
Entities.gmod_subway_81-714_mvm.Buttons.AV_T.1:A80Toggle = @[Common.717.A80]
Entities.gmod_subway_81-714_mvm.Buttons.AV_T.1:A18Toggle = @[Common.717.A18]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A53Toggle = @[Common.717.A53]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A56Toggle = @[Common.717.A56]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A54Toggle = @[Common.717.A54]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A24Toggle = @[Common.717.A24]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A39Toggle = @[Common.717.A39]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A23Toggle = @[Common.717.A23]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A14Toggle = @[Common.717.A14]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A13Toggle = @[Common.717.A13]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A31Toggle = @[Common.717.A31]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A32Toggle = @[Common.717.A32]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A16Toggle = @[Common.717.A16]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A12Toggle = @[Common.717.A12]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A49Toggle = @[Common.717.A49]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A15Toggle = @[Common.717.A15]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A27Toggle = @[Common.717.A27]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A50Toggle = @[Common.717.A50]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A8Toggle = @[Common.717.A8]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A52Toggle = @[Common.717.A52]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A19Toggle = @[Common.717.A19]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A10Toggle = @[Common.717.A10]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A22Toggle = @[Common.717.A22]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A30Toggle = @[Common.717.A30]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A1Toggle = @[Common.717.A1]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A2Toggle = @[Common.717.A2]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A3Toggle = @[Common.717.A3]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A4Toggle = @[Common.717.A4]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A5Toggle = @[Common.717.A5]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A6Toggle = @[Common.717.A6]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A72Toggle = @[Common.717.A72]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A38Toggle = @[Common.717.A38]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A20Toggle = @[Common.717.A20]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A25Toggle = @[Common.717.A25]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A37Toggle = @[Common.717.A37]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A55Toggle = @[Common.717.A55]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A45Toggle = @[Common.717.A45]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A66Toggle = @[Common.717.A66]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A51Toggle = @[Common.717.A51]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A65Toggle = @[Common.717.A65]
Entities.gmod_subway_81-714_mvm.Buttons.AV_S.1:A28Toggle = @[Common.717.A28]
Entities.gmod_subway_81-714_mvm.Buttons.VU.A84Toggle = @[Common.ALL.VU]
Entities.gmod_subway_81-714_mvm.Buttons.Shunt.BPSNonToggle = @[Common.717.BPSN]
Entities.gmod_subway_81-714_mvm.Buttons.Shunt.!RZPLight = @[Common.717.RZPL]
Entities.gmod_subway_81-714_mvm.Buttons.Shunt.ConverterProtectionSet = @[Common.717.ConverterProtection]
Entities.gmod_subway_81-714_mvm.Buttons.Shunt.L_1Toggle = @[Common.ALL.PassLights]
Entities.gmod_subway_81-714_mvm.Buttons.Shunt.OtklBVSet = @[Common.717.OtklBV]
Entities.gmod_subway_81-714_mvm.Buttons.Shunt.StartSet = @[Common.714.Start]
Entities.gmod_subway_81-714_mvm.Buttons.Shunt.VozvratRPSet = @[Common.ALL.VRPBV]
Entities.gmod_subway_81-714_mvm.Buttons.Shunt.RV- = @[Common.714.RV] @[Common.ALL.CCW]
Entities.gmod_subway_81-714_mvm.Buttons.Shunt.RV+ = @[Common.714.RV] @[Common.ALL.CW]
Entities.gmod_subway_81-714_mvm.Buttons.DriverValveBLTLDisconnect.DriverValveBLDisconnectToggle = @[Common.ALL.DriverValveBLDisconnect]
Entities.gmod_subway_81-714_mvm.Buttons.DriverValveBLTLDisconnect.DriverValveTLDisconnectToggle = @[Common.ALL.DriverValveTLDisconnect]
Entities.gmod_subway_81-714_mvm.Buttons.Stopkran.EmergencyBrakeValveToggle = @[Common.ALL.EmergencyBrakeValve]
Entities.gmod_subway_81-714_mvm.Buttons.Voltages.!BatteryVoltage = @[Common.ALL.BatteryVoltage] #NEW
Entities.gmod_subway_81-714_mvm.Buttons.Voltages.!BatteryCurrent = @[Common.ALL.BatteryCurrent] #NEW
Entities.gmod_subway_81-714_mvm.Buttons.Pressures.!BCPressure = @[Common.ALL.BLTLPressure] #NEW
Entities.gmod_subway_81-714_mvm.Buttons.Pressures.!BLTLPressure = @[Common.ALL.BCPressure] #NEW
#gmod_subway_81-714_lvz
Entities.gmod_subway_81-714_lvz.Buttons.FrontPneumatic.FrontBrakeLineIsolationToggle = @[Common.ALL.FrontBrakeLineIsolationToggle]
Entities.gmod_subway_81-714_lvz.Buttons.FrontPneumatic.FrontTrainLineIsolationToggle = @[Common.ALL.FrontTrainLineIsolationToggle]
Entities.gmod_subway_81-714_lvz.Buttons.RearPneumatic.RearTrainLineIsolationToggle = @[Common.ALL.RearTrainLineIsolationToggle]
Entities.gmod_subway_81-714_lvz.Buttons.RearPneumatic.RearBrakeLineIsolationToggle = @[Common.ALL.RearBrakeLineIsolationToggle]
Entities.gmod_subway_81-714_lvz.Buttons.RearPneumatic.ParkingBrakeToggle = @[Common.ALL.ParkingBrake]
Entities.gmod_subway_81-714_lvz.Buttons.GV.GVToggle = @[Common.ALL.GV]
Entities.gmod_subway_81-714_lvz.Buttons.AirDistributor.AirDistributorDisconnectToggle = @[Common.ALL.AirDistributor]
Entities.gmod_subway_81-714_lvz.Buttons.RearDoor.RearDoor = @[Common.ALL.RearDoor]
Entities.gmod_subway_81-714_lvz.Buttons.FrontDoor.FrontDoor = @[Common.ALL.FrontDoor]
Entities.gmod_subway_81-714_lvz.Buttons.couch_cap_o.CouchCap = @[Common.ALL.CouchCap]
Entities.gmod_subway_81-714_lvz.Buttons.couch_cap.CouchCap = @[Common.ALL.CouchCap]
Entities.gmod_subway_81-714_lvz.Buttons.Battery.VBToggle = @[Common.ALL.VB]
Entities.gmod_subway_81-714_lvz.Buttons.AV_T.1:A70Toggle = @[Common.717.A70]
Entities.gmod_subway_81-714_lvz.Buttons.AV_T.1:A81Toggle = @[Common.717.A81]
Entities.gmod_subway_81-714_lvz.Buttons.AV_T.1:A80Toggle = @[Common.717.A80]
Entities.gmod_subway_81-714_lvz.Buttons.AV_T.1:A18Toggle = @[Common.717.A18]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A53Toggle = @[Common.717.A53]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A56Toggle = @[Common.717.A56]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A54Toggle = @[Common.717.A54]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A24Toggle = @[Common.717.A24]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A39Toggle = @[Common.717.A39]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A23Toggle = @[Common.717.A23]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A14Toggle = @[Common.717.A14]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A13Toggle = @[Common.717.A13]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A31Toggle = @[Common.717.A31]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A32Toggle = @[Common.717.A32]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A16Toggle = @[Common.717.A16]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A12Toggle = @[Common.717.A12]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A49Toggle = @[Common.717.A49]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A15Toggle = @[Common.717.A15]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A27Toggle = @[Common.717.A27]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A50Toggle = @[Common.717.A50]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A8Toggle = @[Common.717.A8]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A52Toggle = @[Common.717.A52]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A19Toggle = @[Common.717.A19]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A10Toggle = @[Common.717.A10]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A22Toggle = @[Common.717.A22]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A30Toggle = @[Common.717.A30]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A1Toggle = @[Common.717.A1]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A2Toggle = @[Common.717.A2]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A3Toggle = @[Common.717.A3]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A4Toggle = @[Common.717.A4]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A5Toggle = @[Common.717.A5]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A6Toggle = @[Common.717.A6]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A72Toggle = @[Common.717.A72]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A38Toggle = @[Common.717.A38]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A20Toggle = @[Common.717.A20]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A25Toggle = @[Common.717.A25]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A37Toggle = @[Common.717.A37]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A55Toggle = @[Common.717.A55]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A45Toggle = @[Common.717.A45]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A66Toggle = @[Common.717.A66]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A51Toggle = @[Common.717.A51]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A65Toggle = @[Common.717.A65]
Entities.gmod_subway_81-714_lvz.Buttons.AV_S.1:A28Toggle = @[Common.717.A28]
Entities.gmod_subway_81-714_lvz.Buttons.VU.A84Toggle = @[Common.ALL.VU]
Entities.gmod_subway_81-714_lvz.Buttons.Shunt.BPSNonToggle = @[Common.717.BPSN]
Entities.gmod_subway_81-714_lvz.Buttons.Shunt.!RZPLight = @[Common.717.RZPL]
Entities.gmod_subway_81-714_lvz.Buttons.Shunt.ConverterProtectionSet = @[Common.717.ConverterProtection]
Entities.gmod_subway_81-714_lvz.Buttons.Shunt.L_1Toggle = @[Common.ALL.PassLights]
Entities.gmod_subway_81-714_lvz.Buttons.Shunt.StartSet = @[Common.714.Start]
Entities.gmod_subway_81-714_lvz.Buttons.Shunt.VozvratRPSet = @[Common.ALL.VRPBV]
Entities.gmod_subway_81-714_lvz.Buttons.Shunt.RV- = @[Common.714.RV] @[Common.ALL.CCW]
Entities.gmod_subway_81-714_lvz.Buttons.Shunt.RV+ = @[Common.714.RV] @[Common.ALL.CW]
Entities.gmod_subway_81-714_lvz.Buttons.DriverValveBLTLDisconnect.DriverValveBLDisconnectToggle = @[Common.ALL.DriverValveBLDisconnect]
Entities.gmod_subway_81-714_lvz.Buttons.DriverValveBLTLDisconnect.DriverValveTLDisconnectToggle = @[Common.ALL.DriverValveTLDisconnect]
Entities.gmod_subway_81-714_lvz.Buttons.Stopkran.EmergencyBrakeValveToggle = @[Common.ALL.EmergencyBrakeValve]
Entities.gmod_subway_81-714_lvz.Buttons.Voltages.!BatteryVoltage = @[Common.ALL.BatteryVoltage] #NEW
Entities.gmod_subway_81-714_lvz.Buttons.Voltages.!BatteryCurrent = @[Common.ALL.BatteryCurrent] #NEW
Entities.gmod_subway_81-714_lvz.Buttons.Pressures.!BCPressure = @[Common.ALL.BLTLPressure] #NEW
Entities.gmod_subway_81-714_lvz.Buttons.Pressures.!BLTLPressure = @[Common.ALL.BCPressure] #NEW
#Spawner:
Entities.gmod_subway_81-717_mvm.Spawner.Announcer.Name = @[Common.Spawner.Announcer]
Entities.gmod_subway_81-717_mvm.Spawner.Scheme.Name = @[Common.Spawner.Scheme]
Entities.gmod_subway_81-717_mvm.Spawner.SpawnMode.Name = @[Common.Spawner.SpawnMode]
Entities.gmod_subway_81-717_mvm.Spawner.SpawnMode.1 = @[Common.Spawner.SpawnMode.Full]
Entities.gmod_subway_81-717_mvm.Spawner.SpawnMode.2 = @[Common.Spawner.SpawnMode.Deadlock]
Entities.gmod_subway_81-717_mvm.Spawner.SpawnMode.3 = @[Common.Spawner.SpawnMode.NightDeadlock]
Entities.gmod_subway_81-717_mvm.Spawner.SpawnMode.4 = @[Common.Spawner.SpawnMode.Depot]
Entities.gmod_subway_81-717_mvm_custom.Spawner.Type.Name = @[Spawner.717.Type]
Entities.gmod_subway_81-717_mvm_custom.Spawner.BodyType.Name = @[Spawner.717.BodyType]
Entities.gmod_subway_81-717_mvm_custom.Spawner.BodyType.1 = @[Spawner.717.MVM]
Entities.gmod_subway_81-717_mvm_custom.Spawner.BodyType.2 = @[Spawner.717.LVZ]
Entities.gmod_subway_81-717_mvm_custom.Spawner.Scheme.Name = @[Common.Spawner.Scheme]
Entities.gmod_subway_81-717_mvm_custom.Spawner.MaskType.Name = @[Spawner.717.MaskType]
Entities.gmod_subway_81-717_mvm_custom.Spawner.Cran.Name = @[Spawner.717.CranType]
Entities.gmod_subway_81-717_mvm_custom.Spawner.Announcer.Name = @[Common.Spawner.Announcer]
Entities.gmod_subway_81-717_mvm_custom.Spawner.LampType.Name = @[Spawner.717.LampType]
Entities.gmod_subway_81-717_mvm_custom.Spawner.LampType.1 = @[Common.Spawner.Random]
Entities.gmod_subway_81-717_mvm_custom.Spawner.LampType.2 = @[Spawner.717.Lamp1]
Entities.gmod_subway_81-717_mvm_custom.Spawner.LampType.3 = @[Spawner.717.Lamp2]
Entities.gmod_subway_81-717_mvm_custom.Spawner.SeatType.Name = @[Spawner.717.SeatType]
Entities.gmod_subway_81-717_mvm_custom.Spawner.SeatType.1 = @[Common.Spawner.Random]
Entities.gmod_subway_81-717_mvm_custom.Spawner.SeatType.2 = @[Common.Spawner.Old]
Entities.gmod_subway_81-717_mvm_custom.Spawner.SeatType.3 = @[Common.Spawner.New]
Entities.gmod_subway_81-717_mvm_custom.Spawner.ARSType.Name = @[Spawner.717.ARS]
Entities.gmod_subway_81-717_mvm_custom.Spawner.ARSType.1 = @[Common.Spawner.Random]
Entities.gmod_subway_81-717_mvm_custom.Spawner.ARSType.2 = @[Common.Spawner.Type] 1
Entities.gmod_subway_81-717_mvm_custom.Spawner.ARSType.3 = @[Common.Spawner.Type] 2
Entities.gmod_subway_81-717_mvm_custom.Spawner.ARSType.4 = @[Common.Spawner.Type] 3
Entities.gmod_subway_81-717_mvm_custom.Spawner.ARSType.5 = @[Common.Spawner.Type] 4
Entities.gmod_subway_81-717_mvm_custom.Spawner.ARSType.6 = @[Common.Spawner.Type] 5
Entities.gmod_subway_81-717_mvm_custom.Spawner.Texture.Name = @[Common.Spawner.Texture]
Entities.gmod_subway_81-717_mvm_custom.Spawner.PassTexture.Name = @[Common.Spawner.PassTexture]
Entities.gmod_subway_81-717_mvm_custom.Spawner.CabTexture.Name = @[Common.Spawner.CabTexture]
Entities.gmod_subway_81-717_mvm_custom.Spawner.RingType.Name = @[Spawner.717.RingType]
Entities.gmod_subway_81-717_mvm_custom.Spawner.RingType.1 = @[Common.Spawner.Random]
Entities.gmod_subway_81-717_mvm_custom.Spawner.RingType.2 = @[Common.Spawner.Type] 1
Entities.gmod_subway_81-717_mvm_custom.Spawner.RingType.3 = @[Common.Spawner.Type] 2
Entities.gmod_subway_81-717_mvm_custom.Spawner.RingType.4 = @[Common.Spawner.Type] 3
Entities.gmod_subway_81-717_mvm_custom.Spawner.RingType.5 = @[Common.Spawner.Type] 4
Entities.gmod_subway_81-717_mvm_custom.Spawner.RingType.6 = @[Common.Spawner.Type] 5
Entities.gmod_subway_81-717_mvm_custom.Spawner.RingType.7 = @[Common.Spawner.Type] 6
Entities.gmod_subway_81-717_mvm_custom.Spawner.RingType.8 = @[Common.Spawner.Type] 7
Entities.gmod_subway_81-717_mvm_custom.Spawner.RingType.9 = @[Common.Spawner.Type] 8
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.Name = @[Spawner.717.BPSNType]
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.1 = @[Common.Spawner.Random]
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.2 = @[Common.Spawner.Type] 1
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.3 = @[Common.Spawner.Type] 2
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.4 = @[Common.Spawner.Type] 3
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.5 = @[Common.Spawner.Type] 4
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.6 = @[Common.Spawner.Type] 5
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.7 = @[Common.Spawner.Type] 6
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.8 = @[Common.Spawner.Type] 7
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.9 = @[Common.Spawner.Type] 8
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.10 = @[Common.Spawner.Type] 9
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.11 = @[Common.Spawner.Type] 10
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.12 = @[Common.Spawner.Type] 11
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.13 = @[Common.Spawner.Type] 12
Entities.gmod_subway_81-717_mvm_custom.Spawner.BPSNType.14 = @[Common.Spawner.Type] 13
Entities.gmod_subway_81-717_mvm_custom.Spawner.SpawnMode.Name = @[Common.Spawner.SpawnMode]
Entities.gmod_subway_81-717_mvm_custom.Spawner.SpawnMode.1 = @[Common.Spawner.SpawnMode.Full]
Entities.gmod_subway_81-717_mvm_custom.Spawner.SpawnMode.2 = @[Common.Spawner.SpawnMode.Deadlock]
Entities.gmod_subway_81-717_mvm_custom.Spawner.SpawnMode.3 = @[Common.Spawner.SpawnMode.NightDeadlock]
Entities.gmod_subway_81-717_mvm_custom.Spawner.SpawnMode.4 = @[Common.Spawner.SpawnMode.Depot]
#Spawner:
Entities.gmod_subway_81-717_lvz.Spawner.Texture.Name = @[Common.Spawner.Texture]
Entities.gmod_subway_81-717_lvz.Spawner.PassTexture.Name = @[Common.Spawner.PassTexture]
Entities.gmod_subway_81-717_lvz.Spawner.CabTexture.Name = @[Common.Spawner.CabTexture]
Entities.gmod_subway_81-717_lvz.Spawner.Scheme.Name = @[Common.Spawner.Scheme]
Entities.gmod_subway_81-717_lvz.Spawner.Type.Name = @[Spawner.Common.EType]
Entities.gmod_subway_81-717_lvz.Spawner.Type.1 = @[Spawner.717.Line2]
Entities.gmod_subway_81-717_lvz.Spawner.Type.2 = @[Spawner.717.Line4]
Entities.gmod_subway_81-717_lvz.Spawner.Type.3 = @[Spawner.717.Line5]
Entities.gmod_subway_81-717_lvz.Spawner.SpawnMode.Name = @[Common.Spawner.SpawnMode]
Entities.gmod_subway_81-717_lvz.Spawner.SpawnMode.1 = @[Common.Spawner.SpawnMode.Full]
Entities.gmod_subway_81-717_lvz.Spawner.SpawnMode.2 = @[Common.Spawner.SpawnMode.Deadlock]
Entities.gmod_subway_81-717_lvz.Spawner.SpawnMode.3 = @[Common.Spawner.SpawnMode.NightDeadlock]
Entities.gmod_subway_81-717_lvz.Spawner.SpawnMode.4 = @[Common.Spawner.SpawnMode.Depot]
]]
|
nadmin:RegisterPerm({
title = "Manage Server Settings"
})
if CLIENT then
nadmin.serverConfig = nadmin.serverConfig or {}
nadmin.serverConfig.options = nadmin.serverConfig.options or {}
function nadmin.serverConfig:RegisterOption(cfg)
end
local content
nadmin.menu:RegisterTab({
title = "Server Settings",
sort = 2,
content = function(parent, data)
local tc = nadmin:TextColor(nadmin.colors.gui.theme)
local function loadingAnim(w, h)
draw.Circle(w/2, h/2, 16, 360, 360, 0, nadmin:DarkenColor(nadmin.colors.gui.theme, 25))
draw.Circle(w/2, h/2, 16, 360, 270, (SysTime() % 360) * 180, tc)
draw.Circle(w/2, h/2, 14, 360, 360, 0, nadmin:DarkenColor(nadmin.colors.gui.theme, 0))
end
local leftPanel = nadmin.vgui:DPanel(nil, {parent:GetWide()/6, parent:GetTall()}, parent)
leftPanel:Dock(LEFT)
leftPanel:DockPadding(0, 4, 4, 4)
leftPanel.btns = {}
content = nadmin.vgui:DPanel(nil, {parent:GetWide() - parent:GetWide()/6, parent:GetTall()}, parent)
content:Dock(FILL)
content:SetColor(nadmin:DarkenColor(nadmin.colors.gui.theme, 25))
function content:Paint(w, h)
draw.Text({
text = "Please select an option on the left.",
pos = {w/2, h/2},
xalign = TEXT_ALIGN_CENTER,
yalign = TEXT_ALIGN_CENTER,
font = "nadmin_derma",
color = tc
})
end
local categories = {
{"Sandbox", "icon16/box.png", function()
local function togglecvar(opt, val)
if isbool(val) then val = nadmin:BoolToInt(val) end
net.Start("nadmin_upd_sandbox")
net.WriteString(opt)
net.WriteInt(val, 32)
net.SendToServer()
end
content.noclip = nadmin.vgui:DCheckBox({4, 4}, {content:GetWide()/5 - 8, 32}, content)
content.noclip:SetText("Allow noclip")
content.noclip:SetTooltip("sbox_noclip")
function content.noclip:OnChecked(val)
togglecvar("sbox_noclip", val)
end
content.god = nadmin.vgui:DCheckBox({4, 40}, {content:GetWide()/5 - 8, 32}, content)
content.god:SetText("All players have god")
content.god:SetTooltip("sbox_godmode")
function content.god:OnChecked(val)
togglecvar("sbox_godmode", val)
end
content.pvp = nadmin.vgui:DCheckBox({4, 76}, {content:GetWide()/5 - 8, 32}, content)
content.pvp:SetText("PVP damage")
content.pvp:SetTooltip("sbox_playershurtplayers")
function content.pvp:OnChecked(val)
togglecvar("sbox_playershurtplayers", val)
end
content.notice = nadmin.vgui:AdvancedDLabel({4, 112}, "Notice: These are just for convenience, and will not save if the server restarts or crashes.", content)
content.notice:SetWide(content:GetWide()/5 - 8)
content.limits = nadmin.vgui:DPanel({content:GetWide()/5, 4}, {content:GetWide() * (4/5), content:GetTall() - 4}, content)
function content.limits:Paint(w, h) end -- I want this to be transparent, this is just a parent for docking the children
-- sbox_maxprops 500
-- sbox_maxragdolls 50
-- sbox_maxnpcs 50
-- sbox_maxballoons 50
-- sbox_maxeffects 50
-- sbox_maxdynamite 50
-- sbox_maxlamps 50
-- sbox_maxthrusters 50
-- sbox_maxwheels 50
-- sbox_maxhoverballs 50
-- sbox_maxvehicles 50
-- sbox_maxbuttons 50
-- sbox_maxsents 50
-- sbox_maxemitters 50
content.props = nadmin.vgui:DSlider(nil, {content.limits:GetWide(), 24}, content.limits)
content.props:Dock(TOP)
content.props:DockMargin(0, 4, 12, 0)
content.props:SetText("sbox_maxprops")
content.props:SetColor(content:GetColor())
content.props:SetClampValue(0, 100)
content.lock = nadmin.vgui:DPanel(nil, {content:GetWide(), content:GetTall()}, content)
function content.lock:Paint(w, h)
local tc = nadmin:TextColor(self:GetColor())
draw.RoundedBox(0, 0, 0, w, h, Color(0, 0, 0, 150))
draw.Circle(w/2, h/2, 16, 360, 360, 0, Color(0, 0, 0, 100))
draw.Circle(w/2, h/2, 16, 360, 270, (SysTime() % 360) * 180, tc)
draw.Circle(w/2, h/2, 14, 360, 360, 0, nadmin:DarkenColor(self:GetColor(), 25))
draw.Circle(w/2, h/2, 14, 360, 360, 0, Color(0, 0, 0, 150))
end
net.Start("nadmin_request_sandbox")
net.SendToServer()
end},
{"Adverts", "icon16/newspaper.png", function()
-- function content:Paint(w, h)
-- loadingAnim(w, h)
-- end
content.adverts = nadmin.vgui:DPanel(nil, {content:GetWide()*0.7, content:GetTall()}, content)
content.adverts:Dock(LEFT)
content.adverts:DockMargin(2, 2, 0, 2)
local adv = content.adverts -- Ease of typing
adv.title = nadmin.vgui:DPanel(nil, {adv:GetWide(), 24}, adv)
adv.title:Dock(TOP)
adv.title.normalPaint = adv.title.Paint
function adv.title:Paint(w, h)
self:normalPaint(w, h)
draw.Text({
text = "Adverts",
pos = {w/2, h/2-2},
xalign = TEXT_ALIGN_CENTER,
yalign = TEXT_ALIGN_CENTER,
font = "nadmin_derma",
color = nadmin:TextColor(self:GetColor())
})
draw.RoundedBox(0, 0, h-2, w, 2, nadmin:DarkenColor(self:GetColor(), 25))
end
adv.advs = nadmin.vgui:DScrollPanel(nil, {adv:GetWide(), adv:GetTall()-adv.title:GetTall()}, adv)
adv.advs:Dock(FILL)
function adv.advs:Paint(w, h)
loadingAnim(w, h)
end
content.settings = nadmin.vgui:DPanel(nil, {content:GetWide()*0.3, content:GetTall()}, content)
content.settings:Dock(FILL)
content.settings:DockMargin(2, 2, 2, 2)
local cfg = content.settings -- Ease of typing
cfg.title = nadmin.vgui:DPanel(nil, {cfg:GetWide(), 24}, cfg)
cfg.title:Dock(TOP)
cfg.title.normalPaint = cfg.title.Paint
function cfg.title:Paint(w, h)
self:normalPaint(w, h)
draw.Text({
text = "Options",
pos = {w/2, h/2-2},
xalign = TEXT_ALIGN_CENTER,
yalign = TEXT_ALIGN_CENTER,
font = "nadmin_derma",
color = nadmin:TextColor(self:GetColor())
})
draw.RoundedBox(0, 0, h-2, w, 2, nadmin:DarkenColor(self:GetColor(), 25))
end
cfg.message = nadmin.vgui:DTextEntry(nil, {cfg:GetWide()-8, 24}, cfg)
cfg.message:Dock(TOP)
cfg.message:DockMargin(4, 4, 4, 0)
cfg.message:SetPlaceholderText("Advert Message...")
cfg.repText = nadmin.vgui:DLabel(nil, "Repeat every (minutes):", cfg)
cfg.repText:SetTall(24)
cfg.repText:Dock(TOP)
cfg.repText:DockMargin(4, 4, 4, 0)
cfg.rep = nadmin.vgui:DSlider(nil, {cfg:GetWide()-8, 24}, cfg)
cfg.rep:Dock(TOP)
cfg.rep:DockMargin(4, 4, 4, 0)
cfg.rep:SetText("")
cfg.rep:SetClampValue(1, 15)
cfg.col = nadmin.vgui:DColorMixer(nil, {cfg:GetWide()-8, 120}, cfg)
cfg.col:Dock(TOP)
cfg.col:DockMargin(4, 4, 4, 0)
cfg.col:SetColor(Color(255, 255, 255))
cfg.manage = nadmin.vgui:DPanel(nil, {cfg:GetWide()-8, 28}, cfg)
cfg.manage:Dock(BOTTOM)
cfg.manage:DockMargin(4, 0, 4, 4)
cfg.save = nadmin.vgui:DButton(nil, {cfg.manage:GetWide()/2-2, cfg.manage:GetTall()}, cfg.manage)
cfg.save:Dock(LEFT)
cfg.save:DockMargin(0, 0, 4, 0)
cfg.save:SetText("Update")
cfg.save:SetIcon("icon16/disk.png")
cfg.del = nadmin.vgui:DButton(nil, {cfg.manage:GetWide()/2-2, cfg.manage:GetTall()}, cfg.manage)
cfg.del:Dock(FILL)
cfg.del:SetText("Delete")
cfg.del:SetIcon("icon16/bin_closed.png")
cfg.del:SetColor(nadmin.colors.gui.red)
cfg.new = nadmin.vgui:DButton(nil, {cfg:GetWide()-2, cfg.manage:GetTall()}, cfg)
cfg.new:Dock(BOTTOM)
cfg.new:DockMargin(4, 0, 4, 4)
cfg.new:SetText("New")
cfg.new:SetIcon("icon16/add.png")
cfg.new:SetMouseInputEnabled(false)
cfg.manage:SetTall(0)
cfg.manage:DockMargin(0, 0, 0, 0)
local function checkError()
if string.Trim(cfg.message:GetText()) == "" then
cfg.new:SetMouseInputEnabled(false)
elseif cfg.rep:GetValue() <= 0 then
cfg.new:SetMouseInputEnabled(false)
else
cfg.new:SetMouseInputEnabled(true)
end
end
function cfg.message:OnTextChanged()
checkError()
end
function cfg.rep:OnValueChanged(val)
checkError()
end
function cfg.new:DoClick()
checkError()
if self:IsMouseInputEnabled() then
local col = cfg.col:GetColor()
net.Start("nadmin_add_advert")
net.WriteString(string.Trim(cfg.message:GetText()))
net.WriteInt(cfg.rep:GetValue(), 32)
net.WriteTable({col.r, col.g, col.b})
net.WriteInt(0, 32)
net.SendToServer()
end
end
function cfg.save:DoClick()
local col = cfg.col:GetColor()
local ind = cfg.index
if not isnumber(ind) then ind = 0 end
net.Start("nadmin_add_advert")
net.WriteString(string.Trim(cfg.message:GetText()))
net.WriteInt(cfg.rep:GetValue(), 32)
net.WriteTable({col.r, col.g, col.b})
net.WriteInt(ind, 32)
net.SendToServer()
end
function cfg.del:DoClick()
local ind = cfg.index
if not isnumber(ind) then ind = 0 end
net.Start("nadmin_add_advert")
net.WriteString("")
net.WriteInt(0, 32)
net.WriteTable({0, 0, 0})
net.WriteInt(ind, 32)
net.SendToServer()
end
net.Start("nadmin_req_adverts")
net.SendToServer()
end},
{"Ban Message", "icon16/page_white_text.png"},
{"Command Echoes", "icon16/comment.png", function()
local sendEcho = nadmin.vgui:DCheckBox(nil, {content:GetWide() - 8, 32}, content)
sendEcho:Dock(TOP)
sendEcho:DockMargin(4, 4, 4, 4)
sendEcho:SetText("Send Command Echos")
sendEcho:SetToolTip("When a player runs a command, should the command be echoed?")
local div = nadmin.vgui:DPanel(nil, {content:GetWide() - 8, 2}, content)
div:Dock(TOP)
div:DockMargin(4, 4, 4, 4)
local hideCaller = nadmin.vgui:DCheckBox(nil, {content:GetWide() - 8, 32}, content)
hideCaller:Dock(TOP)
hideCaller:DockMargin(4, 4, 4, 0)
hideCaller:SetText("Hide Command Caller")
hideCaller:SetToolTip("When a player runs a command, should their name be hidden?")
local hideTarget = nadmin.vgui:DCheckBox(nil, {content:GetWide() - 8, 32}, content)
hideTarget:Dock(TOP)
hideTarget:DockMargin(4, 4, 4, 0)
hideTarget:SetText("Hide Command Target")
hideTarget:SetToolTip("When a player runs a command, should their target's name be hidden?")
end},
{"Logs", "icon16/database.png"},
{"MOTD", "icon16/layout.png", function()
content.enabled = nadmin.vgui:DCheckBox(nil, {content:GetWide()-8, 28}, content)
content.enabled:Dock(TOP)
content.enabled:DockMargin(4, 4, 4, 0)
content.enabled:SetText("MOTD Enabled")
content.enabled:SetColor(nadmin.colors.gui.theme)
content.preview = nadmin.vgui:DButton(nil, {content:GetWide()-8, 28}, content)
content.preview:Dock(TOP)
content.preview:DockMargin(4, 4, 4, 0)
content.preview:SetIcon("icon16/application.png")
content.preview:SetText("Preview MOTD")
content.preview:SetColor(nadmin.colors.gui.theme)
content.save = nadmin.vgui:DButton(nil, {content:GetWide()-8, 28}, content)
content.save:Dock(TOP)
content.save:DockMargin(4, 4, 4, 0)
content.save:SetIcon("icon16/disk.png")
content.save:SetText("Save MOTD")
content.mode = nadmin.vgui:DComboBox(nil, {content:GetWide()-8, 28}, content)
content.mode:Dock(TOP)
content.mode:DockMargin(4, 4, 4, 0)
content.mode:SetColor(nadmin.colors.gui.theme)
content.mode:SetValue("MOTD Mode...")
content.mode:AddChoice("Generator", nil, false, "icon16/layout.png")
content.mode:AddChoice("Local File", nil, false, "icon16/tag.png")
content.mode:AddChoice("URL", nil, false, "icon16/link.png")
content.gen = nadmin.vgui:DScrollPanel(nil, nil, content)
content.gen:Dock(FILL)
content.gen:DockMargin(4, 4, 4, 4)
content.gen:SetVisible(false)
content.fileError = nadmin.vgui:DLabel(nil, "Problem loading local file:\n-> 404 - File doesn't exist: \"garrysmod/addons/nadmin/motd.txt\"\n-> 413 - File length exceeds 65523 characters, maximum string length that can be sent to a client.", content)
content.fileError:Dock(TOP)
content.fileError:DockMargin(4, 4, 4, 0)
content.fileError:SetTextColor(nadmin.colors.gui.red)
content.fileError:SizeToContentsY()
content.fileError:SetVisible(false)
content.url = nadmin.vgui:DTextEntry(nil, {content:GetWide()-8, 28}, content)
content.url:Dock(TOP)
content.url:DockMargin(4, 4, 4, 0)
content.url:SetColor(nadmin.colors.gui.theme)
content.url:SetPlaceholderText("URL to load...")
content.url:SetVisible(false)
content.lock = nadmin.vgui:DPanel(nil, {content:GetWide(), content:GetTall()}, content)
function content.lock:Paint(w, h)
local tc = nadmin:TextColor(self:GetColor())
draw.RoundedBox(0, 0, 0, w, h, Color(0, 0, 0, 150))
draw.Circle(w/2, h/2, 16, 360, 360, 0, Color(0, 0, 0, 100))
draw.Circle(w/2, h/2, 16, 360, 270, (SysTime() % 360) * 180, tc)
draw.Circle(w/2, h/2, 14, 360, 360, 0, nadmin:DarkenColor(self:GetColor(), 25))
draw.Circle(w/2, h/2, 14, 360, 360, 0, Color(0, 0, 0, 150))
end
function content.mode:OnSelect(ind, val, data)
if val == "Generator" then
content.lock:SetVisible(true)
content.gen:SetVisible(false)
content.fileError:SetVisible(false)
content.url:SetVisible(false)
net.Start("nadmin_fetch_motd_cfg")
net.WriteString(val)
net.SendToServer()
elseif val == "Local File" then
content.lock:SetVisible(true)
content.gen:SetVisible(false)
content.fileError:SetVisible(false)
content.url:SetVisible(false)
net.Start("nadmin_fetch_motd_cfg")
net.WriteString(val)
net.SendToServer()
elseif val == "URL" then
content.lock:SetVisible(true)
content.gen:SetVisible(false)
content.fileError:SetVisible(false)
content.url:SetVisible(false)
net.Start("nadmin_fetch_motd_cfg")
net.WriteString(val)
net.SendToServer()
end
end
local gen = content.gen
gen.titleText = nadmin.vgui:DLabel(nil, "MOTD Title", gen, true)
gen.titleText:SetFont("nadmin_derma_large")
gen.titleText:SizeToContents()
gen.titleText:Dock(TOP)
gen.titleText:DockMargin(4, 4, 4, 0)
gen.titleDiv = nadmin.vgui:DPanel(nil, {gen:GetWide() - 8, 190}, gen)
gen.titleDiv:Dock(TOP)
gen.titleDiv:DockMargin(4, 4, 4, 0)
gen.title = nadmin.vgui:DTextEntry(nil, {content:GetWide() - 16, 28}, gen.titleDiv)
gen.title:SetPlaceholderText("MOTD Title...")
function gen.title:OnTextChanged()
if not istable(content.gen.motd) then return end
content.gen.motd.title.text = self:GetText()
end
gen.subTitle = nadmin.vgui:DTextEntry({0, 32}, {content:GetWide() - 16, 28}, gen.titleDiv)
gen.subTitle:SetPlaceholderText("MOTD Subtitle...")
function gen.subTitle:OnTextChanged()
if not istable(content.gen.motd) then return end
content.gen.motd.title.subtext = self:GetText()
end
gen.bgcoltxt = nadmin.vgui:DLabel({0, 64}, "Title Background Color:", gen.titleDiv, true)
gen.bgcol = nadmin.vgui:DColorMixer({0, 88}, {content:GetWide() / 2 - 2, 74}, gen.titleDiv)
function gen.bgcol:ValueChanged(col)
if not istable(content.gen.motd) then return end
content.gen.motd.title.bgcol = Color(col.r, col.g, col.b)
end
gen.bgtxtcoltxt = nadmin.vgui:DLabel({content:GetWide()/2 + 2, 64}, "Text Color:", gen.titleDiv, true)
gen.bgtxtcol = nadmin.vgui:DColorMixer({content:GetWide()/2 + 2, 88}, {content:GetWide() / 2 - 2, 74}, gen.titleDiv)
function gen.bgtxtcol:ValueChanged(col)
if not istable(content.gen.motd) then return end
content.gen.motd.title.txcol = Color(col.r, col.g, col.b)
end
gen.underline = nadmin.vgui:DCheckBox({0, 166}, {content:GetWide(), 24}, gen.titleDiv)
gen.underline:SetText("Underline Title Box")
gen.underline:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 25))
function gen.underline:OnChecked(checked)
if not istable(content.gen.motd) then return end
content.gen.motd.title.underline = checked
end
gen.div = nadmin.vgui:DPanel(nil, {content:GetWide() - 16, 12}, gen)
gen.div:Dock(TOP)
gen.div:DockMargin(4, 4, 4, 0)
gen.div:SetColor(nadmin:DarkenColor(nadmin.colors.gui.theme, -25))
gen.bodyText = nadmin.vgui:DLabel(nil, "MOTD Body", gen, true)
gen.bodyText:SetFont("nadmin_derma_large")
gen.bodyText:SizeToContents()
gen.bodyText:Dock(TOP)
gen.bodyText:DockMargin(4, 4, 4, 0)
gen.add = nadmin.vgui:DButton(nil, {gen:GetWide() - 8, 28}, gen)
gen.add:Dock(TOP)
gen.add:DockMargin(4, 4, 4, 4)
gen.add:SetText("Add Content")
gen.add:SetIcon("icon16/add.png")
gen.add:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 25))
content.panels = {}
function gen.add:DoClick(inf, ind)
if not istable(content.gen.motd) then return end
if istable(inf) then data = table.Copy(inf)
else
data = {type = "text", title = "", value = "", ranks = {}}
table.insert(content.gen.motd.contents, data)
end
local pan = nadmin.vgui:DPanel(nil, {gen:GetWide()-8, 150}, gen)
pan:Dock(TOP)
pan:DockMargin(4, 0, 4, 4)
pan:DockPadding(4, 4, 4, 4)
pan:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 25))
table.insert(content.panels, pan)
local controls = nadmin.vgui:DPanel(nil, {32, pan:GetTall()}, pan)
controls:Dock(LEFT)
controls:DockPadding(0, 0, 4, 0)
controls:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 25))
local up = nadmin.vgui:DButton(nil, {28, 28}, controls)
up:Dock(TOP)
up:DockMargin(0, 0, 0, 4)
up:SetIcon("icon16/arrow_up.png")
up:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 50))
up.ind = ind or #content.gen.motd.contents
local down = nadmin.vgui:DButton(nil, {28, 28}, controls)
down:Dock(BOTTOM)
down:DockMargin(0, 4, 0, 0)
down:SetIcon("icon16/arrow_down.png")
down:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 50))
down.ind = up.ind
local del = nadmin.vgui:DButton(nil, {28, 28}, controls)
del:Dock(FILL)
del:SetIcon("icon16/bin_closed.png")
del:SetColor(nadmin.colors.gui.red)
del.ind = up.ind
local info = nadmin.vgui:DScrollPanel(nil, {pan:GetWide()-32, pan:GetTall()}, pan)
info:Dock(FILL)
info:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 25))
info.title = nadmin.vgui:DTextEntry(nil, {info:GetWide(), 28}, info)
info.title:Dock(TOP)
info.title:DockMargin(0, 0, 0, 4)
info.title:SetColor(nadmin.colors.gui.theme)
info.title:SetPlaceholderText("Title...")
info.title:SetText(data.title)
function info.title:OnTextChanged()
data.title = self:GetText()
end
info.type = nadmin.vgui:DComboBox(nil, {info:GetWide(), 28}, info)
info.type:Dock(TOP)
info.type:DockMargin(0, 0, 0, 4)
info.type:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 50))
info.type:SetSortItems(false)
info.type:AddChoice("Number List", "olist", data.type == "olist" )
info.type:AddChoice("Bullet List", "ulist", data.type == "ulist" )
info.type:AddChoice("Text Area", "text", data.type == "text" )
info.type:AddChoice("Workshop Addons", "workshop", data.type == "workshop")
info.type:AddChoice("Members in a Rank", "members", data.type == "members" )
info.notice = nadmin.vgui:AdvancedDLabel(nil, "If making a list, press enter to start a new line for each point.", info)
info.notice:Dock(TOP)
info.notice:DockMargin(0, 0, 0, 4)
info.valueEntry = nadmin.vgui:DTextEntry(nil, {info:GetWide(), 24}, info)
info.valueEntry:Dock(TOP)
info.valueEntry:SetPlaceholderText("Information...")
info.valueEntry:SetMultiline(true)
info.valueEntry:SetColor(nadmin.colors.gui.theme)
info.valueEntry:SetText(data.value)
function info.valueEntry:OnTextChanged()
local lines = #string.Explode("\n", self:GetText())
self:SetTall(4 + 20 * lines)
info:SizeToContentsY()
data.value = self:GetText()
end
info.ranks = nadmin.vgui:DPanel(nil, {info:GetWide(), 0}, info)
info.ranks:Dock(TOP)
info.ranks:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 25))
local ranks = {}
for i, rank in pairs(nadmin.ranks) do
table.insert(ranks, rank)
end
table.sort(ranks, function(a, b) return a.immunity > b.immunity end)
for i, rank in ipairs(ranks) do
local box = nadmin.vgui:DCheckBox(nil, {info:GetWide(), 24}, info.ranks)
box:Dock(TOP)
box:DockMargin(0, 0, 0, 4)
box:SetCheckColor(rank.color)
box:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 50))
box:SetText(rank.title)
box:SetChecked(table.HasValue(data.ranks, rank.id))
function box:OnChecked(checked)
if checked then
table.insert(data.ranks, rank.id)
else
table.RemoveByValue(data.ranks, rank.id)
end
end
info.ranks:SetTall(info.ranks:GetTall() + 28)
end
info.ranks:SetVisible(false)
info.nice = nadmin.vgui:DLabel(nil, "mm yes, you like this empty space of mine right? Why don't you touch it ( ͡° ͜ʖ ͡°)", info, true)
info.nice:Dock(TOP)
info.nice:SetVisible(false)
function del:DoClick()
table.RemoveByValue(content.panels, pan)
pan:Remove()
table.remove(content.gen.motd.contents, self.ind)
end
function up:DoClick()
local index = self.ind
local upcon = content.gen.motd.contents[index - 1]
local ticon = content.gen.motd.contents[index]
if istable(upcon) then
local upContent = table.Copy(upcon)
local thisContent = table.Copy(ticon)
content.gen.motd.contents[index - 1] = thisContent
content.gen.motd.contents[index] = upContent
for x, panel in ipairs(content.panels) do
panel:Remove()
end
content.panels = {}
for i, con in ipairs(content.gen.motd.contents) do
content.gen.add:DoClick(con, i)
end
end
end
function down:DoClick()
local index = self.ind
local ticon = content.gen.motd.contents[index]
local docon = content.gen.motd.contents[index + 1]
if istable(docon) then
local thisContent = table.Copy(ticon)
local doContent = table.Copy(docon)
content.gen.motd.contents[index] = doContent
content.gen.motd.contents[index + 1] = thisContent
for x, panel in ipairs(content.panels) do
panel:Remove()
end
content.panels = {}
for i, con in ipairs(content.gen.motd.contents) do
content.gen.add:DoClick(con, i)
end
end
end
function info.type:OnSelect(index, value, dat)
data.type = dat
if dat == "olist" or dat == "ulist" or dat == "text" then
info.notice:SetVisible(true)
info.valueEntry:SetVisible(true)
info.ranks:SetVisible(false)
info.nice:SetVisible(false)
elseif dat == "workshop" then
info.notice:SetVisible(false)
info.valueEntry:SetVisible(false)
info.ranks:SetVisible(false)
info.nice:SetVisible(true)
elseif dat == "members" then
info.notice:SetVisible(false)
info.valueEntry:SetVisible(false)
info.ranks:SetVisible(true)
info.nice:SetVisible(false)
end
end
info.type:OnSelect(nil, nil, data.type)
end
function content.preview:DoClick()
local data
if content.fileError:IsVisible() then
if isstring(content.fileError.data) then
data = content.fileError.data
end
elseif content.url:IsVisible() then
data = content.url:GetText()
elseif content.gen:IsVisible() then
data = content.gen.motd
end
nadmin.motd:Open(data)
end
function content.save:DoClick()
local mode = content.mode:GetValue()
content.lock:SetVisible(true)
net.Start("nadmin_update_motd_cfg")
net.WriteBool(content.enabled:GetChecked())
net.WriteString(mode)
if mode == "URL" then
net.WriteString(content.url:GetText())
elseif mode == "Generator" and istable(content.gen.motd) then
net.WriteTable(content.gen.motd)
end
net.SendToServer()
net.Start("nadmin_fetch_motd_cfg")
net.WriteString("_get")
net.SendToServer()
end
net.Start("nadmin_fetch_motd_cfg")
net.WriteString("_get")
net.SendToServer()
end},
{"Voteban", "icon16/disconnect.png"},
{"Votemap", "icon16/world.png"},
{"Reserved Slots", "icon16/status_online.png"}
}
for i, cat in ipairs(categories) do
local btn = nadmin.vgui:DButton(nil, {leftPanel:GetWide() - 8, 32}, leftPanel)
btn:Dock(TOP)
btn:DockMargin(0, 0, 0, 4)
btn:SetText(cat[1])
btn:SetIcon(cat[2])
-- if i ~= 1 then
btn:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 25))
-- end
function btn:DoClick()
local col = nadmin:BrightenColor(nadmin.colors.gui.theme, 25)
for x, btn in ipairs(leftPanel.btns) do
btn:SetColor(col)
end
self:SetColor(nadmin.colors.gui.blue)
content:Clear()
if isfunction(cat[3]) then
function content:Paint() end
cat[3]()
else
function content:Paint(w, h)
draw.Text({
text = "Please select an option on the left.",
pos = {w/2, h/2},
xalign = TEXT_ALIGN_CENTER,
yalign = TEXT_ALIGN_CENTER,
font = "nadmin_derma",
color = tc
})
end
end
end
table.insert(leftPanel.btns, btn)
end
end
})
net.Receive("nadmin_fetch_motd_cfg", function()
if not IsValid(content) then return end -- No need to process since they closed the menu
local enabled = net.ReadBool()
local mode = net.ReadString()
if enabled then
content.enabled:SetChecked(true)
end
content.mode:SetValue(mode)
if mode == "Generator" then
local gen = net.ReadTable()
content.gen.motd = gen
content.gen.title:SetText(gen.title.text)
content.gen.subTitle:SetText(gen.title.subtext)
content.gen.bgcol:SetColor(gen.title.bgcol)
content.gen.bgtxtcol:SetColor(gen.title.txcol)
content.gen.underline:SetChecked(gen.title.underline)
for x, pan in ipairs(content.panels) do
pan:Remove()
end
content.panels = {}
for i, con in ipairs(gen.contents) do
content.gen.add:DoClick(con, i)
end
content.gen:SetVisible(true)
elseif mode == "Local File" then
local errored = net.ReadBool()
local val = net.ReadString()
if errored then
content.fileError:SetText("Problem loading local file:\n" .. val)
else
content.fileError:SetText("No errors occur using Local File.")
content.fileError:SetTextColor(nadmin.colors.gui.blue)
content.fileError.data = val
end
content.fileError:SizeToContentsY()
content.fileError:SetVisible(true)
elseif mode == "URL" then
local url = net.ReadString()
content.url:SetText(url)
content.url:SetVisible(true)
end
content.lock:SetVisible(false)
end)
net.Receive("nadmin_req_adverts", function()
local adverts = net.ReadTable()
if not IsValid(content) then return end
content.adverts.advs:Clear()
local numAd = #adverts
if numAd > 0 then
local btns = {}
function content.adverts.advs:Paint() end
for i = 1, numAd do
local adv = adverts[i]
local row = nadmin.vgui:DPanel(nil, {content.adverts.advs:GetWide() - 8, 28}, content.adverts.advs)
row:Dock(TOP)
row:DockMargin(4, 4, 4, 0)
function row:Paint() end
local up = nadmin.vgui:DButton(nil, {30, 13}, row)
up:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 25))
up:SetText("")
function up:Paint(w, h)
if self:IsMouseInputEnabled() then
draw.RoundedBox(0, 0, 0, w, h, nadmin:BrightenColor(self:GetColor(), self:IsDown() and 10 or (self:IsHovered() and 25 or 0)))
else
draw.RoundedBox(0, 0, 0, w, h, nadmin:DarkenColor(self:GetColor(), 15))
end
local c = self:GetTextColor()
draw.NoTexture()
surface.SetDrawColor(c.r, c.g, c.b)
surface.DrawPoly({
{x = w/2, y = 2},
{x = w/2 + h/2 - 2, y = h - 2},
{x = w/2 - h/2 + 2, y = h - 2}
})
end
if i == 1 then
up:SetMouseInputEnabled(false)
end
function up:DoClick()
if istable(adverts[i - 1]) then
local above = adverts[i - 1]
net.Start("nadmin_add_advert")
net.WriteString(above.text)
net.WriteInt(above.repeatAfter, 32)
net.WriteTable({above.color.r, above.color.g, above.color.b})
net.WriteInt(i, 32)
net.SendToServer()
net.Start("nadmin_add_advert")
net.WriteString(adv.text)
net.WriteInt(adv.repeatAfter, 32)
net.WriteTable({adv.color.r, adv.color.g, adv.color.b})
net.WriteInt(i - 1, 32)
net.SendToServer()
end
end
local down = nadmin.vgui:DButton({0, 15}, {30, 13}, row)
down:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 25))
down:SetText("")
function down:Paint(w, h)
if self:IsMouseInputEnabled() then
draw.RoundedBox(0, 0, 0, w, h, nadmin:BrightenColor(self:GetColor(), self:IsDown() and 10 or (self:IsHovered() and 25 or 0)))
else
draw.RoundedBox(0, 0, 0, w, h, nadmin:DarkenColor(self:GetColor(), 15))
end
local c = self:GetTextColor()
draw.NoTexture()
surface.SetDrawColor(c.r, c.g, c.b)
surface.DrawPoly({
{x = w/2 - h/2 + 2, y = 2},
{x = w/2 + h/2 - 2, y = 2},
{x = w/2, y = h - 2}
})
end
if i == numAd then
down:SetMouseInputEnabled(false)
end
function down:DoClick()
if istable(adverts[i + 1]) then
local below = adverts[i + 1]
net.Start("nadmin_add_advert")
net.WriteString(below.text)
net.WriteInt(below.repeatAfter, 32)
net.WriteTable({below.color.r, below.color.g, below.color.b})
net.WriteInt(i, 32)
net.SendToServer()
net.Start("nadmin_add_advert")
net.WriteString(adv.text)
net.WriteInt(adv.repeatAfter, 32)
net.WriteTable({adv.color.r, adv.color.g, adv.color.b})
net.WriteInt(i + 1, 32)
net.SendToServer()
end
end
local resend = nadmin.vgui:DButton({32, 0}, {28, 28}, row)
resend:SetColor(nadmin:BrightenColor(nadmin.colors.gui.theme, 25))
resend:SetText("")
resend:SetIcon("icon16/arrow_refresh.png")
resend:SetToolTip("Resend advert")
function resend:DoClick()
net.Start("nadmin_resend_advert")
net.WriteInt(i, 32)
net.SendToServer()
end
local btn = nadmin.vgui:DButton({62, 0}, {row:GetWide() - 62, 28}, row)
btn:SetText(adv.text)
btn:SetColor(adv.color)
btn.normalPaint = btn.Paint
function btn:Paint(w, h)
self:normalPaint(w, h)
if self.sel then
local tc = self:GetTextColor()
draw.RoundedBox(0, 0, 0, w, 1, tc)
draw.RoundedBox(0, w-1, 0, 1, h, tc)
draw.RoundedBox(0, 0, h-1, w, 1, tc)
draw.RoundedBox(0, 0, 0, 1, h, tc)
end
end
function btn:DoClick()
content.settings.message:SetText(adv.text)
content.settings.rep:SetValue(adv.repeatAfter)
content.settings.col:SetColor(adv.color)
content.settings.manage:SetTall(content.settings.new:GetTall())
content.settings.manage:DockMargin(4, 0, 4, 4)
content.settings.index = i
for i = 1, #btns do
btns[i].sel = false
end
self.sel = true
end
table.insert(btns, btn)
end
else
function content.adverts.advs:Paint(w, h)
draw.Text({
text = "No adverts currently exist.",
pos = {w/2, h/2},
xalign = TEXT_ALIGN_CENTER,
yalign = TEXT_ALIGN_CENTER,
font = "nadmin_derma",
color = nadmin:TextColor(self:GetColor())
})
end
end
end)
net.Receive("nadmin_request_sandbox", function()
local cfg = net.ReadTable()
if not IsValid(content) then return end
content.lock:SetVisible(false)
content.noclip:SetChecked(cfg.noclip)
content.god:SetChecked(cfg.god)
content.pvp:SetChecked(cfg.pvp)
end)
else
util.AddNetworkString("nadmin_request_sandbox")
util.AddNetworkString("nadmin_upd_sandbox")
net.Receive("nadmin_upd_sandbox", function(len, ply)
local opt = net.ReadString()
local val = net.ReadInt(32)
if not ply:HasPerm("manage_sandbox") then
nadmin:Notify(ply, nadmin.colors.red, nadmin.errors.accessDenied)
return
end
local convar = GetConVar(opt)
if convar then
convar:SetInt(val)
else
nadmin:Notify(ply, nadmin.colors.red, "Invalid option specified: " .. opt)
end
end)
net.Receive("nadmin_request_sandbox", function(len, ply)
local noclip = nadmin:IntToBool(GetConVar("sbox_noclip"):GetInt())
local god = nadmin:IntToBool(GetConVar("sbox_godmode"):GetInt())
local pvp = nadmin:IntToBool(GetConVar("sbox_playershurtplayers"):GetInt())
net.Start("nadmin_request_sandbox")
net.WriteTable({
noclip = noclip,
god = god,
pvp = pvp
})
net.Send(ply)
end)
end
nadmin:RegisterPerm({
title = "Manage Sandbox"
})
|
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local S = E:GetModule('Skins')
--Cache global variables
--Lua functions
local _G = _G
--WoW API / Variables
--Global variables that we don't cache, list them here for mikk's FindGlobals script
-- GLOBALS:
local function LoadSkin()
if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.bgscore ~= true then return end
-- Macro to show the WorldStateScoreFrame: /run WorldStateScoreFrame:Show()
local WorldStateScoreFrame = _G["WorldStateScoreFrame"]
_G["WorldStateScoreScrollFrame"]:StripTextures()
WorldStateScoreFrame:StripTextures()
WorldStateScoreFrame:SetTemplate("Transparent")
S:HandleCloseButton(WorldStateScoreFrameCloseButton)
S:HandleScrollBar(WorldStateScoreScrollFrameScrollBar)
WorldStateScoreFrameInset:SetAlpha(0)
S:HandleButton(WorldStateScoreFrameLeaveButton)
S:HandleButton(WorldStateScoreFrameQueueButton)
for i = 1, 3 do
S:HandleTab(_G["WorldStateScoreFrameTab"..i])
end
S:SkinPVPHonorXPBar('WorldStateScoreFrame')
end
S:AddCallback("WorldStateScore", LoadSkin)
|
-- Announce Scaleform to every players
local announce_title = "Flash Info" -- Set the title of the announcement here.
local AnnouncementScaleform
Scaleform = {}
local scaleform = {}
scaleform.__index = scaleform
function StartDraw(time)
Citizen.CreateThread(function()
local fading = false
while not AnnouncementScaleform do Wait(0) end
local StartTime = GetGameTimer()
while true do
AnnouncementScaleform:Draw2D()
if GetGameTimer() - StartTime > time * 1000 then
fading = true
AnnouncementScaleform:CallFunction("SHARD_ANIM_OUT", 2, 1)
end
if GetGameTimer() - StartTime > (time + 1.25) * 1000 then
AnnouncementScaleform:Dispose()
fading = false
return
end
Wait(0)
end
end)
end
RegisterNetEvent("Scaleform:Announce")
AddEventHandler("Scaleform:Announce", function(time, announcement)
Citizen.CreateThread(function()
StartDraw(time)
end)
AnnouncementScaleform = Scaleform.Request("MIDSIZED_MESSAGE")
AnnouncementScaleform:CallFunction("SHOW_SHARD_MIDSIZED_MESSAGE", announce_title, announcement, 2, true, true)
end)
function Scaleform.Request(Name)
local ScaleformHandle = RequestScaleformMovie(Name)
local StartTime = GetGameTimer()
while not HasScaleformMovieLoaded(ScaleformHandle) do Citizen.Wait(0)
if GetGameTimer() - StartTime >= 5000 then
--print("loading failed")
return
end
end
--print("Loaded")
local data = {name = Name, handle = ScaleformHandle}
return setmetatable(data, scaleform)
end
function scaleform:CallScaleFunction(scType, theFunction, ...)
BeginScaleformMovieMethod(self.handle, theFunction)
local arg = {...}
if arg ~= nil then
for i=1,#arg do
local sType = type(arg[i])
if sType == "boolean" then
PushScaleformMovieMethodParameterBool(arg[i])
elseif sType == "number" then
if math.type(arg[i]) == "integer" then
PushScaleformMovieMethodParameterInt(arg[i])
else
PushScaleformMovieMethodParameterFloat(arg[i])
end
elseif sType == "string" then
PushScaleformMovieMethodParameterString(arg[i])
else
PushScaleformMovieMethodParameterInt()
end
end
end
return EndScaleformMovieMethod()
end
function scaleform:CallFunction(theFunction, ...)
self:CallScaleFunction("normal", theFunction, ...)
end
function scaleform:Draw2D(alpha)
DrawScaleformMovieFullscreen(self.handle, 255, 255, 255, (alpha and alpha or 255))
end
function scaleform:Dispose()
SetScaleformMovieAsNoLongerNeeded(self.handle)
setmetatable({}, scaleform)
end
|
--[[
swords.register_sword("swords:sword", {
description = "A basic sword",
texture = "swords_sword.png",
damage = {fleshy = 3},
base_speed = 1.5,
glow = 1
})
]]--
function swords.register_sword(name, def)
minetest.register_tool(name, {
description = def.description,
inventory_image = def.texture,
groups = {sword = 1},
wield_scale = def.wield_scale or vector.new(2, 2.5, 1.5),
glow = def.glow or 0,
tool_capabilities = {
full_punch_interval = def.speed,
damage_groups = def.damage,
punch_attack_uses = 0,
},
on_hit = function(pos, damage, dir)
local r = math.min(255, math.ceil((255/(damage.max-damage.min)) * (damage.dmg-damage.min))+125)
local g = r
local b = r
if damage.dmg == damage.max then
r = 255
g = 25
b = 25
elseif damage.dmg >= damage.max*9/10 then
r = 255
g = 255
b = 25
end
minetest.add_particlespawner({
amount = damage.dmg == damage.max and 5 or 1,
time = 0.1,
minpos = vector.add(pos, vector.new(0, 0.7, 0)),
maxpos = vector.add(pos, vector.new(0, 0.7, 0)),
minvel = {x=-2, y=-1, z=-2},
maxvel = {x=2, y=3, z=2},
minacc = {x=0, y=-9.8, z=0},
maxacc = {x=0, y=-9.8, z=0},
minexptime = 0.2,
maxexptime = 0.6,
minsize = 2,
maxsize = 3,
collisiondetection = true,
texture = "smoke_puff.png",
glow = 3
})
minetest.add_particle({
pos = vector.subtract(pos, vector.multiply(dir, 1.5)),
velocity = {x=0, y=0, z=0},
expirationtime = 0.1,
size = (g == 255 and 10) or (r == 255 and 13) or 7,
collisiondetection = false,
collision_removal = false,
object_collision = false,
texture = ("(slash.%d.png^[colorize:#%X%X%X:255)%s"):format(math.random(1, 2), r, g, b, math.random(0, 1)==1 and "^[transformFX" or ""),
glow = 5,
})
end,
})
end
|
local E = require "luevt"
local dispatcher1 = E.new()
dispatcher1:add_listener("TEST_DISPATCH_FUNC", function(args)
print("listener is fucntion, args =", args)
end)
dispatcher1:add_listener("TEST_DISPATH_CO", coroutine.create(function(args)
while true do
print("listener is coroutine, args =", args)
coroutine.yield()
end
end))
dispatcher1:add_listener({
id = "TEST_DISPATH_TABLE",
listener = function (args)
print("listener is table, args =", args)
end,
priority = 10,
limit = 2,
interval = 0
})
dispatcher1("TEST_DISPATCH_FUNC", "dispatcher1-CALL")
dispatcher1:dispatch("TEST_DISPATCH_FUNC", "dispatcher1-DISPATCH")
for i=1, 3 do
dispatcher1:dispatch("TEST_DISPATH_CO", "dispatcher1")
end
for i=1, 3 do
dispatcher1:dispatch("TEST_DISPATH_TABLE", "dispatcher1")
end
print("--------------------------------")
print("TEST_DISPATCH_FUNC, exists:", dispatcher1:exists("TEST_DISPATCH_FUNC"))
print("TEST_DISPATCH_FUNC, exists:", dispatcher1:exists("TEST_DISPATH_CO"))
print("--------------------------------")
local listeners = dispatcher1:all_listeners()
for i=1, #dispatcher1 do
print(listeners())
end
print("--------------------------------")
local dispatcher2 = E.new()
local priority_default = function()
print("listener is priority_default")
end
local priority_1 = function()
print("listener is priority_1")
end
local priority_10 = function()
print("listener is priority_10")
end
dispatcher2:add_listener("TEST_DISPATCH_PRIORITY", priority_default)
dispatcher2:add_listener("TEST_DISPATCH_PRIORITY", priority_10)
dispatcher2:add_listener("TEST_DISPATCH_PRIORITY", priority_1)
dispatcher2:dispatch("TEST_DISPATCH_PRIORITY")
print("--------------------------------")
dispatcher2:set_priority(priority_1, 1)
dispatcher2:set_priority(priority_10, 10)
dispatcher2:dispatch("TEST_DISPATCH_PRIORITY")
print("--------------------------------")
local dispatcher3 = E.new()
local limit_default = function(times)
print("listener is limit_default, times =", times)
end
local limit_2 = function(times)
print("listener is limit_2, times =", times)
end
dispatcher3:add_listener("TEST_DISPATCH_LIMIT", limit_default)
dispatcher3:add_listener("TEST_DISPATCH_LIMIT", limit_2)
dispatcher3:set_dispatch_limit(limit_2, 2)
for i=1, 5 do
dispatcher3:dispatch("TEST_DISPATCH_LIMIT", i)
end
print("--------------------------------")
print("dispatcher1 listener count =", #dispatcher1, "\ndispatcher2 listener count =", #dispatcher2, "\ndispatcher3 listener count =", #dispatcher3)
print("--------------------------------")
dispatcher1:remove_listener("TEST_DISPATH_CO")
dispatcher2:remove_listeners()
dispatcher3:remove_listener(limit_default)
print("dispatcher1 listener count =", #dispatcher1, "\ndispatcher2 listener count =", #dispatcher2, "\ndispatcher3 listener count =", #dispatcher3)
print("--------------------------------")
local dispatcher4 = E.new()
local listener3
local function listener1(...)
print("dispatcher4 listener1: no remove",...)
end
local function listener2(...)
local exists = dispatcher4:exists(listener1)
print("dispatcher4 exist: listener1", exists)
if exists then
print("dispatcher4 listener2, remove listener1:", ...)
dispatcher4:remove_listener(listener1)
end
end
listener3 = function(...)
print("dispatcher4 listener3, remove listener3:", ...)
dispatcher4:remove_listener(listener3)
end
local listener4 =coroutine.create(function(...)
while true do
print("dispatcher4 listener4, no remove:", ...)
coroutine.yield()
end
end)
dispatcher4:add_listener( "TEST_REMOVE_IN_DISPATCH", listener1 )
dispatcher4:add_listener( "TEST_REMOVE_IN_DISPATCH", listener2 )
dispatcher4:add_listener( "TEST_REMOVE_IN_DISPATCH", listener3 )
dispatcher4:add_listener( "TEST_REMOVE_IN_DISPATCH", listener4 )
dispatcher4:dispatch( "TEST_REMOVE_IN_DISPATCH")
print("--------------------------------")
dispatcher4:remove_dispatch_limit(listener2)
dispatcher4:dispatch( "TEST_REMOVE_IN_DISPATCH")
print("---------------test end-----------------")
|
-----------------------------------------------------------------------------------------------------------------------------------------
-- VRP
-----------------------------------------------------------------------------------------------------------------------------------------
local Tunnel = module("vrp","lib/Tunnel")
local Proxy = module("vrp","lib/Proxy")
vRP = Proxy.getInterface("vRP")
-----------------------------------------------------------------------------------------------------------------------------------------
-- VARIABLE
-----------------------------------------------------------------------------------------------------------------------------------------
local RCCar = {}
-----------------------------------------------------------------------------------------------------------------------------------------
-- EVENT SKATE
-----------------------------------------------------------------------------------------------------------------------------------------
RegisterNetEvent('skate')
AddEventHandler('skate',function()
local ped = PlayerPedId()
if DoesEntityExist(RCCar.Entity) then return end
RCCar.Spawn()
while DoesEntityExist(RCCar.Entity) and DoesEntityExist(RCCar.Driver) do
Citizen.Wait(5)
local distanceCheck = GetDistanceBetweenCoords(GetEntityCoords(ped), GetEntityCoords(RCCar.Entity),true)
RCCar.HandleKeys(distanceCheck)
if distanceCheck <= 3 then
if not NetworkHasControlOfEntity(RCCar.Driver) then
NetworkRequestControlOfEntity(RCCar.Driver)
elseif not NetworkHasControlOfEntity(RCCar.Entity) then
NetworkRequestControlOfEntity(RCCar.Entity)
end
else
TaskVehicleTempAction(RCCar.Driver,RCCar.Entity,6,2500)
end
end
end)
-----------------------------------------------------------------------------------------------------------------------------------------
-- FUNCTION CONTROL SKATE
-----------------------------------------------------------------------------------------------------------------------------------------
Attached = false
function RCCar.HandleKeys(distanceCheck)
local ped = PlayerPedId()
if distanceCheck <= 1.5 then
if IsControlJustPressed(0,38) and IsInputDisabled(0) and not Attached then
RCCar.Attach("pick")
end
if IsControlJustReleased(0,244) and IsInputDisabled(0) then
if Attached then
RCCar.AttachPlayer(false)
else
RCCar.AttachPlayer(true)
end
end
if not Attached then
DrawText3Ds(GetEntityCoords(RCCar.Entity).x,GetEntityCoords(RCCar.Entity).y,GetEntityCoords(RCCar.Entity).z+0.5,"~r~E ~w~ PEGAR ~g~M ~w~ SUBIR",500)
end
end
if distanceCheck <= 1.5 and Attached then
if IsControlPressed(0,32) and IsInputDisabled(0) and not IsControlPressed(0,33) and IsInputDisabled(0) then
TaskVehicleTempAction(RCCar.Driver,RCCar.Entity,9,1)
end
if IsControlJustReleased(0,22) and IsInputDisabled(0) and Attached then
local vel = GetEntityVelocity(RCCar.Entity)
if not IsEntityInAir(RCCar.Entity) then
SetEntityVelocity(RCCar.Entity,vel.x,vel.y,vel.z+5.0)
Citizen.Wait(20)
end
end
if IsControlJustReleased(0,32) or IsControlJustReleased(0,33) and IsInputDisabled(0) then
TaskVehicleTempAction(RCCar.Driver,RCCar.Entity,6,2500)
end
if IsControlPressed(0,33) and not IsControlPressed(0,32) and IsInputDisabled(0) then
TaskVehicleTempAction(RCCar.Driver,RCCar.Entity,22,1)
end
if IsControlPressed(0,34) and IsControlPressed(0,33) and IsInputDisabled(0) then
TaskVehicleTempAction(RCCar.Driver,RCCar.Entity,13,1)
end
if IsControlPressed(0,35) and IsControlPressed(0,33) and IsInputDisabled(0) then
TaskVehicleTempAction(RCCar.Driver,RCCar.Entity,14,1)
end
if IsControlPressed(0,32) and IsControlPressed(0,33) and IsInputDisabled(0) then
TaskVehicleTempAction(RCCar.Driver,RCCar.Entity,30,100)
end
if IsControlPressed(0,34) and IsControlPressed(0,32) and IsInputDisabled(0) then
TaskVehicleTempAction(RCCar.Driver,RCCar.Entity,7,1)
end
if IsControlPressed(0,35) and IsControlPressed(0,32) and IsInputDisabled(0) then
TaskVehicleTempAction(RCCar.Driver,RCCar.Entity,8,1)
end
if IsControlPressed(0,34) and not IsControlPressed(0,32) and not IsControlPressed(0,33) and IsInputDisabled(0) then
TaskVehicleTempAction(RCCar.Driver,RCCar.Entity,4,1)
end
if IsControlPressed(0,35) and not IsControlPressed(0,32) and not IsControlPressed(0,33) and IsInputDisabled(0) then
TaskVehicleTempAction(RCCar.Driver,RCCar.Entity,5,1)
end
end
Citizen.CreateThread(function()
Citizen.Wait(1)
if Attached then
local x = GetEntityRotation(RCCar.Entity).x
local y = GetEntityRotation(RCCar.Entity).y
if (-60.0 < x and x > 60.0) or (-60.0 < y and y > 60.0) or (HasEntityCollidedWithAnything(RCCar.Entity) and GetEntitySpeed(RCCar.Entity) > 12.6) then
RCCar.AttachPlayer(false)
SetPedToRagdoll(ped,4000,4000,0,true,true,false)
elseif IsPedArmed(ped,7) or IsEntityInWater(RCCar.Entity) or GetEntityHealth(ped) <= 101 then
RCCar.AttachPlayer(false)
DetachEntity(RCCar.Entity)
end
end
end)
end
-----------------------------------------------------------------------------------------------------------------------------------------
-- FUNCTION SPAWN SKATE
-----------------------------------------------------------------------------------------------------------------------------------------
function RCCar.Spawn()
local ped = PlayerPedId()
if not IsPedInAnyVehicle(ped) then
RCCar.LoadModels({ GetHashKey("rcbandito"),68070371,GetHashKey("p_defilied_ragdoll_01_s"),"pickup_object","move_strafe@stealth" })
local spawnCoords,spawnHeading = GetEntityCoords(ped)+GetEntityForwardVector(ped)*2.0,GetEntityHeading(ped)
RCCar.Entity = CreateVehicle(GetHashKey("rcbandito"),spawnCoords,spawnHeading,true)
RCCar.Skate = CreateObject(GetHashKey("p_defilied_ragdoll_01_s"),0.0,0.0,0.0,true,true,true)
while not DoesEntityExist(RCCar.Entity) do
Citizen.Wait(5)
end
while not DoesEntityExist(RCCar.Skate) do
Citizen.Wait(5)
end
--ForceVehicleEngineAudio(RCCar.Entity,"VOLTIC")
SetVehicleHandlingFloat(RCCar.Entity,"CHandlingData","fSuspensionForce",1.5)
SetVehicleEngineTorqueMultiplier(RCCar.Entity,0.1)
SetEntityNoCollisionEntity(RCCar.Entity,ped,false)
SetEntityVisible(RCCar.Entity,false)
SetAllVehiclesSpawn(RCCar.Entity,true,true,true,true)
AttachEntityToEntity(RCCar.Skate,RCCar.Entity,GetPedBoneIndex(ped,28422),0.0,0.0,-0.15,0.0,0.0,90.0,true,true,true,true,1,true)
SetEntityCollision(RCCar.Skate,true,true)
RCCar.Driver = CreatePed(5,68070371,spawnCoords,spawnHeading,true)
SetEntityInvincible(RCCar.Driver,true)
SetEntityVisible(RCCar.Driver,false)
FreezeEntityPosition(RCCar.Driver,true)
SetPedAlertness(RCCar.Driver,0.0)
TaskWarpPedIntoVehicle(RCCar.Driver,RCCar.Entity,-1)
while not IsPedInVehicle(RCCar.Driver,RCCar.Entity) do
Citizen.Wait(0)
end
RCCar.Attach("place")
end
end
-----------------------------------------------------------------------------------------------------------------------------------------
-- FUNCTION ATTACH SKATE
-----------------------------------------------------------------------------------------------------------------------------------------
function RCCar.Attach(param)
local ped = PlayerPedId()
if not DoesEntityExist(RCCar.Entity) or GetEntityHealth(ped) <= 101 then
return
end
if param == "place" then
AttachEntityToEntity(RCCar.Entity,ped,GetPedBoneIndex(ped,28422),-0.1,0.0,-0.2,70.0,0.0,270.0,1,1,0,0,2,1)
TaskPlayAnim(ped,"pickup_object","pickup_low",8.0,-8.0,-1,0,0,false,false,false)
Citizen.Wait(800)
DetachEntity(RCCar.Entity,false,true)
PlaceObjectOnGroundProperly(RCCar.Entity)
elseif param == "pick" then
Citizen.Wait(100)
TaskPlayAnim(ped,"pickup_object","pickup_low",8.0,-8.0,-1,0,0,false,false,false)
Citizen.Wait(600)
AttachEntityToEntity(RCCar.Entity,ped,GetPedBoneIndex(ped,28422),-0.1,0.0,-0.2,70.0,0.0,270.0,1,1,0,0,2,1)
Citizen.Wait(900)
DetachEntity(RCCar.Entity)
DeleteEntity(RCCar.Skate)
DeleteVehicle(RCCar.Entity)
DeleteEntity(RCCar.Driver)
for modelIndex = 1,#RCCar.CachedModels do
local model = RCCar.CachedModels[modelIndex]
if IsModelValid(model) then
SetModelAsNoLongerNeeded(model)
else
RemoveAnimDict(model)
end
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------
-- FUNCTION LOADMODEL SKATE
-----------------------------------------------------------------------------------------------------------------------------------------
function RCCar.LoadModels(models)
for modelIndex = 1, #models do
local model = models[modelIndex]
if not RCCar.CachedModels then
RCCar.CachedModels = {}
end
table.insert(RCCar.CachedModels,model)
if IsModelValid(model) then
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(10)
end
else
while not HasAnimDictLoaded(model) do
RequestAnimDict(model)
Citizen.Wait(10)
end
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------
-- FUNCTION ATTACH SKATE TO PLAYER
-----------------------------------------------------------------------------------------------------------------------------------------
function RCCar.AttachPlayer(toggle)
local ped = PlayerPedId()
if toggle then
TaskPlayAnim(ped,"move_strafe@stealth","idle",8.0,8.0,-1,1,1.0,false,false,false)
AttachEntityToEntity(ped,RCCar.Entity,20,0.0,0.0,0.98,0.0,0.0,-15.0,true,true,true,true,true,true)
SetEntityCollision(ped,true,false)
Attached = true
elseif not toggle then
DetachEntity(ped,false,false)
Attached = false
StopAnimTask(ped,"move_strafe@stealth","idle",1.0)
end
end
-----------------------------------------------------------------------------------------------------------------------------------------
-- DRAWTEXT3D
-----------------------------------------------------------------------------------------------------------------------------------------
function DrawText3Ds(x,y,z,text,size)
local onScreen,_x,_y = World3dToScreen2d(x,y,z)
SetTextFont(4)
SetTextScale(0.35,0.35)
SetTextColour(255,255,255,150)
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x,_y)
local factor = (string.len(text))/size
DrawRect(_x,_y+0.0125,0.01+factor,0.03,0,0,0,80)
end
|
local class = require("pl.class")
local ChannelAudience = require("core.ChannelAudience")
---@class AreaAudience : ChannelAudience
local M = class(ChannelAudience)
---@return Character[]
function M:getBroadcastTargets()
if not self.sender.room then return {} end
local area = self.sender.room
local res = area:getBroadcastTargets()
table.remove(res, self.sender)
end
return M
|
--[[
RD2 BeamVars Extension
]]
AddCSLuaFile("BeamVarsExtensions/rd2.lua")
local meta = FindMetaTable( "Entity" )
-- Return if there's nothing to add on to
if (!meta) then return end
-- SetOOO (3 cap o's)
-- sets off/on/overdrive
if (SERVER) then
meta[ "SetOOO" ] = function ( self, value )
if ( value == BeamVars.Get( self, "OOO", 1 ) ) then return end
BeamVars.Set( self, "OOO", 1, value )
end
function BeamVarsSend.OOO( VarType, Index, Key, Value, Player )
umsg.Start( "RcvEntityVarBeam_OOO", Player )
umsg.Short( Index )
umsg.Short( Value )
umsg.End()
end
end
meta[ "GetOOO" ] = function ( self, default )
local out = BeamVars.Get( self, "OOO", 1 )
if ( out != nil ) then return out end
return default or {}
end
if ( CLIENT ) then
local function RecvFunc( m )
local EntIndex = m:ReadShort()
local Value = m:ReadShort()
local IndexKey = Entity( EntIndex )
if ( IndexKey == NULL ) then IndexKey = EntIndex end
BeamVars.GetAll( IndexKey, "OOO" )[1] = Value
if (type(IndexKey) != "number") and (IndexKey.RecvOOO) and (IndexKey:IsValid()) then
IndexKey:RecvOOO(Value)
end
end
usermessage.Hook( "RcvEntityVarBeam_OOO", RecvFunc )
end
--
-- SetNetworked NetInfo
--
if (SERVER) then
function BeamNetVars.SetNetAmount( net, value, priority )
value = math.floor( value )
if ( value == BeamVars.Get( -2, "NetInfo", net ) ) then return end
BeamVars.Set( -2, "NetInfo", net, value, priority )
end
function BeamNetVars.ClearNetAmount( net )
BeamVars.GetAll( -2, "NetInfo" )[ net ] = nil
end
function BeamVarsSend.NetInfo( VarType, Index, Key, Value, Player )
umsg.Start( "RcvEntityVarBeam_NetInfo", Player )
umsg.Short( Key )
umsg.Long( Value )
umsg.End()
end
end
-- GetNetworked ShortFloat
function BeamNetVars.GetNetAmount( net )
if (!net or net == 0) then return 0 end
return BeamVars.Get( -2, "NetInfo", net ) or 0
end
-- Recvs ShortFloat
if ( CLIENT ) then
local function RecvFunc( m )
local net = m:ReadShort()
local Value = m:ReadLong()
BeamVars.GetAll( -2, "NetInfo" )[ net ] = Value
end
usermessage.Hook( "RcvEntityVarBeam_NetInfo", RecvFunc )
end
--list of resources keyed by name
local resnames = {}
local ResNamesPrint = {}
local ResNamesPrintByName = {}
local ResUnitsPrint = {}
if ( SERVER ) then
meta[ "SetResourceNetID" ] = function ( self, res, ID, urgent )
if ( ID == BeamVars.Get( self, "ResourceNetID", res ) ) then return end
BeamVars.Set( self, "ResourceNetID", res, ID )
end
function BeamVarsSend.ResourceNetID( VarType, Index, Key, Value, Player )
umsg.Start( "RcvEntityVarBeam_ResourceNetID", Player )
umsg.Short( Index )
umsg.Short( Key )
umsg.Short( Value )
umsg.End()
end
end
-- give a resouce id or name and get the ent's net's index
meta[ "GetResourceNetID" ] = function ( self, res )
if (type(res) != "number") then res = resnames[res] end
if (!res) then return 0 end
local out = BeamVars.Get( self, "ResourceNetID", res )
return out or 0
end
-- give a resouce id or name and get amount on that net
meta[ "GetResourceAmount" ] = function ( self, res )
if (type(res) != "number") then res = resnames[res] end
if (!res) then return 0 end
return BeamNetVars.GetNetAmount( BeamVars.Get( self, "ResourceNetID", res ) )
end
-- give a resouce id or name and get amount on that net with units attached
meta[ "GetResourceAmountText" ] = function ( self, res )
if (type(res) != "number") then res = resnames[res] end
if (!res) then return 0 end
return BeamNetVars.GetNetAmount( BeamVars.Get( self, "ResourceNetID", res ) )..ResUnitsPrint[res]
end
meta[ "GetResourceAmountTextPrint" ] = function ( self, res )
if (type(res) != "number") then res = resnames[res] end
if (!res) then return "" end
return ResNamesPrint[res]..self.Entity:GetResourceAmountText( self, res )
end
-- get all the ent's net's indexes keyed with the resource IDs
meta[ "GetResourceNetIDAll" ] = function ( self )
return BeamVars.GetAll( self, "ResourceNetID" )
end
-- get all the ent's net's indexes keyed with the resource names
meta[ "GetResourceNetIDAllNamed" ] = function ( self )
local rez = BeamNetVars.GetResourceNames()
local out = {}
for k,v in pairs (BeamVars.GetAll( self, "ResourceNetID" )) do
out[ rez[k].name ] = v
end
return out
end
-- get all amount of resouces on this ents nets key with resource names
meta[ "GetAllResourcesAmounts" ] = function ( self )
local rez = BeamNetVars.GetResourceNames()
local amounts, units = {}, {}
for k,v in pairs (BeamVars.GetAll( self, "ResourceNetID" )) do
amounts[ rez[k].name ] = BeamNetVars.GetNetAmount( v )
units[ rez[k].name ] = rez[k].unit
end
return amounts, units
end
-- get all amount of resouces on this ents nets ready for overlay text readout
meta[ "GetAllResourcesAmountsText" ] = function ( self, GreaterThanOneOnly )
local out = {}
for k,v in pairs (BeamVars.GetAll( self, "ResourceNetID" )) do
--Msg("k= "..k.." ("..type(k)..") v= "..v.."ResNamesPrint[k]= "..tostring(ResNamesPrint[k]).." BeamNetVars.GetNetAmount(v)= "..tostring(BeamNetVars.GetNetAmount(v)).."\n")
local amount = BeamNetVars.GetNetAmount(v)
if (!GreaterThanOneOnly) or (amount > 0) then
table.insert( out, (ResNamesPrint[k] or "")..(amount or 0)..ResUnitsPrint[k] )
end
end
local txt = table.concat(out, "\n")
if txt == "" then txt = "-None-" end
return txt
end
meta[ "GetNumOfResources" ] = function ( self, GreaterThanOneOnly )
return table.Count(BeamVars.GetAll( self, "ResourceNetID" ))
end
if ( CLIENT ) then
local function RecvFunc( m )
--Msg("RecvFunc\n")
local EntIndex = m:ReadShort()
local res = m:ReadShort()
local ID = m:ReadShort()
local IndexKey = Entity( EntIndex )
if ( IndexKey == NULL ) then IndexKey = EntIndex end
BeamVars.GetAll( IndexKey, "ResourceNetID" )[res] = ID
end
usermessage.Hook( "RcvEntityVarBeam_ResourceNetID", RecvFunc )
end
function BeamNetVars.SetResourcePrintName( resname, printname )
ResNamesPrintByName[ resname ] = printname
end
if ( SERVER ) then
-- Tell clients the names of resources and their IDs
function BeamNetVars.SetResourceNames( id, name, unit, priority )
local tab = {}
tab.name = name
tab.unit = unit
resnames[name] = id
ResNamesPrint[id] = string.upper(string.sub(name,1,1)) .. string.sub(name,2) .. ": " --makes "air" in to "Air: " for overlaytext
if ( unit and unit != "") then
ResUnitsPrint[id] = " "..unit
else
ResUnitsPrint[id] = ""
end
BeamVars.Set( -4, "ResNames", id, tab, priority )
end
function BeamVarsSend.ResNames( VarType, Index, Key, Value, Player )
umsg.Start( "RcvEntityVarBeam_ResNames", Player )
umsg.Short( Key )
umsg.String( Value.name )
umsg.String( Value.unit )
umsg.End()
end
end
-- returns the name from given id
function BeamNetVars.GetResourceName( id )
local out = BeamVars.Get( -4, "ResNames", id )
if ( out != nil ) then return out.name, out.unit end
return "", ""
end
-- returns table of all name indexed by id
function BeamNetVars.GetResourceNames()
return BeamVars.GetAll( -4, "ResNames" ) or {}
end
if ( CLIENT ) then
local function RecvFunc( m )
local id = m:ReadShort()
local name = m:ReadString()
local unit = m:ReadString()
local tab = {}
tab.name = name
tab.unit = unit
BeamVars.GetAll( -4, "ResNames" )[id] = tab
resnames[name] = id
if not (ResNamesPrintByName[name] == nil) then
ResNamesPrint[id] = ResNamesPrintByName[name]
else
ResNamesPrint[id] = string.upper(string.sub(name,1,1)) .. string.sub(name,2) .. ": " --makes "air" in to "Air: " for overlaytext
end
if ( unit and unit != "") then
ResUnitsPrint[id] = " "..unit
else
ResUnitsPrint[id] = ""
end
end
usermessage.Hook( "RcvEntityVarBeam_ResNames", RecvFunc )
end
|
--[[
LuCI - Network model - 6to4 & 6in4 protocol extension
Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]--
local netmod = luci.model.network
local _, p
for _, p in ipairs({"6in4", "6to4"}) do
local proto = netmod:register_protocol(p)
function proto.get_i18n(self)
if p == "6in4" then
return luci.i18n.translate("IPv6-in-IPv4 (RFC4213)")
elseif p == "6to4" then
return luci.i18n.translate("IPv6-over-IPv4")
end
end
function proto.ifname(self)
return p .. "-" .. self.sid
end
function proto.opkg_package(self)
return p
end
function proto.is_installed(self)
return nixio.fs.access("/lib/network/" .. p .. ".sh")
end
function proto.is_floating(self)
return true
end
function proto.is_virtual(self)
return true
end
function proto.get_interfaces(self)
return nil
end
function proto.contains_interface(self, ifname)
return (netmod:ifnameof(ifc) == self:ifname())
end
netmod:register_pattern_virtual("^%s-%%w" % p)
end
|
addIcon("dancing", {outfit={mount=0,feet=0,legs=0,body=176,type=128,auxType=0,addons=3,head=48}, hotkey=nil, text="dance"}, macro(80, "", function()
turn(0)
schedule(20, function() turn(1) end)
schedule(40, function() turn(2) end)
schedule(60, function() turn(3) end)
end))
addIcon("Random Outfit", {outfit={mount=0,feet=math.random(0, 133),legs=math.random(0, 133),body=math.random(0, 133),type=128,auxType=0,addons=3,head=math.random(0, 133)}, hotkey=nil, text="ROut"}, macro(20, "", nil, function()
local outfit = outfit() math.random(0, 133)
outfit.head = math.random(0, 133)
outfit.body = math.random(0, 133)
outfit.legs = math.random(0, 133)
outfit.feet = math.random(0, 133)
--outfit.addons = math.random(0, 3)
setOutfit(outfit);
end))
--[[
addIcon("ctrl", {outfit={mount=0,feet=10,legs=10,body=176,type=129,auxType=0,addons=3,head=48}, text="press ctrl to move icon"}, function(widget, enabled)
if enabled then
info("icon on")
else
info("icon off")
end
end)
addIcon("mount", {outfit={mount=848,feet=10,legs=10,body=176,type=129,auxType=0,addons=3,head=48}}, function(widget, enabled)
if enabled then
info("icon mount on")
else
info("icon mount off")
end
end)
addIcon("mount 2", {outfit={mount=849,feet=10,legs=10,body=176,type=140,auxType=0,addons=3,head=48}, switchable=false}, function(widget, enabled)
info("icon mount 2 pressed")
end)
addIcon("item", {item=3380, hotkey="", switchable=false}, function(widget, enabled)
info("icon clicked")
end)
addIcon("item2", {item={id=3043, count=100}, switchable=true}, function(widget, enabled)
info("icon 2 clicked")
end)
addIcon("text", {text="text\nonly\nicon", switchable=true}, function(widget, enabled)
info("icon with text clicked")
end)
]]
|
local register = 1
local constant = 2
local register_or_constant = 3
local upval = 4
local bool = 5
local floating_byte = 6
local jump_pc_offset = 7
local other = 8
local param_types = {
register = register,
constant = constant,
register_or_constant = register_or_constant,
upval = upval,
bool = bool,
floating_byte = floating_byte,
jump_pc_offset = jump_pc_offset,
other = other,
}
local function if_not_zero_reduce_by(amount)
return {reduce_if_not_zero = amount}
end
local next_id = 0
local opcodes = {}
local opcodes_by_id = {}
local function op(name, params, special)
local reduce_if_not_zero = {}
local conditional = {}
local next_op = special and special.next
if special then
special.next = nil
end
for k, v in pairs(special or {}) do
if type(v) == "table" then
if v.reduce_if_not_zero then
reduce_if_not_zero[k] = v.reduce_if_not_zero
elseif v.condition then
conditional[k] = v.condition
end
end
end
local opcode = {
id = next_id,
name = name,
params = params,
reduce_if_not_zero = reduce_if_not_zero,
conditional = conditional,
next_op = next_op,
}
opcodes[name] = opcode
opcodes_by_id[next_id] = opcode
next_id = next_id + 1
end
op("move", {a = register, b = register})
op("loadk", {a = register, bx = constant})
op("loadkx", {a = register, next = {name = "extraarg", ax = constant}})
op("loadbool", {a = register, b = bool, c = bool})
op("loadnil", {a = register, b = other})
op("getupval", {a = register, b = upval})
op("gettabup", {a = register, b = upval, c = register_or_constant})
op("gettable", {a = register, b = register, c = register_or_constant})
op("settabup", {a = upval, b = register_or_constant, c = register_or_constant})
op("setupval", {a = register, b = upval})
op("settable", {a = register, b = register_or_constant, c = register_or_constant})
op("newtable", {a = register, b = floating_byte, c = floating_byte})
op("self", {a = register, b = register, c = register_or_constant})
op("add", {a = register, b = register_or_constant, c = register_or_constant})
op("sub", {a = register, b = register_or_constant, c = register_or_constant})
op("mul", {a = register, b = register_or_constant, c = register_or_constant})
op("div", {a = register, b = register_or_constant, c = register_or_constant})
op("mod", {a = register, b = register_or_constant, c = register_or_constant})
op("pow", {a = register, b = register_or_constant, c = register_or_constant})
op("unm", {a = register, b = register_or_constant})
op("not", {a = register, b = register_or_constant})
op("len", {a = register, b = register_or_constant})
op("concat", {a = register, b = register, c = register})
op("jmp", {a = register, sbx = jump_pc_offset}, {a = if_not_zero_reduce_by(1)})
op("eq", {a = bool, b = register_or_constant, c = register_or_constant})
op("lt", {a = bool, b = register_or_constant, c = register_or_constant})
op("le", {a = bool, b = register_or_constant, c = register_or_constant})
op("test", {a = register, c = bool})
op("testset", {a = register, b = register, c = bool})
op("call", {a = register, b = other, c = other}, {b = if_not_zero_reduce_by(1), c = if_not_zero_reduce_by(1)})
op("tailcall", {a = register, b = other}, {b = if_not_zero_reduce_by(1)})
op("return", {a = register, b = other},
{a = {condition = function(opcode) return opcode.b > 0 end}, b = if_not_zero_reduce_by(1)}
)
op("forloop", {a = register, sbx = jump_pc_offset})
op("forprep", {a = register, sbx = jump_pc_offset})
op("tforcall", {a = register, c = other})
op("tforloop", {a = register, sbx = jump_pc_offset})
op("setlist", {a = register, b = other, c = other},
{next = {"extraarg", condition = function(opcode) return opcode.c == 0 end, ax = other}}
)
op("closure", {a = register, bx = other})
op("vararg", {a = register, b = other}, {b = if_not_zero_reduce_by(2)})
op("extraarg", {ax = other})
return {
param_types = param_types,
opcodes = opcodes,
opcodes_by_id = opcodes_by_id,
}
|
if (SERVER) then
AddCSLuaFile( "shared.lua" )
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
end
if ( CLIENT ) then
SWEP.DrawAmmo = true
SWEP.DrawCrosshair = false
SWEP.ViewModelFOV = 82
SWEP.ViewModelFlip = false
SWEP.CSMuzzleFlashes = false
SWEP.BounceWeaponIcon = false
end
SWEP.Author = "Syntax_Error752"
SWEP.Contact = ""
SWEP.Purpose = "To eradicate the disease that is our enemy"
SWEP.Instructions = ""
//SWEP.Category = "TFA Star Wars"
SWEP.Spawnable = false
SWEP.AdminSpawnable = false
SWEP.Primary.Recoil = 0.5
SWEP.Primary.Damage = 50
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0.0125
SWEP.Primary.Delay = 0.175
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Primary.Tracer = "effect_sw_laser_red"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
/*---------------------------------------------------------
---------------------------------------------------------*/
function SWEP:Initialize()
if ( SERVER ) then
self:SetNPCMinBurst( 30 )
self:SetNPCMaxBurst( 30 )
self:SetNPCFireRate( 0.01 )
end
self:SetWeaponHoldType( self.HoldType )
self.Weapon:SetNetworkedBool( "Ironsights", false )
end
/*---------------------------------------------------------
Think does nothing
---------------------------------------------------------*/
function SWEP:Think()
end
/*---------------------------------------------------------
Checks the objects before any action is taken
This is to make sure that the entities haven't been removed
---------------------------------------------------------*/
//function SWEP:DrawWeaponSelection( x, y, wide, tall, alpha )
//draw.SimpleText( self.IconLetter, "DODSelectIcons", x + wide/2, y + tall*0.2, Color( 255, 210, 0, 255 ), TEXT_ALIGN_CENTER )
// try to fool them into thinking they're playing a Tony Hawks game
//draw.SimpleText( self.IconLetter, "DODSelectIcons", x + wide/2 + math.Rand(-4, 4), y + tall*0.2+ math.Rand(-14, 14), Color( 255, 210, 0, math.Rand(10, 120) ), TEXT_ALIGN_CENTER )
//draw.SimpleText( self.IconLetter, "DODSelectIcons", x + wide/2 + math.Rand(-4, 4), y + tall*0.2+ math.Rand(-9, 9), Color( 255, 210, 0, math.Rand(10, 120) ), TEXT_ALIGN_CENTER )
//end
local IRONSIGHT_TIME = 0.25
/*---------------------------------------------------------
Name: GetViewModelPosition
Desc: Allows you to re-position the view model
---------------------------------------------------------*/
function SWEP:GetViewModelPosition( pos, ang )
if ( !self.IronSightsPos ) then return pos, ang end
local bIron = self.Weapon:GetNetworkedBool( "Ironsights" )
if ( bIron != self.bLastIron ) then
self.bLastIron = bIron
self.fIronTime = CurTime()
if ( bIron ) then
self.SwayScale = 0.3
self.BobScale = 0.1
else
self.SwayScale = 1.0
self.BobScale = 1.0
end
end
local fIronTime = self.fIronTime or 0
if ( !bIron && fIronTime < CurTime() - IRONSIGHT_TIME ) then
return pos, ang
end
local Mul = 1.0
if ( fIronTime > CurTime() - IRONSIGHT_TIME ) then
Mul = math.Clamp( (CurTime() - fIronTime) / IRONSIGHT_TIME, 0, 1 )
if (!bIron) then Mul = 1 - Mul end
end
local Offset = self.IronSightsPos
if ( self.IronSightsAng ) then
ang = ang * 1
ang:RotateAroundAxis( ang:Right(), self.IronSightsAng.x * Mul )
ang:RotateAroundAxis( ang:Up(), self.IronSightsAng.y * Mul )
ang:RotateAroundAxis( ang:Forward(), self.IronSightsAng.z * Mul )
end
local Right = ang:Right()
local Up = ang:Up()
local Forward = ang:Forward()
pos = pos + Offset.x * Right * Mul
pos = pos + Offset.y * Forward * Mul
pos = pos + Offset.z * Up * Mul
return pos, ang
end
/*---------------------------------------------------------
SetIronsights
---------------------------------------------------------*/
function SWEP:SetIronsights( b )
self.Weapon:SetNetworkedBool( "Ironsights", b )
end
SWEP.NextSecondaryAttack = 0
/*---------------------------------------------------------
SecondaryAttack
---------------------------------------------------------*/
function SWEP:SecondaryAttack()
if ( !self.IronSightsPos ) then return end
if ( self.NextSecondaryAttack > CurTime() ) then return end
bIronsights = !self.Weapon:GetNetworkedBool( "Ironsights", false )
self:SetIronsights( bIronsights )
self.NextSecondaryAttack = CurTime() + 0.3
end
/*---------------------------------------------------------
DrawHUD
Just a rough mock up showing how to draw your own crosshair.
---------------------------------------------------------*/
function SWEP:DrawHUD()
// No crosshair when ironsights is on
if ( self.Weapon:GetNetworkedBool( "Ironsights" ) ) then return end
local x, y
// If we're drawing the local player, draw the crosshair where they're aiming,
// instead of in the center of the screen.
if ( self.Owner == LocalPlayer() && self.Owner:ShouldDrawLocalPlayer() ) then
local tr = util.GetPlayerTrace( self.Owner )
// tr.mask = ( CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEBRIS|CONTENTS_GRATE|CONTENTS_AUX )
local trace = util.TraceLine( tr )
local coords = trace.HitPos:ToScreen()
x, y = coords.x, coords.y
else
x, y = ScrW() / 2.0, ScrH() / 2.0
end
local scale = 10 * self.Primary.Cone
// Scale the size of the crosshair according to how long ago we fired our weapon
local LastShootTime = self.Weapon:GetNetworkedFloat( "LastShootTime", 0 )
scale = scale * (2 - math.Clamp( (CurTime() - LastShootTime) * 5, 0.0, 1.0 ))
surface.SetDrawColor( 255, 0, 0, 255 )
// Draw an awesome crosshair
local gap = 40 * scale
local length = gap + 20 * scale
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
end
/*---------------------------------------------------------
onRestore
Loaded a saved game (or changelevel)
---------------------------------------------------------*/
function SWEP:OnRestore()
self.NextSecondaryAttack = 0
self:SetIronsights( false )
end
function SWEP:DoImpactEffect( tr, dmgtype )
if( tr.HitSky ) then return true; end
util.Decal( "fadingscorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal );
if( game.SinglePlayer() or SERVER or not self:IsCarriedByLocalPlayer() or IsFirstTimePredicted() ) then
local effect = EffectData();
effect:SetOrigin( tr.HitPos );
effect:SetNormal( tr.HitNormal );
util.Effect( "effect_sw_impact", effect );
local effect = EffectData();
effect:SetOrigin( tr.HitPos );
effect:SetStart( tr.StartPos );
effect:SetDamageType( dmgtype );
util.Effect( "RagdollImpact", effect );
end
return true;
end
|
return PlaceObj("ModDef", {
"title", "Disable Achievements",
"id", "ChoGGi_DisableAchievements",
"steam_id", "1461207873",
"pops_any_uuid", "28dfa6d1-4f1f-460d-b2db-676a56bafb13",
"lua_revision", 1007000, -- Picard
"version", 2,
"version_major", 0,
"version_minor", 2,
"author", "ChoGGi",
"code", {
"Code/Script.lua",
},
"image", "Preview.png",
"description", [[Stops you from being able to unlock any Steam achievements.
This isn't permanent, you can disable this anytime to have them working again.
Requested by: I know someone did, but I forgot who...]],
})
|
Config = {}
Config.DrawDistance = 100.0
--language currently available EN and SV
Config.Locale = 'en'
Config.Zones = {
PoliceDuty = {
Pos = { x = 442.5, y = -982.1, z = 29.600 },
Size = { x = 1.5, y = 1.5, z = 1.5 },
Color = { r = 0, g = 0, b = 255 },
Type = 27,
},
AmbulanceDuty = {
Pos = { x = 264.45, y = -1356.84, z = 23.56 },
Size = { x = 2.5, y = 2.5, z = 1.5 },
Color = { r = 0, g = 255, b = 0 },
Type = 27,
},
}
-- Don't tough anything aboce this line, it shoudn't mess anything up, but we don't need it.
-- Name of target system you use can be qtarget or bt-target
Config.TargetName = "qtarget"
|
print '-- basics'
-- reused in following tests
_G.simple = {
['nil'] = nil,
['boolean'] = true,
['number'] = 253,
['string'] = 'and my head is my only house unless it rains.',
['empty-table'] = {},
['simple-array'] = {1, 2, 3, 4, 5},
['simple-dict'] = {a=1, b=2, c=3},
['function'] = function()end,
['thread'] = {__type='thread'},
['userdata'] = {__type='userdata'},
}
test('emtpy table', function()
assert_str_equal(pprint.pformat({}), '{}')
end)
test('single element dict', function()
assert_str_equal(pprint.pformat({a=2}),
[[{
a = 2
}]])
end)
test('simple with default settings', function()
assert_str_equal(pprint.pformat(simple), [[
{
boolean = true,
['empty-table'] = {},
number = 253,
['simple-array'] = { 1, 2, 3, 4, 5 },
['simple-dict'] = {
a = 1,
b = 2,
c = 3
},
string = 'and my head is my only house unless it rains.'
}
]])
end)
test('simple show_all', function()
assert_str_equal(pprint.pformat(simple, {show_all = true}), [===[
{
boolean = true,
['empty-table'] = {},
function = [[function 1]],
number = 253,
['simple-array'] = { 1, 2, 3, 4, 5 },
['simple-dict'] = {
a = 1,
b = 2,
c = 3
},
string = 'and my head is my only house unless it rains.',
thread = [[thread 1]],
userdata = [[userdata 1]]
}
]===])
end)
-- '[['' and ']] can't be wraped in between
test('wrap strings', function()
assert_str_equal(
pprint.pformat(
'these are my twisted words.',
{level_width = 10, wrap_string = true}
),
[==[[[these ar
e my twist
ed words.
]]]==])
end)
test('show custom type as table', function()
local t = {1, 2, 3, 4, 5, __type = 'moon' }
assert_str_equal(type(t), 'moon')
assert_str_equal(
pprint.pformat(t),
[[
{ 1, 2, 3, 4, 5,
__type = 'moon'
}
]]
)
end)
test('simple nested table', function()
local empty = {}
local t = {a=empty, b=empty, c=empty}
assert_str_equal(pprint.pformat(t),
[===[
{
a = { --[[table 2]] },
b = [[table 2]],
c = [[table 2]]
}
]===])
end)
-- _G should be complex enough
test('eval pformat _G', function()
local s = loadstring('return '..pprint.pformat(s, {show_all = true}))()
end)
test('identify hash key', function()
local t = {1, 2, 3, [5] = 5}
assert_str_equal(pprint.pformat(t),
[===[
{ 1, 2, 3,
[5] = 5
}
]===])
end)
|
if pcall(require, 'lldebugger') then
require('lldebugger').start()
end
local rect = {0, 0, 64, 64}
function love.update(dt)
rect[1] = rect[1] + 10 * dt
rect[2] = rect[2] + 10 * dt
end
function love.draw()
love.graphics.rectangle('fill', rect[1], rect[2], rect[3], rect[4])
end
function love.keypressed()
love.event.quit()
end
|
animationguiline = class:new()
animationlist = {}
local toenter = {}
--TRIGGERS:
table.insert(toenter, {name = "mapload",
t = {
t="trigger",
nicename="on map load",
entries={
}
}
})
table.insert(toenter, {name = "animationtrigger",
t = {
t="trigger",
nicename="animation trigger",
entries={
{
t="text",
value="with id",
},
{
t="input",
default="myanim",
},
}
}
})
table.insert(toenter, {name = "timepassed",
t = {
t="trigger",
nicename="after seconds:",
entries={
{
t="numinput",
default="1"
},
}
}
})
table.insert(toenter, {name = "playerxgreater",
t = {
t="trigger",
nicename="player's x position >",
entries={
{
t="numinput"
},
}
}
})
table.insert(toenter, {name = "playerxless",
t = {
t="trigger",
nicename="player's x position <",
entries={
{
t="numinput"
},
}
}
})
table.insert(toenter, {name = "playerygreater",
t = {
t="trigger",
nicename="player's y position >",
entries={
{
t="numinput"
},
}
}
})
table.insert(toenter, {name = "playeryless",
t = {
t="trigger",
nicename="player's y position <",
entries={
{
t="numinput"
},
}
}
})
table.insert(toenter, {name = "mariotimeless",
t = {
t="trigger",
nicename="time below:",
entries={
{
t="numinput"
},
}
}
})
table.insert(toenter, {name = "buttonpressed",
t= {
t="trigger",
nicename="button pressed:",
entries={
{
t="buttonselection",
},
{
t="text",
value="by"
},
{
t="playerselectionany",
},
}
}
})
table.insert(toenter, {name = "buttonreleased",
t= {
t="trigger",
nicename="button released:",
entries={
{
t="buttonselection",
},
{
t="text",
value="by"
},
{
t="playerselectionany",
},
}
}
})
table.insert(toenter, {name = "pswitchtrigger",
t= {
t="trigger",
nicename="pBswitch triggered:",
entries={
{
t="text",
value="when switch is"
},
{
t="powerselection",
},
}
}
})
table.insert(toenter, {name = "switchblocktrigger",
t= {
t="trigger",
nicename="switch block triggered:",
entries={
{
t="text",
value="with color"
},
{
t="switchblockselection",
},
}
}
})
table.insert(toenter, {name = "playerlandsonground",
t= {
t="trigger",
nicename="player lands on ground:",
entries={
{
t="text",
value="player"
},
{
t="playerselectionany",
},
}
}
})
table.insert(toenter, {name = "playerhurt",
t= {
t="trigger",
nicename="player is hurt:",
entries={
{
t="text",
value="player:"
},
{
t="playerselectionany",
},
}
}
})
table.insert(toenter, {name = "whennumber",
t= {
t="trigger",
nicename="when number:",
entries={
{
t="text",
value="name",
},
{
t="input",
},
{
t="comparisonselection",
},
{
t="numinput",
},
}
}
})
--CONDITIONS:
table.insert(toenter, {name = "noprevsublevel",
t = {
t="condition",
nicename="map started here",
entries={
}
}
})
table.insert(toenter, {name = "worldequals",
t = {
t="condition",
nicename="world is number",
entries={
{
t="numinput",
default="1"
},
}
}
})
table.insert(toenter, {name = "levelequals",
t = {
t="condition",
nicename="level is number",
entries={
{
t="numinput",
default="1"
},
}
}
})
table.insert(toenter, {name = "sublevelequals",
t= {
t="condition",
nicename="sublevel is number",
entries={
{
t="sublevelselection",
}
}
}
})
table.insert(toenter, {name = "requirecoins",
t= {
t="condition",
nicename="require coins",
entries={
{
t="numinput",
}
}
}
})
table.insert(toenter, {name = "requirepoints",
t= {
t="condition",
nicename="require points",
entries={
{
t="numinput",
}
}
}
})
table.insert(toenter, {name = "requirecollectables",
t= {
t="condition",
nicename="require collectables",
entries={
{
t="numinput",
},
{
t="text",
value="type",
},
{
t="collectableselection",
}
}
}
})
table.insert(toenter, {name = "requirekeys",
t= {
t="condition",
nicename="require keys",
entries={
{
t="numinput",
},
{
t="text",
value="from"
},
{
t="playerselectionany",
},
}
}
})
table.insert(toenter, {name = "playerissize",
t = {
t="condition",
nicename="player is size",
entries={
{
t="powerupselection",
},
{
t="playerselectionany",
},
}
}
})
table.insert(toenter, {name = "buttonhelddown",
t= {
t="condition",
nicename="button held down:",
entries={
{
t="buttonselection",
},
{
t="text",
value="by"
},
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "ifnumber",
t= {
t="condition",
nicename="if number:",
entries={
{
t="text",
value="name",
},
{
t="input",
},
{
t="comparisonselection",
},
{
t="numinput",
},
}
}
})
--ACTIONS:
table.insert(toenter, {name = "disablecontrols",
t = {
t="action",
nicename="disable controls",
entries={
{
t="text",
value="of"
},
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "enablecontrols",
t = {
t="action",
nicename="enable controls",
entries={
{
t="text",
value="of"
},
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "sleep",
t = {
t="action",
nicename="sleep/wait",
entries={
{
t="numinput",
default="1",
},
{
t="text",
value="seconds",
},
}
}
})
table.insert(toenter, {name = "setcamerax",
t = {
t="action",
nicename="set camera to x:",
entries={
{
t="numinput",
},
}
}
})
table.insert(toenter, {name = "setcameray",
t = {
t="action",
nicename="set camera to y:",
entries={
{
t="numinput",
},
}
}
})
table.insert(toenter, {name = "pancameratox",
t = {
t="action",
nicename="pan camera to x:",
entries={
{
t="numinput",
},
{
t="text",
value="over",
},
{
t="numinput",
},
{
t="text",
value="seconds",
}
}
}
})
table.insert(toenter, {name = "pancameratoy",
t = {
t="action",
nicename="pan camera to y:",
entries={
{
t="numinput",
},
{
t="text",
value="over",
},
{
t="numinput",
},
{
t="text",
value="seconds",
}
}
}
})
table.insert(toenter, {name = "pancamera",
t = {
t="action",
nicename="pan camera:",
entries={
{
t="text",
value="hor:",
},
{
t="numinput",
},
{
t="text",
value="ver:",
},
{
t="numinput",
},
{
t="text",
value="over",
},
{
t="numinput",
},
{
t="text",
value="seconds",
}
}
}
})
table.insert(toenter, {name = "disablescroll",
t = {
t="action",
nicename="disable scrolling",
entries={
}
}
})
table.insert(toenter, {name = "disableverscroll",
t = {
t="action",
nicename="disable y scrolling",
entries={
}
}
})
table.insert(toenter, {name = "disablehorscroll",
t = {
t="action",
nicename="disable x scrolling",
entries={
}
}
})
table.insert(toenter, {name = "enablescroll",
t = {
t="action",
nicename="enable scrolling",
entries={
}
}
})
table.insert(toenter, {name = "enableverscroll",
t = {
t="action",
nicename="enable y scrolling",
entries={
}
}
})
table.insert(toenter, {name = "enablehorscroll",
t = {
t="action",
nicename="enable x scrolling",
entries={
}
}
})
table.insert(toenter, {name = "setx",
t = {
t="action",
nicename="move player to x:",
entries={
{
t="playerselection"
},
{
t="text",
value="to x=",
},
{
t="numinput"
}
}
}
})
table.insert(toenter, {name = "sety",
t = {
t="action",
nicename="move player to y:",
entries={
{
t="playerselection"
},
{
t="text",
value="to y=",
},
{
t="numinput"
}
}
}
})
table.insert(toenter, {name = "playerwalk",
t = {
t="action",
nicename="animate to walk:",
entries={
{
t="playerselection",
},
{
t="text",
value="towards"
},
{
t="directionselection",
},
{
t="text",
value="speed",
},
{
t="walkspeedselection",
},
}
}
})
table.insert(toenter, {name = "playeranimationstop",
t = {
t="action",
nicename="stop playeranimations:",
entries={
{
t="playerselection",
}
}
}
})
table.insert(toenter, {name = "disableanimation",
t = {
t="action",
nicename="disable this animation",
entries={
}
}
})
table.insert(toenter, {name = "enableanimation",
t = {
t="action",
nicename="enable this anim",
entries={
}
}
})
table.insert(toenter, {name = "playerjump",
t = {
t="action",
nicename="make jump:",
entries={
{
t="playerselection",
}
}
}
})
table.insert(toenter, {name = "playerstopjump",
t = {
t="action",
nicename="stop jumping:",
entries={
{
t="playerselection",
}
}
}
})
table.insert(toenter, {name = "dialogbox",
t = {
t="action",
nicename="create dialog",
entries={
{
t="text",
value="with text"
},
{
t="input",
length=192
},
{
t="text",
value="and speaker"
},
{
t="input"
},
{
t="text",
value="color"
},
{
t="colorselection"
},
}
}
})
table.insert(toenter, {name = "removedialogbox",
t = {
t="action",
nicename="destroy dialogs",
entries={
}
}
})
table.insert(toenter, {name = "playmusic",
t = {
t="action",
nicename="play music",
entries={
{
t="musicselection"
}
}
}
})
table.insert(toenter, {name = "playsound",
t = {
t="action",
nicename="play sound",
entries={
{
t="soundselection"
}
}
}
})
table.insert(toenter, {name = "stopsound",
t = {
t="action",
nicename="stop sound",
entries={
{
t="soundselection"
}
}
}
})
table.insert(toenter, {name = "stopsounds",
t = {
t="action",
nicename="stop all sounds",
entries={
}
}
})
table.insert(toenter, {name = "screenshake",
t = {
t="action",
nicename="shake the screen",
entries={
{
t="text",
value="with"
},
{
t="numinput",
},
{
t="text",
value="force",
}
}
}
})
table.insert(toenter, {name = "addcoins",
t = {
t="action",
nicename="add coins",
entries={
{
t="numinput",
default="1"
},
{
t="text",
value="coins"
}
}
}
})
table.insert(toenter, {name = "addpoints",
t = {
t="action",
nicename="add points",
entries={
{
t="numinput",
default="1"
},
{
t="text",
value="points"
}
}
}
})
table.insert(toenter, {name = "removepoints",
t = {
t="action",
nicename="remove points",
entries={
{
t="numinput",
default="1"
},
{
t="text",
value="points"
}
}
}
})
table.insert(toenter, {name = "addtime",
t = {
t="action",
nicename="add time",
entries={
{
t="numinput",
default="100"
},
{
t="text",
value="seconds"
}
}
}
})
table.insert(toenter, {name = "removetime",
t = {
t="action",
nicename="remove time",
entries={
{
t="numinput",
default="100"
},
{
t="text",
value="seconds"
}
}
}
})
table.insert(toenter, {name = "settime",
t = {
t="action",
nicename="set time",
entries={
{
t="numinput",
default="100"
},
{
t="text",
value="seconds"
}
}
}
})
table.insert(toenter, {name = "changebackgroundcolor",
t = {
t="action",
nicename="change background color",
entries={
{
t="text",
value="to r"
},
{
t="numinput",
default="255"
},
{
t="text",
value="g"
},
{
t="numinput",
default="255"
},
{
t="text",
value="b"
},
{
t="numinput",
default="255"
},
}
}
})
table.insert(toenter, {name = "killplayer",
t = {
t="action",
nicename="hurt player:",
entries={
{
t="playerselection",
}
}
}
})
table.insert(toenter, {name = "instantkillplayer",
t = {
t="action",
nicename="kill player:",
entries={
{
t="playerselection",
}
}
}
})
table.insert(toenter, {name = "changetime",
t = {
t="action",
nicename="change time left",
entries={
{
t="text",
value="to"
},
{
t="numinput",
default="400"
}
}
}
})
table.insert(toenter, {name = "loadlevel",
t = {
t="action",
nicename="load level:",
entries={
{
t="text",
value="world"
},
{
t="numinput",
default="1"
},
{
t="text",
value="level"
},
{
t="numinput",
default="1"
},
{
t="text",
value="sublevel"
},
{
t="numinputshort",
default="0"
},
{
t="text",
value="exit:"
},
{
t="exitidselection"
}
}
}
})
table.insert(toenter, {name = "loadlevelinstant",
t = {
t="action",
nicename="load level instantly:",
entries={
{
t="text",
value="world"
},
{
t="numinput",
default="1"
},
{
t="text",
value="level"
},
{
t="numinput",
default="1"
},
{
t="text",
value="sublevel"
},
{
t="numinputshort",
default="0"
},
{
t="text",
value="exit:"
},
{
t="exitidselection"
}
}
}
})
table.insert(toenter, {name = "nextlevel",
t = {
t="action",
nicename="next level",
entries={
}
}
})
table.insert(toenter, {name = "disableplayeraim",
t = {
t="action",
nicename="disable aiming",
entries={
{
t="text",
value="of"
},
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "enableplayeraim",
t = {
t="action",
nicename="enable aiming",
entries={
{
t="text",
value="of"
},
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "closeportals",
t = {
t="action",
nicename="close portals",
entries={
{
t="text",
value="of"
},
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "makeplayerlook",
t = {
t="action",
nicename="make player aim to deg",
entries={
{
t="playerselection",
},
{
t="text",
value="to"
},
{
t="numinput",
},
{
t="text",
value="degrees"
},
}
}
})
table.insert(toenter, {name = "makeplayerfireportal",
t = {
t="action",
nicename="make fire portal:",
entries={
{
t="text",
value="player"
},
{
t="playerselection",
},
{
t="text",
value="portal #"
},
{
t="numinput",
default="1"
},
}
}
})
table.insert(toenter, {name = "disableportalgun",
t = {
t="action",
nicename="disable portal gun of",
entries={
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "enableportalgun",
t = {
t="action",
nicename="enable portal gun of",
entries={
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "changebackground",
t = {
t="action",
nicename="change background",
entries={
{
t="backgroundselection"
}
}
}
})
table.insert(toenter, {name = "changeforeground",
t = {
t="action",
nicename="change foreground",
entries={
{
t="backgroundselection"
}
}
}
})
table.insert(toenter, {name = "removecoins",
t = {
t="action",
nicename="remove coins",
entries={
{
t="numinput",
default="1"
},
{
t="text",
value="coins"
}
}
}
})
table.insert(toenter, {name = "removecollectables",
t = {
t="action",
nicename="remove collectables",
entries={
{
t="numinput",
default="1"
},
{
t="text",
value="type",
},
{
t="collectableselection",
}
}
}
})
table.insert(toenter, {name = "addcollectables",
t = {
t="action",
nicename="add collectables",
entries={
{
t="numinput",
default="1"
},
{
t="text",
value="type",
},
{
t="collectableselection",
}
}
}
})
table.insert(toenter, {name = "addkeys",
t= {
t="action",
nicename="add keys",
entries={
{
t="numinput",
},
{
t="text",
value="to"
},
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "removekeys",
t= {
t="action",
nicename="remove keys",
entries={
{
t="numinput",
},
{
t="text",
value="from"
},
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "resetcollectables",
t = {
t="action",
nicename="reset collectables",
entries={
{
t="text",
value="type",
},
{
t="collectableselection",
}
}
}
})
table.insert(toenter, {name = "setautoscrolling",
t = {
t="action",
nicename="set autoscrolling:",
entries={
{
t="text",
value="to x speed",
},
{
t="numinput",
default="3",
},
{
t="text",
value="to y speed",
},
{
t="numinput",
default="2",
}
}
}
})
table.insert(toenter, {name = "stopautoscrolling",
t = {
t="action",
nicename="stop autoscrolling",
entries={
}
}
})
table.insert(toenter, {name = "togglewind",
t = {
t="action",
nicename="set wind",
entries={
{
t="text",
value="to speed",
},
{
t="numinput",
default="1",
}
}
}
})
table.insert(toenter, {name = "togglelowgravity",
t = {
t="action",
nicename="toggle low gravity",
entries={
}
}
})
table.insert(toenter, {name = "togglelightsout",
t = {
t="action",
nicename="toggle lights out",
entries={
}
}
})
table.insert(toenter, {name = "centercamera",
t = {
t="action",
nicename="center camera",
entries={
}
}
})
table.insert(toenter, {name = "repeat",
t = {
t="action",
nicename="repeat",
entries={
}
}
})
table.insert(toenter, {name = "removeshoe",
t = {
t="action",
nicename="remove shoe:",
entries={
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "removehelmet",
t = {
t="action",
nicename="remove helmet:",
entries={
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "animationoutput",
t = {
t="action",
nicename="animation output:",
entries={
{
t="text",
value="with id",
},
{
t="input",
default="myanim",
},
{
t="text",
value="send signal:",
},
{
t="signalselection",
},
}
}
})
table.insert(toenter, {name = "triggeranimation",
t = {
t="action",
nicename="animation trigger:",
entries={
{
t="text",
value="with id",
},
{
t="input",
default="myanim",
},
}
}
})
table.insert(toenter, {name = "transformenemy",
t = {
t="action",
nicename="transform enemy:",
entries={
{
t="text",
value="with \"transformanimation\":",
},
{
t="input",
default="",
},
}
}
})
table.insert(toenter, {name = "killallenemies",
t = {
t="action",
nicename="kill all enemies",
entries={
}
}
})
table.insert(toenter, {name = "setplayersize",
t = {
t="action",
nicename="make player grow:",
entries={
{
t="powerupselection",
},
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "disablejumping",
t = {
t="action",
nicename="disable jumping",
entries={
{
t="text",
value="for"
},
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "enablejumping",
t = {
t="action",
nicename="enable jumping",
entries={
{
t="text",
value="for"
},
{
t="playerselection",
},
}
}
})
table.insert(toenter, {name = "setnumber",
t= {
t="action",
nicename="set number:",
entries={
{
t="text",
value="name",
},
{
t="input",
},
{
t="operationselection",
},
{
t="numinput",
},
}
}
})
table.insert(toenter, {name = "resetnumbers",
t= {
t="action",
nicename="reset numbers",
entries={
}
}
})
table.insert(toenter, {name = "launchplayer",
t = {
t="action",
nicename="launch player:",
entries={
{
t="playerselection",
},
{
t="text",
value="x speed",
},
{
t="numinput",
default="0",
},
{
t="text",
value="y speed",
},
{
t="numinput",
default="0",
}
}
}
})
table.insert(toenter, {name = "setplayerlight",
t = {
t="action",
nicename="set player light:",
entries={
{
t="numinput",
default="3.5",
},
}
}
})
--SORT ALPHABETICALLY (I didn't even know you could greater/less compare strings.)
table.sort(toenter, function(a, b) return a.t.nicename < b.t.nicename end)
local typelist = {"trigger", "condition", "action"}
local animationstrings = {}
for i = 1, #typelist do
animationstrings[typelist[i] ] = {}
end
for i, v in pairs(toenter) do
animationlist[v.name] = v.t
table.insert(animationstrings[v.t.t], v.t.nicename)
end
function animationguiline:init(tabl, t2)
self.t = tabl
self.type = t2
local x = 0
self.elements = {}
self.elements[1] = {}
local start = 1
for i = 1, #animationstrings[self.type] do
if animationlist[self.t[1]] and animationlist[self.t[1]].nicename == animationstrings[self.type][i] then
start = i
end
end
local firstwidth = 22--#animationstrings[self.type][start]
self.deletebutton = guielement:new("button", 0, 0, "x", function() self:delete() end, nil, nil, nil, 8, 0.1)
self.deletebutton.textcolor = {200, 0, 0}
self.downbutton = guielement:new("button", 0, 0, "↓", function() self:movedown() end, nil, nil, nil, 8, 0.1)
self.downbutton.textcolor = {255, 255, 255}
self.upbutton = guielement:new("button", 0, 0, "↑", function() self:moveup() end, nil, nil, nil, 8, 0.1)
self.upbutton.textcolor = {255, 255, 255}
self.elements[1].gui = guielement:new("dropdown", 0, 0, firstwidth, function(val) self:changemainthing(val) end, start, unpack(animationstrings[self.type]))
self.elements[1].width = 14+firstwidth*8
if not self.t[1] then
for i, v in pairs(animationlist) do
if v.nicename == animationstrings[self.type][1] then
self.t[1] = i
break
end
end
end
local tid = 1
if animationlist[self.t[1] ] then
for i, v in ipairs(animationlist[self.t[1] ].entries) do
local temp = {}
if v.t == "text" then
temp.t = "text"
temp.value = v.value
temp.width = #v.value*8
else
tid = tid + 1
local dropdown = false
local dropwidth
local args, displayargs
local coloredtext
if v.t == "input" then
local width = 15
local maxwidth = v.length or 30
temp.gui = guielement:new("input", 0, 0, width, nil, self.t[tid] or v.default or "", maxwidth, nil, nil, 0)
temp.gui.bypassspecialcharacters = true
temp.width = 4+width*8
elseif v.t == "numinput" or v.t == "numinputshort" then
local width = 5
if v.t == "numinputshort" then
width = 3
end
local maxwidth = 10
temp.gui = guielement:new("input", 0, 0, width, nil, self.t[tid] or v.default or "0", maxwidth, nil, true, 0)
temp.gui.bypassspecialcharacters = true
temp.width = 4+width*8
elseif v.t == "playerselection" then
dropdown = true
dropwidth = 8
args = {"everyone", "player 1", "player 2", "player 3", "player 4"}
elseif v.t == "playerselectionany" then
dropdown = true
dropwidth = 8
args = {"everyone", "player 1", "player 2", "player 3", "player 4"}
displayargs = {"anyone", "player 1", "player 2", "player 3", "player 4"}
elseif v.t == "worldselection" then
dropdown = true
dropwidth = 1
args = {"1", "2", "3", "4", "5", "6", "7", "8"}
elseif v.t == "levelselection" then
dropdown = true
dropwidth = 1
args = {"1", "2", "3", "4"}
elseif v.t == "sublevelselection" then
dropdown = true
dropwidth = 4
args = {"main"}
for k = 1, mappacklevels[marioworld][mariolevel] do
table.insert(args, tostring(k))
end
elseif v.t == "directionselection" then
dropdown = true
dropwidth = 5
args = {"right", "left"}
elseif v.t == "musicselection" then
dropdown = true
dropwidth = 15
args = {unpack(musictable)}
elseif v.t == "soundselection" then
dropdown = true
dropwidth = 15
args = {unpack(soundliststring)}
elseif v.t == "backgroundselection" then
dropdown = true
dropwidth = 10
args = {unpack(custombackgrounds)}
elseif v.t == "collectableselection" then
dropdown = true
dropwidth = 2
args = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}
elseif v.t == "buttonselection" then
dropdown = true
dropwidth = 7
args = {"jump", "run", "left", "right", "up", "down", "use", "reload"}
elseif v.t == "signalselection" then
dropdown = true
dropwidth = 7
args = {"toggle", "on", "off"}
elseif v.t == "powerselection" then
dropdown = true
dropwidth = 4
args = {"on", "off"}
elseif v.t == "switchblockselection" then
dropdown = true
dropwidth = 1
args = {"1", "2", "3", "4"}
elseif v.t == "exitidselection" then
dropdown = true
dropwidth = 2
args = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}
elseif v.t == "powerupselection" then
dropdown = true
dropwidth = 8
args = powerupslistids
displayargs = powerupslist
elseif v.t == "colorselection" then
dropdown = true
dropwidth = 7
args = {}
for i, v in pairs(textcolors) do
if i ~= "white" then
table.insert(args, i)
end
end
table.sort(args)
table.insert(args,1,"white")
coloredtext = true
elseif v.t == "walkspeedselection" then
dropdown = true
dropwidth = 5
args = {maxwalkspeed, maxrunspeed, 3}
displayargs = {"walk", "run", "slow"}
elseif v.t == "comparisonselection" then
dropdown = true
dropwidth = 2
args = {"=", ">", "<"}
displayargs = {"=", ">", "<"}
elseif v.t == "operationselection" then
dropdown = true
dropwidth = 2
args = {"=", "+", "-"}
displayargs = {"=", "+", "-"}
end
if dropdown then
local j = #self.elements+1
local starti = 1
for j, k in pairs(args) do
if self.t[tid] == k then
starti = j
end
end
temp.gui = guielement:new("dropdown", 0, 0, dropwidth, function(val) self:submenuchange(val, j) end, starti, unpack(args))
temp.gui.displayentries = displayargs
temp.width = dropwidth*8+14
if coloredtext then
temp.gui.coloredtext = true
end
end
end
table.insert(self.elements, temp)
end
end
end
function animationguiline:update(dt)
for i = 1, #self.elements do
if self.elements[i].gui then
self.elements[i].gui:update(dt)
end
end
self.downbutton:update(dt)
self.upbutton:update(dt)
end
function animationguiline:draw(x, y)
love.graphics.setColor(0, 0, 0)
love.graphics.rectangle("fill", x*scale, y*scale, (width*16-x)*scale, 11*scale)
love.graphics.setColor(255, 255, 255)
local xadd = 0
self.deletebutton.x = x+xadd
self.deletebutton.y = y
self.deletebutton:draw()
xadd = xadd + 10
self.downbutton.x = x+xadd
self.downbutton.y = y
self.downbutton:draw()
xadd = xadd + 10
self.upbutton.x = x+xadd
self.upbutton.y = y
self.upbutton:draw()
xadd = xadd + 12
for i = 1, #self.elements do
if self.elements[i].t == "text" then
love.graphics.setColor(255, 255, 255)
properprintF(self.elements[i].value, (x+xadd-1)*scale, (y+2)*scale)
xadd = xadd + self.elements[i].width
else
if not self.elements[i].gui.extended then
self.elements[i].gui.x = x+xadd
self.elements[i].gui.y = y
end
if self.elements[i].gui.scrollbar then
self.elements[i].gui.scrollbar.x = (self.elements[i].gui.width*8+13)+x+xadd
end
xadd = xadd + self.elements[i].width
end
end
end
function animationguiline:click(x, y, button)
if self.deletebutton:click(x, y, button) then
return true
end
if self.downbutton:click(x, y, button) then
return true
end
if self.upbutton:click(x, y, button) then
return true
end
local rettrue
local i = 1
while i <= #self.elements do
if self.elements[i].gui then
if self.elements[i].gui:click(x, y, button) then
rettrue = true
end
end
i = i + 1
end
return rettrue
end
function animationguiline:unclick(x, y, button)
self.downbutton:unclick(x, y, button)
self.upbutton:unclick(x, y, button)
local i = 1
while i <= #self.elements do
if self.elements[i].gui then
if self.elements[i].gui.unclick then
self.elements[i].gui:unclick(x, y, button)
end
end
i = i + 1
end
end
function animationguiline:delete()
deleteanimationguiline(self.type, self)
end
function animationguiline:moveup()
moveupanimationguiline(self.type, self)
end
function animationguiline:movedown()
movedownanimationguiline(self.type, self)
end
function animationguiline:keypressed(key, textinput)
for i = 1, #self.elements do
if self.elements[i].gui then
self.elements[i].gui:keypress(key, textinput)
end
end
end
function animationguiline:changemainthing(value)
local name
for i, v in pairs(animationlist) do
if v.nicename == animationstrings[self.type][value] then
name = i
end
end
self:init({name}, self.type)
end
function animationguiline:submenuchange(value, id)
self.elements[id].gui.var = value
end
function animationguiline:haspriority()
for i, v in pairs(self.elements) do
if v.gui then
if v.gui.priority then
return true
end
end
end
return false
end
|
module 'mock'
--------------------------------------------------------------------
CLASS: AnimatorValueTrack ( AnimatorTrack )
:MODEL{}
CLASS: AnimatorValueKey ( AnimatorKey )
:MODEL{}
--------------------------------------------------------------------
CLASS: AnimatorKeyNumber ( AnimatorValueKey )
:MODEL{
Field 'value' :number()
}
function AnimatorKeyNumber:__init()
self.length = 0
self.value = 0
end
function AnimatorKeyNumber:isResizable()
return false
end
function AnimatorKeyNumber:toString()
return tostring( self.value )
end
function AnimatorKeyNumber:setValue( v )
self.value = v
end
function AnimatorKeyNumber:getCurveValue()
return self.value
end
function AnimatorKeyNumber:setCurveValue( v )
return self:setValue( v )
end
--------------------------------------------------------------------
CLASS: AnimatorKeyInt ( AnimatorKeyNumber )
:MODEL{
Field 'value' :int()
}
local floor = math.floor
function AnimatorKeyInt:setValue( v )
self.value = floor(v)
end
--------------------------------------------------------------------
CLASS: AnimatorKeyBoolean ( AnimatorValueKey )
:MODEL{
Field 'tweenMode' :no_edit();
Field 'value' :boolean()
}
function AnimatorKeyBoolean:__init()
self.length = 0
self.value = true
self.tweenMode = 1 --constant
end
function AnimatorKeyBoolean:toString()
return tostring( self.value )
end
function AnimatorKeyBoolean:setValue( v )
self.value = v and true or false
end
function AnimatorKeyBoolean:getCurveValue()
return self.value and 1 or 0
end
--------------------------------------------------------------------
CLASS: AnimatorKeyString ( AnimatorValueKey )
:MODEL{
Field 'value' :string()
}
function AnimatorKeyString:__init()
self.length = 0
self.value = ''
self.tweenMode = 1 --constant
end
function AnimatorKeyString:isResizable()
return false
end
function AnimatorKeyString:toString()
return tostring( self.value )
end
function AnimatorKeyString:setValue( v )
self.value = v and tostring( v ) or ''
end
function AnimatorKeyString:getCurveValue()
return self.value and 1 or 0
end
|
return {
short_music_name = "song10",
bpm = 752,
offset_time = 0,
music_name = "bgm-song10",
left_track = {
{
begin_time = "1.196808",
key_flag = "K_LEFT",
end_time = "1.196808"
},
{
begin_time = "3.909575",
key_flag = "K_LEFT",
end_time = "3.909575"
},
{
begin_time = "6.462766",
key_flag = "K_LEFT",
end_time = "6.462766"
},
{
begin_time = "7.101064",
key_flag = "K_LEFT",
end_time = "7.101064"
},
{
begin_time = "7.739362",
key_flag = "K_LEFT",
end_time = "7.739362"
},
{
begin_time = "8.37766",
key_flag = "K_LEFT",
end_time = "8.37766"
},
{
begin_time = "10.6119",
key_flag = "K_LEFT",
end_time = "10.6119"
},
{
begin_time = "11.56915",
key_flag = "K_LEFT",
end_time = "11.56915"
},
{
begin_time = "12.84377",
key_flag = "K_LEFT",
end_time = "12.84377"
},
{
begin_time = "14.60204",
key_flag = "K_LEFT",
end_time = "14.60204"
},
{
begin_time = "15.23986",
key_flag = "K_LEFT",
end_time = "15.23986"
},
{
begin_time = "16.83511",
key_flag = "K_LEFT",
end_time = "16.83511"
},
{
begin_time = "20.02659",
key_flag = "K_LEFT",
end_time = "20.02659"
},
{
begin_time = "22.10106",
key_flag = "K_LEFT",
end_time = "22.10106"
},
{
begin_time = "24.65414",
key_flag = "K_LEFT",
end_time = "24.65414"
},
{
begin_time = "24.97449",
key_flag = "K_LEFT",
end_time = "24.97449"
},
{
begin_time = "25.93112",
key_flag = "K_LEFT",
end_time = "25.93112"
},
{
begin_time = "26.25185",
key_flag = "K_LEFT",
end_time = "26.25185"
},
{
begin_time = "27.36702",
key_flag = "K_LEFT",
end_time = "27.36702"
},
{
begin_time = "27.685",
key_flag = "K_LEFT",
end_time = "27.685"
},
{
begin_time = "28.1649",
key_flag = "K_LEFT",
end_time = "28.1649"
},
{
begin_time = "28.48404",
key_flag = "K_LEFT",
end_time = "28.48404"
},
{
begin_time = "30.55851",
key_flag = "K_LEFT",
end_time = "30.55851"
},
{
begin_time = "31.83511",
key_flag = "K_LEFT",
end_time = "31.83511"
},
{
begin_time = "32.46508",
key_flag = "K_LEFT",
end_time = "32.46508"
},
{
begin_time = "32.95213",
key_flag = "K_LEFT",
end_time = "32.95213"
},
{
begin_time = "33.59043",
key_flag = "K_LEFT",
end_time = "33.59043"
},
{
begin_time = "35.18617",
key_flag = "K_LEFT",
end_time = "35.18617"
},
{
begin_time = "35.82032",
key_flag = "K_LEFT",
end_time = "35.82032"
},
{
begin_time = "36.4669",
key_flag = "K_LEFT",
end_time = "36.4669"
},
{
begin_time = "37.10321",
key_flag = "K_LEFT",
end_time = "37.10321"
},
{
begin_time = "39.01596",
key_flag = "K_LEFT",
end_time = "39.01596"
},
{
begin_time = "40.77159",
key_flag = "K_LEFT",
end_time = "40.77159"
},
{
begin_time = "41.24578",
key_flag = "K_LEFT",
end_time = "41.24578"
},
{
begin_time = "42.20795",
key_flag = "K_LEFT",
end_time = "42.20795"
},
{
begin_time = "42.68373",
key_flag = "K_LEFT",
end_time = "42.68373"
},
{
begin_time = "43.48404",
key_flag = "K_LEFT",
end_time = "43.48404"
},
{
begin_time = "43.80319",
key_flag = "K_LEFT",
end_time = "43.80319"
},
{
begin_time = "44.12432",
key_flag = "K_LEFT",
end_time = "44.12432"
},
{
begin_time = "44.92148",
key_flag = "K_LEFT",
end_time = "44.92148"
},
{
begin_time = "45.87773",
key_flag = "K_LEFT",
end_time = "45.87773"
},
{
begin_time = "46.51596",
key_flag = "K_LEFT",
end_time = "46.51596"
},
{
begin_time = "46.99344",
key_flag = "K_LEFT",
end_time = "46.99344"
},
{
begin_time = "47.87234",
key_flag = "K_LEFT",
end_time = "47.87234"
},
{
begin_time = "48.43005",
key_flag = "K_LEFT",
end_time = "48.43005"
},
{
begin_time = "48.75",
key_flag = "K_LEFT",
end_time = "48.75"
},
{
begin_time = "49.70745",
key_flag = "K_LEFT",
end_time = "49.70745"
},
{
begin_time = "50.66381",
key_flag = "K_LEFT",
end_time = "50.66381"
},
{
begin_time = "50.98521",
key_flag = "K_LEFT",
end_time = "50.98521"
},
{
begin_time = "51.30298",
key_flag = "K_LEFT",
end_time = "51.30298"
},
{
begin_time = "53.37383",
key_flag = "K_LEFT",
end_time = "53.37383"
},
{
begin_time = "53.69932",
key_flag = "K_LEFT",
end_time = "53.69932"
},
{
begin_time = "54.01693",
key_flag = "K_LEFT",
end_time = "54.01693"
},
{
begin_time = "54.64902",
key_flag = "K_LEFT",
end_time = "54.64902"
},
{
begin_time = "55.93476",
key_flag = "K_LEFT",
end_time = "55.93476"
},
{
begin_time = "56.8883",
key_flag = "K_LEFT",
end_time = "56.8883"
},
{
begin_time = "58.16489",
key_flag = "K_LEFT",
end_time = "58.16489"
},
{
begin_time = "58.80442",
key_flag = "K_LEFT",
end_time = "58.80442"
},
{
begin_time = "59.76064",
key_flag = "K_LEFT",
end_time = "59.76064"
},
{
begin_time = "61.03787",
key_flag = "K_LEFT",
end_time = "61.03787"
},
{
begin_time = "61.67795",
key_flag = "K_LEFT",
end_time = "61.67795"
},
{
begin_time = "62.31481",
key_flag = "K_LEFT",
end_time = "62.31481"
},
{
begin_time = "62.95345",
key_flag = "K_LEFT",
end_time = "62.95345"
},
{
begin_time = "64.06596",
key_flag = "K_LEFT",
end_time = "64.06596"
},
{
begin_time = "65.82447",
key_flag = "K_LEFT",
end_time = "65.82447"
},
{
begin_time = "66.30267",
key_flag = "K_LEFT",
end_time = "66.30267"
},
{
begin_time = "66.77775",
key_flag = "K_LEFT",
end_time = "66.77775"
},
{
begin_time = "67.89753",
key_flag = "K_LEFT",
end_time = "67.89753"
},
{
begin_time = "68.22042",
key_flag = "K_LEFT",
end_time = "68.22042"
},
{
begin_time = "69.33511",
key_flag = "K_LEFT",
end_time = "69.33511"
},
{
begin_time = "70.6117",
key_flag = "K_LEFT",
end_time = "70.6117"
},
{
begin_time = "71.72872",
key_flag = "K_LEFT",
end_time = "71.72872"
},
{
begin_time = "72.20827",
key_flag = "K_LEFT",
end_time = "72.20827"
},
{
begin_time = "72.84845",
key_flag = "K_LEFT",
end_time = "72.84845"
},
{
begin_time = "73.80319",
key_flag = "K_LEFT",
end_time = "73.80319"
},
{
begin_time = "74.28394",
key_flag = "K_LEFT",
end_time = "74.28394"
},
{
begin_time = "75.07979",
key_flag = "K_LEFT",
end_time = "75.07979"
},
{
begin_time = "75.87766",
key_flag = "K_LEFT",
end_time = "75.87766"
},
{
begin_time = "76.19681",
key_flag = "K_LEFT",
end_time = "76.19681"
},
{
begin_time = "76.67553",
key_flag = "K_LEFT",
end_time = "76.67553"
},
{
begin_time = "79.22919",
key_flag = "K_LEFT",
end_time = "79.22919"
},
{
begin_time = "79.86692",
key_flag = "K_LEFT",
end_time = "79.86692"
},
{
begin_time = "80.50532",
key_flag = "K_LEFT",
end_time = "80.50532"
},
{
begin_time = "81.14424",
key_flag = "K_LEFT",
end_time = "81.14424"
},
{
begin_time = "81.4631",
key_flag = "K_LEFT",
end_time = "81.4631"
},
{
begin_time = "82.73936",
key_flag = "K_LEFT",
end_time = "82.73936"
},
{
begin_time = "83.37766",
key_flag = "K_LEFT",
end_time = "83.37766"
},
{
begin_time = "84.01721",
key_flag = "K_LEFT",
end_time = "84.01721"
},
{
begin_time = "84.73404",
key_flag = "K_LEFT",
end_time = "84.73404"
},
{
begin_time = "85.93085",
key_flag = "K_LEFT",
end_time = "85.93085"
},
{
begin_time = "86.56915",
key_flag = "K_LEFT",
end_time = "86.56915"
},
{
begin_time = "87.20745",
key_flag = "K_LEFT",
end_time = "87.20745"
}
},
right_track = {
{
begin_time = "2.632979",
key_flag = "K_RIGHT",
end_time = "2.632979"
},
{
begin_time = "5.18842",
key_flag = "K_RIGHT",
end_time = "5.18842"
},
{
begin_time = "8.058511",
key_flag = "K_RIGHT",
end_time = "8.058511"
},
{
begin_time = "9.015958",
key_flag = "K_RIGHT",
end_time = "9.015958"
},
{
begin_time = "9.654256",
key_flag = "K_RIGHT",
end_time = "9.654256"
},
{
begin_time = "10.30029",
key_flag = "K_RIGHT",
end_time = "10.30029"
},
{
begin_time = "10.92892",
key_flag = "K_RIGHT",
end_time = "10.92892"
},
{
begin_time = "14.91967",
key_flag = "K_RIGHT",
end_time = "14.91967"
},
{
begin_time = "15.55851",
key_flag = "K_RIGHT",
end_time = "15.55851"
},
{
begin_time = "16.03723",
key_flag = "K_RIGHT",
end_time = "16.03723"
},
{
begin_time = "17.95213",
key_flag = "K_RIGHT",
end_time = "17.95213"
},
{
begin_time = "18.7537",
key_flag = "K_RIGHT",
end_time = "18.7537"
},
{
begin_time = "20.82645",
key_flag = "K_RIGHT",
end_time = "20.82645"
},
{
begin_time = "21.30847",
key_flag = "K_RIGHT",
end_time = "21.30847"
},
{
begin_time = "23.22503",
key_flag = "K_RIGHT",
end_time = "23.22503"
},
{
begin_time = "25.29255",
key_flag = "K_RIGHT",
end_time = "25.29255"
},
{
begin_time = "26.56409",
key_flag = "K_RIGHT",
end_time = "26.56409"
},
{
begin_time = "29.28192",
key_flag = "K_RIGHT",
end_time = "29.28192"
},
{
begin_time = "32.15363",
key_flag = "K_RIGHT",
end_time = "32.15363"
},
{
begin_time = "33.2677",
key_flag = "K_RIGHT",
end_time = "33.2677"
},
{
begin_time = "37.74196",
key_flag = "K_RIGHT",
end_time = "37.74196"
},
{
begin_time = "38.37865",
key_flag = "K_RIGHT",
end_time = "38.37865"
},
{
begin_time = "40.29596",
key_flag = "K_RIGHT",
end_time = "40.29596"
},
{
begin_time = "41.72673",
key_flag = "K_RIGHT",
end_time = "41.72673"
},
{
begin_time = "43.16677",
key_flag = "K_RIGHT",
end_time = "43.16677"
},
{
begin_time = "45.40079",
key_flag = "K_RIGHT",
end_time = "45.40079"
},
{
begin_time = "47.31383",
key_flag = "K_RIGHT",
end_time = "47.31383"
},
{
begin_time = "51.94149",
key_flag = "K_RIGHT",
end_time = "51.94149"
},
{
begin_time = "52.26261",
key_flag = "K_RIGHT",
end_time = "52.26261"
},
{
begin_time = "52.58243",
key_flag = "K_RIGHT",
end_time = "52.58243"
},
{
begin_time = "55.45213",
key_flag = "K_RIGHT",
end_time = "55.45213"
},
{
begin_time = "56.56975",
key_flag = "K_RIGHT",
end_time = "56.56975"
},
{
begin_time = "57.36702",
key_flag = "K_RIGHT",
end_time = "57.36702"
},
{
begin_time = "57.68513",
key_flag = "K_RIGHT",
end_time = "57.68513"
},
{
begin_time = "61.35276",
key_flag = "K_RIGHT",
end_time = "61.35276"
},
{
begin_time = "62.6321",
key_flag = "K_RIGHT",
end_time = "62.6321"
},
{
begin_time = "63.75406",
key_flag = "K_RIGHT",
end_time = "63.75406"
},
{
begin_time = "65.0285",
key_flag = "K_RIGHT",
end_time = "65.0285"
},
{
begin_time = "65.34347",
key_flag = "K_RIGHT",
end_time = "65.34347"
},
{
begin_time = "68.53903",
key_flag = "K_RIGHT",
end_time = "68.53903"
},
{
begin_time = "69.97269",
key_flag = "K_RIGHT",
end_time = "69.97269"
},
{
begin_time = "72.52382",
key_flag = "K_RIGHT",
end_time = "72.52382"
},
{
begin_time = "74.60107",
key_flag = "K_RIGHT",
end_time = "74.60107"
},
{
begin_time = "79.54695",
key_flag = "K_RIGHT",
end_time = "79.54695"
},
{
begin_time = "80.1852",
key_flag = "K_RIGHT",
end_time = "80.1852"
},
{
begin_time = "80.82666",
key_flag = "K_RIGHT",
end_time = "80.82666"
},
{
begin_time = "81.78191",
key_flag = "K_RIGHT",
end_time = "81.78191"
},
{
begin_time = "82.10434",
key_flag = "K_RIGHT",
end_time = "82.10434"
},
{
begin_time = "83.06033",
key_flag = "K_RIGHT",
end_time = "83.06033"
},
{
begin_time = "85.29256",
key_flag = "K_RIGHT",
end_time = "85.29256"
},
{
begin_time = "86.25105",
key_flag = "K_RIGHT",
end_time = "86.25105"
},
{
begin_time = "86.88703",
key_flag = "K_RIGHT",
end_time = "86.88703"
}
}
}
|
--[===[DOC
= intersecationtab
[source,lua]
----
function intersecationtab( firstTab, secondTab, selectFunc ) --> intersecationTab
----
Creates the `intersecationTab` table that contain the keys shared by the
`firstTab` and `secondTab` tables. By default, the value of the first table
will be used as value in the result.
The `selectFunc` function may be optionally passed to select which value to
associate to the key. It will be called with the two value associated to the
same key in the two argument table. Its result will be used in the
intersecation table.
== Example
[source,lua,example]
----
local intersecationtab = require 'intersecationtab'
local int = intersecationtab({a='a',b='b',c='c',x='x1'},{a='A',d='d',x='x2'})
assert( int.a == 'a' )
assert( int.x == 'x1' )
local count = 0
for _ in pairs(int) do count = count + 1 end
assert( count == 2 )
local int = intersecationtab({a='a1'},{a='a2'},function(x,y) return y end)
assert( int.a == 'a2' )
----
]===]
local function intersecationtab( firstTab, secondTab, selectFunc ) --> intersecationTab
local intersecationTab = {}
if not firstTab or not secondTab then return intersecationTab end
for k, v in pairs(firstTab) do
local o = secondTab[k]
if o then
if not selectFunc then
intersecationTab[k] = v
else
intersecationTab[k] = selectFunc(v, o)
end
end
end
return intersecationTab
end
return intersecationtab
|
-- Arrays are call be ref, therefore assignment of array members work without write-back
-- I assume that _G members are different from global and just represent a runtime variable(maybe it is _G.global)
-- also _G.global somehow does not survive saving the map, it seems factorio doc is wrong
-- remember this when investigating desyncs...
-------------------------------------------------------------------------------
local ncoData = _G.ncoData or {}
ncoData.Longstoragetanks = ncoData.Longstoragetanks or {}
local myData = ncoData.Longstoragetanks
myData.StorageTankSizes = myData.StorageTankSizes or {}
myData.RegisteredStorageTanks = myData.RegisteredStorageTanks or {}
-------------------------------------------------------------------------------
return myData
|
local decoderNet = {}
function decoderNet.model(params, enc)
local optionLSTM = nn.SeqLSTM(params.embedSize, params.rnnHiddenSize)
optionLSTM.batchfirst = true
local optionEnc = {}
local numOptions = 100
for i = 1, numOptions do
optionEnc[i] = nn.Sequential()
optionEnc[i]:add(nn.Select(2,i))
optionEnc[i]:add(enc.wordEmbed:clone('weight', 'bias', 'gradWeight', 'gradBias'));
optionEnc[i]:add(optionLSTM:clone('weight', 'bias', 'gradWeight', 'gradBias'))
optionEnc[i]:add(nn.Select(2,-1))
optionEnc[i]:add(nn.Reshape(1,params.rnnHiddenSize, true)) -- True ensures that the first dimension remains the batch size
end
optionEncConcat = nn.Concat(2)
for i = 1, numOptions do
optionEncConcat:add(optionEnc[i])
end
local jointModel = nn.ParallelTable()
jointModel:add(optionEncConcat)
jointModel:add(nn.Reshape(params.rnnHiddenSize, 1, true))
local dec = nn.Sequential()
dec:add(jointModel)
dec:add(nn.MM())
dec:add(nn.Squeeze())
return dec;
end
-- dummy forwardConnect
function decoderNet.forwardConnect(enc, dec, encOut, seqLen) end
-- dummy backwardConnect
function decoderNet.backwardConnect(enc, dec) end
return decoderNet;
|
function onPre(v)
vee.putreg(v, ESP, 32, 40000000)
vee.putreg(v, EAX, 32, 80808080)
for i=0,4096 do
vee.putmem(v, 80808080+i, 8, 20)
end
end
function onPost(v)
esp = vee.getreg(v, ESP, 32)
if esp ~= nil and esp > 80808080-16 and esp < 80808080+16 then
if vee.getexit(v) == Return then
return true
end
return false
end
eip = vee.getreg(v, EIP, 32)
if eip ~= nil and eip == 20202020 then
return true
end
return false
end
vee.register(onPre, onPost)
|
local UnsubAck = require "lumina.protocol.packet.unsuback"
local test_utils = require "spec.test_utils"
local function round_trip_encode(v)
local source = test_utils.generate_source(assert(v:encode_packet()))
local back = assert(UnsubAck.decode_packet(source))
assert.are.same(v, back)
end
describe("UnsubAck", function()
it("round trip encoding", function()
local v = assert(UnsubAck.new(1))
round_trip_encode(v)
end)
it("encoded_packet_length", function()
local v = assert(UnsubAck.new(1))
assert.are.equal(2, v:encoded_packet_length())
end)
end)
|
--------------------------------
-- @module TableView
-- @extend ScrollView,ScrollViewDelegate
-- @parent_module cc
--------------------------------
-- @function [parent=#TableView] updateCellAtIndex
-- @param self
-- @param #long long
--------------------------------
-- @function [parent=#TableView] setVerticalFillOrder
-- @param self
-- @param #cc.TableView::VerticalFillOrder verticalfillorder
--------------------------------
-- @function [parent=#TableView] scrollViewDidZoom
-- @param self
-- @param #cc.ScrollView scrollview
--------------------------------
-- @function [parent=#TableView] _updateContentSize
-- @param self
--------------------------------
-- @function [parent=#TableView] getVerticalFillOrder
-- @param self
-- @return TableView::VerticalFillOrder#TableView::VerticalFillOrder ret (return value: cc.TableView::VerticalFillOrder)
--------------------------------
-- @function [parent=#TableView] removeCellAtIndex
-- @param self
-- @param #long long
--------------------------------
-- @function [parent=#TableView] initWithViewSize
-- @param self
-- @param #size_table size
-- @param #cc.Node node
-- @return bool#bool ret (return value: bool)
--------------------------------
-- @function [parent=#TableView] scrollViewDidScroll
-- @param self
-- @param #cc.ScrollView scrollview
--------------------------------
-- @function [parent=#TableView] reloadData
-- @param self
--------------------------------
-- @function [parent=#TableView] insertCellAtIndex
-- @param self
-- @param #long long
--------------------------------
-- @function [parent=#TableView] cellAtIndex
-- @param self
-- @param #long long
-- @return TableViewCell#TableViewCell ret (return value: cc.TableViewCell)
--------------------------------
-- @function [parent=#TableView] dequeueCell
-- @param self
-- @return TableViewCell#TableViewCell ret (return value: cc.TableViewCell)
--------------------------------
-- @function [parent=#TableView] onTouchMoved
-- @param self
-- @param #cc.Touch touch
-- @param #cc.Event event
--------------------------------
-- @function [parent=#TableView] onTouchEnded
-- @param self
-- @param #cc.Touch touch
-- @param #cc.Event event
--------------------------------
-- @function [parent=#TableView] onTouchCancelled
-- @param self
-- @param #cc.Touch touch
-- @param #cc.Event event
--------------------------------
-- @function [parent=#TableView] onTouchBegan
-- @param self
-- @param #cc.Touch touch
-- @param #cc.Event event
-- @return bool#bool ret (return value: bool)
--------------------------------
-- @function [parent=#TableView] TableView
-- @param self
return nil
|
BaseEntity = require("entities.core.baseentity")
NPCBullet = class("NPCBullet", BaseEntity)
NPCBullet.image = loadImage("sprites/bullet.gif")
function NPCBullet:initialize()
BaseEntity.initialize(self)
self.type = "BULLET"
self.nextDie = 5
playSound("smash.wav") -- fuck yo sound
end
function NPCBullet:shouldCollide(other)
if other.type == "NPC" or other.type == "TILE" or other.type == "BULLET" then
return false
end
end
function NPCBullet:initPhysics()
local shape = love.physics.newCircleShape(4)
self:makeSolid("dynamic", shape)
self:setMass(0.01)
self:setFriction(0)
self:setGravityScale(0)
end
function NPCBullet:update(dt)
self.nextDie = self.nextDie - dt
if self.nextDie <= 0 then
self:destroy()
end
end
function NPCBullet:draw()
local vx, vy = self:getVelocity()
love.graphics.rotate(math.atan2(vy, vx))
love.graphics.draw(self.image, -16-8, -16-16, 0, 2, 2)
end
function NPCBullet:beginContact(other, contact, isother)
if other.isSensor and other:isSensor() then return end
local nx, ny = contact:getNormal()
local x, y = contact:getPositions()
timer:onNextUpdate(function()
if other.inflictDamage then
local blood = Blood:new()
blood:setPosition(x - nx*5, y - ny*5)
blood:setAngle(math.atan2(ny, nx))
blood:spawn()
other:inflictDamage(5)
end
end)
self:destroy()
end
return NPCBullet
|
-- Copyright (c) 2010 Aleksey Yeschenko <aleksey@yeschenko.com>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
require("zmq")
local ev = require'ev'
local loop = ev.Loop.default
-- define a sub_worker class
local sub_worker_mt = {}
function sub_worker_mt:close(...)
self.s_io_idle:stop(self.loop)
self.s_io_read:stop(self.loop)
return self.socket:close(...)
end
function sub_worker_mt:bind(...)
return self.socket:bind(...)
end
function sub_worker_mt:connect(...)
return self.socket:connect(...)
end
function sub_worker_mt:sub(topic)
return self.socket:setopt(zmq.SUBSCRIBE, topic)
end
function sub_worker_mt:unsub(topic)
return self.socket:setopt(zmq.UNSUBSCRIBE, topic)
end
sub_worker_mt.__index = sub_worker_mt
local function sub_worker(loop, ctx, msg_cb)
local s = ctx:socket(zmq.SUB)
local self = { loop = loop, socket = s, msg_cb = msg_cb }
setmetatable(self, sub_worker_mt)
-- create ev callbacks for recving data.
-- need idle watcher since ZeroMQ sockets are edge-triggered instead of level-triggered
local s_io_idle
local s_io_read
s_io_idle = ev.Idle.new(function()
local msg, err = s:recv(zmq.NOBLOCK)
if err == 'timeout' then
-- need to block on read IO
s_io_idle:stop(loop)
s_io_read:start(loop)
return
end
self:msg_cb(msg)
end)
s_io_idle:start(loop)
s_io_read = ev.IO.new(function()
s_io_idle:start(loop)
s_io_read:stop(loop)
end, s:getopt(zmq.FD), ev.READ)
self.s_io_idle = s_io_idle
self.s_io_read = s_io_read
return self
end
local ctx = zmq.init(1)
-- message handling function.
local function handle_msg(worker, msg)
local msg_id = tonumber(msg)
if math.mod(msg_id, 10000) == 0 then print(worker.id, msg_id) end
end
local sub1 = sub_worker(loop, ctx, handle_msg)
sub1.id = 'sub1'
sub1:sub('')
sub1:connect("tcp://localhost:5555")
local sub2 = sub_worker(loop, ctx, handle_msg)
sub2.id = 'sub2'
sub2:sub('')
sub2:connect("tcp://localhost:5555")
loop:loop()
|
require 'nngraph'
require 'nn';
-- Part (a)
a = nn.Linear(4,2)()
a1 = nn.Power(2)(a)
a2 = nn.Tanh()(a1)
b = nn.Linear(5,2)()
b1 = nn.Power(2)(b)
b2 = nn.Sigmoid()(b1)
c = nn.CMulTable()({a2,b2})
d = nn.Identity()()
e = nn.CAddTable()({c,d})
q1 = nn.gModule({a,b,d},{e})
--Part (b)
x = torch.randn(4)
y = torch.randn(5)
z = torch.randn(2)
fwd = q1:forward({x,y,z})
print('forwarded value is:')
print(fwd)
bck = q1:backward({x,y,z},torch.ones(2))
print('bakwarded vaue are:')
print('d OUT/d x =')
print(bck[1])
print('d OUT/d y =')
print(bck[2])
print('d OUT/d z =')
print(bck[3])
|
local redis = require 'vendor.redis-lua.redis'
RedisClient = {}
-- RedisClient constructor
function RedisClient.new()
local self = {}
local client = redis.connect('127.0.0.1', 6379)
function self.load()
end
function self.ping()
return client:ping()
end
function self.insert_score(score)
time = os.time(os.date('*t'))
client:zadd("highscore", score, time)
end
function self.retrieve_highscore()
zrevrange = client:zrevrange("highscore", "0", "9", "withscores")
highscore = {}
for _, data in ipairs(zrevrange) do
table.insert(highscore, {
["date"] = os.date("%d/%m/%Y - %H:%M:%S", tonumber(data[1])),
["score"] = data[2]
})
end
return highscore
end
return self
end
return RedisClient
|
intcore_improve_autoattack_lua = class({})
LinkLuaModifier( "intcore_improve_autoattack_modifier", LUA_MODIFIER_MOTION_NONE )
function intcore_improve_autoattack_lua:OnUpgrade()
if IsServer() then
if self:GetToggleState() then
self:GetCaster():RemoveModifierByName("intcore_improve_autoattack_modifier")
self:ApplyAutoattackModifier()
end
end
end
function intcore_improve_autoattack_lua:OnToggle()
if IsServer() then
if self:GetToggleState() then
self:ApplyAutoattackModifier()
self:GetCaster():GiveMana(self:GetManaCost(-1)) -- Regain mana lost on toggle
else
self:GetCaster():RemoveModifierByName("intcore_improve_autoattack_modifier")
end
end
end
function intcore_improve_autoattack_lua:ApplyAutoattackModifier()
modifier_table = {
duration = -1,
damage_as_pure_ratio = self:GetSpecialValueFor("damage_as_pure_ratio"),
mana_cost = self:GetManaCost(-1)
}
self:GetCaster():AddNewModifier( self:GetCaster(), self, "intcore_improve_autoattack_modifier", modifier_table )
end
|
fx_version 'cerulean'
game 'gta5'
author 'MiiMii1205'
description 'A simple script for enabling/disabling ragdolls on any aimed ped'
version '1.0.0'
repository 'https://github.com/MiiMii1205/ragdoller'
client_scripts { 'Scripts/rag.lua', 'Scripts/pedTag.lua' }
export 'CheckRagdoller'
|
local path = (...):match('(.-)[^%./]+$')
return {
name = 'timer',
description = 'Provides an interface to the user\'s clock.',
types = {
},
functions = {
{
name = 'getAverageDelta',
description = 'Returns the average delta time (seconds per frame) over the last second.',
variants = {
{
returns = {
{
type = 'number',
name = 'delta',
description = 'The average delta time over the last second.',
},
},
},
},
},
{
name = 'getDelta',
description = 'Returns the time between the last two frames.',
variants = {
{
returns = {
{
type = 'number',
name = 'dt',
description = 'The time passed (in seconds).',
},
},
},
},
},
{
name = 'getFPS',
description = 'Returns the current frames per second.',
variants = {
{
returns = {
{
type = 'number',
name = 'fps',
description = 'The current FPS.',
},
},
},
},
},
{
name = 'getTime',
description = 'Returns the value of a timer with an unspecified starting time.\n\nThis function should only be used to calculate differences between points in time, as the starting time of the timer is unknown.',
variants = {
{
returns = {
{
type = 'number',
name = 'time',
description = 'The time in seconds. Given as a decimal, accurate to the microsecond.',
},
},
},
},
},
{
name = 'sleep',
description = 'Pauses the current thread for the specified amount of time.',
variants = {
{
arguments = {
{
type = 'number',
name = 's',
description = 'Seconds to sleep for.',
},
},
},
},
},
{
name = 'step',
description = 'Measures the time between two frames.\n\nCalling this changes the return value of love.timer.getDelta.',
variants = {
{
returns = {
{
type = 'number',
name = 'dt',
description = 'The time passed (in seconds).',
},
},
},
},
},
},
enums = {
},
}
|
local status_ok, neogen = pcall(require, "neogen")
if not status_ok then
return
end
neogen.setup({
snippet_engine = "luasnip",
languages = {
cs = {
template = {
annotation_convention = "xmldoc",
}
}
}
})
local wk = require("which-key")
wk.register({
n = {
name = "Generate documentation",
f = { "<cmd>Neogen func<CR>", "Function" },
c = { "<cmd>Neogen class<CR>", "Class" },
t = { "<cmd>Neogen type<CR>", "Type" },
},
}, {
prefix = "<leader>",
})
|
local QuickAuctions = select(2, ...)
local Manage = QuickAuctions:NewModule("Manage", "AceEvent-3.0")
local L = QuickAuctions.L
local status = QuickAuctions.status
local reverseLookup, postQueue, scanList, tempList, stats = {}, {}, {}, {}, {}
local totalToCancel, totalCancelled = 0, 0
Manage.reverseLookup = reverseLookup
Manage.stats = stats
function Manage:OnInitialize()
self:RegisterMessage("QA_AH_CLOSED", "AuctionHouseClosed")
end
function Manage:AuctionHouseClosed()
if( self.cancelFrame and self.cancelFrame:IsShown() ) then
QuickAuctions:Print(L["Cancelling interrupted due to Auction House being closed."])
QuickAuctions:Log("cancelstatus", L["Auction House closed before you could tell Quick Auctions to cancel."])
self:StopCancelling()
self.cancelFrame:Hide()
elseif( status.isCancelling and status.isScanning ) then
self:StopCancelling()
elseif( status.isManaging and not status.isCancelling ) then
self:StopPosting()
end
end
function Manage:GetBoolConfigValue(itemID, key)
local val = reverseLookup[itemID] and QuickAuctions.db.profile[key][reverseLookup[itemID]]
if( val ~= nil ) then
return val
end
return QuickAuctions.db.profile[key].default
end
function Manage:GetConfigValue(itemID, key)
return reverseLookup[itemID] and QuickAuctions.db.profile[key][reverseLookup[itemID]] or QuickAuctions.db.profile[key].default
end
function Manage:UpdateReverseLookup()
table.wipe(reverseLookup)
for group, items in pairs(QuickAuctions.db.global.groups) do
if( not QuickAuctions.db.profile.groupStatus[group] ) then
for itemID in pairs(items) do
reverseLookup[itemID] = group
end
end
end
end
function Manage:StartLog()
self:RegisterMessage("QA_QUERY_UPDATE")
self:RegisterMessage("QA_START_SCAN")
self:RegisterMessage("QA_STOP_SCAN")
end
function Manage:StopLog()
self:UnregisterMessage("QA_QUERY_UPDATE")
self:UnregisterMessage("QA_START_SCAN")
self:UnregisterMessage("QA_STOP_SCAN")
end
function Manage:StopCancelling()
self:StopLog()
self:UnregisterEvent("CHAT_MSG_SYSTEM")
QuickAuctions:UnlockButtons()
status.isCancelling = nil
totalCancelled = 0
totalToCancel = 0
end
function Manage:CancelScan()
self:StartLog()
self:RegisterEvent("CHAT_MSG_SYSTEM")
self:UpdateReverseLookup()
QuickAuctions:LockButtons()
table.wipe(scanList)
table.wipe(tempList)
table.wipe(status)
-- Add a scan based on items in the AH that match
for i=1, GetNumAuctionItems("owner") do
if( select(13, GetAuctionItemInfo("owner", i)) == 0 ) then
local link = QuickAuctions:GetSafeLink(GetAuctionItemLink("owner", i))
if( reverseLookup[link] ) then
tempList[GetAuctionItemInfo("owner", i)] = true
end
end
end
for name in pairs(tempList) do
table.insert(scanList, name)
end
if( #(scanList) == 0 ) then
QuickAuctions:Log("cancelstatus", L["Nothing to cancel, you have no unsold auctions up."])
QuickAuctions:UnlockButtons()
return
end
--QuickAuctions.Split:ScanStopped()
--QuickAuctions.Split:Stop()
QuickAuctions.Post:Stop()
status.isCancelling = true
status.totalScanQueue = #(scanList)
status.queueTable = scanList
QuickAuctions.Scan:StartItemScan(scanList)
end
function Manage:CHAT_MSG_SYSTEM(event, msg)
if( msg == ERR_AUCTION_REMOVED ) then
totalToCancel = totalToCancel - 1
QuickAuctions:SetButtonProgress("cancel", totalCancelled - totalToCancel, totalCancelled)
if( totalToCancel <= 0 ) then
QuickAuctions:Log("cancelprogress", string.format(L["Finished cancelling |cfffed000%d|r auctions"], totalCancelled))
-- Unlock posting, cancelling doesn't require the auction house to be open meaning we can cancel everything
-- then go run to the mailbox while it cancels just fine
if( not AuctionFrame:IsVisible() ) then
QuickAuctions:Print(string.format(L["Finished cancelling |cfffed000%d|r auctions"], totalCancelled))
end
self:StopCancelling()
else
QuickAuctions:Log("cancelprogress", string.format(L["Cancelling |cfffed000%d|r of |cfffed000%d|r"], totalCancelled - totalToCancel, totalCancelled))
end
end
end
function Manage:CancelMatch(match)
QuickAuctions:WipeLog()
QuickAuctions:LockButtons()
self:RegisterEvent("CHAT_MSG_SYSTEM")
table.wipe(tempList)
table.wipe(status)
status.isCancelling = true
local itemID = tonumber(string.match(match, "item:(%d+)"))
if( itemID ) then
match = GetItemInfo(itemID)
end
for i=1, GetNumAuctionItems("owner") do
local name, _, _, _, _, _, _, _, _, _, _, _, wasSold = GetAuctionItemInfo("owner", i)
local itemLink = GetAuctionItemLink("owner", i)
if( wasSold == 0 and string.match(string.lower(name), string.lower(match)) ) then
if( not tempList[name] ) then
tempList[name] = true
QuickAuctions:Log(name, string.format(L["Cancelled %s"], itemLink))
end
totalToCancel = totalToCancel + 1
totalCancelled = totalCancelled + 1
CancelAuction(i)
end
end
if( totalToCancel == 0 ) then
QuickAuctions:Log("cancelstatus", string.format(L["Nothing to cancel, no matches found for \"%s\""], match))
self:StopCancelling()
end
end
function Manage:CancelAll(group, duration, price)
QuickAuctions:WipeLog()
QuickAuctions:LockButtons()
self:RegisterEvent("CHAT_MSG_SYSTEM")
self:UpdateReverseLookup()
table.wipe(tempList)
table.wipe(status)
status.isCancelling = true
if( duration ) then
QuickAuctions:Log("masscancel", string.format(L["Mass cancelling posted items with less than %d hours left"], duration == 3 and 12 or 2))
elseif( group ) then
QuickAuctions:Log("masscancel", string.format(L["Mass cancelling posted items in the group |cfffed000%s|r"], group))
elseif( money ) then
QuickAuctions:Log("masscancel", string.format(L["Mass cancelling posted items below %s"], QuickAuctions:FormatTextMoney(money)))
else
QuickAuctions:Log("masscancel", L["Mass cancelling posted items"])
end
for i=1, GetNumAuctionItems("owner") do
local name, _, _, _, _, _, _, _, buyoutPrice, _, _, _, wasSold = GetAuctionItemInfo("owner", i)
local timeLeft = GetAuctionItemTimeLeft("owner", i)
local itemLink = GetAuctionItemLink("owner", i)
local itemID = QuickAuctions:GetSafeLink(itemLink)
if( wasSold == 0 and ( group and reverseLookup[itemID] == group or not group ) and ( duration and timeLeft <= duration or not duration ) and ( price and buyoutPrice <= price or not price ) ) then
if( name and not tempList[name] ) then
tempList[name] = true
QuickAuctions:Log(name, string.format(L["Cancelled %s"], itemLink))
end
totalToCancel = totalToCancel + 1
totalCancelled = totalCancelled + 1
CancelAuction(i)
end
end
if( totalToCancel == 0 ) then
QuickAuctions:Log("cancelstatus", L["Nothing to cancel"])
self:StopCancelling()
end
end
-- Handle the cancel key press stuff
function Manage:ReadyToCancel()
local hasCancelable = self:Cancel(true)
if( not hasCancelable ) then
QuickAuctions:Log("cancelstatus", L["Nothing to cancel"])
self:StopCancelling()
return
end
QuickAuctions:LockButtons()
if( self.cancelFrame ) then
self.cancelFrame:Show()
return
end
local function showTooltip(self)
if( self.tooltip ) then
GameTooltip:SetOwner(self:GetParent(), "ANCHOR_TOPLEFT")
GameTooltip:SetText(self.tooltip, 1, 1, 1, nil, true)
GameTooltip:Show()
end
end
local function hideTooltip(self)
GameTooltip:Hide()
end
local function formatTime(seconds)
if( seconds >= 3600 ) then
return seconds / 3600, L["hours"]
elseif( seconds >= 60 ) then
return seconds / 60, L["minutes"]
end
return seconds, L["seconds"]
end
local scanFinished
local timeElapsed = 0
local soundElapsed = 0
local function OnUpdate(self, elapsed)
timeElapsed = timeElapsed + elapsed
if( timeElapsed >= 1 ) then
timeElapsed = timeElapsed - 1
self.text:SetFormattedText(L["Auction scan finished, can now smart cancel auctions.\n\nScan data age: %d %s"], formatTime(GetTime() - scanFinished))
end
-- Remind them once every 60 seconds that it's ready
if( QuickAuctions.db.global.playSound ) then
soundElapsed = soundElapsed + elapsed
if( soundElapsed >= 60 ) then
soundElapsed = soundElapsed - 60
PlaySound("ReadyCheck")
end
end
end
local frame = CreateFrame("Frame", nil, AuctionFrame)
frame:SetClampedToScreen(true)
frame:SetFrameStrata("HIGH")
frame:SetToplevel(true)
frame:SetWidth(300)
frame:SetHeight(100)
frame:SetBackdrop({
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
edgeSize = 26,
insets = {left = 9, right = 9, top = 9, bottom = 9},
})
frame:SetBackdropColor(0, 0, 0, 0.85)
frame:SetPoint("CENTER", UIParent, "CENTER", 0, 100)
frame:Hide()
frame:SetScript("OnUpdate", OnUpdate)
frame:SetScript("OnShow", function(self)
if( QuickAuctions.db.global.cancelBinding ~= "" ) then
SetOverrideBindingClick(self, true, QuickAuctions.db.global.cancelBinding, self.cancel:GetName())
end
if( QuickAuctions.db.global.playSound ) then
PlaySound("ReadyCheck")
end
-- Setup initial data + update
scanFinished = GetTime()
soundElapsed = 0
OnUpdate(self, 1)
end)
frame:SetScript("OnHide", function(self)
if( not self.wasClicked ) then
Manage:StopCancelling()
end
self.wasclicked = nil
ClearOverrideBindings(self)
end)
frame.titleBar = frame:CreateTexture(nil, "ARTWORK")
frame.titleBar:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
frame.titleBar:SetPoint("TOP", 0, 8)
frame.titleBar:SetWidth(225)
frame.titleBar:SetHeight(45)
frame.title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
frame.title:SetPoint("TOP", 0, 0)
frame.title:SetText("Quick Auctions")
frame.text = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
frame.text:SetText("")
frame.text:SetPoint("TOPLEFT", 12, -22)
frame.text:SetWidth(frame:GetWidth() - 20)
frame.text:SetJustifyH("LEFT")
frame.cancel = CreateFrame("Button", "QuickAuctionsCancelButton", frame, "UIPanelButtonTemplate")
frame.cancel:SetText(L["Start"])
frame.cancel:SetHeight(20)
frame.cancel:SetWidth(100)
frame.cancel:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 6, 8)
frame.cancel.tooltip = L["Clicking this will cancel auctions based on the data scanned."]
frame.cancel:SetScript("OnClick", function(self)
self:GetParent().wasClicked = true
self:GetParent():Hide()
Manage:Cancel()
end)
frame.rescan = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
frame.rescan:SetText(L["Rescan"])
frame.rescan:SetHeight(20)
frame.rescan:SetWidth(100)
frame.rescan:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -6, 8)
frame.rescan:SetScript("OnEnter", showTooltip)
frame.rescan:SetScript("OnLeave", hideTooltip)
frame.rescan.tooltip = L["If the data is too old and instead of canceling you would rather rescan auctions to get newer data just press this button."]
frame.rescan:SetScript("OnClick", function(self)
self:GetParent():Hide()
Manage:CancelScan()
end)
self.cancelFrame = frame
frame:Show()
end
function Manage:Cancel(isTest)
table.wipe(tempList)
for i=1, GetNumAuctionItems("owner") do
local name, _, quantity, _, _, _, bid, _, buyout, activeBid, highBidder, _, wasSold = GetAuctionItemInfo("owner", i)
local itemLink = GetAuctionItemLink("owner", i)
local itemID = QuickAuctions:GetSafeLink(itemLink)
local lowestBuyout, lowestBid, lowestOwner, isWhitelist, isPlayer = QuickAuctions.Scan:GetLowestAuction(itemID)
-- The item is in a group that's not supposed to be cancelled
if( wasSold == 0 and lowestOwner and self:GetBoolConfigValue(itemID, "noCancel") ) then
if( not tempList[name] and not isTest ) then
QuickAuctions:Log(name .. "notcancel", string.format(L["Skipped cancelling %s flagged to not be canelled."], itemLink))
tempList[name] = true
end
elseif( wasSold == 0 and lowestOwner and self:GetBoolConfigValue(itemID, "autoFallback") and lowestBuyout <= self:GetConfigValue(itemID, "threshold") ) then
if( not tempList[name] and not isTest ) then
QuickAuctions:Log(name .. "notcancel", string.format(L["Skipped cancelling %s flagged to post at fallback when market is below threshold."], itemLink))
tempList[name] = true
end
-- It is supposed to be cancelled!
elseif( wasSold == 0 and lowestOwner ) then
buyout = buyout / quantity
bid = bid / quantity
local threshold = self:GetConfigValue(itemID, "threshold")
local fallback = self:GetConfigValue(itemID, "fallback")
local priceDifference = QuickAuctions.Scan:CompareLowestToSecond(itemID, lowestBuyout)
local priceThreshold = self:GetConfigValue(itemID, "priceThreshold")
-- Lowest is the player, and the difference between the players lowest and the second lowest are too far apart
if( isPlayer and priceDifference and priceDifference >= priceThreshold ) then
-- The item that the difference is too high is actually on the tier that was too high as well
-- so cancel it, the reason this check is done here is so it doesn't think it undercut itself.
if( math.floor(lowestBuyout) == math.floor(buyout) ) then
if( isTest ) then return true end
if( not tempList[name] ) then
tempList[name] = true
QuickAuctions:Log(name .. "diffcancel", string.format(L["Price threshold on %s at %s, second lowest is |cfffed000%d%%|r higher and above the |cfffed000%d%%|r threshold, cancelling"], itemLink, QuickAuctions:FormatTextMoney(lowestBuyout, true), priceDifference * 100, priceThreshold * 100))
end
totalToCancel = totalToCancel + 1
totalCancelled = totalCancelled + 1
CancelAuction(i)
end
-- They aren't us (The player posting), or on our whitelist so easy enough
-- They are on our white list, but they undercut us, OR they matched us but the bid is lower
-- The player is the only one with it on the AH and it's below the threshold
elseif( ( not isPlayer and not isWhitelist ) or
( isWhitelist and ( buyout > lowestBuyout or ( buyout == lowestBuyout and lowestBid < bid ) ) ) or
( QuickAuctions.db.global.smartCancel and QuickAuctions.Scan:IsPlayerOnly(itemID) and buyout < fallback ) ) then
local undercutBuyout, undercutBid, undercutOwner
if( QuickAuctions.db.factionrealm.player[lowestOwner] ) then
undercutBuyout, undercutBid, undercutOwner = QuickAuctions.Scan:GetSecondLowest(itemID, lowestBuyout)
end
undercutBuyout = undercutBuyout or lowestBuyout
undercutBid = undercutBid or lowestBid
undercutOwner = undercutOwner or lowestOwner
-- Don't cancel if the buyout is equal, or below our threshold
if( QuickAuctions.db.global.smartCancel and lowestBuyout <= threshold and not QuickAuctions.Scan:IsPlayerOnly(itemID)) then
if( not tempList[name] ) then
tempList[name] = true
QuickAuctions:Log(name .. "notcancel", string.format(L["Undercut on %s by |cfffed000%s|r, their buyout %s, yours %s (per item), threshold is %s not cancelling"], itemLink, undercutOwner, QuickAuctions:FormatTextMoney(undercutBuyout, true), QuickAuctions:FormatTextMoney(buyout, true), QuickAuctions:FormatTextMoney(threshold, true)))
end
-- Don't cancel an auction if it has a bid and we're set to not cancel those
elseif( not QuickAuctions.db.global.cancelWithBid and activeBid > 0 ) then
if( not isTest ) then
QuickAuctions:Log(name .. "bid", string.format(L["Undercut on %s by |cfffed000%s|r, but %s placed a bid of %s so not cancelling"], itemLink, undercutOwner, highBidder, QuickAuctions:FormatTextMoney(activeBid, true)))
end
else
if( isTest ) then return true end
if( not tempList[name] ) then
tempList[name] = true
if( QuickAuctions.Scan:IsPlayerOnly(itemID) and buyout < fallback ) then
QuickAuctions:Log(name .. "cancel", string.format(L["You are the only one posting %s, the fallback is %s (per item), cancelling so you can relist it for more gold"], itemLink, QuickAuctions:FormatTextMoney(fallback)))
else
QuickAuctions:Log(name .. "cancel", string.format(L["Undercut on %s by |cfffed000%s|r, buyout %s, yours %s (per item)"], itemLink, undercutOwner, QuickAuctions:FormatTextMoney(undercutBuyout, true), QuickAuctions:FormatTextMoney(buyout, true)))
end
end
totalToCancel = totalToCancel + 1
totalCancelled = totalCancelled + 1
CancelAuction(i)
end
end
end
end
end
-- Makes sure that the items that stack the lowest are posted first to free up space for items
-- that stack higher
local function sortByStack(a, b)
local aStack = select(8, GetItemInfo(a)) or 20
local bStack = select(8, GetItemInfo(b)) or 20
if( aStack == bStack ) then
return GetItemCount(a) < GetItemCount(b)
end
return aStack < bStack
end
function Manage:PostScan()
self:StartLog()
self:UpdateReverseLookup()
QuickAuctions:LockButtons()
table.wipe(postQueue)
table.wipe(scanList)
table.wipe(tempList)
table.wipe(status)
for bag=0, 4 do
if( QuickAuctions:IsValidBag(bag) ) then
for slot=1, GetContainerNumSlots(bag) do
local link = QuickAuctions:GetSafeLink(GetContainerItemLink(bag, slot))
if( link and reverseLookup[link] ) then
tempList[link] = true
end
end
end
end
for itemID in pairs(tempList) do
table.insert(postQueue, itemID)
end
table.sort(postQueue, sortByStack)
if( #(postQueue) == 0 ) then
QuickAuctions:Log("poststatus", L["You do not have any items to post"])
return
end
for _, itemID in pairs(postQueue) do
table.insert(scanList, (GetItemInfo(itemID)))
end
status.isManaging = true
status.totalPostQueued = 0
status.totalScanQueue = #(postQueue)
status.queueTable = postQueue
--QuickAuctions.Split:ScanStarted()
QuickAuctions.Post:ScanStarted()
--QuickAuctions.Split:Start()
QuickAuctions.Scan:StartItemScan(scanList)
end
function Manage:StopPosting()
table.wipe(postQueue)
status.isManaging = nil
status.totalPostQueued = 0
status.totalScanQueue = 0
self:StopLog()
--QuickAuctions.Split:ScanStopped()
--QuickAuctions.Split:Stop()
QuickAuctions.Post:Stop()
QuickAuctions:UnlockButtons()
end
function Manage:PostItems(itemID)
if( not itemID ) then return end
local name, itemLink, _, _, _, _, _, stackCount = GetItemInfo(itemID)
local perAuction = math.min(stackCount, self:GetConfigValue(itemID, "perAuction"))
local maxCanPost = math.floor(GetItemCount(itemID) / perAuction)
local postCap = self:GetConfigValue(itemID, "postCap")
local threshold = self:GetConfigValue(itemID, "threshold")
local auctionsCreated, activeAuctions = 0, 0
QuickAuctions:Log(name, string.format(L["Queued %s to be posted"], itemLink))
if( maxCanPost == 0 ) then
QuickAuctions:Log(name, string.format(L["Skipped %s need |cff20ff20%d|r for a single post, have |cffff2020%d|r"], itemLink, perAuction, GetItemCount(itemID)))
return
end
local buyout, bid, _, isPlayer, isWhitelist = QuickAuctions.Scan:GetLowestAuction(itemID)
-- Check if we're going to go below the threshold
if( buyout and not self:GetBoolConfigValue(itemID, "autoFallback") ) then
-- Smart undercutting is enabled, and the auction is for at least 1 gold, round it down to the nearest gold piece
local testBuyout = buyout
if( QuickAuctions.db.global.smartUndercut and testBuyout > COPPER_PER_GOLD ) then
testBuyout = math.floor(buyout / COPPER_PER_GOLD) * COPPER_PER_GOLD
else
testBuyout = testBuyout - self:GetConfigValue(itemID, "undercut")
end
if( testBuyout < threshold and buyout <= threshold ) then
QuickAuctions:Log(name, string.format(L["Skipped %s lowest buyout is %s threshold is %s"], itemLink, QuickAuctions:FormatTextMoney(buyout, true), QuickAuctions:FormatTextMoney(threshold, true)))
return
end
end
-- Auto fallback is on, and lowest buyout is below threshold, instead of posting them all
-- use the post count of the fallback tier
if( self:GetBoolConfigValue(itemID, "autoFallback") and buyout and buyout <= threshold ) then
local fallbackBuyout = QuickAuctions.Manage:GetConfigValue(itemID, "fallback")
local fallbackBid = fallbackBuyout * QuickAuctions.Manage:GetConfigValue(itemID, "bidPercent")
activeAuctions = QuickAuctions.Scan:GetPlayerAuctionCount(itemID, fallbackBuyout, fallbackBid)
-- Either the player or a whitelist person is the lowest teir so use this tiers quantity of items
elseif( isPlayer or isWhitelist ) then
activeAuctions = QuickAuctions.Scan:GetPlayerAuctionCount(itemID, buyout or 0, bid or 0)
end
-- If we have a post cap of 20, and 10 active auctions, but we can only have 5 of the item then this will only let us create 5 auctions
-- however, if we have 20 of the item it will let us post another 10
auctionsCreated = math.min(postCap - activeAuctions, maxCanPost)
if( auctionsCreated <= 0 ) then
QuickAuctions:Log(name, string.format(L["Skipped %s posted |cff20ff20%d|r of |cff20ff20%d|r already"], itemLink, activeAuctions, postCap))
return
end
-- Warn that they don't have enough to post
if( maxCanPost < postCap ) then
QuickAuctions:Log(name, string.format(L["Queued %s to be posted (Cap is |cffff2020%d|r, only can post |cffff2020%d|r need to restock)"], itemLink, postCap, maxCanPost))
end
-- The splitter will automatically pass items to the post queuer, meaning if an item doesn't even stack it will handle that just fine
stats[itemID] = (stats[itemID] or 0) + auctionsCreated
status.totalPostQueued = status.totalPostQueued + auctionsCreated
QuickAuctions.Post:QueueItem(itemID, perAuction, auctionsCreated)
--QuickAuctions.Split:QueueItem(itemID, perAuction)
--QuickAuctions.Split:UpdateBags()
end
-- Log handler
function Manage:QA_QUERY_UPDATE(event, type, filter, ...)
if( not filter ) then return end
if( type == "retry" ) then
local page, totalPages, retries, maxRetries = ...
QuickAuctions:Log(filter, string.format(L["Retry |cfffed000%d|r of |cfffed000%d|r for %s"], retries, maxRetries, filter))
elseif( type == "page" ) then
local page, totalPages = ...
QuickAuctions:Log(filter, string.format(L["Scanning page |cfffed000%d|r of |cfffed000%d|r for %s"], page, totalPages, filter))
elseif( type == "done" ) then
local page, totalPages = ...
QuickAuctions:Log(filter, string.format(L["Scanned page |cfffed000%d|r of |cfffed000%d|r for %s"], page, totalPages, filter))
QuickAuctions:SetButtonProgress("status", status.totalScanQueue - #(status.queueTable), status.totalScanQueue)
-- Do everything we need to get it splitted/posted
for i=#(postQueue), 1, -1 do
if( GetItemInfo(postQueue[i]) == filter ) then
self:PostItems(table.remove(postQueue, i))
end
end
elseif( type == "next" ) then
QuickAuctions:Log(filter, string.format(L["Scanning %s"], filter))
end
end
function Manage:QA_START_SCAN(event, type, total)
QuickAuctions:WipeLog()
QuickAuctions:Log("scanstatus", string.format(L["Scanning |cfffed000%d|r items..."], total or 0))
status.totalPostQueued = 0
table.wipe(stats)
end
function Manage:QA_STOP_SCAN(event, interrupted)
self:StopLog()
status.isManaging = nil
--QuickAuctions.Split:ScanStopped()
if( interrupted ) then
QuickAuctions:Log("scaninterrupt", L["Scan interrupted before it could finish"])
return
end
QuickAuctions:Log("scandone", L["Scan finished!"], true)
if( status.isCancelling ) then
QuickAuctions:Log("cancelstatus", L["Starting to cancel..."])
self:ReadyToCancel()
end
end
|
-- 官方模块
local ngx = require "ngx"
-- 自定义库模块
local http = require "http"
local urlencode = require "utils".urlencode
-- 应用模块
local config = require "config"
local response = require "response"
-- 将函数缓存下来
local ngx_encode_base64 = ngx.encode_base64
local _M = {}
_M._VERSION = "0.1"
_M.name = "orientdb"
local host = config.orientdb_conf["host"] or "127.0.0.1"
local port = config.orientdb_conf["port"] or 2480
local db = config.orientdb_conf["db"]
local user = config.orientdb_conf["user"] or ""
local password = config.orientdb_conf["password"] or ""
local timeout = config.orientdb_conf["timeout"] or 2000
local keepalive_timeout = config.orientdb_conf["keepalive_timeout"] or 10000
local keepalive_pool = config.orientdb_conf["keepalive_pool"] or 50
-- 查询orientdb的http api前缀
local orientdb_base_api = "http://" .. host .. ":" .. port
.. "/query/" .. db .. "/sql/"
local headers = {}
-- http basic 认证
if user ~= "" and password ~= "" then
local auth_str = user .. ":" .. password
local basic_auth = ngx_encode_base64(auth_str)
headers["Authorization"] = "Basic " .. basic_auth
end
headers["Content-Type"] = "application/json;charset=utf8"
-- 查询orientdb, 返回result table
local n = 1 -- error.log中对请求orientdb计数
_M.query = function(sql)
print(n .. "***************************: " .. sql)
n = n + 1
sql = urlencode(sql) -- 防止中文字符乱码造成查询orientdb返回空结果.
local query_api = orientdb_base_api .. sql
local res, err = http.request(query_api,
"GET",
timeout,
keepalive_timeout,
keepalive_pool,
headers)
if not res then
return response.db_err(err, sql)
--return {} -- 忽略后端错误, 从而使业务api不会报错.
end
local data = res.result
return data
end
return _M
|
green = Color.new(0, 255, 0)
yellow = Color.new(255, 255, 0)
cyan = Color.new(0, 255, 255)
monoSpaced = Font.createMonoSpaced()
proportional = Font.createProportional()
proportionalBig = Font.createProportional()
proportional:setPixelSizes(0, 32)
proportionalBig:setPixelSizes(0, 64)
monoSpaced:setPixelSizes(0, 14)
t = 0
pi = math.atan(1) * 4
while true do
screen:clear()
x = math.cos(pi / 16 * t) * 30
y = math.sin(pi / 16 * t) * 80
t = t + 1
if t == 63 then
t = 0
end
screen:fontPrint(proportional, 10, 60, "Hello", green)
screen:fontPrint(proportionalBig, 40 + x, 140 + y, "Lua Player", yellow)
screen:fontPrint(monoSpaced, 10, 200, "Above is the proportional font and this is the mono-spaced", cyan)
screen:fontPrint(monoSpaced, 10, 214, "font, where every character has the same width", cyan)
if Controls.read():start() then break end
screen.waitVblankStart()
screen.flip()
end
|
return function(utf8)
local cl = utf8.regex.compiletime.charclass.builder
return function(str, c, bs, ctx)
return cl.new():with_codes(c), utf8.next(str, bs) - bs
end
end
|
-- Theme is based on https://github.com/lcpz/awesome-copycats.git Powerarrow-dardk
local theme_assets = require("beautiful.theme_assets")
local xresources = require("beautiful.xresources")
local dpi = xresources.apply_dpi
local gfs = require("gears.filesystem")
local gcol = require("gears.color")
local surface = require("gears.surface")
local shape = require("gears.shape")
local lain_helpers = require("lain.helpers")
-- {{{ Main
-- inherit default theme
local theme = dofile(gfs.get_themes_dir() .. "zenburn/theme.lua")
theme.dir = gfs.get_configuration_dir() .. "theme/"
theme.wallpaper = theme.dir .. "wall.png"
-- }}}
-- {{{ Styles
theme.font = "Sans 8"
theme.tooltip_font = "Sans 10"
-- {{{ Colors
theme.alpha = "B0"
theme.fg_normal = "#DDDDFF"
theme.fg_focus = "#EA6F81"
theme.fg_urgent = "#CC9393"
theme.bg_normal = "#353535" .. theme.alpha
theme.bg_focus = "#2C2C2C" .. theme.alpha
theme.bg_urgent = "#1A1A1A"
theme.wibar_bg = theme.bg_focus
theme.bg_systray = theme.wibar_bg
-- }}}
-- {{{ Borders
theme.useless_gap = dpi(32)
theme.border_width = dpi(2)
theme.border_normal = theme.bg_normal
theme.border_focus = theme.bg_focus
theme.border_marked = "#CC9393"
-- }}}
theme.tasklist_bg_normal = "#00000000"
theme.tasklist_bg_focus = "#00000000"
theme.tasklist_bg_urgent = "#00000000"
theme.tasklist_bg_minimize = "#00000000"
theme.tasklist_align = "center"
theme.tasklist_max_button_size = dpi(300)
theme.tasklist_fg_focus = theme.fg_normal
theme.tasklist_underline_size = dpi(3)
-- {{{ Titlebars
theme.titlebar_bg_normal = theme.bg_normal
theme.titlebar_bg_focus = theme.bg_focus
theme.titlebar_fg_normal = theme.fg_normal
theme.titlebar_fg_focus = theme.fg_normal
theme.titlebar_fg_hover = theme.fg_focus
theme.titlebar_fg_press = theme.fg_focus
theme.titlebar_fg_active = theme.fg_urgent
-- }}}
-- There are other variable sets
-- overriding the default one when
-- defined, the sets are:
-- [taglist|tasklist]_[bg|fg]_[focus|urgent]
-- titlebar_[normal|focus]
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
-- Example:
--theme.taglist_bg_focus = "#CC9393"
-- }}}
-- {{{ Widgets
-- You can add as many variables as
-- you wish and access them by using
-- beautiful.variable in your rc.lua
--theme.fg_widget = "#AECF96"
--theme.fg_center_widget = "#88A175"
--theme.fg_end_widget = "#FF5656"
--theme.bg_widget = "#494B4F"
--theme.border_widget = "#3F3F3F"
-- }}}
-- {{{ Mouse finder
theme.mouse_finder_color = "#CC9393"
-- mouse_finder_[timeout|animate_timeout|radius|factor]
-- }}}
-- {{{ Menu
-- Variables set for theming the menu:
-- menu_[bg|fg]_[normal|focus]
-- menu_[border_color|border_width]
theme.menu_height = dpi(15)
theme.menu_width = dpi(100)
-- }}}
-- {{{ Icons
-- {{{ Taglist
-- Generate taglist squares:
local taglist_square_size = dpi(6)
theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
taglist_square_size, theme.fg_normal
)
theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
taglist_square_size, theme.fg_normal
)
theme.taglist_underline_size = dpi(3)
theme.taglist_fg_focus = theme.fg_normal
theme.taglist_bg_normal = "#00000000"
theme.taglist_bg_focus = "#00000000"
--theme.taglist_squares_resize = "false"
-- }}}
-- {{{ Misc
-- }}}
-- {{{ Layout
-- }}}
-- {{{ Titlebar
theme = theme_assets.recolor_titlebar(theme, theme.titlebar_fg_normal, "normal")
theme = theme_assets.recolor_titlebar(theme, theme.titlebar_fg_hover, "normal", "hover")
theme = theme_assets.recolor_titlebar(theme, theme.titlebar_fg_press, "normal", "press")
theme = theme_assets.recolor_titlebar(theme, theme.titlebar_fg_focus, "focus")
theme = theme_assets.recolor_titlebar(theme, theme.titlebar_fg_hover, "focus", "hover")
theme = theme_assets.recolor_titlebar(theme, theme.titlebar_fg_press, "focus", "press")
local function match_color(color, image)
local sfc = surface.duplicate_surface(image)
return gcol.recolor_image(sfc, color)
end
theme.titlebar_ontop_button_focus_active = match_color(theme.titlebar_fg_active, theme.titlebar_ontop_button_focus_active)
theme.titlebar_ontop_button_normal_active = match_color(theme.titlebar_fg_active, theme.titlebar_ontop_button_normal_active)
theme.titlebar_sticky_button_focus_active = match_color(theme.titlebar_fg_active, theme.titlebar_sticky_button_focus_active)
theme.titlebar_sticky_button_normal_active = match_color(theme.titlebar_fg_active, theme.titlebar_sticky_button_normal_active)
theme.titlebar_floating_button_focus_active = match_color(theme.titlebar_fg_active, theme.titlebar_floating_button_focus_active)
theme.titlebar_floating_button_normal_active = match_color(theme.titlebar_fg_active, theme.titlebar_floating_button_normal_active)
theme.titlebar_maximized_button_focus_active = match_color(theme.titlebar_fg_active, theme.titlebar_maximized_button_focus_activ)
theme.titlebar_maximized_button_normal_active = match_color(theme.titlebar_fg_active, theme.titlebar_maximized_button_normal_active)
-- }}}
-- }}}
theme.lain_icons = lain_helpers.icons_dir .. "layout/zenburn/"
theme.layout_termfair = match_color(theme.fg_normal, theme.lain_icons .. "termfair.png")
theme.layout_centerfair = match_color(theme.fg_normal, theme.lain_icons .. "centerfair.png") -- termfair.center
theme.layout_cascade = match_color(theme.fg_normal, theme.lain_icons .. "cascade.png")
theme.layout_cascadetile = match_color(theme.fg_normal, theme.lain_icons .. "cascadetile.png") -- cascade.tile
theme.layout_centerwork = match_color(theme.fg_normal, theme.lain_icons .. "centerwork.png")
theme.layout_centerhwork = match_color(theme.fg_normal, theme.lain_icons .. "centerworkh.png") -- centerwork.horizontal
theme = theme_assets.recolor_layout(theme, theme.fg_normal)
theme.tags_internet = theme.dir .. "icons/tags-internet.png"
theme.tags_term = theme.dir .. "icons/tags-term.png"
theme.tags_develop = theme.dir .. "icons/tags-develop.png"
theme.tags_doc = theme.dir .. "icons/tags-doc.png"
theme.tags_files = theme.dir .. "icons/tags-files.png"
return theme
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
-- scaffolding entry point for zlib
return dofile("zlib.lua")
|
local math = require("math")
local os = require("os")
local random = {}
math.randomseed(os.time())
function random.string(length, allowed_chars)
length = length or 16
allowed_chars = allowed_chars or "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
local randomString = ''
for _ = 1, length do
local i = math.random(1, #allowed_chars)
randomString = randomString .. string.sub(allowed_chars, i, i)
end
return randomString
end
function random.table(items)
items = items or 16
local random_table = {}
for _ = 1, items do
local key = random.string()
local value = random.string()
random_table[key] = value
end
return random_table
end
return random
|
--[[
/////// //////////////////
/////// 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: TrainCrossing.lua ##
-- ## Author: Noneatme (edit by MasterM) ##
-- ## Version: 1.0 ##
-- ## License: See top Folder ##
-- #######################################
-- FUNCTIONS / METHODS --
local cFunc = {}; -- Local Functions
local cSetting = {}; -- Local Settings
TrainCrossing = {};
TrainCrossing.__index = TrainCrossing;
--[[
]]
-- ///////////////////////////////
-- ///// New //////
-- ///// Returns: Object //////
-- ///////////////////////////////
function TrainCrossing:New(...)
local obj = setmetatable({}, {__index = self});
if obj.Constructor then
obj:Constructor(...);
end
return obj;
end
-- ///////////////////////////////
-- ///// Close //////
-- ///// Returns: void //////
-- ///////////////////////////////
function TrainCrossing:Close()
if(self.state == false) then
if(self.moving) then
killTimer(self.movingTimer)
end
for i = 1, self.maxSchranken, 1 do
if(self.moving) then
stopObject(self.schranke[i])
setElementPosition(self.schranke[i], self.standardPos[i][1], self.standardPos[i][2], self.standardPos[i][3])
setElementRotation(self.schranke[i], 0, 90, self.standardPos[i][6])
end
local x, y, z = getElementPosition(self.schranke[i])
local rx, ry, rz = getElementRotation(self.schranke[i])
local iAimRotY = 90-ry
local iAimRotZ = 0--self.standardPos[i][6]-rz
moveObject(self.schranke[i], self.moveTime, x, y, z, 0, iAimRotY, iAimRotZ);
if(isElement(self.crossSound[i])) then
destroyElement(self.crossSound[i])
end
self.crossSound[i] = playSound3D("res/sounds/train/railroad.mp3", self.standardPos[i][1], self.standardPos[i][2], self.standardPos[i][3], true);
setSoundMaxDistance(self.crossSound[i], 100)
end
self.moving = true;
self.movingTimer = setTimer(function() self.moving = false end, self.moveTime, 1);
self.state = not (self.state);
end
end
-- ///////////////////////////////
-- ///// Open //////
-- ///// Returns: void //////
-- ///////////////////////////////
function TrainCrossing:Open()
if(self.state == true) then
if(self.moving) then
killTimer(self.movingTimer)
end
for i = 1, self.maxSchranken, 1 do
if(self.moving) then
stopObject(self.schranke[i])
setElementPosition(self.schranke[i], self.standardPos[i][1], self.standardPos[i][2], self.standardPos[i][3])
setElementRotation(self.schranke[i], 0, 10, self.standardPos[i][6])
end
local x, y, z = getElementPosition(self.schranke[i])
local rx, ry, rz = getElementRotation(self.schranke[i])
local iAimRotY = 10-ry
local iAimRotZ = 0--self.standardPos[i][6]-rz
moveObject(self.schranke[i], self.moveTime, x, y, z, 0, iAimRotY, iAimRotZ);
if(isElement(self.crossSound[i])) then
destroyElement(self.crossSound[i])
end
end
self.moving = true;
self.movingTimer = setTimer(function() self.moving = false end, self.moveTime, 1);
self.state = not (self.state);
end
end
-- ///////////////////////////////
-- ///// ColShapeHit //////
-- ///// Returns: void //////
-- ///////////////////////////////
function TrainCrossing:ColShapeHit(element, dim)
if(dim == true) then
if(self.state == false) then
if(isElement(element)) and (getElementType(element) == "vehicle") and (self.trainHelper:IsTrain(getElementModel(element))) or getElementData(element, "IsServerTrain") then -- getElementData für das Sync-Fahrzeug
self:Close();
end
end
end
end
-- ///////////////////////////////
-- ///// ColShapeLeave //////
-- ///// Returns: void //////
-- ///////////////////////////////
function TrainCrossing:ColShapeLeave(element, dim)
if(dim == true) then
if(self.state == true) then
local Open = true;
local counter = 0
for index, vehicle in pairs(getElementsWithinColShape(self.colShape, "vehicle")) do
if(self.trainHelper:IsTrain(getElementModel(vehicle))) or getElementData(vehicle,"IsServerTrain") then
counter = counter+1
if counter > 1 then
Open = false;
break;
end
end
end
if(Open) then
self:Open();
end
end
end
end
-- ///////////////////////////////
-- ///// Constructor //////
-- ///// Returns: void //////
-- ///////////////////////////////
function TrainCrossing:Constructor(iObjectID, tblSchranke, iRadius)
-- Klassenvariablen --
self.schranke = {}
self.schranke[1] = createObject(iObjectID, tblSchranke[1], tblSchranke[2], tblSchranke[3], 0, 90, tblSchranke[4]);
self.schranke[2] = createObject(iObjectID, tblSchranke[5], tblSchranke[6], tblSchranke[7], 0, 90, tblSchranke[8]);
self.standardPos = {}
self.standardPos[1] = {tblSchranke[1], tblSchranke[2], tblSchranke[3], 0, 90, tblSchranke[4]};
self.standardPos[2] = {tblSchranke[5], tblSchranke[6], tblSchranke[7], 0, 90, tblSchranke[8]};
self.crossSound = {}
self.moving = false;
self.movingTimer = nil;
self.maxSchranken = #self.schranke;
self.radius = iRadius or 50;
self.state = true; -- Ist Oben
self.moveTime = 3000;
self.colShape = createColSphere(tblSchranke[1], tblSchranke[2], tblSchranke[3], self.radius)
self.trainHelper = TrainHelper:New();
-- Methoden --
--self.moveUpFunc = function() self:Close() end;
--self.moveDownFunc = function() self:Open() end;
self.resetMoveStateFunc = function() self:ResetMoveState() end;
self.ColShapeHitFunc = function(...) self:ColShapeHit(...) end;
self.ColShapeLeaveFunc = function(...) self:ColShapeLeave(...) end;
-- Events --
addEventHandler("onClientColShapeHit", self.colShape, self.ColShapeHitFunc)
addEventHandler("onClientColShapeLeave", self.colShape, self.ColShapeLeaveFunc)
self:Open();
--logger:OutputInfo("[CALLING] TrainCrossing: Constructor");
end
-- EVENT HANDLER --
|
--settings.lua
local enable_connect_particles = {
type = "bool-setting",
name = "ret-enable-connect-particles",
setting_type = "runtime-global",
default_value = true,
order = "a-a"
}
local enable_failure_text = {
type = "bool-setting",
name = "ret-enable-failure-text",
setting_type = "runtime-global",
default_value = true,
order = "a-b"
}
local enable_modular_info_text = {
type = "bool-setting",
name = "ret-enable-modular-info",
setting_type = "runtime-global",
default_value = true,
order = "a-c"
}
local enable_zigzag_wire = {
type = "bool-setting",
name = "ret-enable-zigzag-wire",
setting_type = "runtime-global",
default_value = false,
order = "b-a"
}
local enable_zigzag_vertical_only = {
type = "bool-setting",
name = "ret-enable-zigzag-vertical-only",
setting_type = "runtime-global",
default_value = true,
order = "b-a-a"
}
local enable_circuit_wire = {
type = "bool-setting",
name = "ret-enable-circuit-wire",
setting_type = "runtime-global",
default_value = false,
order = "b-b"
}
local enable_rewire_neighbours = {
type = "bool-setting",
name = "ret-enable-rewire-neighbours",
setting_type = "runtime-global",
default_value = false,
order = "b-c"
}
local max_pole_search_distance = {
type = "int-setting",
name = "ret-max-pole-search-distance",
setting_type = "runtime-global",
default_value = 6,
min_value = 1,
max_value = 20,
order = "c"
}
local ticks_per_update = {
type = "int-setting",
name = "ret-ticks-per-update",
setting_type = "startup",
default_value = 60,
min_value = 10,
max_value = 600,
order = "a"
}
data:extend{enable_connect_particles, enable_failure_text, enable_modular_info_text,
enable_circuit_wire, enable_zigzag_wire, enable_zigzag_vertical_only,
enable_rewire_neighbours, max_pole_search_distance, ticks_per_update}
|
local BodyMetadata = require("octo.model.body-metadata").BodyMetadata
local TitleMetadata = require("octo.model.title-metadata").TitleMetadata
local autocmds = require "octo.autocmds"
local config = require "octo.config"
local constants = require "octo.constants"
local folds = require "octo.folds"
local gh = require "octo.gh"
local graphql = require "octo.gh.graphql"
local signs = require "octo.ui.signs"
local writers = require "octo.ui.writers"
local utils = require "octo.utils"
local M = {}
---@class OctoBuffer
---@field bufnr integer
---@field number integer
---@field repo string
---@field kind string
---@field titleMetadata TitleMetadata
---@field bodyMetadata BodyMetadata
---@field commentsMetadata CommentMetadata[]
---@field threadsMetadata ThreadMetadata[]
---@field node table
---@field taggable_users string[]
local OctoBuffer = {}
OctoBuffer.__index = OctoBuffer
---OctoBuffer constructor.
---@return OctoBuffer
function OctoBuffer:new(opts)
local this = {
bufnr = opts.bufnr or vim.api.nvim_get_current_buf(),
number = opts.number,
repo = opts.repo,
node = opts.node,
titleMetadata = TitleMetadata:new(),
bodyMetadata = BodyMetadata:new(),
commentsMetadata = opts.commentsMetadata or {},
threadsMetadata = opts.threadsMetadata or {},
}
if this.repo then
this.owner, this.name = utils.split_repo(this.repo)
end
if this.node and this.node.commits then
this.kind = "pull"
this.taggable_users = { this.node.author.login }
elseif this.node and this.number then
this.kind = "issue"
this.taggable_users = { this.node.author.login }
elseif this.node and not this.number then
this.kind = "repo"
else
this.kind = "reviewthread"
end
setmetatable(this, self)
octo_buffers[this.bufnr] = this
return this
end
M.OctoBuffer = OctoBuffer
---Apply the buffer mappings
function OctoBuffer:apply_mappings()
local conf = config.get_config()
local kind = self.kind
if self.kind == "pull" then
kind = "pull_request"
elseif self.kind == "reviewthread" then
kind = "review_thread"
end
for action, value in pairs(conf.mappings[kind]) do
local mappings = require "octo.mappings"
local mapping_opts = { silent = true, noremap = true, buffer = self.bufnr, desc = value.desc }
vim.keymap.set("n", value.lhs, mappings[action], mapping_opts)
end
end
---Clears the buffer
function OctoBuffer:clear()
-- clear buffer
vim.api.nvim_buf_set_lines(self.bufnr, 0, -1, false, {})
-- delete extmarks
local extmarks = vim.api.nvim_buf_get_extmarks(self.bufnr, constants.OCTO_COMMENT_NS, 0, -1, {})
for _, m in ipairs(extmarks) do
vim.api.nvim_buf_del_extmark(self.bufnr, constants.OCTO_COMMENT_NS, m[1])
end
end
---Writes a repo to the buffer
function OctoBuffer:render_repo()
self:clear()
writers.write_repo(self.bufnr, self.node)
-- reset modified option
vim.api.nvim_buf_set_option(self.bufnr, "modified", false)
self.ready = true
end
---Writes an issue or pull request to the buffer.
function OctoBuffer:render_issue()
self:clear()
-- write title
writers.write_title(self.bufnr, self.node.title, 1)
-- write details in buffer
writers.write_details(self.bufnr, self.node)
-- write issue/pr status
writers.write_state(self.bufnr, self.node.state:upper(), self.number)
-- write body
writers.write_body(self.bufnr, self.node)
-- write body reactions
local reaction_line
if utils.count_reactions(self.node.reactionGroups) > 0 then
local line = vim.api.nvim_buf_line_count(self.bufnr) + 1
writers.write_block(self.bufnr, { "", "" }, line)
reaction_line = writers.write_reactions(self.bufnr, self.node.reactionGroups, line)
end
self.bodyMetadata.reactionGroups = self.node.reactionGroups
self.bodyMetadata.reactionLine = reaction_line
-- write timeline items
local unrendered_labeled_events = {}
local unrendered_unlabeled_events = {}
local prev_is_event = false
for _, item in ipairs(self.node.timelineItems.nodes) do
if item.__typename ~= "LabeledEvent" and #unrendered_labeled_events > 0 then
writers.write_labeled_events(self.bufnr, unrendered_labeled_events, "added")
unrendered_labeled_events = {}
prev_is_event = true
end
if item.__typename ~= "UnlabeledEvent" and #unrendered_unlabeled_events > 0 then
writers.write_labeled_events(self.bufnr, unrendered_unlabeled_events, "removed")
unrendered_unlabeled_events = {}
prev_is_event = true
end
if item.__typename == "IssueComment" then
if prev_is_event then
writers.write_block(self.bufnr, { "" })
end
-- write the comment
local start_line, end_line = writers.write_comment(self.bufnr, item, "IssueComment")
folds.create(self.bufnr, start_line + 1, end_line, true)
prev_is_event = false
elseif item.__typename == "PullRequestReview" then
if prev_is_event then
writers.write_block(self.bufnr, { "" })
end
-- A review can have 0+ threads
local threads = {}
for _, comment in ipairs(item.comments.nodes) do
for _, reviewThread in ipairs(self.node.reviewThreads.nodes) do
if comment.id == reviewThread.comments.nodes[1].id then
-- found a thread for the current review
table.insert(threads, reviewThread)
end
end
end
-- skip reviews with no threads and empty body
if #threads > 0 or not utils.is_blank(item.body) then
-- print review header and top level comment
local review_start, review_end = writers.write_comment(self.bufnr, item, "PullRequestReview")
-- print threads
if #threads > 0 then
review_end = writers.write_threads(self.bufnr, threads)
folds.create(self.bufnr, review_start + 1, review_end, true)
end
writers.write_block(self.bufnr, { "" })
prev_is_event = false
end
elseif item.__typename == "AssignedEvent" then
writers.write_assigned_event(self.bufnr, item)
prev_is_event = true
elseif item.__typename == "PullRequestCommit" then
writers.write_commit_event(self.bufnr, item)
prev_is_event = true
elseif item.__typename == "MergedEvent" then
writers.write_merged_event(self.bufnr, item)
prev_is_event = true
elseif item.__typename == "ClosedEvent" then
writers.write_closed_event(self.bufnr, item)
prev_is_event = true
elseif item.__typename == "ReopenedEvent" then
writers.write_reopened_event(self.bufnr, item)
prev_is_event = true
elseif item.__typename == "LabeledEvent" then
table.insert(unrendered_labeled_events, item)
elseif item.__typename == "UnlabeledEvent" then
table.insert(unrendered_unlabeled_events, item)
elseif item.__typename == "ReviewRequestedEvent" then
writers.write_review_requested_event(self.bufnr, item)
prev_is_event = true
elseif item.__typename == "ReviewRequestRemovedEvent" then
writers.write_review_request_removed_event(self.bufnr, item)
prev_is_event = true
elseif item.__typename == "ReviewDismissedEvent" then
writers.write_review_dismissed_event(self.bufnr, item)
prev_is_event = true
end
end
if prev_is_event then
writers.write_block(self.bufnr, { "" })
end
-- drop undo history
utils.clear_history()
-- reset modified option
vim.api.nvim_buf_set_option(self.bufnr, "modified", false)
self.ready = true
end
---Draws review threads
function OctoBuffer:render_threads(threads)
self:clear()
writers.write_threads(self.bufnr, threads)
self.ready = true
end
---Confgiures the buffer
function OctoBuffer:configure()
-- configure buffer
vim.api.nvim_buf_call(self.bufnr, function()
--options
vim.cmd [[setlocal filetype=octo]]
vim.cmd [[setlocal buftype=acwrite]]
vim.cmd [[setlocal omnifunc=v:lua.octo_omnifunc]]
vim.cmd [[setlocal conceallevel=2]]
vim.cmd [[setlocal signcolumn=yes]]
vim.cmd [[setlocal foldenable]]
vim.cmd [[setlocal foldtext=v:lua.octo_foldtext()]]
vim.cmd [[setlocal foldmethod=manual]]
vim.cmd [[setlocal foldcolumn=3]]
vim.cmd [[setlocal foldlevelstart=99]]
vim.cmd [[setlocal nonumber norelativenumber nocursorline wrap]]
vim.cmd [[setlocal fillchars=fold:⠀,foldopen:⠀,foldclose:⠀,foldsep:⠀]]
autocmds.octo_buffer(self.bufnr)
end)
self:apply_mappings()
end
---Accumulates all the taggable users into a single list that
--gets set as a buffer variable `taggable_users`. If this list of users
---is needed syncronously, this function will need to be refactored.
---The list of taggable users should contain:
-- - The PR author
-- - The authors of all the existing comments
-- - The contributors of the repo
function OctoBuffer:async_fetch_taggable_users()
local users = self.taggable_users or {}
-- add participants
for _, p in pairs(self.node.participants) do
table.insert(users, p.login)
end
-- add comment authors
for _, c in pairs(self.commentsMetadata) do
table.insert(users, c.author)
end
-- add repo contributors
gh.run {
args = { "api", string.format("repos/%s/contributors", self.repo) },
cb = function(response)
if not utils.is_blank(response) then
local resp = vim.fn.json_decode(response)
for _, contributor in ipairs(resp) do
table.insert(users, contributor.login)
end
self.taggable_users = users
end
end,
}
end
---Fetches the issues in the repo so they can be used for completion.
function OctoBuffer:async_fetch_issues()
gh.run {
args = { "api", string.format("repos/%s/issues", self.repo) },
cb = function(response)
local issues_metadata = {}
local resp = vim.fn.json_decode(response)
for _, issue in ipairs(resp) do
table.insert(issues_metadata, { number = issue.number, title = issue.title })
end
octo_repo_issues[self.repo] = issues_metadata
end,
}
end
---Saves the Octo buffer and syncs all the comments/title/body with GitHub
function OctoBuffer:save()
local bufnr = vim.api.nvim_get_current_buf()
-- collect comment metadata
self:update_metadata()
-- title & body
if self.kind == "issue" or self.kind == "pull" then
self:do_save_title_and_body()
end
-- comments
for _, comment_metadata in ipairs(self.commentsMetadata) do
if comment_metadata.body ~= comment_metadata.savedBody then
if comment_metadata.id == -1 then
-- we use -1 as a placeholder for new comments
if comment_metadata.kind == "IssueComment" then
self:do_add_issue_comment(comment_metadata)
elseif comment_metadata.kind == "PullRequestReviewComment" then
if not utils.is_blank(comment_metadata.replyTo) then
-- comment is a reply to a thread comment
self:do_add_thread_comment(comment_metadata)
else
-- comment starts a new thread of comments
self:do_add_new_thread(comment_metadata)
end
elseif comment_metadata.kind == "PullRequestComment" then
self:do_add_pull_request_comment(comment_metadata)
end
else
-- comment is an existing comment
self:do_update_comment(comment_metadata)
end
end
end
-- reset modified option
vim.api.nvim_buf_set_option(bufnr, "modified", false)
end
---Sync issue/PR title and body with GitHub
function OctoBuffer:do_save_title_and_body()
local title_metadata = self.titleMetadata
local desc_metadata = self.bodyMetadata
local id = self.node.id
if title_metadata.dirty or desc_metadata.dirty then
-- trust but verify
if string.find(title_metadata.body, "\n") then
vim.api.nvim_err_writeln "Title can't contains new lines"
return
elseif title_metadata.body == "" then
vim.api.nvim_err_writeln "Title can't be blank"
return
end
local query
if self:isIssue() then
query = graphql("update_issue_mutation", id, title_metadata.body, desc_metadata.body)
elseif self:isPullRequest() then
query = graphql("update_pull_request_mutation", id, title_metadata.body, desc_metadata.body)
end
gh.run {
args = { "api", "graphql", "-f", string.format("query=%s", query) },
cb = function(output, stderr)
if stderr and not utils.is_blank(stderr) then
vim.api.nvim_err_writeln(stderr)
elseif output then
local resp = vim.fn.json_decode(output)
local obj
if self:isPullRequest() then
obj = resp.data.updatePullRequest.pullRequest
elseif self:isIssue() then
obj = resp.data.updateIssue.issue
end
if title_metadata.body == obj.title then
title_metadata.savedBody = obj.title
title_metadata.dirty = false
self.titleMetadata = title_metadata
end
if desc_metadata.body == obj.body then
desc_metadata.savedBody = obj.body
desc_metadata.dirty = false
self.bodyMetadata = desc_metadata
end
self:render_signcolumn()
utils.notify("Saved!", 1)
end
end,
}
end
end
---Add a new comment to the issue/PR
function OctoBuffer:do_add_issue_comment(comment_metadata)
-- create new issue comment
local id = self.node.id
local add_query = graphql("add_issue_comment_mutation", id, comment_metadata.body)
gh.run {
args = { "api", "graphql", "-f", string.format("query=%s", add_query) },
cb = function(output, stderr)
if stderr and not utils.is_blank(stderr) then
vim.api.nvim_err_writeln(stderr)
elseif output then
local resp = vim.fn.json_decode(output)
local respBody = resp.data.addComment.commentEdge.node.body
local respId = resp.data.addComment.commentEdge.node.id
if vim.fn.trim(comment_metadata.body) == vim.fn.trim(respBody) then
local comments = self.commentsMetadata
for i, c in ipairs(comments) do
if tonumber(c.id) == -1 then
comments[i].id = respId
comments[i].savedBody = respBody
comments[i].dirty = false
break
end
end
self:render_signcolumn()
end
end
end,
}
end
---Replies to a review comment thread
function OctoBuffer:do_add_thread_comment(comment_metadata)
-- create new thread reply
local query = graphql(
"add_pull_request_review_comment_mutation",
comment_metadata.replyTo,
comment_metadata.body,
comment_metadata.reviewId
)
gh.run {
args = { "api", "graphql", "-f", string.format("query=%s", query) },
cb = function(output, stderr)
if stderr and not utils.is_blank(stderr) then
vim.api.nvim_err_writeln(stderr)
elseif output then
local resp = vim.fn.json_decode(output)
local resp_comment = resp.data.addPullRequestReviewComment.comment
local comment_end
if vim.fn.trim(comment_metadata.body) == vim.fn.trim(resp_comment.body) then
local comments = self.commentsMetadata
for i, c in ipairs(comments) do
if tonumber(c.id) == -1 then
comments[i].id = resp_comment.id
comments[i].savedBody = resp_comment.body
comments[i].dirty = false
comment_end = comments[i].endLine
break
end
end
local threads = resp_comment.pullRequest.reviewThreads.nodes
local review = require("octo.reviews").get_current_review()
if review then
review:update_threads(threads)
end
self:render_signcolumn()
-- update thread map
local thread_id
for _, thread in ipairs(threads) do
for _, c in ipairs(thread.comments.nodes) do
if c.id == resp_comment.id then
thread_id = thread.id
break
end
end
end
local mark_id
for markId, threadMetadata in pairs(self.threadsMetadata) do
if threadMetadata.threadId == thread_id then
mark_id = markId
end
end
local extmark = vim.api.nvim_buf_get_extmark_by_id(
self.bufnr,
constants.OCTO_THREAD_NS,
tonumber(mark_id),
{ details = true }
)
local thread_start = extmark[1]
-- update extmark
vim.api.nvim_buf_del_extmark(self.bufnr, constants.OCTO_THREAD_NS, tonumber(mark_id))
local thread_mark_id = vim.api.nvim_buf_set_extmark(self.bufnr, constants.OCTO_THREAD_NS, thread_start, 0, {
end_line = comment_end + 2,
end_col = 0,
})
self.threadsMetadata[tostring(thread_mark_id)] = self.threadsMetadata[tostring(mark_id)]
self.threadsMetadata[tostring(mark_id)] = nil
end
end
end,
}
end
---Adds a new review comment thread to the current review.
function OctoBuffer:do_add_new_thread(comment_metadata)
--TODO: How to create a new thread on a line where there is already one
local review = require("octo.reviews").get_current_review()
local layout = review.layout
local pr = review.pull_request
local file = layout:cur_file()
if not file then
utils.notify("No file selected", 1)
return
end
local review_level = review:get_level()
local isMultiline = true
if comment_metadata.snippetStartLine == comment_metadata.snippetEndLine then
isMultiline = false
end
-- create new thread
if review_level == "PR" then
local query
if isMultiline then
query = graphql(
"add_pull_request_review_multiline_thread_mutation",
comment_metadata.reviewId,
comment_metadata.body,
comment_metadata.path,
comment_metadata.diffSide,
comment_metadata.diffSide,
comment_metadata.snippetStartLine,
comment_metadata.snippetEndLine
)
else
query = graphql(
"add_pull_request_review_thread_mutation",
comment_metadata.reviewId,
comment_metadata.body,
comment_metadata.path,
comment_metadata.diffSide,
comment_metadata.snippetStartLine
)
end
gh.run {
args = { "api", "graphql", "-f", string.format("query=%s", query) },
cb = function(output, stderr)
if stderr and not utils.is_blank(stderr) then
vim.api.nvim_err_writeln(stderr)
elseif output then
local resp = vim.fn.json_decode(output).data.addPullRequestReviewThread
if not utils.is_blank(resp.thread) then
local new_comment = resp.thread.comments.nodes[1]
if vim.fn.trim(comment_metadata.body) == vim.fn.trim(new_comment.body) then
local comments = self.commentsMetadata
for i, c in ipairs(comments) do
if tonumber(c.id) == -1 then
comments[i].id = new_comment.id
comments[i].savedBody = new_comment.body
comments[i].dirty = false
break
end
end
local threads = resp.thread.pullRequest.reviewThreads.nodes
if review then
review:update_threads(threads)
end
self:render_signcolumn()
end
else
utils.notify("Failed to create thread", 2)
return
end
end
end,
}
elseif review_level == "COMMIT" then
if isMultiline then
utils.notify("Can't create a multiline comment at the commit level", 2)
return
else
-- get the line number the comment is on
local line
for _, thread in ipairs(vim.tbl_values(self.threadsMetadata)) do
if thread.threadId == -1 then
line = thread.line
end
end
-- we need to convert the line number to a diff line number (position)
local position = line
if file.status ~= "A" then
-- for non-added files (modified), check we are in a valid comment range
local diffhunks = {}
local diffhunk = ""
local left_comment_ranges, right_comment_ranges = {}, {}
if not utils.is_blank(pr.diff) then
local diffhunks_map = utils.extract_diffhunks_from_diff(pr.diff)
local file_diffhunks = diffhunks_map[comment_metadata.path]
diffhunks, left_comment_ranges, right_comment_ranges = utils.process_patch(file_diffhunks)
end
local comment_ranges
if comment_metadata.diffSide == "RIGHT" then
comment_ranges = right_comment_ranges
elseif comment_metadata.diffSide == "LEFT" then
comment_ranges = left_comment_ranges
end
local idx, offset = 0, 0
for i, range in ipairs(comment_ranges) do
if range[1] <= line and range[2] >= line then
diffhunk = diffhunks[i]
idx = i
break
end
end
for i, hunk in ipairs(diffhunks) do
if i < idx then
offset = offset + #vim.split(hunk, "\n")
end
end
if not vim.startswith(diffhunk, "@@") then
diffhunk = "@@ " .. diffhunk
end
local map = utils.generate_line2position_map(diffhunk)
if comment_metadata.diffSide == "RIGHT" then
position = map.right_side_lines[tostring(line)]
elseif comment_metadata.diffSide == "LEFT" then
position = map.left_side_lines[tostring(line)]
end
position = position + offset - 1
end
local query = graphql(
"add_pull_request_review_commit_thread_mutation",
layout.right.commit,
comment_metadata.body,
comment_metadata.reviewId,
comment_metadata.path,
position
)
gh.run {
args = { "api", "graphql", "-f", string.format("query=%s", query) },
cb = function(output, stderr)
if stderr and not utils.is_blank(stderr) then
vim.api.nvim_err_writeln(stderr)
elseif output then
local r = vim.fn.json_decode(output)
local resp = r.data.addPullRequestReviewComment
if not utils.is_blank(resp.comment) then
if vim.fn.trim(comment_metadata.body) == vim.fn.trim(resp.comment.body) then
local comments = self.commentsMetadata
for i, c in ipairs(comments) do
if tonumber(c.id) == -1 then
comments[i].id = resp.comment.id
comments[i].savedBody = resp.comment.body
comments[i].dirty = false
break
end
end
if review then
local threads = resp.comment.pullRequest.reviewThreads.nodes
review:update_threads(threads)
end
self:render_signcolumn()
end
else
utils.notify("Failed to create thread", 2)
return
end
end
end,
}
end
end
end
---Replies a review thread w/o creating a new review
function OctoBuffer:do_add_pull_request_comment(comment_metadata)
local current_review = require("octo.reviews").get_current_review()
if not utils.is_blank(current_review) then
utils.notify("Please submit or discard the current review before adding a comment", 2)
return
end
gh.run {
args = {
"api",
"--method",
"POST",
string.format("/repos/%s/pulls/%d/comments/%s/replies", self.repo, self.number, comment_metadata.replyToRest),
"-f",
string.format([[body=%s]], utils.escape_char(comment_metadata.body)),
"--jq",
".",
},
headers = { "Accept: application/vnd.github.v3+json" },
cb = function(output, stderr)
if not utils.is_blank(stderr) then
utils.notify(stderr, 2)
elseif output then
local resp = vim.fn.json_decode(output)
print(vim.inspect(resp))
if not utils.is_blank(resp) then
if vim.fn.trim(comment_metadata.body) == vim.fn.trim(resp.body) then
local comments = self.commentsMetadata
for i, c in ipairs(comments) do
if tonumber(c.id) == -1 then
comments[i].id = resp.id
comments[i].savedBody = resp.body
comments[i].dirty = false
break
end
end
self:render_signcolumn()
end
else
utils.notify("Failed to create thread", 2)
return
end
end
end,
}
end
---Update a comment's metadata
function OctoBuffer:do_update_comment(comment_metadata)
-- update comment/reply
local update_query
if comment_metadata.kind == "IssueComment" then
update_query = graphql("update_issue_comment_mutation", comment_metadata.id, comment_metadata.body)
elseif comment_metadata.kind == "PullRequestReviewComment" then
update_query = graphql("update_pull_request_review_comment_mutation", comment_metadata.id, comment_metadata.body)
elseif comment_metadata.kind == "PullRequestReview" then
update_query = graphql("update_pull_request_review_mutation", comment_metadata.id, comment_metadata.body)
end
gh.run {
args = { "api", "graphql", "-f", string.format("query=%s", update_query) },
cb = function(output, stderr)
if stderr and not utils.is_blank(stderr) then
vim.api.nvim_err_writeln(stderr)
elseif output then
local resp = vim.fn.json_decode(output)
local resp_comment
if comment_metadata.kind == "IssueComment" then
resp_comment = resp.data.updateIssueComment.issueComment
elseif comment_metadata.kind == "PullRequestReviewComment" then
resp_comment = resp.data.updatePullRequestReviewComment.pullRequestReviewComment
local threads =
resp.data.updatePullRequestReviewComment.pullRequestReviewComment.pullRequest.reviewThreads.nodes
local review = require("octo.reviews").get_current_review()
if review then
review:update_threads(threads)
end
elseif comment_metadata.kind == "PullRequestReview" then
resp_comment = resp.data.updatePullRequestReview.pullRequestReview
end
if resp_comment and vim.fn.trim(comment_metadata.body) == vim.fn.trim(resp_comment.body) then
local comments = self.commentsMetadata
for i, c in ipairs(comments) do
if c.id == comment_metadata.id then
comments[i].savedBody = comment_metadata.body
comments[i].dirty = false
break
end
end
self:render_signcolumn()
end
end
end,
}
end
---Update the buffer metadata
function OctoBuffer:update_metadata()
if not self.ready then
return
end
local metadata_objs = {}
if self.kind == "issue" or self.kind == "pull" then
table.insert(metadata_objs, self.titleMetadata)
table.insert(metadata_objs, self.bodyMetadata)
end
for _, m in ipairs(self.commentsMetadata) do
table.insert(metadata_objs, m)
end
for _, metadata in ipairs(metadata_objs) do
local mark = vim.api.nvim_buf_get_extmark_by_id(
self.bufnr,
constants.OCTO_COMMENT_NS,
metadata.extmark,
{ details = true }
)
local start_line, end_line, text = utils.get_extmark_region(self.bufnr, mark)
metadata.body = text
metadata.startLine = start_line
metadata.endLine = end_line
metadata.dirty = vim.fn.trim(metadata.body) ~= vim.fn.trim(metadata.savedBody) and true or false
end
end
---Renders the signcolumn
function OctoBuffer:render_signcolumn()
if not self.ready then
return
end
local issue_dirty = false
-- update comment metadata (lines, etc.)
self:update_metadata()
-- clear all signs
signs.unplace(self.bufnr)
-- clear virtual texts
vim.api.nvim_buf_clear_namespace(self.bufnr, constants.OCTO_EMPTY_MSG_VT_NS, 0, -1)
local metadata
if self.kind == "issue" or self.kind == "pull" then
-- title
metadata = self.titleMetadata
if metadata then
if metadata.dirty then
issue_dirty = true
end
signs.place_signs(self.bufnr, metadata.startLine, metadata.endLine, metadata.dirty)
end
-- description
metadata = self.bodyMetadata
if metadata then
if metadata.dirty then
issue_dirty = true
end
signs.place_signs(self.bufnr, metadata.startLine, metadata.endLine, metadata.dirty)
-- description virtual text
if utils.is_blank(metadata.body) then
local desc_vt = { { constants.NO_BODY_MSG, "OctoEmpty" } }
writers.write_virtual_text(self.bufnr, constants.OCTO_EMPTY_MSG_VT_NS, metadata.startLine, desc_vt)
end
end
end
-- comments
local comments_metadata = self.commentsMetadata
for _, comment_metadata in ipairs(comments_metadata) do
metadata = comment_metadata
if metadata then
if metadata.dirty then
issue_dirty = true
end
signs.place_signs(self.bufnr, metadata.startLine, metadata.endLine, metadata.dirty)
-- comment virtual text
if utils.is_blank(metadata.body) then
local comment_vt = { { constants.NO_BODY_MSG, "OctoEmpty" } }
writers.write_virtual_text(self.bufnr, constants.OCTO_EMPTY_MSG_VT_NS, metadata.startLine, comment_vt)
end
end
end
-- reset modified option
if not issue_dirty then
vim.api.nvim_buf_set_option(self.bufnr, "modified", false)
end
end
--- Checks if the buffer represents a review comment thread
function OctoBuffer:isReviewThread()
return self.kind == "reviewthread"
end
--- Checks if the buffer represents a Pull Request
function OctoBuffer:isPullRequest()
return self.kind == "pull"
end
--- Checks if the buffer represents an Issue
function OctoBuffer:isIssue()
return self.kind == "issue"
end
---Checks if the buffer represents a GitHub repo
function OctoBuffer:isRepo()
return self.kind == "repo"
end
---Gets the PR object for the current octo buffer
function OctoBuffer:get_pr()
if not self:isPullRequest() then
utils.notify("Not in a PR buffer", 2)
return
end
local Rev = require("octo.reviews.rev").Rev
local PullRequest = require("octo.model.pull-request").PullRequest
local bufnr = vim.api.nvim_get_current_buf()
return PullRequest:new {
bufnr = bufnr,
repo = self.repo,
number = self.number,
id = self.node.id,
left = Rev:new(self.node.baseRefOid),
right = Rev:new(self.node.headRefOid),
files = self.node.files.nodes,
}
end
--- Get a issue/PR comment at cursor (if any)
function OctoBuffer:get_comment_at_cursor()
local cursor = vim.api.nvim_win_get_cursor(0)
return self:get_comment_at_line(cursor[1])
end
--- Get a issue/PR comment at a given line (if any)
function OctoBuffer:get_comment_at_line(line)
for _, comment in ipairs(self.commentsMetadata) do
local mark = vim.api.nvim_buf_get_extmark_by_id(
self.bufnr,
constants.OCTO_COMMENT_NS,
comment.extmark,
{ details = true }
)
local start_line = mark[1] + 1
local end_line = mark[3]["end_row"] + 1
if start_line + 1 <= line and end_line - 2 >= line then
comment.bufferStartLine = start_line
comment.bufferEndLine = end_line
return comment
end
end
end
---Gets the issue/PR body at cursor (if any)
function OctoBuffer:get_body_at_cursor()
local cursor = vim.api.nvim_win_get_cursor(0)
local metadata = self.bodyMetadata
local mark = vim.api.nvim_buf_get_extmark_by_id(
self.bufnr,
constants.OCTO_COMMENT_NS,
metadata.extmark,
{ details = true }
)
local start_line = mark[1] + 1
local end_line = mark[3]["end_row"] + 1
if start_line + 1 <= cursor[1] and end_line - 2 >= cursor[1] then
return metadata, start_line, end_line
end
end
---Gets the review thread at cursor (if any)
function OctoBuffer:get_thread_at_cursor()
local cursor = vim.api.nvim_win_get_cursor(0)
return self:get_thread_at_line(cursor[1])
end
---Gets the review thread at a given line (if any)
function OctoBuffer:get_thread_at_line(line)
local thread_marks = vim.api.nvim_buf_get_extmarks(self.bufnr, constants.OCTO_THREAD_NS, 0, -1, { details = true })
for _, mark in ipairs(thread_marks) do
local thread = self.threadsMetadata[tostring(mark[1])]
if thread then
local startLine = mark[2] - 1
local endLine = mark[4].end_row
if startLine <= line and endLine >= line then
thread.bufferStartLine = startLine
thread.bufferEndLine = endLine
return thread
end
end
end
end
---Gets the reactions groups at cursor (if any)
function OctoBuffer:get_reactions_at_cursor()
local cursor = vim.api.nvim_win_get_cursor(0)
local body_reaction_line = self.bodyMetadata.reactionLine
if body_reaction_line and body_reaction_line == cursor[1] then
return self.node.id
end
local comments_metadata = self.commentsMetadata
if comments_metadata then
for _, c in pairs(comments_metadata) do
if c.reactionLine and c.reactionLine == cursor[1] then
return c.id
end
end
end
end
---Updates the reactions groups at cursor (if any)
function OctoBuffer:update_reactions_at_cursor(reaction_groups, reaction_line)
local cursor = vim.api.nvim_win_get_cursor(0)
local reactions_count = 0
for _, group in ipairs(reaction_groups) do
if group.users.totalCount > 0 then
reactions_count = reactions_count + 1
end
end
local comments = self.commentsMetadata
for i, comment in ipairs(comments) do
local mark = vim.api.nvim_buf_get_extmark_by_id(
self.bufnr,
constants.OCTO_COMMENT_NS,
comment.extmark,
{ details = true }
)
local start_line = mark[1] + 1
local end_line = mark[3].end_row + 1
if start_line <= cursor[1] and end_line >= cursor[1] then
-- cursor located in the body of a comment
-- update reaction groups
comments[i].reactionGroups = reaction_groups
-- update reaction line
if not comments[i].reactionLine and reactions_count > 0 then
comments[i].reactionLine = reaction_line
elseif reactions_count == 0 then
comments[i].reactionLine = nil
end
return
end
end
-- cursor not located at any comment, so updating issue
-- update reaction groups
self.bodyMetadata.reactionGroups = reaction_groups
local body_reaction_line = self.bodyMetadata.reactionLine
if not body_reaction_line and reactions_count > 0 then
self.bodyMetadata.reactionLine = reaction_line
elseif reactions_count == 0 then
self.bodyMetadata.reactionLine = nil
end
end
return M
|
module("luci.controller.dect", package.seeall)
function index()
if not nixio.fs.access("/usr/sbin/dectmngr2") then
return
end
local users = { "admin", "support", "user" }
local page
for k, user in pairs(users) do
page = node(user, "services", "dect")
page.target = template("dect_status")
page.title = _("DECT")
page.subindex = true
entry({user, "services", "dect", "main"}, template("dect_status"), "Status", 1)
entry({user, "services", "dect", "config"}, cbi("admin_status/dect"), "Configuration", 2)
page = entry({user, "services", "dect", "status"}, call("status"))
page = entry({user, "services", "dect", "reg_start"}, call("reg_start"))
page = entry({user, "services", "dect", "delete_hset"}, call("delete_hset"))
page = entry({user, "services", "dect", "ping_hset"}, call("ping_hset"))
--page = entry({user, "services", "dect", "switch_plug"}, call("switch_plug"))
end
end
function reg_start()
luci.sys.exec("ubus -t 2 call dect state \"{'registration':'on'}\"")
status()
end
function delete_hset(opts)
local handset = tonumber(luci.http.formvalue("handset"))
local rv = luci.sys.exec("ubus -t 2 call dect handset \"{'delete':%d}\"" %handset)
luci.http.write(rv)
end
function ping_hset(opts)
local handset = tonumber(luci.http.formvalue("handset"))
local rv = luci.sys.exec("ubus -t 2 call dect call \"{'terminal':%d, 'add':%d}\"" % {handset, handset-1})
luci.http.write(rv)
end
function switch_plug(opts)
local handset = luci.http.formvalue("plug")
local rv = luci.sys.exec("/usr/bin/dect -z " .. handset)
luci.http.write(rv)
end
function status()
local rv = luci.sys.exec("ubus -t 2 call dect status | tr '}' ',' > /tmp/dect_status; ubus -t 2 call dect handset \"{'list':''}\" | tail -n +2 >> /tmp/dect_status; cat /tmp/dect_status")
luci.http.prepare_content("application/json")
luci.http.write(rv)
end
|
-- The MIT License (MIT)
-- Copyright (c) 2016 Colin Hall-Coates <yo@oka.io>
-- Permission is hereby granted, free of charge, to any person obtaining
-- a copy of this software and associated documentation files (the
-- "Software"), to deal in the Software without restriction, including
-- without limitation the rights to use, copy, modify, merge, publish,
-- distribute, sublicense, and/or sell copies of the Software, and to
-- permit persons to whom the Software is furnished to do so, subject to
-- the following conditions:
-- The above copyright notice and this permission notice shall be
-- included in all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-- randbytes.lua
-- Colin 'Oka' Hall-Coates
-- MIT, 2015
local defaults = setmetatable ({
bytes = 4,
mask = 256,
file = 'urandom',
filetable = {'urandom', 'random'}
}, { __newindex = function () return false end })
local files = {
urandom = false,
random = false
}
local utils = {}
function utils:gettable (...)
local t, r = {...}, defaults.filetable
if #t > 0 then r = t end
return r
end
function utils:open (...)
for _, f in next, self:gettable (...) do
for k, _ in next, files do
if k == f then
files[f] = assert (io.open ('/dev/'..f, 'rb'))
end
end
end
end
function utils:close (...)
for _, f in next, self:gettable (...) do
for k, _ in next, files do
if files[f] and k == f then
files[f] = not assert (files[f]:close ())
end
end
end
end
function utils:reader (f, b)
if f then
return f:read (b or defaults.bytes)
end
end
local randbytes = {
generate = function (f, ...)
if f then
local n, m = 0, select (2, ...) or defaults.mask
local s = utils:reader (f, select (1, ...))
for i = 1, s:len () do
n = m * n + s:byte (i)
end
return n
end
end
}
function randbytes:open (...)
utils:open (...)
return self
end
function randbytes:close (...)
utils:close (...)
return self
end
function randbytes:uread (...)
return utils:reader (files.urandom, ...)
end
function randbytes:read (...)
return utils:reader (files.random, ...)
end
function randbytes:urandom (...)
return self.generate (files.urandom, ...)
end
function randbytes:random (...)
return self.generate (files.random, ...)
end
function randbytes:setdefault (k, v)
defaults[k] = v or defaults[k]
return defaults[k]
end
utils:open ()
return setmetatable (randbytes, {
__call = function (t, ...)
return utils:reader (files[defaults.file], ...)
end,
__metatable = false,
__newindex = function () return false end
})
|
local cqs = require"cqueues"
local api = require"lacord.api"
local shard = require"lacord.shard"
local logger = require"lacord.util.logger"
local util = require"lacord.util"
local mutex = require"lacord.util.mutex"
local promise = require"cqueues.promise"
local signal = require"cqueues.signal"
local emitter = require"lacord.x.event"
local intents = require"lacord.util.intents"
local cmd = require"lacord.x.command"
local contextualize_for_client = require"lacord.x.command.context".contextualize
local understand_arguments = require"lacord.x.command.arguments".understand_arguments
local inspect = require"inspect"
require"lacord.x.cqswrap"
local get = rawget
local setmetatable = setmetatable
local pairs = pairs
local assert = assert
local typ = type
local iiter = ipairs
local _ENV = {}
local client = {__name = "lacord.x.client"}
client.__index = client
--luacheck: ignore 111 ignore 421
--- Creates a new client, which is a collection of various book-keeping tables tracking various discord objects.
local empty_options = {}
function new(token, options)
options = options or empty_options
local self = setmetatable({
api = (options.api_init or api.init){
token = "Bot "..token
,accept_encoding = true
,track_ratelimits = false
,route_delay = 0
,api_timeout = options.api_timeout
,api_http_version = options.http_version
}
,shards = {}
,loop = cqs.new()
,identex = mutex.new()
,command_received = emitter.new()
,options = options
,events = { }
,command_events = { }
,guilds = { }
,receive = true
,ready = emitter.new'ready'
,has_ready = promise.new()
,intents = options.intents or (intents.guilds | intents.guild_messages)
,commands_config = options.commands
,guild_commands_config = options.guild_commands
,commands_ready = promise.new()
,has_commands = not not (options.commands or
options.guild_commands)
,refresh_guild_commands = options.refresh_guild_commands
,user_config = options.config or { }
,guild_discovery = { }
}, client)
if self.commands_config then
for _, ts in iiter(cmd.source_tree(self.commands_config, true)) do
local ctype, source = ts[1], ts[2]
if ctype and ctype > 1 then source = 'click' .. cmd.SEPARATOR .. source end
logger.info("Command %s configured.", source)
self.command_events[source] = emitter.recv()
end
end
if self.guild_commands_config then
for _, ts in iiter(cmd.source_tree(self.guild_commands_config, true)) do
local ctype, source = ts[1], ts[2]
if ctype and ctype > 1 then source = 'click' .. cmd.SEPARATOR .. source end
logger.info("Command %s configured.", 'guild' .. cmd.SEPARATOR .. source)
self.command_events['guild' .. cmd.SEPARATOR .. source] = emitter.recv()
end
end
-- set up some important events
self:new_event'MESSAGE_CREATE'
self:new_event'INTERACTION_CREATE'
self:new_received'READY'
self:new_received'GUILD_CREATE'
self:new_received'GUILD_DELETE'
self:new_received'DISCONNECT'
if self.has_commands then self.events.INTERACTION_CREATE:listen(self) end
logger.info('Initialized %s', self)
return self
end
--- Creates a new event emitter and adds it to `client.events`.
function client:new_event(name)
self.events[name] = emitter.new(name)
end
--- Creates a new event emitter and adds it to `client.events`. Then registers the client as an event reeiver.
function client:new_received(name)
self.events[name] = emitter.new(name):listen(self)
end
--- Factory for gateway urls containing token reset checks.
function client:refresher()
local function regenerate_gateway(ws)
local success , gateway, err = self.api:get_gateway_bot()
assert(success, err)
local limit = gateway.session_start_limit
logger.info("TOKEN-%s has used %d/%d sessions.",
util.hash(self.api.token),
limit.total - limit.remaining,
limit.total)
if limit.remaining == 0 then
logger.warn("TOKEN-%s can no longer identify, waiting for %.3f seconds",
util.hash(self.api.token),
limit.reset_after/1000)
cqs.sleep(limit.reset_after/1000)
return regenerate_gateway(ws)
else
return gateway.url
end
end
return regenerate_gateway
end
--- A little object to hold discord events.
local ctx_meta = {__name = "lacord.x.eventcontext"}
function ctx_meta:__index(k)
if k == 'shard_id' then return get(self, 1)
elseif k == 'event' then return get(self, 2)
end
end
local function context(...)
return setmetatable({...}, ctx_meta)
end
--- Factory which produces an event handler for our client.
function client:eventer()
return function(s, t, event)
if self.events[t] then
self.events[t]:enqueue(context(s.options.id, event))
end
end
end
--- Blocks sigterm and sigint to gracefully disconnect shards and then let cqueues drop off.
local function handlesignals(self)
signal.block(signal.SIGINT, signal.SIGTERM)
local sig = signal.listen(signal.SIGTERM, signal.SIGINT)
local int = sig:wait()
local reason = signal.strsignal(int)
logger.info("%s received (%d, %q); shutting down.", self, int, reason)
for _, s in pairs(self.shards) do
s:shutdown()
end
signal.unblock(signal.SIGINT, signal.SIGTERM)
end
--- Function which gets our bot's information and then connects the shards.
local function runner(self)
local R = self.api
:capture()
:get_current_application_information()
:get_gateway_bot()
if R.success then
local gatewayinfo
self.app, gatewayinfo = R:results()
self.numshards = gatewayinfo.shards
logger.info("starting %s with %d shards.", self, self.numshards)
local output = self:eventer()
local refresh = self:refresher()
for i = 0 , gatewayinfo.shards - 1 do
local s = shard.init({
token = self.api.token
,id = i
,gateway = refresh
,compress = false
,transport_compression = true
,total_shard_count = gatewayinfo.shards
,large_threshold = 100
,auto_reconnect = true
,loop = cqs.running()
,output = output,
intents = self.intents
}, self.identex)
self.shards[i] = s
s:connect()
end
self.loop:wrap(handlesignals, self)
if self.has_commands then
self.loop:wrap(self.command_init, self)
end
else
logger.error(R.error)
end
end
--- Use this to start the client, this will call :loop on the client's cqueues controller.
function client:run()
self.loop:wrap(runner, self)
return assert(self.loop:loop())
end
--- Handles the READY shard event.
-- This creates new promises for each of the guilds.
-- This wakes anyone waiting for this client to be ready.
function client:READY(ctx)
for _, ug in iiter(ctx.event.guilds) do
if not self.guilds[ug.id] then
self.guilds[ug.id] = promise.new()
elseif self.guilds[ug.id]:status() ~= 'pending' then
self.guilds[ug.id] = promise.new()
end
end
self.ready:enqueue(ctx)
self.has_ready:set(true)
end
--- Handles the DISCONNECT shard event.
-- This refreshes the ready promise.
function client:DISCONNECT()
if self.has_ready:status() ~= 'pending' then
self.has_ready = promise.new()
end
end
local function publish_commands(self, guild_id)
logger.info("Publishing guild commands to %s", guild_id)
self.guild_discovery[guild_id] = self.guild_discovery[guild_id] or {}
local success, list, errs, extra = self.api:bulk_overwrite_guild_application_commands(self.app.id, guild_id, self.guild_commands_config)
if success then
for _, a_command in iiter(list) do
local de_mangled = a_command.name
if a_command.type > 1 then
de_mangled = 'click' .. cmd.SEPARATOR .. de_mangled
end
self.guild_discovery[guild_id][de_mangled] = a_command.id
end
else
if extra then
logger.debug("Response.errors:\n%s", inspect(extra))
end
logger.error("Error setting up guild commands, after bulk overwrite failed: %s", errs)
end
end
--- Handles the GUILD_CREATE shard event.
-- This sets the value of the guild, waking anyone waiting for that guild.
function client:GUILD_CREATE(ctx)
if promise.type(self.guilds[ctx.event.id]) then
self.guilds[ctx.event.id]:set(true, ctx.event)
else
self.guilds[ctx.event.id] = promise.new()
self.guilds[ctx.event.id]:set(true, ctx.event)
end
local refresh_behavior = self.refresh_guild_commands
if refresh_behavior == true
or (typ(refresh_behavior) == 'table' and refresh_behavior[ctx.event.id]) then
self.loop:wrap(publish_commands, self, ctx.event.id)
elseif typ(refresh_behavior) == 'function' then
if refresh_behavior(self, ctx.event.id) then
self.loop:wrap(publish_commands, self, ctx.event.id)
end
end
end
function client:INTERACTION_CREATE(ctx)
local payload = ctx.event
local payload_data = payload.data
self.commands_ready:get()
if payload.version == 1 then
if payload.type == 2 then
local command
local global_cmds = payload_data.type and payload_data.type > 1 and self.click_commands or self.commands
local guild_cmds = payload_data.type and payload_data.type > 1 and self.guild_click_commands or self.guild_commands
if payload.guild_id then
local command_id = payload_data.id
local command_name = payload_data.name
local global = global_cmds and global_cmds[command_name]
if global_cmds and global.id == command_id then
command = global
else
local discovery_name = command_name
if payload_data.type > 1 then
discovery_name = 'click' .. cmd.SEPARATOR .. discovery_name
end
local guild = guild_cmds[command_name]
local cache = self.guild_discovery[payload.guild_id]
if not cache then cache = {} self.guild_discovery[payload.guild_id] = cache end
cache[discovery_name] = command_id
command = guild
end
end
if command then
local args, src = understand_arguments(command, payload_data)
local the_ctx = contextualize_for_client(src, payload, args, self, self.user_config)
self.command_received:emit(the_ctx)
end
end
end
end
--- Handles the GUILD_DELETE shard event.
-- This will refresh any promised guilds if they are unavilable.
function client:GUILD_DELETE(ctx)
if ctx.event.unavailable
and promise.type(self.guilds[ctx.event.id])
and self.guilds[ctx.event.id]:status() ~= 'pending' then
self.guilds[ctx.event.id] = promise.new()
else
self.guilds[ctx.event.id] = nil
end
end
--- Waits for a specific guild_id to become available.
function client:wait_guild(guild_id)
if self.guilds[guild_id] then return self.guilds[guild_id]:get()
else self.has_ready:get() return self.guilds[guild_id]:get() end
end
function client:command_init()
if (not self.announce_commands or self.announce_commands == true) and self.commands_config then
logger.info("Announcing global commands to discord.")
local success, list, errs, extra = self.api:bulk_overwrite_global_application_commands(self.app.id, self.commands_config)
if success then
self.commands = cmd.install(self.commands_config, list, {})
elseif self.soft_announce then
local success, list, errs, extra = self.api:get_global_application_commands(self.app.id)
if success then
self.commands, self.click_commands = cmd.install(self.commands_config, list, {})
else
logger.debug("Response.errors:\n%s", inspect(extra))
logger.fatal("Error setting up commands, after bulk overwrite failed: %s", errs)
end
else
logger.debug("Response.errors:\n%s", inspect(extra))
logger.fatal("Error setting up commands, after bulk overwrite failed: %s", errs)
end
elseif typ(self.announce_commands) == 'function' then
self:announce_commands()
end
self.guild_commands, self.guild_click_commands = cmd.freeze(self.guild_commands_config, {})
self.command_received:split(function(ctx) return ctx.source end, self.command_events)
self.commands_ready:set(true, true)
end
return _ENV
|
return function (ipt)
local transf = _G.Flags.Transformations
local x, y, z =
ipt.x,
ipt.y,
ipt.z
--scale
local tr_sc = transf.Scale
x, y, z = x*tr_sc.x, y*tr_sc.y, z*tr_sc.z
--rotate
local ang = transf.Rotate
if ang ~= 0 then
x, y =
(x * math.cos(ang) - y * math.sin(ang)),
(x * math.sin(ang) + y * math.cos(ang))
end
--move
local tr_mv = transf.Move
local dx, dy, dz =
tr_mv.x or 0,
tr_mv.y or 0,
tr_mv.z or 0
x = x + dx
y = y + dy
z = z + dz
return {x=x, y=y, z=z}
end
|
function create()
entity = getNewEntity("baseLuaEntity")
sizeMultiplier = getGlobalValue("sizeMultiplier")
setEntityLabel(entity, "student")
destinations = {{555, 566, 663}, {580, 654, 782}}
heights = {432, 266}
floor = rand() % 2 + 1
spawn = rand() % 3 + 1
door = rand() % 3 + 1
addEntityValue(entity, "destination", "double")
setEntityValue(entity, "destination", destinations[floor][door] * sizeMultiplier)
if destinations[floor][spawn] > destinations[floor][door] then
setEntityDeltaX(entity, -100)
elseif destinations[floor][spawn] < destinations[floor][door] then
setEntityDeltaX(entity, 100)
else
end
addEntityFunction(entity, "update", "void")
texture = "student" .. rand() % 3 + 1
texture = "treyWalking"
setEntityX(entity, destinations[floor][spawn] * sizeMultiplier)
setEntityY(entity, (heights[floor] * sizeMultiplier) - getAnimationHeight(texture))
setEntityRenderWidth(entity, getAnimationWidth(texture))
setEntityRenderHeight(entity, getAnimationHeight(texture))
startEntityAnimation(entity, texture)
addEntityToGroup(entity, "Students")
addEntityToRenderGroup(entity, "400Students")
return entity
end
function update(entity)
if getEntityDeltaX(entity) > 0 and getEntityX(entity) > getEntityValue(entity, "destination") then
deleteEntity(entity)
elseif getEntityDeltaX(entity) < 0 then
setEntityRenderFlip(entity, true)
if getEntityX(entity) < getEntityValue(entity, "destination") then
deleteEntity(entity)
end
elseif getEntityDeltaX(entity) == 0 then
deleteEntity(entity)
end
end
|
local which_key_ok, which_key = pcall(require, "which-key")
if not which_key_ok then
vim.notify("which-key not found. Custom keybinds are disabled.", "warn")
return
end
-- Remap space as leader key
vim.api.nvim_set_keymap("", "<Space>", "<Nop>", { noremap = true, silent = true })
vim.g.mapleader = " "
vim.g.maplocalleader = " "
which_key.setup({
key_labels = {
["<Leader>"] = "LDR",
["<Space>"] = "SPC",
["<CR>"] = "RET",
["<Tab>"] = "TAB",
["<Esc>"] = "ESC",
},
})
local leader_mappings = {
["d"] = {
name = "+debug 🐛",
["b"] = { "<cmd>lua require('dap').toggle_breakpoint()<cr>", "Toggle breakpoint" },
["d"] = { "<cmd>lua require('dap').continue()<cr>", "Start or continue" },
["i"] = { "<cmd>lua require('dap').step_into()<cr>", "Step into" },
["o"] = { "<cmd>lua require('dap').step_out()<cr>", "Step out" },
["n"] = { "<cmd>lua require('dap').step_over()<cr>", "Step over" },
["p"] = { "<cmd>lua require('dap').step_back()<cr>", "Step back" },
["v"] = { "<cmd>lua require('dap').reverse_continue()<cr>", "Reverse continue" },
["r"] = { "<cmd>lua require('dap').restart()<cr>", "Restart debugger" },
["x"] = { "<cmd>lua require('dap').terminate()<cr>", "Stop debugger" },
["u"] = { "<cmd>lua require('dapui').toggle()<cr>", "Toggle debug UI" },
},
["f"] = {
name = "+find 🔎",
["f"] = { "<cmd>Telescope find_files<cr>", "Find files" },
["g"] = { "<cmd>Telescope live_grep<cr>", "Live grep" },
["b"] = { "<cmd>Telescope buffers<cr>", "Buffers" },
["h"] = { "<cmd>Telescope help_tags<cr>", "Help tags" },
["r"] = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
["s"] = { "<cmd>SearchBoxIncSearch<cr>", "Find in file" },
},
["t"] = {
name = "+terminal 🖥️ ",
["t"] = { "<cmd>ToggleTerm<cr>", "Toggle terminal" },
},
["P"] = {
name = "+Packer 📦",
["c"] = { "<cmd>PackerCompile<cr>", "PackerCompile" },
["y"] = { "<cmd>PackerSync<cr>", "PackerSync" },
["p"] = { "<cmd>PackerProfile<cr>", "PackerProfile" },
},
}
which_key.register(leader_mappings, { prefix = "<leader>" })
|
local function init()
require 'TheAltF4Stream.vim'.init()
require 'TheAltF4Stream.packer'.init()
end
return {
init = init,
}
|
---------------------------------------------------------------------------
--- Rules for clients.
--
-- This module applies @{rules} to clients during startup (via @{client.manage},
-- but its functions can be used for client matching in general.
--
-- All existing `client` properties can be used in rules. It is also possible
-- to add random properties that will be later accessible as `c.property_name`
-- (where `c` is a valid client object)
--
-- Syntax
-- ===
-- You should fill this table with your rule and properties to apply.
-- For example, if you want to set xterm maximized at startup, you can add:
--
-- { rule = { class = "xterm" },
-- properties = { maximized_vertical = true, maximized_horizontal = true } }
--
-- If you want to set mplayer floating at startup, you can add:
--
-- { rule = { name = "MPlayer" },
-- properties = { floating = true } }
--
-- If you want to put Firefox on a specific tag at startup, you can add:
--
-- { rule = { instance = "firefox" },
-- properties = { tag = mytagobject } }
--
-- Alternatively, you can specify the tag by name:
--
-- { rule = { instance = "firefox" },
-- properties = { tag = "3" } }
--
-- If you want to put Thunderbird on a specific screen at startup, use:
--
-- { rule = { instance = "Thunderbird" },
-- properties = { screen = 1 } }
--
-- Assuming that your X11 server supports the RandR extension, you can also specify
-- the screen by name:
--
-- { rule = { instance = "Thunderbird" },
-- properties = { screen = "VGA1" } }
--
-- If you want to put Emacs on a specific tag at startup, and immediately switch
-- to that tag you can add:
--
-- { rule = { class = "Emacs" },
-- properties = { tag = mytagobject, switchtotag = true } }
--
-- If you want to apply a custom callback to execute when a rule matched,
-- for example to pause playing music from mpd when you start dosbox, you
-- can add:
--
-- { rule = { class = "dosbox" },
-- callback = function(c)
-- awful.spawn('mpc pause')
-- end }
--
-- Note that all "rule" entries need to match. If any of the entry does not
-- match, the rule won't be applied.
--
-- If a client matches multiple rules, they are applied in the order they are
-- put in this global rules table. If the value of a rule is a string, then the
-- match function is used to determine if the client matches the rule.
--
-- If the value of a property is a function, that function gets called and
-- function's return value is used for the property.
--
-- To match multiple clients to a rule one need to use slightly different
-- syntax:
--
-- { rule_any = { class = { "MPlayer", "Nitrogen" }, instance = { "xterm" } },
-- properties = { floating = true } }
--
-- To match multiple clients with an exception one can couple `rules.except` or
-- `rules.except_any` with the rules:
--
-- { rule = { class = "Firefox" },
-- except = { instance = "Navigator" },
-- properties = {floating = true},
-- },
--
-- { rule_any = { class = { "Pidgin", "Xchat" } },
-- except_any = { role = { "conversation" } },
-- properties = { tag = "1" }
-- }
--
-- { rule = {},
-- except_any = { class = { "Firefox", "Vim" } },
-- properties = { floating = true }
-- }
--
-- Applicable client properties
-- ===
--
-- The table below holds the list of default client properties along with
-- some extra properties that are specific to the rules. Note that any property
-- can be set in the rules and interpreted by user provided code. This table
-- only represent those offered by default.
--
--
--
-- @author Julien Danjou <julien@danjou.info>
-- @copyright 2009 Julien Danjou
-- @module awful.rules
---------------------------------------------------------------------------
-- Grab environment we need
local client = client
local awesome = awesome
local screen = screen
local table = table
local type = type
local ipairs = ipairs
local pairs = pairs
local atag = require("awful.tag")
local gtable = require("gears.table")
local a_place = require("awful.placement")
local protected_call = require("gears.protected_call")
local aspawn = require("awful.spawn")
local gsort = require("gears.sort")
local gdebug = require("gears.debug")
local unpack = unpack or table.unpack -- luacheck: globals unpack (compatibility with Lua 5.1)
local rules = {}
--- This is the global rules table.
rules.rules = {}
--- Check if a client matches a rule.
-- @client c The client.
-- @tab rule The rule to check.
-- @treturn bool True if it matches, false otherwise.
function rules.match(c, rule)
if not rule then return false end
for field, value in pairs(rule) do
if c[field] then
if type(c[field]) == "string" then
if not c[field]:match(value) and c[field] ~= value then
return false
end
elseif c[field] ~= value then
return false
end
else
return false
end
end
return true
end
--- Check if a client matches any part of a rule.
-- @client c The client.
-- @tab rule The rule to check.
-- @treturn bool True if at least one rule is matched, false otherwise.
function rules.match_any(c, rule)
if not rule then return false end
for field, values in pairs(rule) do
if c[field] then
for _, value in ipairs(values) do
if c[field] == value then
return true
elseif type(c[field]) == "string" and c[field]:match(value) then
return true
end
end
end
end
return false
end
--- Does a given rule entry match a client?
-- @client c The client.
-- @tab entry Rule entry (with keys `rule`, `rule_any`, `except` and/or
-- `except_any`).
-- @treturn bool
function rules.matches(c, entry)
return (rules.match(c, entry.rule) or rules.match_any(c, entry.rule_any)) and
(not rules.match(c, entry.except) and not rules.match_any(c, entry.except_any))
end
--- Get list of matching rules for a client.
-- @client c The client.
-- @tab _rules The rules to check. List with "rule", "rule_any", "except" and
-- "except_any" keys.
-- @treturn table The list of matched rules.
function rules.matching_rules(c, _rules)
local result = {}
for _, entry in ipairs(_rules) do
if (rules.matches(c, entry)) then
table.insert(result, entry)
end
end
return result
end
--- Check if a client matches a given set of rules.
-- @client c The client.
-- @tab _rules The rules to check. List of tables with `rule`, `rule_any`,
-- `except` and `except_any` keys.
-- @treturn bool True if at least one rule is matched, false otherwise.
function rules.matches_list(c, _rules)
for _, entry in ipairs(_rules) do
if (rules.matches(c, entry)) then
return true
end
end
return false
end
-- Contains the sources.
-- The elements are ordered "first in, first executed". Thus, the higher the
-- index, the higher the priority. Each entry is a table with a `name` and a
-- `callback` field. This table is exposed for debugging purpose. The API
-- is private and should be modified using the public accessors.
local rule_sources = {}
local rule_source_sort = gsort.topological()
--- Add a new rule source.
--
-- A rule source is a provider called when a client is managed (started). It
-- allows to configure the client by providing properties that should be applied.
-- By default, Awesome provides 2 sources:
--
-- * `awful.rules`: A declarative matcher
-- * `awful.spawn`: Launch clients with pre-defined properties
--
-- It is possible to register new callbacks to modify the properties table
-- before it is applied. Each provider is executed sequentially and modifies the
-- same table. If the first provider set a property, then the second can
-- override it, then the third, etc. Once the providers are exhausted, the
-- properties are applied on the client.
--
-- It is important to note that properties themselves have their own
-- dependencies. For example, a `tag` property implies a `screen`. Therefor, if
-- a `screen` is already specified, then it will be ignored when the rule is
-- executed. Properties also have their own priorities. For example, the
-- `titlebar` and `border_width` need to be applied before the `x` and `y`
-- positions are set. Otherwise, it will be off or the client will shift
-- upward everytime Awesome is restarted. A rule source *cannot* change this.
-- It is up to the callback to be aware of the dependencies and avoid to
-- introduce issues. For example, if the source wants to set a `screen`, it has
-- to check if the `tag`, `tags` or `new_tag` are on that `screen` or remove
-- those properties. Otherwise, they will be ignored once the rule is applied.
--
-- @tparam string name The provider name. It must be unique.
-- @tparam function callback The callback that is called to produce properties.
-- @tparam client callback.c The client
-- @tparam table callback.properties The current properties. The callback should
-- add to and overwrite properties in this table
-- @tparam table callback.callbacks A table of all callbacks scheduled to be
-- executed after the main properties are applied.
-- @tparam[opt={}] table depends_on A list of names of sources this source depends on
-- (sources that must be executed *before* `name`.
-- @tparam[opt={}] table precede A list of names of sources this source have a
-- priority over.
-- @treturn boolean Returns false if a dependency conflict was found.
function rules.add_rule_source(name, callback, depends_on, precede)
depends_on = depends_on or {}
precede = precede or {}
assert(type( depends_on ) == "table")
assert(type( precede ) == "table")
for _, v in ipairs(rule_sources) do
-- Names must be unique
assert(
v.name ~= name,
"Name must be unique, but '" .. name .. "' was already registered."
)
end
local new_sources = rule_source_sort:clone()
new_sources:prepend(name, precede )
new_sources:append (name, depends_on )
local res, err = new_sources:sort()
if err then
gdebug.print_warning("Failed to add the rule source: "..err)
return false
end
-- Only replace the source once the additions have been proven safe
rule_source_sort = new_sources
local callbacks = {}
-- Get all callbacks for *existing* sources.
-- It is important to remember that names can be used in the sorting even
-- if the source itself doesn't (yet) exists.
for _, v in ipairs(rule_sources) do
callbacks[v.name] = v.callback
end
rule_sources = {}
callbacks[name] = callback
for _, v in ipairs(res) do
if callbacks[v] then
table.insert(rule_sources, 1, {
callback = callbacks[v],
name = v
})
end
end
return true
end
--- Remove a source.
-- @tparam string name The source name.
-- @treturn boolean If the source was removed
function rules.remove_rule_source(name)
rule_source_sort:remove(name)
for k, v in ipairs(rule_sources) do
if v.name == name then
table.remove(rule_sources, k)
return true
end
end
return false
end
-- Add the rules properties
local function apply_awful_rules(c, props, callbacks)
for _, entry in ipairs(rules.matching_rules(c, rules.rules)) do
gtable.crush(props,entry.properties or {})
if entry.callback then
table.insert(callbacks, entry.callback)
end
end
end
--- The default `awful.rules` source.
--
-- **Has priority over:**
--
-- *nothing*
--
-- @rulesources awful.rules
rules.add_rule_source("awful.rules", apply_awful_rules, {"awful.spawn"}, {})
-- Add startup_id overridden properties
local function apply_spawn_rules(c, props, callbacks)
if c.startup_id and aspawn.snid_buffer[c.startup_id] then
local snprops, sncb = unpack(aspawn.snid_buffer[c.startup_id])
-- The SNID tag(s) always have precedence over the rules one(s)
if snprops.tag or snprops.tags or snprops.new_tag then
props.tag, props.tags, props.new_tag = nil, nil, nil
end
gtable.crush(props, snprops)
gtable.merge(callbacks, sncb)
end
end
--- The rule source for clients spawned by `awful.spawn`.
--
-- **Has priority over:**
--
-- * `awful.rules`
--
-- @rulesources awful.spawn
rules.add_rule_source("awful.spawn", apply_spawn_rules, {}, {"awful.rules"})
local function apply_singleton_rules(c, props, callbacks)
local persis_id, info = c.single_instance_id, nil
-- This is a persistent property set by `awful.spawn`
if awesome.startup and persis_id then
info = aspawn.single_instance_manager.by_uid[persis_id]
elseif c.startup_id then
info = aspawn.single_instance_manager.by_snid[c.startup_id]
aspawn.single_instance_manager.by_snid[c.startup_id] = nil
elseif aspawn.single_instance_manager.by_pid[c.pid] then
info = aspawn.single_instance_manager.by_pid[c.pid].matcher(c) and
aspawn.single_instance_manager.by_pid[c.pid] or nil
end
if info then
c.single_instance_id = info.hash
gtable.crush(props, info.rules)
table.insert(callbacks, info.callback)
table.insert(info.instances, c)
-- Prevent apps with multiple clients from re-using this too often in
-- the first 30 seconds before the PID is cleared.
aspawn.single_instance_manager.by_pid[c.pid] = nil
end
end
--- The rule source for clients spawned by `awful.spawn.once` and `single_instance`.
--
-- **Has priority over:**
--
-- * `awful.rules`
--
-- **Depends on:**
--
-- * `awful.spawn`
--
-- @rulesources awful.spawn_once
rules.add_rule_source("awful.spawn_once", apply_singleton_rules, {"awful.spawn"}, {"awful.rules"})
--- Apply awful.rules.rules to a client.
-- @client c The client.
function rules.apply(c)
local callbacks, props = {}, {}
for _, v in ipairs(rule_sources) do
v.callback(c, props, callbacks)
end
rules.execute(c, props, callbacks)
end
local function add_to_tag(c, t)
if not t then return end
local tags = c:tags()
table.insert(tags, t)
c:tags(tags)
end
--- Extra rules properties.
--
-- These properties are used in the rules only and are not sent to the client
-- afterward.
--
-- To add a new properties, just do:
--
-- function awful.rules.extra_properties.my_new_property(c, value, props)
-- -- do something
-- end
--
-- By default, the table has the following functions:
--
-- * geometry
-- * placement
--
-- @tfield table awful.rules.extra_properties
rules.extra_properties = {}
--- Extra high priority properties.
--
-- Some properties, such as anything related to tags, geometry or focus, will
-- cause a race condition if set in the main property section. This is why
-- they have a section for them.
--
-- To add a new properties, just do:
--
-- function awful.rules.high_priority_properties.my_new_property(c, value, props)
-- -- do something
-- end
--
-- By default, the table has the following functions:
--
-- * tag
-- * new_tag
--
-- @tfield table awful.rules.high_priority_properties
rules.high_priority_properties = {}
--- Delayed properties.
-- Properties applied after all other categories.
-- @tfield table awful.rules.delayed_properties
-- By default, the table has the following functions:
--
-- * switch_to_tags
rules.delayed_properties = {}
local force_ignore = {
titlebars_enabled=true, focus=true, screen=true, x=true,
y=true, width=true, height=true, geometry=true,placement=true,
border_width=true,floating=true,size_hints_honor=true
}
function rules.high_priority_properties.tag(c, value, props)
if value then
if type(value) == "string" then
local name = value
value = atag.find_by_name(c.screen, value)
if not value and not props.screen then
value = atag.find_by_name(nil, name)
end
if not value then
require("gears.debug").print_error("awful.rules-rule specified "
.. "tag = '" .. name .. "', but no such tag exists")
return
end
end
-- In case the tag has been forced to another screen, move the client
if c.screen ~= value.screen then
c.screen = value.screen
props.screen = value.screen -- In case another rule query it
end
c:tags{ value }
end
end
function rules.delayed_properties.switch_to_tags(c, value)
if not value then return end
atag.viewmore(c:tags(), c.screen)
end
function rules.delayed_properties.switchtotag(c, value)
gdebug.deprecate("Use switch_to_tags instead of switchtotag", {deprecated_in=5})
rules.delayed_properties.switch_to_tags(c, value)
end
function rules.extra_properties.geometry(c, _, props)
local cur_geo = c:geometry()
local new_geo = type(props.geometry) == "function"
and props.geometry(c, props) or props.geometry or {}
for _, v in ipairs {"x", "y", "width", "height"} do
new_geo[v] = type(props[v]) == "function" and props[v](c, props)
or props[v] or new_geo[v] or cur_geo[v]
end
c:geometry(new_geo) --TODO use request::geometry
end
function rules.high_priority_properties.new_tag(c, value, props)
local ty = type(value)
local t = nil
if ty == "boolean" then
-- Create a new tag named after the client class
t = atag.add(c.class or "N/A", {screen=c.screen, volatile=true})
elseif ty == "string" then
-- Create a tag named after "value"
t = atag.add(value, {screen=c.screen, volatile=true})
elseif ty == "table" then
-- Assume a table of tags properties. Set the right screen, but
-- avoid editing the original table
local values = value.screen and value or gtable.clone(value)
values.screen = values.screen or c.screen
t = atag.add(value.name or c.class or "N/A", values)
-- In case the tag has been forced to another screen, move the client
c.screen = t.screen
props.screen = t.screen -- In case another rule query it
else
assert(false)
end
add_to_tag(c, t)
return t
end
function rules.extra_properties.placement(c, value, props)
-- Avoid problems
if awesome.startup and
(c.size_hints.user_position or c.size_hints.program_position) then
return
end
local ty = type(value)
local args = {
honor_workarea = props.honor_workarea ~= false,
honor_padding = props.honor_padding ~= false
}
if ty == "function" or (ty == "table" and
getmetatable(value) and getmetatable(value).__call
) then
value(c, args)
elseif ty == "string" and a_place[value] then
a_place[value](c, args)
end
end
function rules.high_priority_properties.tags(c, value, props)
local current = c:tags()
local tags, s = {}, nil
for _, t in ipairs(value) do
if type(t) == "string" then
t = atag.find_by_name(c.screen, t)
end
if t and ((not s) or t.screen == s) then
table.insert(tags, t)
s = s or t.screen
end
end
if s and s ~= c.screen then
c.screen = s
props.screen = s -- In case another rule query it
end
if #current == 0 or (value[1] and value[1].screen ~= current[1].screen) then
c:tags(tags)
else
c:tags(gtable.merge(current, tags))
end
end
--- Apply properties and callbacks to a client.
-- @client c The client.
-- @tab props Properties to apply.
-- @tab[opt] callbacks Callbacks to apply.
function rules.execute(c, props, callbacks)
-- This has to be done first, as it will impact geometry related props.
if props.titlebars_enabled and (type(props.titlebars_enabled) ~= "function"
or props.titlebars_enabled(c,props)) then
c:emit_signal("request::titlebars", "rules", {properties=props})
c._request_titlebars_called = true
end
-- Border width will also cause geometry related properties to fail
if props.border_width then
c.border_width = type(props.border_width) == "function" and
props.border_width(c, props) or props.border_width
end
-- Size hints will be re-applied when setting width/height unless it is
-- disabled first
if props.size_hints_honor ~= nil then
c.size_hints_honor = type(props.size_hints_honor) == "function" and props.size_hints_honor(c,props)
or props.size_hints_honor
end
-- Geometry will only work if floating is true, otherwise the "saved"
-- geometry will be restored.
if props.floating ~= nil then
c.floating = type(props.floating) == "function" and props.floating(c,props)
or props.floating
end
-- Before requesting a tag, make sure the screen is right
if props.screen then
c.screen = type(props.screen) == "function" and screen[props.screen(c,props)]
or screen[props.screen]
end
-- Some properties need to be handled first. For example, many properties
-- require that the client is tagged, this isn't yet the case.
for prop, handler in pairs(rules.high_priority_properties) do
local value = props[prop]
if value ~= nil then
if type(value) == "function" then
value = value(c, props)
end
handler(c, value, props)
end
end
-- Make sure the tag is selected before the main rules are called.
-- Otherwise properties like "urgent" or "focus" may fail (if they were
-- overridden by other callbacks).
-- Previously this was done in a second client.manage callback, but caused
-- a race condition where the order of modules being loaded would change
-- the outcome.
c:emit_signal("request::tag", nil, {reason="rules"})
-- By default, rc.lua uses no_overlap+no_offscreen placement. This has to
-- be executed before x/y/width/height/geometry as it would otherwise
-- always override the user specified position with the default rule.
if props.placement then
-- It may be a function, so this one doesn't execute it like others
rules.extra_properties.placement(c, props.placement, props)
end
-- Handle the geometry (since tags and screen are set).
if props.height or props.width or props.x or props.y or props.geometry then
rules.extra_properties.geometry(c, nil, props)
end
-- Apply the remaining properties (after known race conditions are handled).
for property, value in pairs(props) do
if property ~= "focus" and type(value) == "function" then
value = value(c, props)
end
local ignore = rules.high_priority_properties[property] or
rules.delayed_properties[property] or force_ignore[property]
if not ignore then
if rules.extra_properties[property] then
rules.extra_properties[property](c, value, props)
elseif type(c[property]) == "function" then
c[property](c, value)
else
c[property] = value
end
end
end
-- Apply all callbacks.
if callbacks then
for _, callback in pairs(callbacks) do
protected_call(callback, c)
end
end
-- Apply the delayed properties
for prop, handler in pairs(rules.delayed_properties) do
if not force_ignore[prop] then
local value = props[prop]
if value ~= nil then
if type(value) == "function" then
value = value(c, props)
end
handler(c, value, props)
end
end
end
-- Do this at last so we do not erase things done by the focus signal.
if props.focus and (type(props.focus) ~= "function" or props.focus(c)) then
c:emit_signal('request::activate', "rules", {raise=not awesome.startup})
end
end
-- TODO v5 deprecate this
function rules.completed_with_payload_callback(c, props, callbacks)
rules.execute(c, props, callbacks)
end
client.connect_signal("manage", rules.apply)
return rules
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
commun = {}
commun.server = "spectre"
commun.setup = function(ssid, password)
wifi.sta.config(ssid, password)
end
commun.post = function(data)
http.put('http://'..commun.server..':3000/api/v1/devices',
'Content-Type: text/plain\r\nuid: 2zCpe4HRSho78T3\r\niv: ivivivivivivivi',
data,
function(code, data)
if (code < 0) then
print("HTTP request failed")
else
print(code, data)
end
end
)
end
|
packs = {{
name = "First pack",
levels = 15
}, {
name = "Second pack",
levels = 15
}}
|
CONTOUR = {
Sharp = 101,
Glamour = 102,
Nose = 103,
Highlight = 104,
Round = 105,
Square = 106,
Long = 107
}
BLUSH = {
Light1 = 101,
Light2 = 102,
Edge1 = 103,
Edge2 = 104,
Edge3 = 105,
Edge4 = 106,
Apple1 = 107,
Apple2 = 108,
Apple3 = 109,
Apple4 = 110
}
EYE_COLOR = {
Oasis = 1,
Moist = 2,
Crystal = 3,
Gray = 4,
Brown = 5,
Blue = 6,
Crystal2 = 101,
Hazel = 102,
Gray2 = 103,
Berry = 104,
Indigo = 105
}
EYELASHES = {
Lash1 = 101,
Lash2 = 102,
Lash3 = 103,
Lash4 = 104,
Lash5 = 105
}
EYELINER = {
BR1 = 101,
BR2 = 102,
BR3 = 103,
BK1 = 104,
BK2 = 105,
BK3 = 106,
BK4 = 107,
BK5 = 108
}
EYESHADOW_LAYER0 = {
Pink = 101,
Orange = 102,
Brown = 103,
Coral = 104,
Smokey = 105
}
EYESHADOW_LAYER1 = {
Pink = 101,
Orange = 102
}
appStrength = 1.0
maxStrength = 1.00
minStrength = 0.00
contourStrength = 0.36
blushStrength = 0.36
eyeBrowLayer1Strength = 0.20
eyeColorStrength = 1.00
eyeLashesStrength = 0.39
eyeLineStrength = 0.35
eyeShadows_L0Strength = 0.35
eyeShadows_L1Strength = 0.46
makeup0_lipLayer8Strength = 1.00
function initialize(scene)
local b = KuruMakeupNodeBuilder.create():useAsianModel(true):mergedResource(true)
makeup0 = KuruMakeupNode.createWithBuilder(b:build())
makeup0:setEyeShadowMultiStrength(true)
scene:addNodeAndRelease(makeup0)
makeup_param = makeup0:getParam()
makeup0:setPathAndBlendMode(KuruMakeupNodeType.CONTOUR, BASE_DIRECTORY .. "images/contour.jpg", BlendMode.SoftLight)
makeup0:setPathAndBlendMode(KuruMakeupNodeType.BLUSH, BASE_DIRECTORY .. "images/blush.png", BlendMode.None)
makeup0:setPathAndBlendMode(KuruMakeupNodeType.EYEBROWS_LAYER1, BASE_DIRECTORY .. "images/eyebrows.png", BlendMode.Multiply)
makeup0:setPathAndBlendMode(KuruMakeupNodeType.EYE_COLOR, BASE_DIRECTORY .. "images/eye_color_0001", BlendMode.None)
makeup0:setPathAndBlendMode(KuruMakeupNodeType.EYELASHES, BASE_DIRECTORY .. "images/eyelashes/eyelashes.png", BlendMode.Multiply)
makeup0:setPathAndBlendMode(KuruMakeupNodeType.EYELINER, BASE_DIRECTORY .. "images/eye_liner/eye_liner.png", BlendMode.Multiply)
makeup0:setPathAndBlendMode(KuruMakeupNodeType.EYESHADOW_LAYER0, BASE_DIRECTORY .. "images/eye_shadow_L0/eye_shadow_L0.png", BlendMode.Multiply)
makeup0:setPathAndBlendMode(KuruMakeupNodeType.EYESHADOW_LAYER1, BASE_DIRECTORY .. "images/eye_shadow_L1/eye_shadow_L1.png", BlendMode.Multiply)
makeup0:addLipLayer(BASE_DIRECTORY .. "images/liplayer.png", BlendMode.None)
setMakeupParam()
end
function frameReady(scene, elapsedTime)
setMakeupParam()
end
function setMakeupParam()
local strength = PropertyConfig.instance():getNumber("stickerSliderValue", 1.0)
appStrength = (maxStrength - minStrength) * strength + minStrength
makeup_param.faceContour = contourStrength * appStrength
makeup_param.cheek = blushStrength * appStrength
makeup_param.eyeBrowLayer1 = eyeBrowLayer1Strength * appStrength
makeup_param.colorLens = eyeColorStrength * appStrength
makeup_param.eyeLashes = eyeLashesStrength * appStrength
makeup_param.eyeLiner = eyeLineStrength * appStrength
makeup_param.eyeShadowLayer0 = eyeShadows_L0Strength * appStrength
makeup_param.eyeShadowLayer1 = eyeShadows_L1Strength * appStrength
makeup0:setLipLayerStrength(0, makeup0_lipLayer8Strength * appStrength)
end
|
slot0 = class("ActivityMediator", import("..base.ContextMediator"))
slot0.register = function (slot0)
slot0.contextData.singleActivity = true
slot0:bind(ActivityMediator.EVENT_OPERATION, function (slot0, slot1)
slot0:sendNotification(GAME.ACTIVITY_OPERATION, slot1)
end)
slot0.bind(slot0, ActivityMediator.EVENT_GO_SCENE, function (slot0, slot1, slot2)
if slot1 == SCENE.SUMMER_FEAST then
pg.NewStoryMgr.GetInstance():Play("TIANHOUYUYI1", function ()
slot0:sendNotification(GAME.GO_SCENE, SCENE.SUMMER_FEAST)
end)
else
slot0.sendNotification(slot3, GAME.GO_SCENE, slot1, slot2)
end
end)
slot0.viewComponent:setPlayer(slot3)
slot0.viewComponent:setFlagShip(slot5)
slot0.viewComponent:selectActivity(getProxy(ActivityProxy).getActivityById(slot6, slot1))
end
slot0.listNotificationInterests = function (slot0)
return {
ActivityProxy.ACTIVITY_ADDED,
ActivityProxy.ACTIVITY_UPDATED,
ActivityProxy.ACTIVITY_OPERATION_DONE,
ActivityProxy.ACTIVITY_SHOW_AWARDS,
GAME.ACT_NEW_PT_DONE,
GAME.RETURN_AWARD_OP_DONE,
GAME.MONOPOLY_AWARD_DONE,
GAME.SUBMIT_TASK_DONE
}
end
slot0.handleNotification = function (slot0, slot1)
slot3 = slot1:getBody()
if slot1:getName() == ActivityProxy.ACTIVITY_ADDED or slot2 == ActivityProxy.ACTIVITY_UPDATED then
slot0.viewComponent:updateActivity(slot3)
elseif slot2 == ActivityProxy.ACTIVITY_OPERATION_DONE then
elseif slot2 == ActivityProxy.ACTIVITY_SHOW_AWARDS or slot2 == GAME.ACT_NEW_PT_DONE or slot2 == GAME.RETURN_AWARD_OP_DONE or slot2 == GAME.MONOPOLY_AWARD_DONE then
slot0.viewComponent:emit(BaseUI.ON_ACHIEVE, slot3.awards, slot3.callback)
elseif slot2 == GAME.SUBMIT_TASK_DONE then
slot0.viewComponent:emit(BaseUI.ON_ACHIEVE, slot3, function ()
slot0.viewComponent:updateTaskLayers()
end)
elseif slot2 == GAME.SEND_MINI_GAME_OP_DONE then
slot4 = {
function (slot0)
if #slot0.awards > 0 then
if slot1.viewComponent then
slot1.viewComponent:emit(BaseUI.ON_ACHIEVE, slot1, slot0)
else
slot1:emit(BaseUI.ON_ACHIEVE, slot1, slot0)
end
else
slot0()
end
end
}
seriesAsync(slot4)
end
end
return slot0
|
-- Decompiled using luadec 2.2 rev: for Lua 5.2 from https://github.com/viruscamp/luadec
-- Command line: A:\Steam\twd-definitive\scripteditor-10-31-20\s1_lighting_improvements\WDC_pc_WalkingDead101_data\env_clementineHouseExterior_temp.lua
-- params : ...
-- function num : 0 , upvalues : _ENV
require("Relighting.lua")
local kScript = "ClementineHouseExterior"
local kScene = "adv_clementineHouseExterior"
local kDialog = "env_clementineYard.dlog"
--local newKscene = "adv_sewerEntrance"
--local newKscene = "cms_networkBoxMessage"
--local newKscene = "ui_debugConsole"
--local newKscene = "platformDataVisualizer"
--local newKscene = "player"
if not IsRegistered() then
require("wd_tutorial.lua")
end
ClearScene = function(sceneObj)
local agent1 = AgentFindInScene("adv_clementineHouseExterior_meshesA", sceneObj)
local agent2 = AgentFindInScene("adv_clementineHouseExterior_meshesB", sceneObj)
local agent3 = AgentFindInScene("adv_clementineHouseExterior_meshesC", sceneObj)
local agent4 = AgentFindInScene("adv_clementineHouseExterior_meshesD", sceneObj)
local agent5 = AgentFindInScene("adv_clementineHouseExterior_meshesE", sceneObj)
local agent6 = AgentFindInScene("adv_clementineHouseExterior_meshesF", sceneObj)
local agent7 = AgentFindInScene("adv_clementineHouseExterior_meshesG", sceneObj)
local agent8 = AgentFindInScene("adv_clementineHouseExterior_meshesH", sceneObj)
local agent9 = AgentFindInScene("adv_clementineHouseExterior_meshesI", sceneObj)
local agent10 = AgentFindInScene("adv_clementineHouseExterior_meshesJ", sceneObj)
local agent11 = AgentFindInScene("adv_clementineHouseExterior_meshesK", sceneObj)
local agent12 = AgentFindInScene("adv_clementineHouseExterior_meshesL", sceneObj)
local agent13 = AgentFindInScene("adv_clementineHouseExterior_meshesM", sceneObj)
local agent14 = AgentFindInScene("adv_clementineHouseExterior_meshesN", sceneObj)
local agent15 = AgentFindInScene("adv_clementineHouseExterior_meshesO", sceneObj)
local agent16 = AgentFindInScene("adv_clementineHouseExterior_meshesB_decals", sceneObj)
local agent17 = AgentFindInScene("adv_clementineHouseExterior_meshesC_decals", sceneObj)
local agent18 = AgentFindInScene("adv_clementineHouseExterior_meshesE_decals", sceneObj)
local agent19 = AgentFindInScene("adv_clementineHouseExterior_meshesF_decals", sceneObj)
local agent20 = AgentFindInScene("adv_clementineHouseExterior_meshesG_decals", sceneObj)
local agent21 = AgentFindInScene("adv_clementineHouseExterior_meshesO_decals", sceneObj)
local agent22 = AgentFindInScene("adv_clementineHouseExterior_distTrees", sceneObj)
destroyMe(agent1)
destroyMe(agent2)
destroyMe(agent3)
destroyMe(agent4)
destroyMe(agent5)
destroyMe(agent6)
destroyMe(agent7)
destroyMe(agent8)
destroyMe(agent9)
destroyMe(agent10)
destroyMe(agent11)
destroyMe(agent12)
destroyMe(agent13)
destroyMe(agent14)
destroyMe(agent15)
destroyMe(agent16)
destroyMe(agent17)
destroyMe(agent18)
destroyMe(agent19)
destroyMe(agent20)
destroyMe(agent21)
destroyMe(agent22)
end
ModifyScene = function(sceneObj)
local light1 = AgentFindInScene("light_shadowLIGHT_CAM_0", sceneObj)
local light2 = AgentFindInScene("light_shadowLIGHT_CAM_1", sceneObj)
local light3 = AgentFindInScene("light_characters_shadowLIGHT_CAM_0", sceneObj)
local light4 = AgentFindInScene("light_characters_shadowLIGHT_CAM_1", sceneObj)
local light5 = AgentFindInScene("light_characters_shadowLIGHT_CAM_2", sceneObj)
destroyMe(light1)
destroyMe(light2)
destroyMe(light3)
destroyMe(light4)
destroyMe(light5)
local light6 = AgentFindInScene("light_ENV_S_1", sceneObj)
local light7 = AgentFindInScene("light_ENV_S_2", sceneObj)
local light8 = AgentFindInScene("light_ENV_S_3", sceneObj)
local light9 = AgentFindInScene("light_ENV_S_4", sceneObj)
local light10 = AgentFindInScene("light_ENV_S_5", sceneObj)
local light11 = AgentFindInScene("light_ENV_S_6", sceneObj)
local light12 = AgentFindInScene("light_ENV_S_7", sceneObj)
local light13 = AgentFindInScene("light_ENV_S_8", sceneObj)
local light14 = AgentFindInScene("light_ENV_S_9", sceneObj)
local light15 = AgentFindInScene("light_ENV_S_10", sceneObj)
local light16 = AgentFindInScene("light_ENV_S_11", sceneObj)
local light17 = AgentFindInScene("light_ENV_S_12", sceneObj)
local light18 = AgentFindInScene("light_ENV_S_13", sceneObj)
local light19 = AgentFindInScene("light_ENV_S_14", sceneObj)
local light20 = AgentFindInScene("light_ENV_S_15", sceneObj)
local light21 = AgentFindInScene("light_ENV_S_16", sceneObj)
local light22 = AgentFindInScene("light_ENV_S_17", sceneObj)
local light23 = AgentFindInScene("light_ENV_S_18", sceneObj)
local light24 = AgentFindInScene("light_ENV_S_19", sceneObj)
local light25 = AgentFindInScene("light_ENV_S_20", sceneObj)
local light26 = AgentFindInScene("light_ENV_S_22", sceneObj)
local light27 = AgentFindInScene("light_ENV_S_23", sceneObj)
local light28 = AgentFindInScene("light_ENV_S_26", sceneObj)
local light29 = AgentFindInScene("light_ENV_S_27", sceneObj)
local light30 = AgentFindInScene("light_ENV_S_28", sceneObj)
local light31 = AgentFindInScene("light_ENV_S_29", sceneObj)
local light32 = AgentFindInScene("light_ENV_S_30", sceneObj)
local light33 = AgentFindInScene("light_spot_trees", sceneObj)
local light34 = AgentFindInScene("light_spot_trees01", sceneObj)
local light35 = AgentFindInScene("light_spot_trees02", sceneObj)
local light36 = AgentFindInScene("light_ENV_S_bgTreeFill", sceneObj)
local light37 = AgentFindInScene("light_ENV_S_bgTreeFill01", sceneObj)
local light38 = AgentFindInScene("light_ENV_S_bgTreeFill02", sceneObj)
destroyMe(light6)
destroyMe(light7)
destroyMe(light8)
destroyMe(light9)
destroyMe(light10)
destroyMe(light11)
destroyMe(light12)
destroyMe(light13)
destroyMe(light14)
destroyMe(light15)
destroyMe(light16)
destroyMe(light17)
destroyMe(light18)
destroyMe(light19)
destroyMe(light20)
destroyMe(light21)
destroyMe(light22)
destroyMe(light23)
destroyMe(light24)
destroyMe(light25)
destroyMe(light26)
destroyMe(light27)
destroyMe(light28)
destroyMe(light29)
destroyMe(light30)
destroyMe(light31)
destroyMe(light32)
destroyMe(light33)
destroyMe(light34)
destroyMe(light35)
--destroyMe(light36)
--destroyMe(light37)
--destroyMe(light38)
local light39 = AgentFindInScene("light_ENV_A_1", sceneObj)
local light40 = AgentFindInScene("light_ENV_A_2", sceneObj)
local light41 = AgentFindInScene("light_ENV_A_3 vfx", sceneObj)
local light42 = AgentFindInScene("light_ENV_D_1", sceneObj)
--destroyMe(light39)--light_ENV_A_1 (ambient)
--destroyMe(light40)--light_ENV_A_2 (sky)
--destroyMe(light41)--light_ENV_A_3 (vfx)
--destroyMe(light42)--light_ENV_D_1 (sun)
local sunColor = RGBColor(255, 214, 159, 255)
local ambientColor = RGBColor(108, 170, 225, 255)
local skyColor = RGBColor(24, 99, 205, 255)
local fogColor = Desaturate_RGBColor(skyColor, 0.45)
skyColor = Desaturate_RGBColor(skyColor, 0.2)
--enviorment module (fog)
local envModule = AgentFindInScene("module_environment", sceneObj)
local envModule_props = AgentGetRuntimeProperties(envModule)
customSetPropertyColor(envModule_props, "5416356241638078242", fogColor)
--sun
local dupedLight42_sun = AgentCreate("light_ENV_D_1_duplicated_sun", AgentGetProperties(light42), AgentGetPos(light42), AgentGetRot(light42), sceneObj, false, false)
ModifyLightSettings(dupedLight42_sun, 6.0, 4.0, sunColor)
ModifyAgentTransformation_Rotation(dupedLight42_sun, Vector(110, 92, 60))
--remove original sun
destroyMe(light42)
--skydome light
ModifyLightSettings(light40, 14.0, 1.0, skyColor)
--flat ambient
ModifyLightSettings(light39, 0.35, 1.0, ambientColor)
--bg tree fill
ModifyLightSettings(light36, 6.0, 1.0, sunColor)
ModifyLightSettings(light37, 6.0, 1.0, sunColor)
ModifyLightSettings(light37, 6.0, 1.0, sunColor)
RemovingAllLightingRigs(sceneObj)
end
CreateClemHouse = function(sceneObj)
ResourceSetEnable("ProjectSeason4")
ResourceSetEnable("Menu")
local newPosition = Vector(0, 0, 0)
local agent1_prop = "adv_clementineHouse400_meshesAHouse.prop"
local agent1 = AgentCreate("adv_clementineHouse400_meshesAHouse", agent1_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent2_prop = "adv_clementineHouse400_meshesAFence.prop"
local agent2 = AgentCreate("adv_clementineHouse400_meshesAFence", agent2_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent3_prop = "adv_clementineHouse400_meshesAGarage.prop"
local agent3 = AgentCreate("adv_clementineHouse400_meshesAGarage", agent3_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent4_prop = "adv_clementineHouse400_meshesAGlass.prop"
local agent4 = AgentCreate("adv_clementineHouse400_meshesAGlass", agent4_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent5_prop = "adv_clementineHouse400_meshesAGrass.prop"
local agent5 = AgentCreate("adv_clementineHouse400_meshesAGrass", agent5_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent6_prop = "adv_clementineHouse400_meshesAHouseInterior.prop"
local agent6 = AgentCreate("adv_clementineHouse400_meshesAHouseInterior", agent6_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent7_prop = "adv_clementineHouse400_meshesAIvy.prop"
local agent7 = AgentCreate("adv_clementineHouse400_meshesAIvy", agent7_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent8_prop = "adv_clementineHouse400_meshesATerrain.prop"
local agent8 = AgentCreate("adv_clementineHouse400_meshesATerrain", agent8_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent9_prop = "adv_clementineHouse400_meshesATreeFlats.prop"
local agent9 = AgentCreate("adv_clementineHouse400_meshesATreeFlats", agent9_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent10_prop = "adv_clementineHouse400_meshesATreeHouse.prop"
local agent10 = AgentCreate("adv_clementineHouse400_meshesATreeHouse", agent10_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent11_prop = "adv_clementineHouse400_meshesATreeHouseTree.prop"
local agent11 = AgentCreate("adv_clementineHouse400_meshesATreeHouseTree", agent11_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent12_prop = "adv_clementineHouse400_meshesATrees.prop"
local agent12 = AgentCreate("adv_clementineHouse400_meshesATrees", agent12_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent13_prop = "adv_clementineHouse400_meshesBGrass.prop"
local agent13 = AgentCreate("adv_clementineHouse400_meshesBGrass", agent13_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent14_prop = "adv_clementineHouse400_meshesBHouse.prop"
local agent14 = AgentCreate("adv_clementineHouse400_meshesBHouse", agent14_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent15_prop = "adv_clementineHouse400_meshesBTerrain.prop"
local agent15 = AgentCreate("adv_clementineHouse400_meshesBTerrain", agent15_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent16_prop = "adv_clementineHouse400_meshesBTreeFlats.prop"
local agent16 = AgentCreate("adv_clementineHouse400_meshesBTreeFlats", agent16_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent17_prop = "adv_clementineHouse400_meshesBTrees.prop"
local agent17 = AgentCreate("adv_clementineHouse400_meshesBTrees", agent17_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent18_prop = "adv_clementineHouse400_meshesCGrass.prop"
local agent18 = AgentCreate("adv_clementineHouse400_meshesCGrass", agent18_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent19_prop = "adv_clementineHouse400_meshesCHouse.prop"
local agent19 = AgentCreate("adv_clementineHouse400_meshesCHouse", agent19_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent20_prop = "adv_clementineHouse400_meshesCTerrain.prop"
local agent20 = AgentCreate("adv_clementineHouse400_meshesCTerrain", agent20_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent21_prop = "adv_clementineHouse400_meshesCTrees.prop"
local agent21 = AgentCreate("adv_clementineHouse400_meshesCTrees", agent21_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent22_prop = "adv_clementineHouse400_meshesDHouse.prop"
local agent22 = AgentCreate("adv_clementineHouse400_meshesDHouse", agent22_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent23_prop = "adv_clementineHouse400_meshesDTerrain.prop"
local agent23 = AgentCreate("adv_clementineHouse400_meshesDTerrain", agent23_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
local agent24_prop = "adv_clementineHouse400_meshesDTreeFlats.prop"
local agent24 = AgentCreate("adv_clementineHouse400_meshesDTreeFlats", agent24_prop, newPosition, Vector(0,0,0), sceneObj, false, false)
end
CreateWellingtonSeasonThree = function(sceneObj)
ResourceSetEnable("ProjectSeason3")
ResourceSetEnable("WalkingDead301")
--ResourceSetDisable("WalkingDead401")
--ResourceSetDisable("ProjectSeason4")
local main_prop = "adv_wellington301.prop"
PreLoad(main_prop)
local main = AgentCreate("adv_wellington301", main_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent1_prop = "adv_wellington301_meshesA.prop"
PreLoad(agent1_prop)
local agent1 = AgentCreate("adv_wellington301_meshesA", agent1_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent2_prop = "adv_wellington301_meshesB.prop"
PreLoad(agent2_prop)
local agent2 = AgentCreate("adv_wellington301_meshesB", agent2_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent3_prop = "adv_wellington301_meshesBBushes.prop"
PreLoad(agent3_prop)
local agent3 = AgentCreate("adv_wellington301_meshesBBushes", agent3_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent4_prop = "adv_wellington301_meshesBGrass.prop"
PreLoad(agent4_prop)
local agent4 = AgentCreate("adv_wellington301_meshesBGrass", agent4_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent5_prop = "adv_wellington301_meshesBPuddles.prop"
PreLoad(agent5_prop)
local agent5 = AgentCreate("adv_wellington301_meshesBPuddles", agent5_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent6_prop = "adv_wellington301_meshesBTrees.prop"
PreLoad(agent6_prop)
local agent6 = AgentCreate("adv_wellington301_meshesBTrees", agent6_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent7_prop = "adv_wellington301_meshesC.prop"
PreLoad(agent7_prop)
local agent7 = AgentCreate("adv_wellington301_meshesC", agent7_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent8_prop = "adv_wellington301_meshesCBushes.prop"
PreLoad(agent8_prop)
local agent8 = AgentCreate("adv_wellington301_meshesCBushes", agent8_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent9_prop = "adv_wellington301_meshesCGrass.prop"
PreLoad(agent9_prop)
local agent9 = AgentCreate("adv_wellington301_meshesCGrass", agent9_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent10_prop = "adv_wellington301_meshesCTreeCards.prop"
PreLoad(agent10_prop)
local agent10 = AgentCreate("adv_wellington301_meshesCTreeCards", agent10_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent11_prop = "adv_wellington301_meshesD.prop"
PreLoad(agent11_prop)
local agent11 = AgentCreate("adv_wellington301_meshesD", agent11_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent12_prop = "adv_wellington301_meshesDBushes.prop"
PreLoad(agent12_prop)
local agent12 = AgentCreate("adv_wellington301_meshesDBushes", agent12_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent13_prop = "adv_wellington301_meshesDGrass.prop"
PreLoad(agent13_prop)
local agent13 = AgentCreate("adv_wellington301_meshesDGrass", agent13_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent14_prop = "adv_wellington301_meshesDTreeCards.prop"
PreLoad(agent14_prop)
local agent14 = AgentCreate("adv_wellington301_meshesDTreeCards", agent14_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent15_prop = "adv_wellington301_meshesDTrees.prop"
PreLoad(agent15_prop)
local agent15 = AgentCreate("adv_wellington301_meshesDTrees", agent15_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent16_prop = "adv_wellington301_meshesE.prop"
PreLoad(agent16_prop)
local agent16 = AgentCreate("adv_wellington301_meshesE", agent16_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent17_prop = "adv_wellington301_meshesEBushes.prop"
PreLoad(agent17_prop)
local agent17 = AgentCreate("adv_wellington301_meshesEBushes", agent17_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent18_prop = "adv_wellington301_meshesEGrass.prop"
PreLoad(agent18_prop)
local agent18 = AgentCreate("adv_wellington301_meshesEGrass", agent18_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent19_prop = "adv_wellington301_meshesETreeCards.prop"
PreLoad(agent19_prop)
local agent19 = AgentCreate("adv_wellington301_meshesETreeCards", agent19_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent20_prop = "adv_wellington301_meshesETrees.prop"
PreLoad(agent20_prop)
local agent20 = AgentCreate("adv_wellington301_meshesETrees", agent20_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent21_prop = "adv_wellington301_meshesF.prop"
PreLoad(agent21_prop)
local agent21 = AgentCreate("adv_wellington301_meshesF", agent21_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent22_prop = "adv_wellington301_meshesFBushes.prop"
PreLoad(agent22_prop)
local agent22 = AgentCreate("adv_wellington301_meshesFBushes", agent22_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent23_prop = "adv_wellington301_meshesFGrass.prop"
PreLoad(agent23_prop)
local agent23 = AgentCreate("adv_wellington301_meshesFGrass", agent23_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent24_prop = "adv_wellington301_meshesFTrees.prop"
PreLoad(agent24_prop)
local agent24 = AgentCreate("adv_wellington301_meshesFTrees", agent24_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent25_prop = "adv_wellington301_meshesFTreesCards.prop"
PreLoad(agent25_prop)
local agent25 = AgentCreate("adv_wellington301_meshesFTreesCards", agent25_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent26_prop = "adv_wellington301_meshesG.prop"
PreLoad(agent26_prop)
local agent26 = AgentCreate("adv_wellington301_meshesG", agent26_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent27_prop = "adv_wellington301_meshesGBushes.prop"
PreLoad(agent27_prop)
local agent27 = AgentCreate("adv_wellington301_meshesGBushes", agent27_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent28_prop = "adv_wellington301_meshesGGrass.prop"
PreLoad(agent28_prop)
local agent28 = AgentCreate("adv_wellington301_meshesGGrass", agent28_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent29_prop = "adv_wellington301_meshesGTreeCards.prop"
PreLoad(agent29_prop)
local agent29 = AgentCreate("adv_wellington301_meshesGTreeCards", agent29_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent30_prop = "adv_wellington301_meshesH.prop"
PreLoad(agent30_prop)
local agent30 = AgentCreate("adv_wellington301_meshesH", agent30_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent31_prop = "adv_wellington301_meshesI.prop"
PreLoad(agent31_prop)
local agent31 = AgentCreate("adv_wellington301_meshesI", agent31_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local agent32_prop = "adv_wellington301_meshesJ.prop"
PreLoad(agent32_prop)
local agent32 = AgentCreate("adv_wellington301_meshesJ", agent32_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
--ResourceSetEnable("WalkingDead401")
--ResourceSetEnable("ProjectSeason4")
end
ReplaceCamera = function(sceneObj)
--Custom_RemoveAgent("cam_cutscene", sceneObj)
--Custom_RemoveAgent("cam_cutscene_zombieTimer", sceneObj)
--Custom_RemoveAgent("cam_nav_gate_parent", sceneObj)
--Custom_RemoveAgent("cam_nav", sceneObj)
--Custom_RemoveAgent("cam_nav_yard_parent", sceneObj)
--Custom_RemoveAgent("cam_nav_trigger_yard_depth", sceneObj)
--Custom_RemoveAgent("cam_nav_yard", sceneObj)
--Custom_RemoveAgent("cam_cutsceneChore", sceneObj)
--Custom_RemoveAgent("cam_player", sceneObj)
--Custom_RemoveAgent("cam_playerwalk", sceneObj)
--Custom_RemoveAgent("cam_nav_porch_parent", sceneObj)
--Custom_RemoveAgent("cam_nav_porch", sceneObj)
--Custom_RemoveAgent("cam_nav_trigger_porch_depth", sceneObj)
--Custom_RemoveAgent("cam_nav_gate", sceneObj)
--Custom_RemoveAgent("cam_nav_porch_horizontal01", sceneObj)
--Custom_RemoveAgent("cam_nav_trigger_gate_depth", sceneObj)
--Custom_RemoveAgent("cam_nav_yard_horizontal", sceneObj)
--Custom_RemoveAgent("cam_nav_porch_horizontal", sceneObj)
--Custom_RemoveAgent("cam_nav_gate_horizontal", sceneObj)
--Custom_RemoveAgent("cam_nav_shawnArrivalYard", sceneObj)
--Custom_RemoveAgent("cam_nav_shawnArrivalYard_horizontal", sceneObj)
--Custom_RemoveAgent("cam_nav_shawnArrivalYard_parent", sceneObj)
--Custom_RemoveAgent("cam_nav_shawnArrivalFence", sceneObj)
--Custom_RemoveAgent("cam_nav_shawnArrivalFence_horizontal", sceneObj)
--Custom_RemoveAgent("cam_nav_shawnArrivalFence_parent", sceneObj)
--Custom_RemoveAgent("cam_nav_trigger_shawnGate_depth", sceneObj)
--Custom_RemoveAgent("cam_nav_yardPoolLevel", sceneObj)
--Custom_RemoveAgent("cam_nav_gate_nav", sceneObj)
--Custom_RemoveAgent("cam_nav_yardPoolLevel_parent", sceneObj)
--Custom_RemoveAgent("cam_nav_yardPoolLevel_horizontal", sceneObj)
--Custom_RemoveAgent("cam_nav_yardPoolLevel_nav", sceneObj)
--Custom_RemoveAgent("cam_nav_shawnArrivalFence_nav", sceneObj)
--Custom_RemoveAgent("cam_nav_shawnArrivalYard_nav", sceneObj)
--Custom_RemoveAgent("cam_leeFrontHouse", sceneObj)
--Custom_RemoveAgent("cam_leeFrontHouse_horizontal", sceneObj)
--Custom_RemoveAgent("cam_nav_porchToGate", sceneObj)
--Custom_RemoveAgent("cam_leeFrontHouse_nav", sceneObj)
--Custom_RemoveAgent("cam_leeFrontHouse_parent", sceneObj)
--Custom_RemoveAgent("cam_leeShawnDialog", sceneObj)
--Custom_RemoveAgent("cam_leeClemFrontHouse", sceneObj)
--Custom_RemoveAgent("cam_carCop", sceneObj)
--Custom_RemoveAgent("cam_leeShawnPushCar", sceneObj)
--Custom_RemoveAgent("cam_shawnTruck", sceneObj)
--Custom_RemoveAgent("cam_ClemGate_Lee_M", sceneObj)
--Custom_RemoveAgent("cam_ClemGate_Lee_CU", sceneObj)
--Custom_RemoveAgent("cam_ClemGate_Clementine_CU", sceneObj)
--Custom_RemoveAgent("cam_ClemGate_Clementine_OST", sceneObj)
--Custom_RemoveAgent("cam_Driveway_Lee_CU", sceneObj)
--Custom_RemoveAgent("cam_Driveway_Chet_CU", sceneObj)
--Custom_RemoveAgent("cam_Driveway_Clementine_CU", sceneObj)
--Custom_RemoveAgent("cam_Driveway_Shawn_CU", sceneObj)
--Custom_RemoveAgent("cam_Driveway_Shawn_M", sceneObj)
--Custom_RemoveAgent("cam_Driveway_Lee_M", sceneObj)
--Custom_RemoveAgent("cam_Driveway_Clementine_M", sceneObj)
--Custom_RemoveAgent("cam_Driveway_Chet_M", sceneObj)
--Custom_RemoveAgent("cam_leeClemDialog", sceneObj)
--Custom_RemoveAgent("camAxis_cam_nav_porch", sceneObj)
--Custom_RemoveAgent("camAxis_cam_nav_gate", sceneObj)
--Custom_RemoveAgent("camAxis_cam_nav_shawnArrivalFence_nav", sceneObj)
--Custom_RemoveAgent("camAxis_cam_nav_shawnArrivalYard_nav", sceneObj)
ResourceSetEnable("ProjectSeason4")
local orbitCam_prop = "cam_orbit.prop"
local orbitCam = AgentCreate("orbitCam", orbitCam_prop, Vector(0,0,0), Vector(0,0,0), sceneObj, false, false)
local orbitCam_properties = AgentGetRuntimeProperties(orbitCam)
local orbitCam_camera = AgentGetCamera(orbitCam)
CameraActivate(orbitCam_camera)
local leeAgent = AgentFindInScene("Lee", sceneObj)
PropertySet(orbitCam_properties, "Orbit Cam - Attach Agent", leeAgent)
local sceneAgent = AgentFindInScene("adv_clementineHouseExterior.scene", sceneObj)
local sceneAgent_properties = AgentGetRuntimeProperties(sceneAgent)
PropertySet(sceneAgent_properties, "Scene - Last Camera", orbitCam_camera)
PropertySet(sceneAgent_properties, "Scene - Camera", orbitCam_camera)
PropertySet(sceneAgent_properties, "Active Camera", orbitCam_camera)
CameraActivate(orbitCam_camera)
CameraPush(orbitCam_camera)
end
ClementineHouseExterior = function()
--PrintSceneListToTXT(kScene, "sceneobject_101-clemHouseExt.txt")
ModifyScene(kScene)
ReplaceCamera(kScene)
--ClearScene(kScene)
--CreateWellingtonSeasonThree(kScene)
--SceneAdd(newKscene)
--CreateClemHouse(kScene)
-- function num : 0_0 , upvalues : _ENV, kDialog
local mbKilledBabySitter = Logic["ClemHouseInt - Killed Babysitter"]
if Platform_IsXfinity() then
local isTrial = not (((GetPreferences()).DLC).WalkingDead102).Purchased
end
-- DECOMPILER ERROR at PC20: Confused about usage of register: R2 in 'UnsetPending'
if isTrial and mbKilledBabySitter then
((AgentFind("logic_game")).mProps).bDemoMode = true
local func = function()
-- function num : 0_0_0 , upvalues : _ENV
LoadScript("ui_demoUpsell.lua")
end
ThreadStart(func)
return
end
do
if Platform_IsWiiU() then
print("Dialog Preloading start")
DlgPreload(kDialog, "Enter", 0, 15, 0, false)
end
if Platform_IsIOS() or Platform_IsAndroid() then
AgentHide("obj_treesBackClementineExterior", true)
ShaderHideTexture("obj_doorSlidingGlassClementineHouseExterior", "env_clementinehouseinteriorglassdoors.d3dtx", true)
end
Mode(mode_Main)
-- DECOMPILER ERROR at PC62: Confused about usage of register: R2 in 'UnsetPending'
Logic["ClemHouseInt - Test Fight Prototype"] = true
if not SaveLoad_IsFromLoad() then
Dialog_Play("Enter", "Lee", nil, kDialog)
else
if Logic["ClemHouseExt - Entered From House"] and not Logic["ClemHouseInt - ChoseLookForHelp"] then
ClemHouseExt_RestrictWalkbox()
end
end
end
end
ClemHouseExt_RestrictWalkbox = function()
-- function num : 0_1 , upvalues : _ENV, kScene
for i = 40, 77 do
WalkBoxesDisableTri(kScene, i)
end
end
SceneOpen(kScene, kScript)
--SceneOpen(newKscene, kScript)
|
require('init');
require('gnuplot');
--[[
Plot Relative Error Criterion
--]]
function main()
local criterion = nnst.ErrorCriterionRelative(0.8, 0.16)
local e = 10
local xs = torch.linspace(e-12, e+12, 200)
local f = xs:clone()
f:apply(function (x)
return criterion:forward(torch.Tensor{ x }, torch.Tensor{ e })
end)
local df = xs:clone()
df:apply(function (x)
local result = criterion:backward(torch.Tensor{ x }, torch.Tensor{ e })
return result[1]
end)
local ddf = xs:clone()
ddf:apply(function (x)
local _, result = criterion:backward2(torch.Tensor{ x }, torch.Tensor{ e })
return result[1]
end)
gnuplot.plot({'f(x)', xs, f, '-'}, {'df', xs, df, '-'}, {'d^2f', xs, ddf, '-'})
gnuplot.grid(true)
end
main()
|
function px(amount)
return amount.."px"
end
Lucene.ui = {}
Lucene.ui.sides = {} -- Holds all the different UI sides
Lucene.window = {}
Lucene.window.width, Lucene.window.height = getMainWindowSize()
-- Import them files
Lucene.import("ui/containers")
Lucene.import("ui/styles")
Lucene.import("ui/sides/left")
Lucene.import("ui/sides/right")
|
------------------------------------------------------------------
-- common.lua
-- Author : ChenJM
-- Version : 1.15
-- Date :
-- Description: 通用类,包含字体,颜色,适配位置等,
------------------------------------------------------------------
require("lib.ZyImage")
pWinSize=CCDirector:sharedDirector():getWinSize()
function ZyRequire()
--local eLanguage = ScutUtility.CLocale:getLanguage()
local strPath = nil
if eLanguage == "zh_TW" then --繁体中文
strPath2 = "config/language/ZH_TW/lib"
else
strPath1 = "config/language/ZH_CN/Language"
strPath2 = "config/language/ZH_CN/lib"
end
require(strPath1)
require(strPath2)
end
ZyRequire()
function PT(x,y)
return CCPoint(x,y)
end
function Half_Float(x)
return x*0.5;
end
function SZ(width, height)
return CCSize(width, height)
end
function SCALEX(x)
return CCDirector:sharedDirector():getWinSize().width/480*x
end
function SCALEY(y)
return CCDirector:sharedDirector():getWinSize().height /320*y
end
FONT_NAME = "黑体"
FONT_DEF_SIZE = SCALEX(18)
FONT_SM_SIZE = SCALEX(15)
FONT_BIG_SIZE = SCALEX(23)
FONT_M_BIG_SIZE = SCALEX(63)
FONT_SMM_SIZE = SCALEX(13)
FONT_FM_SIZE=SCALEX(11)
FONT_FMM_SIZE=SCALEX(12)
FONT_FMMM_SIZE=SCALEX(9)
ccBLACK = ccc3(0,0,0);
ccWHITE = ccc3(255,255,255);
ccYELLOW = ccc3(255,255,0);
ccBLUE = ccc3(0,0,255);
ccGREEN = ccc3(0,255,0);
ccRED = ccc3(255,0,0);
ccMAGENTA = ccc3(255,0,255);
ccPINK = ccc3(228,56,214); -- 粉色
ccORANGE = ccc3(206, 79, 2) -- 橘红色
ccGRAY = ccc3(166,166,166);
ccC1=ccc3(45,245,250);
---通用颜色
ccRED1= ccc3(86,26,0)
ccYELLOW2=ccc3(241,176,63)
---
------获取资源的路径---------------------
function P(fileName)
if fileName then
return ScutDataLogic.CFileHelper:getPath(fileName)
else
return nil
end
end
function SX(x)
return SCALEX(x)
end
function SY(y)
return SCALEY(y)
end
function Log(fmt,...)
CCLuaLog(string.format(fmt,...))
end
--文件的路径--
--mode r w a b
--fmt... 同Log参数
function LogFile(fileName, mode, fmt,...)
local f = io.open(ScutDataLogic.CFileHelper:getWritablePath(fileName), mode)
f:write(string.format(fmt,...))
f:write("\n")
f:close()
end
--返回时间hh:mm:ss---
function formatTime(timeNum, format)
if format == nil then
format = "%02d:%02d:%02d"
end
return string.format(format, ZyCalculateTime(timeNum))
end
function ZyCalculateTime(timeNum)
local nSec=timeNum
local h=0
local m=0
local s=0
h=math.floor(nSec/ 3600)
m=math.floor((nSec%3600) /60)
s=nSec%60
return h,m,s
end
-- 解析服务器下发时间
function parseTime(strTime)
local strMode = "(%d+)-(%d+)-(%d+)%s*(%d+)%:(%d+):(%d+)"
local pos, leng, year, month, day, hour, min, sec = string.find(strTime, strMode)
local time = {}
time.year = year or 1970
time.month = month or 1
time.day = day or 1
time.hour = hour or 0
time.min = min or 0
time.sec = sec or 0
return time
end
-- 获取当前系统时间
function currentTime()
return os.date("*t")
end
function isSameDay(t1, t2)
if t1 == nil or t2 == nil then
return false
end
if tonumber(t1.year) == tonumber(t2.year)
and tonumber(t1.month) == tonumber(t2.month)
and tonumber(t1.day) == tonumber(t2.day) then
return true
end
return false
end
-- 事件用时间
function eventTime(ticks)
local time = getTimeTable(ticks)
local curTime = currentTime()
if isSameDay(time, curTime) then
return string.format("%02d:%02d", time.hour, time.min)
else
return string.format("%02d-%02d", time.month, time.day)
end
end
--将服务器下发的Ticks时间转换成时间表 nTicks为nil时输出当前时间
--表格如下:
-- hour 2
-- min 20
-- wday 2
-- day 14
-- month 11
-- year 2011
-- sec 29
-- yday 318
-- isdst false
function getTimeTable(nTicks)
if nTicks then
nTicks = nTicks - 3600 * 8
else
nTicks = os.time()
end
return os.date("*t", nTicks)
end
--将服务器下发的Ticks时间转换成时间字符串 nTicks为nil时输出当前时间
--输出格式: 2011-11-14 17:38:01
function getTimeString(nTicks)
local tDate = getTimeTable(nTicks)
return string.format("%04d-%02d-%02d %02d:%02d:%02d", tDate.year, tDate.month, tDate.day, tDate.hour, tDate.min, tDate.sec)
end
function Int64(number)
return ScutDataLogic.CInt64:new_local(number)
end
function int64toNumber(int64)
if int64 == nil then
return nil
else
return tonumber(int64:str())
end
end
function compareFloat(float1, float2)
local float21 = float2 - 0.000001
local float22 = float2 + 0.000001
if float1 >= float21 and float1 <= float22 then
return 0
elseif float1 < float21 then
return -1
elseif float1 > float22 then
return 1
end
end
function deleteFile(fileName)
os.remove (ScutDataLogic.CFileHelper:getWritablePath(fileName))
end
function debugInfo()
local info = debug.getinfo(3)
local src = string.reverse(info.short_src)
local pos = string.find(src, "\\")
src = src.sub(src, 0, pos-1)
src = string.reverse(src)
local info2 = debug.getinfo(2)
if info.name == nil then
info.name = "nil"
end
local str = string.format("%-25s %-25s %-20s line:%-10d %-30s", info2.name, src, info.name, info.currentline, os.date())
return str
end
--获取节点在当前屏幕的位置
function getScreenPosition(node)
local position = node:getPosition()
while node:getParent() do
node = node:getParent()
local position2 = node:getPosition()
position.x = position.x + position2.x
position.y = position.y + position2.y
end
return position
end
--返回值为true表示保存成功,ITEMS数组TABLE,filename表示要保存的文件名
function saveItemsToFile(items,filename)
local f = io.open(ScutDataLogic.CFileHelper:getWritablePath(filename), "w+")
if f == nil or items == nil or #items <= 0 then
return false
end
local key = ZyTable.keys(items[1])
for i,x in ipairs(key) do
f:write(string.format("%s ",x))
end
f:write("\n")
for i,x in ipairs(items) do
if x then
local itemId = nil;
local item = ""
for j,v in ipairs(key) do
local data = x[v]
if data ~= nil then
if type(data) == "userdata" then
item = item..string.format("%s ",data:str())
else
item = item..string.format("%s ",tostring(data))
end
end
end
f:write(item)
f:write("\n")
end
end;
f:flush()
f:close()
io.close();
end
--返回nil则表示失败
function getItemFromFile(filename)
local f = io.open(ScutDataLogic.CFileHelper:getWritablePath(filename), "r")
if f == nil then
return nil
end
local items = {}
local keys = {}
local itemIndex = 0
for line in f:lines() do
local index = 0
local i = 0
local j = 0
if #keys == 0 then
while true do
i, j = string.find(line, " ", index)
if i == nil then break end
ZyTable.push_back(keys,string.sub(line, index, i-1))
index = i+1;
end
else
local elemIndex = 1
items[itemIndex] = {}
while true do
i, j = string.find(line, " ", index)
if i == nil then break end
local item = items[itemIndex]
local key = keys[elemIndex]
if key == nil then
break
end
item[key] = string.sub(line, index, i-1)
elemIndex = elemIndex + 1
index = i+1;
end
end
itemIndex = itemIndex + 1
end
return items
end
-- 判断文件是否存在
function isFileExist(filename)
local result = io.open(filename, "r")
io.close()
return result ~= nil
end
--是否包含非法字符,除数字与字母外的字符
function IsillegalString(inString)
firstidx, lastidx = string.find(inString, "[%d%a]+")
if firstidx ~= nil and lastidx == string.len(inString) then
return false
end
return true
end
--分割字符串
function Split(szFullString, szSeparator)
local nSplitArray = {}
local nFindStartIndex = 1
local nSplitIndex = 1
if szFullString == nil then
return nSplitArray
end
while true do
local nFindLastIndex = string.find(szFullString, szSeparator, nFindStartIndex)
if not nFindLastIndex then
nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, string.len(szFullString))
break
end
nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, nFindLastIndex - 1)
nFindStartIndex = nFindLastIndex + string.len(szSeparator)
nSplitIndex = nSplitIndex + 1
end
return nSplitArray
end
--场景进入退出动画
local time = 0.6
local sceneTable = {}
function SlideInLPushScene(scene)
local beforeScene = CCDirector:sharedDirector():getRunningScene()
sceneTable[#sceneTable+1] = beforeScene
local s = CCTransitionFade:create(time,scene)
CCDirector:sharedDirector():pushScene(s)
end
function SlideInLReplaceScene(scene,type)
if type then
MainScene.releaseResource()
GuideLayer.releaseResource()
end
local s = CCTransitionFade:transitionWithDuration(time,scene)
commReplaceScene(s)
end
function SlideInRPopScene(scene,type)
local beforeScene = sceneTable[#sceneTable]
local s = CCTransitionFade:create(time,beforeScene)
commReplaceScene(s)
if type then
MainMenuLayer.init(type, beforeScene)
end
sceneTable[#sceneTable] = nil
end
function popupScene()
commPopScene()
end
function commPopScene()
CCDirector:sharedDirector():popScene()
CCTextureCache:sharedTextureCache():removeUnusedTextures()
end
function commReplaceScene(scene)
CCDirector:sharedDirector():replaceScene(scene)
CCTextureCache:sharedTextureCache():removeUnusedTextures()
end
--使用Lua遍历指定目录,获取所有文件,并使用自定义的函数处理每一个文件
--遍历目录,并对所有的文件进行处理
function fuc_dir_file(dirpath,func)
os.execute('dir "'.. dirpath.. '" /s > temp.txt')
io.input("temp.txt")
local dirname = ""
local filename = ""
for line in io.lines() do
local a,b,c
--匹配目录
a,b,c=string.find(line,"^%s*(.+)%s+的目录")
if a then
dirname = c
end
--匹配文件
a,b,c=string.find(line,"^%d%d%d%d%-%d%d%-%d%d%s-%d%d:%d%d%s-[%d%,]+%s+(.+)%s-$")
if a then
filename = c
func(dirname.. "\\".. filename)
end
end
end
function getUserDataPath()
local path = string.format("userdata/%s/", accountInfo.mUser91Name)
if not ScutDataLogic.CFileHelper:isDirExists(path) then
ScutDataLogic.CFileHelper:createDir(path)
end
return path
end
function IMAGE(file)
local texture = CCTextureCache:sharedTextureCache():addImage(P(file))
return texture
end
function getMidPoint(startPoint, endPoint)
if startPoint == nil or endPoint == nil then
return PT(0, 0)
end
local midPoint = PT(0, 0)
midPoint.x = startPoint.x + (endPoint.x - startPoint.x)/2
midPoint.y = startPoint.y + (endPoint.y - startPoint.y)/2
return midPoint
end
function transToLocalPosition(x, y)
local pos = PT(0, 0)
pos.x = x * TILE_SIZE.width - TILE_SIZE.width / 2
pos.y = y * TILE_SIZE.height - TILE_SIZE.height / 2
return pos
end
function transToServerPosition(x, y)
local pos = PT(0, 0)
pos.x = math.floor(x / TILE_SIZE.width)
pos.y = math.floor(y / TILE_SIZE.height)
return pos
end
--创建物品图片
function createItemImage(itemId,ImageId)
local imagePath,itemAbility = getItemImageRoute(itemId,ImageId)
local bgSprite = CCSprite:spriteWithTexture(IMAGE(mAbilityImagePath[itemAbility]))
bgSprite:setAnchorPoint(PT(0, 0))
bgSprite:setPosition(PT(0, 0))
local itemImage = CCSprite:spriteWithTexture(IMAGE(imagePath))
bgSprite:addChild(itemImage, 0)
itemImage:setAnchorPoint(PT(0.5, 0.5))
itemImage:setPosition(PT(bgSprite:getContentSize().width/2, bgSprite:getContentSize().height/2))
return bgSprite
end
function createAction(texture, frameCount, delay)
if not texture then
return
end
delay = delay or 0.05
local size = texture:getContentSize()
local frameWidth = size.width / frameCount
local animation = CCAnimation:animation()
animation:setDelay(delay)
for i=1, frameCount do
animation:addFrameWithTexture(texture, CCRectMake((i-1)*frameWidth, 0, frameWidth, size.height))
end
local action = CCAnimate:actionWithAnimation(animation, false)
return action
end
function timeToDate(ticks)
local time = getTimeTable(ticks)
local curTime = currentTime()
local strTime = string.format("%04d-%02d-%02d %02d:%02d", time.year, time.month, time.day, time.hour, time.min)
if time.year == curTime.year then
if time.yday == curTime.yday then -- 今天
strTime = GameString.IDS_TODAY.. string.format(" %02d:%02d", time.hour, time.min)
elseif time.yday == curTime.yday - 1 then -- 昨天
strTime = GameString.IDS_YESTERDAY.. string.format(" %02d:%02d", time.hour, time.min)
elseif time.yday == curTime.yday - 2 then -- 前天
strTime = GameString.IDS_DAY_BEFORE_YESTERDAY.. string.format(" %02d:%02d", time.hour, time.min)
end
end
return strTime;
end
--缩放控件
function setScale(item, scaleValue)
itemSize = item:getContentSize()
item:setScale(scaleValue)
item:setContentSize(SZ(itemSize.width * scaleValue, itemSize.height * scaleValue))
end
--按平台
function createAndColor(msg, size, CCTextAlignment, fontName, fontsize, strokeColor, color)
local lbl = CCLabelTTF:create(msg, size, CCTextAlignment, fontName, fontsize, strokeColor)
lbl:setColor(color)
return lbl
end
---算字符长度
function utfstrlen(str)
local len = #str;
local left = len;
local cnt = 0;
local arr={0,0xc0,0xe0,0xf0,0xf8,0xfc};
while left ~= 0 do
local tmp=string.byte(str,-left);
local i=#arr;
while arr[i] do
if tmp>=arr[i] then
left=left-i;
break;
end
i=i-1;
end
cnt=cnt+1;
end
return cnt;
end
-----
function utfstrIndex(str,num)
local len = #str;
local left = len;
local cnt = 0;
local arr={0,0xc0,0xe0,0xf0,0xf8,0xfc};
local maxIndex=1
while cnt <num and left~=0 do
local tmp=string.byte(str,-left);
local i=#arr;
while arr[i] do
if tmp>=arr[i] then
left=left-i;
break;
end
i=i-1;
end
cnt=cnt+1;
end
maxIndex=#str-left
local content=string.sub(str, 1,maxIndex)
if maxIndex<#str then
content=content.."..."
end
return content
end;
--------
function getQualityBg(qualityType, itemType)
if itemType == 1 then--装备图标背景
if qualityType == 1 then
return "common/icon_8015_1.png"
elseif qualityType == 2 then
return "common/icon_8015_2.png"
elseif qualityType == 3 then
return "common/icon_8015_3.png"
elseif qualityType == 4 then
return "common/icon_8015_4.png"
else
return "common/icon_8015_3.png"
end
elseif itemType == 2 then--战斗背景
if qualityType == 1 then
return "common/icon_8016_1.png"
elseif qualityType == 2 then
return "common/icon_8016_2.png"
elseif qualityType == 3 then
return "common/icon_8016_3.png"
elseif qualityType == 4 then
return "common/icon_8016_4.png"
else
return "common/icon_8032.png"
end
elseif itemType == 3 then--大图背景
if qualityType == 1 then
return "common/icon_8017_1.png"
elseif qualityType == 2 then
return "common/icon_8017_2.png"
elseif qualityType == 3 then
return "common/icon_8017_3.png"
elseif qualityType == 4 then
return "common/icon_8017_4.png"
else
return "common/icon_8017_3.png"
end
end
end;
--获取数字图片
function getNumberSprite(nNumber,type)
--1 减 2 加
local imageFile = "common/panle_1042.png"
if type== 2 then
imageFile = "common/panle_1043.png"
end
local texture = IMAGE(imageFile)
if texture == nil then
return nil
end
local txSize = texture:getContentSize()
local strNumber = tostring(nNumber)
strNumber=strNumber or 0
strNumber=math.abs(strNumber)
local nLength = string.len(strNumber)
local pNode = CCNode:create()
local nWidth = txSize.width/3
local nHeight = txSize.height/4
local subFrame = CCSpriteFrame:createWithTexture(texture, CCRectMake(0, 3*nHeight,nWidth,nHeight))
local nLeft =-nWidth
local subSprite = CCSprite:createWithSpriteFrame(subFrame)
pNode:setPosition(PT(0, 0))
pNode:addChild(subSprite, 0)
subSprite:setAnchorPoint(PT(0,0))
subSprite:setPosition(PT(0, 0 ))
nLeft =0
for i = 1,nLength do
local nDig = tonumber(string.sub(strNumber, i, i))
if nDig == 0 then
subFrame = CCSpriteFrame:createWithTexture(texture, CCRectMake(nWidth, 3*nHeight,nWidth,nHeight))
else
subFrame = CCSpriteFrame:createWithTexture(texture, CCRectMake((nDig- 1)%3*nWidth,math.floor((nDig -1)/3)*nHeight,nWidth,nHeight))
end
subSprite = CCSprite:createWithSpriteFrame(subFrame)
pNode:addChild(subSprite, 0)
subSprite:setAnchorPoint(PT(0,0))
nLeft = nLeft + nWidth
subSprite:setPosition(PT(nLeft, 0 ))
end
pNode:setContentSize(SZ(nLeft, subSprite:getContentSize().height))
return pNode
end
|
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getGlobalStorageValue(22549) ~= -1 then
s = string.explode(getGlobalStorageValue(22549), ",")
for i = 1, #s do
if getCreatureName(cid) == s[i] then
doPlayerSendTextMessage(cid, 20, "You are already registered in the Golden Arena!")
return true
end
end
if #s > 15 then
doPlayerSendTextMessage(cid, 20, "Sorry, but we have reached the limit of players for the Golden Arena!")
return true
end
end
--alterado v1.3
doPlayerSendTextMessage(cid, 20, "You spent a Meowth coin! Now attend the next event of the 'Golden Survival Arena'.")
doPlayerSendTextMessage(cid, 20, "Check the time for the next event in the billboard on the CP or say /golden horarios.")
doRemoveItem(item.uid, 1) --alterado v1.2
if getGlobalStorageValue(22549) == -1 then
setGlobalStorageValue(22549, getCreatureName(cid)..",")
else
setGlobalStorageValue(22549, getGlobalStorageValue(22549)..""..getCreatureName(cid)..",")
end
end
|
-- Read gpio pin
gpio.mode(3, gpio.INPUT);
level = gpio.read(3); -- read gpio level
print(level);
|
--行动前 阿尔
function onStart(target, buff)
if GetFightData().fight_id == 10100103 then
target[1211] = 200
target[1723] = 40 --初始能量
end
end
--大回合开始前
function afterAllEnter(target, buff)
if GetFightData().fight_id == 10100402 and GetFightData().round == 1 and target.side == 2 then
AddBattleDialog(1010040201)
end
end
--角色死亡
function onEnd(target, buff)
if GetFightData().fight_id == 10100402 and target.side == 2 then
AddBattleDialog(1010040261)
end
end
|
local w = {}
w.Timer = 0
w.Drawing = {}
w.Size = 360/12
w.Scale = 20
w.Height = 50
function w:Init(n)
self.Music = love.audio.newSource(n, "static")
self.Music:setLooping(true)
self.Data = love.sound.newSoundData(n)
self.SampleRate = self.Data:getSampleRate()
end
function w:Update(dt)
self.Timer = self.Timer+dt
if self.Timer>dt then
self.Timer = 0
for i = 1, self.Size do
local h = self.Height*math.log((0.1+math.abs(self.Data:getSample((self.Music:tell("seconds")*self.SampleRate+i-1))*self.Scale)))
self.Drawing[i] = h>(self.Drawing[i] or 0) and h or (self.Drawing[i] or 0)*math.pow(0.01,dt)
end
end
end
function w:Draw()
for k,v in pairs(self.Drawing) do
love.graphics.setColor(v/75, 0, .2, 1)
love.graphics.push()
love.graphics.translate(320, 240)
love.graphics.rotate(k)
love.graphics.rectangle('fill', 15, 90, 10, v*1.2)
love.graphics.pop()
end
end
function w:New(n)
local a = setmetatable({}, self)
self.__index = self
a:Init(n)
return a
end
return w
|
local M = {}
-- define vars
-- assets dir
-- ----------------------------------------------------------------------------
-- private functions
-- ----------------------------------------------------------------------------
-- ----------------------------------------------------------------------------
-- public functions
-- ----------------------------------------------------------------------------
-- insert in scene:create()
function M.create( group )
-- init vars
end
-- insert in scene:show() in "will" phase
function M.showWill()
end
-- insert in scene:show() in "did" phase
function M.showDid()
end
-- insert in scene:hide() in "will" phase
function M.hideWill()
-- remove Runtime listeners
-- cancel timers
-- cancel transitions
end
-- insert in scene:hide() in "did" phase
function M.hideDid()
-- remove Runtime listeners
-- cancel timers
-- cancel transitions
end
-- insert in scene:destroy()
function M.destroy()
-- dispose loaded audio
end
-- return module table
return M
|
local SwiftNode = require 'swiftnode'
local table = require 'table'
describe('Test Swift code generator.', function()
it('should work', function()
local result = 42
assert.is.equals(42, result)
end)
end)
|
--[[
Cops and Robbers: Vehicle Resource
Created by RhapidFyre
Contributors:
-
Created 12/29/2019
--]]
resource_manifest_version '05cfa83c-a124-4cfa-a768-c24a5811d8f9'
ui_page "nui/ui.html"
dependency 'cnrobbers'
files {
"nui/ui.html",
"nui/ui.js",
"nui/ui.css"
}
client_scripts {
"cl_config.lua",
"cl_vehicles.lua"
}
server_scripts {
"sv_config.lua",
"sv_vehicles.lua"
}
server_exports {
'',
}
exports {
''
}
|
--パワー・ツール・ブレイバー・ドラゴン
--
--Script by Trishula9
function c100427005.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(100427005,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,100427005)
e1:SetTarget(c100427005.eqtg)
e1:SetOperation(c100427005.eqop)
c:RegisterEffect(e1)
--pos or neg
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(100427005,1))
e2:SetCategory(CATEGORY_POSITION+CATEGORY_DISABLE)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCountLimit(1,100427005+100)
e2:SetCondition(c100427005.pncon)
e2:SetCost(c100427005.pncost)
e2:SetTarget(c100427005.pntg)
e2:SetOperation(c100427005.pnop)
c:RegisterEffect(e2)
end
function c100427005.eqfilter(c,ec,tp)
return c:IsType(TYPE_EQUIP) and c:CheckEquipTarget(ec) and c:CheckUniqueOnField(tp,LOCATION_SZONE) and not c:IsForbidden()
end
function c100427005.eqtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(c100427005.eqfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e:GetHandler(),tp) end
Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function c100427005.eqop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_SZONE)
local c=e:GetHandler()
if ft<=0 or c:IsFacedown() or not c:IsRelateToEffect(e) then return end
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(c100427005.eqfilter),tp,LOCATION_DECK+LOCATION_GRAVE,0,nil,c,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local sg=g:SelectSubGroup(tp,aux.dncheck,false,1,math.min(ft,3))
if not sg then return end
local tc=sg:GetFirst()
while tc do
Duel.Equip(tp,tc,c,true,true)
tc=sg:GetNext()
end
Duel.EquipComplete()
end
function c100427005.pncon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2
end
function c100427005.cfilter(c,tp)
return c:IsType(TYPE_EQUIP) and c:IsType(TYPE_SPELL) and c:IsControler(tp) and c:IsAbleToGraveAsCost()
end
function c100427005.pncost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local cg=c:GetEquipGroup()
if chk==0 then return cg:IsExists(c100427005.cfilter,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=cg:FilterSelect(tp,c100427005.cfilter,1,1,nil,tp)
Duel.SendtoGrave(g,REASON_COST)
end
function c100427005.pnfilter(c)
return c:IsFaceup() and c:IsType(TYPE_EFFECT)
end
function c100427005.pntg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c100427005.pnfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c100427005.pnfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c100427005.pnfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
end
function c100427005.pnop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) then return end
local b1=tc:IsCanChangePosition()
local b2=aux.NegateMonsterFilter(tc)
local op=-1
if b1 and b2 then
op=Duel.SelectOption(tp,aux.Stringid(100427005,2),aux.Stringid(100427005,3))
elseif b1 then
op=0
elseif b2 then
op=1
end
if op==0 then
Duel.ChangePosition(tc,POS_FACEUP_DEFENSE,POS_FACEUP_DEFENSE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK)
elseif op==1 then
if not tc:IsDisabled() and not tc:IsImmuneToEffect(e) then
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
tc:RegisterEffect(e2)
end
end
end
|
local block = [[
Extract lines started with tags > or <
line 1
>line 2
line 3
> line 4
line 5
< line 6
< line 7
line > 8
line < 9
line <10>
I need to extract lines 2, 4, 6 and 7
]]
for tag, line in block:gmatch('\n([><])%s?(%C+)') do
print(tag, line)
end
|
--[[ Copyright (c) 2009 Peter "Corsix" Cawley
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. --]]
local TH = require "TH"
--! Room / door / reception desk queue visualisation dialog.
class "UIQueue" (Window)
---@type UIQueue
local UIQueue = _G["UIQueue"]
function UIQueue:UIQueue(ui, queue)
self:Window()
local app = ui.app
self.esc_closes = true
self.ui = ui
self.modal_class = "main"
self.width = 604
self.height = 122
self:setDefaultPosition(0.5, 0.5)
self.panel_sprites = app.gfx:loadSpriteTable("QData", "Req06V", true)
self.white_font = app.gfx:loadFont("QData", "Font01V")
self.queue = queue
self:addPanel(364, 0, 0) -- Right extremity of the panel
for x = 21, 83, 4 do
self:addPanel(365, x, 0)
end
self:addPanel(366, 85, 0)
for x = 223, 531, 7 do
self:addPanel(367, x, 0)
end
self:addPanel(368, 529, 0) -- Left extremity of the panel
self:addPanel(369, 97, self.height - 33):makeButton(0, 0, 17, 17, 370, self.decreaseMaxSize):setTooltip(_S.tooltip.queue_window.dec_queue_size)
self:addPanel(371, 144, self.height - 33):makeButton(0, 0, 17, 17, 372, self.increaseMaxSize):setTooltip(_S.tooltip.queue_window.inc_queue_size)
self:addPanel(373, self.width - 42, 17):makeButton(0, 0, 24, 24, 374, self.close):setTooltip(_S.tooltip.queue_window.close)
self:makeTooltip(_S.tooltip.queue_window.num_in_queue, 15, 15, 163, 36)
self:makeTooltip(_S.tooltip.queue_window.num_expected, 15, 39, 163, 60)
self:makeTooltip(_S.tooltip.queue_window.num_entered, 15, 62, 163, 83)
self:makeTooltip(_S.tooltip.queue_window.max_queue_size, 15, 87, 163, 108)
self:makeTooltip(_S.tooltip.queue_window.front_of_queue, 168, 25, 213, 105)
self:makeTooltip(_S.tooltip.queue_window.end_of_queue, 543, 51, 586, 105)
self:makeTooltip(_S.tooltip.queue_window.patient .. " " .. _S.misc.not_yet_implemented, 218, 15, 537, 107)
end
function UIQueue:decreaseMaxSize()
local amount = 1
if self.ui.app.key_modifiers.ctrl then
amount = amount * 10
elseif self.ui.app.key_modifiers.shift then
amount = amount * 5
end
self.queue:decreaseMaxSize(amount)
end
function UIQueue:increaseMaxSize()
local amount = 1
if self.ui.app.key_modifiers.ctrl then
amount = amount * 10
elseif self.ui.app.key_modifiers.shift then
amount = amount * 5
end
self.queue:increaseMaxSize(amount)
end
function UIQueue:draw(canvas, x, y)
Window.draw(self, canvas, x, y)
x, y = self.x + x, self.y + y
local font = self.white_font
local queue = self.queue
local num_patients = queue:reportedSize()
font:draw(canvas, _S.queue_window.num_in_queue, x + 22, y + 22)
font:draw(canvas, num_patients, x + 140, y + 22)
font:draw(canvas, _S.queue_window.num_expected, x + 22, y + 45)
font:draw(canvas, queue:expectedSize(), x + 140, y + 45)
font:draw(canvas, _S.queue_window.num_entered, x + 22, y + 68)
font:draw(canvas, queue.visitor_count, x + 140, y + 68)
font:draw(canvas, _S.queue_window.max_queue_size, x + 22, y + 93)
font:draw(canvas, queue.max_size, x + 119, y + 93)
self:drawPatients(canvas, x, y)
-- Draw dragged patient in the cursor location
if self.dragged then
self:drawPatient(canvas, self.dragged.x, self.dragged.y, self.dragged.patient)
end
end
local function isInsideQueueBoundingBox(x, y)
local x_min = 219
local x_max = 534
local y_min = 15
local y_max = 105
return not (x < x_min or x > x_max or y < y_min or y > y_max)
end
function UIQueue:onMouseDown(button, x, y)
-- Allow normal window operations if the mouse is outside the listing of patients
if not isInsideQueueBoundingBox(x, y) then
return Window.onMouseDown(self, button, x, y)
end
local x_min = 219
local y_min = 15
self.hovered = self:getHoveredPatient(x - x_min, y - y_min)
-- Select patient to drag - if left clicking.
if button == "left" then
self.dragged = self.hovered
if self.dragged then
self.dragged.x = x + self.x
self.dragged.y = y + self.y
end
elseif button == "right" and self.hovered then
-- Otherwise bring up the choice screen.
self.just_added = true
self.ui:addWindow(UIQueuePopup(self.ui, self.x + x, self.y + y, self.hovered.patient))
end
end
function UIQueue:onMouseUp(button, x, y)
if self.just_added then
self.just_added = false
else
-- Always remove any leftover popup windows
local window = self.ui:getWindow(UIQueuePopup)
if window then
window:close()
end
end
if button == "left" then
local queue = self.queue
local num_patients = queue:reportedSize()
local width = 276
self.ui:setCursor(self.ui.default_cursor) -- reset cursor
if not self.dragged then
return Window.onMouseUp(self, button, x, y)
end
-- Check whether the dragged patient is still in the queue
local index = -1
for i = 1, num_patients do
if self.dragged.patient == queue:reportedHumanoid(i) then
index = i
break
end
end
if index == -1 then
self.dragged = nil
return
end
if x > 170 and x < 210 and y > 25 and y < 105 then -- Inside door bounding box
queue:move(index, 1) -- move to front
elseif x > 542 and x < 585 and y > 50 and y < 105 then -- Inside exit sign bounding box
queue:move(index, num_patients) -- move to back
elseif isInsideQueueBoundingBox(x, y) then
local dx = 1
if num_patients ~= 1 then
dx = math.floor(width / (num_patients - 1))
end
queue:move(index, math.floor((x - 220) / dx) + 1) -- move to dropped position
self:onMouseMove(x, y, 0, 0)
end
-- Try to drop to another room
local room
local wx, wy = self.ui:ScreenToWorld(x + self.x, y + self.y)
wx = math.floor(wx)
wy = math.floor(wy)
if wx > 0 and wy > 0 and wx < self.ui.app.map.width and wy < self.ui.app.map.height then
room = self.ui.app.world:getRoom(wx, wy)
end
-- The new room must be of the same class as the current one
local this_room = self.dragged.patient.next_room_to_visit
if this_room and room and room ~= this_room and room.room_info.id == this_room.room_info.id then
-- Move to another room
local patient = self.dragged.patient
patient:setNextAction(room:createEnterAction(patient))
patient.next_room_to_visit = room
patient:updateDynamicInfo(_S.dynamic_info.patient.actions.on_my_way_to:format(room.room_info.name))
room.door.queue:expect(patient)
room.door:updateDynamicInfo()
end
end
self.dragged = nil
end
function UIQueue:onMouseMove(x, y, dx, dy)
local x_min = 219
local y_min = 15
if self.dragged then
self.dragged.x = x + self.x
self.dragged.y = y + self.y
-- Change cursor when outside queue dialog
if x > 0 and x < 605 and y > 0 and y < 120 then
self.ui:setCursor(self.ui.default_cursor)
else
self.ui:setCursor(self.ui.app.gfx:loadMainCursor("queue_drag"))
end
end
if not isInsideQueueBoundingBox(x, y) then
self.hovered = nil
Window:onMouseMove(x, y, dx, dy)
return
end
-- Update hovered patient
self.hovered = self:getHoveredPatient(x - x_min, y - y_min)
Window:onMouseMove(x, y, dx, dy)
end
function UIQueue:close()
-- Always remove any leftover popup windows
local window = self.ui:getWindow(UIQueuePopup)
if window then
window:close()
end
Window.close(self)
end
function UIQueue:getHoveredPatient(x, y)
local queue = self.queue
local num_patients = queue:reportedSize()
local width = 276
local gap = 10
x = x - 15 -- sprite offset
local dx = 0
if num_patients ~= 1 then
dx = math.floor(width / (num_patients - 1))
end
local offset = 0
local closest = nil
-- Find the closest patient to the given x-coordinate
for index = 1, num_patients do
local patient = queue:reportedHumanoid(index)
local patient_x = (index - 1) * dx + offset
local diff = math.abs(patient_x - x)
-- Take into account the gap between the hovered patient and other patients
if self.hovered and patient == self.hovered.patient then
offset = gap * 2
diff = diff + gap
end
if not closest or diff < closest.diff then
closest = {patient = patient, diff = diff, x = x}
end
end
-- The closest patient must be close enough (i.e. almost over the patient sprite)
if not closest or closest.diff > 25 then
return nil
end
return {patient = closest.patient, x = closest.x}
end
function UIQueue:drawPatients(canvas, x, y)
local queue = self.queue
local num_patients = queue:reportedSize()
local width = 276
local gap = 10
local dx = 0
if not self.hovered then
if num_patients ~= 1 then
dx = math.floor(width / (num_patients - 1))
end
for index = 1, num_patients do
local patient = queue:reportedHumanoid(index)
self:drawPatient(canvas, x + 239 + dx * (index - 1), y + 75, patient)
end
else
if num_patients ~= 1 then
dx = math.floor((width - 2 * gap) / (num_patients - 1))
end
x = x + 239
y = y + 75
for index = 1, num_patients do
local patient = queue:reportedHumanoid(index)
if patient == self.hovered.patient then
x = x + gap
self:drawPatient(canvas, x, y - 10, patient)
x = x + gap + dx
else
self:drawPatient(canvas, x, y, patient)
x = x + dx
end
end
end
end
function UIQueue:drawPatient(canvas, x, y, patient)
local anim = TH.animation()
local idle_anim = patient.getIdleAnimation(patient.humanoid_class)
anim:setAnimation(self.ui.app.world.anims, idle_anim, 1) -- flag 1 is for having patients in west position (looking the door in the dialog)
for layer, id in pairs(patient.layers) do
anim:setLayer(layer, id)
end
anim:draw(canvas, x, y)
-- Also draw the mood of the patient, if any.
local mood = patient:getCurrentMood()
if mood then
mood:draw(canvas, x, y + 24)
end
end
class "UIQueuePopup" (Window)
---@type UIQueuePopup
local UIQueuePopup = _G["UIQueuePopup"]
function UIQueuePopup:UIQueuePopup(ui, x, y, patient)
self:Window()
self.esc_closes = true
self.ui = ui
self.patient = patient
self.width = 188
self.height = 68
local app = ui.app
self.modal_class = "popup"
self:setDefaultPosition(x, y)
-- Background sprites
self:addPanel(375, 0, 0)
-- Buttons
self:addPanel(0, 12, 12):makeButton(0, 0, 81, 54, 378, self.sendToReception)
self:addPanel(0, 95, 12):makeButton(0, 0, 81, 54, 379, self.sendHome)
self:addPanel(377, 0, 58)
self.panel_sprites = app.gfx:loadSpriteTable("QData", "Req06V", true)
self.white_font = app.gfx:loadFont("QData", "Font01V")
end
function UIQueuePopup:draw(canvas, x, y)
Window.draw(self, canvas, x, y)
-- TODO: Same as above.
-- x, y = self.x + x, self.y + y
--[[for i, hospital in ipairs(self.ui.app.world.hospitals) do
self.white_font:draw(canvas, hospital.name:upper() , x + 74, y + 78 + (i-1)*34, 92, 0)
end]]
end
function UIQueuePopup:sendToReception()
self.patient:setNextAction(SeekReceptionAction())
self:close()
end
function UIQueuePopup:sendHome()
self.patient:goHome("kicked")
self:close()
end
|
function on_activate(parent, ability)
local targets = parent:targets():hostile():attackable()
local targeter = parent:create_targeter(ability)
targeter:set_selection_attackable()
targeter:add_all_selectable(targets)
targeter:add_all_effectable(targets)
targeter:activate()
end
function on_target_select(parent, ability, targets)
local target = targets:first()
local cb = ability:create_callback(parent)
cb:add_target(target)
cb:set_after_attack_fn("create_stun_effect")
ability:activate(parent)
parent:anim_special_attack(target, "Fortitude", "Melee", 0, 0, 0, "Raw", cb)
end
function create_stun_effect(parent, ability, targets, hit)
local target = targets:first()
if hit:is_miss() then
game:play_sfx("sfx/swish_2")
elseif hit:is_graze() then
game:play_sfx("sfx/thwack-07")
target:change_overflow_ap(-2000)
elseif hit:is_hit() then
target:change_overflow_ap(-4000)
game:play_sfx("sfx/thwack-08")
elseif hit:is_crit() then
game:play_sfx("sfx/thwack-09")
target:change_overflow_ap(-6000)
end
local gen = target:create_anim("burst", 0.15)
gen:set_moves_with_parent()
gen:set_position(gen:param(-0.75), gen:param(-0.75))
gen:set_particle_size_dist(gen:fixed_dist(1.5), gen:fixed_dist(1.5))
gen:activate()
end
|
local wibox = require("wibox")
local dpi = require("beautiful").xresources.apply_dpi
local clickableContainer = require("widgets.general.clickable-container")
-- Return function to create a widget group
return function(widgets, margins, height, spacing, clickable, vertical, bgColor)
-- Create layout widget which contains all content widgets
local layout =
wibox.widget {
layout = vertical and wibox.layout.fixed.vertical or wibox.layout.fixed.horizontal,
spacing = spacing and dpi(spacing) or nil
}
-- Add content widgets to the layout widget
for _, widget in ipairs(widgets) do
layout:add(widget)
end
-- Create group widget with the margin, background and click-container widgets
local group =
wibox.widget {
wibox.widget {
clickable and clickableContainer(layout) or layout,
bg = bgColor,
widget = wibox.container.background
},
left = dpi(margins[1]),
top = dpi(margins[2]),
right = dpi(margins[3]),
bottom = dpi(margins[4]),
forced_height = height and dpi(height) or nil,
widget = wibox.container.margin
}
-- Return group widget
return group
end
|
module(..., package.seeall)
NODE = {
fields = [[
-- Think twice before editing this ------------------------
fields = {0.0, proto="concat", activate="lua"}
title = {0.1 }
category = {0.2 }
actions = {0.3, proto="concat", activate="lua"}
action_hooks = {0.31, proto="concat", activate="lua"}
config = {0.4, proto="concat", activate="lua"}
markup_module = {0.41, proto="fallback"}
templates = {0.5, proto="concat", activate="list"}
translations = {0.51, proto="concat", activate="list"}
prototype = {0.6 }
permissions = {0.7, proto="concat"}
html_main = {0.701, proto="fallback"}
html_head = {0.702, proto="fallback"}
html_menu = {0.703, proto="fallback"}
html_logo = {0.704, proto="fallback"}
html_search = {0.705, proto="fallback"}
html_page = {0.706, proto="fallback"}
html_content = {0.7061, proto="fallback"}
html_body = {0.707, proto="fallback"}
html_header = {0.708, proto="fallback"}
html_footer = {0.708, proto="fallback"}
html_sidebar = {0.709, proto="fallback"}
html_meta_keywords = {0.70901, proto="fallback"}
html_meta_description = {0.70902, proto="fallback"}
redirect_destination = {0.70903}
xssfilter_allowed_tags = {0.7091, proto="concat", activate="lua"}
http_cache_control = {0.710, proto="fallback"}
http_expires = {0.711, proto="fallback"}
content = {0.8 }
edit_ui = {0.9, proto="concat"}
admin_edit_ui = {0.91, proto="concat"}
child_defaults = {0.92, proto="concat", activate="lua"}
icon = {0.93, proto="fallback"}
breadcrumb = {0.94 }
save_hook = {0.95, proto="fallback"}
-- "virtual" fields (never saved) ------------------------
version = {virtual=true}
prev_version = {virtual=true}
raw = {virtual=true}
history = {virtual=true}
name = {virtual=true}
]],
title="@Root (Root Prototype)",
category="Prototypes",
actions=[[
show = "wiki.show"
show_content = "wiki.show_content"
history = "wiki.history"
edit = "wiki.edit"
configure = "wiki.configure"
post = "wiki.post"
rss = "wiki.rss"
diff = "wiki.diff"
code = "wiki.code"
raw = "wiki.raw"
raw_content = "wiki.raw_content"
login = "wiki.show_login_form"
sputnik_version = "wiki.sputnik_version"
save = "wiki.save"
preview = "wiki.preview"
preview_content = "wiki.preview_content"
reload = "wiki.reload"
]],
markup_module = "markdown",
templates = "sputnik/templates",
translations = "sputnik/translations",
config = [[
]],
edit_ui = [[
-------------------------- basic fields ----------------
content_section = {1.0, "div_start", id="content_section", open="true"}
content = {1.3, "textarea", rows=15, no_label=true}
content.editor_modules = {
"resizeable",
"markitup",
}
content_section_end = {1.4, "div_end"}
-------------------------- advanced fields -------------
advanced_section = {2.0, "div_start", id="advanced"}
page_name = {2.21, "readonly_text"}
title = {2.22, "text_field"}
breadcrumb = {2.23, "text_field"}
category = {2.24, "select", options = {}}
prototype = {2.25, "hidden", no_label=true, div_class="hidden"}
advanced_section_end = {2.3, "div_end"}
--- info about the edit --------------------------------
edit_info_section = {3.00, "div_start", id="edit_info_section", open="true"}
minor = {3.1, "checkbox", value=false}
summary = {3.2, "textarea", rows=3, editor_modules = {"resizeable"}}
edit_info_section_end = {3.3, "div_end"}
]],
admin_edit_ui = [[
-------------------------- basic fields ----------------
--page_params_hdr = {1.0, "header"}
content_section = {1.00, "div_start", id="content_section", open="true"}
page_name = {1.1, "readonly_text"}
title = {1.2, "text_field"}
breadcrumb = {1.3, "text_field"}
content = {1.4, "textarea", editor_modules = {"resizeable"}, rows=15, no_label=true}
content_section_end = {1.5, "div_end"}
-------------------------- advanced fields -------------
advanced_section = {2.0, "div_start", id="advanced_section"}
category = {2.01, "select", options = {"Foo", "Bar"}}
prototype = {2.02, "text_field"}
redirect_destination = {2.022, "text_field"}
permissions = {2.03, "textarea", rows=3, editor_modules = {"resizeable", "validatelua"}}
actions = {2.04, "textarea", rows=3, editor_modules = {"resizeable", "validatelua"}}
config = {2.05, "textarea", rows=3, editor_modules = {"resizeable", "validatelua"}}
markup_module = {2.0501, "text_field"}
html_meta_keywords = {2.051, "text_field"}
html_meta_description = {2.052, "text_field"}
save_hook = {2.053, "text_field"}
advanced_section_end = {2.06, "div_end"}
html_section = {2.100, "div_start", id="html_section", state="open"}
html_main = {2.101, "textarea", rows=3, editor_modules = {"resizeable"}}
html_head = {2.102, "textarea", rows=3, editor_modules = {"resizeable"}}
html_body = {2.103, "textarea", rows=3, editor_modules = {"resizeable"}}
html_header = {2.104, "textarea", rows=3, editor_modules = {"resizeable"}}
html_menu = {2.105, "textarea", rows=3, editor_modules = {"resizeable"}}
html_logo = {2.106, "textarea", rows=3, editor_modules = {"resizeable"}}
html_search = {2.107, "textarea", rows=3, editor_modules = {"resizeable"}}
html_page = {2.108, "textarea", rows=3, editor_modules = {"resizeable"}}
html_content = {2.108, "textarea", rows=3, editor_modules = {"resizeable"}}
html_sidebar = {2.109, "textarea", rows=3, editor_modules = {"resizeable"}}
html_footer = {2.110, "textarea", rows=3, editor_modules = {"resizeable"}}
xssfilter_allowed_tags = {2.111, "textarea", rows=3, editor_modules = {"resizeable"}}
html_section_end = {2.112, "div_end"}
http_section = {2.201, "div_start", id="http_section", state="open"}
http_cache_control = {2.202, "textarea", rows=3, editor_modules = {"resizeable"}}
http_expires = {2.203, "textarea", rows=3, editor_modules = {"resizeable"}}
http_section_end = {2.209, "div_end"}
guru_section = {2.30, "div_start", id="guru_section"}
templates = {2.31, "text_field"}
translations = {2.32, "text_field"}
fields = {2.33, "textarea", rows=3, editor_modules = {"resizeable", "validatelua"}}
edit_ui = {2.34, "textarea", rows=3, editor_modules = {"resizeable", "validatelua"}}
admin_edit_ui = {2.35, "textarea", rows=3, editor_modules = {"resizeable", "validatelua"}}
guru_section_end = {2.36, "div_end"}
--- info about the edit --------------------------------
edit_info_section = {3.00, "div_start", id="edit_info_section", open="true"}
minor = {3.1, "checkbox", value=false}
summary = {3.2, "textarea", rows=3, editor_modules = {"resizeable"}}
edit_info_section_end = {3.3, "div_end"}
]],
content=[===[
This is the root proto-page. The content of this form is ignored, but
it's fields are inherited by all other pages. E.g., if you were to set
actions = [[show_content = "wiki.show_content_as_lua_code"]]
on this page, _all_ pages would default to displaying their content as
if it was Lua code. (Note that any page that sets `show_content` to
its own value, and any pages that inherit from it, will continue to
work as they did before.) I.e., this page only affects the default
values. Handle with care.
]===],
permissions=[[
deny(all_users, all_actions)
allow(all_users, show) -- show, show_content, cancel
allow(all_users, edit_and_save) -- edit, save, preview
allow(all_users, "post") --needed for login
allow(all_users, "login")
allow(all_users, history_and_diff)
allow(all_users, "rss")
allow(all_users, "xml")
--deny(Anonymous, edit_and_save)
allow(Admin, "reload")
allow(Admin, "configure")
]]
}
NODE.html_main = [==[
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
$head
</head>
<body>
$body
<script type="text/javascript" src="$js_base_url{}sputnik/scripts.js"></script>
$do_javascript_links[[<script type="text/javascript" src="$href"></script>
]]
$do_javascript_snippets[=[
<script type="text/javascript">/* <![CDATA[ */ $snippet /* ]]> */</script>
]=]
</body>
</html>
]==]
NODE.html_head = [==[
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="keywords" content="$html_meta_keywords"/>
<meta name="description" content="$html_meta_description"/>
<title>$site_title: $title</title>
<link type="text/css" rel="stylesheet" href="$css_base_url{}sputnik/style.css" media="all"/>
$do_css_links[[<link type="text/css" rel="stylesheet" href="$href" media="$media"/>
]]$do_css_snippets[[
<style type="text/css" media="$media">$snippet</style>
]]
<link rel="shortcut icon" href="$favicon_url"/>
<link rel="alternate" type="application/rss+xml" title="_(RECENT_EDITS_TO_SITE)" $site_rss_link/>
<link rel="alternate" type="application/rss+xml" title="_(RECENT_EDITS_TO_NODE)" $node_rss_link/>
$if_no_index[[<meta name="ROBOTS" content="NOINDEX, NOFOLLOW"/>
]]]==]
NODE.html_menu = [==[
<ul id='menu' class="level1">$do_nav_sections[=[
<li class='$class level1' id='$id'>
<a title="$accessibility_title" $link>$title</a>
<ul class='$class level2'>$subsections[[
<li class='$class level2'><a title="$accessibility_title" $link>$title</a></li>]]
<li style="display:none"> </li>
</ul>
</li>]=]
</ul>
]==]
NODE.html_search = [==[
<form action="$base_url" class="search">
<input class="hidden" type="hidden" name="p" value="sputnik/search"/>
<input class="search_box" type="text" name="q" size="16"
title="_(TOOLTIP_FOR_SEARCH_BOX)" value="$search_box_content"/>
<input class="search_button" type="image" src="$icon_base_url{}icons/search.png" alt="_(BUTTON)"/>
</form>
]==]
NODE.html_page = [==[
<div id="breadcrumbs">
<ul>
$do_breadcrumb[[
<li class="first"><a $link>$title</a></li>]],[[
<li class="follow"><a $link>▹ $title</a></li>]]
</ul>
<span class="toolbar">
$do_toolbar[[
$if_icon[====[<a $link title="$title"><img src="$icon_base_url{}$icon" alt="_(BUTTON)"/></a>]====]
$if_text[====[<a $link>$title</a>]====]
]]
</span>
</div>
<div class="title">$if_title_icon[[
<img src="$title_icon" class="title_icon" alt="type icon ($title_icon)"/>]]
<a name="title" title="_(CURRENT_PAGE)" $show_link >$title</a> $if_old_version[[<span class="from_version">($version)</span>]]
</div>
<div class='content'>
$do_messages[[<p class="$class">$message</p>]]
$content
</div>
]==]
NODE.html_content = [==[
Not used by default.
]==]
NODE.html_logo = [==[
<a class="logo" href="$home_page_url">
<img src="$logo_url" alt="_(LOGO)" />
</a>
]==]
NODE.html_header = [===[
<div id="login" style="vertical-align: middle;">
<!--login and search (in the upper right corner) -->
$if_search[[$search]]<br/><br/>
$if_logged_in[[<span style="border: 1px solid read;">_(HI_USER)
<a title="_(LOGOUT)" $logout_link><img style="vertical-align: text-bottom" src="$icon_base_url{}icons/logout.png" alt="_(BUTTON)"/></a></span>]]
$if_not_logged_in[[<a class="login_link" $login_link>_(LOGIN)</a> _(OR) <a $register_link>_(REGISTER)</a>]]
</div>
<div id="logo">
$logo
</div>
<div id="menu_bar">
$menu<!--br/><br/-->
</div>
]===]
NODE.html_body = [===[
<div id='doc3' class='yui-t0'>
<div id="login_form" class="popup_form" style="display: none"></div>
<div id='hd'>
$header
</div>
<div id='bd'>
<div id="yui-main" $if_old_version[[style='background-color:#ddd;']]>
<div class="yui-b" id='page'>
$page
</div>
</div>
<div class="yui-b" id="sidebar">
$sidebar
</div>
</div> <!--#bd-->
<div id='ft'>
$footer </div>
</div> <!--#docN-->
<br/>
]===]
NODE.html_sidebar = [==[
]==]
NODE.html_footer = [===[
_(POWERED_BY_SPUTNIK) | <a style="font-size: .7em" href="http://validator.w3.org/check?uri=referer">XHTML 1.1</a>
]===]
NODE.html_meta_keywords = " "
NODE.html_meta_description = " "
NODE.child_defaults = [[
--talk = [==[
--title = "Discussion of $id"
--prototype ="@Discussion"
--]==]
]]
|
local kong = kong
local find = string.find
local fmt = string.format
local CONTENT_TYPE = "Content-Type"
local ACCEPT = "Accept"
local TYPE_JSON = "application/json"
local TYPE_GRPC = "application/grpc"
local TYPE_HTML = "text/html"
local TYPE_XML = "application/xml"
local JSON_TEMPLATE = [[
{
"message": "%s"
}
]]
local HTML_TEMPLATE = [[
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Kong Error</title>
</head>
<body>
<h1>Kong Error</h1>
<p>%s.</p>
</body>
</html>
]]
local XML_TEMPLATE = [[
<?xml version="1.0" encoding="UTF-8"?>
<error>
<message>%s</message>
</error>
]]
local PLAIN_TEMPLATE = "%s\n"
local BODIES = {
s400 = "Bad request",
s404 = "Not found",
s408 = "Request timeout",
s411 = "Length required",
s412 = "Precondition failed",
s413 = "Payload too large",
s414 = "URI too long",
s417 = "Expectation failed",
s494 = "Request header or cookie too large",
s500 = "An unexpected error occurred",
s502 = "An invalid response was received from the upstream server",
s503 = "The upstream server is currently unavailable",
s504 = "The upstream server is timing out",
default = "The upstream server responded with %d"
}
return function(ctx)
local accept_header = kong.request.get_header(ACCEPT)
if accept_header == nil then
accept_header = kong.request.get_header(CONTENT_TYPE)
if accept_header == nil then
accept_header = kong.configuration.error_default_type
end
end
local status = kong.response.get_status()
local message = BODIES["s" .. status] or fmt(BODIES.default, status)
local headers
if find(accept_header, TYPE_JSON, nil, true) == 1 then
message = fmt(JSON_TEMPLATE, message)
headers = {
[CONTENT_TYPE] = "application/json; charset=utf-8"
}
elseif find(accept_header, TYPE_GRPC, nil, true) == 1 then
message = { message = message }
elseif find(accept_header, TYPE_HTML, nil, true) == 1 then
message = fmt(HTML_TEMPLATE, message)
headers = {
[CONTENT_TYPE] = "text/html; charset=utf-8"
}
elseif find(accept_header, TYPE_XML, nil, true) == 1 then
message = fmt(XML_TEMPLATE, message)
headers = {
[CONTENT_TYPE] = "application/xml; charset=utf-8"
}
else
message = fmt(PLAIN_TEMPLATE, message)
headers = {
[CONTENT_TYPE] = "text/plain; charset=utf-8"
}
end
-- Reset relevant context values
kong.ctx.core.buffered_proxying = nil
kong.ctx.core.response_body = nil
if ctx then
ctx.delay_response = nil
ctx.delayed_response = nil
ctx.delayed_response_callback = nil
end
return kong.response.exit(status, message, headers)
end
|
local math = require_relative("math")
local Math = {}
Math.min = math.min
Math.max = math.max
Math.sqrt = math.sqrt
Math.modf = math.modf
function Math.clamp(n, min, max)
return Math.min(Math.max(n, min), max)
end
return Math
|
--------------------------------
-- @module EaseBounceOut
-- @extend ActionEase
-- @parent_module cc
---@class cc.EaseBounceOut:cc.ActionEase
local EaseBounceOut = {}
cc.EaseBounceOut = EaseBounceOut
--------------------------------
---
---@param action cc.ActionInterval
---@return cc.EaseBounceOut
function EaseBounceOut:create(action)
end
--------------------------------
---
---@return cc.EaseBounceOut
function EaseBounceOut:clone()
end
--------------------------------
---
---@param time number
---@return cc.EaseBounceOut
function EaseBounceOut:update(time)
end
--------------------------------
---
---@return cc.ActionEase
function EaseBounceOut:reverse()
end
--------------------------------
---
---@return cc.EaseBounceOut
function EaseBounceOut:EaseBounceOut()
end
return nil
|
object_mobile_hologram_moncal_male = object_mobile_hologram_shared_moncal_male:new {
}
ObjectTemplates:addTemplate(object_mobile_hologram_moncal_male, "object/mobile/hologram/moncal_male.iff")
|
class 'RacingCheckpoint'
function RacingCheckpoint:__init(number, transform, start, finish, blueprint)
self.number = number
self.transform = transform
self.start = start
self.finish = finish
self.effect = nil
if SharedUtils:IsClientModule() then
self.effect = EntityManager:CreateEntity(blueprint, self.transform)
self.effect:Init(Realm.Realm_Client, true)
end
end
function RacingCheckpoint:SetActive(active)
if not SharedUtils:IsClientModule() then
return
end
if self.effect ~= nil then
if active then
self.effect:FireEvent('Start')
else
self.effect:FireEvent('Stop')
end
end
end
|
--------------------------------
-- @module TransitionFlipX
-- @extend TransitionSceneOriented
-- @parent_module cc
---@class cc.TransitionFlipX:cc.TransitionSceneOriented
local TransitionFlipX = {}
cc.TransitionFlipX = TransitionFlipX
--------------------------------
--- Creates a transition with duration and incoming scene.<br>
-- param t Duration time, in seconds.<br>
-- param s A given scene.<br>
-- return A autoreleased TransitionFlipX object.
---@param t number
---@param s cc.Scene
---@param o number
---@return cc.TransitionFlipX
---@overload fun(self:cc.TransitionFlipX, t:number, s:cc.Scene):cc.TransitionFlipX
function TransitionFlipX:create(t, s, o)
end
--------------------------------
---
---@return cc.TransitionFlipX
function TransitionFlipX:TransitionFlipX()
end
return nil
|
#!/usr/bin/env lua
function myfunction ()
print(debug.traceback("Stack trace"))
print(debug.getinfo(1))
print("Stack trace end")
return 10
end
myfunction ()
print(debug.getinfo(1))
function newCounter ()
local n = 0
local k = 0
return function ()
k = n
n = n + 1
return n
end
end
counter = newCounter ()
print(counter())
print(counter())
local i = 1
repeat
name, val = debug.getupvalue(counter, i)
if name then
print ("index", i, name, "=", val)
if(name == "n") then
debug.setupvalue (counter,2,10)
end
i = i + 1
end -- if
until not name
print(counter())
|
--Generated By protoc-gen-lua Do not Edit
local protobuf = require "protobuf.protobuf"
local PBVector3_pb = require("Protol.PBVector3_pb")
module('Protol.SyncPlayerPosReq_pb')
SYNCPLAYERPOSREQ = protobuf.Descriptor();
SYNCPLAYERPOSREQ_PLAYERID_FIELD = protobuf.FieldDescriptor();
SYNCPLAYERPOSREQ_POS_FIELD = protobuf.FieldDescriptor();
SYNCPLAYERPOSREQ_PLAYERID_FIELD.name = "playerId"
SYNCPLAYERPOSREQ_PLAYERID_FIELD.full_name = ".pb.SyncPlayerPosReq.playerId"
SYNCPLAYERPOSREQ_PLAYERID_FIELD.number = 1
SYNCPLAYERPOSREQ_PLAYERID_FIELD.index = 0
SYNCPLAYERPOSREQ_PLAYERID_FIELD.label = 2
SYNCPLAYERPOSREQ_PLAYERID_FIELD.has_default_value = false
SYNCPLAYERPOSREQ_PLAYERID_FIELD.default_value = 0
SYNCPLAYERPOSREQ_PLAYERID_FIELD.type = 3
SYNCPLAYERPOSREQ_PLAYERID_FIELD.cpp_type = 2
SYNCPLAYERPOSREQ_POS_FIELD.name = "pos"
SYNCPLAYERPOSREQ_POS_FIELD.full_name = ".pb.SyncPlayerPosReq.pos"
SYNCPLAYERPOSREQ_POS_FIELD.number = 2
SYNCPLAYERPOSREQ_POS_FIELD.index = 1
SYNCPLAYERPOSREQ_POS_FIELD.label = 2
SYNCPLAYERPOSREQ_POS_FIELD.has_default_value = false
SYNCPLAYERPOSREQ_POS_FIELD.default_value = nil
SYNCPLAYERPOSREQ_POS_FIELD.message_type = PBVector3_pb.PBVECTOR3
SYNCPLAYERPOSREQ_POS_FIELD.type = 11
SYNCPLAYERPOSREQ_POS_FIELD.cpp_type = 10
SYNCPLAYERPOSREQ.name = "SyncPlayerPosReq"
SYNCPLAYERPOSREQ.full_name = ".pb.SyncPlayerPosReq"
SYNCPLAYERPOSREQ.nested_types = {}
SYNCPLAYERPOSREQ.enum_types = {}
SYNCPLAYERPOSREQ.fields = {SYNCPLAYERPOSREQ_PLAYERID_FIELD, SYNCPLAYERPOSREQ_POS_FIELD}
SYNCPLAYERPOSREQ.is_extendable = false
SYNCPLAYERPOSREQ.extensions = {}
SyncPlayerPosReq = protobuf.Message(SYNCPLAYERPOSREQ)
|
--[[
Copyright (c) 2019, Vsevolod Stakhov <vsevolod@highsecure.ru>
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.
]]--
--[[[
-- @module lua_content/pdf
-- This module contains some heuristics for PDF files
--]]
local rspamd_trie = require "rspamd_trie"
local rspamd_util = require "rspamd_util"
local rspamd_text = require "rspamd_text"
local rspamd_url = require "rspamd_url"
local rspamd_logger = require "rspamd_logger"
local bit = require "bit"
local N = "lua_content"
local lua_util = require "lua_util"
local rspamd_regexp = require "rspamd_regexp"
local lpeg = require "lpeg"
local pdf_patterns = {
trailer = {
patterns = {
[[\ntrailer\r?\n]]
}
},
suspicious = {
patterns = {
[[netsh\s]],
[[echo\s]],
[[\/[A-Za-z]*#\d\d(?:[#A-Za-z<>/\s])]], -- Hex encode obfuscation
}
},
start_object = {
patterns = {
[=[[\r\n\0]\s*\d+\s+\d+\s+obj[\s<]]=]
}
},
end_object = {
patterns = {
[=[endobj[\r\n]]=]
}
},
start_stream = {
patterns = {
[=[>\s*stream[\r\n]]=],
}
},
end_stream = {
patterns = {
[=[endstream[\r\n]]=]
}
}
}
local pdf_text_patterns = {
start = {
patterns = {
[[\sBT\s]]
}
},
stop = {
patterns = {
[[\sET\b]]
}
}
}
local pdf_cmap_patterns = {
start = {
patterns = {
[[\d\s+beginbfchar\s]],
[[\d\s+beginbfrange\s]]
}
},
stop = {
patterns = {
[[\sendbfrange\b]],
[[\sendbchar\b]]
}
}
}
-- index[n] ->
-- t[1] - pattern,
-- t[2] - key in patterns table,
-- t[3] - value in patterns table
-- t[4] - local pattern index
local pdf_indexes = {}
local pdf_text_indexes = {}
local pdf_cmap_indexes = {}
local pdf_trie
local pdf_text_trie
local pdf_cmap_trie
local exports = {}
local config = {
max_extraction_size = 512 * 1024,
max_processing_size = 32 * 1024,
text_extraction = false, -- NYI feature
url_extraction = true,
enabled = true,
js_fuzzy = true, -- Generate fuzzy hashes from PDF javascripts
min_js_fuzzy = 32, -- Minimum size of js to be considered as a fuzzy
openaction_fuzzy_only = false, -- Generate fuzzy from all scripts
}
-- Used to process patterns found in PDF
-- positions for functional processors should be a iter/table from trie matcher in form
---- [{n1, pat_idx1}, ... {nn, pat_idxn}] where
---- pat_idxn is pattern index and n1 ... nn are match positions
local processors = {}
-- PDF objects outer grammar in LPEG style (performing table captures)
local pdf_outer_grammar
local pdf_text_grammar
-- Used to match objects
local object_re = rspamd_regexp.create_cached([=[/(\d+)\s+(\d+)\s+obj\s*/]=])
local function config_module()
local opts = rspamd_config:get_all_opt('lua_content')
if opts and opts.pdf then
config = lua_util.override_defaults(config, opts.pdf)
end
end
local function compile_tries()
local default_compile_flags = bit.bor(rspamd_trie.flags.re,
rspamd_trie.flags.dot_all,
rspamd_trie.flags.no_start)
local function compile_pats(patterns, indexes, compile_flags)
local strs = {}
for what,data in pairs(patterns) do
for i,pat in ipairs(data.patterns) do
strs[#strs + 1] = pat
indexes[#indexes + 1] = {what, data, pat, i}
end
end
return rspamd_trie.create(strs, compile_flags or default_compile_flags)
end
if not pdf_trie then
pdf_trie = compile_pats(pdf_patterns, pdf_indexes)
end
if not pdf_text_trie then
pdf_text_trie = compile_pats(pdf_text_patterns, pdf_text_indexes)
end
if not pdf_cmap_trie then
pdf_cmap_trie = compile_pats(pdf_cmap_patterns, pdf_cmap_indexes)
end
end
-- Returns a table with generic grammar elements for PDF
local function generic_grammar_elts()
local P = lpeg.P
local R = lpeg.R
local S = lpeg.S
local V = lpeg.V
local C = lpeg.C
local D = R'09' -- Digits
local grammar_elts = {}
-- Helper functions
local function pdf_hexstring_unescape(s)
local function ue(cc)
return string.char(tonumber(cc, 16))
end
if #s % 2 == 0 then
-- Sane hex string
return s:gsub('..', ue)
end
-- WTF hex string
-- Append '0' to it and unescape...
return s:sub(1, #s - 1):gsub('..' , ue) .. (s:sub(#s) .. '0'):gsub('..' , ue)
end
local function pdf_string_unescape(s)
local function ue_single(cc)
if cc == '\\r' then
return '\r'
elseif cc == '\\n' then
return '\n'
else
return cc:gsub(2, 2)
end
end
-- simple unescape \char
s = s:gsub('\\[^%d]', ue_single)
-- unescape octal
local function ue_octal(cc)
-- Replace unknown stuff with '?'
return string.char(tonumber(cc:sub(2), 8) or 63)
end
s = s:gsub('\\%d%d?%d?', ue_octal)
return s
end
local function pdf_id_unescape(s)
return (s:gsub('#%d%d', function (cc)
return string.char(tonumber(cc:sub(2), 16))
end))
end
local delim = S'()<>[]{}/%'
grammar_elts.ws = S'\0 \r\n\t\f'
local hex = R'af' + R'AF' + D
-- Comments.
local eol = P'\r\n' + '\n'
local line = (1 - S'\r\n\f')^0 * eol^-1
grammar_elts.comment = P'%' * line
-- Numbers.
local sign = S'+-'^-1
local decimal = D^1
local float = D^1 * P'.' * D^0 + P'.' * D^1
grammar_elts.number = C(sign * (float + decimal)) / tonumber
-- String
grammar_elts.str = P{ "(" * C(((1 - S"()\\") + (P '\\' * 1) + V(1))^0) / pdf_string_unescape * ")" }
grammar_elts.hexstr = P{"<" * C(hex^0) / pdf_hexstring_unescape * ">"}
-- Identifier
grammar_elts.id = P{'/' * C((1-(delim + grammar_elts.ws))^1) / pdf_id_unescape}
-- Booleans (who care about them?)
grammar_elts.boolean = C(P("true") + P("false"))
-- Stupid references
grammar_elts.ref = lpeg.Ct{lpeg.Cc("%REF%") * C(D^1) * " " * C(D^1) * " " * "R"}
return grammar_elts
end
-- Generates a grammar to parse outer elements (external objects in PDF notation)
local function gen_outer_grammar()
local V = lpeg.V
local gen = generic_grammar_elts()
return lpeg.P{
"EXPR";
EXPR = gen.ws^0 * V("ELT")^0 * gen.ws^0,
ELT = V("ARRAY") + V("DICT") + V("ATOM"),
ATOM = gen.ws^0 * (gen.comment + gen.boolean + gen.ref +
gen.number + V("STRING") + gen.id) * gen.ws^0,
DICT = "<<" * gen.ws^0 * lpeg.Cf(lpeg.Ct("") * V("KV_PAIR")^0, rawset) * gen.ws^0 * ">>",
KV_PAIR = lpeg.Cg(gen.id * gen.ws^0 * V("ELT") * gen.ws^0),
ARRAY = "[" * gen.ws^0 * lpeg.Ct(V("ELT")^0) * gen.ws^0 * "]",
STRING = lpeg.P{gen.str + gen.hexstr},
}
end
-- Graphic state in PDF
local function gen_graphics_unary()
local P = lpeg.P
local S = lpeg.S
return P("q") + P("Q") + P("h")
+ S("WSsFfBb") * P("*")^0 + P("n")
end
local function gen_graphics_binary()
local P = lpeg.P
local S = lpeg.S
return S("gGwJjMi") +
P("M") + P("ri") + P("gs") +
P("CS") + P("cs") + P("sh")
end
local function gen_graphics_ternary()
local P = lpeg.P
local S = lpeg.S
return P("d") + P("m") + S("lm")
end
local function gen_graphics_nary()
local P = lpeg.P
local S = lpeg.S
return P("SC") + P("sc") + P("SCN") + P("scn") + P("k") + P("K") + P("re") + S("cvy") +
P("RG") + P("rg")
end
-- Generates a grammar to parse text blocks (between BT and ET)
local function gen_text_grammar()
local V = lpeg.V
local P = lpeg.P
local C = lpeg.C
local gen = generic_grammar_elts()
local empty = ""
local unary_ops = C("T*") / "\n" +
C(gen_graphics_unary()) / empty
local binary_ops = P("Tc") + P("Tw") + P("Tz") + P("TL") + P("Tr") + P("Ts") +
gen_graphics_binary()
local ternary_ops = P("TD") + P("Td") + gen_graphics_ternary()
local nary_op = P("Tm") + gen_graphics_nary()
local text_binary_op = P("Tj") + P("TJ") + P("'")
local text_quote_op = P('"')
local font_op = P("Tf")
return lpeg.P{
"EXPR";
EXPR = gen.ws^0 * lpeg.Ct(V("COMMAND")^0),
COMMAND = (V("UNARY") + V("BINARY") + V("TERNARY") + V("NARY") + V("TEXT") +
V("FONT") + gen.comment) * gen.ws^0,
UNARY = unary_ops,
BINARY = V("ARG") / empty * gen.ws^1 * binary_ops,
TERNARY = V("ARG") / empty * gen.ws^1 * V("ARG") / empty * gen.ws^1 * ternary_ops,
NARY = (gen.number / 0 * gen.ws^1)^1 * (gen.id / empty * gen.ws^0)^-1 * nary_op,
ARG = V("ARRAY") + V("DICT") + V("ATOM"),
ATOM = (gen.comment + gen.boolean + gen.ref +
gen.number + V("STRING") + gen.id),
DICT = "<<" * gen.ws^0 * lpeg.Cf(lpeg.Ct("") * V("KV_PAIR")^0, rawset) * gen.ws^0 * ">>",
KV_PAIR = lpeg.Cg(gen.id * gen.ws^0 * V("ARG") * gen.ws^0),
ARRAY = "[" * gen.ws^0 * lpeg.Ct(V("ARG")^0) * gen.ws^0 * "]",
STRING = lpeg.P{gen.str + gen.hexstr},
TEXT = (V("TEXT_ARG") * gen.ws^1 * text_binary_op) +
(V("ARG") / 0 * gen.ws^1 * V("ARG") / 0 * gen.ws^1 * V("TEXT_ARG") * gen.ws^1 * text_quote_op),
FONT = (V("FONT_ARG") * gen.ws^1 * (gen.number / 0) * gen.ws^1 * font_op),
FONT_ARG = lpeg.Ct(lpeg.Cc("%font%") * gen.id),
TEXT_ARG = lpeg.Ct(V("STRING")) + V("TEXT_ARRAY"),
TEXT_ARRAY = "[" *
lpeg.Ct(((gen.ws^0 * (gen.ws^0 * (gen.number / 0)^0 * gen.ws^0 * (gen.str + gen.hexstr)))^1)) * gen.ws^0 * "]",
}
end
-- Call immediately on require
compile_tries()
config_module()
pdf_outer_grammar = gen_outer_grammar()
pdf_text_grammar = gen_text_grammar()
local function extract_text_data(specific)
return nil -- NYI
end
-- Generates index for major/minor pair
local function obj_ref(major, minor)
return major * 10.0 + 1.0 / (minor + 1.0)
end
-- Return indirect object reference (if needed)
local function maybe_dereference_object(elt, pdf, task)
if type(elt) == 'table' and elt[1] == '%REF%' then
local ref = obj_ref(elt[2], elt[3])
if pdf.ref[ref] then
-- No recursion!
return pdf.ref[ref]
else
lua_util.debugm(N, task, 'cannot dereference %s:%s -> %s',
elt[2], elt[3], obj_ref(elt[2], elt[3]))
return nil
end
end
return elt
end
-- Apply PDF stream filter
local function apply_pdf_filter(input, filt)
if filt == 'FlateDecode' then
return rspamd_util.inflate(input, config.max_extraction_size)
end
return nil
end
-- Conditionally apply a pipeline of stream filters and return uncompressed data
local function maybe_apply_filter(dict, data)
local uncompressed = data
if dict.Filter then
local filt = dict.Filter
if type(filt) == 'string' then
filt = {filt}
end
for _,f in ipairs(filt) do
uncompressed = apply_pdf_filter(uncompressed, f)
if not uncompressed then break end
end
end
return uncompressed
end
-- Conditionally extract stream data from object and attach it as obj.uncompressed
local function maybe_extract_object_stream(obj, pdf, task)
if pdf.encrypted then
-- TODO add decryption some day
return nil
end
local dict = obj.dict
if dict.Length then
local len = math.min(obj.stream.len,
tonumber(maybe_dereference_object(dict.Length, pdf, task)) or 0)
local real_stream = obj.stream.data:span(1, len)
local uncompressed = maybe_apply_filter(dict, real_stream)
if uncompressed then
obj.uncompressed = uncompressed
lua_util.debugm(N, task, 'extracted object %s:%s: (%s -> %s)',
obj.major, obj.minor, len, uncompressed:len())
return obj.uncompressed
else
lua_util.debugm(N, task, 'cannot extract object %s:%s; len = %s; filter = %s',
obj.major, obj.minor, len, dict.Filter)
end
end
end
local function parse_object_grammar(obj, task, pdf)
-- Parse grammar
local obj_dict_span
if obj.stream then
obj_dict_span = obj.data:span(1, obj.stream.start - obj.start)
else
obj_dict_span = obj.data
end
if obj_dict_span:len() < config.max_processing_size then
local ret,obj_or_err = pcall(pdf_outer_grammar.match, pdf_outer_grammar, obj_dict_span)
if ret then
if obj.stream then
obj.dict = obj_or_err
lua_util.debugm(N, task, 'stream object %s:%s is parsed to: %s',
obj.major, obj.minor, obj_or_err)
else
-- Direct object
if type(obj_or_err) == 'table' then
obj.dict = obj_or_err
obj.uncompressed = obj_or_err
lua_util.debugm(N, task, 'direct object %s:%s is parsed to: %s',
obj.major, obj.minor, obj_or_err)
pdf.ref[obj_ref(obj.major, obj.minor)] = obj
else
pdf.ref[obj_ref(obj.major, obj.minor)] = obj_or_err
obj.dict = {}
obj.uncompressed = obj_or_err
end
end
else
lua_util.debugm(N, task, 'object %s:%s cannot be parsed: %s',
obj.major, obj.minor, obj_or_err)
end
else
lua_util.debugm(N, task, 'object %s:%s cannot be parsed: too large %s',
obj.major, obj.minor, obj_dict_span:len())
end
end
-- Extracts font data and process /ToUnicode mappings
-- NYI in fact as cmap is ridiculously stupid and complicated
local function process_font(task, pdf, font, fname)
local dict = font
if font.dict then
dict = font.dict
end
if type(dict) == 'table' and dict.ToUnicode then
local cmap = maybe_dereference_object(dict.ToUnicode, pdf, task)
if cmap and cmap.dict then
maybe_extract_object_stream(cmap, pdf, task)
lua_util.debugm(N, task, 'found cmap for font %s: %s',
fname, cmap.uncompressed)
end
end
end
-- Forward declaration
local process_dict
-- This function processes javascript string and returns JS hash and JS rspamd_text
local function process_javascript(task, pdf, js)
local rspamd_cryptobox_hash = require "rspamd_cryptobox_hash"
if type(js) == 'string' then
js = rspamd_text.fromstring(js):oneline()
elseif type(js) == 'userdata' then
js = js:oneline()
else
return nil
end
local hash = rspamd_cryptobox_hash.create(js)
local bin_hash = hash:bin()
if not pdf.scripts then
pdf.scripts = {}
end
if pdf.scripts[bin_hash] then
-- Duplicate
return pdf.scripts[bin_hash]
end
local njs = {
data = js,
hash = rspamd_util.encode_base32(bin_hash),
bin_hash = bin_hash,
}
pdf.scripts[bin_hash] = njs
return njs
end
-- Extract interesting stuff from /Action, e.g. javascript
local function process_action(task, pdf, obj)
if not (obj.js or obj.launch) and (obj.dict and obj.dict.JS) then
local js = maybe_dereference_object(obj.dict.JS, pdf, task)
if js then
if type(js) == 'table' then
local extracted_js = maybe_extract_object_stream(js, pdf, task)
if not extracted_js then
lua_util.debugm(N, task, 'invalid type for javascript from %s:%s: %s',
obj.major, obj.minor, js)
else
js = extracted_js
end
end
js = process_javascript(task, pdf, js)
if js then
obj.js = js
lua_util.debugm(N, task, 'extracted javascript from %s:%s: %s',
obj.major, obj.minor, obj.js.data)
else
lua_util.debugm(N, task, 'invalid type for javascript from %s:%s: %s',
obj.major, obj.minor, js)
end
elseif obj.dict.F then
local launch = maybe_dereference_object(obj.dict.F, pdf, task)
if launch then
if type(launch) == 'string' then
obj.launch = rspamd_text.fromstring(launch):exclude_chars('%n%c')
lua_util.debugm(N, task, 'extracted launch from %s:%s: %s',
obj.major, obj.minor, obj.launch)
elseif type(launch) == 'userdata' then
obj.launch = launch:exclude_chars('%n%c')
lua_util.debugm(N, task, 'extracted launch from %s:%s: %s',
obj.major, obj.minor, obj.launch)
else
lua_util.debugm(N, task, 'invalid type for launch from %s:%s: %s',
obj.major, obj.minor, launch)
end
end
else
lua_util.debugm(N, task, 'no JS attribute in action %s:%s',
obj.major, obj.minor)
end
end
end
-- Extract interesting stuff from /Catalog, e.g. javascript in /OpenAction
local function process_catalog(task, pdf, obj)
if obj.dict then
if obj.dict.OpenAction then
local action = maybe_dereference_object(obj.dict.OpenAction, pdf, task)
if action and type(action) == 'table' then
-- This also processes action js (if not already processed)
process_dict(task, pdf, action, action.dict)
if action.js then
lua_util.debugm(N, task, 'found openaction JS in %s:%s: %s',
obj.major, obj.minor, action.js)
pdf.openaction = action.js
elseif action.launch then
lua_util.debugm(N, task, 'found openaction launch in %s:%s: %s',
obj.major, obj.minor, action.launch)
pdf.launch = action.launch
else
lua_util.debugm(N, task, 'no JS in openaction %s:%s: %s',
obj.major, obj.minor, action)
end
else
lua_util.debugm(N, task, 'cannot find openaction %s:%s: %s -> %s',
obj.major, obj.minor, obj.dict.OpenAction, action)
end
else
lua_util.debugm(N, task, 'no openaction in catalog %s:%s',
obj.major, obj.minor)
end
end
end
local function process_xref(task, pdf, obj)
if obj.dict then
if obj.dict.Encrypt then
local encrypt = maybe_dereference_object(obj.dict.Encrypt, pdf, task)
lua_util.debugm(N, task, 'found encrypt: %s in xref object %s:%s',
encrypt, obj.major, obj.minor)
pdf.encrypted = true
end
end
end
process_dict = function(task, pdf, obj, dict)
if not obj.type and type(dict) == 'table' then
if dict.Type and type(dict.Type) == 'string' then
-- Common stuff
obj.type = dict.Type
end
if not obj.type then
if obj.dict.S and obj.dict.JS then
obj.type = 'Javascript'
lua_util.debugm(N, task, 'implicit type for Javascript object %s:%s',
obj.major, obj.minor)
else
lua_util.debugm(N, task, 'no type for %s:%s',
obj.major, obj.minor)
return
end
end
lua_util.debugm(N, task, 'processed stream dictionary for object %s:%s -> %s',
obj.major, obj.minor, obj.type)
local contents = dict.Contents
if contents and type(contents) == 'table' then
if contents[1] == '%REF%' then
-- Single reference
contents = {contents}
end
obj.contents = {}
for _,c in ipairs(contents) do
local cobj = maybe_dereference_object(c, pdf, task)
if cobj and type(cobj) == 'table' then
obj.contents[#obj.contents + 1] = cobj
cobj.parent = obj
cobj.type = 'content'
end
end
lua_util.debugm(N, task, 'found content objects for %s:%s -> %s',
obj.major, obj.minor, #obj.contents)
end
local resources = dict.Resources
if resources and type(resources) == 'table' then
obj.resources = maybe_dereference_object(resources, pdf, task)
if type(obj.resources) ~= 'table' then
rspamd_logger.infox(task, 'cannot parse resources from pdf: %s returned by grammar',
obj.resources)
obj.resources = {}
elseif obj.resources.dict then
obj.resources = obj.resources.dict
end
else
-- Fucking pdf: we need to inherit from parent
resources = {}
if dict.Parent then
local parent = maybe_dereference_object(dict.Parent, pdf, task)
if parent and type(parent) == 'table' and parent.dict then
if parent.resources then
lua_util.debugm(N, task, 'propagated resources from %s:%s to %s:%s',
parent.major, parent.minor, obj.major, obj.minor)
resources = parent.resources
end
end
end
obj.resources = resources
end
local fonts = obj.resources.Font
if fonts and type(fonts) == 'table' then
obj.fonts = {}
for k,v in pairs(fonts) do
obj.fonts[k] = maybe_dereference_object(v, pdf, task)
if obj.fonts[k] then
local font = obj.fonts[k]
if config.text_extraction then
process_font(task, pdf, font, k)
lua_util.debugm(N, task, 'found font "%s" for object %s:%s -> %s',
k, obj.major, obj.minor, font)
end
end
end
end
lua_util.debugm(N, task, 'found resources for object %s:%s (%s): %s',
obj.major, obj.minor, obj.type, obj.resources)
if obj.type == 'Action' then
process_action(task, pdf, obj)
elseif obj.type == 'Catalog' then
process_catalog(task, pdf, obj)
elseif obj.type == 'XRef' then
-- XRef stream instead of trailer from PDF 1.5 (thanks Adobe)
process_xref(task, pdf, obj)
elseif obj.type == 'Javascript' then
local js = maybe_dereference_object(obj.dict.JS, pdf, task)
if js then
if type(js) == 'table' then
local extracted_js = maybe_extract_object_stream(js, pdf, task)
if not extracted_js then
lua_util.debugm(N, task, 'invalid type for javascript from %s:%s: %s',
obj.major, obj.minor, js)
else
js = extracted_js
end
end
js = process_javascript(task, pdf, js)
if js then
obj.js = js
lua_util.debugm(N, task, 'extracted javascript from %s:%s: %s',
obj.major, obj.minor, obj.js.data)
else
lua_util.debugm(N, task, 'invalid type for javascript from %s:%s: %s',
obj.major, obj.minor, js)
end
end
end
end -- Already processed dict (obj.type is not empty)
end
-- This function is intended to unpack objects from ObjStm crappy structure
local compound_obj_grammar
local function compound_obj_grammar_gen()
if not compound_obj_grammar then
local gen = generic_grammar_elts()
compound_obj_grammar = gen.ws^0 * (gen.comment * gen.ws^1)^0 *
lpeg.Ct(lpeg.Ct(gen.number * gen.ws^1 * gen.number * gen.ws^0)^1)
end
return compound_obj_grammar
end
local function pdf_compound_object_unpack(_, uncompressed, pdf, task, first)
-- First, we need to parse data line by line likely to find a line
-- that consists of pairs of numbers
compound_obj_grammar_gen()
local elts = compound_obj_grammar:match(uncompressed)
if elts and #elts > 0 then
lua_util.debugm(N, task, 'compound elts (chunk length %s): %s',
#uncompressed, elts)
for i,pair in ipairs(elts) do
local obj_number,offset = pair[1], pair[2]
offset = offset + first
if offset < #uncompressed then
local span_len
if i == #elts then
span_len = #uncompressed - offset
else
span_len = (elts[i + 1][2] + first) - offset
end
if span_len > 0 and offset + span_len < #uncompressed then
local obj = {
major = obj_number,
minor = 0, -- Implicit
data = uncompressed:span(offset + 1, span_len),
ref = obj_ref(obj_number, 0)
}
parse_object_grammar(obj, task, pdf)
if obj.dict then
pdf.objects[#pdf.objects + 1] = obj
end
end
end
end
end
end
-- PDF 1.5 ObjStmt
local function extract_pdf_compound_objects(task, pdf)
for _,obj in ipairs(pdf.objects or {}) do
if obj.stream and obj.dict and type(obj.dict) == 'table' then
local t = obj.dict.Type
if t and t == 'ObjStm' then
-- We are in troubles sir...
local nobjs = tonumber(maybe_dereference_object(obj.dict.N, pdf, task))
local first = tonumber(maybe_dereference_object(obj.dict.First, pdf, task))
if nobjs and first then
--local extend = maybe_dereference_object(obj.dict.Extends, pdf, task)
lua_util.debugm(N, task, 'extract ObjStm with %s objects (%s first) %s extend',
nobjs, first, obj.dict.Extends)
local uncompressed = maybe_extract_object_stream(obj, pdf, task)
if uncompressed then
pdf_compound_object_unpack(obj, uncompressed, pdf, task, first)
end
else
lua_util.debugm(N, task, 'ObjStm object %s:%s has bad dict: %s',
obj.major, obj.minor, obj.dict)
end
end
end
end
end
-- This function arranges starts and ends of all objects and process them into initial
-- set of objects
local function extract_outer_objects(task, input, pdf)
local start_pos, end_pos = 1, 1
local obj_count = 0
while start_pos <= #pdf.start_objects and end_pos <= #pdf.end_objects do
local first = pdf.start_objects[start_pos]
local last = pdf.end_objects[end_pos]
-- 7 is length of `endobj\n`
if first + 7 < last then
local len = last - first - 7
-- Also get the starting span and try to match it versus obj re to get numbers
local obj_line_potential = first - 32
if obj_line_potential < 1 then obj_line_potential = 1 end
local prev_obj_end = pdf.end_objects[end_pos - 1]
if end_pos > 1 and prev_obj_end >= obj_line_potential and prev_obj_end < first then
obj_line_potential = prev_obj_end + 1
end
local obj_line_span = input:span(obj_line_potential, first - obj_line_potential + 1)
local matches = object_re:search(obj_line_span, true, true)
if matches and matches[1] then
local nobj = {
start = first,
len = len,
data = input:span(first, len),
major = tonumber(matches[1][2]),
minor = tonumber(matches[1][3]),
}
pdf.objects[obj_count + 1] = nobj
if nobj.major and nobj.minor then
-- Add reference
local ref = obj_ref(nobj.major, nobj.minor)
nobj.ref = ref -- Our internal reference
pdf.ref[ref] = nobj
end
end
obj_count = obj_count + 1
start_pos = start_pos + 1
end_pos = end_pos + 1
elseif first > last then
end_pos = end_pos + 1
else
start_pos = start_pos + 1
end_pos = end_pos + 1
end
end
end
-- This function attaches streams to objects and processes outer pdf grammar
local function attach_pdf_streams(task, input, pdf)
if pdf.start_streams and pdf.end_streams then
local start_pos, end_pos = 1, 1
for _,obj in ipairs(pdf.objects) do
while start_pos <= #pdf.start_streams and end_pos <= #pdf.end_streams do
local first = pdf.start_streams[start_pos]
local last = pdf.end_streams[end_pos]
last = last - 10 -- Exclude endstream\n pattern
lua_util.debugm(N, task, "start: %s, end: %s; obj: %s-%s",
first, last, obj.start, obj.start + obj.len)
if first > obj.start and last < obj.start + obj.len and last > first then
-- In case if we have fake endstream :(
while pdf.end_streams[end_pos + 1] and pdf.end_streams[end_pos + 1] < obj.start + obj.len do
end_pos = end_pos + 1
last = pdf.end_streams[end_pos]
end
-- Strip the first \n
while first < last do
local chr = input:at(first)
if chr ~= 13 and chr ~= 10 then break end
first = first + 1
end
local len = last - first
obj.stream = {
start = first,
len = len,
data = input:span(first, len)
}
start_pos = start_pos + 1
end_pos = end_pos + 1
break
elseif first < obj.start then
start_pos = start_pos + 1
elseif last > obj.start + obj.len then
-- Not this object
break
else
start_pos = start_pos + 1
end_pos = end_pos + 1
end
end
if obj.stream then
lua_util.debugm(N, task, 'found object %s:%s %s start %s len, %s stream start, %s stream length',
obj.major, obj.minor, obj.start, obj.len, obj.stream.start, obj.stream.len)
else
lua_util.debugm(N, task, 'found object %s:%s %s start %s len, no stream',
obj.major, obj.minor, obj.start, obj.len)
end
end
end
end
-- Processes PDF objects: extracts streams, object numbers, process outer grammar,
-- augment object types
local function postprocess_pdf_objects(task, input, pdf)
pdf.objects = {} -- objects table
pdf.ref = {} -- references table
extract_outer_objects(task, input, pdf)
-- Now we have objects and we need to attach streams that are in bounds
attach_pdf_streams(task, input, pdf)
-- Parse grammar for outer objects
for _,obj in ipairs(pdf.objects) do
if obj.ref then
parse_object_grammar(obj, task, pdf)
end
end
extract_pdf_compound_objects(task, pdf)
-- Now we might probably have all objects being processed
for _,obj in ipairs(pdf.objects) do
if obj.dict then
-- Types processing
process_dict(task, pdf, obj, obj.dict)
end
end
end
local function offsets_to_blocks(starts, ends, out)
local start_pos, end_pos = 1, 1
while start_pos <= #starts and end_pos <= #ends do
local first = starts[start_pos]
local last = ends[end_pos]
if first < last then
local len = last - first
out[#out + 1] = {
start = first,
len = len,
}
start_pos = start_pos + 1
end_pos = end_pos + 1
elseif first > last then
end_pos = end_pos + 1
else
-- Not ordered properly!
break
end
end
end
local function search_text(task, pdf)
for _,obj in ipairs(pdf.objects) do
if obj.type == 'Page' and obj.contents then
local text = {}
for _,tobj in ipairs(obj.contents) do
maybe_extract_object_stream(tobj, pdf, task)
local matches = pdf_text_trie:match(tobj.uncompressed or '')
if matches then
local text_blocks = {}
local starts = {}
local ends = {}
for npat,matched_positions in pairs(matches) do
if npat == 1 then
for _,pos in ipairs(matched_positions) do
starts[#starts + 1] = pos
end
else
for _,pos in ipairs(matched_positions) do
ends[#ends + 1] = pos
end
end
end
offsets_to_blocks(starts, ends, text_blocks)
for _,bl in ipairs(text_blocks) do
if bl.len > 2 then
-- To remove \s+ET\b pattern (it can leave trailing space or not but it doesn't matter)
bl.len = bl.len - 2
end
bl.data = tobj.uncompressed:span(bl.start, bl.len)
--lua_util.debugm(N, task, 'extracted text from object %s:%s: %s',
-- tobj.major, tobj.minor, bl.data)
if bl.len < config.max_processing_size then
local ret,obj_or_err = pcall(pdf_text_grammar.match, pdf_text_grammar,
bl.data)
if ret then
text[#text + 1] = obj_or_err
lua_util.debugm(N, task, 'attached %s from content object %s:%s to %s:%s',
obj_or_err, tobj.major, tobj.minor, obj.major, obj.minor)
else
lua_util.debugm(N, task, 'object %s:%s cannot be parsed: %s',
obj.major, obj.minor, obj_or_err)
end
end
end
end
end
-- Join all text data together
if #text > 0 then
obj.text = rspamd_text.fromtable(text)
lua_util.debugm(N, task, 'object %s:%s is parsed to: %s',
obj.major, obj.minor, obj.text)
end
end
end
end
-- This function searches objects for `/URI` key and parses it's content
local function search_urls(task, pdf)
local function recursive_object_traverse(obj, dict, rec)
if rec > 10 then
lua_util.debugm(N, task, 'object %s:%s recurses too much',
obj.major, obj.minor)
return
end
for k,v in pairs(dict) do
if type(v) == 'table' then
recursive_object_traverse(obj, v, rec + 1)
elseif k == 'URI' then
v = maybe_dereference_object(v, pdf, task)
if type(v) == 'string' then
local url = rspamd_url.create(task:get_mempool(), v)
if url then
lua_util.debugm(N, task, 'found url %s in object %s:%s',
v, obj.major, obj.minor)
task:inject_url(url)
end
end
end
end
end
for _,obj in ipairs(pdf.objects) do
if obj.dict and type(obj.dict) == 'table' then
recursive_object_traverse(obj, obj.dict, 0)
end
end
end
local function process_pdf(input, _, task)
if not config.enabled then
-- Skip processing
return {}
end
local matches = pdf_trie:match(input)
if matches then
local pdf_output = {
tag = 'pdf',
extract_text = extract_text_data,
}
local grouped_processors = {}
for npat,matched_positions in pairs(matches) do
local index = pdf_indexes[npat]
local proc_key,loc_npat = index[1], index[4]
if not grouped_processors[proc_key] then
grouped_processors[proc_key] = {
processor_func = processors[proc_key],
offsets = {},
}
end
local proc = grouped_processors[proc_key]
-- Fill offsets
for _,pos in ipairs(matched_positions) do
proc.offsets[#proc.offsets + 1] = {pos, loc_npat}
end
end
for name,processor in pairs(grouped_processors) do
-- Sort by offset
lua_util.debugm(N, task, "pdf: process group %s with %s matches",
name, #processor.offsets)
table.sort(processor.offsets, function(e1, e2) return e1[1] < e2[1] end)
processor.processor_func(input, task, processor.offsets, pdf_output)
end
pdf_output.flags = {}
if pdf_output.start_objects and pdf_output.end_objects then
-- Postprocess objects
postprocess_pdf_objects(task, input, pdf_output)
if config.text_extraction then
search_text(task, pdf_output)
end
if config.url_extraction then
search_urls(task, pdf_output)
end
if config.js_fuzzy and pdf_output.scripts then
pdf_output.fuzzy_hashes = {}
if config.openaction_fuzzy_only then
-- OpenAction only
if pdf_output.openaction and pdf_output.openaction.bin_hash then
if config.min_js_fuzzy and #pdf_output.openaction.data >= config.min_js_fuzzy then
lua_util.debugm(N, task, "pdf: add fuzzy hash from openaction: %s",
pdf_output.openaction.hash)
table.insert(pdf_output.fuzzy_hashes, pdf_output.openaction.bin_hash)
else
lua_util.debugm(N, task, "pdf: skip fuzzy hash from Javascript: %s, too short: %s",
pdf_output.openaction.hash, #pdf_output.openaction.data)
end
end
else
-- All hashes
for h,sc in pairs(pdf_output.scripts) do
if config.min_js_fuzzy and #sc.data >= config.min_js_fuzzy then
lua_util.debugm(N, task, "pdf: add fuzzy hash from Javascript: %s",
sc.hash)
table.insert(pdf_output.fuzzy_hashes, h)
else
lua_util.debugm(N, task, "pdf: skip fuzzy hash from Javascript: %s, too short: %s",
sc.hash, #sc.data)
end
end
end
end
else
pdf_output.flags.no_objects = true
end
return pdf_output
end
end
-- Processes the PDF trailer
processors.trailer = function(input, task, positions, output)
local last_pos = positions[#positions]
local last_span = input:span(last_pos[1])
for line in last_span:lines(true) do
if line:find('/Encrypt ') then
lua_util.debugm(N, task, "pdf: found encrypted line in trailer: %s",
line)
output.encrypted = true
end
end
end
processors.suspicious = function(_, task, _, output)
lua_util.debugm(N, task, "pdf: found a suspicious pattern")
output.suspicious = true
end
local function generic_table_inserter(positions, output, output_key)
if not output[output_key] then
output[output_key] = {}
end
local shift = #output[output_key]
for i,pos in ipairs(positions) do
output[output_key][i + shift] = pos[1]
end
end
processors.start_object = function(_, task, positions, output)
generic_table_inserter(positions, output, 'start_objects')
end
processors.end_object = function(_, task, positions, output)
generic_table_inserter(positions, output, 'end_objects')
end
processors.start_stream = function(_, task, positions, output)
generic_table_inserter(positions, output, 'start_streams')
end
processors.end_stream = function(_, task, positions, output)
generic_table_inserter(positions, output, 'end_streams')
end
exports.process = process_pdf
return exports
|
local Panel = { }
Panel.x = 0
Panel.y = 0
Panel.width = 100
Panel.height = 100
Panel.backgroundColor = lui.theme.color.paneBackground
Panel.borderColor = lui.theme.color.borderInactive
Panel.borderWidth = 1
Panel.cornerRadius = 2
------------------------------------------------------------------------------------------------------------------------
local function drawNiceRect( x, y, w, h, borderWidth, cornerRadius, fillColor, borderColor )
-- Draws a nice rectangle and inside borders with support for transparent colours.
local offset = math.max(0, borderWidth * 0.5)
local cornerInside = math.max(0, cornerRadius - borderWidth * 0.5)
love.graphics.setColor(fillColor)
love.graphics.rectangle('fill', borderWidth, borderWidth, w - borderWidth * 2, h - borderWidth * 2, cornerInside)
love.graphics.setColor(borderColor)
love.graphics.setLineWidth(borderWidth)
love.graphics.rectangle('line', offset, offset, w - borderWidth, h - borderWidth, cornerRadius)
end
------------------------------------------------------------------------------------------------------------------------
function Panel:init( )
end
------------------------------------------------------------------------------------------------------------------------
function Panel:destroyed( )
end
------------------------------------------------------------------------------------------------------------------------
function Panel:update( dt )
end
------------------------------------------------------------------------------------------------------------------------
function Panel:draw( )
--[[ OLD DRAW CODE (Feb 3)
if self.borderWidth > 0 then
love.graphics.setColor(self.borderColor)
love.graphics.rectangle('fill', 0, 0, self.width, self.height, self.cornerRadius)
end
if self.backgroundColor then
love.graphics.setColor(self.backgroundColor)
if self.borderWidth > 0 then
local bw2 = self.borderWidth + self.borderWidth
love.graphics.rectangle('fill',
self.borderWidth, self.borderWidth, self.width - bw2, self.height - bw2, self.cornerRadius)
else
love.graphics.rectangle('fill', 0, 0, self.width, self.height, self.cornerRadius)
end
end
]]
if self.borderWidth > 0 then
drawNiceRect(0, 0, self.width, self.height,
self.borderWidth, self.cornerRadius, self.backgroundColor, self.borderColor)
else
love.graphics.setColor(self.backgroundColor)
love.graphics.rectangle('fill', 0, 0, self.width, self.height, self.cornerRadius)
end
end
------------------------------------------------------------------------------------------------------------------------
function Panel:keypressed( key, scancode, isrepeat )
end
------------------------------------------------------------------------------------------------------------------------
function Panel:keyreleased( key, scancode )
end
------------------------------------------------------------------------------------------------------------------------
function Panel:textedited( text, start, length )
end
------------------------------------------------------------------------------------------------------------------------
function Panel:textinput( text )
end
------------------------------------------------------------------------------------------------------------------------
function Panel:mousemoved( x, y, dx, dy, istouch )
end
------------------------------------------------------------------------------------------------------------------------
function Panel:mousepressed( x, y, button, istouch, presses )
end
------------------------------------------------------------------------------------------------------------------------
function Panel:mousereleased( x, y, button, istouch, presses )
end
------------------------------------------------------------------------------------------------------------------------
function Panel:wheelmoved( x, y )
end
lui.register('Panel', Panel)
|
local M = {}
-- Should we send commands to terminal buffers that we can't currently see?
M.get_term_use_current_tab = function ()
if vim.g.CompileMe_term_use_current_tab == nil then
return true
end
return vim.g.CompileMe_term_use_current_tab
end
-- Should we spawn a new cmd.exe window on Windows?
M.get_term_use_cmd_window = function ()
if vim.fn.has('win32') == 0 then
return false
end
if vim.g.CompileMe_term_use_cmd_window == nil then
return false
end
return vim.g.CompileMe_term_use_cmd_window
end
-- Should we pause at the end of a cmd.exe task? This stops the cmd.exe window
-- from instantly closing
M.get_term_use_cmd_window_pause = function ()
if vim.g.CompileMe_term_use_cmd_window_pause == nil then
return false
end
return vim.g.CompileMe_term_use_cmd_window_pause
end
-- @@Rework move this somewhere else
M.last_terminal = nil
M.last_regular_buffer_id = nil
M.get_commands = function ()
local commands = {}
local proj = require('CompileMe.project').get_current()
for k, _ in pairs(proj and proj.compiler or {}) do
table.insert(commands, k)
end
return commands;
end
M.command_wrapper = function (cmd)
if cmd == "" then
cmd = "compile"
end
local commands = M.get_commands()
local cmd_is_registered = false
for _, command in pairs(commands) do
if cmd == command then
cmd_is_registered = true
break
end
end
if not cmd_is_registered then
print(string.format("Command %s not implemented.", cmd))
return
end
local str = string.format("require('CompileMe.project').get_current().compiler.%s():run()", cmd)
loadstring(str)()
end
return M
|
require 'nn'
require 'cunn'
local backend_name = opt.backend
local backend
if backend_name == 'cudnn' then
require 'cudnn'
backend = cudnn
else
backend = nn
end
local net = nn.Sequential()
net = nn.Sequential()
net:add(backend.SpatialConvolution(im_channel, 20, 5, 5))
net:add(nn.SpatialBatchNormalization(20,1e-3))
net:add(backend.ReLU(true))
net:add(backend.SpatialMaxPooling(2,2,2,2))
net:add(backend.SpatialConvolution(20, 50, 5, 5))
net:add(nn.SpatialBatchNormalization(50,1e-3))
net:add(backend.ReLU(true))
net:add(backend.SpatialMaxPooling(2,2,2,2))
net:add(nn.View(50*after_pool_sz*after_pool_sz))
net:add(nn.Linear(50*after_pool_sz*after_pool_sz, 500))
net:add(nn.BatchNormalization(500))
net:add(nn.ReLU(true))
net:add(nn.Linear(500, 10))
return net
|
object_tangible_collection_rare_pistol_sr_combat = object_tangible_collection_shared_rare_pistol_sr_combat:new {
gameObjectType = 8211,}
ObjectTemplates:addTemplate(object_tangible_collection_rare_pistol_sr_combat, "object/tangible/collection/rare_pistol_sr_combat.iff")
|
if spawners == nil then
_G.spawners = class({}) -- put spawners in the global scope
end
require('spawner_tables')
spawners.dire_unit_count = -1
--thinker that triggers dire spawns, it's called under function GameMode:OnGameRulesStateChange(keys) under events
function dire_thinker()
Timers:CreateTimer(
function()
activate_spawned_unit_orders()
return 5.0
end)
Timers:CreateTimer(
function()
for _,overlord in pairs(CustomGameRules.overlord_table) do
activate_spawners(overlord)
end
return 30.0
end)
end
function spawners:stats_update_thinker(overlord) --called on the spawn event for the overlord in gamemode.lua
Timers:CreateTimer(
function()
local count = spawners:get_dire_unit_count(overlord)
if count ~= spawners.dire_unit_count then
CustomGameEventManager:Send_ServerToTeam(overlord:GetTeam(),"UpdateUnitCount", {text = count .."/".. SPAWNER_UNIT_CAP} )
end
spawners.dire_unit_count = count
local cost = spawners:get_active_spawner_cost(overlord)
if cost ~= overlord.active_spawner_cost then
CustomGameEventManager:Send_ServerToTeam(overlord:GetTeam(),"UpdateGoldCostPerMinute", {text = "-" .. cost } )
end
overlord.active_spawner_cost = cost
gpm = PlayerResource:GetGoldPerMin(overlord:GetPlayerID())
CustomGameEventManager:Send_ServerToTeam(overlord:GetTeam(),"UpdateGoldPerMinute", {text = math.floor(gpm) .. "Gold/Minute" } )
return 2
end)
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--Spawner scripts
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function activate_spawners(overlord)
overlord.UnitCount = 0
overlord.wave_gold_spent = 0
for spawner,spawn_unit_string in pairs(spawners.spawner_table) do
overlord.UnitCount = 0
for unit, _ in pairs( spawners.dire_spawned_units ) do
if IsValidEntity(unit) then
if unit:GetOwner() == overlord then
overlord.UnitCount = overlord.UnitCount + 1
end
end
end
if overlord.UnitCount < SPAWNER_UNIT_CAP then
if spawner:IsNull() == false then
if spawner:IsChanneling() == false and spawner.deactivated == false and spawner:GetOwner() == overlord then
spawn_location = spawner:GetOrigin()
spawn(spawn_unit_string,spawn_location, spawner,spawner:GetOwner())
end
else
delete_spawner(spawner)
end
end
end
GameAlerts:DireSpawnComplete(overlord.wave_gold_spent,overlord.UnitCount + 1,overlord)
end
function clear_unit_ai(unit)
spawners.dire_spawned_units[unit] = nil
spawners.neutral_spawned_units[unit] = nil
unit.ai = nil
end
function delete_spawner(spawner)
spawners.spawner_table[spawner] = nil
end
function spawners:assign_dire_ai(unit,string)
if IsValidEntity(unit) then
clear_unit_ai(unit)
unit.starting_team = unit:GetTeam()
unit.ai = string
spawners.dire_spawned_units[unit] = string
end
spawners:unit_order(unit, string)
end
function spawners:assign_neutral_ai(unit,string)
if IsValidEntity(unit) then
clear_unit_ai(unit)
unit.ai = string
spawners.neutral_spawned_units[unit] = string
end
spawners:unit_order(unit, string)
end
function spawners:new_spawner(spawner,unit_string)
if IsValidEntity(spawner) then
spawner.deactivated = false
spawners.spawner_table[spawner] = unit_string
end
end
function spawners:get_dire_unit_count(overlord)
count = 0
for unit,unit_script_string in pairs(spawners.dire_spawned_units) do
if unit:IsNull() == false then
if unit:GetTeam() == unit.starting_team and unit:GetTeam() == overlord:GetTeam() and unit:IsAlive() then
count = count + 1
end
else
clear_unit_ai(unit)
end
end
return count
end
function spawners:get_active_spawner_cost(overlord)
local total_cost = 0
for spawner,unit_name_string in pairs(spawners.spawner_table) do
if spawner:IsNull() == false then
if spawner:IsChanneling() == false and spawner.deactivated == false and spawner:GetTeam() == overlord:GetTeam() then
local cost = gold_cost[unit_name_string]
total_cost = total_cost + cost
end
else
delete_spawner(spawner)
end
end
return total_cost
end
------spawn function ----------------------------------------------------------------------------------------------------------------------------------
function spawn(unit_name_string,spawn_location,spawner,overlord)
if spawner:IsAlive() == false then
return
end
local current_gold
local id
if PlayerResource:GetPlayerCountForTeam(overlord:GetTeam()) ~= 0 then
id = overlord:GetPlayerID()
current_gold = PlayerResource:GetGold(id)
else
current_gold = 10000
id = -1
end
if overlord.wave_gold_spent == nil then
overlord.wave_gold_spent = 0
end
local cost = gold_cost[unit_name_string]
if current_gold > cost then
PlayerResource:SpendGold(id, cost, 0)
local unit = CreateUnitByName(unit_name_string, spawn_location + 140*spawner:GetForwardVector(), true, spawner:GetOwner(), spawner:GetOwner(), overlord:GetTeam()) -- ( szUnitName, vLocation, bFindClearSpace, hNPCOwner, hUnitOwner, iTeamNumber )
local unit_script_string = spawners.ai[unit:GetUnitName()]
spawners:assign_dire_ai(unit,unit_script_string)
if GAMEMODE == OVERLORD_VS then
unit:SetMaximumGoldBounty(0)
unit:SetMinimumGoldBounty(0)
end
overlord.wave_gold_spent = overlord.wave_gold_spent + cost
return unit
else
GameAlerts:NotEnoughGoldForSpawner(overlord)
end
end
--------- function that triggers each ai order
function activate_spawned_unit_orders()
for unit,unit_script_string in pairs(spawners.dire_spawned_units) do
if unit:IsNull() == false then
if unit:GetTeam() == unit.starting_team then
if unit:IsAttacking() then
Timers:CreateTimer(GetAttackTimeRemaining(unit), function()
spawners:unit_order(unit, unit_script_string)
end)
else
spawners:unit_order(unit, unit_script_string)
end
else
clear_unit_ai(unit)
end
else
clear_unit_ai(unit)
end
end
for unit,unit_script_string in pairs(spawners.neutral_spawned_units) do
if unit:IsNull() == false then
if unit:GetTeam() ~= DOTA_TEAM_BADGUYS and unit:GetTeam() ~= DOTA_TEAM_GOODGUYS then
spawners:unit_order(unit, unit_script_string)
end
end
end
end
function spawners:upgrade(spawner)
current_spawn = spawners.spawner_table[spawner]
if upgrade_table[current_spawn] == nil then
return false
end
spawners.spawner_table[spawner] = upgrade_table[current_spawn]
return true
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--AI scripts
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function spawners:unit_order(unit, unit_script_string)
if unit ~= nil then
if unit:IsNull() then
return
end
else
return
end
if unit:IsAlive() == false then
return
end
if unit_script_string == "attack_base" then
--find the nearest moon well
unit:Stop()
local buildings = Entities:FindAllByClassname('npc_dota_building')
local attack_target = nil
for _,building in pairs(buildings) do
if building:GetTeam() ~= unit:GetTeam() and building:GetTeam() ~= DOTA_TEAM_CUSTOM_1 and building:IsAlive() then
if attack_target == nil then
attack_target = building
elseif (building:GetOrigin() - unit:GetOrigin()):Length() < (attack_target:GetOrigin() - unit:GetOrigin()):Length() then
attack_target = building
end
end
end
local towers = Entities:FindAllByClassname('npc_dota_tower')
for _,tower in pairs(towers) do
if tower:GetTeam() ~= unit:GetTeam() and tower:IsAlive() then
if attack_target == nil then
attack_target = tower
elseif (tower:GetOrigin() - unit:GetOrigin()):Length() < (attack_target:GetOrigin() - unit:GetOrigin()):Length() then
attack_target = tower
end
end
end
if attack_target == nil and GameMode.ancient:GetTeam() ~= DOTA_TEAM_CUSTOM_1 then
if unit:GetTeam() == DOTA_TEAM_BADGUYS then
attack_target = Entities:FindByName(nil, "dota_goodguys_fort")
elseif unit:GetTeam() == DOTA_TEAM_GOODGUYS then
attack_target = Entities:FindByName(nil, "dota_badguys_fort")
end
end
for spawner,_ in pairs(spawners.spawner_table) do
if unit:CanEntityBeSeenByMyTeam(spawner) and spawner:GetTeam() ~= unit:GetTeam() then
attack_target = spawner
end
end
if attack_target == nil then
local enemy_units = FindUnitsInRadius( unit:GetTeam(), unit:GetAbsOrigin(), nil, FIND_UNITS_EVERYWHERE, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_BASIC + DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE, FIND_CLOSEST, false )
local flag = true
for i = 0,#enemy_units do
if i > 0 and enemy_units[i]:GetTeam() ~= DOTA_TEAM_NEUTRALS and flag then
attack_target = enemy_units[i]
flag = false
end
end
end
if attack_target == nil then
MillAbout(unit)
return
end
AggressiveMoveToPoint(unit,attack_target:GetOrigin())
return
end
if unit_script_string == "wander" then
if unit:IsAttacking() == false then
unit:Stop()
end
target_vector = unit:GetOrigin()
for i=1,7 do
target_vector = target_vector + RandomVector(RandomInt(0,1200))
if GridNav:IsTraversable(target_vector) == false then
target_vector = -target_vector
end
AggressiveMoveToPoint(unit,target_vector)
end
return
end
if unit_script_string == "neutral_wander" then
if unit:IsAttacking() then
local target = unit:GetAttackTarget()
if target:GetClassname() == "npc_dota_building" or target:GetClassname() == "npc_dota_tower" then
unit:Stop()
MoveToPoint(unit,unit:GetOrigin() + (-1 * target:GetOrigin() + unit:GetOrigin()):Normalized() * 1000)
return
end
else
unit:Stop()
end
target_vector = unit:GetOrigin()
for i=1,7 do
target_vector = target_vector + RandomVector(RandomInt(0,1200))
if GridNav:IsTraversable(target_vector) == false then
target_vector = -target_vector
end
AggressiveMoveToPoint(unit,target_vector)
end
return
end
if unit_script_string == "guard" then
if unit.guard_point == nil then
unit.guard_point = unit:GetOrigin()
end
for i=1,7 do
target_vector = RandomVector(RandomInt(0,3000)) + unit.guard_point
if GridNav:CanFindPath(unit:GetOrigin(),target_vector) then
AggressiveMoveToPoint(unit,target_vector)
end
end
return
end
if unit_script_string == "farm" then
if unit:IsAttacking() then
unit:Stop()
local target = unit:GetAttackTarget()
if target:GetClassname() == "npc_dota_tower" then
MoveToPoint(unit,unit:GetOrigin() + (-1 * target:GetOrigin() + unit:GetOrigin()):Normalized() * 3600)
return
end
if target:GetTeam() ~= DOTA_TEAM_NEUTRALS then
MoveToPoint(unit,unit:GetOrigin() + (-1 * target:GetOrigin() + unit:GetOrigin()):Normalized() * 1600)
return
end
end
local enemy_neutrals = FindUnitsInRadius( DOTA_TEAM_NEUTRALS, unit:GetAbsOrigin(), nil, 1500, DOTA_UNIT_TARGET_TEAM_FRIENDLY, DOTA_UNIT_TARGET_BASIC, DOTA_UNIT_TARGET_FLAG_NO_INVIS, FIND_CLOSEST, false )
local target_point
if #enemy_neutrals > 0 then
local aggro_target = enemy_neutrals[1]
if aggro_target:GetTeam() ~= DOTA_TEAM_NEUTRALS then
MoveToPoint(unit,unit:GetOrigin() + (-1 * target:GetOrigin() + unit:GetOrigin()):Normalized() * 3600)
return
end
target_point = aggro_target:GetOrigin()
if GridNav:CanFindPath(unit:GetOrigin(),target_point) == false then
target_point = RandomVector(400)
end
AggressiveMoveToPoint( unit, target_point, unit:IsAttacking() ) --Start attacking
else
target_point = RandomVector(2000) + unit:GetOrigin()
end
for i=1,3 do --this is here so they scatter after killing their target
target_point = RandomVector(RandomInt(0,1200)) + target_point
if GridNav:IsTraversable(target_point) == false then
target_point = -target_point
end
AggressiveMoveToPoint( unit, target_point)
end
return
end
if unit_script_string == "order" then
if unit:IsIdle() then
spawners.dire_spawned_units[unit] = spawners.ai[unit:GetUnitName()]
end
return
end
if unit_script_string == "hunt" then
if unit:IsAttacking() == false then
unit:Stop()
end
unit.IsBored = false
enemy_heroes = FindUnitsInRadius( unit:GetTeam(), unit:GetAbsOrigin(), nil, FIND_UNITS_EVERYWHERE, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE + DOTA_UNIT_TARGET_FLAG_NOT_CREEP_HERO, FIND_CLOSEST, false )
unitpos = unit:GetOrigin()
if #enemy_heroes > 0 then
local prey = enemy_heroes[1]
Timers:CreateTimer(0,function()
if unit ~= nil then
if unit:IsNull() == false then
if unit:CanEntityBeSeenByMyTeam(prey) then
unit.preypos = prey:GetOrigin() + 500*prey:GetForwardVector()
return .1
end
end
end
return
end)
AttackToTarget(unit,prey)
else
if unit.preypos ~= nil then
if (unit.preypos - unitpos):Length() > 50 then
AggressiveMoveToPoint(unit,unit.preypos)
else
AggressiveMoveToPoint(unit,unitpos + RandomVector(RandomInt(1,400)))
MillAbout(unit)
unit.preypos = nil
end
else
MillAbout(unit)
end
end
return
end
if unit_script_string == "cower" then
local enemies = FindUnitsInRadius( unit:GetTeam(), unit:GetAbsOrigin(), nil, 1200, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_ALL, DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE, FIND_CLOSEST, false )
if #enemies > 0 then
local average_pos = Vector(0,0,0)
for _,enemy in pairs(enemies) do
average_pos = average_pos + enemy:GetOrigin()
end
average_pos = average_pos/#enemies
local direction = (unit:GetOrigin() - average_pos):Normalized()
local backup_loc = unit:GetOrigin() + direction * 2000
if unit:GetUnitName() == "npc_dota_treasure_frog" then
EmitSoundOnLocationWithCaster(unit:GetOrigin(), "Hero_Lion.Hex.Target", unit)
end
MoveToPoint(unit,backup_loc)
return
else
spawners:unit_order(unit, "wander")
return
end
end
if unit_script_string == "nether_lich" then
local enemies = FindUnitsInRadius( unit:GetTeam(), unit:GetAbsOrigin(), nil, 2000, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_ALL, DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE, FIND_CLOSEST, false )
local decrepify = unit:FindAbilityByName("pugna_decrepify")
local nether_blast = unit:FindAbilityByName("pugna_nether_blast")
local lich_pos = unit:GetOrigin()
if #enemies > 0 then
unit.IsBored = false
nearest = enemies[1]
if (nearest:GetOrigin() - lich_pos):Length() < 300 then
unit:Stop()
CastAbilityTargetUnit(unit,decrepify,nearest)
CastAbilityPoint(unit, nether_blast, nearest:GetOrigin())
local direction = (lich_pos - nearest:GetOrigin()):Normalized()
local backup_loc = unit:GetOrigin() + direction * 2000
MoveToPoint(unit,backup_loc)
return
end
if #enemies > 10 then
CastAbilityPoint(unit, nether_blast, nearest:GetOrigin())
local direction = (nearest:GetOrigin() - lich_pos):Normalized()
MoveToPoint(unit,direction * 1000)
return
else
AttackToTarget(unit,nearest)
return
end
else
MillAbout(unit)
return
end
end
if unit_script_string == "demon_lord" then
local rain = unit:FindAbilityByName("rain_of_chaos")
if rain:GetCooldownTimeRemaining() == 0 then
unit:Stop()
CastAbilityNoTarget(unit,rain)
MoveToPoint(unit,unit:GetOrigin())
return
end
if unit:CanEntityBeSeenByMyTeam(unit.summoner) then
unit.IsBored = false
AttackToTarget(unit,unit.summoner)
return
else
MillAbout(unit)
return
end
end
if unit_script_string == "ogre" then
local leap_slam = unit:FindAbilityByName("bruiser_leap_slam")
local pancakes = FindUnitsInRadius( unit:GetTeam(), unit:GetAbsOrigin() + unit:GetForwardVector() * 600, nil, 200, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_BASIC + DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE, FIND_CLOSEST, false )
local heroes = FindUnitsInRadius( unit:GetTeam(), unit:GetAbsOrigin(), nil, 2000, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO, DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE, FIND_CLOSEST, false )
if #pancakes > 0 and leap_slam:IsFullyCastable() then
unit:Stop()
CastAbilityNoTarget(unit,leap_slam)
AttackToTarget(unit,pancakes[1])
elseif #heroes > 1 then
AttackToTarget(unit,heroes[1],false)
else
spawners:unit_order(unit, "wander")
end
end
end
function spawners:command_in_radius(command_string,center,TEAM,target,range) --this function looks for badguys on the bad minion list then passes a new order to them and sets their ai to "order"
if range == nil then
range = 1400
end
if command_string == "global_attack" then
for unit,_ in pairs(spawners.dire_spawned_units) do
if IsValidEntity(unit) then
if unit:GetTeam() == TEAM then
spawners.dire_spawned_units[unit] = "attack_base"
end
end
end
activate_spawned_unit_orders()
return
end
local unit_table = FindUnitsInRadius( TEAM, center, nil, range, DOTA_UNIT_TARGET_TEAM_FRIENDLY, DOTA_UNIT_TARGET_ALL, DOTA_UNIT_TARGET_FLAG_INVULNERABLE, FIND_ANY_ORDER, false )
local unitcount = #unit_table
for _,unit in pairs(unit_table) do
if spawners.dire_spawned_units[unit] ~= nil and unit:GetTeam() == TEAM then
spawners.dire_spawned_units[unit] = "order"
unit:Stop()
unit.IsBored = false
if command_string == "attack_move" then
AggressiveMoveToPoint(unit,target + RandomVector(RandomFloat(1,40*math.sqrt(unitcount))))
end
if command_string == "attack_target" then
AttackToTarget(unit,target)
end
if command_string == "move" then
MoveToPoint(unit,target + RandomVector(RandomFloat(1,60*math.sqrt(unitcount))))
end
if command_string == "work" then
spawners.dire_spawned_units[unit] = spawners.ai[unit:GetUnitName()]
spawners:unit_order(unit, spawners.dire_spawned_units[unit])
end
if command_string == "defend" then
target_table = FindUnitsInRadius( unit:GetTeam(), center, nil, 1400, DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO, 0, FIND_CLOSEST, false )
if #target_table > 0 then
AttackToTarget(unit,target_table[1])
else
AggressiveMoveToPoint(unit,target + RandomVector(350))
end
end
end
end
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--Commands
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function AggressiveMoveToPoint(unit,point,bool)
if bool == nil then
bool = true
end
local position = point + RandomVector(RandomInt(1,40))
ExecuteOrderFromTable({ UnitIndex = unit:GetEntityIndex(),
OrderType = DOTA_UNIT_ORDER_ATTACK_MOVE,
Position = point, Queue = bool })
end
function MoveToPoint(unit,point, bool)
if bool == nil then
bool = true
end
local position = point + RandomVector(RandomInt(1,300))
ExecuteOrderFromTable({ UnitIndex = unit:GetEntityIndex(),
OrderType = DOTA_UNIT_ORDER_MOVE_TO_POSITION,
Position = point, Queue = bool })
AggressiveMoveToPoint(unit,point)
end
function AttackToTarget(unit,target,bool)
if bool == nil then
bool = true
end
ExecuteOrderFromTable({ UnitIndex = unit:GetEntityIndex(),
OrderType = DOTA_UNIT_ORDER_ATTACK_TARGET,
TargetIndex = target:entindex(), Queue = bool })
AggressiveMoveToPoint(unit,target:GetOrigin())
end
function MoveToTarget(unit,target,bool)
if bool == nil then
bool = true
end
ExecuteOrderFromTable({ UnitIndex = unit:GetEntityIndex(),
OrderType = DOTA_UNIT_ORDER_MOVE_TO_TARGET,
TargetIndex = target:entindex(), Queue = bool })
AggressiveMoveToPoint(unit,target:GetOrigin())
end
function CastAbilityTargetUnit(unit,ability,target,bool)
if bool == nil then
bool = true
end
ExecuteOrderFromTable({ UnitIndex = unit:GetEntityIndex(),
OrderType = DOTA_UNIT_ORDER_CAST_TARGET,
AbilityIndex = ability:GetEntityIndex(),
TargetIndex = target:entindex(), Queue = bool })
end
function CastAbilityPoint(unit,ability,point,bool)
if bool == nil then
bool = true
end
ExecuteOrderFromTable({ UnitIndex = unit:GetEntityIndex(),
OrderType = DOTA_UNIT_ORDER_CAST_POSITION,
AbilityIndex = ability:GetEntityIndex(),
Position = point, Queue = bool })
end
function CastAbilityNoTarget(unit,ability,bool)
if bool == nil then
bool = true
end
ExecuteOrderFromTable({ UnitIndex = unit:GetEntityIndex(),
OrderType = DOTA_UNIT_ORDER_CAST_NO_TARGET,
AbilityIndex = ability:GetEntityIndex(),
Queue = bool })
end
function MillAbout(unit)
if unit.IsBored ~= true then
unit.millpos = unit:GetOrigin()
end
unit.IsBored = true
Timers:CreateTimer(
function()
if unit:IsNull() == false then
if unit:IsAlive() then
if unit.IsBored == true then
AggressiveMoveToPoint(unit,unit.millpos + RandomVector(RandomInt(1,800)))
return RandomInt(1,10)
else
return nil
end
end
end
end
)
end
function GetAttackTimeRemaining(unit)
local animation_point = unit:GetAttackAnimationPoint()
local attack_time = 1/(unit:GetAttackSpeed())
local time_until_next_attack = unit:TimeUntilNextAttack()
local time_until_attack_lands = attack_time * animation_point - (attack_time - time_until_next_attack)
if time_until_attack_lands < 0 then
time_until_attack_lands = time_until_attack_lands + attack_time
end
return time_until_attack_lands + .02 --slight offset in case of float rounding errors from division
end
|
local ran,err = ypcall(function()
plr = game:service'Players'.LocalPlayer
char = plr.Character
mouse = plr:GetMouse()
humanoid = char:findFirstChild("Humanoid")
torso = char:findFirstChild("Torso")
head = char.Head
ra = char:findFirstChild("Right Arm")
la = char:findFirstChild("Left Arm")
rl = char:findFirstChild("Right Leg")
ll = char:findFirstChild("Left Leg")
rs = torso:findFirstChild("Right Shoulder")
ls = torso:findFirstChild("Left Shoulder")
rh = torso:findFirstChild("Right Hip")
lh = torso:findFirstChild("Left Hip")
neck = torso:findFirstChild("Neck")
rj = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint")
anim = char:findFirstChild("Animate")
rootpart = char:findFirstChild("HumanoidRootPart")
camera = workspace.CurrentCamera
if anim then
anim:Destroy()
end
rj.C0 = CFrame.new()
rj.C1 = CFrame.new()
super_annoying = Instance.new("Sound", head)
super_annoying.SoundId = "http://www.roblox.com/asset/?id=138288153"
super_annoying.Volume = 0.6
super_annoying.Looped = true
barrel_roll = Instance.new("Sound", head)
barrel_roll.SoundId = "http://www.roblox.com/asset/?id=130791919"
barrel_roll.Volume = 1
barrel_roll.Looped = true
dubstep_gun = Instance.new("Sound", head)
dubstep_gun.SoundId = "http://www.roblox.com/asset/?id=130855491"
dubstep_gun.Volume = 0.6
dubstep_gun.Looped = true
you_are_pirate = Instance.new("Sound", head)
you_are_pirate.SoundId = "http://www.roblox.com/asset/?id=130888577"
you_are_pirate.Volume = 0.6
you_are_pirate.Looped = true
cant_touch = Instance.new("Sound", head)
cant_touch.SoundId = "http://www.roblox.com/asset/?id=131280929"
cant_touch.Volume = 1
cant_touch.Looped = true
gangy_style = Instance.new("Sound", head)
gangy_style.SoundId = "http://www.roblox.com/asset/?id=142633540"
gangy_style.Volume = 0.6
gangy_style.Looped = true
fox_say = Instance.new("Sound", head)
fox_say.SoundId = "http://www.roblox.com/asset/?id=130763583"
fox_say.Volume = 1.9
fox_say.Looped = true
durk = Instance.new("Sound", head)
durk.SoundId = "http://www.roblox.com/asset/?id=140448249"
durk.Volume = 1.9
durk.Pitch = 16
durk.Looped = true
sax_guy = Instance.new("Sound", head)
sax_guy.SoundId = "http://www.roblox.com/asset/?id=140448249"
sax_guy.Volume = 0.6
sax_guy.Looped = true
heman = Instance.new("Sound", head)
heman.SoundId = "http://www.roblox.com/asset/?id=133339133"
heman.Volume = 1
heman.Looped = true
justin = Instance.new("Sound", head)
justin.SoundId = "http://www.roblox.com/asset/?id=130766856"
justin.Volume = 0.8
justin.Looped = true
brony_music = Instance.new("Sound", head)
brony_music.SoundId = "http://www.roblox.com/asset/?id=135360327"
brony_music.Volume = 1
brony_music.Looped = true
spitfire = Instance.new("Sound", head)
spitfire.SoundId = "http://www.roblox.com/asset/?id=130764066"
spitfire.Volume = 0.8
spitfire.Looped = true
burn_dem = Instance.new("Sound", head)
burn_dem.SoundId = "http://www.roblox.com/asset/?id=132399469"
burn_dem.Volume = 1
burn_dem.Looped = true
if char:findFirstChild("Shirt") then
char:findFirstChild("Shirt"):Destroy()
end
if char:findFirstChild("Pants") then
char:findFirstChild("Pants"):Destroy()
end
if char:findFirstChild("Shirt Graphic") then
char:findFirstChild("Shirt Graphic"):Destroy()
end
Instance.new("HumanoidController", game:service'ControllerService')
Instance.new("SkateboardController", game:service'ControllerService')
Instance.new("VehicleController", game:service'ControllerService')
--minimize
rh.Parent = nil
lh.Parent = nil
rs.Parent = nil
ls.Parent = nil
neck.Parent = nil
rj.Parent = nil
rl.FormFactor = "Custom"
ll.FormFactor = "Custom"
ra.FormFactor = "Custom"
la.FormFactor = "Custom"
torso.FormFactor = "Custom"
head.FormFactor = "Custom"
rootpart.FormFactor = "Custom"
rootpart.Size = Vector3.new(.4, .4, .2)
rl.Size = Vector3.new(.2, .4, .2)
ll.Size = Vector3.new(.2, .4, .2)
ra.Size = Vector3.new(.2, .4, .2)
la.Size = Vector3.new(.2, .4, .2)
torso.Size = Vector3.new(.4, .4, .2)
head.Size = Vector3.new(.4, .2, .2)
rh.Parent = torso
lh.Parent = torso
rs.Parent = torso
ls.Parent = torso
neck.Parent = torso
rj.Parent = rootpart
if torso:findFirstChild("roblox") then
local p = Instance.new("Part", char)
p.FormFactor = "Custom"
p.Size = torso.Size
p.Transparency = 1
p:BreakJoints()
local w = Instance.new("Weld", char)
w.Part0 = p
w.Part1 = torso
torso:findFirstChild("roblox").Parent = p
end
mesh1 = Instance.new("SpecialMesh", torso)
mesh1.Name = "Mesh"
mesh1.Scale = torso.Size - Vector3.new(torso.Size.x/2, torso.Size.y/2, 0)
mesh1.MeshId = "rbxasset://fonts/torso.mesh"
mesh2 = Instance.new("SpecialMesh", la)
mesh2.Name = "Mesh"
mesh2.Scale = la.Size - Vector3.new(0, la.Size.y/2, 0)
mesh2.MeshId = "rbxasset://fonts/leftarm.mesh"
mesh3 = Instance.new("SpecialMesh", ra)
mesh3.Name = "Mesh"
mesh3.Scale = ra.Size - Vector3.new(0, ra.Size.y/2, 0)
mesh3.MeshId = "rbxasset://fonts/rightarm.mesh"
mesh4 = Instance.new("SpecialMesh", ll)
mesh4.Name = "Mesh"
mesh4.Scale = ll.Size - Vector3.new(0, ll.Size.y/2, 0)
mesh4.MeshId = "rbxasset://fonts/leftleg.mesh"
mesh5 = Instance.new("SpecialMesh", rl)
mesh5.Name = "Mesh"
mesh5.Scale = rl.Size - Vector3.new(0, rl.Size.y/2, 0)
mesh5.MeshId = "rbxasset://fonts/rightleg.mesh"
--0.3 = 1.5, 0.1 = 0.5, 0.2 = 1
ls.C0 = CFrame.new(-.3,.1,0)
ls.C1 = CFrame.new(0,.1,0)
rs.C0 = CFrame.new(.3,.1,0)
rs.C1 = CFrame.new(0,.1,0)
rh.C0 = CFrame.new(.1,-.2,0)
rh.C1 = CFrame.new(0, .2, 0)
lh.C0 = CFrame.new(-.1,-.2,0)
lh.C1 = CFrame.new(0, .2, 0)
neck.C0 = CFrame.new(0,.2,0)
neck.C1 = CFrame.new(0,-.1,0)
bodyc = char:findFirstChild("Body Colors")
if bodyc then
bodyc:Destroy()
end
wait(0.1)
skincolor = {"Reddish brown", "Brick yellow", "Pastel brown", "Nougat", "Brown", "Cool yellow", "Dark orange", "Neon orange"}
clothcolor = {"Bright green", "Bright red", "Bright blue", "Light stone grey", "New Yeller", "Really black", "Lavender", "Medium green", "White", "Bright Yellow"}
skincolorrandom = BrickColor.new(skincolor[math.random(1, #skincolor)])
clothcolorrandom = BrickColor.new(clothcolor[math.random(1, #clothcolor)])
function restorecolors()
for _,bp in pairs(char:children()) do
if bp:IsA("BasePart") then
bp.BrickColor = skincolorrandom
end
end
torso.BrickColor = clothcolorrandom
ll.BrickColor = clothcolorrandom
rl.BrickColor = clothcolorrandom
end
restorecolors()
local LightForTorso = Instance.new("PointLight", head)
LightForTorso.Color = torso.BrickColor.Color
LightForTorso.Range = 7
LightForTorso.Brightness = 1.5
local slidecount = 0
local slidecountmax = 0
local anim = ""
local lastanim = anim
local speed = 0
local looking = false
local dancing = false
local superannoying = false
local barrelroll = false
local dubstepgun = false
local foxie = false
local durka = false
local saxguy = false
local heya = false
local jb = false
local bronymusic = false
local sheddy = false
local burndem = false
local global_wait = 0
count = 0
countspeed = 1
sine = 0
sinespeed = 1
humanoid.WalkSpeed = 11
local controllerService = game:GetService("ControllerService")
local controller = controllerService:GetChildren()[1]
local colors = {"White", "Really black"}
humanoid.Died:connect(function()
for cframe_parts = 0, 100 do
local p = Instance.new("Part")
p.FormFactor = "Custom"
p.BrickColor = BrickColor.new(colors[math.random(1, #colors)])
p.Size = Vector3.new(1, 1, 1)
Instance.new("BlockMesh", p).Scale = Vector3.new(0.05, 0.05, 0.05)
p.Locked = true
p.CanCollide = false
p.Anchored = true
p.CFrame = torso.CFrame * CFrame.Angles(math.random(-36, 36),math.random(-36, 36),math.random(-36, 36))
p.Parent = workspace
game:service'Debris':AddItem(p, 5)
coroutine.wrap(function()
while wait() do
if p ~= nil then
p.CFrame = p.CFrame * CFrame.new(0, 0.085, 0)
p.Mesh.Scale = p.Mesh.Scale - Vector3.new(0.005, 0, 0.005) + Vector3.new(0, 0.01, 0)
p.Transparency = p.Transparency + 0.015
else
break
end
end
end)()
end
for _,v in pairs(char:children()) do
if v:IsA("Part") then
v:Destroy()
end
end
end)
mouse.KeyDown:connect(function(k)
if string.byte(k) == 50 then
if dancing then return end
sitting = not sitting
if sitting then
local ray = Ray.new(torso.Position, Vector3.new(0, -1, 0))
local hitz,enz = workspace:FindPartOnRay(ray, char)
if hitz then
controller.Parent = nil
humanoid.WalkSpeed = 0
coroutine.wrap(function()
while wait() do
humanoid.PlatformStand = true
if sitting == false then humanoid.PlatformStand = false break end
end
end)()
rj.C0 = CFrame.new(0, -0.35, 0) * CFrame.Angles(math.rad(10), 0, 0)
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(math.pi/2-math.rad(10), 0, -math.pi/16)
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(math.pi/2-math.rad(10), 0, math.pi/16)
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(-math.rad(10), 0, -math.pi/10)
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(-math.rad(10), 0, math.pi/10)
miniweld = Instance.new("Weld", char)
miniweld.C0 = hitz.CFrame:toObjectSpace(rootpart.CFrame)
miniweld.Part0 = hitz
miniweld.Part1 = rootpart
else
sitting = false
return
end
else
if miniweld then
miniweld:Destroy()
end
controller.Parent = controllerService
humanoid.PlatformStand = false
humanoid.WalkSpeed = 11
end
end
if k == "w" or k == "a" or k == "s" or k == "d" or string.byte(k) == 32 then
superannoying = false
barrelroll = false
heya = false
dubstepgun = false
youpirate = false
canttouch = false
gangnam = false
sheddy = false
durka = false
saxguy = false
foxie = false
burndem = false
bronymusic = false
brony_music:stop()
fox_say:stop()
spitfire:stop()
heman:stop()
justin:stop()
jb = false
durk:stop()
restorecolors()
burn_dem:stop()
if hat then
hat:Destroy()
end
sax_guy:stop()
gangy_style:stop()
cant_touch:stop()
you_are_pirate:stop()
dubstep_gun:stop()
super_annoying:stop()
barrel_roll:stop()
dancing = false
global_wait = 0
LightForTorso.Color = torso.BrickColor.Color
end
if k == "z" then
if dancing then return end
if not sitting then
dancing = true
superannoying = true
super_annoying:play()
end
end
if k == "k" then
if dancing then return end
if not sitting then
dancing = true
sheddy = true
spitfire:play()
end
end
if k == "n" then
if dancing then return end
if not sitting then
dancing = true
gangnam = true
gangy_style:play()
end
end
if k == "r" then
if dancing then return end
if not sitting then
dancing = true
burndem = true
burn_dem:play()
end
end
if k == "x" then
if dancing then return end
if not sitting then
dancing = true
barrelroll = true
barrel_roll:play()
hat = Instance.new("Part", char)
hat.FormFactor = "Custom"
hat.CanCollide = false
hat.Size = torso.Size
hat.Locked = true
hat:breakJoints()
local hatmesh = Instance.new("SpecialMesh", hat)
hatmesh.MeshId = "http://www.roblox.com/asset/?id=29873142"
hatmesh.TextureId = "http://www.roblox.com/asset/?id=31467063"
hatmesh.Scale = Vector3.new(.22, .2, .22)
local hatweld = Instance.new("Weld", hat)
hatweld.Part0 = hat
hatweld.Part1 = torso
end
end
if k == "h" then
if dancing then return end
if not sitting then
dancing = true
heman:play()
heya = true
hat = Instance.new("Part", char)
hat.FormFactor = "Custom"
hat.CanCollide = false
hat.Size = torso.Size + Vector3.new(0.01, 0.01, 0.01)
hat.Locked = true
hat.BrickColor = BrickColor.new("Hot pink")
hat:breakJoints()
local hatweld = Instance.new("Weld", hat)
hatweld.Part0 = hat
hatweld.Part1 = torso
end
end
if k == "j" then
if dancing then return end
if not sitting then
dancing = true
justin:play()
jb = true
hat = Instance.new("Part", char)
hat.FormFactor = "Custom"
hat.CanCollide = false
hat.Size = head.Size
hat.Locked = true
hat.BrickColor = BrickColor.new("Hot pink")
hat:breakJoints()
local hatmesh = Instance.new("SpecialMesh", hat)
hatmesh.MeshId = "http://www.roblox.com/asset/?id=19999424"
hatmesh.TextureId = "http://www.roblox.com/asset/?id=20571982"
hatmesh.Scale = Vector3.new(.23, .23, .23)
local hatweld = Instance.new("Weld", hat)
hatweld.Part0 = hat
hatweld.Part1 = head
hatweld.C0 = CFrame.new(0.025, -0.05, 0)
end
end
if k == "c" then
if dancing then return end
if not sitting then
dancing = true
dubstepgun = true
dubstep_gun:play()
end
end
if k == "v" then
if dancing then return end
if not sitting then
dancing = true
youpirate = true
you_are_pirate:play()
hat = Instance.new("Part", char)
hat.FormFactor = "Custom"
hat.CanCollide = false
hat.Size = head.Size
hat.Locked = true
hat:breakJoints()
local hatmesh = Instance.new("SpecialMesh", hat)
hatmesh.MeshId = "http://www.roblox.com/asset/?id=1028848"
hatmesh.TextureId = "http://www.roblox.com/asset/?id=1028847"
hatmesh.Scale = Vector3.new(.2, .2, .2)
local hatweld = Instance.new("Weld", hat)
hatweld.Part0 = hat
hatweld.Part1 = head
hatweld.C0 = CFrame.new(0, -0.15, 0)
end
end
if k == "m" then
if dancing then return end
if not sitting then
dancing = true
canttouch = true
cant_touch:play()
end
end
if k == "b" then
if dancing then return end
if not sitting then
dancing = true
bronymusic = true
brony_music:play()
for _,bp in pairs(char:children()) do
if bp:IsA("BasePart") then
bp.BrickColor = BrickColor.new("Lavender")
end
end
hat = Instance.new("Part", char)
hat.FormFactor = "Custom"
hat.CanCollide = false
hat.Size = head.Size
hat.Locked = true
hat.BrickColor = BrickColor.new("Lavender")
hat:breakJoints()
local hatmesh = Instance.new("SpecialMesh", hat)
hatmesh.MeshId = "http://www.roblox.com/asset/?id=118186643"
hatmesh.Scale = Vector3.new(.1, .2, .1)
local hatweld = Instance.new("Weld", hat)
hatweld.Part0 = hat
hatweld.Part1 = head
hatweld.C0 = CFrame.new(0, -0.1, 0.05)
end
end
if k == "l" then
if dancing then return end
if not sitting then
dancing = true
foxie = true
fox_say:play()
hat = Instance.new("Part", char)
hat.FormFactor = "Custom"
hat.CanCollide = false
hat.Size = head.Size
hat.Locked = true
hat:breakJoints()
local hatmesh = Instance.new("SpecialMesh", hat)
hatmesh.MeshId = "http://www.roblox.com/asset/?id=25266225"
hatmesh.TextureId = "http://www.roblox.com/asset/?id=25266210"
hatmesh.Scale = Vector3.new(.2, .2, .2)
local hatweld = Instance.new("Weld", hat)
hatweld.Part0 = hat
hatweld.Part1 = head
hatweld.C0 = CFrame.new(0, -0.1, 0)
end
end
if k == "f" then
if dancing then return end
if not sitting then
dancing = true
durka = true
durk:play()
end
end
if k == "g" then
if dancing then return end
if not sitting then
dancing = true
saxguy = true
sax_guy:play()
hat = Instance.new("Part", char)
hat.FormFactor = "Custom"
hat.CanCollide = false
hat.Size = head.Size
hat.Locked = true
hat:breakJoints()
local hatmesh = Instance.new("SpecialMesh", hat)
hatmesh.MeshId = "http://www.roblox.com/asset/?id=44410178"
hatmesh.TextureId = "http://www.roblox.com/asset/?id=44410320"
hatmesh.Scale = Vector3.new(.25, .25, .25)
local hatweld = Instance.new("Weld", hat)
hatweld.Part0 = hat
hatweld.Part1 = la
hatweld.C0 = CFrame.new(-0.18, -0.05, .04) * CFrame.Angles(math.pi - math.rad(18), 0, math.pi/4)
end
end
if k == "q" then
if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 14 then return end
if sitting then return end
looking = true
rj.C0 = CFrame.new(-math.pi/6, 0,0) * CFrame.Angles(0, 0, math.pi/4)
end
if k == "e" then
if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 14 then return end
if sitting then return end
looking = true
rj.C0 = CFrame.new(math.pi/6, 0,0) * CFrame.Angles(0, 0, -math.pi/4)
end
if string.byte(k) == 48 or string.byte(k) == 47 then
if sitting then return end
humanoid.WalkSpeed = 18
end
if string.byte(k) == 52 then
if sitting then return end
humanoid.WalkSpeed = 6
end
end)
mouse.KeyUp:connect(function(k)
if string.byte(k) == 48 or string.byte(k) == 47 then
if sitting then return end
humanoid.WalkSpeed = 11
end
if k == "w" or k == "a" or k == "s" or k == "d" or string.byte(k) == 32 then
superannoying = false
barrelroll = false
heya = false
dubstepgun = false
youpirate = false
canttouch = false
gangnam = false
sheddy = false
durka = false
saxguy = false
foxie = false
burndem = false
bronymusic = false
brony_music:stop()
fox_say:stop()
spitfire:stop()
heman:stop()
justin:stop()
jb = false
durk:stop()
restorecolors()
burn_dem:stop()
if hat then
hat:Destroy()
end
sax_guy:stop()
gangy_style:stop()
cant_touch:stop()
you_are_pirate:stop()
dubstep_gun:stop()
super_annoying:stop()
barrel_roll:stop()
dancing = false
global_wait = 0
LightForTorso.Color = torso.BrickColor.Color
end
if k == "q" then
if looking then
if sitting then return end
rj.C0 = CFrame.new()
looking = false
end
end
if k == "e" then
if looking then
if sitting then return end
rj.C0 = CFrame.new()
looking = false
end
end
end)
game:service'RunService'.Stepped:connect(function()
count = (count % 100) + countspeed
angle = math.pi * math.sin(math.pi*2/100*count)
if slidecount < slidecountmax then
slidecount = slidecount + speed
end
if slidecount > slidecountmax then
slidecount = slidecount - speed
end
if global_wait == 380 then global_wait = 0 end
sine = sine + sinespeed
if not dancing then
if not sitting then
local ray = Ray.new(rootpart.Position, Vector3.new(0, -1, 0))
local hitz, enz = workspace:FindPartOnRay(ray, char)
if not hitz then
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles((math.pi/8/5*slidecount) + math.pi + angle*0.05, 0, 0)
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles((math.pi/8/5*slidecount) + math.pi + -angle*0.05, 0, 0)
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(-angle*0.28, 0, 0)
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(angle*0.28, 0, 0)
if not looking then
rj.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(-math.pi/8/5*slidecount, 0, 0)
end
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.pi/8/5*slidecount, 0, 0)
elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 2 then
-- idle anim
anim = "Idle"
if anim ~= lastanim then
if lastanim == "Walking" then
speed = 0.5
slidecount = 1
slidecountmax = 0
elseif lastanim == "Running" then
speed = 2.5
slidecount = 5
slidecountmax = 0
else
slidecount = 0
slidecountmax = 0
end
end
countspeed = 1
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(angle*0.02, 0, 0)
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(-angle*0.02, 0, 0)
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(-angle*0.01, 0, 0)
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(angle*0.01, 0, 0)
if not looking then
rj.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(-math.pi/8/5*slidecount, 0, 0)
end
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.pi/8/5*slidecount, 0, 0)
elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude < 14 then
looking = false
-- walk anim
anim = "Walking"
if anim ~= lastanim then
speed = 0.2
slidecount = 0
slidecountmax = 1
if lastanim == "Running" then
slidecount = 5
end
end
countspeed = 6
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(angle*0.3, 0, math.abs(angle*0.02))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(-angle*0.3, 0, -math.abs(angle*0.02))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(-angle*0.28, 0, -math.abs(angle*0.01))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(angle*0.28, 0, math.abs(angle*0.01))
rj.C0 = CFrame.new(0, math.abs(-angle*0.035), 0) * CFrame.Angles(-math.pi/8/5*slidecount, 0, 0)
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.pi/8/5*slidecount, 0, 0)
elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 14 then
--run anim
anim = "Running"
if anim ~= lastanim then
speed = 1
slidecount = 0
slidecountmax = 5
if lastanim == "Walking" then
slidecount = 1
end
end
looking = false
countspeed = 9
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(angle*0.4, 0, math.abs(angle*0.07))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(-angle*0.4, 0, -math.abs(angle*0.07))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(-angle*0.38, 0, -math.abs(angle*0.03))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(angle*0.38, 0, math.abs(angle*0.03))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.pi/8/5*slidecount, 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.055), 0) * CFrame.Angles(-math.pi/8/5*slidecount, math.sin(angle*0.05), 0)
end
lastanim = anim
else
countspeed = 1
local ray = Ray.new(rootpart.Position, Vector3.new(0, -2, 0))
local hitz, enz = workspace:FindPartOnRay(ray, char)
if not hitz then
rj.C0 = CFrame.new(0, -0.5, 0) * CFrame.Angles(-math.pi/2, 0, 0)
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(math.rad(30), 0, -math.pi/16)
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(math.rad(30), 0, math.pi/16)
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(-math.pi-math.rad(30), 0, -math.pi/10)
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(-math.pi-math.rad(30), 0, math.pi/10)
else
rj.C0 = CFrame.new(0, -0.35, 0) * CFrame.Angles(math.rad(10), 0, 0)
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(math.pi/2-math.rad(10), 0, -math.pi/16)
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(math.pi/2-math.rad(10), 0, math.pi/16)
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(-math.rad(10), 0, -math.pi/10)
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(-math.rad(10), 0, math.pi/10)
end
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(angle*0.055, 0, 0)
end
else
if superannoying then
countspeed = 5
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi/2 + angle*0.2, 0, math.abs(angle*0.07))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi/2 + angle*0.2, 0, -math.abs(angle*0.07))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(angle*0.1, 0, -math.abs(angle*0.03))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-angle*0.1, 0, math.abs(angle*0.03))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.035), 0) * CFrame.Angles(0, math.sin(angle*0.15), 0)
elseif barrelroll then
countspeed = 5
sinespeed = 0.1
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi + angle*0.2, 0, math.abs(angle*0.07))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi + angle*0.2, 0, -math.abs(angle*0.07))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(0, 0, -math.abs(angle*0.03))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(0, 0, math.abs(angle*0.03))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(math.sin(sine)*2.5, 0, 0) * CFrame.Angles(-math.pi/2, math.sin(sine)*4.5, 0)
elseif dubstepgun then
global_wait = (global_wait % 380) + 1
countspeed = 5
if global_wait < 249 - 40 then
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi/2 + angle*0.2, 0, -math.abs(angle*0.27))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi/2 + angle*0.2, 0, math.abs(angle*0.27))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(angle*0.1, 0, -math.abs(angle*0.03))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-angle*0.1, 0, math.abs(angle*0.03))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.035), 0) * CFrame.Angles(0, math.sin(angle*0.15), 0)
elseif global_wait > 249 - 40 then
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi/2 + angle*0.4, 0, math.abs(angle*0.11))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi + angle*0.2, 0, -math.abs(angle*0.11))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(angle*0.1, 0, -math.abs(angle*0.09))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-angle*0.1, 0, math.abs(angle*0.09))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.075), 0) * CFrame.Angles(0, math.pi/3 + math.sin(angle*0.15), 0)
end
elseif youpirate then
global_wait = (global_wait % 380) + 1
countspeed = 5
if global_wait < 79 then
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi/2 + angle*0.1, 0, -math.abs(angle*0.07))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(angle*0.2, 0, math.abs(angle*0.07))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(angle*0.1, 0, -math.abs(angle*0.03))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-angle*0.1, 0, math.abs(angle*0.03))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.02), 0) * CFrame.Angles(0, math.sin(angle*0.15), 0)
elseif global_wait < 299 then
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi + angle*0.2, 0, math.abs(angle*0.11))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi + angle*0.2, 0, -math.abs(angle*0.11))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(angle*0.2, 0, -math.abs(angle*0.1))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-angle*0.2, 0, math.abs(angle*0.1))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), math.sin(angle*0.19), 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.055+0.2), 0) * CFrame.Angles(0, math.sin(angle*0.15), 0)
elseif global_wait > 299 then
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi/2 + angle*0.1, 0, -math.abs(angle*0.07))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(angle*0.2, 0, math.abs(angle*0.07))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(angle*0.1, 0, -math.abs(angle*0.03))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-angle*0.1, 0, math.abs(angle*0.03))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.02), 0) * CFrame.Angles(0, math.sin(angle*0.15), 0)
end
elseif canttouch then
countspeed = 5
global_wait = (global_wait % 160) + 1
if global_wait == 160 then global_wait = 0 end
if global_wait < 39 then
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi/2 + angle*0.2, 0, -math.abs(angle*0.07))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi/2 + angle*0.2, 0, math.abs(angle*0.07))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(angle*0.1, 0, -math.abs(angle*0.03))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-angle*0.1, 0, math.abs(angle*0.03))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.03), 0) * CFrame.Angles(0, -math.pi/6, 0)
elseif global_wait < 79 then
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi/2 + angle*0.2, 0, -math.abs(angle*0.07))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi/2 + angle*0.2, 0, math.abs(angle*0.07))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(angle*0.1, 0, -math.abs(angle*0.03))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-angle*0.1, 0, math.abs(angle*0.03))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.03), 0) * CFrame.Angles(0, math.pi/6, 0)
elseif global_wait < 119 then
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(0.01, 0, 0.17)
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(0.01, 0, -0.17)
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(0, -math.abs(angle*0.05), -math.abs(angle*0.06))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(0, -math.abs(angle*0.05), math.abs(angle*0.06))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.02), 0) * CFrame.Angles(0, 0, 0)
torso.CFrame = torso.CFrame * CFrame.new(0.05, 0, 0)
elseif global_wait > 119 then
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(0.01, 0, 0.17)
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(0.01, 0, -0.17)
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(0, -math.abs(angle*0.05), -math.abs(angle*0.06))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(0, -math.abs(angle*0.05), math.abs(angle*0.06))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.02), 0) * CFrame.Angles(0, 0, 0)
torso.CFrame = torso.CFrame * CFrame.new(-0.05, 0, 0)
end
elseif gangnam then
countspeed = 5
if global_wait == 180 then global_wait = 0 end
global_wait = (global_wait % 180) + 1
if global_wait < 89 then
ls.C0 = CFrame.new(-.2,.1,-.1) * CFrame.Angles(math.pi/2.5 + math.abs(angle*0.2), 0, math.pi/3 + math.abs(angle*0.05))
rs.C0 = CFrame.new(.2,.1,-.1) * CFrame.Angles(math.pi/2.5 + math.abs(angle*0.2), 0, -math.pi/3 + -math.abs(angle*0.05))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, -math.abs(angle*0.03))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-math.abs(angle*0.1), 0, math.abs(angle*0.03))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.035), 0) * CFrame.Angles(0, math.sin(angle*0.05), 0)
elseif global_wait > 89 then
ls.C0 = CFrame.new(-.2,.1,-.1) * CFrame.Angles(math.pi/2.5 + math.abs(angle*0.2), 0, math.pi/3 + math.abs(angle*0.05))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi + math.sin(angle*0.1), 0, -math.sin(angle*0.1))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, -math.abs(angle*0.03))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-math.abs(angle*0.1), 0, math.abs(angle*0.03))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.035), 0) * CFrame.Angles(0, math.sin(angle*0.05), 0)
end
elseif foxie then
countspeed = 5
global_wait = (global_wait % 380) + 2
if global_wait < 89 then
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi + math.abs(angle*0.1), 0, -math.abs(angle*0.2))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi + math.abs(angle*0.1), 0, math.abs(angle*0.2))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, -math.abs(angle*0.03))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-math.abs(angle*0.1), 0, math.abs(angle*0.03))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.035), 0) * CFrame.Angles(0, math.rad(global_wait*4), 0)
elseif global_wait > 89 then
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi/2 + math.abs(angle*0.2), 0, math.abs(angle*0.05))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi/2 + math.abs(angle*0.2), 0, -math.abs(angle*0.05))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, -math.abs(angle*0.03))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-math.abs(angle*0.1), 0, math.abs(angle*0.03))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, math.sin(angle*0.1))
rj.C0 = CFrame.new(0, math.abs(-angle*.035), 0) * CFrame.Angles(0, math.sin(angle*0.05), 0)
end
elseif durka then
countspeed = 2
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi/2 + math.abs(angle*0.2), 0, math.abs(angle*0.07))
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(angle*0.1, 0, -math.abs(angle*0.07))
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(angle*0.05, 0, -math.abs(angle*0.03))
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-angle*0.05, 0, math.abs(angle*0.03))
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
rj.C0 = CFrame.new(0, math.abs(-angle*.035), 0) * CFrame.Angles(0, math.sin(angle*0.05), 0)
elseif saxguy then
countspeed = 5
ls.C0 = CFrame.new(-.25,.1,-.1) * CFrame.Angles(math.pi/2.5, 0, math.pi/4)
rs.C0 = CFrame.new(.25,.1,-.1) * CFrame.Angles(math.rad(60), 0, -math.pi/4)
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(-math.abs(angle*0.1), 0, -0.06)
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-math.abs(angle*0.1), 0, 0.06)
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(0, 0, 0)
rj.C0 = CFrame.new(0, -math.abs(angle*0.01), math.abs(angle*0.01)) * CFrame.Angles(math.abs(angle*0.1), 0, 0)
elseif heya then
countspeed = 5
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi + -angle*0.2, -angle*0.1, 0)
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi + angle*0.2, angle*0.1, 0)
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(angle*0.05, angle*0.1, -0.06)
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-angle*0.05, -angle*0.1, 0.06)
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(0.2), 0, 0)
rj.C0 = CFrame.new(0, math.abs(angle*0.05), 0) * CFrame.Angles(0, math.sin(angle*0.07), 0)
elseif jb then
countspeed = 5
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi/2 + -angle*0.2, -angle*0.1, 0)
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi/2 + angle*0.2, angle*0.1, 0)
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(angle*0.05, angle*0.1, -0.06)
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-angle*0.05, -angle*0.1, 0.06)
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(0.2), 0, 0)
rj.C0 = CFrame.new(0, math.abs(angle*0.05), 0) * CFrame.Angles(0, math.abs(angle*0.1), 0)
elseif bronymusic then
countspeed = 5
ls.C0 = CFrame.new(-.1,.1,-.15) * CFrame.Angles(math.pi/2 + -angle*0.1, -angle*0.1, 0)
rs.C0 = CFrame.new(.1,.1,-.15) * CFrame.Angles(math.pi/2 + angle*0.1, angle*0.1, 0)
lh.C0 = CFrame.new(-.1,-.25,0) * CFrame.Angles(math.pi/2 + angle*0.1, 0, 0)
rh.C0 = CFrame.new(.1,-.25,0) * CFrame.Angles(math.pi/2 + -angle*0.1, 0, 0)
neck.C0 = CFrame.new(0,.25,0) * CFrame.Angles(math.pi/2 + math.abs(angle*0.25), 0, 0)
rj.C0 = CFrame.new(0, -0.2 + math.abs(angle*0.05), 0) * CFrame.Angles(-math.rad(85), 0, 0)
elseif sheddy then
countspeed = 7
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi/4 + -angle*0.4, -angle*0.1, 0)
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi/4 + angle*0.4, angle*0.1, 0)
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(angle*0.05, angle*0.1, -0.06)
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-angle*0.05, -angle*0.1, 0.06)
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(0.2), 0, 0)
rj.C0 = CFrame.new(0, math.abs(angle*0.05), 0) * CFrame.Angles(0, math.abs(angle*0.1), 0)
elseif burndem then
countspeed = 4
ls.C0 = CFrame.new(-.3,.1,0) * CFrame.Angles(math.pi/4 + -angle*0.4, -angle*0.1, 0)
rs.C0 = CFrame.new(.3,.1,0) * CFrame.Angles(math.pi/4 + angle*0.4, angle*0.1, 0)
lh.C0 = CFrame.new(-.1,-.2,0) * CFrame.Angles(angle*0.05, angle*0.1, -0.06)
rh.C0 = CFrame.new(.1,-.2,0) * CFrame.Angles(-angle*0.05, -angle*0.1, 0.06)
neck.C0 = CFrame.new(0,.2,0) * CFrame.Angles(math.abs(0.2), 0, 0)
rj.C0 = CFrame.new(0, math.abs(angle*0.05), 0) * CFrame.Angles(0, math.abs(angle*0.1), 0)
end
end
end)
plr.Chatted:connect(function(msg)
game:service'Chat':Chat(head, msg, 1)
if msg == "die/" then
char:breakJoints()
end
end)
end)
if not ran and err then
print(err)
end
|
---------------------------------------------------------------------------------------------------
-- User story: TBD
-- Use case: TBD
--
-- Requirement summary:
-- [SDL_RC] TBD
--
-- Description: SDL shall not send OnRCStatus notifications to rc registered apps
-- by allocation module via GetInteriorVehicleData
-- In case:
-- 1) RC app1 is registered
-- 2) RC app2 is registered
-- 3) Mobile applications subscribe to module via GetInteriorVehicleData one by one
-- SDL must:
-- 1) Not send OnRCStatus notification to RC applications by module subscribing
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('test_scripts/RC/OnRCStatus/commonOnRCStatus')
--[[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
--[[ Local Functions ]]
local function subscribeToModuleWOOnRCStatus(pModuleType)
common.subscribeToModule(pModuleType)
common.getMobileSession(1):ExpectNotification("OnRCStatus")
:Times(0)
common.getMobileSession(2):ExpectNotification("OnRCStatus")
:Times(0)
EXPECT_HMINOTIFICATION("RC.OnRCStatus")
:Times(0)
end
--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Register RC application 1", common.registerRCApplication, { 1 })
runner.Step("Activate App 1", common.activateApp, { 1 })
runner.Step("Register RC application 2", common.registerRCApplication, { 2 })
runner.Title("Test")
for _, mod in pairs(common.getAllModules()) do
runner.Step("GetInteriorVehicleData " .. mod, subscribeToModuleWOOnRCStatus, { mod })
end
runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
|
function loadthings()
local txd = engineLoadTXD ( "speeds.txd" )
engineImportTXD ( txd, 1444 )
end
local dxlabel = {
{1692.41, -683.77, 45.4,"120 KM/H"},
{1723.19, -876.78, 57.81 ,"120 KM/H"},
{1671.93, -65.04, 35.92 ,"150 KM/H"},
{1595.1, 92.6, 37.79 ,"180 KM/H"},
{1732.59, 1632.17, 9.16 ,"90 KM/H"},
{457.93, 754.08, 4.91 ,"150 KM/H"},
{-1077.13, 1196.5, 39.24 ,"130 KM/H"},
{-1147.39, 1092.01, 39.43 ,"130 KM/H"},
{-1563.4, 482.86, 7.17 ,"100 KM/H"},
{-1567.67, 669.15, 7.18 ,"100 KM/H"},
{-1809.58, -638.06, 17.04 ,"140 KM/H"},
{-1740.8, -570.2, 16.48 ,"140 KM/H"},
{-1753.77, -618.43, 17.09 ,"140 KM/H"},
{-1830.96, -490.22, 15.1 ,"140 KM/H"},
{423.67, -1695.27, 9.87 ,"150 KM/H"},
{276.94, -1710.2, 7.71 ,"150 KM/H"},
{1264.11, -1410.87, 13.18 ,"180 KM/H"},
{1353.88, -1477.61, 13.54,"180 KM/H"},
{1337.1, -1289.83, 13.54,"180 KM/H"},
{1419.44, -1390.44, 13.39,"180 KM/H"},
{572.66, -1163.98, 25.9,"180 KM/H"},
{645.68, -1286.77, 15.9,"180 KM/H"},
{563.13, -1247.77, 17.28,"180 KM/H"},
{672.12, -1162.56, 15.34,"180 KM/H"},
}
r,g,b = 255,0,0
setTimer(function()
if r == 255 then
r,g,b = 0,100,200
else
r,g,b = 255,0,0
end
end,500,0)
function showTextOnTopOfPed()
local x, y, z = getElementPosition(localPlayer)
for k,v in ipairs(dxlabel) do
local mX, mY, mZ = v[1], v[2], v[3]
local jobb = v[4]
local sx, sy = getScreenFromWorldPosition(mX, mY, mZ+4)
if (sx) and (sy) then
local distance = getDistanceBetweenPoints3D(x, y, z, mX, mY, mZ)
if (distance < 80) then
if isPedInVehicle(localPlayer) then
dxDrawText("Reduce Speed (Max KM/H) : "..jobb, sx+2, sy+2, sx, sy, tocolor(r,g,b, 255), 2-(distance/60), "default-bold", "center", "center")
end
end
end
end
end
addEventHandler("onClientRender",root,showTextOnTopOfPed)
setTimer(function()
for k,v in ipairs(getElementsByType("object")) do
if getElementData(v,"speedCam") == true then
setObjectBreakable(v, false)
end
end
end,10000,0)
loadthings()
|
return {'kadaster','kadasterkaarten','kadastraal','kadastreren','kadastrering','kadaver','kadaverdiscipline','kaddisj','kade','kadee','kadegeld','kademuur','kaden','kader','kaderakkoord','kaderbrief','kadercursus','kaderen','kaderfunctie','kaderlid','kaderlijnen','kadernota','kaderopleiding','kaderovereenkomst','kaderpersoneel','kaderprogramma','kaderscholing','kaderschool','kaderspel','kaderstelling','kadervorming','kaderwerk','kaderwerving','kaderwet','kadet','kadetje','kadewerker','kadi','kadraai','kadraaier','kadreren','kadrering','kaduuk','kaderstuk','kaderrichtlijn','kaderbesluit','kaderregeling','kaderstellend','kadasterkaart','kadering','kader','kadir','kadijk','kaddouri','kadasterwet','kadastrale','kadavers','kadees','kadeetje','kadeeen','kadegelden','kademuren','kadercursussen','kaderfuncties','kaderleden','kaders','kaderscholen','kaderstukje','kadertje','kadertjes','kadetjes','kadetten','kadraaiers','kadreer','kadreerde','kadreert','kaduke','kadastreerde','kadavertje','kaderde','kadert','kaderwetten','kades','kadewerkers','kadasters','kaduker','kaduukst','kadaverdisciplines','kaddisjen','kadis','kaderstellende','kaders','kadirs','kadavertjes'}
|
Character = {}
Character.__index = Character
function Character:Create(def, map)
-- Look up the entity
local entityDef = gEntities[def.entity]
assert(entityDef) -- The entity should always exist!
local this =
{
mDef = def,
mEntity = Entity:Create(entityDef),
mAnims = def.anims,
mFacing = def.facing,
mDefaultState = def.state,
}
setmetatable(this, self)
-- Create the controller states from the def
local states = {}
-- Make the controller state machine from the states
this.mController = StateMachine:Create(states)
for _, name in ipairs(def.controller) do
local state = gCharacterStates[name]
assert(state)
assert(states[state.mName] == nil)
local instance = state:Create(this, map)
states[state.mName] = function() return instance end
end
this.mController.states = states
-- Change the statemachine to the initial state
-- as definied in the def
this.mController:Change(def.state)
return this
end
function Character:GetFacedTileCoords()
-- Change the facing information into a tile offset
local xInc = 0
local yInc = 0
if self.mFacing == "left" then
xInc = -1
elseif self.mFacing == "right" then
xInc = 1
elseif self.mFacing == "up" then
yInc = -1
elseif self.mFacing == "down" then
yInc = 1
end
local x = self.mEntity.mTileX + xInc
local y = self.mEntity.mTileY + yInc
return x, y
end
function Character:SetFacingForCombat()
self.mFacing = "left"
local x = self.mEntity.mX
if x < 0 then
self.mFacing = "right"
end
end
function Character:GetCombatAnim(id)
if self.mAnims and self.mAnims[id] then
return self.mAnims[id]
else
return { self.mEntity.mStartFrame }
end
end
function Character:FollowPath(path)
self.mPathIndex = 1
self.mPath = path
self.mPrevDefaultState = self.mDefaultState
self.mDefaultState = "follow_path"
self.mController:Change("follow_path")
end
|
local AddonName = ...
local L = LibStub("AceLocale-3.0"):NewLocale(AddonName, "deDE")
if not L then return end
L.Updated = "Aktualisiert auf v%s"
L.Pulse = "Pulse"
L.Shine = "Shine"
|
local rcvboxes = {
{ -3/16, -3/16, -8/16 , 3/16, 3/16 , -13/32 }, -- the smaller bump
{ -1/32, -1/32, -3/2 , 1/32, 1/32 , -1/2 }, -- the wire through the block
{ -2/32, -1/2 , -.5 , 2/32, 0 , -.5002+3/32 }, -- the vertical wire bit
{ -2/32, -1/2 , -7/16+0.002 , 2/32, -14/32, 16/32+0.001 } -- the horizontal wire
}
local down_rcvboxes = {
{-6/16, -8/16, -6/16, 6/16, -7/16, 6/16}, -- Top plate
{-2/16, -6/16, -2/16, 2/16, -7/16, 2/16}, -- Bump
{-1/16, -8/16, -1/16, 1/16, -24/16, 1/16}, -- Wire through the block
{-1/16, -8/16, 6/16, 1/16, -7/16, 8/16}, -- Plate extension (North)
{-1/16, -8/16, -6/16, 1/16, -7/16, -8/16}, -- Plate extension (South)
{-8/16, -8/16, 1/16, -6/16, -7/16, -1/16}, -- Plate extension (West)
{6/16, -8/16, 1/16, 8/16, -7/16, -1/16}, -- Plate extension (East)
}
local up_rcvboxes = {
{-6/16, -8/16, -6/16, 6/16, -7/16, 6/16}, -- Top plate
{-2/16, -6/16, -2/16, 2/16, -7/16, 2/16}, -- Bump
{-1/16, -6/16, -1/16, 1/16, 24/16, 1/16}, -- Wire through the block
{-1/16, -8/16, 6/16, 1/16, -7/16, 8/16}, -- Plate extension (North)
{-1/16, -8/16, -6/16, 1/16, -7/16, -8/16}, -- Plate extension (South)
{-8/16, -8/16, 1/16, -6/16, -7/16, -1/16}, -- Plate extension (West)
{6/16, -8/16, 1/16, 8/16, -7/16, -1/16}, -- Plate extension (East)
}
local receiver_get_rules = function (node)
local rules = { {x = 1, y = 0, z = 0},
{x = -2, y = 0, z = 0}}
if node.param2 == 2 then
rules = mesecon.rotate_rules_left(rules)
elseif node.param2 == 3 then
rules = mesecon.rotate_rules_right(mesecon.rotate_rules_right(rules))
elseif node.param2 == 0 then
rules = mesecon.rotate_rules_right(rules)
end
return rules
end
mesecon.register_node("mesecons_receiver:receiver", {
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
sunlight_propagates = true,
walkable = false,
on_rotate = false,
selection_box = {
type = "fixed",
fixed = { -3/16, -8/16, -8/16, 3/16, 3/16, 8/16 }
},
node_box = {
type = "fixed",
fixed = rcvboxes
},
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons:wire_00000000_off",
sounds = default.node_sound_defaults(),
}, {
tiles = {
"receiver_top_off.png",
"receiver_bottom_off.png",
"receiver_lr_off.png",
"receiver_lr_off.png",
"receiver_fb_off.png",
"receiver_fb_off.png",
},
mesecons = {conductor = {
state = mesecon.state.off,
rules = receiver_get_rules,
onstate = "mesecons_receiver:receiver_on"
}}
}, {
tiles = {
"receiver_top_on.png",
"receiver_bottom_on.png",
"receiver_lr_on.png",
"receiver_lr_on.png",
"receiver_fb_on.png",
"receiver_fb_on.png",
},
mesecons = {conductor = {
state = mesecon.state.on,
rules = receiver_get_rules,
offstate = "mesecons_receiver:receiver_off"
}}
})
mesecon.register_node("mesecons_receiver:receiver_up", {
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
sunlight_propagates = true,
walkable = false,
on_rotate = false,
selection_box = {
type = "fixed",
fixed = up_rcvboxes
},
node_box = {
type = "fixed",
fixed = up_rcvboxes
},
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons:wire_00000000_off",
sounds = default.node_sound_defaults(),
}, {
tiles = {"mesecons_wire_off.png"},
mesecons = {conductor = {
state = mesecon.state.off,
rules = {{x=1, y=0, z=0},
{x=-1, y=0, z=0},
{x=0, y=0, z=1},
{x=0, y=0, z=-1},
{x=0, y=1, z=0},
{x=0, y=2, z=0}},
onstate = "mesecons_receiver:receiver_up_on"
}}
}, {
tiles = {"mesecons_wire_on.png"},
mesecons = {conductor = {
state = mesecon.state.on,
rules = {{x=1, y=0, z=0},
{x=-1, y=0, z=0},
{x=0, y=0, z=1},
{x=0, y=0, z=-1},
{x=0, y=1, z=0},
{x=0, y=2, z=0}},
offstate = "mesecons_receiver:receiver_up_off"
}}
})
mesecon.register_node("mesecons_receiver:receiver_down", {
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
sunlight_propagates = true,
walkable = false,
on_rotate = false,
selection_box = {
type = "fixed",
fixed = down_rcvboxes
},
node_box = {
type = "fixed",
fixed = down_rcvboxes
},
groups = {dig_immediate = 3, not_in_creative_inventory = 1},
drop = "mesecons:wire_00000000_off",
sounds = default.node_sound_defaults(),
}, {
tiles = {"mesecons_wire_off.png"},
mesecons = {conductor = {
state = mesecon.state.off,
rules = {{x=1,y=0, z=0},
{x=-1,y=0, z=0},
{x=0, y=0, z=1},
{x=0, y=0, z=-1},
{x=0, y=-2,z=0}},
onstate = "mesecons_receiver:receiver_down_on"
}}
}, {
tiles = {"mesecons_wire_on.png"},
mesecons = {conductor = {
state = mesecon.state.on,
rules = {{x=1,y=0, z=0},
{x=-1,y=0, z=0},
{x=0, y=0, z=1},
{x=0, y=0, z=-1},
{x=0, y=-2,z=0}},
offstate = "mesecons_receiver:receiver_down_off"
}}
})
function mesecon.receiver_get_pos_from_rcpt(pos, param2)
local rules = {{x = 2, y = 0, z = 0}}
if param2 == nil then param2 = minetest.get_node(pos).param2 end
local rcvtype = "mesecons_receiver:receiver_off"
local dir = minetest.facedir_to_dir(param2)
if dir.x == 1 then
-- No action needed
elseif dir.z == -1 then
rules = mesecon.rotate_rules_left(rules)
elseif dir.x == -1 then
rules = mesecon.rotate_rules_right(mesecon.rotate_rules_right(rules))
elseif dir.z == 1 then
rules = mesecon.rotate_rules_right(rules)
elseif dir.y == -1 then
rules = mesecon.rotate_rules_up(rules)
rcvtype = "mesecons_receiver:receiver_up_off"
elseif dir.y == 1 then
rules = mesecon.rotate_rules_down(rules)
rcvtype = "mesecons_receiver:receiver_down_off"
end
local np = { x = pos.x + rules[1].x,
y = pos.y + rules[1].y,
z = pos.z + rules[1].z}
return np, rcvtype
end
function mesecon.receiver_place(rcpt_pos)
local node = minetest.get_node(rcpt_pos)
local pos, rcvtype = mesecon.receiver_get_pos_from_rcpt(rcpt_pos, node.param2)
local nn = minetest.get_node(pos)
local param2 = minetest.dir_to_facedir(minetest.facedir_to_dir(node.param2))
if string.find(nn.name, "mesecons:wire_") ~= nil then
minetest.set_node(pos, {name = rcvtype, param2 = param2})
mesecon.on_placenode(pos, nn)
end
end
function mesecon.receiver_remove(rcpt_pos, dugnode)
local pos = mesecon.receiver_get_pos_from_rcpt(rcpt_pos, dugnode.param2)
local nn = minetest.get_node(pos)
if string.find(nn.name, "mesecons_receiver:receiver_") ~= nil then
local node = {name = "mesecons:wire_00000000_off"}
minetest.set_node(pos, node)
mesecon.on_placenode(pos, node)
end
end
minetest.register_on_placenode(function (pos, node)
if minetest.get_item_group(node.name, "mesecon_needs_receiver") == 1 then
mesecon.receiver_place(pos)
end
end)
minetest.register_on_dignode(function(pos, node)
if minetest.get_item_group(node.name, "mesecon_needs_receiver") == 1 then
mesecon.receiver_remove(pos, node)
end
end)
minetest.register_on_placenode(function (pos, node)
if string.find(node.name, "mesecons:wire_") ~= nil then
local rules = { {x = 2, y = 0, z = 0},
{x =-2, y = 0, z = 0},
{x = 0, y = 0, z = 2},
{x = 0, y = 0, z =-2},
{x = 0, y = 2, z = 0},
{x = 0, y = -2, z = 0}}
local i = 1
while rules[i] ~= nil do
local np = { x = pos.x + rules[i].x,
y = pos.y + rules[i].y,
z = pos.z + rules[i].z}
if minetest.get_item_group(minetest.get_node(np).name, "mesecon_needs_receiver") == 1 then
mesecon.receiver_place(np)
end
i = i + 1
end
end
end)
function mesecon.buttonlike_onrotate(pos, node)
minetest.after(0, mesecon.receiver_remove, pos, node)
minetest.after(0, mesecon.receiver_place, pos)
end
|
-- Intents for plot/endgame factions.
-- appease ram checker
-- ns:joinFaction()
local log = require 'log'
local fc = require 'intent.faction-common'
local factions = table.List {
-- TODO take into account how long it'll take to grind up these stats based on
-- character multipliers and stuff
{ name = "The Covenant"; augs = 20; money = 75e9; hack = 850; combat = 850; };
{ name = "Daedalus"; augs = 30; money = 100e9; hack = 2500; combat = 0; };
{ name = "Illuminati"; augs = 30; money = 150e9; hack = 1500; combat = 1200; };
-- This gets stuffed into plot factions because it shares most of its code with
-- them, even though it isn't really plot related.
-- { name = "Netburners"; augs = 0; money = 0; hack = 80; combat = 0; };
}
local function joinFaction(target)
if fc.haveInvite(target.name) then
return { activity = "joinFaction"; priority = target.priority; delay = 1; target.name }
elseif fc.inFaction(target.name) then
return nil
end
if not fc.haveCombatLevel(target.combat) then
return { activity = "GRIND_COMBAT", goal = "⚔"..target.combat }
elseif not fc.haveHackingLevel(target.hack) then
return { activity = "GRIND_HACK", goal = 'ℍ'..target.hack }
elseif not fc.haveMoney(target.money) then
return { activity = "GRIND_MONEY", goal = '$'..target.money }
end
return { activity = "IDLE"; priority = -1; }
end
return function()
local target = fc.chooseTarget(
factions:filter(f'f => ns:getOwnedAugmentations().length >= f.augs'))
if not target then return { activity = 'IDLE'; priority = -1; source = "plot factions" } end
local intent = joinFaction(target)
or fc.getFactionRep(target.name, target.reputation)
or fc.getAugs(target.name)
or { activity = 'IDLE'; priority = -1 }
intent.priority = target.priority
intent.source = intent.source or "plot factions"
return intent
end
|
--!strict
--[=[
@class Draw
]=]
local Draw = {}
local thickness = 0.5
local abs = math.abs
local function factorial(n : number) : number
if n == 0 then return 1 end
return n * factorial(n - 1)
end
local function binomial(n : number, i : number) : number
local x : number = nil
x = (factorial(n)) /
(factorial(n - i) * factorial(i))
return x
end
local function findPoint(t : number, ... : Vector3) : Vector3
assert(t >= 0 and t <= 1, t .. "t is not between 0 and 1.")
local points = {...}
local n : number = #points - 1
local p : Vector3 = nil
for i = 0, n do
local x = binomial(n,i)*(1 - t)^(n-i) * t^i * points[i+1]
p = p and p + x or x
end
return p
end
local function SetProperties(... : BasePart)
for _, part in ipairs{...} do
part.Material = Enum.Material.SmoothPlastic
part.Anchored = true
part.CanCollide = false
part.CanTouch = false
part.CanQuery = false
part.CastShadow = false
end
end
--[=[
@param Points Array<Vector3>
@param Accuracy number? -- Defaults to 10, limit of 1000
@return Model
Creates a bezier curve.
]=]
function Draw.Curve(Points : {[number] : Vector3}, Accuracy : number?) : Model
Accuracy = math.min(Accuracy or 10, 1000)
local lastPoint = findPoint(0, unpack(Points))
local group = Instance.new("Model")
group.Parent = workspace
group.Name = "Bezier Curve"
local step = 1/Accuracy :: number
for t = step, 1, step do
local newPoint = findPoint(t, unpack(Points))
Draw.Line(lastPoint, newPoint).Parent = group
lastPoint = newPoint
end
return group
end
--[=[
@param P0 Vector3
@param P1 Vector3
@return BasePart
Creates a new line between points P0 and P1
]=]
function Draw.Line(P0 : Vector3, P1 : Vector3) : BasePart
local part = Instance.new("Part")
part.Parent = workspace
SetProperties(part)
local dist = (P0 - P1).Magnitude
part.CFrame = CFrame.new(P0, P1) * CFrame.new(0, 0, -(dist)/2)
part.Size = Vector3.new(thickness, thickness, dist)
return part
end
--[=[
@param P0 Vector3
@param P1 Vector3
@return BasePart
Creates an axis-aligned rectangle.
]=]
function Draw.Rectangle(P0 : Vector3, P1 : Vector3) : BasePart
local rect = Instance.new("Part")
rect.Parent = workspace
SetProperties(rect)
local size : Vector3 = P0 - P1
rect.Size = Vector3.new(abs(size.X), abs(size.Y), abs(size.Z))
rect.Position = (P0 + P1)/2
return rect
end
--[=[
@param P0 Vector3
@param P1 Vector3
@param P2 Vector3
@return Model
Creates a new triangle.
]=]
function Draw.Triangle(P0 : Vector3, P1 : Vector3, P2 : Vector3) : Model
local group = Instance.new("Model")
group.Parent = workspace
group.Name = "Triangle"
local wedge = Instance.new("WedgePart")
local edges = {
{longest = (P2 - P0), other = (P1 - P0), origin = P0},
{longest = (P0 - P1), other = (P2 - P1), origin = P1},
{longest = (P1 - P2), other = (P0 - P2), origin = P2}
}
local edge = edges[1]
for i = 2, #edges do
if (edges[i].longest.Magnitude > edge.longest.Magnitude) then
edge = edges[i]
end
end
local theta = math.acos(edge.longest.Unit:Dot(edge.other.Unit))
local w1 = math.cos(theta) * edge.other.Magnitude
local w2 = edge.longest.Magnitude - w1
local h = math.sin(theta) * edge.other.Magnitude
local p1 = edge.origin + edge.other * 0.5
local p2 = edge.origin + edge.longest + (edge.other - edge.longest) * 0.5
local right = edge.longest:Cross(edge.other).Unit
local up = right:Cross(edge.longest).Unit
local back = edge.longest.Unit
local wedge1 = wedge:Clone()
wedge1.Size = Vector3.new(.5, h, w1)
wedge1.CFrame = CFrame.new(
p1.X, p1.Y, p1.Z,
-right.X, up.X, back.X,
-right.Y, up.Y, back.Y,
-right.Z, up.Z, back.Z
)
wedge1.Parent = group
local wedge2 = wedge:Clone()
wedge2.Size = Vector3.new(.5, h, w2)
wedge2.CFrame = CFrame.new(
p2.X, p2.Y, p2.Z,
right.X, up.X, -back.X,
right.Y, up.Y, -back.Y,
right.Z, up.Z, -back.Z
)
wedge2.Parent = group
SetProperties(wedge1, wedge2)
wedge:Destroy()
return group
end
return Draw
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.