content stringlengths 5 1.05M |
|---|
local class = require 'std.class'
local cls = class('Node')
local node_table = {}
function cls.exist(name)
return name and node_table[name]
end
function cls:_new(args)
return {
_args_ = args,
_name_ = nil,
parent_ = nil,
tree_ = nil,
_decorator_ = {},
}
end
function cls:__call(name, parent, type_name)
local type = type
if type(name) ~= 'string' then
return false
end
if not node_table[name] then
if type(parent) == 'table' then
node_table[name] = class(type_name or 'ActionNode', parent)
elseif type(parent) == "string" then
node_table[name] = class(type_name or 'ActionNode', node_table[parent] or pcall(require, parent) or self)
else
node_table[name] = class(type_name or 'ActionNode', self)
end
node_table[name]._name_ = name
end
return node_table[name]
end
function cls:getName()
return self._name_
end
function cls:addDecorator(name)
if not self:hasDecorator(name) then
self._decorator_[#self._decorator_+1] = name
return true
end
return false
end
function cls:hasDecorator(name)
for _, dcr in ipairs(self._decorator_) do
if dcr == name then
return true
end
end
return false
end
function cls:start()
end
function cls:run()
end
function cls:finish()
end
function cls:success()
if self.parent_ then
self.parent_:success()
end
end
function cls:fail()
if self.parent_ then
self.parent_:fail()
end
end
function cls:running()
if self.parent_ then
self.parent_:running()
end
end
function cls:Break()
if self.parent_ then
self.parent_:Break()
end
end
function cls:continue()
if self.parent_ then
self.parent_:continue()
end
end
return cls
|
local _, Engine = ...
local Module = Engine:GetModule("ActionBars")
local MenuWidget = Module:SetWidget("Menu: Main")
local L = Engine:GetLocale()
-- Lua API
local ipairs, unpack = ipairs, unpack
local floor = math.floor
-- WoW API
local CreateFrame = CreateFrame
local GetFramerate = GetFramerate
local GetNetStats = GetNetStats
local UnitFactionGroup = UnitFactionGroup
local UIHider = CreateFrame("Frame")
UIHider:Hide()
MenuWidget.UpdateMicroButtons = function(self, event, ...)
self.MicroMenuWindow:Arrange()
self:UnregisterEvent(event, "UpdateMicroButtons")
end
MenuWidget.Strip = function(self, button)
-- kill off blizzard's textures
local normal = button:GetNormalTexture()
if normal then
button:SetNormalTexture("")
normal:SetAlpha(0)
normal:SetSize(.0001, .0001)
end
local pushed = button:GetPushedTexture()
if pushed then
button:SetPushedTexture("")
pushed:SetTexture("")
pushed:SetAlpha(0)
pushed:SetSize(.0001, .0001)
end
local highlight = button:GetNormalTexture()
if highlight then
button:SetHighlightTexture("")
highlight:SetAlpha(0)
highlight:SetSize(.0001, .0001)
end
-- in cata some buttons are missing this
local disabled = button:GetDisabledTexture()
if disabled then
button:SetNormalTexture("")
disabled:SetAlpha(0)
disabled:SetSize(.0001, .0001)
end
-- this was first introduced in cata
local flash = _G[button:GetName().."Flash"]
if flash then
flash:SetTexture("")
flash:SetAlpha(0)
flash:SetSize(.0001, .0001)
end
end
MenuWidget.Skin = function(self, button, config, icon)
local icon_config = Module.config.visuals.menus.icons
button.Normal = button:CreateTexture(nil, "BORDER")
button.Normal:ClearAllPoints()
button.Normal:SetPoint(unpack(config.button.texture_position))
button.Normal:SetSize(unpack(config.button.texture_size))
button.Normal:SetTexture(config.button.textures.normal)
button.Pushed = button:CreateTexture(nil, "BORDER")
button.Pushed:Hide()
button.Pushed:ClearAllPoints()
button.Pushed:SetPoint(unpack(config.button.texture_position))
button.Pushed:SetSize(unpack(config.button.texture_size))
button.Pushed:SetTexture(config.button.textures.pushed)
button.Icon = button:CreateTexture(nil, "OVERLAY")
button.Icon:SetSize(unpack(icon_config.size))
button.Icon:SetPoint(unpack(icon_config.position))
button.Icon:SetAlpha(icon_config.alpha)
button.Icon:SetTexture(icon_config.texture)
button.Icon:SetTexCoord(unpack(icon_config.texcoords[icon]))
local position = icon_config.position
local position_pushed = icon_config.pushed.position
local alpha = icon_config.alpha
local alpha_pushed = icon_config.pushed.alpha
button.OnButtonState = function(self, state, lock)
if state == "PUSHED" then
self.Pushed:Show()
self.Normal:Hide()
self.Icon:ClearAllPoints()
self.Icon:SetPoint(unpack(position_pushed))
self.Icon:SetAlpha(alpha_pushed)
else
self.Normal:Show()
self.Pushed:Hide()
self.Icon:ClearAllPoints()
self.Icon:SetPoint(unpack(position))
self.Icon:SetAlpha(alpha)
end
end
hooksecurefunc(button, "SetButtonState", button.OnButtonState)
button:SetHitRectInsets(0, 0, 0, 0)
button:OnButtonState(button:GetButtonState())
end
MenuWidget.NewMenuButton = function(self, parent, config, label)
local button = CreateFrame("Button", nil, parent, "SecureHandlerClickTemplate")
button:RegisterForClicks("AnyUp")
button:SetSize(unpack(config.size))
button.normal = button:CreateTexture(nil, "ARTWORK")
button.normal:SetPoint("CENTER")
button.highlight = button:CreateTexture(nil, "ARTWORK")
button.highlight:SetPoint("CENTER")
button.pushed = button:CreateTexture(nil, "ARTWORK")
button.pushed:SetPoint("CENTER")
button.text = button:CreateFontString(nil, "OVERLAY")
button.text:SetPoint("CENTER")
button:HookScript("OnEnter", function(self) self:UpdateLayers() end)
button:HookScript("OnLeave", function(self) self:UpdateLayers() end)
button:HookScript("OnMouseDown", function(self)
self.isDown = true
self:UpdateLayers()
end)
button:HookScript("OnMouseUp", function(self)
self.isDown = false
self:UpdateLayers()
end)
button:HookScript("OnShow", function(self)
self.isDown = false
self:UpdateLayers()
end)
button:HookScript("OnHide", function(self)
self.isDown = false
self:UpdateLayers()
end)
button.UpdateLayers = function(self)
if self.isDown then
self.normal:Hide()
if self:IsMouseOver() then
self.highlight:Hide()
self.pushed:Show()
self.text:ClearAllPoints()
self.text:SetPoint("CENTER", 0, -4)
self.text:SetTextColor(unpack(config.font_color.pushed))
else
self.pushed:Hide()
self.normal:Hide()
self.highlight:Show()
self.text:ClearAllPoints()
self.text:SetPoint("CENTER", 0, 0)
self.text:SetTextColor(unpack(config.font_color.highlight))
end
else
self.text:ClearAllPoints()
self.text:SetPoint("CENTER", 0, 0)
if self:IsMouseOver() then
self.pushed:Hide()
self.normal:Hide()
self.highlight:Show()
self.text:SetTextColor(unpack(config.font_color.highlight))
else
self.normal:Show()
self.highlight:Hide()
self.pushed:Hide()
self.text:SetTextColor(unpack(config.font_color.normal))
end
end
end
button:SetSize(unpack(config.size))
button.normal:SetTexture(config.texture.normal)
button.normal:SetSize(unpack(config.texture_size))
button.normal:ClearAllPoints()
button.normal:SetPoint("CENTER")
button.highlight:SetTexture(config.texture.highlight)
button.highlight:SetSize(unpack(config.texture_size))
button.highlight:ClearAllPoints()
button.highlight:SetPoint("CENTER")
button.pushed:SetTexture(config.texture.pushed)
button.pushed:SetSize(unpack(config.texture_size))
button.pushed:ClearAllPoints()
button.pushed:SetPoint("CENTER")
button.text:SetFontObject(config.font_object)
button.text:SetText(label)
button:UpdateLayers() -- update colors and layers
return button
end
MenuWidget.OnEnable = function(self)
local config = Module.config
local db = Module.db
local Main = Module:GetWidget("Controller: Main"):GetFrame()
local Side = Module:GetWidget("Controller: Side"):GetFrame()
local Menu = Module:GetWidget("Controller: Menu"):GetFrame()
local MenuButton = Module:GetWidget("Template: MenuButton")
local FlyoutBar = Module:GetWidget("Template: FlyoutBar")
-- config table shortcuts
local main_menu_config = config.structure.controllers.mainmenu
local micro_menu_config = config.visuals.menus.main.micromenu
local actionbar_menu_config = config.visuals.menus.main.barmenu
local bagbar_menu_config = config.visuals.menus.main.bagmenu
-- Main Buttons
---------------------------------------------
local MicroMenuButton = MenuButton:New(Menu)
MicroMenuButton:SetPoint("BOTTOMRIGHT")
MicroMenuButton:SetFrameStrata("MEDIUM")
MicroMenuButton:SetFrameLevel(50) -- get it above the actionbars
MicroMenuButton:SetSize(unpack(micro_menu_config.button.size))
self:Skin(MicroMenuButton, micro_menu_config, "mainmenu")
local ActionBarMenuButton = MenuButton:New(Menu)
ActionBarMenuButton:SetPoint("BOTTOMRIGHT", MicroMenuButton, "BOTTOMLEFT", -main_menu_config.padding, 0 )
ActionBarMenuButton:SetFrameStrata("MEDIUM")
ActionBarMenuButton:SetFrameLevel(50)
ActionBarMenuButton:SetSize(unpack(actionbar_menu_config.button.size))
self:Skin(ActionBarMenuButton, micro_menu_config, "bars")
local BagBarMenuButton = MenuButton:New(Menu)
BagBarMenuButton:SetPoint("BOTTOMRIGHT", ActionBarMenuButton, "BOTTOMLEFT", -main_menu_config.padding, 0 )
BagBarMenuButton:SetFrameStrata("MEDIUM")
BagBarMenuButton:SetFrameLevel(50)
BagBarMenuButton:SetSize(unpack(bagbar_menu_config.button.size))
self:Skin(BagBarMenuButton, micro_menu_config, "bag")
-- Menu Window #1: MicroMenu
---------------------------------------------
local MicroMenuWindow = FlyoutBar:New(MicroMenuButton)
MicroMenuWindow:AttachToButton(MicroMenuButton)
MicroMenuWindow:SetPoint(unpack(micro_menu_config.position))
MicroMenuWindow:SetBackdrop(micro_menu_config.backdrop)
MicroMenuWindow:SetBackdropColor(unpack(micro_menu_config.backdrop_color))
MicroMenuWindow:SetBackdropBorderColor(unpack(micro_menu_config.backdrop_border_color))
MicroMenuWindow:SetWindowInsets(unpack(micro_menu_config.insets))
MicroMenuWindow:SetButtonSize(unpack(micro_menu_config.button.size))
MicroMenuWindow:SetButtonAnchor(micro_menu_config.button.anchor)
MicroMenuWindow:SetButtonPadding(micro_menu_config.button.padding)
MicroMenuWindow:SetButtonGrowthX(micro_menu_config.button.growthX)
MicroMenuWindow:SetButtonGrowthY(micro_menu_config.button.growthY)
MicroMenuWindow:SetRowSpacing(micro_menu_config.button.spacing)
MicroMenuWindow:SetJustify(micro_menu_config.button.justify)
self.MicroMenuWindow = MicroMenuWindow -- needed for some callbacks later on
local button_to_icon = {} -- simple mapping of icons to the buttons
local faction = UnitFactionGroup("player") -- to get the right faction icon, or neutral
-- Buttons haven't changed from WoD to Legion,
-- at least not in the build I'm working on when writing this.
if Engine:IsBuild("WoD") then
MicroMenuWindow:InsertButton(CharacterMicroButton)
MicroMenuWindow:InsertButton(SpellbookMicroButton)
MicroMenuWindow:InsertButton(TalentMicroButton)
MicroMenuWindow:InsertButton(AchievementMicroButton)
MicroMenuWindow:InsertButton(QuestLogMicroButton)
MicroMenuWindow:InsertButton(GuildMicroButton)
MicroMenuWindow:InsertButton(LFDMicroButton)
MicroMenuWindow:InsertButton(CollectionsMicroButton)
MicroMenuWindow:InsertButton(EJMicroButton)
if C_StorePublic and C_StorePublic.IsEnabled() then
MicroMenuWindow:InsertButton(StoreMicroButton)
end
MicroMenuWindow:InsertButton(MainMenuMicroButton)
--MicroMenuWindow:InsertButton(HelpMicroButton) -- on the game menu
MicroMenuWindow:SetRowSize(4)
button_to_icon = {
[CharacterMicroButton] = "character",
[SpellbookMicroButton] = "spellbook",
[TalentMicroButton] = "talents",
[AchievementMicroButton] = "achievements",
[QuestLogMicroButton] = "worldmap",
[GuildMicroButton] = "guild",
[LFDMicroButton] = "raid",
[CollectionsMicroButton] = "mount",
[EJMicroButton] = "encounterjournal",
[StoreMicroButton] = "store",
[MainMenuMicroButton] = "cogs",
[HelpMicroButton] = "bug"
}
elseif Engine:IsBuild("MoP") then
MicroMenuWindow:InsertButton(CharacterMicroButton)
MicroMenuWindow:InsertButton(SpellbookMicroButton)
MicroMenuWindow:InsertButton(TalentMicroButton)
MicroMenuWindow:InsertButton(AchievementMicroButton)
MicroMenuWindow:InsertButton(QuestLogMicroButton)
MicroMenuWindow:InsertButton(GuildMicroButton)
MicroMenuWindow:InsertButton(PVPMicroButton)
MicroMenuWindow:InsertButton(LFDMicroButton)
MicroMenuWindow:InsertButton(CompanionsMicroButton)
MicroMenuWindow:InsertButton(EJMicroButton)
MicroMenuWindow:InsertButton(StoreMicroButton)
MicroMenuWindow:InsertButton(MainMenuMicroButton)
--MicroMenuWindow:InsertButton(HelpMicroButton) -- blizz removes this? -- on the game menu
MicroMenuWindow:SetRowSize(4)
button_to_icon = {
[CharacterMicroButton] = "character",
[SpellbookMicroButton] = "spellbook",
[TalentMicroButton] = "talents",
[AchievementMicroButton] = "achievements",
[QuestLogMicroButton] = "questlog",
[GuildMicroButton] = "guild",
[PVPMicroButton] = faction == "Alliance" and "alliance" or faction == "Horde" and "horde" or "neutral",
[LFDMicroButton] = "raid",
[CompanionsMicroButton] = "mount",
[EJMicroButton] = "encounterjournal",
[StoreMicroButton] = "store",
[MainMenuMicroButton] = "cogs",
[HelpMicroButton] = "bug"
}
elseif Engine:IsBuild("Cata") then
MicroMenuWindow:InsertButton(CharacterMicroButton)
MicroMenuWindow:InsertButton(SpellbookMicroButton)
MicroMenuWindow:InsertButton(TalentMicroButton)
MicroMenuWindow:InsertButton(AchievementMicroButton)
MicroMenuWindow:InsertButton(QuestLogMicroButton)
MicroMenuWindow:InsertButton(GuildMicroButton)
MicroMenuWindow:InsertButton(PVPMicroButton)
MicroMenuWindow:InsertButton(LFDMicroButton)
MicroMenuWindow:InsertButton(RaidMicroButton)
MicroMenuWindow:InsertButton(EJMicroButton)
MicroMenuWindow:InsertButton(MainMenuMicroButton)
--MicroMenuWindow:InsertButton(HelpMicroButton) -- on the game menu
MicroMenuWindow:SetRowSize(4)
button_to_icon = {
[CharacterMicroButton] = "character",
[SpellbookMicroButton] = "spellbook",
[TalentMicroButton] = "talents",
[AchievementMicroButton] = "achievements",
[QuestLogMicroButton] = "questlog",
[GuildMicroButton] = "guild",
[PVPMicroButton] = faction == "Alliance" and "alliance" or faction == "Horde" and "horde" or "neutral",
[LFDMicroButton] = "group",
[RaidMicroButton] = "raid",
[EJMicroButton] = "encounterjournal",
[MainMenuMicroButton] = "cogs",
[HelpMicroButton] = "bug"
}
elseif Engine:IsBuild("WotLK") then
MicroMenuWindow:InsertButton(CharacterMicroButton)
MicroMenuWindow:InsertButton(SpellbookMicroButton)
MicroMenuWindow:InsertButton(TalentMicroButton)
MicroMenuWindow:InsertButton(AchievementMicroButton)
MicroMenuWindow:InsertButton(QuestLogMicroButton)
MicroMenuWindow:InsertButton(SocialsMicroButton)
MicroMenuWindow:InsertButton(PVPMicroButton)
MicroMenuWindow:InsertButton(LFDMicroButton)
MicroMenuWindow:InsertButton(MainMenuMicroButton)
MicroMenuWindow:InsertButton(HelpMicroButton)
MicroMenuWindow:SetRowSize(5)
button_to_icon = {
[CharacterMicroButton] = "character",
[SpellbookMicroButton] = "spellbook",
[TalentMicroButton] = "talents",
[AchievementMicroButton] = "achievements",
[QuestLogMicroButton] = "questlog",
[SocialsMicroButton] = "group",
[PVPMicroButton] = faction == "Alliance" and "alliance" or faction == "Horde" and "horde" or "neutral",
[LFDMicroButton] = "raid",
[MainMenuMicroButton] = "cogs",
[HelpMicroButton] = "bug"
}
end
-- Disable Blizzard texture changes and stuff from these buttons.
-- Also re-align their tooltips to be above our menu.
for index,button in MicroMenuWindow:GetAll() do
self:Strip(button)
self:Skin(button, micro_menu_config, button_to_icon[button])
button.OnEnter = button:GetScript("OnEnter")
button.OnLeave = button:GetScript("OnLeave")
button:SetScript("OnEnter", function(self)
self:OnEnter()
if GameTooltip:IsShown() and GameTooltip:GetOwner() == self then
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("BOTTOMRIGHT", MicroMenuWindow, "TOPRIGHT", 0, 10)
end
end)
button:SetScript("OnLeave", function(self)
self:OnLeave()
end)
end
-- Remove the character button portrait
if MicroButtonPortrait then
MicroButtonPortrait:SetParent(UIHider)
end
-- Remove the guild tabard
if GuildMicroButtonTabard then
GuildMicroButtonTabard:SetParent(UIHider)
end
-- Remove the pvp frame icon, and add our own
if PVPMicroButtonTexture then
PVPMicroButtonTexture:SetParent(UIHider)
end
-- Kill off the game menu button latency display
if MainMenuBarPerformanceBar then
MainMenuBarPerformanceBar:SetParent(UIHider)
end
-- wild hacks to control the tooltip position
if MainMenuBarPerformanceBarFrame_OnEnter then
hooksecurefunc("MainMenuBarPerformanceBarFrame_OnEnter", function()
if GameTooltip:IsShown() and GameTooltip:GetOwner() == MainMenuMicroButton then
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("BOTTOMRIGHT", MicroMenuWindow, "TOPRIGHT", 0, 10)
end
end)
end
-- Kill of the game menu button download texture
if MainMenuBarDownload then
MainMenuBarDownload:SetParent(UIHider)
end
if UpdateMicroButtonsParent then
hooksecurefunc("UpdateMicroButtonsParent", function(parent)
if InCombatLockdown() then
self:RegisterEvent("PLAYER_REGEN_ENABLED", "UpdateMicroButtons")
else
MicroMenuWindow:Arrange()
end
end)
end
if MoveMicroButtons then
hooksecurefunc("MoveMicroButtons", function()
if InCombatLockdown() then
self:RegisterEvent("PLAYER_REGEN_ENABLED", "UpdateMicroButtons")
else
MicroMenuWindow:Arrange()
end
end)
end
if UpdateMicroButtons then
hooksecurefunc("UpdateMicroButtons", function()
if InCombatLockdown() then
self:RegisterEvent("PLAYER_REGEN_ENABLED", "UpdateMicroButtons")
else
MicroMenuWindow:Arrange()
end
end)
end
-- Arrange the buttons and size the window
MicroMenuWindow:Arrange()
-- Menu Window #2: ActionBars
---------------------------------------------
local ActionBarMenuWindow = FlyoutBar:New(ActionBarMenuButton)
ActionBarMenuWindow:AttachToButton(ActionBarMenuButton)
ActionBarMenuWindow:SetSize(unpack(actionbar_menu_config.size))
ActionBarMenuWindow:SetPoint(unpack(actionbar_menu_config.position))
ActionBarMenuWindow:SetBackdrop(actionbar_menu_config.backdrop)
ActionBarMenuWindow:SetBackdropColor(unpack(actionbar_menu_config.backdrop_color))
ActionBarMenuWindow:SetBackdropBorderColor(unpack(actionbar_menu_config.backdrop_border_color))
ActionBarMenuWindow:SetWindowInsets(unpack(actionbar_menu_config.insets))
ActionBarMenuWindow:SetButtonSize(unpack(actionbar_menu_config.button.size))
ActionBarMenuWindow:SetButtonAnchor(actionbar_menu_config.button.anchor)
ActionBarMenuWindow:SetButtonPadding(actionbar_menu_config.button.padding)
ActionBarMenuWindow:SetButtonGrowthX(actionbar_menu_config.button.growthX)
ActionBarMenuWindow:SetButtonGrowthY(actionbar_menu_config.button.growthY)
-- Raise your hand if you hate writing menus!!!1 >:(
do
local insets = actionbar_menu_config.insets
local ui_width = ActionBarMenuWindow:GetWidth() - (insets[1] + insets[2])
local ui_padding = 4
local ui_paragraph = 10
local style_table = actionbar_menu_config.ui.window
local style_table_button = actionbar_menu_config.ui.menubutton
local new = ActionBarMenuWindow
-- Header1
------------------------------------------------------------------
new.header = CreateFrame("Frame", nil, new)
new.header:SetPoint("TOP", 0, -style_table.header.insets[3])
new.header:SetPoint("LEFT", style_table.header.insets[1], 0)
new.header:SetPoint("RIGHT", -style_table.header.insets[2], 0)
new.header:SetHeight(style_table.header.height)
new.header:SetBackdrop(style_table.header.backdrop)
new.header:SetBackdropColor(unpack(style_table.header.backdrop_color))
new.header:SetBackdropBorderColor(unpack(style_table.header.backdrop_border_color))
-- title
new.title = new.header:CreateFontString(nil, "ARTWORK")
new.title:SetPoint("CENTER")
new.title:SetJustifyV("TOP")
new.title:SetJustifyH("CENTER")
new.title:SetFontObject(style_table.header.title.font_object)
new.title:SetText(L["Action Bars"])
new.title:SetTextColor(unpack(style_table.header.title.font_color))
-- Body
------------------------------------------------------------------
new.body = CreateFrame("Frame", nil, new)
new.body:SetPoint("TOP", new.header, "BOTTOM", 0, -style_table.padding)
new.body:SetPoint("LEFT", style_table.body.insets[1], 0)
new.body:SetPoint("RIGHT", -style_table.body.insets[2], 0)
new.body:SetBackdrop(style_table.body.backdrop)
new.body:SetBackdropColor(unpack(style_table.body.backdrop_color))
new.body:SetBackdropBorderColor(unpack(style_table.body.backdrop_border_color))
new.body:SetHeight(style_table_button.size[2]*3 + 16*2 + 4*2)
-- Buttons
------------------------------------------------------------------
new.button1 = self:NewMenuButton(new.body, style_table_button, L["One"])
new.button1:SetPoint("TOP", 0, -16 )
new.button1:SetFrameRef("controller", Main)
new.button1:SetAttribute("_onclick", [[
local controller = self:GetFrameRef("controller");
controller:SetAttribute("numbars", 1);
]])
new.button2 = self:NewMenuButton(new.body, style_table_button, L["Two"])
new.button2:SetPoint("TOP", new.button1, "BOTTOM", 0, -4 )
new.button2:SetFrameRef("controller", Main)
new.button2:SetAttribute("_onclick", [[
local controller = self:GetFrameRef("controller");
controller:SetAttribute("numbars", 2);
]])
new.button3 = self:NewMenuButton(new.body, style_table_button, L["Three"])
new.button3:SetPoint("TOP", new.button2, "BOTTOM", 0, -4 )
new.button3:SetFrameRef("controller", Main)
new.button3:SetAttribute("_onclick", [[
local controller = self:GetFrameRef("controller");
controller:SetAttribute("numbars", 3);
]])
-- Header2
------------------------------------------------------------------
new.header2 = CreateFrame("Frame", nil, new)
new.header2:SetPoint("TOP", new.body, "BOTTOM", 0, -style_table.padding)
new.header2:SetPoint("LEFT", style_table.header.insets[1], 0)
new.header2:SetPoint("RIGHT", -style_table.header.insets[2], 0)
new.header2:SetHeight(style_table.header.height)
new.header2:SetBackdrop(style_table.header.backdrop)
new.header2:SetBackdropColor(unpack(style_table.header.backdrop_color))
new.header2:SetBackdropBorderColor(unpack(style_table.header.backdrop_border_color))
-- title2
new.title2 = new.header2:CreateFontString(nil, "ARTWORK")
new.title2:SetPoint("CENTER")
new.title2:SetJustifyV("TOP")
new.title2:SetJustifyH("CENTER")
new.title2:SetFontObject(style_table.header.title.font_object)
new.title2:SetText(L["Side Bars"])
new.title2:SetTextColor(unpack(style_table.header.title.font_color))
-- Body2
------------------------------------------------------------------
new.body2 = CreateFrame("Frame", nil, new)
new.body2:SetPoint("TOP", new.header2, "BOTTOM", 0, -style_table.padding)
new.body2:SetPoint("LEFT", style_table.body.insets[1], 0)
new.body2:SetPoint("RIGHT", -style_table.body.insets[2], 0)
new.body2:SetBackdrop(style_table.body.backdrop)
new.body2:SetBackdropColor(unpack(style_table.body.backdrop_color))
new.body2:SetBackdropBorderColor(unpack(style_table.body.backdrop_border_color))
new.body2:SetHeight(style_table_button.size[2]*3 + 16*2 + 4*2)
-- Buttons2
------------------------------------------------------------------
new.button4 = self:NewMenuButton(new.body2, style_table_button, L["No Bars"])
new.button4:SetPoint("TOP", 0, -16 )
new.button4:SetFrameRef("controller", Side)
new.button4:SetAttribute("_onclick", [[
local controller = self:GetFrameRef("controller");
controller:SetAttribute("numbars", 0);
]])
new.button5 = self:NewMenuButton(new.body2, style_table_button, L["One"])
new.button5:SetPoint("TOP", new.button4, "BOTTOM", 0, -4 )
new.button5:SetFrameRef("controller", Side)
new.button5:SetAttribute("_onclick", [[
local controller = self:GetFrameRef("controller");
controller:SetAttribute("numbars", 1);
]])
new.button6 = self:NewMenuButton(new.body2, style_table_button, L["Two"])
new.button6:SetPoint("TOP", new.button5, "BOTTOM", 0, -4 )
new.button6:SetFrameRef("controller", Side)
new.button6:SetAttribute("_onclick", [[
local controller = self:GetFrameRef("controller");
controller:SetAttribute("numbars", 2);
]])
-- Footer
------------------------------------------------------------------
new.footer = CreateFrame("Frame", nil, new)
new.footer:SetPoint("TOP", new.body2, "BOTTOM", 0, -style_table.footer.offset)
new.footer:SetPoint("LEFT", style_table.footer.insets[1], 0)
new.footer:SetPoint("RIGHT", -style_table.footer.insets[2], 0)
new.footer:SetPoint("BOTTOM", 0, style_table.footer.insets[3])
new.footer:SetBackdrop(style_table.footer.backdrop)
new.footer:SetBackdropColor(unpack(style_table.footer.backdrop_color))
new.footer:SetBackdropBorderColor(unpack(style_table.footer.backdrop_border_color))
-- message
new.message = new.footer:CreateFontString(nil, "ARTWORK")
new.message:SetWidth(new.footer:GetWidth() - (style_table.footer.message.insets[1] + style_table.footer.message.insets[2]))
new.message:SetPoint("TOP")
new.message:SetPoint("LEFT")
new.message:SetPoint("RIGHT")
new.message:SetJustifyV("TOP")
new.message:SetJustifyH("CENTER")
new.message:SetIndentedWordWrap(false)
new.message:SetWordWrap(true)
new.message:SetNonSpaceWrap(false)
new.message:SetSpacing(0) -- or it will become truncated
new.message:SetPoint("TOP", 0, -style_table.footer.message.insets[3])
new.message:SetPoint("LEFT", style_table.footer.message.insets[1], 0)
new.message:SetPoint("RIGHT", -style_table.footer.message.insets[2], 0)
new.message:SetFontObject(style_table.footer.message.font_object)
new.message:SetTextColor(unpack(style_table.footer.message.font_color))
new.message:SetText(L["Hold |cff00b200<Alt+Ctrl+Shift>|r and drag to remove spells, macros and items from the action buttons."])
end
-- Menu Window #3: BagBar
---------------------------------------------
local BagBarMenuWindow = FlyoutBar:New(BagBarMenuButton)
BagBarMenuWindow:Hide()
--BagBarMenuWindow:AttachToButton(BagBarMenuButton)
BagBarMenuWindow:SetSize(unpack(bagbar_menu_config.size))
BagBarMenuWindow:SetPoint(unpack(bagbar_menu_config.position))
BagBarMenuWindow:SetBackdrop(bagbar_menu_config.backdrop)
BagBarMenuWindow:SetBackdropColor(unpack(bagbar_menu_config.backdrop_color))
BagBarMenuWindow:SetBackdropBorderColor(unpack(bagbar_menu_config.backdrop_border_color))
BagBarMenuButton.OnEnter = function(self)
if MicroMenuButton:GetButtonState() == "PUSHED"
or ActionBarMenuButton:GetButtonState() == "PUSHED"
or BagBarMenuButton:GetButtonState() == "PUSHED" then
GameTooltip:Hide()
return
end
-- GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT", -6, 16)
GameTooltip_SetDefaultAnchor(GameTooltip, self)
GameTooltip:AddLine(L["Bags"])
GameTooltip:AddLine(L["<Left-click> to toggle bags."], 0, .7, 0)
GameTooltip:AddLine(L["<Right-click> to toggle bag bar."], 0, .7, 0)
GameTooltip:Show()
end
BagBarMenuButton:SetScript("OnEnter", BagBarMenuButton.OnEnter)
BagBarMenuButton:SetScript("OnLeave", function(self) GameTooltip:Hide() end)
ActionBarMenuButton.OnEnter = function(self)
if MicroMenuButton:GetButtonState() == "PUSHED"
or ActionBarMenuButton:GetButtonState() == "PUSHED"
or BagBarMenuButton:GetButtonState() == "PUSHED" then
GameTooltip:Hide()
return
end
-- GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT", -6, 16)
GameTooltip_SetDefaultAnchor(GameTooltip, self)
GameTooltip:AddLine(L["Action Bars"])
GameTooltip:AddLine(L["<Left-click> to toggle action bar menu."], 0, .7, 0)
GameTooltip:Show()
end
ActionBarMenuButton:SetScript("OnEnter", ActionBarMenuButton.OnEnter)
ActionBarMenuButton:SetScript("OnLeave", function(self) GameTooltip:Hide() end)
ActionBarMenuButton.OnClick = function(self, button)
if button == "LeftButton" then
self:OnEnter() -- update tooltips
end
end
MicroMenuButton.OnEnter = function(self)
if MicroMenuButton:GetButtonState() == "PUSHED"
or ActionBarMenuButton:GetButtonState() == "PUSHED"
or BagBarMenuButton:GetButtonState() == "PUSHED" then
GameTooltip:Hide()
return
end
-- GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT", -6, 16)
GameTooltip_SetDefaultAnchor(GameTooltip, self)
GameTooltip:AddLine(L["Main Menu"])
GameTooltip:AddLine(L["<Left-click> to toggle menu."], 0, .7, 0)
GameTooltip:Show()
end
MicroMenuButton:SetScript("OnEnter", MicroMenuButton.OnEnter)
MicroMenuButton:SetScript("OnLeave", function(self) GameTooltip:Hide() end)
MicroMenuButton.OnClick = function(self, button)
if button == "LeftButton" then
self:OnEnter() -- update tooltips
end
end
local BagWindow = ContainerFrame1 -- to easier transition to our custom bags later
-- Move the backpack-, bag- and keyring buttons to a visible frame
MainMenuBarBackpackButton:SetParent(BagBarMenuWindow)
MainMenuBarBackpackButton:ClearAllPoints()
MainMenuBarBackpackButton:SetPoint("BOTTOMRIGHT", BagBarMenuWindow, "BOTTOMRIGHT", -bagbar_menu_config.insets[2], bagbar_menu_config.insets[4])
CharacterBag0Slot:SetParent(BagBarMenuWindow)
CharacterBag1Slot:SetParent(BagBarMenuWindow)
CharacterBag2Slot:SetParent(BagBarMenuWindow)
CharacterBag3Slot:SetParent(BagBarMenuWindow)
-- The keyring was removed in 4.2.0 in Cata
if not Engine:IsBuild("4.2.0") then
KeyRingButton:SetParent(BagBarMenuWindow)
KeyRingButton:Show()
end
-- initial hack of the bag position
local Blizz_ToggleBackpack = ToggleBackpack
local Blizz_ToggleBag = ToggleBag
local Blizz_OpenBag = OpenBag
local Blizz_OpenBackpack = OpenBackpack
local Blizz_OpenAllBags = OpenAllBags
-- This was at one point reported as tainting the WorldMap, but after testing
-- I concluded that the taint is coming from the tracker module instead.
local UpdateOffsets = function()
if InCombatLockdown() then
return
end
CONTAINER_OFFSET_Y = MicroMenuWindow:GetBottom() + 6 + (BagBarMenuWindow:IsShown() and bagbar_menu_config.bag_offset or 0)
CONTAINER_OFFSET_X = UIParent:GetRight() - MicroMenuWindow:GetRight()
end
OpenBag = function(...)
UpdateOffsets()
Blizz_OpenBag(...)
end
OpenBackpack = function(...)
UpdateOffsets()
Blizz_OpenBackpack(...)
end
OpenAllBags = function(...)
UpdateOffsets()
Blizz_OpenAllBags(...)
end
BagBarMenuButton.OnClick = function(self, button)
if button == "LeftButton" then
if Engine:IsBuild("Cata") then
ToggleAllBags() -- functionality on OpenAllBags was changed in Cata from toggle to pure open.
else
OpenAllBags() -- Toggle bag frames. This was actually a toggle function in WotLK.
end
elseif button == "RightButton" then
-- Bagbar was toggled by the secure environement. Put any post updates here, if needed.
end
-- toggle anchors
UpdateOffsets()
if updateContainerFrameAnchors then
updateContainerFrameAnchors()
elseif UpdateContainerFrameAnchors then
UpdateContainerFrameAnchors()
end
self:OnEnter() -- update tooltips
end
-- Hook the bagbutton's pushed state to the backpack.
BagBarMenuWindow:HookScript("OnShow", function() BagBarMenuButton:SetButtonState("PUSHED", 1) end)
BagBarMenuWindow:HookScript("OnHide", function()
if not BagWindow:IsShown() then
BagBarMenuButton:SetButtonState("NORMAL")
end
end)
BagWindow:HookScript("OnShow", function(self)
BagBarMenuButton:SetButtonState("PUSHED", 1)
end)
BagWindow:HookScript("OnHide", function(self)
if not BagBarMenuWindow:IsShown() then
BagBarMenuButton:SetButtonState("NORMAL")
end
end)
BagBarMenuButton:SetFrameRef("bags", BagWindow)
BagBarMenuButton:SetFrameRef("window", BagBarMenuWindow)
BagBarMenuButton:SetFrameRef("otherwindow1", ActionBarMenuWindow)
BagBarMenuButton:SetFrameRef("otherwindow2", MicroMenuWindow)
BagBarMenuButton:SetAttribute("_onclick", [[
self:GetFrameRef("otherwindow1"):Hide();
self:GetFrameRef("otherwindow2"):Hide();
local window = self:GetFrameRef("window"); -- bag bar
local bags
if not PlayerInCombat() then
bags = self:GetFrameRef("bags"); -- backpack (insecure frame, can't be accessed in combat)
end
if button == "LeftButton" then
if bags then
if bags:IsShown() and window:IsShown() then
window:Hide(); -- hide the bagbar when hiding the bags (only works out of combat)
end
end
elseif button == "RightButton" then
-- this will toggle the bagbar
if window:IsShown() then
window:Hide();
else
window:Show();
end
end
control:CallMethod("OnClick", button);
]])
-- Close the bags when showing any of our other windows.
MicroMenuWindow:HookScript("OnShow", CloseAllBags)
ActionBarMenuWindow:HookScript("OnShow", CloseAllBags)
-- Make sure clicking one main button hides the rest and their windows.
MicroMenuButton:SetFrameRef("otherwindow1", ActionBarMenuWindow)
MicroMenuButton:SetFrameRef("otherwindow2", BagBarMenuWindow)
MicroMenuButton:SetAttribute("leftclick", [[
self:GetFrameRef("otherwindow1"):Hide()
self:GetFrameRef("otherwindow2"):Hide()
]])
ActionBarMenuButton:SetFrameRef("otherwindow1", MicroMenuWindow)
ActionBarMenuButton:SetFrameRef("otherwindow2", BagBarMenuWindow)
ActionBarMenuButton:SetAttribute("leftclick", [[
self:GetFrameRef("otherwindow1"):Hide();
self:GetFrameRef("otherwindow2"):Hide();
]])
-- Texts
---------------------------------------------
local Performance = MicroMenuButton:CreateFontString()
Performance:SetDrawLayer("ARTWORK")
Performance:SetFontObject(micro_menu_config.performance.font_object)
Performance:SetPoint(unpack(micro_menu_config.performance.position))
MicroMenuButton.Performance = Performance
local performance_string = "%d%s - %d%s"
local performance_hz = 1
local MILLISECONDS_ABBR = MILLISECONDS_ABBR
local FPS_ABBR = FPS_ABBR
local floor = math.floor
MicroMenuButton:SetScript("OnUpdate", function(self, elapsed)
self.elapsed = (self.elapsed or 0) + elapsed
if self.elapsed > performance_hz then
local _, _, chat_latency, cast_latency = GetNetStats()
local fps = floor(GetFramerate())
if not cast_latency or cast_latency == 0 then
cast_latency = chat_latency
end
self.Performance:SetFormattedText(performance_string, cast_latency, MILLISECONDS_ABBR, fps, FPS_ABBR)
self.elapsed = 0
end
end)
end
|
function GetInfo()
local info = {
name = "uh_effect_rotate2",
displayname = {
en = "uh_effect_rotate2",
ja = "UH_VS回転"
},
tag = "effect",
affects = AF_Angle,
thumbnail = nil
}
return info
end
function InitEffect()
SetDuration(0.5)
AddProperty(NewProperty("RotateZ",
{ ja="回転角度(Z軸)", en="RotateZ"},
"float", nil, 0))
end
function ApplyEffect(effInfo, param)
param.angle = GetProperty("RotateZ")
return param
end |
---@class PS_FourFlames : ModulBase
PS_FourFlames = ModulBase:extend()
function PS_FourFlames:new()
PS_FourFlames.super.new(self)
self.Flame_A = nil ---@type GameObject
self.Flame_B = nil ---@type GameObject
self.Flame_C = nil ---@type GameObject
self.Flame_D = nil ---@type GameObject
end
function PS_FourFlames:Start()
self:Deactive()
end
function PS_FourFlames:Active()
self.Flame_A:SetActive(true)
self.Flame_B:SetActive(true)
self.Flame_C:SetActive(true)
self.Flame_D:SetActive(true)
end
function PS_FourFlames:Deactive()
self.Flame_A:SetActive(false)
self.Flame_B:SetActive(false)
self.Flame_C:SetActive(false)
self.Flame_D:SetActive(false)
end
function PS_FourFlames:ActiveForPreview()
self.Flame_A:SetActive(true)
self.Flame_B:SetActive(true)
self.Flame_C:SetActive(true)
self.Flame_D:SetActive(true)
end
function PS_FourFlames:DeactiveForPreview()
self.Flame_A:SetActive(false)
self.Flame_B:SetActive(false)
self.Flame_C:SetActive(false)
self.Flame_D:SetActive(false)
end
function PS_FourFlames:Reset()
end
function PS_FourFlames:Backup()
end
function CreateClass:PS_FourFlames()
return PS_FourFlames()
end |
local luasnip = require("luasnip")
luasnip.snippets = {
go = {},
typescript = {},
javascript = {},
}
require("luasnip.loaders.from_vscode").load({ paths = "", include = { "go", "typescript", "javascript" } })
-- require("luasnip/loaders/from_vscode").lazy_load()
|
local barrier = {}
barrier.name = "BrokemiaHelper/moveBlockBarrier"
barrier.depth = 0
barrier.color = {0.45, 0.0, 0.45, 0.8}
barrier.placements = {
name = "barrier",
data = {
width = 8,
height = 8,
blockDebris = false
}
}
return barrier |
--- required and optional dependencies
local f = require('f')
local typex = require('typex')()
local on_attach = require('plugins.lspconfig.on_attach')
local has_lspinstall, lspinstall = pcall(require, 'nvim-lsp-installer')
local has_lspconfig, lspconfig = pcall(require, 'lspconfig')
local log = require('log')
--- globals
local text_change_default_debounce = 150
local languages = {
powershell = 'powershell_es',
python = 'pyright',
-- 'gopls',
rust = 'rust_analyzer',
javascript = 'tsserver',
-- 'vimls',
bash = 'bashls',
cpp = 'ccls',
-- deno = 'denols',
php = 'intelephense',
java = 'jdtls',
dart = 'dartls',
json = 'jsonls',
-- csharp = 'csharp_ls',
csharp = 'omnisharp',
-- 'perlls',
-- 'perlpls',
lua = 'sumneko_lua',
-- 'phpactor',
yaml = 'yamlls',
cmake = 'cmake',
go = 'gopls',
tailwindcss = 'tailwindcss',
salt_ls = 'salt_ls',
ltex = 'ltex',
}
-- server configuration {{{1
local configure_servers = function(language_list)
local capabilities = require('lang.capabilities')
local installer
if not has_lspinstall then
log.warn('Unable to install language servers automatically.', '‼ lsp')
else
installer = require('nvim-lsp-installer.servers')
end
f
.iterate(language_list)
:foreach(function (_, server)
local has_settings, settings = pcall(require, 'lang.servers.' .. server)
if not has_settings then
log.error(
'Missing configuration for language server ' .. server,
'‼ lsp'
)
return
end
if has_lspinstall then
local has_lsp_server, lsp_server = installer.get_server(server)
if has_lsp_server and not lsp_server:is_installed() then
lsp_server:install()
end
end
local function run_hook (hook, client, bufnr, s)
if typex(hook) == 'function' then
hook(client, bufnr, s)
elseif typex(hook) == 'table' then
f
.iterate(hook)
:foreach(function (_, h)
h(client, bufnr, s)
end)
end
end
settings.on_attach = function (client, bufnr)
run_hook(settings.pre_attach, client, bufnr, settings)
run_hook(on_attach, client, bufnr, settings)
run_hook(settings.post_attach, client, bufnr, settings)
log.info('Started ' .. server, ' lsp')
end
settings.flags = {
debounce_text_changes = text_change_default_debounce,
}
settings.capabilities = capabilities
-- TODO: refactor and use lspinstall's post install hook
-- lspinstall.install_server(language)
lspconfig[server].setup(settings)
end)
end
-- main {{{1
if not has_lspconfig then
log.error('Tried loading plugin ... unsuccessfully', '‼ lsp')
return has_lspconfig
end
require('lang.protocol').setup()
require('lang.handlers').setup()
configure_servers(languages)
log.info('Plugin loaded', ' lsp')
return true
-- vim: set fdm=marker fdl=0:
|
-- check for available hunger mods
local hmod = minetest.get_modpath("hunger")
local hbmod = minetest.get_modpath("hbhunger")
local stmod = minetest.get_modpath("stamina")
-- eat pie slice function
local replace_pie = function(node, puncher, pos)
-- is this my pie?
if minetest.is_protected(pos, puncher:get_player_name()) then
return
end
-- which size of pie did we hit?
local pie = node.name:split("_")[1]
local num = tonumber(node.name:split("_")[2])
-- eat slice or remove whole pie
if num == 3 then
node.name = "air"
elseif num < 3 then
node.name = pie .. "_" .. (num + 1)
end
minetest.swap_node(pos, {name = node.name})
-- Blockmen's hud_hunger mod
if hmod then
local h = hunger.read(puncher)
-- print ("hunger is "..h)
h = math.min(h + 4, 30)
local ok = hunger.update_hunger(puncher, h)
minetest.sound_play("hunger_eat", {
pos = pos, gain = 0.7, max_hear_distance = 5})
-- Wuzzy's hbhunger mod
elseif hbmod then
local h = tonumber(hbhunger.hunger[puncher:get_player_name()])
-- print ("hbhunger is "..h)
h = math.min(h + 4, 30)
hbhunger.hunger[puncher:get_player_name()] = h
minetest.sound_play("hbhunger_eat_generic", {
pos = pos, gain = 0.7, max_hear_distance = 5})
-- Sofar's stamina mod
elseif stmod then
stamina.change(puncher, 4)
minetest.sound_play("stamina_eat", {
pos = pos, gain = 0.7, max_hear_distance = 5})
-- none of the above found? add to health instead
else
local h = puncher:get_hp()
-- print ("health is "..h)
h = math.min(h + 4, 20)
puncher:set_hp(h)
end
end
-- register pie bits
local register_pie = function(pie, desc)
-- full pie
minetest.register_node("pie:" .. pie .. "_0", {
description = desc,
paramtype = "light",
sunlight_propagates = false,
tiles = {
pie .. "_top.png", pie .. "_bottom.png", pie .. "_side.png",
pie .. "_side.png", pie .. "_side.png", pie .. "_side.png"
},
inventory_image = pie .. "_inv.png",
wield_image = pie .. "_inv.png",
groups = {crumbly = 1, level = 2},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {{-0.45, -0.5, -0.45, 0.45, 0, 0.45}},
},
on_punch = function(pos, node, puncher, pointed_thing)
replace_pie(node, puncher, pos)
end,
})
-- 3/4 pie
minetest.register_node("pie:" .. pie .. "_1", {
description = "3/4" .. desc,
paramtype = "light",
sunlight_propagates = true,
tiles = {
pie .. "_top.png", pie .. "_bottom.png", pie .. "_side.png",
pie .. "_side.png", pie .. "_side.png", pie .. "_inside.png"
},
groups = {not_in_creative_inventory = 1},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {{-0.45, -0.5, -0.25, 0.45, 0, 0.45}},
},
on_punch = function(pos, node, puncher, pointed_thing)
replace_pie(node, puncher, pos)
end,
})
-- 1/2 pie
minetest.register_node("pie:" .. pie .. "_2", {
description = "Half " .. desc,
paramtype = "light",
sunlight_propagates = true,
tiles = {
pie .. "_top.png", pie .. "_bottom.png", pie .. "_side.png",
pie .. "_side.png", pie .. "_side.png", pie .. "_inside.png"
},
groups = {not_in_creative_inventory = 1},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {{-0.45, -0.5, 0.0, 0.45, 0, 0.45}},
},
on_punch = function(pos, node, puncher, pointed_thing)
replace_pie(node, puncher, pos)
end,
})
-- 1/4 pie
minetest.register_node("pie:" .. pie .. "_3", {
description = "Piece of " .. desc,
paramtype = "light",
sunlight_propagates = true,
tiles = {
pie .. "_top.png", pie .. "_bottom.png", pie .. "_side.png",
pie .. "_side.png", pie .. "_side.png", pie .. "_inside.png"
},
groups = {not_in_creative_inventory = 1},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {{-0.45, -0.5, 0.25, 0.45, 0, 0.45}},
},
on_punch = function(pos, node, puncher, pointed_thing)
replace_pie(node, puncher, pos)
end,
})
end
-- normal cake
register_pie("pie", "Cake")
minetest.register_craft({
output = "pie:pie_0",
recipe = {
{"farming:sugar", "mobs:bucket_milk", "farming:sugar"},
{"farming:sugar", "mobs:egg", "farming:sugar"},
{"farming:wheat", "farming:flour", "farming:wheat"},
},
replacements = {{ "mobs:bucket_milk", "bucket:bucket_empty"}}
})
-- chocolate cake
register_pie("choc", "Chocolate Cake")
minetest.register_craft({
output = "pie:choc_0",
recipe = {
{"farming:cocoa_beans", "mobs:bucket_milk", "farming:cocoa_beans"},
{"farming:sugar", "mobs:egg", "farming:sugar"},
{"farming:wheat", "farming:flour", "farming:wheat"},
},
replacements = {{ "mobs:bucket_milk", "bucket:bucket_empty"}}
})
-- strawberry cheesecake
register_pie("scsk", "Strawberry Cheesecake")
minetest.register_craft({
output = "pie:scsk_0",
recipe = {
{"ethereal:strawberry", "mobs:bucket_milk", "ethereal:strawberry"},
{"farming:sugar", "mobs:egg", "farming:sugar"},
{"farming:wheat", "farming:flour", "farming:wheat"},
},
replacements = {{ "mobs:bucket_milk", "bucket:bucket_empty"}}
})
-- coffee cake
register_pie("coff", "Coffee Cake")
minetest.register_craft({
output = "pie:coff_0",
recipe = {
{"farming:coffee_beans", "mobs:bucket_milk", "farming:coffee_beans"},
{"farming:sugar", "mobs:egg", "farming:sugar"},
{"farming:wheat", "farming:flour", "farming:wheat"},
},
replacements = {{ "mobs:bucket_milk", "bucket:bucket_empty"}}
})
-- red velvet cake
register_pie("rvel", "Red Velvet Cake")
minetest.register_craft({
output = "pie:rvel_0",
recipe = {
{"farming:cocoa_beans", "mobs:bucket_milk", "dye:red"},
{"farming:sugar", "mobs:egg", "farming:sugar"},
{"farming:flour", "mobs:cheese", "farming:flour"},
},
replacements = {{ "mobs:bucket_milk", "bucket:bucket_empty"}}
})
-- meat cake
register_pie("meat", "Meat Cake")
minetest.register_craft({
output = "pie:meat_0",
recipe = {
{"mobs:meat_raw", "mobs:egg", "mobs:meat_raw"},
{"farming:wheat", "farming:wheat", "farming:wheat"},
{"", "", ""}
},
})
-- banana cake
register_pie("bana", "Banana Cake")
minetest.register_craft({
output = "pie:bana_0",
recipe = {
{"ethereal:banana", "mobs:bucket_milk", "ethereal:banana"},
{"farming:sugar", "mobs:egg", "farming:sugar"},
{"farming:wheat", "farming:flour", "farming:wheat"},
},
replacements = {{ "mobs:bucket_milk", "bucket:bucket_empty"}}
})
-- bread pudding
register_pie("brpd","Bread Pudding")
minetest.register_craft({
output = "pie:brpd_0",
recipe = {
{"farming:bread", "mobs:bucket_milk", "farming:bread"},
{"farming:sugar", "mobs:egg", "farming:sugar"},
{"farming:wheat", "farming:flour", "farming:wheat"},
},
replacements = {{ "mobs:bucket_milk", "bucket:bucket_empty"}}
})
-- orange pie
register_pie("orange","Orange Pie")
minetest.register_craft({
output = "pie:orange_0",
recipe = {
{"ethereal:orange", "mobs:bucket_milk", "ethereal:orange"},
{"farming:sugar", "mobs:egg", "farming:sugar"},
{"farming:wheat", "farming:flour", "farming:wheat"},
},
replacements = {{ "mobs:bucket_milk", "bucket:bucket_empty"}}
})
-- add lucky blocks
if minetest.get_modpath("lucky_block") then
lucky_block:add_blocks({
{"nod", "pie:pie_0", 0},
{"nod", "pie:choc_0", 0},
{"nod", "pie:coff_0", 0},
{"tro", "pie:pie_0"},
{"nod", "pie:rvel_0", 0},
{"nod", "pie:scsk_0", 0},
{"nod", "pie:bana_0", 0},
{"nod", "pie:orange_0", 0},
{"tro", "pie:orange_0", "default_place_node_hard", true},
{"nod", "pie:brpd_0", 0},
{"nod", "pie:meat_0", 0},
{"lig"},
})
end
print ("[MOD] Pie loaded")
|
drinkListTable = {
-- Non Alcoholic
-- Vanilla
[8079] = 0, -- Conjured Crystal Water
[18300] = 10, -- Hyjal Nectar
[8766] = 0, -- Morning Glory Dew
[8078] = 0, -- Conjured Sparkling Water
[8077] = 0, -- Conjured Mineral Water
[1645] = 3, -- Moonberry Juice
[19300] = 0, -- Bottled Winterspring Water
[3772] = 0, -- Conjured Spring Water
[4791] = 0, -- Enchanted Water
[1708] = 9, -- Sweet Nectar
[10841] = 30, -- Goldthorn Tea
[5342] = 48, -- Raptor Punch
[2136] = 0, -- Conjured Purified Water
[9451] = 0, -- Bubbling Water
[19299] = 39, -- Fizzy Faire Drink
[2288] = 0, -- Conjured Fresh Water
[7676] = 20, -- Thistle Tea
[5350] = 0, -- Conjured Water
[17198] = 25, -- Winter Veil Egg Nog
-- BC
[22018] = 0, -- Conjured Glacier Water
[27860] = 0, -- Purified Draenic Water
[29395] = 50, -- Ethermead
[29401] = 46, -- Sparkling Southshore Cider
[30457] = 0, -- Gilneas Sparkling Water
[32453] = 41, -- Star's Tears
[32722] = 28, -- Enriched Terocone Juice
[33042] = 5, -- Black Coffee
[34411] = 41, -- Hot Apple Cider
[38431] = 0, -- Blackrock Fortified Water
[32668] = 50, -- Dos Ogris
[28399] = 0, -- Filtered Draenic Water
[30703] = 0, -- Conjured Mountain Spring Water
[38430] = 0, -- Blackrock Mineral Water
[32455] = 33, -- Star's Lament
[38429] = 0, -- Blackrock Spring Water
[33234] = 24, -- Iced Berry Slush
[33236] = 47, -- Fizzy Faire Drink "Classic"
-- WotLK
[42777] = 0, -- Crusader's Waterskin
[41731] = 39, -- Yeti Milk
[33445] = 20, -- Honeymint Tea
[43236] = 22, -- Star's Sorrow
[33444] = 20, -- Pungent Seal Whey
[38698] = 41, -- Bitter Plasma
[44941] = 45, -- Fresh-Squeezed Limeade
[35954] = 33, -- Sweetened Goat's Milk
[37253] = 34, -- Frostberry Juice
[40357] = 29, -- Grizzleberry Juice
[44750] = 0, -- Mountain Water
-- Cata
[58257] = 0, -- Highland Spring Water
[68140] = 25, -- Invigorating Pineapple Punch
[74822] = 33, -- Sasparilla Sinker
[62675] = 27, -- Starfire Espresso
[59029] = 46, -- Greasy Whale Milk
[59230] = 42, -- Fungus Squeezings
[58256] = 0, -- Sparkling Oasis Water
[58274] = 0, -- Fresh Water
[59229] = 5, -- Murky Water
[61382] = 42, -- Garr's Limeade
[63023] = 26, -- Sweet Tea
[60269] = 0, -- Well Water
[49601] = 0, -- Volcanic Spring Water
[63530] = 23, -- Refreshing Pineapple Punch
[49254] = 0, -- Tarp Collected Dew
[75028] = 38, -- Stormwind Surprise
-- MoP
[81414] = 65, -- Pearl Milk Tea
[81923] = 68, -- Cobo Cola
[98127] = 64, -- Dented Can of Kaja'Cola
[105721] = 71, -- Hot Papaya Milk
[75037] = 20, -- Jade Witch Brew
[75026] = 71, -- Ginseng Tea
[81406] = 39, -- Roasted Barley Tea
[104348] = 14, -- Timeless Tea
[105700] = 69, -- Kun-Lai Kicker
[105701] = 40, -- Greenstone Brew
[80313] = 64, -- Ling-Ting's Favorite Tea
[81924] = 5, -- Carbonated Water
[88382] = 11, -- Keenbean Kafa
[88492] = 44, -- Wicked Wikket
[88529] = 5, -- Sparkling Water
[88530] = 17, -- Bubbling Beverage
[88532] = 2, -- Lotus Water
[88578] = 13, -- Cup of Kafa
[89593] = 20, -- Serpent Brew of Fallen Blossoms
[89600] = 43, -- Tiger Brew of Fallen Blossoms
[89592] = 28, -- Serpent Brew of Meditation
[89599] = 40, -- Tiger Brew of Meditation
[89591] = 34, -- Serpent Brew of Pilgramage
[89598] = 29, -- Tiger Brew of Pilgrimage
[89590] = 37, -- Serpent Brew of Adversity
[89597] = 23, -- Tiger Brew of Adversity
[89589] = 28, -- Initiate's Serpent Brew
[89596] = 38, -- Initiate's Tiger Brew
[89588] = 26, -- Novice's Serpent Brew
[89595] = 40, -- Novice's Tiger Brew
[90660] = 19, -- Black Tea
[90659] = 22, -- Jasmine Tea
[74636] = 0, -- Golden Carp Consomme
[85501] = 0, -- Viseclaw Soup
-- WoD
[118897] = 68, -- Miner's Coffee
[117452] = 3, -- Gorgrond Mineral Water
[117475] = 53, -- Clefthoof Milk
[101436] = 68, -- Icemother Milk
[118900] = 26, -- Hol'bruk's Brutal Brew
[120150] = 50, -- Blackrock Coffee
[128385] = 0, -- Elemental-Distilled Water
[159] = 0, --Refreshing Spring Water
[1179] = 2.43, --Ice Cold Milk
[1205] = 13, -- Melon Juice
-- Alcoholic
-- Vanilla
[12003] = 260, -- Dark Dwarven Lager - No Longer in Game
[2595] = 300, -- Jug of Badlands Bourbon
[17402] = 254, -- Greatfather's Winter Ale
[2594] = 256, -- Flagon of Dwarven Mead
[4600] = 294, -- Cherry Grog
[422] = 286, -- Dwarven Mild
[2593] = 299, -- Flask of Stormwind Tawny
[2596] = 296, -- Skin of Dwarven Stout
[11846] = 285, -- Wizbang's Special Brew - No Longer in Game
[17403] = 279, -- Steamwheedle Fizzy Spirits
[21721] = 276, -- Moonglow
[2686] = 265, -- Thunder Ale
[2723] = 254, -- Bottle of Dalaran Noir
[2894] = 268, -- Rhapsody Malt
[3703] = 290, -- Southshore Stout
[4595] = 251, -- Junglevine Wine
[9260] = 262, -- Volatile Rum
[9360] = 292, -- Cuergo's Gold - No Longer in Game
[9361] = 257, -- Curego's Gold with Worm - No Longer in Game
[17196] = 260, -- Holiday Spirits
[18287] = 277, -- Evermurky
[18288] = 296, -- Molasses Firewater
[19221] = 276, -- Darkkmoon Special Reserve
[19222] = 277, -- Cheap Beer
[20709] = 254, -- Rumsey Rum Light
[21114] = 288, -- Rumsey Rum Dark
[21151] = 277, -- Rumsey Rum Black Label
-- BC
[32667] = 268, -- Bash Ale
[29454] = 297, -- Silverwine
[35720] = 265, -- Lord of Frost's Private Label
[23848] = 281, -- Nethergarde Bitter
[38466] = 274, -- Sulfuron Slammer
[38432] = 275, -- Plugger's Blackrock Ale
[28284] = 296, -- Don Carlos Tequila
[29112] = 258, -- Cenarion Spirits
[34832] = 274, -- Captain Rumsey's Lager
-- WotLK
[39520] = 251, -- Kungaloosh
[44619] = 294, -- Glass of Peaked Dalaran Red
[44618] = 255, -- Glass of Aged Dalaran Red
[44616] = 280, -- Glass of Dalaran White
[44574] = 294, -- Skin of Mulgore Firewater
[40042] = 285, -- Caraway Burnwine
[44573] = 297, -- Cup of Frog Venom Brew
[40036] = 279, -- Snowplum Brandy
[44575] = 285, -- Flask of Bitter Cactus Cider
[44571] = 295, -- Bottle of Silvermoon Port
[38350] = 263, -- Winterfin "Depth Charge"
[40035] = 265, -- Northrend Honey Mead
[43695] = 269, -- Half Full Bottle of Prison Moonshine
[43696] = 271, -- Half Empty Bottle of Prison Moonshine
[44570] = 273, -- Glass of Eversong Wine
[44617] = 266, -- Glass of Dalaran Red
[44716] = 277, -- Mysterious Fermented Liquid
-- Cata
[63251] = 253, -- Mei's Masterful Brew
[62672] = 295, -- South Island Iced Tea
[61986] = 253, -- Tol Barad Coconut Rum
[64639] = 256, -- Silversnap Ice
[61983] = 264, -- Imported E.K. Ale
[61984] = 255, -- Potent Pineapple Punch
[63299] = 264, -- Sunkissed Wine
[57543] = 283, -- Stormhammer Stout
[61384] = 284, -- Doublerum
[61982] = 260, -- Fizzy Fruit Wine
[62674] = 284, -- Highland Spirits
[62790] = 282, -- Darkbrew Lager
[63275] = 275, -- Gilnean Fortified Brandy
[63291] = 272, -- Blood Red Ale
[63292] = 286, -- Disgusting Rotgut
[63293] = 300, -- Blackheart Grog
[63296] = 266, -- Embalming Fluid
-- MoP
[88531] = 279, -- Lao Chin's Last Mug
[75038] = 289, -- Mad Brewer's Breakfast
[81415] = 259, -- Pandaren Plum Wine
[82344] = 275, -- Hearthglen Ambrosia
[83094] = 264, -- Foote Tripel
[86432] = 252, -- Banana Infused Rum
[87264] = 264, -- Four Senses Brew
[105700] = 272, -- Kun-Lai Kicker
[105701] = 276, -- Greenstone Brew
[105702] = 277, -- Boomer Brew
[105703] = 274, -- Stormstout Brew
[105704] = 278, -- Yan-Zhu's Blazing Brew
[105705] = 262, -- Chani's Bitter Brew
[105706] = 255, -- Shado-Pan Brew
[105707] = 285, -- Unga Brew
[105708] = 275, -- Shimmering Amber-Brew
[105711] = 291, -- Funky Monkey Brew
[81407] = 293, -- Four Wind Soju
[82343] = 293, -- Loraeron Lambic
[83095] = 260, -- Lagrave Stout
[88490] = 255, -- Triple-Distilled Brew
[89594] = 267, -- Serpent Brew of Serenity
[89601] = 283, -- Tiger Brew of Serenity
[89683] = 290, -- Hozen Cuervo
[98157] = 262, -- Big Blossom Brew
[104316] = 280, -- Spectral Grog
-- WoD
[117439] = 252, -- "Da Bruisery" Hot & Wroth
[117440] = 265, -- Peglegger's Porter
[117442] = 274, -- Thunderbelly Mead
[117454] = 296, -- Gorgrond Grapes
[117457] = 260, -- Blood Apples
[119022] = 259, -- Shadowmoon Sugar Pear Cider
[119157] = 271, -- Saberon Cat-Sip
[119324] = 271, -- Savage Remedy
[120959] = 261, -- Pinchwistle "Nitro Fuel"
[116917] = 258, -- Sailor Zazzuk's 180-Proof Rum
[117453] = 254, -- "Da Bruisery" OPA
[117568] = 279, -- Jug of Ironwine
[117437] = 291, -- Skyreach Sunrise
[113108] = 300, -- Ogre Moonshine
[114017] = 296, -- Steamwheedle Wagon Bomb
[117441] = 2, -- Elekk's Neck
[111522] = 232, -- Tikari & K.A.Y.T.
}
|
local function createULibSyncUsersTable()
local q = ULibSync.mysql:query('CREATE TABLE IF NOT EXISTS `ulib_users` (' ..
'`id` INT AUTO_INCREMENT PRIMARY KEY,' ..
'`steamid` VARCHAR(19) UNIQUE NOT NULL,' ..
'`removed` BOOLEAN NOT NULL DEFAULT FALSE,' ..
'`group` VARCHAR(20),' ..
'`date_created` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),' ..
'`date_updated` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6)' ..
');')
function q:onError(err)
ULibSync.log('Table creation failed.', 'users', 50, err)
end
q:start()
end
local function addULibSyncUsersHooks()
hook.Add('ULibUserGroupChange', 'ULibSyncUserGroupChange', function (id, allows, denies, newGroup, oldGroup)
ULibSync.syncULibUser(id, newGroup)
end)
hook.Add('ULibUserRemoved', 'ULibSyncUserRemoved', ULibSync.syncULibUserRemoved)
end
local function removeULibSyncUsersHooks()
hook.Remove('ULibUserGroupChange', 'ULibSyncUserGroupChange')
hook.Remove('ULibUserRemoved', 'ULibSyncUserRemoved')
end
function ULibSync.initUsersSync()
ULibSync.log('Initializing sync.', 'users', 10)
createULibSyncUsersTable()
addULibSyncUsersHooks()
end
function ULibSync.syncULibUsers()
for steamid, userData in pairs(ULib.ucl.users) do
ULibSync.syncULibUser(steamid, userData['group'])
end
end
function ULibSync.syncULibUser(steamid, group)
ULibSync.log('Attemping to sync user.', steamid, 10)
local q = ULibSync.mysql:prepare('REPLACE INTO ulib_users (`steamid`, `group`) VALUES (?, ?)')
q:setString(1, steamid)
q:setString(2, group)
function q:onSuccess(data)
ULibSync.log('User has been synced successfully.', steamid, 20)
end
function q:onError(err)
ULibSync.log('User has not been synced.', steamid, 40, err)
end
q:start()
end
function ULibSync.syncULibUserRemoved(steamid)
ULibSync.log('Attemping to sync user removed.', steamid, 10)
local q = ULibSync.mysql:prepare('UPDATE ulib_users SET removed = ? WHERE steamid = ?')
q:setBoolean(1, true)
q:setString(2, steamid)
function q:onSuccess(data)
ULibSync.log('User removal has been synced successfully.', steamid, 20)
end
function q:onError(err)
ULibSync.log('User removal has not been synced.', steamid, 40, err)
end
q:start()
end
function ULibSync.syncULibUsersGroupChanged(oldGroup, newGroup)
ULibSync.log('Attemping to sync all user group changes.', newGroup, 10)
local q = ULibSync.mysql:prepare('UPDATE ulib_users SET `group` = ? WHERE `group` = ?')
q:setString(1, newGroup)
q:setString(2, oldGroup)
function q:onSuccess(data)
ULibSync.log('All user group changes have been synced successfully.', newGroup, 20)
end
function q:onError(err)
ULibSync.log('All user group changes have not been synced.', newGroup, 40, err)
end
q:start()
end
local function syncULibSyncUserLocally(steamid, uLibSyncUser)
if uLibSyncUser.removed == 0 then
if not ULib.ucl.users[steamid] or ULib.ucl.users[steamid].group ~= uLibSyncUser.group then
local success, result = pcall(ULib.ucl.addUser, steamid, nil, nil, uLibSyncUser.group, nil)
if success then
ULibSync.log('User has been synced locally.', steamid, 20)
else
ULibSync.log('User has not been synced locally. Syncing ULibSync groups locally may fix.', steamid, 30, result)
end
end
else
if ULib.ucl.users[steamid] then
ULib.ucl.removeUser(steamid)
end
end
end
function ULibSync.syncULibSyncUsers()
ULibSync.log('Attemping to sync locally.', 'users', 10)
local q = ULibSync.mysql:prepare('SELECT `group`, removed, steamid FROM ulib_users')
function q:onSuccess(data)
removeULibSyncUsersHooks()
for index, uLibSyncUser in pairs(data) do
syncULibSyncUserLocally(uLibSyncUser.steamid, uLibSyncUser)
end
addULibSyncUsersHooks()
end
function q:onError(err)
ULibSync.log('Local syncing failed.', 'users', 40, err)
end
q:start()
end
function ULibSync.syncULibSyncUser(ply)
local steamid = ply:SteamID()
ULibSync.log('Attemping to sync user locally.', steamid, 10)
local q = ULibSync.mysql:prepare('SELECT `group`, removed FROM ulib_users WHERE steamid = ?')
q:setString(1, steamid)
function q:onSuccess(data)
local uLibSyncUser = data[1]
if uLibSyncUser then
removeULibSyncUsersHooks()
syncULibSyncUserLocally(steamid, uLibSyncUser)
addULibSyncUsersHooks()
end
end
function q:onError(err)
ULibSync.log('User has not been synced locally.', steamid, 40, err)
end
q:start()
end
if ULibSync.syncUserOnJoin then hook.Add('ULibLocalPlayerReady', 'ULibSyncUserGroupCheck', ULibSync.syncULibSyncUser) end
|
object_tangible_loot_npc_loot_shared_aero_magnifier_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_aero_magnifier_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_aero_magnifier_generic, "object/tangible/loot/npc_loot/shared_aero_magnifier_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_answering_machine_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_answering_machine_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_answering_machine_generic, "object/tangible/loot/npc_loot/shared_answering_machine_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_armor_repair_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_armor_repair_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_armor_repair_device_generic, "object/tangible/loot/npc_loot/shared_armor_repair_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_artifact_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_artifact_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_artifact_generic, "object/tangible/loot/npc_loot/shared_artifact_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_atat_life_support_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_atat_life_support_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_atat_life_support_generic, "object/tangible/loot/npc_loot/shared_atat_life_support_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_bacta_ampules_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_bacta_ampules_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_bacta_ampules_generic, "object/tangible/loot/npc_loot/shared_bacta_ampules_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_basket_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_basket_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_basket_generic, "object/tangible/loot/npc_loot/shared_basket_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_blue_wiring_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_blue_wiring_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_blue_wiring_generic, "object/tangible/loot/npc_loot/shared_blue_wiring_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_bottle_s01_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_bottle_s01_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_bottle_s01_generic, "object/tangible/loot/npc_loot/shared_bottle_s01_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_bottle_s02_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_bottle_s02_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_bottle_s02_generic, "object/tangible/loot/npc_loot/shared_bottle_s02_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_bottle_s03_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_bottle_s03_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_bottle_s03_generic, "object/tangible/loot/npc_loot/shared_bottle_s03_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_bottle_s04_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_bottle_s04_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_bottle_s04_generic, "object/tangible/loot/npc_loot/shared_bottle_s04_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_bowl_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_bowl_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_bowl_generic, "object/tangible/loot/npc_loot/shared_bowl_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_briefcase_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_briefcase_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_briefcase_generic, "object/tangible/loot/npc_loot/shared_briefcase_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_broad_spectrum_med_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_broad_spectrum_med_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_broad_spectrum_med_device_generic, "object/tangible/loot/npc_loot/shared_broad_spectrum_med_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_bug_jar_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_bug_jar_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_bug_jar_generic, "object/tangible/loot/npc_loot/shared_bug_jar_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_building_repair_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_building_repair_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_building_repair_device_generic, "object/tangible/loot/npc_loot/shared_building_repair_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_cage_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_cage_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_cage_generic, "object/tangible/loot/npc_loot/shared_cage_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_camera_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_camera_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_camera_generic, "object/tangible/loot/npc_loot/shared_camera_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_canister_small_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_canister_small_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_canister_small_device_generic, "object/tangible/loot/npc_loot/shared_canister_small_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_chance_cube_8_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_chance_cube_8_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_chance_cube_8_generic, "object/tangible/loot/npc_loot/shared_chance_cube_8_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_chassis_blueprint_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_chassis_blueprint_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_chassis_blueprint_device_generic, "object/tangible/loot/npc_loot/shared_chassis_blueprint_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_chem_dispersion_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_chem_dispersion_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_chem_dispersion_device_generic, "object/tangible/loot/npc_loot/shared_chem_dispersion_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_circuit_board_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_circuit_board_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_circuit_board_generic, "object/tangible/loot/npc_loot/shared_circuit_board_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_clamp_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_clamp_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_clamp_generic, "object/tangible/loot/npc_loot/shared_clamp_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_clipon_id_badge_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_clipon_id_badge_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_clipon_id_badge_generic, "object/tangible/loot/npc_loot/shared_clipon_id_badge_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_clothing_repair_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_clothing_repair_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_clothing_repair_device_generic, "object/tangible/loot/npc_loot/shared_clothing_repair_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_cloth_box_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_cloth_box_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_cloth_box_generic, "object/tangible/loot/npc_loot/shared_cloth_box_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_cloth_kit_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_cloth_kit_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_cloth_kit_generic, "object/tangible/loot/npc_loot/shared_cloth_kit_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_comlink_civilian_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_comlink_civilian_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_comlink_civilian_generic, "object/tangible/loot/npc_loot/shared_comlink_civilian_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_copper_battery_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_copper_battery_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_copper_battery_generic, "object/tangible/loot/npc_loot/shared_copper_battery_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_datadisk_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_datadisk_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_datadisk_generic, "object/tangible/loot/npc_loot/shared_datadisk_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_datapad_flashy_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_datapad_flashy_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_datapad_flashy_generic, "object/tangible/loot/npc_loot/shared_datapad_flashy_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_datapad_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_datapad_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_datapad_generic, "object/tangible/loot/npc_loot/shared_datapad_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_datapad_trakball_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_datapad_trakball_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_datapad_trakball_generic, "object/tangible/loot/npc_loot/shared_datapad_trakball_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_decryptor_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_decryptor_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_decryptor_generic, "object/tangible/loot/npc_loot/shared_decryptor_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_deed_datapad_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_deed_datapad_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_deed_datapad_generic, "object/tangible/loot/npc_loot/shared_deed_datapad_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_dermal_analyzer_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_dermal_analyzer_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_dermal_analyzer_generic, "object/tangible/loot/npc_loot/shared_dermal_analyzer_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_disguise_makeup_kit_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_disguise_makeup_kit_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_disguise_makeup_kit_generic, "object/tangible/loot/npc_loot/shared_disguise_makeup_kit_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_disk_drive_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_disk_drive_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_disk_drive_generic, "object/tangible/loot/npc_loot/shared_disk_drive_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_dye_set_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_dye_set_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_dye_set_generic, "object/tangible/loot/npc_loot/shared_dye_set_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_electronic_key_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_electronic_key_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_electronic_key_generic, "object/tangible/loot/npc_loot/shared_electronic_key_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_electro_polearm_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_electro_polearm_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_electro_polearm_generic, "object/tangible/loot/npc_loot/shared_electro_polearm_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_elect_module_complex_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_elect_module_complex_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_elect_module_complex_generic, "object/tangible/loot/npc_loot/shared_elect_module_complex_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_elect_module_misc_01 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_elect_module_misc_01.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_elect_module_misc_01, "object/tangible/loot/npc_loot/shared_elect_module_misc_01.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_elect_module_simple_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_elect_module_simple_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_elect_module_simple_generic, "object/tangible/loot/npc_loot/shared_elect_module_simple_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_elect_module_wires = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_elect_module_wires.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_elect_module_wires, "object/tangible/loot/npc_loot/shared_elect_module_wires.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_elect_power_unit_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_elect_power_unit_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_elect_power_unit_generic, "object/tangible/loot/npc_loot/shared_elect_power_unit_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_engineer_analysis_board_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_engineer_analysis_board_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_engineer_analysis_board_generic, "object/tangible/loot/npc_loot/shared_engineer_analysis_board_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_firework_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_firework_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_firework_generic, "object/tangible/loot/npc_loot/shared_firework_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_flask_sample_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_flask_sample_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_flask_sample_device_generic, "object/tangible/loot/npc_loot/shared_flask_sample_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_fliptop_calibrator_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_fliptop_calibrator_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_fliptop_calibrator_generic, "object/tangible/loot/npc_loot/shared_fliptop_calibrator_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_frequency_jammer_wire_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_frequency_jammer_wire_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_frequency_jammer_wire_generic, "object/tangible/loot/npc_loot/shared_frequency_jammer_wire_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_furniture_repair_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_furniture_repair_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_furniture_repair_device_generic, "object/tangible/loot/npc_loot/shared_furniture_repair_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_generator_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_generator_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_generator_device_generic, "object/tangible/loot/npc_loot/shared_generator_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_generic_crystal = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_generic_crystal.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_generic_crystal, "object/tangible/loot/npc_loot/shared_generic_crystal.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_generic_tool_kit_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_generic_tool_kit_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_generic_tool_kit_generic, "object/tangible/loot/npc_loot/shared_generic_tool_kit_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_green_stone_necklace_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_green_stone_necklace_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_green_stone_necklace_generic, "object/tangible/loot/npc_loot/shared_green_stone_necklace_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_handheld_viewscreen_1_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_handheld_viewscreen_1_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_handheld_viewscreen_1_generic, "object/tangible/loot/npc_loot/shared_handheld_viewscreen_1_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_handheld_viewscreen_2_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_handheld_viewscreen_2_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_handheld_viewscreen_2_generic, "object/tangible/loot/npc_loot/shared_handheld_viewscreen_2_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_healing_chemical_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_healing_chemical_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_healing_chemical_generic, "object/tangible/loot/npc_loot/shared_healing_chemical_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_axkva_min_claw = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_axkva_min_claw.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_axkva_min_claw, "object/tangible/loot/npc_loot/shared_heroic_axkva_min_claw.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_axkva_min_claw_light = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_axkva_min_claw_light.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_axkva_min_claw_light, "object/tangible/loot/npc_loot/shared_heroic_axkva_min_claw_light.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_axkva_min_crystal_s01 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_axkva_min_crystal_s01.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_axkva_min_crystal_s01, "object/tangible/loot/npc_loot/shared_heroic_axkva_min_crystal_s01.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_axkva_min_crystal_s02 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_axkva_min_crystal_s02.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_axkva_min_crystal_s02, "object/tangible/loot/npc_loot/shared_heroic_axkva_min_crystal_s02.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_axkva_min_crystal_s03 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_axkva_min_crystal_s03.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_axkva_min_crystal_s03, "object/tangible/loot/npc_loot/shared_heroic_axkva_min_crystal_s03.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_destroyer_cooling_coil = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_destroyer_cooling_coil.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_destroyer_cooling_coil, "object/tangible/loot/npc_loot/shared_heroic_destroyer_cooling_coil.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_destroyer_power_transformer = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_destroyer_power_transformer.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_destroyer_power_transformer, "object/tangible/loot/npc_loot/shared_heroic_destroyer_power_transformer.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_destroyer_reactor_console = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_destroyer_reactor_console.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_destroyer_reactor_console, "object/tangible/loot/npc_loot/shared_heroic_destroyer_reactor_console.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_destroyer_space_beacon = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_destroyer_space_beacon.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_destroyer_space_beacon, "object/tangible/loot/npc_loot/shared_heroic_destroyer_space_beacon.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_exar_brazier = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_exar_brazier.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_exar_brazier, "object/tangible/loot/npc_loot/shared_heroic_exar_brazier.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_exar_claw_s01 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_exar_claw_s01.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_exar_claw_s01, "object/tangible/loot/npc_loot/shared_heroic_exar_claw_s01.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_exar_claw_s02 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_exar_claw_s02.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_exar_claw_s02, "object/tangible/loot/npc_loot/shared_heroic_exar_claw_s02.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_exar_roots_s01 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_exar_roots_s01.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_exar_roots_s01, "object/tangible/loot/npc_loot/shared_heroic_exar_roots_s01.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_exar_roots_s02 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_exar_roots_s02.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_exar_roots_s02, "object/tangible/loot/npc_loot/shared_heroic_exar_roots_s02.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_exar_roots_s03 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_exar_roots_s03.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_exar_roots_s03, "object/tangible/loot/npc_loot/shared_heroic_exar_roots_s03.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_exar_roots_s04 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_exar_roots_s04.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_exar_roots_s04, "object/tangible/loot/npc_loot/shared_heroic_exar_roots_s04.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_exar_torch = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_exar_torch.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_exar_torch, "object/tangible/loot/npc_loot/shared_heroic_exar_torch.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_sm_generator = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_sm_generator.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_sm_generator, "object/tangible/loot/npc_loot/shared_heroic_sm_generator.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_solar_panel = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_solar_panel.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_solar_panel, "object/tangible/loot/npc_loot/shared_heroic_solar_panel.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_tusken_meat_rack = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_tusken_meat_rack.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_tusken_meat_rack, "object/tangible/loot/npc_loot/shared_heroic_tusken_meat_rack.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_tusken_shelves = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_tusken_shelves.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_tusken_shelves, "object/tangible/loot/npc_loot/shared_heroic_tusken_shelves.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_tusken_stairs = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_tusken_stairs.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_tusken_stairs, "object/tangible/loot/npc_loot/shared_heroic_tusken_stairs.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_tusken_vent_pillar = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_tusken_vent_pillar.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_tusken_vent_pillar, "object/tangible/loot/npc_loot/shared_heroic_tusken_vent_pillar.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_heroic_wall_lamp = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_heroic_wall_lamp.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_heroic_wall_lamp, "object/tangible/loot/npc_loot/shared_heroic_wall_lamp.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_holocube_splinters_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_holocube_splinters_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_holocube_splinters_generic, "object/tangible/loot/npc_loot/shared_holocube_splinters_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_hovercrate_transport_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_hovercrate_transport_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_hovercrate_transport_generic, "object/tangible/loot/npc_loot/shared_hovercrate_transport_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_hyperdrive_part_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_hyperdrive_part_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_hyperdrive_part_generic, "object/tangible/loot/npc_loot/shared_hyperdrive_part_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_id_chip_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_id_chip_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_id_chip_generic, "object/tangible/loot/npc_loot/shared_id_chip_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_impulse_detector_01_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_impulse_detector_01_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_impulse_detector_01_generic, "object/tangible/loot/npc_loot/shared_impulse_detector_01_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_impulse_detector_02_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_impulse_detector_02_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_impulse_detector_02_generic, "object/tangible/loot/npc_loot/shared_impulse_detector_02_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_imp_life_support_pack_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_imp_life_support_pack_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_imp_life_support_pack_generic, "object/tangible/loot/npc_loot/shared_imp_life_support_pack_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_installation_repair_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_installation_repair_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_installation_repair_device_generic, "object/tangible/loot/npc_loot/shared_installation_repair_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jellyfish_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jellyfish_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jellyfish_generic, "object/tangible/loot/npc_loot/shared_jellyfish_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_ear_s02 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_ear_s02.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_ear_s02, "object/tangible/loot/npc_loot/shared_jewelry_ear_s02.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_ear_s03 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_ear_s03.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_ear_s03, "object/tangible/loot/npc_loot/shared_jewelry_ear_s03.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_ear_s04 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_ear_s04.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_ear_s04, "object/tangible/loot/npc_loot/shared_jewelry_ear_s04.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_ear_s06 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_ear_s06.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_ear_s06, "object/tangible/loot/npc_loot/shared_jewelry_ear_s06.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_ear_s07 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_ear_s07.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_ear_s07, "object/tangible/loot/npc_loot/shared_jewelry_ear_s07.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_ear_s08 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_ear_s08.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_ear_s08, "object/tangible/loot/npc_loot/shared_jewelry_ear_s08.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_ear_s09 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_ear_s09.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_ear_s09, "object/tangible/loot/npc_loot/shared_jewelry_ear_s09.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_ear_s10 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_ear_s10.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_ear_s10, "object/tangible/loot/npc_loot/shared_jewelry_ear_s10.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_ear_s11 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_ear_s11.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_ear_s11, "object/tangible/loot/npc_loot/shared_jewelry_ear_s11.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_ear_s12 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_ear_s12.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_ear_s12, "object/tangible/loot/npc_loot/shared_jewelry_ear_s12.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_ear_s13 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_ear_s13.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_ear_s13, "object/tangible/loot/npc_loot/shared_jewelry_ear_s13.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_ear_s14 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_ear_s14.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_ear_s14, "object/tangible/loot/npc_loot/shared_jewelry_ear_s14.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_ear_s15 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_ear_s15.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_ear_s15, "object/tangible/loot/npc_loot/shared_jewelry_ear_s15.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_jewelry_setting_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_jewelry_setting_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_jewelry_setting_generic, "object/tangible/loot/npc_loot/shared_jewelry_setting_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_large_dispersal_unit_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_large_dispersal_unit_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_large_dispersal_unit_generic, "object/tangible/loot/npc_loot/shared_large_dispersal_unit_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_laser_trap_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_laser_trap_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_laser_trap_generic, "object/tangible/loot/npc_loot/shared_laser_trap_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_launcher_tube_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_launcher_tube_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_launcher_tube_generic, "object/tangible/loot/npc_loot/shared_launcher_tube_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_ledger_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_ledger_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_ledger_generic, "object/tangible/loot/npc_loot/shared_ledger_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_magseal_detector_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_magseal_detector_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_magseal_detector_generic, "object/tangible/loot/npc_loot/shared_magseal_detector_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_medical_console_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_medical_console_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_medical_console_generic, "object/tangible/loot/npc_loot/shared_medical_console_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_medical_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_medical_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_medical_device_generic, "object/tangible/loot/npc_loot/shared_medical_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_medical_enhance_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_medical_enhance_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_medical_enhance_device_generic, "object/tangible/loot/npc_loot/shared_medical_enhance_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_metal_ball_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_metal_ball_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_metal_ball_generic, "object/tangible/loot/npc_loot/shared_metal_ball_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_metal_barrel_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_metal_barrel_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_metal_barrel_generic, "object/tangible/loot/npc_loot/shared_metal_barrel_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_metal_case_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_metal_case_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_metal_case_generic, "object/tangible/loot/npc_loot/shared_metal_case_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_motivator_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_motivator_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_motivator_device_generic, "object/tangible/loot/npc_loot/shared_motivator_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_notebook_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_notebook_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_notebook_generic, "object/tangible/loot/npc_loot/shared_notebook_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_organichem_stores_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_organichem_stores_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_organichem_stores_generic, "object/tangible/loot/npc_loot/shared_organichem_stores_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_pearl_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_pearl_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_pearl_generic, "object/tangible/loot/npc_loot/shared_pearl_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_place_setting_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_place_setting_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_place_setting_generic, "object/tangible/loot/npc_loot/shared_place_setting_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_power_output_analyzer_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_power_output_analyzer_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_power_output_analyzer_generic, "object/tangible/loot/npc_loot/shared_power_output_analyzer_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_preserved_bugs_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_preserved_bugs_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_preserved_bugs_generic, "object/tangible/loot/npc_loot/shared_preserved_bugs_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_prop_jacket_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_prop_jacket_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_prop_jacket_generic, "object/tangible/loot/npc_loot/shared_prop_jacket_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_radio_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_radio_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_radio_generic, "object/tangible/loot/npc_loot/shared_radio_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_ration_kit_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_ration_kit_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_ration_kit_device_generic, "object/tangible/loot/npc_loot/shared_ration_kit_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_rebreather_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_rebreather_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_rebreather_generic, "object/tangible/loot/npc_loot/shared_rebreather_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_recording_rod_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_recording_rod_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_recording_rod_generic, "object/tangible/loot/npc_loot/shared_recording_rod_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_red_wiring_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_red_wiring_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_red_wiring_generic, "object/tangible/loot/npc_loot/shared_red_wiring_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_rng_weapon_repair_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_rng_weapon_repair_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_rng_weapon_repair_device_generic, "object/tangible/loot/npc_loot/shared_rng_weapon_repair_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_rocket_ammo_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_rocket_ammo_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_rocket_ammo_generic, "object/tangible/loot/npc_loot/shared_rocket_ammo_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_rocket_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_rocket_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_rocket_generic, "object/tangible/loot/npc_loot/shared_rocket_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_rock_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_rock_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_rock_generic, "object/tangible/loot/npc_loot/shared_rock_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_rusty_toolkit_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_rusty_toolkit_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_rusty_toolkit_generic, "object/tangible/loot/npc_loot/shared_rusty_toolkit_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_scope_weapon_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_scope_weapon_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_scope_weapon_generic, "object/tangible/loot/npc_loot/shared_scope_weapon_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_scroll_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_scroll_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_scroll_generic, "object/tangible/loot/npc_loot/shared_scroll_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_serum_vial_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_serum_vial_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_serum_vial_generic, "object/tangible/loot/npc_loot/shared_serum_vial_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_shield_module_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_shield_module_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_shield_module_generic, "object/tangible/loot/npc_loot/shared_shield_module_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_shield_repair_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_shield_repair_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_shield_repair_device_generic, "object/tangible/loot/npc_loot/shared_shield_repair_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_shisa_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_shisa_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_shisa_generic, "object/tangible/loot/npc_loot/shared_shisa_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_shoe_soul_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_shoe_soul_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_shoe_soul_generic, "object/tangible/loot/npc_loot/shared_shoe_soul_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_slave_collar_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_slave_collar_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_slave_collar_generic, "object/tangible/loot/npc_loot/shared_slave_collar_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_small_motor_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_small_motor_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_small_motor_generic, "object/tangible/loot/npc_loot/shared_small_motor_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_software_module_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_software_module_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_software_module_generic, "object/tangible/loot/npc_loot/shared_software_module_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_software_module_orange_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_software_module_orange_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_software_module_orange_generic, "object/tangible/loot/npc_loot/shared_software_module_orange_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_software_module_red_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_software_module_red_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_software_module_red_generic, "object/tangible/loot/npc_loot/shared_software_module_red_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_solar_panel = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_solar_panel.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_solar_panel, "object/tangible/loot/npc_loot/shared_solar_panel.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_speaker_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_speaker_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_speaker_generic, "object/tangible/loot/npc_loot/shared_speaker_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_booster_blue_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_booster_blue_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_booster_blue_generic, "object/tangible/loot/npc_loot/shared_spice_booster_blue_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_crash_n_burn_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_crash_n_burn_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_crash_n_burn_generic, "object/tangible/loot/npc_loot/shared_spice_crash_n_burn_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_droid_lube_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_droid_lube_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_droid_lube_generic, "object/tangible/loot/npc_loot/shared_spice_droid_lube_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_giggledust_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_giggledust_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_giggledust_generic, "object/tangible/loot/npc_loot/shared_spice_giggledust_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_grey_gabaki_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_grey_gabaki_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_grey_gabaki_generic, "object/tangible/loot/npc_loot/shared_spice_grey_gabaki_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_gunjack_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_gunjack_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_gunjack_generic, "object/tangible/loot/npc_loot/shared_spice_gunjack_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_kliknik_boost_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_kliknik_boost_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_kliknik_boost_generic, "object/tangible/loot/npc_loot/shared_spice_kliknik_boost_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_kwi_boost_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_kwi_boost_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_kwi_boost_generic, "object/tangible/loot/npc_loot/shared_spice_kwi_boost_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_muon_gold_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_muon_gold_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_muon_gold_generic, "object/tangible/loot/npc_loot/shared_spice_muon_gold_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_neutron_pixey_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_neutron_pixey_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_neutron_pixey_generic, "object/tangible/loot/npc_loot/shared_spice_neutron_pixey_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_pyrepenol_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_pyrepenol_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_pyrepenol_generic, "object/tangible/loot/npc_loot/shared_spice_pyrepenol_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_scramjet_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_scramjet_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_scramjet_generic, "object/tangible/loot/npc_loot/shared_spice_scramjet_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_sedative_h4b_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_sedative_h4b_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_sedative_h4b_generic, "object/tangible/loot/npc_loot/shared_spice_sedative_h4b_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_shadowpaw_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_shadowpaw_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_shadowpaw_generic, "object/tangible/loot/npc_loot/shared_spice_shadowpaw_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_sweetblossom_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_sweetblossom_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_sweetblossom_generic, "object/tangible/loot/npc_loot/shared_spice_sweetblossom_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_thruster_head_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_thruster_head_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_thruster_head_generic, "object/tangible/loot/npc_loot/shared_spice_thruster_head_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spice_yarrock_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spice_yarrock_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spice_yarrock_generic, "object/tangible/loot/npc_loot/shared_spice_yarrock_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spray_bottle_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spray_bottle_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spray_bottle_generic, "object/tangible/loot/npc_loot/shared_spray_bottle_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spray_unit_small_01_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spray_unit_small_01_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spray_unit_small_01_generic, "object/tangible/loot/npc_loot/shared_spray_unit_small_01_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spray_unit_small_02_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spray_unit_small_02_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spray_unit_small_02_generic, "object/tangible/loot/npc_loot/shared_spray_unit_small_02_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spray_unit_small_03_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spray_unit_small_03_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spray_unit_small_03_generic, "object/tangible/loot/npc_loot/shared_spray_unit_small_03_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_spray_unit_small_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_spray_unit_small_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_spray_unit_small_generic, "object/tangible/loot/npc_loot/shared_spray_unit_small_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_stasis_field_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_stasis_field_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_stasis_field_generic, "object/tangible/loot/npc_loot/shared_stasis_field_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_stim_a_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_stim_a_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_stim_a_generic, "object/tangible/loot/npc_loot/shared_stim_a_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_substance_analyzer_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_substance_analyzer_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_substance_analyzer_generic, "object/tangible/loot/npc_loot/shared_substance_analyzer_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_supplement_liquid = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_supplement_liquid.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_supplement_liquid, "object/tangible/loot/npc_loot/shared_supplement_liquid.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_supplement_solid = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_supplement_solid.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_supplement_solid, "object/tangible/loot/npc_loot/shared_supplement_solid.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_supplement_solid_pills = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_supplement_solid_pills.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_supplement_solid_pills, "object/tangible/loot/npc_loot/shared_supplement_solid_pills.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_survey_pad_adv_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_survey_pad_adv_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_survey_pad_adv_generic, "object/tangible/loot/npc_loot/shared_survey_pad_adv_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_survival_equipment_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_survival_equipment_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_survival_equipment_generic, "object/tangible/loot/npc_loot/shared_survival_equipment_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_syringe_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_syringe_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_syringe_generic, "object/tangible/loot/npc_loot/shared_syringe_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_tech_food_basket_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_tech_food_basket_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_tech_food_basket_generic, "object/tangible/loot/npc_loot/shared_tech_food_basket_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_tool_bundle_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_tool_bundle_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_tool_bundle_generic, "object/tangible/loot/npc_loot/shared_tool_bundle_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_tubed_device_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_tubed_device_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_tubed_device_generic, "object/tangible/loot/npc_loot/shared_tubed_device_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_tube_paste_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_tube_paste_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_tube_paste_generic, "object/tangible/loot/npc_loot/shared_tube_paste_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_wiring_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_wiring_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_wiring_generic, "object/tangible/loot/npc_loot/shared_wiring_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_worklight_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_worklight_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_worklight_generic, "object/tangible/loot/npc_loot/shared_worklight_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
object_tangible_loot_npc_loot_shared_writing_utensils_generic = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/loot/npc_loot/shared_writing_utensils_generic.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_loot_npc_loot_shared_writing_utensils_generic, "object/tangible/loot/npc_loot/shared_writing_utensils_generic.iff")
------------------------------------------------------------------------------------------------------------------------------------
|
local ls = require("luasnip")
-- some shorthands...
local s = ls.snippet
local sn = ls.snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local l = require("luasnip.extras").lambda
local r = require("luasnip.extras").rep
local p = require("luasnip.extras").partial
local m = require("luasnip.extras").match
local n = require("luasnip.extras").nonempty
local dl = require("luasnip.extras").dynamic_lambda
local fmt = require("luasnip.extras.fmt").fmt
local fmta = require("luasnip.extras.fmt").fmta
local types = require("luasnip.util.types")
local conds = require("luasnip.extras.conditions")
-- Every unspecified option will be set to the default.
ls.config.set_config({
history = true,
-- Update more often, :h events for more info.
updateevents = "TextChanged,TextChangedI",
ext_opts = {
[types.choiceNode] = {
active = {
virt_text = { { "choiceNode", "Comment" } },
},
},
},
-- treesitter-hl has 100, use something higher (default is 200).
ext_base_prio = 300,
-- minimal increase in priority.
ext_prio_increase = 1,
enable_autosnippets = true,
})
-- args is a table, where 1 is the text in Placeholder 1, 2 the text in
-- placeholder 2,...
local function copy(args)
return args[1]
end
-- 'recursive' dynamic snippet. Expands to some text followed by itself.
local rec_ls
rec_ls = function()
return sn(
nil,
c(1, {
-- Order is important, sn(...) first would cause infinite loop of expansion.
t(""),
sn(nil, { t({ "", "\t\\item " }), i(1), d(2, rec_ls, {}) }),
})
)
end
-- complicated function for dynamicNode.
local function jdocsnip(args, _, old_state)
local nodes = {
t({ "/**", " * " }),
i(1, "A short Description"),
t({ "", "" }),
}
-- These will be merged with the snippet; that way, should the snippet be updated,
-- some user input eg. text can be referred to in the new snippet.
local param_nodes = {}
if old_state then
nodes[2] = i(1, old_state.descr:get_text())
end
param_nodes.descr = nodes[2]
-- At least one param.
if string.find(args[2][1], ", ") then
vim.list_extend(nodes, { t({ " * ", "" }) })
end
local insert = 2
for indx, arg in ipairs(vim.split(args[2][1], ", ", true)) do
-- Get actual name parameter.
arg = vim.split(arg, " ", true)[2]
if arg then
local inode
-- if there was some text in this parameter, use it as static_text for this new snippet.
if old_state and old_state[arg] then
inode = i(insert, old_state["arg" .. arg]:get_text())
else
inode = i(insert)
end
vim.list_extend(
nodes,
{ t({ " * @param " .. arg .. " " }), inode, t({ "", "" }) }
)
param_nodes["arg" .. arg] = inode
insert = insert + 1
end
end
if args[1][1] ~= "void" then
local inode
if old_state and old_state.ret then
inode = i(insert, old_state.ret:get_text())
else
inode = i(insert)
end
vim.list_extend(
nodes,
{ t({ " * ", " * @return " }), inode, t({ "", "" }) }
)
param_nodes.ret = inode
insert = insert + 1
end
if vim.tbl_count(args[3]) ~= 1 then
local exc = string.gsub(args[3][2], " throws ", "")
local ins
if old_state and old_state.ex then
ins = i(insert, old_state.ex:get_text())
else
ins = i(insert)
end
vim.list_extend(
nodes,
{ t({ " * ", " * @throws " .. exc .. " " }), ins, t({ "", "" }) }
)
param_nodes.ex = ins
insert = insert + 1
end
vim.list_extend(nodes, { t({ " */" }) })
local snip = sn(nil, nodes)
-- Error on attempting overwrite.
snip.old_state = param_nodes
return snip
end
-- Make sure to not pass an invalid command, as io.popen() may write over nvim-text.
local function bash(_, _, command)
local file = io.popen(command, "r")
local res = {}
for line in file:lines() do
table.insert(res, line)
end
return res
end
-- Returns a snippet_node wrapped around an insert_node whose initial
-- text value is set to the current date in the desired format.
local date_input = function(args, state, fmt)
local fmt = fmt or "%Y-%m-%d"
return sn(nil, i(1, os.date(fmt)))
end
ls.snippets = {
python = {
-- python __name__ == '__main__'
s("ifmain", {
t({ "def main (" }),
i(1),
t({ "):" }),
t({ "", "\t" }),
t({ "pass" }),
i(2),
t({"", "", "if __name__ == '__main__':" }),
t({ "", "\t" }),
t({ "main()" }),
i(0),
}),
-- python function
s("def",{
t({ "def " }),
i(1, "functionName"),
t({ "(" }),
i(2),
t({ "):" }),
t({ "", "\t" }),
t({ "pass" }),
i(0),
}),
s("class", {
t({ "class " }),
i(1, "ClassName"),
t({ "(" }),
i(2),
t({ "):" }),
t({ "", "\t" }),
t({ "def __init__(self" }),
i(3),
t({ "):" }),
t({ "", "\t\t" }),
t({ "pass" }),
i(0),
}),
},
}
-- autotriggered snippets have to be defined in a separate table, luasnip.autosnippets.
-- ls.autosnippets = {
-- all = {
-- s("autotrigger", {
-- t("autosnippet"),
-- }),
-- },
-- }
-- in a lua file: search lua-, then c-, then all-snippets.
-- ls.filetype_extend("lua", { "c" })
-- in a cpp file: search c-snippets, then all-snippets only (no cpp-snippets!!).
-- ls.filetype_set("cpp", { "c" })
--[[
-- Beside defining your own snippets you can also load snippets from "vscode-like" packages
-- that expose snippets in json files, for example <https://github.com/rafamadriz/friendly-snippets>.
-- Mind that this will extend `ls.snippets` so you need to do it after your own snippets or you
-- will need to extend the table yourself instead of setting a new one.
]]
-- require("luasnip/loaders/from_vscode").load({ include = { "python" } }) -- Load only python snippets
-- The directories will have to be structured like eg. <https://github.com/rafamadriz/friendly-snippets> (include
-- a similar `package.json`)
-- require("luasnip/loaders/from_vscode").load({ paths = { "./my-snippets" } }) -- Load snippets from my-snippets folder
-- You can also use lazy loading so you only get in memory snippets of languages you use
require("luasnip/loaders/from_vscode").lazy_load() -- You can pass { paths = "./my-snippets/"} as well
|
bEnabled = false
msBt = {L = 1, R = 2, M = 3, B = 4, F = 5, D = 6}
function OnEvent(event, arg, family)
local x1, y1, x2, y2, t1, t2
if(event == "MOUSE_BUTTON_PRESSED" and bEnabled == false and IsKeyLockOn("scrolllock") == false)
then
t1 = GetRunningTime()
bEnabled = true
if arg == msBt.M
then
x1, y1 = GetMousePosition()
while(true)
do
Sleep(20)
if(not IsModifierPressed("rctrl"))
then
t2 = GetRunningTime()
break
end
end
if((t2 - t1) < 2000)
then
x2, y2 = GetMousePosition()
if(math.abs(x1 - x2) < math.abs(y1 - y2) and y1 > y2 and math.abs(y1 - y2) >= 10)
then
if(IsModifierPressed("ctrl") and IsModifierPressed("alt"))
then
--
elseif IsModifierPressed("ctrl")
then
noModifierPressKey({"equal", "s", "u", "m", "enter"})
elseif IsModifierPressed("alt")
then
--
else
pressKeyboard({"c"}, {"lctrl"})
end
elseif(math.abs(x1 - x2) < math.abs(y1 - y2) and y1 < y2 and math.abs(y1 - y2) >= 10)
then
if(IsModifierPressed("ctrl") and IsModifierPressed("alt"))
then
--
elseif IsModifierPressed("ctrl")
then
noModifierPressKey({"equal", "s", "u", "m", "p", "r", "o", "d", "u", "c", "t", "enter"})
elseif IsModifierPressed("alt")
then
--
else
pressKeyboard({"v"}, {"lctrl"})
end
elseif(math.abs(x1 - x2) > math.abs(y1 - y2) and x1 > x2 and math.abs(x1 - x2) >= 10)
then
if(IsModifierPressed("ctrl") and IsModifierPressed("alt"))
then
--
elseif IsModifierPressed("ctrl")
then
noModifierPressKey({"equal", "r", "o","u", "n", "d", "enter"})
elseif IsModifierPressed("alt")
then
--
else
pressKeyboard({"z"}, {"lctrl"})
end
elseif(math.abs(x1 - x2) > math.abs(y1 - y2) and x1 < x2 and math.abs(x1 - x2) >= 10)
then
if(IsModifierPressed("ctrl") and IsModifierPressed("alt"))
then
--
elseif IsModifierPressed("ctrl")
then
noModifierPressKey({"equal", "c", "o", "u","n", "t", "i", "f", "enter"})
elseif IsModifierPressed("alt")
then
--
else
pressKeyboard({"f"}, {"lctrl"})
end
else
if(IsModifierPressed("ctrl") and IsModifierPressed("alt"))
then
--
elseif IsModifierPressed("ctrl")
then
noModifierPressKey({"equal", "v", "l", "o", "o", "k", "u", "p", "enter"})
elseif IsModifierPressed("alt")
then
noModifierPressKey({"lalt", "d", "p"})
else
pressKeyboard({"a"}, {"lctrl"})
end
end
else
PressAndReleaseKey("scrolllock")
end
elseif arg == msBt.D
then
while(true)
do
Sleep(20)
t2 = GetRunningTime()
if((t2 - t1) < 500)
then
if(not IsModifierPressed("rctrl"))
then
break
end
else
break
end
end
if ((t2 - t1) >= 500)
then
PressKey("lalt")
while(true)
do
if(IsModifierPressed("rctrl"))
then
PressAndReleaseKey("tab")
else
ReleaseKey("lalt")
PressAndReleaseKey("enter")
break
end
Sleep(500)
end
else
pressKeyboard({"tab"}, {"lctrl"})
end
elseif arg == msBt.F
then
while(true)
do
Sleep(20)
if(not IsModifierPressed("rctrl"))
then
t2 = GetRunningTime()
break
end
end
if ((t2 - t1) < 300)
then
pressKeyboard({"pageup"}, {"lctrl"})
else
pressKeyboard({"home"}, {"lctrl"})
end
elseif arg == msBt.B
then
while(true)
do
Sleep(20)
if(not IsModifierPressed("rctrl"))
then
t2 = GetRunningTime()
break
end
end
if ((t2 - t1) < 300)
then
pressKeyboard({"pagedown"}, {"lctrl"})
else
pressKeyboard({"end"}, {"lctrl"})
end
end
bEnabled = false
elseif(event == "MOUSE_BUTTON_PRESSED" and bEnabled == false and IsKeyLockOn("scrolllock") == true)
then
t1 = GetRunningTime()
bEnabled = true
if arg == msBt.M
then
--
elseif arg ==msBt.F
then
--
elseif arg ==msBt.B
then
--
elseif arg ==msBt.D
then
--
end
bEnabled = false
end
end
function pressKeyboard(pressR, pressH)
local i
local element
if(pressH)
then
for i, element in ipairs(pressH)
do
PressKey(element)
end
end
if(IsKeyLockOn("capslock"))
then
PressAndReleaseKey("capslock")
end
for i, element in ipairs(pressR)
do
if(string.len(element) == 1 and string.lower(element) ~= element)
then
Sleep(5)
PressAndReleaseKey("capslock")
PressAndReleaseKey(string.lower(element))
PressAndReleaseKey("capslock")
else
Sleep(5)
PressAndReleaseKey(element)
end
end
if(pressH)
then
for i, element in ipairs(pressH)
do
ReleaseKey(element)
end
end
end
function noModifierPressKey(key)
while(true)
do
if ((not IsModifierPressed("ctrl")) and (not IsModifierPressed("alt")))
then
Sleep(5)
pressKeyboard(key)
break
end
end
end |
-- Implementation of CQL Binary protocol V2 available at https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=blob_plain;f=doc/native_protocol_v2.spec;hb=HEAD
local tcp
if ngx then
-- openresty
tcp = ngx.socket.tcp
else
-- fallback to luasocket
local socket = require("socket")
tcp = socket.tcp
end
local _M = {}
_M.version = "0.0.1"
local CQL_VERSION = "3.0.0"
local version_codes = {
REQUEST=0x02,
RESPONSE=0x82
}
local op_codes = {
ERROR=0x00,
STARTUP=0x01,
READY=0x02,
AUTHENTICATE=0x03,
-- 0x04
OPTIONS=0x05,
SUPPORTED=0x06,
QUERY=0x07,
RESULT=0x08,
PREPARE=0x09,
EXECUTE=0x0A,
REGISTER=0x0B,
EVENT=0x0C,
BATCH=0x0D,
AUTH_CHALLENGE=0x0E,
AUTH_RESPONSE=0x0F,
AUTH_SUCCESS=0x10,
}
local consistency = {
ANY=0x0000,
ONE=0x0001,
TWO=0x0002,
THREE=0x0003,
QUORUM=0x0004,
ALL=0x0005,
LOCAL_QUORUM=0x0006,
EACH_QUORUM=0x0007,
SERIAL=0x0008,
LOCAL_SERIAL=0x0009,
LOCAL_ONE=0x000A
}
_M.consistency = consistency
local result_kinds = {
VOID=0x01,
ROWS=0x02,
SET_KEYSPACE=0x03,
PREPARED=0x04,
SCHEMA_CHANGE=0x05
}
local types = {
custom=0x00,
ascii=0x01,
bigint=0x02,
blob=0x03,
boolean=0x04,
counter=0x05,
decimal=0x06,
double=0x07,
float=0x08,
int=0x09,
text=0x0A,
timestamp=0x0B,
uuid=0x0C,
varchar=0x0D,
varint=0x0E,
timeuuid=0x0F,
inet=0x10,
list=0x20,
map=0x21,
set=0x22
}
-- create function for type annotation
for key, value in pairs(types) do
_M[key] = function(value)
return {type=key, value=value}
end
end
_M.null = {type="null", value=nil}
local error_codes = {
[0x0000]= "Server error",
[0x000A]= "Protocol error",
[0x0100]= "Bad credentials",
[0x1000]= "Unavailable exception",
[0x1001]= "Overloaded",
[0x1002]= "Is_bootstrapping",
[0x1003]= "Truncate_error",
[0x1100]= "Write_timeout",
[0x1200]= "Read_timeout",
[0x2000]= "Syntax_error",
[0x2100]= "Unauthorized",
[0x2200]= "Invalid",
[0x2300]= "Config_error",
[0x2400]= "Already_exists",
[0x2500]= "Unprepared"
}
local mt = { __index = _M }
-- see: http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
local function shuffle(t)
local n = #t
while n >= 2 do
-- n is now the last pertinent index
local k = math.random(n) -- 1 <= k <= n
-- Quick swap
t[n], t[k] = t[k], t[n]
n = n - 1
end
return t
end
---
--- SOCKET METHODS
---
function _M.new(self)
math.randomseed(ngx and ngx.time() or os.time())
local sock, err = tcp()
if not sock then
return nil, err
end
return setmetatable({ sock = sock }, mt)
end
function _M.set_timeout(self, timeout)
local sock = self.sock
if not sock then
return nil, "not initialized"
end
return sock:settimeout(timeout)
end
function _M.connect(self, contact_points, port)
if port == nil then port = 9042 end
if type(contact_points) == 'table' then
shuffle(contact_points)
else
contact_points = {contact_points}
end
local sock = self.sock
if not sock then
return nil, "not initialized"
end
local ok, err
for _, host in ipairs(contact_points) do
ok, err = sock:connect(host, port)
if ok then
self.host = host
break
end
end
if not ok then
return false, err
end
if not self.initialized then
--todo: not tested
self:startup()
self.initialized = true
end
return true
end
function _M.set_keepalive(self, ...)
local sock = self.sock
if not sock then
return nil, "not initialized"
elseif sock.setkeepalive then
return sock:setkeepalive(...)
end
return nil, "luasocket does not support reusable sockets"
end
function _M.get_reused_times(self)
local sock = self.sock
if not sock then
return nil, "not initialized"
elseif sock.getreusedtimes then
return sock:getreusedtimes()
end
return nil, "luasocket does not support reusable sockets"
end
local function close(self)
local sock = self.sock
if not sock then
return nil, "not initialized"
end
return sock:close()
end
_M.close = close
---
--- ENCODE FUNCTIONS
---
local function big_endian_representation(num, bytes)
if num < 0 then
-- 2's complement
num = math.pow(0x100, bytes) + num
end
local t = {}
while num > 0 do
local rest = math.fmod(num, 0x100)
table.insert(t, 1, string.char(rest))
num = (num-rest) / 0x100
end
local padding = string.rep(string.char(0), bytes - #t)
return padding .. table.concat(t)
end
local function int_representation(num)
return big_endian_representation(num, 4)
end
local function short_representation(num)
return big_endian_representation(num, 2)
end
local function bigint_representation(n)
if n >= 0 then
return string.char(0, -- only 53 bits from double
math.floor(n / 0x1000000000000) % 0x100,
math.floor(n / 0x10000000000) % 0x100,
math.floor(n / 0x100000000) % 0x100,
math.floor(n / 0x1000000) % 0x100,
math.floor(n / 0x10000) % 0x100,
math.floor(n / 0x100) % 0x100,
n % 0x100)
else
return string.char(0xFF, -- only 53 bits from double
math.floor(n / 0x1000000000000) % 0x100,
math.floor(n / 0x10000000000) % 0x100,
math.floor(n / 0x100000000) % 0x100,
math.floor(n / 0x1000000) % 0x100,
math.floor(n / 0x10000) % 0x100,
math.floor(n / 0x100) % 0x100,
n % 0x100)
end
end
local function uuid_representation(value)
local str = string.gsub(value, "-", "")
local buffer = {}
for i = 1, #str, 2 do
local byte_str = string.sub(str, i, i + 1)
buffer[#buffer + 1] = string.char(tonumber(byte_str, 16))
end
return table.concat(buffer)
end
local function string_representation(str)
return short_representation(#str) .. str
end
local function long_string_representation(str)
return int_representation(#str) .. str
end
local function bytes_representation(bytes)
return int_representation(#bytes) .. bytes
end
local function short_bytes_representation(bytes)
return short_representation(#bytes) .. bytes
end
local function string_map_representation(map)
local buffer = {}
local n = 0
for k, v in pairs(map) do
buffer[#buffer + 1] = string_representation(k)
buffer[#buffer + 1] = string_representation(v)
n = n + 1
end
return short_representation(n) .. table.concat(buffer)
end
local function boolean_representation(value)
if value then return "\001" else return "\000" end
end
-- 'inspired' by https://github.com/fperrad/lua-MessagePack/blob/master/src/MessagePack.lua
local function double_representation(number)
local sign = 0
if number < 0.0 then
sign = 0x80
number = -number
end
local mantissa, exponent = math.frexp(number)
if mantissa ~= mantissa then
return string.char(0xFF, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) -- nan
elseif mantissa == math.huge then
if sign == 0 then
return string.char(0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) -- +inf
else
return string.char(0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) -- -inf
end
elseif mantissa == 0.0 and exponent == 0 then
return string.char(sign, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) -- zero
else
exponent = exponent + 0x3FE
mantissa = (mantissa * 2.0 - 1.0) * math.ldexp(0.5, 53)
return string.char(sign + math.floor(exponent / 0x10),
(exponent % 0x10) * 0x10 + math.floor(mantissa / 0x1000000000000),
math.floor(mantissa / 0x10000000000) % 0x100,
math.floor(mantissa / 0x100000000) % 0x100,
math.floor(mantissa / 0x1000000) % 0x100,
math.floor(mantissa / 0x10000) % 0x100,
math.floor(mantissa / 0x100) % 0x100,
mantissa % 0x100)
end
end
local function float_representation(number)
if number == 0 then
return string.char(0x00, 0x00, 0x00, 0x00)
elseif number ~= number then
return string.char(0xFF, 0xFF, 0xFF, 0xFF)
else
local sign = 0x00
if number < 0 then
sign = 0x80
number = -number
end
local mantissa, exponent = math.frexp(number)
exponent = exponent + 0x7F
if exponent <= 0 then
mantissa = math.ldexp(mantissa, exponent - 1)
exponent = 0
elseif exponent > 0 then
if exponent >= 0xFF then
return string.char(sign + 0x7F, 0x80, 0x00, 0x00)
elseif exponent == 1 then
exponent = 0
else
mantissa = mantissa * 2 - 1
exponent = exponent - 1
end
end
mantissa = math.floor(math.ldexp(mantissa, 23) + 0.5)
return string.char(
sign + math.floor(exponent / 2),
(exponent % 2) * 0x80 + math.floor(mantissa / 0x10000),
math.floor(mantissa / 0x100) % 0x100,
mantissa % 0x100)
end
end
local function inet_representation(value)
local digits = {}
-- ipv6
for d in string.gfind(value, "([^:]+)") do
if #d == 4 then
for i = 1, #d, 2 do
digits[#digits + 1] = string.char(tonumber(string.sub(d, i, i + 1), 16))
end
end
end
-- ipv4
if #digits == 0 then
for d in string.gfind(value, "(%d+)") do
table.insert(digits, string.char(d))
end
end
return table.concat(digits)
end
local function list_representation(elements)
local buffer = {short_representation(#elements)}
for _, value in ipairs(elements) do
buffer[#buffer + 1] = _M._value_representation(value, true)
end
return table.concat(buffer)
end
local function set_representation(elements)
return list_representation(elements)
end
local function map_representation(map)
local buffer = {}
local size = 0
for key, value in pairs(map) do
buffer[#buffer + 1] = _M._value_representation(key, true)
buffer[#buffer + 1] = _M._value_representation(value, true)
size = size + 1
end
table.insert(buffer, 1, short_representation(size))
return table.concat(buffer)
end
local function identity_representation(value)
return value
end
local packers = {
-- custom=0x00,
[types.ascii]=identity_representation,
[types.bigint]=bigint_representation,
[types.blob]=identity_representation,
[types.boolean]=boolean_representation,
[types.counter]=bigint_representation,
-- decimal=0x06,
[types.double]=double_representation,
[types.float]=float_representation,
[types.int]=int_representation,
[types.text]=identity_representation,
[types.timestamp]=bigint_representation,
[types.uuid]=uuid_representation,
[types.varchar]=identity_representation,
[types.varint]=int_representation,
[types.timeuuid]=uuid_representation,
[types.inet]=inet_representation,
[types.list]=list_representation,
[types.map]=map_representation,
[types.set]=set_representation
}
local function infer_type(value)
if type(value) == 'number' and math.floor(value) == value then
return types.int
elseif type(value) == 'number' then
return types.float
elseif type(value) == 'boolean' then
return types.boolean
elseif type(value) == 'table' and value.type == 'null' then
return _M.null
elseif type(value) == 'table' and value.type then
return types[value.type]
else
return types.varchar
end
end
local function value_representation(value, short)
local infered_type = infer_type(value)
if type(value) == 'table' and value.type and value.value then
value = value.value
end
if infered_type == _M.null then
if short then
return short_representation(-1)
else
return int_representation(-1)
end
end
local representation = packers[infered_type](value)
if short then
return short_bytes_representation(representation)
end
return bytes_representation(representation)
end
_M._value_representation = value_representation
---
--- DECODE FUNCTIONS
---
local function create_buffer(str)
return {str=str, pos=1}
end
local function string_to_number(str, signed)
local number = 0
local exponent = 1
for i = #str, 1, -1 do
number = number + string.byte(str, i) * exponent
exponent = exponent * 256
end
if signed and number > exponent / 2 then
-- 2's complement
number = number - exponent
end
return number
end
local function read_signed_number(bytes)
return string_to_number(bytes, true)
end
local function read_raw_bytes(buffer, n_bytes)
local bytes = string.sub(buffer.str, buffer.pos, buffer.pos + n_bytes - 1)
buffer.pos = buffer.pos + n_bytes
return bytes
end
local function read_raw_byte(buffer)
return string.byte(read_raw_bytes(buffer, 1))
end
local function read_int(buffer)
return string_to_number(read_raw_bytes(buffer, 4), true)
end
local function read_short(buffer)
return string_to_number(read_raw_bytes(buffer, 2), false)
end
local function read_string(buffer)
local str_size = read_short(buffer)
return read_raw_bytes(buffer, str_size)
end
local function read_bytes(buffer)
local size = read_int(buffer, true)
if size < 0 then
return nil
end
return read_raw_bytes(buffer, size)
end
local function read_short_bytes(buffer)
local size = read_short(buffer)
return read_raw_bytes(buffer, size)
end
local function read_option(buffer)
local type_id = read_short(buffer)
local type_value = nil
if type_id == types.custom then
type_value = read_string(buffer)
elseif type_id == types.list then
type_value = read_option(buffer)
elseif type_id == types.map then
type_value = {read_option(buffer), read_option(buffer)}
elseif type_id == types.set then
type_value = read_option(buffer)
end
return {id=type_id, value=type_value}
end
local function read_boolean(bytes)
return string.byte(bytes) == 1
end
local function read_bigint(bytes)
local b1, b2, b3, b4, b5, b6, b7, b8 = string.byte(bytes, 1, 8)
if b1 < 0x80 then
return ((((((b1 * 0x100 + b2) * 0x100 + b3) * 0x100 + b4) * 0x100 + b5) * 0x100 + b6) * 0x100 + b7) * 0x100 + b8
else
return ((((((((b1 - 0xFF) * 0x100 + (b2 - 0xFF)) * 0x100 + (b3 - 0xFF)) * 0x100 + (b4 - 0xFF)) * 0x100 + (b5 - 0xFF)) * 0x100 + (b6 - 0xFF)) * 0x100 + (b7 - 0xFF)) * 0x100 + (b8 - 0xFF)) - 1
end
end
local function read_double(bytes)
local b1, b2, b3, b4, b5, b6, b7, b8 = string.byte(bytes, 1, 8)
local sign = b1 > 0x7F
local exponent = (b1 % 0x80) * 0x10 + math.floor(b2 / 0x10)
local mantissa = ((((((b2 % 0x10) * 0x100 + b3) * 0x100 + b4) * 0x100 + b5) * 0x100 + b6) * 0x100 + b7) * 0x100 + b8
if sign then
sign = -1
else
sign = 1
end
local number
if mantissa == 0 and exponent == 0 then
number = sign * 0.0
elseif exponent == 0x7FF then
if mantissa == 0 then
number = sign * math.huge
else
number = 0.0/0.0
end
else
number = sign * math.ldexp(1.0 + mantissa / 0x10000000000000, exponent - 0x3FF)
end
return number
end
local function read_float(bytes)
local b1, b2, b3, b4 = string.byte(bytes, 1, 4)
local exponent = (b1 % 0x80) * 0x02 + math.floor(b2 / 0x80)
local mantissa = math.ldexp(((b2 % 0x80) * 0x100 + b3) * 0x100 + b4, -23)
if exponent == 0xFF then
if mantissa > 0 then
return 0 / 0
else
mantissa = math.huge
exponent = 0x7F
end
elseif exponent > 0 then
mantissa = mantissa + 1
else
exponent = exponent + 1
end
if b1 >= 0x80 then
mantissa = -mantissa
end
return math.ldexp(mantissa, exponent - 0x7F)
end
local function read_uuid(bytes)
local buffer = {}
for i = 1, #bytes do
buffer[i] = string.format("%02x", string.byte(bytes, i))
end
table.insert(buffer, 5, "-")
table.insert(buffer, 8, "-")
table.insert(buffer, 11, "-")
table.insert(buffer, 14, "-")
return table.concat(buffer)
end
local function read_inet(bytes)
local buffer = {}
if #bytes == 16 then
-- ipv6
for i = 1, #bytes, 2 do
buffer[#buffer + 1] = string.format("%02x", string.byte(bytes, i)) ..
string.format("%02x", string.byte(bytes, i + 1))
end
return table.concat(buffer, ":")
end
for i = 1, #bytes do
buffer[#buffer + 1] = string.format("%d", string.byte(bytes, i))
end
return table.concat(buffer, ".")
end
local function read_list(bytes, type)
local element_type = type.value
local buffer = create_buffer(bytes)
local n = read_short(buffer)
local elements = {}
for i = 1, n do
elements[#elements + 1] = _M._read_value(buffer, element_type, true)
end
return elements
end
local read_set = read_list
local function read_map(bytes, type)
local key_type = type.value[1]
local value_type = type.value[2]
local buffer = create_buffer(bytes)
local n = read_short(buffer)
local map = {}
for i = 1, n do
local key = _M._read_value(buffer, key_type, true)
local value = _M._read_value(buffer, value_type, true)
map[key] = value
end
return map
end
local unpackers = {
-- custom=0x00,
[types.ascii]=identity_representation,
[types.bigint]=read_bigint,
[types.blob]=identity_representation,
[types.boolean]=read_boolean,
[types.counter]=read_bigint,
-- decimal=0x06,
[types.double]=read_double,
[types.float]=read_float,
[types.int]=read_signed_number,
[types.text]=identity_representation,
[types.timestamp]=read_bigint,
[types.uuid]=read_uuid,
[types.varchar]=identity_representation,
[types.varint]=read_signed_number,
[types.timeuuid]=read_uuid,
[types.inet]=read_inet,
[types.list]=read_list,
[types.map]=read_map,
[types.set]=read_set
}
local function read_value(buffer, type, short)
local bytes
if short then
bytes = read_short_bytes(buffer)
else
bytes = read_bytes(buffer)
end
if bytes == nil then
return nil
end
return unpackers[type.id](bytes, type)
end
_M._read_value = read_value
local function read_error(buffer)
local error_code = error_codes[read_int(buffer)]
local error_message = read_string(buffer)
return 'Cassandra returned error (' .. error_code .. '): "' .. error_message .. '"'
end
local function read_frame(self, tracing)
local header, err, partial = self.sock:receive(8)
if not header then
return nil, string.format("Failed to read frame header from %s: %s", self.host, err)
end
local header_buffer = create_buffer(header)
local version = read_raw_byte(header_buffer)
local flags = read_raw_byte(header_buffer)
local stream = read_raw_byte(header_buffer)
local op_code = read_raw_byte(header_buffer)
local length = read_int(header_buffer)
local body, err, partial, tracing_id
if length > 0 then
body, err, partial = self.sock:receive(length)
if not body then
return nil, string.format("Failed to read frame body from %s: %s", self.host, err)
end
else
body = ""
end
if version ~= version_codes.RESPONSE then
error("Invalid response version")
end
local body_buffer = create_buffer(body)
if flags == 0x02 then -- tracing
tracing_id = read_uuid(string.sub(body, 1, 16))
body_buffer.pos = 17
end
if op_code == op_codes.ERROR then
return nil, read_error(body_buffer)
end
return {
flags=flags,
stream=stream,
op_code=op_code,
buffer=body_buffer,
tracing_id=tracing_id
}
end
---
--- BITS methods
--- http://ricilake.blogspot.com.br/2007/10/iterating-bits-in-lua.html
---
local function bit(p)
return 2 ^ (p - 1)
end
local function hasbit(x, p)
return x % (p + p) >= p
end
---
--- CLIENT METHODS
---
local function send_reply_and_get_response(self, op_code, body, tracing)
local version = string.char(version_codes.REQUEST)
local flags = tracing and '\002' or '\000'
local stream_id = '\000'
local length = int_representation(#body)
local frame = version .. flags .. stream_id .. string.char(op_code) .. length .. body
local bytes, err = self.sock:send(frame)
if not bytes then
return nil, string.format("Failed to read frame header from %s: %s", self.host, err)
end
return read_frame(self)
end
function _M.startup(self)
local body = string_map_representation({["CQL_VERSION"]=CQL_VERSION})
local response, err = send_reply_and_get_response(self, op_codes.STARTUP, body)
if not response then
return nil, err
end
if response.op_code ~= op_codes.READY then
error("Server is not ready")
end
return true
end
local function parse_metadata(buffer)
local flags = read_int(buffer)
local global_tables_spec = hasbit(flags, bit(1))
local has_more_pages = hasbit(flags, bit(2))
local no_metadata = hasbit(flags, bit(3))
local columns_count = read_int(buffer)
local paging_state = nil
if has_more_pages then
paging_state = read_bytes(buffer)
end
local global_keyspace_name = nil
local global_table_name = nil
if global_tables_spec then
global_keyspace_name = read_string(buffer)
global_table_name = read_string(buffer)
end
local columns = {}
for j = 1, columns_count do
local ksname = global_keyspace_name
local tablename = global_table_name
if not global_tables_spec then
ksname = read_string(buffer)
tablename = read_string(buffer)
end
local column_name = read_string(buffer)
local type = read_option(buffer)
columns[#columns + 1] = {
keyspace = ksname,
table = tablename,
name = column_name,
type = type
}
end
return {columns_count=columns_count, columns=columns}
end
local function parse_rows(buffer, metadata)
local columns = metadata.columns
local columns_count = metadata.columns_count
local rows_count = read_int(buffer)
local values = {}
for i = 1, rows_count do
local row = {}
for j = 1, columns_count do
local value = read_value(buffer, columns[j].type)
row[j] = value
row[columns[j].name] = value
end
values[#values + 1] = row
end
assert(buffer.pos == #(buffer.str) + 1)
return values
end
function _M.prepare(self, query, options)
if not options then options = {} end
local body = long_string_representation(query)
local response, err = send_reply_and_get_response(self, op_codes.PREPARE, body, options.tracing)
if not response then
return nil, err
end
if response.op_code ~= op_codes.RESULT then
error("Result expected")
end
local buffer = response.buffer
local kind = read_int(buffer)
local result = {}
if kind == result_kinds.PREPARED then
local id = read_short_bytes(buffer)
local metadata = parse_metadata(buffer)
local result_metadata = parse_metadata(buffer)
assert(buffer.pos == #(buffer.str) + 1)
result = {type="PREPARED", id=id, metadata=metadata, result_metadata=result_metadata}
else
error("Invalid result kind")
end
if response.tracing_id then result.tracing_id = response.tracing_id end
return result
end
function _M.execute(self, query, args, options)
if not options then options = {} end
if not options.consistency_level then
options.consistency_level = consistency.ONE
end
local op_code, query_repr
if type(query) == "string" then
op_code = op_codes.QUERY
query_repr = long_string_representation(query)
else
op_code = op_codes.EXECUTE
query_repr = short_bytes_representation(query.id)
end
local values = {}
local flags
if not args then
flags = string.char(0)
else
flags = string.char(1)
values[#values + 1] = short_representation(#args)
for _, value in ipairs(args) do
values[#values + 1] = value_representation(value)
end
end
local query_parameters = short_representation(options.consistency_level) .. flags
local body = query_repr .. query_parameters .. table.concat(values)
local response, err = send_reply_and_get_response(self, op_code, body, options.tracing)
if not response then
return nil, err
end
if response.op_code ~= op_codes.RESULT then
error("Result expected")
end
local result
local buffer = response.buffer
local kind = read_int(buffer)
if kind == result_kinds.VOID then
result = {type="VOID"}
elseif kind == result_kinds.ROWS then
local metadata = parse_metadata(buffer)
result = parse_rows(buffer, metadata)
result.type = "ROWS"
elseif kind == result_kinds.SET_KEYSPACE then
result = {
type="SET_KEYSPACE",
keyspace= read_string(buffer)
}
elseif kind == result_kinds.SCHEMA_CHANGE then
result = {
type="SCHEMA_CHANGE",
change=read_string(buffer),
keyspace=read_string(buffer),
table=read_string(buffer)
}
else
error(string.format("Invalid result kind: %x", kind))
end
if response.tracing_id then result.tracing_id = response.tracing_id end
return result
end
function _M.set_keyspace(self, keyspace_name)
return self:execute("USE " .. keyspace_name)
end
function _M.get_trace(self, result)
if not result.tracing_id then
return nil, "No tracing available"
end
local rows, err = self:execute([[
SELECT coordinator, duration, parameters, request, started_at
FROM system_traces.sessions WHERE session_id = ?]],
{_M.uuid(result.tracing_id)})
if not rows then
return nil, "Unable to get trace: " .. err
end
if #rows == 0 then
return nil, "Trace not found"
end
local trace = rows[1]
trace.events, err = self:execute([[
SELECT event_id, activity, source, source_elapsed, thread
FROM system_traces.events WHERE session_id = ?]],
{_M.uuid(result.tracing_id)})
if not trace.events then
return nil, "Unable to get trace events: " .. err
end
return trace
end
return _M
|
-- Generated by CSharp.lua Compiler
local System = System
local SlipeMtaDefinitions
local SlipeSharedElements
local SlipeSharedUtilities
System.import(function (out)
SlipeMtaDefinitions = Slipe.MtaDefinitions
SlipeSharedElements = Slipe.Shared.Elements
SlipeSharedUtilities = Slipe.Shared.Utilities
end)
System.namespace("Slipe.Shared.Radar", function (namespace)
-- <summary>
-- Class representing a minimap blip
-- </summary>
namespace.class("SharedBlip", function (namespace)
local getColor, setColor, getIcon, setIcon, getOrdering, setOrdering, getSize, setSize,
getVisibleDistance, setVisibleDistance, __ctor__
__ctor__ = function (this, element)
SlipeSharedElements.PhysicalElement.__ctor__(this, element)
end
getColor = function (this)
local tuple = SlipeMtaDefinitions.MtaShared.GetBlipColor(this.element)
return System.new(SlipeSharedUtilities.Color, 3, System.toByte(tuple[1]), System.toByte(tuple[2]), System.toByte(tuple[3]), System.toByte(tuple[4]))
end
setColor = function (this, value)
SlipeMtaDefinitions.MtaShared.SetBlipColor(this.element, value:getR(), value:getG(), value:getB(), value:getA())
end
getIcon = function (this)
return SlipeMtaDefinitions.MtaShared.GetBlipIcon(this.element)
end
setIcon = function (this, value)
SlipeMtaDefinitions.MtaShared.SetBlipIcon(this.element, value)
end
getOrdering = function (this)
return SlipeMtaDefinitions.MtaShared.GetBlipOrdering(this.element)
end
setOrdering = function (this, value)
SlipeMtaDefinitions.MtaShared.SetBlipOrdering(this.element, value)
end
getSize = function (this)
return SlipeMtaDefinitions.MtaShared.GetBlipSize(this.element)
end
setSize = function (this, value)
SlipeMtaDefinitions.MtaShared.SetBlipSize(this.element, value)
end
getVisibleDistance = function (this)
return SlipeMtaDefinitions.MtaShared.GetBlipVisibleDistance(this.element)
end
setVisibleDistance = function (this, value)
SlipeMtaDefinitions.MtaShared.SetBlipVisibleDistance(this.element, value)
end
return {
__inherits__ = function (out)
return {
out.Slipe.Shared.Elements.PhysicalElement
}
end,
getColor = getColor,
setColor = setColor,
getIcon = getIcon,
setIcon = setIcon,
getOrdering = getOrdering,
setOrdering = setOrdering,
getSize = getSize,
setSize = setSize,
getVisibleDistance = getVisibleDistance,
setVisibleDistance = setVisibleDistance,
__ctor__ = __ctor__,
__metadata__ = function (out)
return {
properties = {
{ "Color", 0x106, out.Slipe.Shared.Utilities.Color, getColor, setColor },
{ "Icon", 0x106, System.Int32, getIcon, setIcon },
{ "Ordering", 0x106, System.Int32, getOrdering, setOrdering },
{ "Size", 0x106, System.Int32, getSize, setSize },
{ "VisibleDistance", 0x106, System.Single, getVisibleDistance, setVisibleDistance }
},
methods = {
{ ".ctor", 0x106, nil, out.Slipe.MtaDefinitions.MtaElement }
},
class = { 0x6 }
}
end
}
end)
end)
|
local area = {}
local values = {}
local max_x = 21
local max_y = 21
local function get_index(x,y)
return math.floor(x) + math.floor(y) * 65536
end
local function get_xy(index)
local x = index % 65536
local y = ( index - x ) / 65536
return x,y
end
local adj = {
-1, -1,
-1, 0,
-1, 1,
0, 1,
1, 1,
1, 0,
1, -1,
0, -1
}
local function do_wawe( values, check, wawe, next_wawe )
local adj_count = #adj
local result = false
for index in pairs(wawe) do
local value = values[index]
local x0,y0 = get_xy(index)
for i = 1, adj_count, 2 do
local x,y = x0 + adj[i], y0 + adj[i + 1]
if x >= 0 and y >= 0 and x < max_x and y < max_y then
local delta = check(x0,y0,x,y)
if delta then
local next_index = get_index(x,y)
local prev_value = values[next_index]
local next_value = value + delta
if not prev_value or next_value < prev_value then
values[next_index] = next_value
next_wawe[next_index] = true
result = true
end
end
end
end
wawe[index] = nil
end
return result
end
function find_values( values, check, x, y )
local index = get_index(x,y)
values[ index ] = 0
local wawe, next_wawe = { [index] = 0 }, {}
while do_wawe( values, check, wawe, next_wawe ) do
wawe, next_wawe = next_wawe, wawe
end
end
local function get_min_cell( values, index )
local x0, y0 = get_xy(index)
local min_index, min_value
for i = 1, #adj, 2 do
local x,y = x0 + adj[i], y0 + adj[i + 1]
if x >= 0 and y >= 0 and x < max_x and y < max_y then
local next_index = get_index(x,y)
local next_value = values[next_index]
if next_value then
if not min_value or next_value < min_value then
min_value = next_value
min_index = next_index
end
end
end
end
return min_index, min_value
end
function get_path( values, x, y )
local index = get_index(x,y)
local value = values[index]
if not value then return end
local path = {}
while index do
path[#path + 1] = index
if value <= 0 then
break
end
index, value = get_min_cell( values, index )
end
return path
end
local area = {}
local values = {}
local path
local function check( x0,y0, x,y )
local index = get_index(x,y)
if not area[index] then
return getDistanceBetweenPoints2D(x0,y0, x,y)
end
end
----[[
local startPoint, endPoint
local cellSize = 32
addEventHandler( "onClientRender", root, function()
local emptyColor = tocolor( 0, 0, 255, 128 )
local blockColor = tocolor( 255, 0, 0, 128 )
local pathColor = tocolor( 0, 0, 0, 128 )
local startColor = tocolor( 0, 255, 0, 128 )
for y = 0, 20 do
for x = 0, 20 do
local index = get_index(x,y)
if area[index] then
dxDrawRectangle( x * cellSize, y * cellSize, cellSize, cellSize, blockColor, true )
else
dxDrawRectangle( x * cellSize, y * cellSize, cellSize, cellSize, emptyColor, true )
end
if values[index] then
dxDrawText( string.format("%.1f", values[index]), x * cellSize, y * cellSize, x * cellSize + cellSize, y * cellSize + cellSize )
end
if startPoint and startPoint[1] == x and startPoint[2] == y then
dxDrawRectangle( x * cellSize, y * cellSize, cellSize, cellSize, startColor, true )
end
end
end
if path then
for _,index in ipairs(path) do
local x,y = get_xy(index)
dxDrawRectangle( x * cellSize, y * cellSize, cellSize, cellSize, pathColor, true )
end
end
end)
local blockOn
addEventHandler( "onClientClick", root, function( button, state, absoluteX, absoluteY)
local x,y = math.floor(absoluteX / cellSize), math.floor( absoluteY / cellSize )
if x < 21 and y < 21 and state == "down" then
if button == "left" then
if not endPoint then
if not startPoint then
startPoint = {x,y}
else
endPoint = {x,y}
values = {}
find_values( values, check, startPoint[1], startPoint[2] )
path = get_path( values, x, y )
startPoint = nil
endPoint = nil
end
end
elseif button == "right" then
local index = get_index(x,y)
area[index] = not area[index]
end
end
end)
addEventHandler( "onClientMouseMove", root, function ( x, y )
end)
showCursor(true)
--]]
--[[
area =
{
[0x00000] = false, [0x00001] = false, [0x00002] = false,
[0x10000] = false, [0x10001] = false, [0x10002] = false,
[0x20000] = false, [0x20001] = false, [0x20002] = false,
}
values = {}
find_values( values, check, 0, 0 )
path = get_path( values, 2, 2 )
--]] |
-- random
-- by Qige
-- 2017.01.05
-- 2017.03.13: add local, change "require 'six.seed'" to "local seed = require 'six.seed'"
local seed = {}
function seed.seed()
--return math.randomseed(tostring(os.time()):reverse():sub(1, 6))
return tostring(os.time()):reverse():sub(1, 6)
end
function seed.random(from, to)
math.randomseed(seed.seed())
return math.random(from, to)
end
return seed
|
local _defaultCPath = ""
local os = ""
if(love.system == nil) then
os = "Thread"
else
os = love.system.getOS()
end
if(os ~= "Web") then
_defaultCPath = love.filesystem.getCRequirePath()
end
local _defaultLPath = love.filesystem.getRequirePath()
local function setReqPath(path)
if(os ~= "Web") then
love.filesystem.setCRequirePath(path.."/??;??")
end
love.filesystem.setRequirePath(path.."/?.lua;"..path.."/?/init.lua;?.lua;?/init.lua")
end
local function restorePath()
if(os ~= "Web") then
love.filesystem.setCRequirePath(_defaultCPath)
end
love.filesystem.setRequirePath(_defaultLPath)
end
function loadFromLib(libsPath, ...)
setReqPath(libsPath)
for _, files in ipairs({...}) do
require(files)
end
restorePath()
end
function requireFromLib(libPath, fileName)
setReqPath(libPath)
local ret = require(fileName)
restorePath()
return ret
end |
local prefabs =
{
"spider",
"spider_warrior",
"silk",
"spidereggsack",
"spiderqueen",
}
local assets =
{
Asset("ANIM", "anim/spider_cocoon.zip"),
Asset("SOUND", "sound/spider.fsb"),
}
local function SetStage(inst, stage)
if stage <= 3 then
inst.SoundEmitter:PlaySound("dontstarve/creatures/spider/spiderLair_grow")
if inst.components.childspawner then
inst.components.childspawner:SetMaxChildren(TUNING.SPIDERDEN_SPIDERS[stage])
end
if inst.components.health then
inst.components.health:SetMaxHealth(TUNING.SPIDERDEN_HEALTH[stage])
end
inst.AnimState:PlayAnimation(inst.anims.init)
inst.AnimState:PushAnimation(inst.anims.idle, true)
end
inst.data.stage = stage -- track here, as growable component may go away
end
local function SetSmall(inst)
inst.anims = {
hit="cocoon_small_hit",
idle="cocoon_small",
init="grow_sac_to_small",
freeze="frozen_small",
thaw="frozen_loop_pst_small",
}
SetStage(inst, 1)
inst.components.lootdropper:SetLoot({ "silk","silk"})
if inst.components.burnable then
inst.components.burnable:SetFXLevel(3)
inst.components.burnable:SetBurnTime(10)
end
if inst.components.freezable then
inst.components.freezable:SetShatterFXLevel(3)
inst.components.freezable:SetResistance(2)
end
inst.GroundCreepEntity:SetRadius( 5 )
end
local function SetMedium(inst)
inst.anims = {
hit="cocoon_medium_hit",
idle="cocoon_medium",
init="grow_small_to_medium",
freeze="frozen_medium",
thaw="frozen_loop_pst_medium",
}
SetStage(inst, 2)
inst.components.lootdropper:SetLoot({ "silk","silk","silk","silk"})
if inst.components.burnable then
inst.components.burnable:SetFXLevel(3)
inst.components.burnable:SetBurnTime(10)
end
if inst.components.freezable then
inst.components.freezable:SetShatterFXLevel(4)
inst.components.freezable:SetResistance(3)
end
inst.GroundCreepEntity:SetRadius( 9 )
end
local function SetLarge(inst)
inst.anims = {
hit="cocoon_large_hit",
idle="cocoon_large",
init="grow_medium_to_large",
freeze="frozen_large",
thaw="frozen_loop_pst_large",
}
SetStage(inst, 3)
inst.components.lootdropper:SetLoot({ "silk","silk","silk","silk","silk","silk", "spidereggsack"})
if inst.components.burnable then
inst.components.burnable:SetFXLevel(4)
inst.components.burnable:SetBurnTime(15)
end
if inst.components.freezable then
inst.components.freezable:SetShatterFXLevel(5)
inst.components.freezable:SetResistance(4)
end
inst.GroundCreepEntity:SetRadius( 9 )
end
local function AttemptMakeQueen(inst)
if inst.data.stage == nil or inst.data.stage ~= 3 then
-- we got here directly (probably by loading), so reconfigure to the level 3 state.
SetLarge(inst)
end
local player = GetPlayer()
if not player or player:GetDistanceSqToInst(inst) > 30*30 then
inst.components.growable:StartGrowing(60 + math.random(60) )
return
end
local check_range = 60
local cap = 4
local x, y, z = inst.Transform:GetWorldPosition()
local ents = TheSim:FindEntities(x,y,z, check_range)
local num_dens = 0
for k,v in pairs(ents) do
if v:HasTag("spiderden") or v.prefab == "spiderqueen" then
num_dens = num_dens + 1
end
if num_dens >= cap then break end
end
local should_duplicate = num_dens < cap
inst.components.growable:SetStage(1)
inst.AnimState:PlayAnimation("cocoon_large_burst")
inst.AnimState:PushAnimation("cocoon_large_burst_pst")
inst.AnimState:PushAnimation("cocoon_small", true)
inst.SoundEmitter:PlaySound("dontstarve/creatures/spiderqueen/legburst")
inst:DoTaskInTime(5*FRAMES, function() inst.SoundEmitter:PlaySound("dontstarve/creatures/spiderqueen/legburst") end)
inst:DoTaskInTime(15*FRAMES, function() inst.SoundEmitter:PlaySound("dontstarve/creatures/spiderqueen/legburst") end)
inst:DoTaskInTime(35*FRAMES, function()
local queen = SpawnPrefab("spiderqueen")
local pt = Vector3(inst.Transform:GetWorldPosition())
local rad = 1.25
local angle = math.random(2*PI)
pt = pt + Vector3(rad*math.cos(angle), 0, rad*math.sin(angle))
queen.Transform:SetPosition(pt:Get())
queen.sg:GoToState("birth")
if not should_duplicate then
inst:Remove()
end
end)
inst.components.growable:StartGrowing(60)
end
local function onspawnspider(inst, spider)
spider.sg:GoToState("taunt")
end
local function OnKilled(inst)
inst.AnimState:PlayAnimation("cocoon_dead")
if inst.components.childspawner then
inst.components.childspawner:ReleaseAllChildren()
end
inst.Physics:ClearCollisionMask()
inst.SoundEmitter:KillSound("loop")
inst.SoundEmitter:PlaySound("dontstarve/creatures/spider/spiderLair_destroy")
inst.components.lootdropper:DropLoot(Vector3(inst.Transform:GetWorldPosition()))
end
local function SpawnDefenders(inst, attacker)
if not inst.components.health:IsDead() then
inst.SoundEmitter:PlaySound("dontstarve/creatures/spider/spiderLair_hit")
inst.AnimState:PlayAnimation(inst.anims.hit)
inst.AnimState:PushAnimation(inst.anims.idle)
if inst.components.childspawner then
local max_release_per_stage = {2, 4, 6}
local num_to_release = math.min( max_release_per_stage[inst.data.stage] or 1, inst.components.childspawner.childreninside)
local num_warriors = math.min(num_to_release, TUNING.SPIDERDEN_WARRIORS[inst.data.stage])
num_warriors = num_warriors - inst.components.childspawner:CountChildrenOutside(function(child)
return child.prefab == "spider_warrior"
end)
for k = 1,num_to_release do
if k <= num_warriors then
inst.components.childspawner.childname = "spider_warrior"
else
inst.components.childspawner.childname = "spider"
end
local spider = inst.components.childspawner:SpawnChild()
if spider and attacker and spider.components.combat then
spider.components.combat:SetTarget(attacker)
spider.components.combat:BlankOutAttacks(1.5 + math.random()*2)
end
end
inst.components.childspawner.childname = "spider"
end
end
end
local function SpawnInvestigators(inst, data)
if not inst.components.health:IsDead() and not (inst.components.freezable and inst.components.freezable:IsFrozen()) then
inst.AnimState:PlayAnimation(inst.anims.hit)
inst.AnimState:PushAnimation(inst.anims.idle)
if inst.components.childspawner then
local max_release_per_stage = {1, 2, 3}
local num_to_release = math.min( max_release_per_stage[inst.data.stage] or 1, inst.components.childspawner.childreninside)
local num_investigators = inst.components.childspawner:CountChildrenOutside(function(child)
return child.components.knownlocations:GetLocation("investigate") ~= nil
end)
num_to_release = num_to_release - num_investigators
for k = 1,num_to_release do
local spider = inst.components.childspawner:SpawnChild()
if spider and data and data.target then
spider.components.knownlocations:RememberLocation("investigate", Vector3(data.target.Transform:GetWorldPosition() ) )
end
end
end
end
end
local function StartSpawning(inst)
if inst.components.childspawner then
local frozen = (inst.components.freezable and inst.components.freezable:IsFrozen())
if not frozen and not GetClock():IsDay() then
inst.components.childspawner:StartSpawning()
end
end
end
local function StopSpawning(inst)
if inst.components.childspawner then
inst.components.childspawner:StopSpawning()
end
end
local function OnIgnite(inst)
if inst.components.childspawner then
SpawnDefenders(inst)
inst:RemoveComponent("childspawner")
end
inst.SoundEmitter:KillSound("loop")
DefaultBurnFn(inst)
end
local function OnBurnt(inst)
end
local function OnFreeze(inst)
print(inst, "OnFreeze")
inst.SoundEmitter:PlaySound("dontstarve/common/freezecreature")
inst.AnimState:PlayAnimation(inst.anims.freeze, true)
inst.AnimState:OverrideSymbol("swap_frozen", "frozen", "frozen")
StopSpawning(inst)
if inst.components.growable then
inst.components.growable:Pause()
end
end
local function OnThaw(inst)
print(inst, "OnThaw")
inst.AnimState:PlayAnimation(inst.anims.thaw, true)
inst.SoundEmitter:PlaySound("dontstarve/common/freezethaw", "thawing")
inst.AnimState:OverrideSymbol("swap_frozen", "frozen", "frozen")
end
local function OnUnFreeze(inst)
print(inst, "OnUnFreeze")
inst.AnimState:PlayAnimation(inst.anims.idle, true)
inst.SoundEmitter:KillSound("thawing")
inst.AnimState:ClearOverrideSymbol("swap_frozen")
StartSpawning(inst)
if inst.components.growable then
inst.components.growable:Resume()
end
end
local function GetSmallGrowTime(inst)
return TUNING.SPIDERDEN_GROW_TIME[1] + math.random()*TUNING.SPIDERDEN_GROW_TIME[1]
end
local function GetMedGrowTime(inst)
return TUNING.SPIDERDEN_GROW_TIME[2]+ math.random()*TUNING.SPIDERDEN_GROW_TIME[2]
end
local function GetLargeGrowTime(inst)
return TUNING.SPIDERDEN_GROW_TIME[3]+ math.random()*TUNING.SPIDERDEN_GROW_TIME[3]
end
local function OnEntityWake(inst)
inst.SoundEmitter:PlaySound("dontstarve/creatures/spider/spidernest_LP", "loop")
end
local function OnEntitySleep(inst)
inst.SoundEmitter:KillSound("loop")
end
local growth_stages = {
{name="small", time = GetSmallGrowTime, fn = SetSmall },
{name="med", time = GetMedGrowTime , fn = SetMedium },
{name="large", time = GetLargeGrowTime, fn = SetLarge},
{name="queen", fn = AttemptMakeQueen}}
local function MakeSpiderDenFn(den_level)
local spiderden_fn = function(Sim)
local inst = CreateEntity()
local trans = inst.entity:AddTransform()
local anim = inst.entity:AddAnimState()
inst.entity:AddGroundCreepEntity()
inst.entity:AddSoundEmitter()
inst.data = {}
MakeObstaclePhysics(inst, .5)
local minimap = inst.entity:AddMiniMapEntity()
minimap:SetIcon( "spiderden.png" )
anim:SetBank("spider_cocoon")
anim:SetBuild("spider_cocoon")
anim:PlayAnimation("cocoon_small", true)
inst:AddTag("structure")
inst:AddTag("hostile")
inst:AddTag("spiderden")
inst:AddTag("hive")
-------------------
inst:AddComponent("health")
inst.components.health:SetMaxHealth(200)
-------------------
inst:AddComponent("childspawner")
inst.components.childspawner.childname = "spider"
inst.components.childspawner:SetRegenPeriod(TUNING.SPIDERDEN_REGEN_TIME)
inst.components.childspawner:SetSpawnPeriod(TUNING.SPIDERDEN_RELEASE_TIME)
inst.components.childspawner:SetSpawnedFn(onspawnspider)
--inst.components.childspawner:SetMaxChildren(TUNING.SPIDERDEN_SPIDERS[stage])
--inst.components.childspawner:ScheduleNextSpawn(0)
inst:ListenForEvent("creepactivate", SpawnInvestigators)
---------------------
inst:AddComponent("lootdropper")
---------------------
---------------------
MakeMediumBurnable(inst)
inst.components.burnable:SetOnIgniteFn(OnIgnite)
-------------------
---------------------
MakeMediumFreezableCharacter(inst)
inst:ListenForEvent("freeze", OnFreeze)
inst:ListenForEvent("onthaw", OnThaw)
inst:ListenForEvent("unfreeze", OnUnFreeze)
-------------------
inst:ListenForEvent("dusktime", function() StartSpawning(inst) end, GetWorld())
inst:ListenForEvent("daytime", function() StopSpawning(inst) end , GetWorld())
-------------------
inst:AddComponent("combat")
inst.components.combat:SetOnHit(SpawnDefenders)
inst:ListenForEvent("death", OnKilled)
---------------------
MakeLargePropagator(inst)
---------------------
inst:AddComponent("growable")
inst.components.growable.stages = growth_stages
inst.components.growable:SetStage(den_level)
inst.components.growable:StartGrowing()
---------------------
--inst:AddComponent( "spawner" )
--inst.components.spawner:Configure( "resident", max, initial, rate )
--inst.spawn_weight = global_spawn_weight
inst:AddComponent("inspectable")
MakeSnowCovered(inst)
inst:SetPrefabName("spiderden")
inst.OnEntitySleep = OnEntitySleep
inst.OnEntityWake = OnEntityWake
return inst
end
return spiderden_fn
end
return Prefab( "forest/monsters/spiderden", MakeSpiderDenFn(1), assets, prefabs ),
Prefab( "forest/monsters/spiderden_2", MakeSpiderDenFn(2), assets, prefabs ),
Prefab( "forest/monsters/spiderden_3", MakeSpiderDenFn(3), assets, prefabs )
|
function uptime() return tmr.now() / 1000000 end
function mod(a, b) return a - math.floor(a/b)*b end
function step(amt) return mod(tmr.now() / 1000, step * 1000) end
function file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end
end
function monitor(interval)
tmr.stop(0)
tmr.alarm(0, interval*1000, 1, function()
print('heap: '..node.heap())
end)
end
function rltrim(str)
local rltrim = string.match(string.match(str, "%S.*"), ".*%S")
return string.format("%s", rltrim)
end
function splitstring(string, sep)
if sep == nil then sep = "%s" end
local t={} ; i=1
for str in string.gmatch(string, "([^"..sep.."]+)") do
t[i] = str
i = i + 1
end
return t
end
function explode(div,str) -- credit: http://richard.warburton.it
if (div=='') then return false end
local pos,arr = 0,{}
-- for each divider found
for st,sp in function() return string.find(str,div,pos,true) end do
table.insert(arr,string.sub(str,pos,st-1)) -- Attach chars left of current divider
pos = sp + 1 -- Jump past current divider
end
table.insert(arr,string.sub(str,pos)) -- Attach chars right of last divider
return arr
end
function switch(t)
t.case = function (self,x)
local f=self[x] or self.default
if f then
if type(f)=="function" then
f(x,self)
else
error("case "..tostring(x).." not a function")
end
end
end
return t
end
function green(x) id = 'green' end
function red(x) id = 'red'; end
function blue(x) id = 'blue'; end
function initDevice(mac)
if mac == "18:fe:34:9a:6c:44" then green()
elseif mac == "18:fe:34:9a:6d:10" then blue()
elseif mac == "18:fe:34:f9:0e:d9" then red()
else print('.. vreemde eend in de bijt')
end
print(mac .. ' ' .. id)
end |
local Object = require 'libs.classic'
local Piece = require 'tetris.components.piece'
local Ruleset = Object:extend()
Ruleset.name = ""
Ruleset.hash = ""
Ruleset.enable_IRS_wallkicks = false
-- Component functions.
function Ruleset:rotatePiece(inputs, piece, grid, prev_inputs, initial)
local new_inputs = {}
for input, value in pairs(inputs) do
if value and not prev_inputs[input] then
new_inputs[input] = true
end
end
self:attemptRotate(new_inputs, piece, grid, initial)
-- prev_inputs becomes the previous inputs
for input, value in pairs(inputs) do
prev_inputs[input] = inputs[input]
end
end
function Ruleset:attemptRotate(new_inputs, piece, grid, initial)
local rot_dir = 0
if (new_inputs["rotate_left"] or new_inputs["rotate_left2"]) then
rot_dir = 3
elseif (new_inputs["rotate_right"] or new_inputs["rotate_right2"]) then
rot_dir = 1
elseif (new_inputs["rotate_180"]) then
rot_dir = self:get180RotationValue()
end
if rot_dir == 0 then return end
local new_piece = piece:withRelativeRotation(rot_dir)
if (grid:canPlacePiece(new_piece)) then
piece:setRelativeRotation(rot_dir)
self:onPieceRotate(piece, grid)
else
if not(initial and self.enable_IRS_wallkicks == false) then
self:attemptWallkicks(piece, new_piece, rot_dir, grid)
end
end
end
function Ruleset:attemptWallkicks(piece, new_piece, rot_dir, grid)
-- do nothing in default ruleset
end
function Ruleset:movePiece(piece, grid, move, instant)
local x = piece.position.x
if move == "left" then
piece:moveInGrid({x=-1, y=0}, 1, grid, false)
elseif move == "right" then
piece:moveInGrid({x=1, y=0}, 1, grid, false)
elseif move == "speedleft" then
piece:moveInGrid({x=-1, y=0}, 10, grid, instant)
elseif move == "speedright" then
piece:moveInGrid({x=1, y=0}, 10, grid, instant)
end
if piece.position.x ~= x then
self:onPieceMove(piece, grid)
end
end
function Ruleset:dropPiece(
inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked,
hard_drop_enabled, additive_gravity
)
local y = piece.position.y
if inputs["down"] == true and drop_locked == false then
if additive_gravity then
piece:addGravity(gravity + drop_speed, grid)
else
piece:addGravity(math.max(gravity, drop_speed), grid)
end
elseif inputs["up"] == true and hard_drop_enabled == true then
if hard_drop_locked == true or piece:isDropBlocked(grid) then
piece:addGravity(gravity, grid)
else
piece:dropToBottom(grid)
end
else
piece:addGravity(gravity, grid)
end
if piece.position.y ~= y then
self:onPieceDrop(piece, grid)
end
end
function Ruleset:lockPiece(piece, grid, lock_delay)
if piece:isDropBlocked(grid) and piece.gravity >= 1 and piece.lock_delay >= lock_delay then
piece.locked = true
end
end
function Ruleset:get180RotationValue() return 2 end
function Ruleset:getDefaultOrientation() return 1 end
function Ruleset:initializePiece(
inputs, data, grid, gravity, prev_inputs,
move, lock_delay, drop_speed,
drop_locked, hard_drop_locked, big
)
local spawn_positions
if big then
spawn_positions = self.big_spawn_positions
else
spawn_positions = self.spawn_positions
end
local piece = Piece(data.shape, data.orientation - 1, {
x = spawn_positions[data.shape].x,
y = spawn_positions[data.shape].y
}, self.block_offsets, 0, 0, data.skin, big)
self:onPieceCreate(piece)
self:rotatePiece(inputs, piece, grid, {}, true)
self:dropPiece(inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked)
return piece
end
-- stuff like move count, rotate count, floorkick count go here
function Ruleset:onPieceCreate(piece) end
function Ruleset:processPiece(
inputs, piece, grid, gravity, prev_inputs,
move, lock_delay, drop_speed,
drop_locked, hard_drop_locked,
hard_drop_enabled, additive_gravity
)
self:rotatePiece(inputs, piece, grid, prev_inputs, false)
self:movePiece(piece, grid, move, gravity >= 20)
self:dropPiece(
inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked,
hard_drop_enabled, additive_gravity
)
self:lockPiece(piece, grid, lock_delay)
end
function Ruleset:onPieceMove(piece) end
function Ruleset:onPieceRotate(piece) end
function Ruleset:onPieceDrop(piece) end
return Ruleset
|
local ffi = require 'ffi'
local gl = require 'gl'
local class = require 'ext.class'
local GLTex = require 'gl.tex'
local GLTex3D = class(GLTex)
GLTex3D.target = gl.GL_TEXTURE_3D
function GLTex3D:create(args)
self.width = args.width
self.height = args.height
self.depth = args.depth
gl.glTexImage3D(
args.target or self.target,
args.level or 0,
args.internalFormat,
args.width,
args.height,
args.depth,
args.border or 0,
args.format,
args.type,
args.data)
end
function GLTex3D:load(args)
local Image = require 'image'
local image = args.image
if not image then
error('GLTex3D:load expected image')
end
assert(image)
local w,h,d = image:size()
local data = image:data()
local nw,nh,nd = self.rupowoftwo(w), self.rupowoftwo(h), self.rupowoftwo(d)
if w ~= nw or h ~= nh then
local ndata = ffi.new('unsigned char[?]', nw*nh*nd*4)
for nz=0,nd-1 do
for ny=0,nh-1 do
for nx=0,nw-1 do
local x = math.floor(nx*(w-1)/(nw-1))
local y = math.floor(ny*(h-1)/(nh-1))
local z = math.floor(nz*(d-1)/(nd-1))
for c=0,3 do
ndata[c+4*(nx+nw*(ny+nh*nz))] = data[c+4*(x+w*(y+h*z))]
end
end
end
end
data = ndata
w,h,d = nw,nh,nd
end
args.width, args.height, args.depth = w, h, d
args.data = data
args.internalFormat = args.internalFormat or self.formatForChannels[image.channels]
args.format = args.format or self.formatForChannels[image.channels] or gl.GL_RGBA
args.type = args.type or self.typeForType[image.format] or gl.GL_UNSIGNED_BYTE
end
return GLTex3D
|
module ("mi.util.micrypto", package.seeall)
local b = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
function base64_enc(str)
return ((str:gsub('.', function(x)
local r,b='',x:byte()
for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
return r;
end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
if (#x < 6) then return '' end
local c=0
for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end
return b:sub(c+1,c+1)
end)..({ '', '==', '=' })[#str%3+1])
end
function base64_enc_file(filepath)
local util = require("mi.miutil")
if util.str_nil(filepath) then
return nil
end
local str = util.exec("/usr/bin/base64 "..filepath)
if util.str_nil(str) then
return nil
else
return str:gsub("\n", "")
end
end
function base64_dec(str)
str = string.gsub(str, '[^'..b..'=]', '')
return (str:gsub('.', function(x)
if (x == '=') then return '' end
local r,f='',(b:find(x)-1)
for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end
return r;
end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x)
if (#x ~= 8) then return '' end
local c=0
for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end
return string.char(c)
end))
end
function md5_str(str)
local util = require("mi.miutil")
return util.trim(util.exec("/bin/echo -n '%s'|/usr/bin/md5sum|/usr/bin/cut -d' ' -f1" % str))
end
function md5_file(filepath)
local util = require("mi.miutil")
return util.trim(util.exec("/usr/bin/md5sum '%s'|/usr/bin/cut -d' ' -f1" % filepath))
end
function sha256_str(str)
local util = require("mi.miutil")
return util.trim(util.exec("/bin/echo -n '%s'|/usr/bin/sha256sum|/usr/bin/cut -d' ' -f1" % str))
end
function md5_base64_str(str)
return md5_str(base64_enc(str))
end |
local MyMathService = {
}
function MyMathService.Exec()
print('MyMathService.Exec')
end
return MyMathService |
--[[
MailSlurp API
MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://www.mailslurp.com/docs/) - [Examples](https://github.com/mailslurp/examples) repository
The version of the OpenAPI document: 6.5.2
Contact: contact@mailslurp.dev
Generated by: https://openapi-generator.tech
]]
-- send_email_options class
local send_email_options = {}
local send_email_options_mt = {
__name = "send_email_options";
__index = send_email_options;
}
local function cast_send_email_options(t)
return setmetatable(t, send_email_options_mt)
end
local function new_send_email_options(to_contacts, to_group, to, from, cc, bcc, subject, reply_to, body, html, is_html, charset, attachments, template_variables, template, send_strategy, use_inbox_name, add_tracking_pixel)
return cast_send_email_options({
["toContacts"] = to_contacts;
["toGroup"] = to_group;
["to"] = to;
["from"] = from;
["cc"] = cc;
["bcc"] = bcc;
["subject"] = subject;
["replyTo"] = reply_to;
["body"] = body;
["html"] = html;
["isHTML"] = is_html;
["charset"] = charset;
["attachments"] = attachments;
["templateVariables"] = template_variables;
["template"] = template;
["sendStrategy"] = send_strategy;
["useInboxName"] = use_inbox_name;
["addTrackingPixel"] = add_tracking_pixel;
})
end
return {
cast = cast_send_email_options;
new = new_send_email_options;
}
|
wHunter, optionOne, optionTwo, hunterText = nil
function createhunterGUI()
-- Window variables
local Width = 400
local Height = 250
local screenwidth, screenheight = guiGetScreenSize()
local X = (screenwidth - Width)/2
local Y = (screenheight - Height)/2
if not (wHunter) then
-- Create the window
wHunter = guiCreateWindow(X, Y, Width, Height, "Conversation with a stranger.", false )
-- Create Stevies text box
hunterText = guiCreateLabel ( 0.05, 0.1, 0.9, 0.3, "*A muscular man works under the car's hood.", true, wHunter )
guiLabelSetHorizontalAlign ( hunterText, "left", true )
-- Create close, previous and Next Button
optionOne = guiCreateButton( 0.05, 0.35, 0.9, 0.2, "Hey. I'm looking for a mechanic to change some spark plugs.", true, wHunter )
addEventHandler( "onClientGUIClick", optionOne, hunterStatement2, false )
optionTwo = guiCreateButton( 0.05, 0.55, 0.9, 0.2, "Nice ride. Is it yours?", true, wHunter )
addEventHandler( "onClientGUIClick", optionTwo, hunterStatement3, false ) -- Trigger Server side event
showCursor(true)
end
end
addEvent( "hunterIntroEvent", true )
addEventHandler( "hunterIntroEvent", getRootElement(), createhunterGUI )
function destroyHunterGUI()
-- destroy all possibly created windows
if optionOne then
destroyElement ( optionOne )
optionOne = nil
end
if optionTwo then
destroyElement ( optionTwo )
optionTwo = nil
end
if hunterText then
destroyElement ( hunterText )
hunterText = nil
end
if wHunter then
destroyElement ( wHunter )
wHunter = nil
end
showCursor(false)
end
-- make sure to quit the Convo GUI when player is killed
addEventHandler("onClientPlayerWasted", getLocalPlayer(), destroyHunterGUI)
addEventHandler("onClientChangeChar", getRootElement(), destroyHunterGUI)
-- statement 2
function hunterStatement2()
triggerServerEvent( "hunterStatement2ServerEvent", getLocalPlayer() ) -- Trigger Server Event to output previous option
-- Destroy elements
destroyHunterGUI()
end
-- Statement 3
function hunterStatement3()
triggerServerEvent( "hunterStatement3ServerEvent", getLocalPlayer() ) -- Trigger Server Event to output previous option
-- Destroy the old options
destroyElement ( optionOne )
destroyElement ( optionTwo )
optionOne = nil
optionTwo = nil
-- Create new Stevies text box
guiSetText ( hunterText, "Hunter says: It sure is." )
-- Create the new options
optionOne = guiCreateButton( 0.05, 0.35, 0.9, 0.2, "What are you running under there?", true, wHunter )
addEventHandler( "onClientGUIClick", optionOne, hunterStatement4, false ) -- New event handlers to different functions.
optionTwo = guiCreateButton( 0.05, 0.55, 0.9, 0.2, "I like the paint job.", true, wHunter )
addEventHandler( "onClientGUIClick", optionTwo, hunterStatement5, false )
end
-- statement 4
function hunterStatement4()
triggerServerEvent( "hunterStatement4ServerEvent", getLocalPlayer() ) -- Trigger Server Event to output previous option
-- Destroy the old options
destroyElement ( optionOne )
destroyElement ( optionTwo )
optionOne = nil
optionTwo = nil
-- Create Stevies text box
guiSetText (hunterText, "Hunter says: Sport air intake, NOS, fogger system and a T4 turbo. But you wouldn't know much about that, would you?" )
-- Create the new options
optionOne = guiCreateButton( 0.05, 0.35, 0.9, 0.2, "Looks like all show and no go to me.", true, wHunter )
addEventHandler( "onClientGUIClick", optionOne, hunterStatement6, false )
optionTwo = guiCreateButton( 0.05, 0.55, 0.9, 0.2, "Is that an AIC controller? .. And direct port nitrous injection?!", true, wHunter )
addEventHandler( "onClientGUIClick", optionTwo, hunterStatement7, false )
end
-- statement 5
function hunterStatement5()
triggerServerEvent( "hunterStatement5ServerEvent", getLocalPlayer() ) -- Trigger Server Event to output previous option
-- Destroy elements
destroyHunterGUI()
end
-- statement 6
function hunterStatement6()
triggerServerEvent( "hunterStatement6ServerEvent", getLocalPlayer() ) -- Trigger Server Event to output previous option
-- Destroy elements
destroyHunterGUI()
end
-- Statement 7
function hunterStatement7()
triggerServerEvent( "hunterStatement7ServerEvent", getLocalPlayer() ) -- Trigger Server Event to output previous option
-- Destroy the old options
destroyElement ( optionOne )
destroyElement ( optionTwo )
optionOne = nil
optionTwo = nil
-- Create Stevies text box
guiSetText (hunterText, "Hunter says: You almost sound like you know what you're talking about." )
-- Create the new options
optionOne = guiCreateButton( 0.05, 0.35, 0.9, 0.2, "There's nothing better than living a quarter mile at a time.", true, wHunter )
addEventHandler( "onClientGUIClick", optionOne, hunterStatement8, false )
end
-- Statement 8
function hunterStatement8()
triggerServerEvent( "hunterStatement8ServerEvent", getLocalPlayer() ) -- Trigger Server Event to output previous option
-- Destroy the old options
destroyElement ( optionOne )
optionOne = nil
-- Create Stevies text box
guiSetText ( hunterText, "Hunter says: Oh, you're a racer? They call me Hunter. I got a real name but unless you're the government you don't need to know it." )
-- Create the new options
optionOne = guiCreateButton( 0.05, 0.35, 0.9, 0.2, "You work here alone?", true, wHunter )
addEventHandler( "onClientGUIClick", optionOne, hunterStatement9, false )
optionTwo = guiCreateButton( 0.05, 0.55, 0.9, 0.2, "My mother taught me never to trust a man that won't even tell you his name.", true, wHunter )
addEventHandler( "onClientGUIClick", optionTwo, hunterStatement10, false )
end
-- Statement 9
function hunterStatement9()
triggerServerEvent( "hunterStatement9ServerEvent", getLocalPlayer() ) -- Trigger Server Event to output previous option
-- Destroy elements
destroyHunterGUI()
end
-- Statement 10
function hunterStatement10()
triggerServerEvent( "hunterStatement10ServerEvent", getLocalPlayer() ) -- Trigger Server Event to output previous option
-- Destroy the old options
destroyElement ( optionOne )
destroyElement ( optionTwo )
optionOne = nil
optionTwo = nil
-- Create Stevies text box
guiSetText ( hunterText, "Hunter says: Well here's the thing. One of my usual guys got busted a couple days ago. If you're looking to make some money I could use a new go to guy. See running a car like this isn't cheap so we ...borrow from other cars if you know what I'm saying." )
-- Create the new options
optionOne = guiCreateButton( 0.05, 0.45, 0.9, 0.2, "Sounds like easy money. Give me a call.", true, wHunter )
addEventHandler( "onClientGUIClick", optionOne, hunterStatement11, false )
optionTwo = guiCreateButton( 0.05, 0.65, 0.9, 0.2, "I'd rather not get involved in all that.", true, wHunter )
addEventHandler( "onClientGUIClick", optionTwo, hunterStatement12, false )
end
-- Hunter Success
function hunterStatement11()
triggerServerEvent( "hunterStatement11ServerEvent", getLocalPlayer() ) -- Trigger Server Event to output previous option
-- Destroy elements
destroyHunterGUI()
end
-- Hunter Decline
function hunterStatement12()
triggerServerEvent( "hunterStatement12ServerEvent", getLocalPlayer() ) -- Trigger Server Event to output previous option
-- Destroy elements
destroyHunterGUI()
end
|
pushenv("CONDA_DEFAULT_ENV","spades-3.12.0")
prepend_path{"PATH","/util/opt/anaconda/deployed-conda-envs/packages/spades/envs/spades-3.12.0/bin",priority=100}
append_path("CONDA_ENVS_PATH", "/util/opt/anaconda/deployed-conda-envs/packages/spades/envs")
|
-- Transform between YAML 1.1 streams and Lua table representations.
-- Written by Gary V. Vaughan, 2013
--
-- Copyright (c) 2013-2015 Gary V. Vaughan
--
-- 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.
--
-- Portions of this software were inspired by an earlier LibYAML binding by
-- Andrew Danforth <acd@weirdness.net>
--print ("lyaml package path " .. package.path)
--print ("lyaml c path " .. package.cpath)
--package.path =
local yaml = require "yaml"
local TAG_PREFIX = "tag:yaml.org,2002:"
local null = setmetatable ({}, { _type = "LYAML null" })
local function isnull (x)
return (getmetatable (x) or {})._type == "LYAML null"
end
-- Metatable for Dumper objects.
local dumper_mt = {
__index = {
-- Emit EVENT to the LibYAML emitter.
emit = function (self, event)
return self.emitter.emit (event)
end,
-- Look up an anchor for a repeated document element.
get_anchor = function (self, value)
local r = self.anchors[value]
if r then
self.aliased[value], self.anchors[value] = self.anchors[value], nil
end
return r
end,
-- Look up an already anchored repeated document element.
get_alias = function (self, value)
return self.aliased[value]
end,
-- Dump ALIAS into the event stream.
dump_alias = function (self, alias)
return self:emit {
type = "ALIAS",
anchor = alias,
}
end,
-- Dump MAP into the event stream.
dump_mapping = function (self, map)
local alias = self:get_alias (map)
if alias then
return self:dump_alias (alias)
end
self:emit {
type = "MAPPING_START",
anchor = self:get_anchor (map),
style = "BLOCK",
}
for k, v in pairs (map) do
self:dump_node (k)
self:dump_node (v)
end
return self:emit {type = "MAPPING_END"}
end,
-- Dump SEQUENCE into the event stream.
dump_sequence = function (self, sequence)
local alias = self:get_alias (sequence)
if alias then
return self:dump_alias (alias)
end
self:emit {
type = "SEQUENCE_START",
anchor = self:get_anchor (sequence),
style = "BLOCK",
}
for _, v in ipairs (sequence) do
self:dump_node (v)
end
return self:emit {type = "SEQUENCE_END"}
end,
-- Dump a null into the event stream.
dump_null = function (self)
return self:emit {
type = "SCALAR",
value = "~",
plain_implicit = true,
quoted_implicit = true,
style = "PLAIN",
}
end,
-- Dump VALUE into the event stream.
dump_scalar = function (self, value)
local alias = self:get_alias (value)
if alias then
return self:dump_alias (alias)
end
local anchor = self:get_anchor (value)
local itsa = type (value)
local style = "PLAIN"
if value == "true" or value == "false" or
value == "yes" or value == "no" or value == "~" or
(type (value) ~= "number" and tonumber (value) ~= nil) then
style = "SINGLE_QUOTED"
elseif itsa == "number" or itsa == "boolean" then
value = tostring (value)
elseif itsa == "string" and string.find (value, "\n") then
style = "LITERAL"
end
return self:emit {
type = "SCALAR",
anchor = anchor,
value = value,
plain_implicit = true,
quoted_implicit = true,
style = style,
}
end,
-- Decompose NODE into a stream of events.
dump_node = function (self, node)
local itsa = type (node)
if isnull (node) then
return self:dump_null ()
elseif itsa == "string" or itsa == "boolean" or itsa == "number" then
return self:dump_scalar (node)
elseif itsa == "table" then
if #node > 0 then
return self:dump_sequence (node)
else
return self:dump_mapping (node)
end
else -- unsupported Lua type
error ("cannot dump object of type '" .. itsa .. "'", 2)
end
end,
-- Dump DOCUMENT into the event stream.
dump_document = function (self, document)
self:emit {type = "DOCUMENT_START"}
self:dump_node (document)
return self:emit {type = "DOCUMENT_END"}
end,
},
}
-- Emitter object constructor.
local function Dumper (anchors)
local t = {}
for k, v in pairs (anchors or {}) do t[v] = k end
local object = {
anchors = t,
aliased = {},
emitter = yaml.emitter (),
--emitter = package.loadlib ("yaml.so","emmiter"),
}
return setmetatable (object, dumper_mt)
end
local function dump (documents, anchors)
local dumper = Dumper (anchors)
dumper:emit { type = "STREAM_START", encoding = "UTF8" }
for _, document in ipairs (documents) do
dumper:dump_document (document)
end
local ok, stream = dumper:emit { type = "STREAM_END" }
return stream
end
-- Metatable for Parser objects.
local parser_mt = {
__index = {
-- Return the type of the current event.
type = function (self)
return tostring (self.event.type)
end,
-- Raise a parse error.
error = function (self, errmsg)
error (string.format ("%d:%d: %s", self.mark.line,
self.mark.column, errmsg), 0)
end,
-- Save node in the anchor table for reference in future ALIASes.
add_anchor = function (self, node)
if self.event.anchor ~= nil then
self.anchors[self.event.anchor] = node
end
end,
-- Fetch the next event.
parse = function (self)
local ok, event = pcall (self.next)
if not ok then
-- if ok is nil, then event is a parser error from libYAML
self:error (event:gsub (" at document: .*$", ""))
end
self.event = event
self.mark = {
line = self.event.start_mark.line + 1,
column = self.event.start_mark.column + 1,
}
return self:type ()
end,
-- Construct a Lua hash table from following events.
load_map = function (self)
local map = {}
self:add_anchor (map)
while true do
local key = self:load_node ()
if key == nil then break end
local value, event = self:load_node ()
if value == nil then
self:error ("unexpected " .. self:type () .. "event")
end
map[key] = value
end
return map
end,
-- Construct a Lua array table from following events.
load_sequence = function (self)
local sequence = {}
self:add_anchor (sequence)
while true do
local node = self:load_node ()
if node == nil then break end
sequence[#sequence + 1] = node
end
return sequence
end,
-- Construct a primitive type from the current event.
load_scalar = function (self)
local value = self.event.value
local tag = self.event.tag
if tag then
tag = tag:match ("^" .. TAG_PREFIX .. "(.*)$")
if tag == "str" then
-- value is already a string
elseif tag == "int" or tag == "float" then
value = tonumber (value)
elseif tag == "bool" then
value = (value == "true" or value == "yes")
end
elseif self.event.style == "PLAIN" then
if value == "~" then
value = null
elseif value == "true" or value == "yes" then
value = true
elseif value == "false" or value == "no" then
value = false
else
local number = tonumber (value)
if number then value = number end
end
end
self:add_anchor (value)
return value
end,
load_alias = function (self)
local anchor = self.event.anchor
if self.anchors[anchor] == nil then
self:error ("invalid reference: " .. tostring (anchor))
end
return self.anchors[anchor]
end,
load_node = function (self)
local dispatch = {
SCALAR = self.load_scalar,
ALIAS = self.load_alias,
MAPPING_START = self.load_map,
SEQUENCE_START = self.load_sequence,
MAPPING_END = function () end,
SEQUENCE_END = function () end,
DOCUMENT_END = function () end,
}
local event = self:parse ()
if dispatch[event] == nil then
self:error ("invalid event: " .. self:type ())
end
return dispatch[event] (self)
end,
},
}
-- Parser object constructor.
local function Parser (s)
local object = {
anchors = {},
mark = { line = 0, column = 0 },
next = yaml.parser (s),
--next = package.loadlib ("yaml.so","parser")(s)
}
return setmetatable (object, parser_mt)
end
local function load (s, all)
local documents = {}
local parser = Parser (s)
if parser:parse () ~= "STREAM_START" then
error ("expecting STREAM_START event, but got " .. parser:type (), 2)
end
while parser:parse () ~= "STREAM_END" do
local document = parser:load_node ()
if document == nil then
error ("unexpected " .. parser:type () .. " event")
end
if parser:parse () ~= "DOCUMENT_END" then
error ("expecting DOCUMENT_END event, but got " .. parser:type (), 2)
end
-- save document
documents[#documents + 1] = document
-- reset anchor table
parser.anchors = {}
end
return all and documents or documents[1]
end
--[[ ----------------- ]]--
--[[ Public Interface. ]]--
--[[ ----------------- ]]--
local M = {
dump = dump,
load = load,
null = null,
--_VERSION = yaml.version,
}
return M |
includeFile("custom_content/draft_schematic/weapon/core/weapon_core_heavy_advanced.lua")
includeFile("custom_content/draft_schematic/weapon/core/weapon_core_heavy_standard.lua")
includeFile("custom_content/draft_schematic/weapon/core/weapon_core_melee_advanced.lua")
includeFile("custom_content/draft_schematic/weapon/core/weapon_core_melee_basic.lua")
includeFile("custom_content/draft_schematic/weapon/core/weapon_core_melee_standard.lua")
includeFile("custom_content/draft_schematic/weapon/core/weapon_core_ranged_advanced.lua")
includeFile("custom_content/draft_schematic/weapon/core/weapon_core_ranged_basic.lua")
includeFile("custom_content/draft_schematic/weapon/core/weapon_core_ranged_standard.lua")
|
--***********************************************************
--** ROBERT JOHNSON **
--** Simple collapsable window wich handle our farming info panel **
--***********************************************************
require "ISUI/ISCollapsableWindow"
---@class ISFarmingWindow : ISCollapsableWindow
ISFarmingWindow = ISCollapsableWindow:derive("ISFarmingWindow");
function ISFarmingWindow:initialise()
ISCollapsableWindow.initialise(self);
end
function ISFarmingWindow:visible(visible)
ISFarmingWindow.instance:setVisible(visible);
end
--************************************************************************--
--** ISPanel:instantiate
--**
--************************************************************************--
function ISFarmingWindow:createChildren()
ISCollapsableWindow.createChildren(self);
self.farmingPanel = ISFarmingInfo:new(0, 16, self.width, self.height-16, self.character, self.plant);
self.farmingPanel:initialise();
self:addChild(self.farmingPanel);
end
function ISFarmingWindow:new (x, y, width, height, character, plant)
local o = {}
--o.data = {}
o = ISCollapsableWindow:new(x, y, width, height);
o:setResizable(false)
setmetatable(o, self)
self.__index = self
self.farmingPanel = {};
o.character = character
o.plant = plant;
return o
end
|
local group = ARGV[1]
local min_idle = ARGV[3]
local id = ARGV[2]
local stream = KEYS[1]
local result = redis.call('XCLAIM', stream, group, "reclaimer", min_idle, id)
-- non-empty table?
if next(result) then
for k, v in pairs(result) do
if v then
redis.call('XADD', stream, '*', 'job', v[2][2])
redis.call('XACK', stream, group, id)
redis.call('XDEL', stream, id)
end
end
return 1
else
return 0
end
|
-- file opens with the cursor at the same position where last left off
vim.cmd([[
autocmd BufReadPost * if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' | exe "normal! g`\"" | endif
]])
vim.cmd([[
augroup numbertoggle
autocmd!
autocmd BufEnter,InsertLeave,WinEnter * if &nu | set rnu | endif
autocmd BufLeave,InsertEnter,WinLeave * if &nu | set nornu | endif
augroup END
]])
-- for highlighting a selection on yank
vim.cmd([[
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 450 }
]])
vim.cmd([[
sign define DiagnosticSignError text= texthl=DiagnosticSignError
sign define DiagnosticSignWarn text= texthl=DiagnosticSignWarn
sign define DiagnosticSignInfo text= texthl=DiagnosticSignInfo
sign define DiagnosticSignHint text= texthl=DiagnosticSignHint
]])
|
--[[
2020-2021 Xalalau Xubilozo. MIT License
https://xalalau.com/
--]]
-- MAIN CONFIGURATIONS
-- -----------------------------------------------------------------------------------
-- If true, will enable code live reloading, the command bs_tests and more time without hibernation
-- Unsafe! Only used while developing
BS.devMode = true
-- REAL TIME PROTECTION
-- -----------------------------------------------------------------------------------
-- In-game detouring protection and backdoor detection
BS.live = {
-- If true, will block backdoors activity in real time
backdoorDetection = true,
-- Live protection main control table
--[[
["some.game.function"] = { -- Declaring a function in a field will keep it safe from external detouring
detour = function -- Our detoured function address (Automatically managed)
filters = string or { string, ... } -- Internal functions to execute any extra security checks we want (following the declared order)
failed = type -- Set "failed" if you've set multiple "filters" and need to return fail values other than nil
fast = bool -- Set "fast" if you've set one or none "filters" and need to run VERY fast (much less code, ignore whitelists and low-risk lists)
-- If you've set the "Filters_CheckStack" filter:
stackBanLists = { string, ...} -- You can create blacklists of functions by adding names here. "some.game.function" will be grouped with others in blacklists.functions[the selected name]
protectStack = { string, ...} -- Select lists from blacklists.functions (created by the stackBanLists option) to block "some.game.function" from calling any of them
},
Current stackBanLists names:
harmful
doubtful
observed
]]
control = {
["Ban"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
["BroadcastLua"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
["cam.Start3D"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "doubtful" } },
["ChatPrint"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "observed" } },
["ClientsideModel"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "observed" } },
["CompileFile"] = { filters = { "Filters_CheckStack", "Filters_CheckStrCode" }, stackBanLists = { "harmful" } },
-- To-do: Test
["CompileString"] = { filters = { "Filters_CheckStack", "Filters_CheckStrCode" }, stackBanLists = { "harmful" }, failed = "" },
["concommand.Add"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
["debug.getfenv"] = { filters = { "Filters_CheckStack", "Filters_ProtectEnvironment" }, stackBanLists = { "harmful" } },
["debug.getinfo"] = { filters = { "Filters_CheckStack", "Filters_ProtectDebugGetinfo" }, stackBanLists = { "harmful" }, failed = {} },
["debug.getregistry"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
["Error"] = {},
["file.Delete"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "doubtful" } },
["file.Exists"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "observed" } },
-- To-do: needs fix for Pac3
--["file.Find"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "observed" } },
["file.Read"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "observed" } },
["file.Write"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "doubtful" } },
["game.CleanUpMap"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
-- To-do: Scan commands
["game.ConsoleCommand"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
["game.KickID"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
["getfenv"] = { filters = { "Filters_CheckStack", "Filters_ProtectEnvironment" }, stackBanLists = { "harmful" } },
["hook.Add"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "doubtful" } },
["hook.GetTable"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "doubtful" } },
["hook.Remove"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "doubtful" } },
["HTTP"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
["http.Fetch"] = { filters = { "Filters_CheckStack", "Filters_CheckHttpFetchPost" }, stackBanLists = { "harmful" }, protectStack = { "harmful", "doubtful", "observed" } },
["http.Post"] = { filters = { "Filters_CheckStack", "Filters_CheckHttpFetchPost" }, stackBanLists = { "harmful" }, protectStack = { "harmful", "doubtful", "observed" } },
["include"] = {},
["jit.util.funcinfo"] = { filters = { "Filters_CheckStack", "Filters_ProtectAddresses" }, stackBanLists = { "harmful" } },
["jit.util.funck"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
["Kick"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
["net.ReadHeader"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
-- To-do: Scan text
["net.ReadString"] = {},
-- To-do:
["net.Receive"] = { filters = { "Filters_CheckStack" }, protectStack = { "harmful" } },
["net.Start"] = {},
-- To-do: Scan text
["net.WriteString"] = {},
-- To-do: Test trace persistence
["pcall"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
["PrintMessage"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "observed" } },
["require"] = {},
-- To-do: Scan commands
["RunConsoleCommand"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "doubtful" } },
["RunString"] = { filters = { "Filters_CheckStack", "Filters_CheckStrCode" }, failed = "", stackBanLists = { "harmful" }, protectStack = { "harmful", "doubtful", "observed" } },
["RunStringEx"] = { filters = { "Filters_CheckStack", "Filters_CheckStrCode" }, failed = "", stackBanLists = { "harmful" }, protectStack = { "harmful", "doubtful", "observed" } },
["setfenv"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
["sound.PlayURL"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "observed" } },
["surface.PlaySound"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "observed" } },
["timer.Create"] = { filters = "Filters_CheckTimers" },
["timer.Destroy"] = {},
["timer.Exists"] = {},
["timer.Simple"] = { filters ="Filters_CheckTimers" },
["tostring"] = { filters = "Filters_ProtectAddresses", fast = true },
["util.AddNetworkString"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
["util.NetworkIDToString"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
["util.ScreenShake"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "doubtful" } },
-- To-do: Test trace persistence
["xpcall"] = { filters = { "Filters_CheckStack" }, stackBanLists = { "harmful" } },
},
blacklists = {
-- Every stackBanLists declaration in BS.control will merge into a functions["stackBanLists name"] list here
functions = {},
-- Snippets, syntax and symbols that are usually only seen in backdoors
snippets = {
"", -- LEFT-TO-RIGHT EMBEDDING
"=_G",
"(_G)",
",_G,",
"!true",
"!false",
"_G[",
"_G.",
"_R[",
"_R.",
"]()",
"0x",
"\\x",
"STEAM_0:",
"startingmoney", -- DarkRP var
},
-- Commands that are usually executed by backdoors
cvars = {
"rcon_password",
"sv_password",
"sv_gravity",
"sv_friction",
"sv_allowcslua",
"sv_password",
"sv_hostname",
"rp_resetallmoney",
"hostport",
},
}
}
-- FILES SCANNER
-- -----------------------------------------------------------------------------------
-- Don't add common patterns to the blacklists and suspect lists, or the addon will return
-- many false positives and probably turn the console into a giant log hell.
BS.filesScanner = {
-- These extensions will never be considered as not suspect by the file scanner.
-- The bs_scan command scans only for files with these extensions.
dangerousExtensions = { "lua", "txt" , "vmt", "dat", "json" },
-- The folders checked by the scanner if none are specified (bs_scan command)
foldersToScan = { "addons", "lua", "gamemode", "data" },
-- Print low-risk results in the console
printLowRisk = false,
-- Discard a result if it's from a file with only BS.filesScanner.suspect_suspect detections
discardVeryLowRisk = true,
-- Ignore our own folders
ignoreBSFolders = true,
-- Detections with these chars will be considered as not suspect (at first) for tested strings
-- that aren't from files with extensions listed in scanner.dangerousExtensions.
-- Avoid false positives with non Lua files
notSuspect = {
"ÿ",
"", -- 000F
},
-- Very edge snippets, syntax and symbols that virtually only backdoors use
-- High-risk
blacklistHigh = {
"", -- LEFT-TO-RIGHT EMBEDDING
"(_G)",
",_G,",
"!true",
"!false",
},
-- Edge snippets, syntax and symbols that virtually only backdoors use
-- High-risk
blacklistHigh_suspect = {
"=_G", -- Note: used by backdoors to start hiding names or create a better environment
},
-- Functions that sometimes appear in normal scripts, but are usually seen in backdoors
-- Medium-risk
blacklistMedium = {
"RunString",
"RunStringEx",
"CompileString",
"CompileFile",
"BroadcastLua",
"setfenv",
"http.Fetch",
"http.Post",
"debug.getinfo",
"game.ConsoleCommand",
},
-- Snippets, syntax and symbols that sometimes appear in normal scripts, but are usually seen in backdoors
-- Medium-risk
blacklistMedium_suspect = {
"_G[",
"_G.",
"_R[",
"_R."
},
-- Functions that some backdoors and regular scripts use - They aren't worth blocking, just warning.
-- I use these detections to increase the potential risk of others while scanning files.
-- Low-risk
suspect = {
"pcall",
"xpcall",
"SendLua",
},
-- Snippets, syntax and symbols that some backdoors and regular scripts use - They aren't worth blocking, just warning.
-- I use these detections to increase the potential risk of others while scanning files, but with a very light weight.
-- Low-risk
suspect_suspect = {
"]()",
"0x",
"\\x",
},
}
-- LOW-RISK LISTS
-- -----------------------------------------------------------------------------------
-- Detections from these lists are considered low risk on the file scanner and generate
-- only warnings on live protection. Even detour detections only alert!
-- Exception: BS.live.control functions configured with the "fast" option
BS.lowRisk= {
-- Low-risk folders
folders = {
},
-- Low-risk files
files = {
},
}
-- WHITELISTS
-- -----------------------------------------------------------------------------------
-- Detections from these lists don't appear on the file scanner and aren't protected
-- in any way. No blocking, no warnings, no logs. Detours are completely ignored!
-- Exception: BS.live.control functions configured with the "fast" option
BS.whitelists = {
-- Whitelisted files
folders = {
"lua/wire/", -- Wiremod
"lua/ulx/", -- ULX
"lua/ulib/", -- Ulib
"lua/pac3/", -- Pac3
"lua/smh", -- Stop Motion Helper
"lua/playx", -- PlayX
},
-- Whitelisted folders
files = {
"lua/entities/gmod_wire_expression2/core/extloader.lua", -- Wiremod
"gamemodes/base/entities/entities/lua_run.lua" -- GMod
},
-- Whitelist for Filters_CheckStack combinations
stack = {
-- { "CompileString", "BroadcastLua" } -- e.g. it means that a BroadcastLua() inside a CompileString() won't generate a detection
{ "RunString", "RunString" },
{ "pcall", "pcall" },
{ "xpcall", "xpcall" },
{ "pcall", "xpcall" },
{ "xpcall", "pcall" }
},
-- Whitelist http.Fetch() and http.Post() urls
-- Don't scan the downloaded content, just run it normally to start checking again
urls = {
"http://www.geoplugin.net/",
},
-- Whitelist snippets
-- Ignore detections containing the listed "texts"
-- Be very careful to add items to this list! Ideally, it should never be used
snippets = {
},
} |
require 'init'.init()
|
gr_worrt_gutbuster = Creature:new {
objectName = "@mob/creature_names:worrt_gutbuster",
socialGroup = "worrt",
faction = "",
level = 16,
chanceHit = 0.33,
damageMin = 160,
damageMax = 170,
baseXp = 960,
baseHAM = 2900,
baseHAMmax = 3500,
armor = 0,
resists = {0,0,0,0,0,110,0,-1,-1},
meatType = "meat_reptilian",
meatAmount = 9,
hideType = "hide_leathery",
hideAmount = 9,
boneType = "bone_mammal",
boneAmount = 4,
milk = 0,
tamingChance = 0,
ferocity = 0,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = PACK,
optionsBitmask = 0,
diet = CARNIVORE,
templates = {"object/mobile/worrt.iff"},
scale = 4.5,
lootGroups = {},
weapons = {},
conversationTemplate = "",
attacks = {
{"stunattack",""}
}
}
CreatureTemplates:addCreatureTemplate(gr_worrt_gutbuster, "gr_worrt_gutbuster")
|
ITEM.name = "Кассета Наемников"
ITEM.desc = "Список треков:\n1. Тимур Муцураев - Нет дороги назад\n2. Тимур Муцураев - Шамиль ведет отряд\n3. Тимур Муцураев - Мама, приезжай и меня забери\n4. Тимур Муцураев - Они ушли\n5. Тимур Муцураев - Если духом ты слаб\n6. Любэ - Комбат\n\nНа кассете написано «Танксит-Бекдорщик», в углу подпись «M&L». Интересно, что бы это могло значить?"
ITEM.price = 87940
ITEM.model = "models/kek1ch/cassette_backkek.mdl"
ITEM.cassette_options = {}
ITEM.cassette_options['radio/muravcev_1.ogg'] = {dur = 231}
ITEM.cassette_options['radio/muravcev_2.ogg'] = {dur = 211}
ITEM.cassette_options['radio/muravcev_3.ogg'] = {dur = 218}
ITEM.cassette_options['radio/muravcev_4.ogg'] = {dur = 456}
ITEM.cassette_options['radio/muravcev_5.ogg'] = {dur = 289}
ITEM.cassette_options['radio/lube_combt.ogg'] = {dur = 303}
|
-- * _JOKER_VERSION: 0.0.1 ** Please do not modify this line.
--[[----------------------------------------------------------
Utility Functions
- Frequent needs not specific to Joker (isEmpty, setContains, etc)
- Imported from Joker.lua
CONTENTS:
- isEmpty()
- trim()
- addToSet()
- setContains()
- difference()
- formatNumber()
- startsWith()
- split()
- colorize()
----------------------------------------------------------
]]--
local Util = JokerUtilityFn or {}
-- isEmpty()
-- Utility; Checks if given string is empty/nil
function Util.isEmpty(s)
return s == nil or s == ""
end
-- isSetEmpty()
-- Utility; Checks if given string is empty/nil
function Util.isSetEmpty(t)
return next (t) == nil
end
-- trim()
-- Utility; Trims extraneous whitespace from string
function Util.trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
-- addToSet()
-- Utility; Add given key to set with int 1
function Util.addToSet(set, key)
set[key] = 1
end
-- Util.setContains()
-- Utility; Determines if a set contains a key. Best used for ipair-able things
function Util.setContains(set, key)
return set[key] ~= nil
end
-- Util.setContains()
-- Utility; Determines if a set and key contain a value
function Util.setContainsValue(set, value)
local foundValue = false
for i,v in pairs(set) do
if v == value then
foundValue = true
end
end
return foundValue
end
-- Util.countSet()
-- Utility; Counts number of entries in a set
function Util.countSet(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
-- Util.sortSet
-- Utility; Sorts table alphabetically
function Util.sortSet(set)
return table.sort(set, function(a,b) return a < b end)
end
-- difference()
-- Utility; Returns table of differences between two given tables
function Util.difference(a, b)
local aa = {}
for k,v in pairs(a) do aa[v]=true end
for k,v in pairs(b) do aa[v]=nil end
local ret = {}
local n = 0
for k,v in pairs(a) do
if aa[v] then n=n+1 ret[n]=v end
end
return ret
end
-- formatNumber()
-- Utility; Returns a localized (comma thousands, period decimals) number
function Util.formatNumber(amount)
return zo_strformat("<<1>>", ZO_LocalizeDecimalNumber(amount))
end
function Util.startsWith(String,Start)
return string.sub(String,1,string.len(Start))==Start
end
-- split()
-- Utility; split string based on given string & delimiter
function Util.split(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
-- colorize()
-- Display; Wraps text with a color. Credit: @Phuein
function Util.colorize(text, color)
-- Default to addon's .color.
if not color then color = Joker.color end
text = "|c" .. color .. text .. "|r"
return text
end
-- roundNumber
-- Util: Round number [num] to given decimal places [numDecimalPlaces]
function Util.roundNumber(num, numDecimalPlaces)
return tonumber(string.format("%." .. (numDecimalPlaces or 0) .. "f", num))
end
JokerUtilityFn = Util or {}
|
ENT.Type = "anim"
ENT.PrintName = "Sign"
ENT.Category = "Metrostroi (utility)"
ENT.Spawnable = false
ENT.AdminSpawnable = false
ENT.RenderGroup = RENDERGROUP_BOTH
ENT.SignModels = {}
--------------------------------------------------------------------------------
-- Inside
--------------------------------------------------------------------------------
--ENT.RenderOffset[0] = Vector(0,0,112+32)
ENT.SignModels[0] = {
model = "models/metrostroi/re_sign/t_och_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[1] = {
model = "models/metrostroi/re_sign/t_40_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[2] = {
model = "models/metrostroi/re_sign/t_60_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[3] = {
model = "models/metrostroi/re_sign/t_70_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[4] = {
model = "models/metrostroi/re_sign/t_80_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[5] = {
model = "models/metrostroi/re_sign/station_border.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
noauto = true,
}
ENT.SignModels[6] = {
model = "models/metrostroi/re_sign/signal_outdoor.mdl",
pos = Vector(0,100,50),
angles = Angle(0,90,0),
noauto = true,
}
ENT.SignModels[7] = {
model = "models/metrostroi/re_sign/stop_1.mdl",
pos = Vector(0,100,40),
angles = Angle(0,90,0),
noauto = true,
}
ENT.SignModels[8] = {
model = "models/metrostroi/re_sign/t_opasno_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
noauto = true,
}
ENT.SignModels[9] = {
model = "models/metrostroi/re_sign/t_otstoi_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
noauto = true,
}
ENT.SignModels[10] = {
model = "models/metrostroi/props_models/stop_marker_vertical.mdl",
pos = Vector(0,113,143),
angles = Angle(0,0,90),
noauto = true,
}
ENT.SignModels[11] = {
model = "models/metrostroi/re_sign/t_!_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[12] = {
model = "models/metrostroi/re_sign/t_x_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[13] = {
model = "models/metrostroi/re_sign/t_nachalo_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[14] = {
model = "models/metrostroi/re_sign/t_t_konec_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[15] = {
model = "models/metrostroi/re_sign/t_sbor_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[16] = {
model = "models/metrostroi/re_sign/t_tedoff_r.mdl",
pos = Vector(0,90,112),
angles = Angle(0,0,-0),
}
ENT.SignModels[17] = {
model = "models/metrostroi/re_sign/t_tedon_r.mdl",
pos = Vector(0,90,112),
angles = Angle(0,0,-0),
}
ENT.SignModels[18] = {
model = "models/metrostroi/re_sign/t_c_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[19] = {
model = "models/metrostroi/re_sign/t_t_r.mdl",
pos = Vector(0,0,-2),
angles = Angle(0,0,0),
noauto = true,
noleft = true,
}
ENT.SignModels[20] = {
model = "models/metrostroi/re_sign/t_shod.mdl",
pos = Vector(0,0,-2),
angles = Angle(0,0,0),
noauto = true,
noleft = true,
}
ENT.SignModels[21] = {
model = "models/metrostroi/re_sign/t_door_r.mdl",
pos = Vector(0,0,-2),
angles = Angle(0,0,0),
noauto = true,
noleft = true
}
ENT.SignModels[22] = {
model = "models/metrostroi/re_sign/t_phone_l.mdl",
pos = Vector(0,99,125),
angles = Angle(0,-90,0),
rotate = true,
}
ENT.SignModels[23] = {
model = "models/metrostroi/re_sign/t_phone_r.mdl",
pos = Vector(0,99,125),
angles = Angle(0,-90,0),
rotate = true,
}
ENT.SignModels[24] = {
model = "models/metrostroi/re_sign/t_1up_r.mdl",--replace
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[25] = {
model = "models/metrostroi/re_sign/stop_2.mdl",
pos = Vector(0,100,40),
angles = Angle(0,90,0),
noauto = true,
}
ENT.SignModels[26] = {
model = "models/metrostroi/re_sign/signal_outdoor_och.mdl",
pos = Vector(0,100,50),
angles = Angle(0,90,0),
noauto = true,
}
ENT.SignModels[27] = {
model = "models/metrostroi/re_sign/signal_outdoor_35.mdl",
pos = Vector(0,100,50),
angles = Angle(0,90,0),
noauto = true,
}
ENT.SignModels[28] = {
model = "models/metrostroi/re_sign/signal_outdoor_40.mdl",
pos = Vector(0,100,50),
angles = Angle(0,90,0),
noauto = true,
}
ENT.SignModels[29] = {
model = "models/metrostroi/re_sign/signal_outdoor_60.mdl",
pos = Vector(0,100,50),
angles = Angle(0,90,0),
noauto = true,
}
ENT.SignModels[30] = {
model = "models/metrostroi/re_sign/signal_outdoor_70.mdl",
pos = Vector(0,100,50),
angles = Angle(0,90,0),
noauto = true,
}
ENT.SignModels[31] = {
model = "models/metrostroi/re_sign/signal_outdoor_80.mdl",
pos = Vector(0,100,50),
angles = Angle(0,90,0),
noauto = true,
}
ENT.SignModels[32] = {
model = "models/metrostroi/re_sign/signal_outdoor_sbor.mdl",
pos = Vector(0,100,50),
angles = Angle(0,90,0),
noauto = true,
}
ENT.SignModels[33] = {
model = "models/metrostroi/re_sign/t_35_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[34] = {
model = "models/metrostroi/re_sign/t_opasno_200_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[35] = {
model = "models/metrostroi/tracks/powerrail_end_2.mdl",
pos = Vector(0,-0.2,-0.6),
angles = Angle(0,0,0),
noauto = true,
rotate = true,
}
ENT.SignModels[36] = {
model = "models/metrostroi/tracks/powerrail_end_2.mdl",
pos = Vector(0,-0.2+139,-0.6),
angles = Angle(0,180,0),
noauto = true,
rotate = true,
}
ENT.SignModels[37] = {
model = "models/metrostroi/re_sign/t_2up_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[38] = {
model = "models/metrostroi/re_sign/t_3up_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[39] = {
model = "models/metrostroi/re_sign/t_4up_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[40] = {
model = "models/metrostroi/re_sign/t_5up_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[41] = {
model = "models/metrostroi/re_sign/t_6up_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[42] = {
model = "models/metrostroi/re_sign/signal_outdoor_x.mdl",
pos = Vector(0,100,50),
angles = Angle(0,90,0),
noauto = true,
}
ENT.SignModels[43] = {
model = "models/metrostroi/re_sign/t_metal_r.mdl",--replace
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[44] = {
model = "models/metrostroi/re_sign/t_50_r.mdl",
pos = Vector(0,90,125),
angles = Angle(0,0,0),
}
ENT.SignModels[45] = {
model = "models/metrostroi/re_sign/signal_outdoor_50.mdl",
pos = Vector(0,100,50),
angles = Angle(0,90,0),
noauto = true,
} |
-- luacheck: globals vim
local utils = {}
utils.keys = function(tbl)
local new = {}
for k, _ in pairs(tbl) do
table.insert(new, k)
end
return new
end
utils.LRU = function(sz)
return {
__newindex = function(tbl, key, value)
local lru = rawget(tbl, "__lru_tbl")
if lru == nil then
lru = {}
rawset(tbl, "__lru_tbl", lru)
end
table.insert(lru, key)
if (#utils.keys(lru) - 1 >= sz) then
local old = table.remove(lru, 1)
rawset(tbl, old, nil)
end
rawset(tbl, "__lru_tbl", lru)
rawset(tbl, key, value)
end
}
end
utils.default = function(val, def)
if val ~= nil then
return val
else
return def
end
end
utils.get = function(d, k)
if type(d) == "table" then
return d and d[k]
else
return nil
end
end
utils.get_in = function(d, k)
local p = d
for _, i in ipairs(k) do
p = utils.get(p, i)
end
return p
end
utils.clone = function(orig)
local orig_type = type(orig)
local copy
if orig_type == 'table' then
copy = {}
for orig_key, orig_value in next, orig, nil do
copy[utils.clone(orig_key)] = utils.clone(orig_value)
end
setmetatable(copy, utils.clone(getmetatable(orig)))
else -- number, string, boolean, etc
copy = orig
end
return copy
end
utils.interleave = function(tbl, itn)
local new = {}
for _, v in ipairs(tbl) do
table.insert(new, v)
table.insert(new, itn)
end
return new
end
utils.key_to_attr = function(tbl, attr_name)
local new = {}
for k, v in pairs(tbl) do
local itm = utils.clone(v)
itm[attr_name] = k
table.insert(new, itm)
end
return new
end
utils.sorted_by = function(tbl, compare)
local new = utils.clone(tbl)
table.sort(new, compare)
return new
end
utils.partial = function(fn, ...)
local args = {...}
return function(...)
return fn(unpack(args), ...)
end
end
utils.partial_last = function(fn, ...)
local args = {...}
return function(...)
return fn(..., unpack(args))
end
end
utils.chain = function(v, ...)
local fns = {...}
local nv = utils.clone(v)
for _, fn in ipairs(fns) do
nv = fn(nv)
end
return nv
end
utils.map = function(tbl, fn)
local new = {}
for _, v in ipairs(tbl) do
table.insert(new, fn(v))
end
return new
end
utils.tap = function(tbl)
print(require("inspect")(tbl))
return tbl
end
utils.merge = function(...)
local new = {}
for _, tbl in ipairs(...) do
for k, v in pairs(tbl) do
new[k] = v
end
end
return new
end
-- Taken from luarocks
utils.deep_merge = function(tgt, src)
local dst = utils.clone(tgt)
for k, v in pairs(src) do
if type(v) == "table" then
if not dst[k] then
dst[k] = {}
end
if type(dst[k]) == "table" then
dst[k] = utils.deep_merge(dst[k], v)
else
dst[k] = v
end
else
dst[k] = v
end
end
return dst
end
utils.extend = function(tbls)
local new = {}
for _, tbl in ipairs(tbls) do
for _, v in ipairs(tbl) do
table.insert(new, v)
end
end
return new
end
utils.split = function(str, sep)
local fields = {}
local pattern = string.format("([^%s]+)", sep)
str:gsub(pattern, function(c) fields[#fields+1] = c end)
return fields
end
utils.trim = function(s)
-- http://lua-users.org/wiki/StringTrim
return s:match'^()%s*$' and '' or s:match'^%s*(.*%S)'
end
utils.displaywidth = function(expr, col)
return vim.api.nvim_call_function('strdisplaywidth', { expr, col })
end
utils.strwidth = function(expr, col)
return vim.api.nvim_call_function('strwidth', { expr, col })
end
utils.str_escape = function(expr)
return vim.api.nvim_call_function('escape', { expr , '[]'})
end
utils.take = function(sz, iter, cinv, z)
local count = 1
return function(inv, c)
if count > sz then
return
end
count = count + 1
return iter(inv, c)
end, cinv, z
end
utils.drop = function(dropped, sz, iter, cinv, z)
local count = math.max(sz, 0)
local function drop_iter(inv, c)
local result = iter(inv, c)
if dropped ~= nil then
table.insert(dropped, result)
end
if count > 0 then
count = count - 1
if c ~= nil then
c = c + 1
end
return drop_iter(inv, c)
end
return result
end
return drop_iter, cinv, z
end
utils.replace_at = function(str, nv, at)
return string.gsub(str, "().", {[at] = nv})
end
utils.table_from_iter = function(...)
local arr = {}
for k, v in ... do
arr[k] = v
end
return arr
end
utils.starts_with = function(str, begining)
return begining == "" or string.sub(str, 1, #begining) == begining
end
return utils
|
local Minimal = game:GetService("ReplicatedStorage"):WaitForChild("Minimal")
local Commands = Minimal:WaitForChild("Commands"):GetChildren()
local Config = require(Minimal:WaitForChild("Configuration"))
local List = script.Parent:WaitForChild("List")
local ASEP = Config.Settings.ArgumentSeperator
for _,v in ipairs(Commands) do
if v:IsA("ModuleScript") then
local CMD = require(v)
local CommandInfo = CMD.Configuration.Information
local Command = script.Parent.CmdInfo:WaitForChild("CMD"):Clone()
Command.Parent = script.Parent.CmdInfo
Command.Name = CommandInfo.Command
local UsageArgs = string.split(CommandInfo.Usage," ")
Command.Usage.Text = ""
for _,v in ipairs(UsageArgs) do
Command.Usage.Text = Command.Usage.Text..v..ASEP
end
for _,v in ipairs(CommandInfo.Aliases) do
Command.Aliases.Text = Command.Aliases.Text..","..v
end
Command.Usage.Text = string.sub(Command.Usage.Text,1,string.len(Command.Usage.Text) - 1)
Command.Aliases.Text = string.sub(Command.Aliases.Text,2)
Command.Description.Text = CommandInfo.Description
end
wait()
if v:IsA("ModuleScript") then
local CMD = require(v)
local CommandInfo = CMD.Configuration.Information
local Command = List.CMD:Clone()
Command.Name = CommandInfo.Command
Command.Text = CommandInfo.Command
Command.Parent = List
Command.Visible = true
Command.MouseEnter:Connect(function()
local CmdInf = script.Parent.CmdInfo:WaitForChild(Command.Name)
CmdInf.Visible = true
end)
Command.MouseLeave:Connect(function()
local CmdInf = script.Parent.CmdInfo:WaitForChild(Command.Name)
CmdInf.Visible = false
end)
end
end
|
-- do things when net is up
dofile("rtc/init.lua")
--dofile(arch=='linux' and "shell/main.lua" or "shell/main.lc")
--if arch=='esp32' then
-- dofile("httpd/init.lua")
--end
--dofile("tftpd/init.lua")()
--dofile("demo/init.lua")
--dofile("example/init2.lua")
--dofile("httpd/init.lua")
|
local function get_ancestors_of_class(instance: Instance, class_name: string): { Instance? }
instance = instance.Parent
local ancestors = { instance }
while instance do
instance = instance.Parent
if not instance or instance.ClassName ~= class_name then
continue
end
table.insert(ancestors, instance)
end
return ancestors
end
return get_ancestors_of_class |
Ext.Require("Server/Modules/RealJump.lua")
Ext.Require("Server/Modules/FallDamage.lua")
Ext.Require("Server/Modules/GBTalents.lua")
Ext.Require("Server/Modules/Corrogic.lua")
PersistentVars = {}
function EnableFallDamage(cmd)
if cmd == "on" then
print("Fall damage module activated")
PersistentVars["DGM_FallDamage"] = true
elseif cmd == "off" then
print("Fall damage module deactivated")
PersistentVars["DGM_FallDamage"] = false
end
end
function EnableJumpDamage(cmd)
if cmd == "on" then
print("Jump fall damage module activated")
PersistentVars["DGM_FallDamage_Jump"] = true
elseif cmd == "off" then
print("Jump fall damage module deactivated")
PersistentVars["DGM_FallDamage_Jump"] = false
end
end
local function DGM_Modules_consoleCmd(cmd, ...)
local params = {...}
for i=1,10,1 do
local par = params[i]
if par == nil then break end
if type(par) == "string" then
par = par:gsub("&", " ")
par = par:gsub("\\ ", "&")
params[i] = par
end
end
if cmd == "DGM_Module_RealJump" then ReplaceAllJumps(params[1]) end
if cmd == "DGM_Module_FallDamage" then EnableFallDamage(params[1]) end
if cmd == "DGM_Module_FallDamage_Jump" then EnableJumpDamage(params[1]) end
end
local function ActivateModule(flag)
if flag == "LXDGM_ModuleRealJump" then
ReplaceAllJumps("on")
elseif flag == "LXDGM_ModuleFallDamageClassic" then
EnableFallDamage("on")
elseif flag == "LXDGM_ModuleFallDamageAlternate" then
EnableJumpDamage("on")
elseif flag == "LXDGM_ModuleDualCC" then
Ext.ExtraData.DGM_EnableDualCCParry = 1
elseif flag == "LXDGM_ModuleCorrogicDisable" then
Ext.ExtraData.DGM_Corrogic = 0
end
end
Ext.RegisterOsirisListener("GlobalFlagSet", 1, "after", ActivateModule)
local function DeactivateModule(flag)
if flag == "LXDGM_ModuleRealJump" then
ReplaceAllJumps("off")
elseif flag == "LXDGM_ModuleFallDamageClassic" then
EnableFallDamage("off")
elseif flag == "LXDGM_ModuleFallDamageAlternate" then
EnableJumpDamage("off")
elseif flag == "LXDGM_ModuleDualCC" then
Ext.ExtraData.DGM_EnableDualCCParry = 0
elseif flag == "LXDGM_ModuleCorrogicDisable" then
Ext.ExtraData.DGM_Corrogic = 1
end
end
Ext.RegisterOsirisListener("GlobalFlagCleared", 1, "after", DeactivateModule)
Ext.RegisterConsoleCommand("DGM_Module_RealJump", DGM_Modules_consoleCmd)
Ext.RegisterConsoleCommand("DGM_Module_FallDamage", DGM_Modules_consoleCmd)
|
resource.AddWorkshop(2181831767)
resource.AddWorkshop(788109554)
resource.AddWorkshop(1275272057)
resource.AddWorkshop(442214334)
resource.AddWorkshop(892493593)
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
AddCSLuaFile("cl_hud.lua")
AddCSLuaFile("cl_scoreboard.lua")
AddCSLuaFile("cl_menu.lua")
AddCSLuaFile("cl_messages.lua")
include("shared.lua")
include("player_meta.lua")
include("player.lua")
include("nav.lua")
util.AddNetworkString("AbilityAttempt")
util.AddNetworkString("AbilityResult")
util.AddNetworkString("ConsumeAttempt")
util.AddNetworkString("ConsumeExpired")
util.AddNetworkString("ConsumeResult")
util.AddNetworkString("CraftAttempt")
util.AddNetworkString("CraftResult")
util.AddNetworkString("DefaultModelChoice")
util.AddNetworkString("MessageSide")
util.AddNetworkString("PlayerDisconnected")
util.AddNetworkString("PrintColored")
util.AddNetworkString("ScoreboardRequest")
util.AddNetworkString("ScoreboardResult")
util.AddNetworkString("ScoreMessage")
util.AddNetworkString("SpectateToggle")
util.AddNetworkString("TogglePlayable")
util.AddNetworkString("TrainAttempt")
util.AddNetworkString("TrainClosed")
util.AddNetworkString("TrainResult")
util.AddNetworkString("UpdateInfoCache")
util.AddNetworkString("UpdateInv")
util.AddNetworkString("UpdateRound")
util.AddNetworkString("UpdateScoreboard")
util.AddNetworkString("UpdateStat")
util.AddNetworkString("WinnerMessage")
util.AddNetworkString("WinnerChosen")
--------------------------------
--[[ GAME FUNCTIONS ]]--
-------------------------------
BBB = BBB or {
round = "Waiting",
time = 0,
playing = {},
estimatedPlaying = 0,
bossLiving = false,
}
function GetRound() return BBB.round end
function GetEndTime() return BBB.time end
function GM:Initialize()
StartWaiting()
timer.Simple(5, InitializeSpawns)
end
---------------------------------------------
--[[ IMPORTANT ROUND DETERMINERS ]]--
---------------------------------------------
local function minPlayersMet()
local playable = 0
for k, ply in ipairs(player.GetAll()) do
if IsValid(ply) and ply:GetPlayable() then
playable = playable + 1
end
end
return playable >= 2
end
local function checkForEnd()
-- Checks how many players are still playing
local playing = 0
for ply, bool in pairs(BBB.playing) do
if IsValid(ply) and ply:GetPlaying() then
playing = playing + 1
end
end
-- If there are more than 2 players playing then don't end the round
if playing >= 2 then return end
-- Remove other timers
timer.Remove("endbattle")
timer.Remove("endarmageddon")
timer.Remove("checkforend")
for ply, bool in pairs(BBB.playing) do
if IsValid(ply) then
ply:UpdateScore(50, "You got 50 points for being the final survivor!")
end
end
-- Add a small timer for final survivor declaration?
EndArmageddon()
end
local function applyToxicity(ply, id, startTime)
if IsValid(ply) and ply:GetPlaying() and GetRound() == "Armageddon" then
if ply:Alive() then
local damage = DamageInfo()
damage:SetDamage(math.ceil((CurTime() - startTime) / 4))
ply:TakeDamageInfo(damage)
-- Points for surviving another second into armageddon
ply:UpdateScore(2)
end
else
timer.Remove("applytoxicity"..tostring(id))
end
end
-- Attempts 3 times recurseively to pick a boss, and returns to waiting if none are found
local function pickBoss(attempt)
local potentialBosses = {}
for k, ply in ipairs(player.GetAll()) do
if IsValid(ply) then
ply:SetBoss(false)
table.insert(potentialBosses, ply)
end
end
local potentialBoss = potentialBosses[math.random(#potentialBosses)]
if IsValid(potentialBoss) and potentialBoss:IsPlayer() then
potentialBoss:SetBoss(true)
BBB.bossLiving = true
return potentialBoss
elseif attempt <= 3 then
return pickBoss(attempt + 1)
else
ResetTimers()
end
end
local roundTimes = {
Waiting = 1,
Preparing = 7,
Crafting = 165,
Battle = 105,
Armageddon = 105,
Scoring = 5,
}
-- Sets the round marker and tells the clients
local function SetRound(arg)
BBB.round = arg
BBB.time = roundTimes[arg] + math.floor(CurTime())
net.Start("UpdateRound")
net.WriteString(GetRound())
net.WriteInt(GetEndTime(), 16)
net.Broadcast()
end
--------------------------------
--[[ GAMEMODE CYCLE ]]--
--------------------------------
-- Starts the waiting timer which loops every 3 seconds until removed
function StartWaiting()
SetRound("Waiting")
timer.Create("endwaiting", roundTimes.Waiting, 0, EndWaiting)
end
-- Checks for game start conditions
function EndWaiting()
if minPlayersMet() and SpawnsSelected() then
timer.Remove("endwaiting")
StartPreparing()
end
end
-- Spawns players and checks to see if there is a valid boss selected
function StartPreparing()
SetRound("Preparing")
game.CleanUpMap()
BBB.playing = {}
BBB.estimatedPlaying = 0
for k, ply in ipairs(player.GetAll()) do
if IsValid(ply) and ply:GetPlayable() then
BBB.estimatedPlaying = BBB.estimatedPlaying + 1
ply:Spawn()
end
end
SpawnMaterials()
timer.Create("endpreparing", roundTimes.Preparing, 1, EndPreparing)
end
-- Begins the game or restarts the waiting timer
function EndPreparing()
timer.Remove("endpreparing")
if minPlayersMet() then
-- Attempts to find a boss
local bossFound = false
for k, ply in ipairs(player.GetAll()) do
if IsValid(ply) then
if not ply:GetPlayable() then
ply:KillSilent()
elseif ply:GetBoss() then
bossFound = true
BBB.bossLiving = true
end
end
end
if not bossFound then
pickBoss(1)
end
StartCrafting()
else
StartWaiting()
end
end
-- Respawns players who died and gets everyone ready for the crafting round
function StartCrafting()
SetRound("Crafting")
local amt = 0
for k, ply in ipairs(player.GetAll()) do
if IsValid(ply) then
if ply:GetPlayable() then
ply:SetPlaying(true)
ply:SetPlayed(true)
ply:SetLives(3)
ply:GiveTools()
BBB.playing[ply] = true
amt = amt + 1
else
BBB.playing[ply] = nil
end
end
end
-- The double loop is a necessary evil
for ply, bool in pairs(BBB.playing) do
if ply:GetBoss() then
ply:EmitSound("vo/ravenholm/madlaugh0"..math.random(1, 4)..".wav", 150)
ply:SetLives(1)
ply:SetWalkSpeed(350)
ply:SetRunSpeed(350)
ply:SetJumpPower(350)
ply:SetMaxHP(100 + 25 * amt)
ply:SetMaxShield(100 + 10 * amt)
ply:SetDefense(1.25)
ply:SetShieldRegen(0.25)
ply:SetModel("models/player/breen.mdl")
if not ply:Alive() then
ply:Spawn()
else
ply:SetHealth(ply:GetMaxHealth())
ply:SetShield(ply:GetMaxShield())
ply:GiveTools()
end
end
end
timer.Create("endcrafting", roundTimes.Crafting, 1, EndCrafting)
end
-- Determines player ranks before the battle phase begins
function EndCrafting()
timer.Remove("endcrafting")
for ply, bool in pairs(BBB.playing) do
if IsValid(ply) then
ply:ChooseRank()
end
end
RemoveMaterials()
SpawnObstacles()
StartBattle()
end
-- Gives players the necessary stats and tools and begins the battle phase
function StartBattle()
SetRound("Battle")
for ply, bool in pairs(BBB.playing) do
if IsValid(ply) then
if not ply:Alive() then
ply:Spawn()
else
ply:SetHealth(ply:GetMaxHealth())
ply:SetShield(ply:GetMaxShield())
ply:FullStrip()
ply:GiveTools()
end
if ply:GetBoss() then
ply:EmitSound("vo/Citadel/br_mock0"..tostring(3 * math.random(2, 3))..".wav", 150)
end
ply:ChangeStats()
end
end
timer.Remove("abilitycooldown")
if BBB.bossLiving then
timer.Create("endbattle", roundTimes.Battle, 1, EndBattle)
else
timer.Create("endbattle", 10, 1, function()
EndBattle()
end)
end
timer.Create("checkforend", 3, 0, checkForEnd)
end
-- Transitions to the armageddon phase
function EndBattle()
timer.Remove("endbattle")
StartArmageddon()
end
-- Starts the armageddon
function StartArmageddon()
SetRound("Armageddon")
for ply, bool in pairs(BBB.playing) do
if IsValid(ply) then
-- Points for reaching armageddon
ply:UpdateScore(50, "You got 50 points for reaching Armageddon!")
-- Automatically damages each living player to end the round
local id = ply:SteamID64()
local curtime = CurTime()
timer.Create("applytoxicity"..tostring(id), 1, 0, function() applyToxicity(ply, id, curtime) end)
end
end
timer.Create("breakobstacles", 7, 0, function()
if GetRound() == "Armageddon" then
RemoveObstacles(false)
else
timer.Remove("breakobstacles")
end
end)
timer.Create("endarmageddon", roundTimes.Armageddon, 1, EndArmageddon)
end
-- Removes everyone's items and removes the boss
function EndArmageddon()
timer.Remove("endarmageddon")
timer.Remove("breakobstacles")
timer.Remove("checkforend")
for k, ply in ipairs(player.GetAll()) do
if IsValid(ply) then
ply:FullStrip()
end
end
for ply, bool in pairs(BBB.playing) do
if IsValid(ply) then
-- Points for surviving multiplied by the number of remaining lives
ply:UpdateScore(50 * ply:GetLives(), "You got 50 points for each leftover life!")
end
end
BBB.bossLiving = false
RemoveMaterials()
StartScoring()
end
function StartScoring()
local playerScores = {}
for k, ply in ipairs(player.GetAll()) do
if IsValid(ply) and ply:GetPlayed() then
-- Give the boss an extra score penalty
if ply:GetBoss() then
ply:SetScore(ply:GetScore() / 2)
end
ply:SetPity(ply:GetPity() + 0.2)
playerScores[ply] = ply:GetScore()
end
end
local playerScoresSorted = table.SortByKey(playerScores)
local winner = playerScoresSorted[1]
if IsValid(winner) and winner:GetBoss() then
winner = playerScoresSorted[2]
end
for k, ply in ipairs(player.GetAll()) do
ply:SetBoss(false)
end
if IsValid(winner) then
winner:SetBoss(true)
net.Start("WinnerMessage")
local winnerMessage = winner:Name().." has won with "..tostring(math.floor(winner:GetScore())).." points and has proven worthy of being Battle Boss!"
net.WriteString(winnerMessage)
net.Broadcast()
end
SetRound("Scoring")
timer.Create("endscoring", roundTimes.Scoring, 1, EndScoring)
end
-- Resets everyone's stats and starts checks if enough people are available for the next round
function EndScoring()
timer.Remove("endscoring")
for k, ply in ipairs(player.GetAll()) do
if IsValid(ply) then
ply:FullReset()
end
end
if minPlayersMet() and SpawnsSelected() then
StartPreparing()
else
StartWaiting()
end
end
-- Allows a game to be completely stopped and restarted
function ResetTimers()
timer.Remove("endwaiting")
timer.Remove("endpreparing")
timer.Remove("endcrafting")
timer.Remove("endbattle")
timer.Remove("endarmageddon")
timer.Remove("endscoring")
timer.Remove("checkforend")
for k, ply in ipairs(player.GetAll()) do
if IsValid(ply) then
ply:SetBoss(false)
end
end
BBB.bossLiving = false
EndScoring()
end
|
local _M=
{
mContext=nil,
}
_M.new=function()
local p={}
setmetatable(p,_M)
_M.__index=_M
return p
end
_M.show=function(t)
oTUIObject_Show(t.mContext)
end
_M.getVisible=function(t)
return oTUIObject_GetVisible(t.mContext)
end
_M.setVisible=function(t,value)
oTUIObject_SetVisible(t.mContext,value)
end
_M.show=function(t)
_M.setVisible(t,true)
end
_M.hide=function(t)
_M.setVisible(t,false)
end
_M.isEnable=function(t)
return oTUIObject_IsEnable(t.mContext)
end
_M.setEnable=function(t)
oTUIObject_SetEnable(t.mContext)
end
_M.getObjectName=function(t)
oTUIObject_GetObjectName(t.mContext)
end
_M.setObjectName=function(t,value)
oTUIObject_SetObjectName(t.mContext,value)
end
_M.setParent=function(t,value)
if type(value)~="number"then
value=value.mContext
end
oTUIObject_SetParent(t.mContext,value)
end
return _M |
-- Copyright 2011-2012 Nils Nordman <nino at nordman.org>
-- Copyright 2012-2014 Robert Gieseke <rob.g@web.de>
-- License: MIT (see LICENSE)
--[[--
The Textredux core module allows you to easily create text based interfaces
for the [Textadept](http://foicica.com/textadept/) editor.
It currently consists of the following components:
- The @{textredux.core.buffer} module that supports custom styling, buffer
specific key bindings, hotspot support and generally makes it easy to
create a text based interface buffer by taking care of the background
gruntwork required.
- The @{textredux.core.style} module that let's you easily define custom
styles, as well as leveraging the default styles already provided by the
user's theme.
- The @{textredux.core.indicator} module that provides a convenient way of
using indicators in your buffers.
- The @{textredux.core.list} module that provides a versatile and extensible
text based item listing for Textadept, featuring advanced search capabilities
and styling.
How to use
----------
After installing the Textredux module into your `modules` directory, you can
either do
local textredux = require('textredux')
local reduxlist = textredux.core.list
or you can just the modules that you want by something
similar to
local reduxstyle = require('textredux.core.style')
local reduxbuffer = require('textredux.core.style')
The examples provide an overview on how to use the various components and their
features, and the documentation for each component provides more details.
@module textredux.core
]]
local M = {
buffer = require 'textredux.core.buffer',
filteredlist = require 'textredux.core.filteredlist',
style = require 'textredux.core.style',
list = require 'textredux.core.list',
indicator = require 'textredux.core.indicator',
}
return M
|
--[[
Graphite for Lua
List
Copyright (c) 2014 Lucien Greathouse (LPGhatguy)
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the
use of this software.
Permission is granted to anyone to use this software for any purpose, including
commercial applications, and to alter it and redistribute it freely, subject to
the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim
that you wrote the original software. If you use this software in a product, an
acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented
as being the original software.
3. This notice may not be removed or altered from any source distribution.
]]
local Graphite = (...)
local List = {}
--[[
void List.Clear(List list)
list: The list to clear.
Clears a list of all list values.
]]
function List.Clear(list)
for key, value in ipairs(list) do
list[key] = nil
end
end
--[[
table List.ShallowCopy(table from, [table to])
from: The table to source data from
to: The table to copy into; an empty table if not given.
Shallow copies data from one table into another and returns the result.
]]
function List.ShallowCopy(from, to)
to = to or {}
for key, value in ipairs(from) do
table.insert(to, value)
end
return to
end
return List |
function Div (div)
div.attributes.five = ("%d"):format(div.attributes.two + div.attributes.three)
div.attributes.two = nil
div.attributes.one = "eins"
return div
end
|
--other items
require("items.cooked_fish")
require("items.gauss_coil")
require("items.laser_axe")
--armor items
require("items.armor.power_armor_3")
--ammunition items
require("items.ammunition.auxiliary_tesla_coil")
require("items.ammunition.basic_arrow")
require("items.ammunition.heavy_duty_bullets")
require("items.ammunition.laser_battery")
require("items.ammunition.poisonous_cannon_shell")
require("items.ammunition.rock")
require("items.ammunition.sharpened_log")
require("items.ammunition.sulfuric_acid_shotgun_shell")
--weapon items
require("items.weapons.laser_rifle")
require("items.weapons.log_launcher")
require("items.weapons.minigun")
require("items.weapons.portable_cannon")
require("items.weapons.sling")
require("items.weapons.sniper_rifle")
require("items.weapons.tandem_coilgun")
require("items.weapons.tesla_pistol")
require("items.weapons.wooden_bow")
require("items.weapons.heavy_flamethrower")
--entity items
require("items.entities.tesla_turret")
|
CHANNEL_GPS = 65534
local function trilaterate( A, B, C )
local a2b = B.vPosition - A.vPosition
local a2c = C.vPosition - A.vPosition
if math.abs( a2b:normalize():dot( a2c:normalize() ) ) > 0.999 then
return nil
end
local d = a2b:length()
local ex = a2b:normalize( )
local i = ex:dot( a2c )
local ey = (a2c - (ex * i)):normalize()
local j = ey:dot( a2c )
local ez = ex:cross( ey )
local r1 = A.nDistance
local r2 = B.nDistance
local r3 = C.nDistance
local x = (r1*r1 - r2*r2 + d*d) / (2*d)
local y = (r1*r1 - r3*r3 - x*x + (x-i)*(x-i) + j*j) / (2*j)
local result = A.vPosition + (ex * x) + (ey * y)
local zSquared = r1*r1 - x*x - y*y
if zSquared > 0 then
local z = math.sqrt( zSquared )
local result1 = result + (ez * z)
local result2 = result - (ez * z)
local rounded1, rounded2 = result1:round( 0.01 ), result2:round( 0.01 )
if rounded1.x ~= rounded2.x or rounded1.y ~= rounded2.y or rounded1.z ~= rounded2.z then
return rounded1, rounded2
else
return rounded1
end
end
return result:round( 0.01 )
end
local function narrow( p1, p2, fix )
local dist1 = math.abs( (p1 - fix.vPosition):length() - fix.nDistance )
local dist2 = math.abs( (p2 - fix.vPosition):length() - fix.nDistance )
if math.abs(dist1 - dist2) < 0.01 then
return p1, p2
elseif dist1 < dist2 then
return p1:round( 0.01 )
else
return p2:round( 0.01 )
end
end
function locate( _nTimeout, _bDebug )
if _nTimeout ~= nil and type( _nTimeout ) ~= "number" then
error( "bad argument #1 (expected number, got " .. type( _nTimeout ) .. ")", 2 )
end
if _bDebug ~= nil and type( _bDebug ) ~= "boolean" then
error( "bad argument #2 (expected boolean, got " .. type( _bDebug) .. ")", 2 )
end
-- Let command computers use their magic fourth-wall-breaking special abilities
if commands then
return commands.getBlockPosition()
end
-- Find a modem
local sModemSide = nil
for n,sSide in ipairs( rs.getSides() ) do
if peripheral.getType( sSide ) == "modem" and peripheral.call( sSide, "isWireless" ) then
sModemSide = sSide
break
end
end
if sModemSide == nil then
if _bDebug then
print( "No wireless modem attached" )
end
return nil
end
if _bDebug then
print( "Finding position..." )
end
-- Open a channel
local modem = peripheral.wrap( sModemSide )
local bCloseChannel = false
if not modem.isOpen( os.getComputerID() ) then
modem.open( os.getComputerID() )
bCloseChannel = true
end
-- Send a ping to listening GPS hosts
modem.transmit( CHANNEL_GPS, os.getComputerID(), "PING" )
-- Wait for the responses
local tFixes = {}
local pos1, pos2 = nil, nil
local timeout = os.startTimer( _nTimeout or 2 )
while true do
local e, p1, p2, p3, p4, p5 = os.pullEvent()
if e == "modem_message" then
-- We received a reply from a modem
local sSide, sChannel, sReplyChannel, tMessage, nDistance = p1, p2, p3, p4, p5
if sSide == sModemSide and sChannel == os.getComputerID() and sReplyChannel == CHANNEL_GPS and nDistance then
-- Received the correct message from the correct modem: use it to determine position
if type(tMessage) == "table" and #tMessage == 3 and tonumber(tMessage[1]) and tonumber(tMessage[2]) and tonumber(tMessage[3]) then
local tFix = { vPosition = vector.new( tMessage[1], tMessage[2], tMessage[3] ), nDistance = nDistance }
if _bDebug then
print( tFix.nDistance.." metres from "..tostring( tFix.vPosition ) )
end
if tFix.nDistance == 0 then
pos1, pos2 = tFix.vPosition, nil
else
table.insert( tFixes, tFix )
if #tFixes >= 3 then
if not pos1 then
pos1, pos2 = trilaterate( tFixes[1], tFixes[2], tFixes[#tFixes] )
else
pos1, pos2 = narrow( pos1, pos2, tFixes[#tFixes] )
end
end
end
if pos1 and not pos2 then
break
end
end
end
elseif e == "timer" then
-- We received a timeout
local timer = p1
if timer == timeout then
break
end
end
end
-- Close the channel, if we opened one
if bCloseChannel then
modem.close( os.getComputerID() )
end
-- Return the response
if pos1 and pos2 then
if _bDebug then
print( "Ambiguous position" )
print( "Could be "..pos1.x..","..pos1.y..","..pos1.z.." or "..pos2.x..","..pos2.y..","..pos2.z )
end
return nil
elseif pos1 then
if _bDebug then
print( "Position is "..pos1.x..","..pos1.y..","..pos1.z )
end
return pos1.x, pos1.y, pos1.z
else
if _bDebug then
print( "Could not determine position" )
end
return nil
end
end
|
if SERVER then AddCSLuaFile() return end
local PANEL = {}
DEFINE_BASECLASS( "Panel" )
local DEBUG = false
local JS_CallbackHack = [[(function(){
var funcname = '%s';
window[funcname] = function(){
_gm[funcname].apply(_gm,arguments);
}
})();]]
local FilterCVar = CreateClientConVar( "js_console_filter", 0, true, false )
local FILTER_ALL = 0
local FILTER_NONE = 1
--[[---------------------------------------------------------
-----------------------------------------------------------]]
function PANEL:Init()
self.JS = {}
self.Callbacks = {}
self.MouseActions = {}
self.URL = "about:blank"
--
-- Implement a console - because awesomium doesn't provide it for us anymore
--
local console_funcs = {'log','error','debug','warn','info'}
for _, func in pairs(console_funcs) do
self:AddFunction( "console", func, function(param)
self:ConsoleMessage( param, func )
end )
end
self:AddFunction( "gmod", "getUrl", function( url )
self:SetURL( url )
end )
hook.Add( "HUDPaint", self, function() self:HUDPaint() end )
end
function PANEL:Think()
if self:IsLoading() then
-- Call started loading
if not self._loading then
-- Get the page URL
self:FetchPageURL()
self._loading = true
self:OnStartLoading()
end
else
-- Call finished loading
if self._loading then
-- Get the page URL
self:FetchPageURL()
-- Hack to add window object callbacks
if self.Callbacks.window then
for funcname, callback in pairs(self.Callbacks.window) do
self:RunJavascript( JS_CallbackHack:format(funcname) )
end
end
self._loading = nil
self:OnFinishLoading()
end
-- Run queued javascript
if self.JS then
for k, v in pairs( self.JS ) do
self:RunJavascript( v )
end
self.JS = nil
end
end
-- HACK: Poll page for URL change
if not self._nextUrlPoll or self._nextUrlPoll < RealTime() then
self:FetchPageURL()
self._nextUrlPoll = RealTime() + 1
end
end
function PANEL:FetchPageURL()
local js = "gmod.getUrl(window.location.href);"
self:RunJavascript(js)
end
function PANEL:GetURL()
return self.URL
end
function PANEL:SetURL( url )
local current = self.URL
if current ~= url then
self:OnURLChanged( url, current )
end
self.URL = url
end
function PANEL:OnURLChanged( new, old )
if FilterCVar:GetInt() > FILTER_ALL then
--print( "URL Changed: " .. tostring(new) )
end
end
--[[---------------------------------------------------------
Awesomium Override Functions
-----------------------------------------------------------]]
function PANEL:SetSize( w, h, fullscreen )
local keyboardEnabled = self:IsKeyboardInputEnabled()
local mouseEnabled = self:IsMouseInputEnabled()
if fullscreen then
-- Cache fullscreen size
local cw, ch = self:GetSize()
self._OrigSize = { w = cw, h = ch }
-- Render before the HUD
self:ParentToHUD()
elseif self._OrigSize then
-- Restore cached size
w = self._OrigSize.w
h = self._OrigSize.h
self._OrigSize = nil
-- Reparent due to hud parented panels sometimes being inaccessible
-- from Lua.
self:SetParent( vgui.GetWorldPanel() )
else
self._OrigSize = nil
end
self:SetKeyBoardInputEnabled( keyboardEnabled )
self:SetMouseInputEnabled( mouseEnabled )
if not (w and h) then return end
BaseClass.SetSize( self, w, h )
end
function PANEL:OpenURL( url )
if DEBUG then
--print("DMediaPlayerHTML.OpenURL", url)
end
self:SetURL( url )
BaseClass.OpenURL( self, url )
end
function PANEL:SetHTML( html )
if DEBUG then
--print("DMediaPlayerHTML.SetHTML")
--print(html)
end
BaseClass.SetHTML( self, html )
end
--[[---------------------------------------------------------
Window loading events
-----------------------------------------------------------]]
--
-- Called when the page begins loading
--
function PANEL:OnStartLoading()
end
--
-- Called when the page finishes loading all assets
--
function PANEL:OnFinishLoading()
end
--[[---------------------------------------------------------
Lua => JavaScript queue
This code only runs when the page is finished loading;
this means all assets (images, CSS, etc.) must load first!
-----------------------------------------------------------]]
function PANEL:QueueJavascript( js )
--
-- Can skip using the queue if there's nothing else in it
--
if not ( self.JS or self:IsLoading() ) then
return self:RunJavascript( js )
end
self.JS = self.JS or {}
table.insert( self.JS, js )
self:Think()
end
PANEL.QueueJavaScript = PANEL.QueueJavascript
PANEL.Call = PANEL.QueueJavascript
--[[---------------------------------------------------------
Handle console logging from JavaScript
-----------------------------------------------------------]]
PANEL.ConsoleColors = {
["default"] = Color(255,160,255),
["text"] = Color(255,255,255),
["error"] = Color(235,57,65),
["warn"] = Color(227,181,23),
["info"] = Color(100,173,229),
}
function PANEL:ConsoleMessage( ... )
local filterLevel = FilterCVar:GetInt()
local args = {...}
local msg = args[1]
-- Three arguments are passed in if an error occured
if #args == 3 and filterLevel > FILTER_ALL then
local script = args[2]
local linenum = args[3]
local col = self.ConsoleColors.error
local out = {
"[JavaScript]",
msg,
",",
script,
":",
linenum,
"\n"
}
MsgC( col, table.concat(out, " ") )
else
if not isstring( msg ) then
msg = "*js variable* (" .. type(msg) .. ": " .. tostring(msg) .. ")"
end
-- Run Lua from JavaScript console logging (POTENTIALLY HARMFUL!)
--[[if msg:StartWith( "RUNLUA:" ) then
local strLua = msg:sub( 8 )
SELF = self
RunString( strLua )
SELF = nil
return
end]]
-- Play a sound from JavaScript console logging
if msg:StartWith( "PLAY:" ) then
local soundpath = msg:sub( 7 )
surface.PlaySound( soundpath )
return
end
if filterLevel == FILTER_ALL then return end
local func = args[2]
-- Output console message with prefix
local prefixColor = self.ConsoleColors.default
local prefix = "[HTML"
if func and func:len() > 0 and func ~= "log" then
if self.ConsoleColors[func] then
prefixColor = self.ConsoleColors[func]
end
prefix = prefix .. ":" .. func:upper()
end
prefix = prefix .. "] "
MsgC( prefixColor, prefix )
MsgC( self.ConsoleColors.text, msg, "\n" )
end
end
--[[---------------------------------------------------------
JavaScript callbacks
-----------------------------------------------------------]]
local JSObjects = {
window = "_gm",
this = "_gm",
_gm = "window"
}
--
-- Called by the engine when a callback function is called
--
function PANEL:OnCallback( obj, func, args )
-- Hack for adding window callbacks
obj = JSObjects[obj] or obj
if not self.Callbacks[ obj ] then return end
--
-- Use AddFunction to add functions to this.
--
local f = self.Callbacks[ obj ][ func ]
if ( f ) then
return f( unpack( args ) )
end
end
--
-- Add a function to Javascript
--
function PANEL:AddFunction( obj, funcname, func )
-- Hack for adding window callbacks
-- obj = JSObjects[obj] or obj
if obj == "this" then
obj = "window"
end
-- Create the `object` if it doesn't exist
if not self.Callbacks[ obj ] then
self:NewObject( obj )
self.Callbacks[ obj ] = {}
end
-- This creates the function in javascript (which redirects to c++ which calls OnCallback here)
self:NewObjectCallback( JSObjects[obj] or obj, funcname )
-- Store the function so OnCallback can find it and call it
self.Callbacks[ obj ][ funcname ] = func
end
--[[---------------------------------------------------------
Remove Scrollbars
-----------------------------------------------------------]]
local JS_RemoveScrollbars = "document.body.style.overflow = 'hidden';"
function PANEL:RemoveScrollbars()
self:QueueJavascript(JS_RemoveScrollbars)
end
--[[---------------------------------------------------------
Compatibility functions
-----------------------------------------------------------]]
function PANEL:OpeningURL( url )
end
function PANEL:FinishedURL( url )
end
--[[---------------------------------------------------------
Simulated mouse clicks
-----------------------------------------------------------]]
function PANEL:HUDPaint()
self:HandleMouseActions()
end
function PANEL:InjectMouseClick( x, y )
if self._handlingMouseAction then
return
end
local w, h = self:GetSize()
table.insert( self.MouseActions, {
x = math.Round(x * w),
y = math.Round(y * h),
tick = 0
} )
end
function PANEL:HandleMouseActions()
if #self.MouseActions == 0 then
return
end
local action = self.MouseActions[1]
action.tick = action.tick + 1
if action.tick == 1 then
-- show cursor
self._handlingMouseAction = true
self:SetZPos( 32767 )
self:MoveToCursor( action.x, action.y )
self:MakePopup()
gui.EnableScreenClicker( true )
gui.InternalCursorMoved( 0, 0 )
elseif action.tick == 2 then
local cx, cy = input.GetCursorPos()
gui.InternalCursorMoved( cx, cy )
elseif action.tick == 3 then
-- simulate click; need to wait at least one frame
gui.InternalMousePressed( MOUSE_LEFT )
gui.InternalMouseReleased( MOUSE_LEFT )
elseif action.tick > 3 then
-- hide cursor
gui.EnableScreenClicker( false )
self:SetKeyboardInputEnabled( false )
self:SetMouseInputEnabled( false )
self:SetZPos( -32768 )
table.remove( self.MouseActions, 1 )
self._handlingMouseAction = nil
end
end
function PANEL:MoveToCursor( xoffset, yoffset )
xoffset = xoffset or 0
yoffset = yoffset or 0
local cx, cy = input.GetCursorPos()
self:SetPos( cx - xoffset, cy - yoffset )
end
derma.DefineControl( "DMediaPlayerHTML", "", PANEL, "Awesomium" ) |
-------------------------------------------------------------------------------
-- Mob Framework Mod by Sapier
--
-- You may copy, use, modify or do nearly anything except removing this
-- copyright notice.
-- And of course you are NOT allow to pretend you have written it.
--
--! @file dont_move.lua
--! @brief movementpattern for immobile mob
--! @copyright Sapier
--! @author Sapier
--! @date 2012-08-10
--
--! @addtogroup mpatterns
--! @{
-- Contact sapier a t gmx net
-------------------------------------------------------------------------------
--! @struct dont_move_prototype
--! @brief a movement pattern resulting in a mob not moving at all
local dont_move_prototype = {
name ="dont_move",
jump_up =0,
random_jump_chance =0,
random_jump_initial_speed =0,
random_jump_delay =0,
random_acceleration_change =0,
--
-- --run towards player or run away? 1 <-> -1
-- player_attraction =0,
-- --maximum distance a player has an effect
-- player_attraction_range =-1,
}
--!@}
table.insert(mov_patterns_defined,dont_move_prototype) |
local M={} ; package.loaded[(...)]=M ; M.module_name=(...)
setmetatable(M,{__index=io}) -- use io as prototype
local pmio=M
--
-- pmio.lua
-- Additpmions to the I/O namespace.
-- Copyright (c) 2008-2009 Jason Perkins and the Premake project
--
--
-- Prepare to capture the output from all subsequent calls to pmio.printf(),
-- used for automated testing of the generators.
--
function pmio.capture()
pmio.captured = ''
end
--
-- Returns the captured text and stops capturing.
--
function pmio.endcapture()
local captured = pmio.captured
pmio.captured = nil
return captured
end
--
-- Open an overload of the pmio.open() function, which will create any missing
-- subdirectories in the filename if "mode" is set to writeable.
--
local builtin_open = pmio.open
function pmio.open(fname, mode)
if (mode) then
if (mode:find("w")) then
local dir = path.getdirectory(fname)
ok, err = os.mkdir(dir)
if (not ok) then
error(err, 0)
end
end
end
return builtin_open(fname, mode)
end
--
-- A shortcut for printing formatted output to an output stream.
--
function pmio.printf(msg, ...)
if not pmio.eol then
pmio.eol = "\n"
end
if not pmio.indent then
pmio.indent = "\t"
end
if type(msg) == "number" then
s = string.rep( (io.indent or pmio.indent) , msg) .. string.format(...)
else
s = string.format(msg,...)
end
if pmio.captured then
pmio.captured = pmio.captured .. s .. (io.eol or pmio.eol)
else
pmio.write(s)
pmio.write((io.eol or pmio.eol))
end
end
--
-- Because I use pmio.printf() so often in the generators, create a terse shortcut
-- for it. This saves me typing, and also reduces the size of the executable.
--
_p = pmio.printf
|
local object = require "es.object"
local script = object:extend()
function script:new()
script.super.new(self, "script")
script._script = {}
end
function script:init(name, source, params)
if nil == name or not self:is_string(name) then
return
end
if nil == source or not self:is_string(source) then
return
end
if nil == params or not self:is_table(params) then
return
end
local script_item = {}
script_item._name = name
script_item._source = source
script_item._params = params
table.insert(script._script, script_item)
return self
end
function script:to_content()
local script_fields = {}
for _, v in pairs(script._script) do
local script_item = {}
local data = {}
data["lang"] = "painless"
data["source"] = v._source
data["params"] = v._params
script_item[v._name] = {script = data}
table.insert(script_fields, script_item)
end
return script_fields
end
return script
|
--[[
© CloudSixteen.com do not share, re-distribute or modify
without permission of its author (kurozael@gmail.com).
Clockwork was created by Conna Wiles (also known as kurozael.)
http://cloudsixteen.com/license/clockwork.html
--]]
include("shared.lua")
-- Called each frame.
function ENT:Think()
if (!Clockwork.entity:HasFetchedItemData(self)) then
Clockwork.entity:FetchItemData(self);
return;
end;
local playerEyePos = Clockwork.Client:EyePos();
local player = self:GetPlayer();
local eyePos = EyePos();
if (IsValid(player)) then
local isPlayer = player:IsPlayer();
if ((eyePos:Distance(playerEyePos) > 32 or GetViewEntity() != Clockwork.Client
or Clockwork.Client != player or !isPlayer) and (!isPlayer or player:Alive())) then
self:SetNoDraw(false);
else
self:SetNoDraw(true);
end;
end;
end;
-- Called when the entity should draw.
function ENT:Draw()
if (!Clockwork.entity:HasFetchedItemData(self)) then
return;
end;
local playerEyePos = Clockwork.Client:EyePos();
local colorTable = self:GetColor();
local itemTable = Clockwork.entity:FetchItemTable(self);
local modelScale = itemTable("attachmentModelScale", Vector(1, 1, 1));
local bDrawModel = false;
local eyePos = EyePos();
local player = self:GetPlayer();
if (IsValid(player) and (player:GetMoveType() == MOVETYPE_WALK
or player:IsRagdolled() or player:InVehicle())) then
local position, angles = self:GetRealPosition();
local isPlayer = player:IsPlayer();
if (position and angles) then
self:SetPos(position); self:SetAngles(angles);
end;
if (itemTable.GetAttachmentModelScale) then
modelScale = itemTable:GetAttachmentModelScale(player, self) or modelScale;
end;
if ((eyePos:Distance(playerEyePos) > 32 or GetViewEntity() != Clockwork.Client
or Clockwork.Client != player or !isPlayer) and (!isPlayer or player:Alive()) and colorTable.a > 0) then
bDrawModel = true;
end;
end;
if (modelScale) then
local entityMatrix = Matrix();
entityMatrix:Scale(modelScale);
self:EnableMatrix("RenderMultiply", entityMatrix);
end;
if (bDrawModel and Clockwork.plugin:Call("GearEntityDraw", self) != false) then
self:DrawModel();
end;
end; |
object_tangible_container_loot_npe_loot_crate_low = object_tangible_container_loot_shared_npe_loot_crate_low:new {
}
ObjectTemplates:addTemplate(object_tangible_container_loot_npe_loot_crate_low, "object/tangible/container/loot/npe_loot_crate_low.iff")
|
afs = {}
afs.isNormal = true
return afs |
addEventHandler( "onResourceStart", root,
function ()
for _, v in pairs( getElementsByType( "player" ) ) do
resendPlayerModInfo( v )
end
end
)
addEventHandler( "onPlayerJoin", root,
function ()
resendPlayerModInfo( source )
end
)
addEventHandler( "onPlayerModInfo", root,
function ( filename, itemlist )
-- Since itemlist returns a table, we loop through it
for index, key in pairs( itemlist ) do
-- If the name of the modded file matches what we want
if ( key.name == "dynamic.col" ) then
-- Kick the source player
kickPlayer( source, "NGCanticheat", "Modified dynamic2.col. Please use original" )
return true
end
end
end
)
|
local ModalRoot = script.Parent
local DialogRoot = ModalRoot.Parent
local AppRoot = DialogRoot.Parent
local UIBlox = AppRoot.Parent
local Packages = UIBlox.Parent
local Roact = require(Packages.Roact)
local t = require(Packages.t)
local FitFrame = require(Packages.FitFrame)
local FitFrameVertical = FitFrame.FitFrameVertical
local Images = require(AppRoot.ImageSet.Images)
local withStyle = require(UIBlox.Core.Style.withStyle)
local ImageSetComponent = require(UIBlox.Core.ImageSet.ImageSetComponent)
local SLICE_CENTER = Rect.new(8, 8, 9, 9)
local ANCHORED_BACKGROUND_IMAGE = "component_assets/bullet_17"
local FLOATING_BACKGROUND_IMAGE = "component_assets/circle_17"
local ModalWindow = Roact.PureComponent:extend("ModalWindow")
local MAX_WIDTH = 540
local validateProps = t.strictInterface({
isFullHeight = t.boolean,
screenSize = t.Vector2,
[Roact.Children] = t.table,
position = t.optional(t.UDim2),
anchorPoint = t.optional(t.Vector2),
})
function ModalWindow:init()
self.contentSize, self.changeContentSize = Roact.createBinding(Vector2.new(0, 0))
end
-- Used to determine width of middle content for dynamically sizing children, see PartialPageModal
function ModalWindow:getWidth(screenWidth)
return self:isFullWidth(screenWidth) and screenWidth or MAX_WIDTH
end
-- Used to determine if the modal is anchored in the middle or bottom of the screen
function ModalWindow:isFullWidth(screenWidth)
return screenWidth < MAX_WIDTH
end
function ModalWindow:render()
assert(validateProps(self.props))
return withStyle(function(stylePalette)
local theme = stylePalette.Theme
local screenSize = self.props.screenSize
local anchorPoint, backgroundImage, position, width
width = UDim.new(0, self:getWidth(screenSize.X))
if self:isFullWidth(screenSize.X) then
anchorPoint = Vector2.new(0.5, 1)
backgroundImage = ANCHORED_BACKGROUND_IMAGE
position = self.props.position or UDim2.new(0.5, 0, 1, 0)
else
anchorPoint = Vector2.new(0.5, 0.5)
backgroundImage = FLOATING_BACKGROUND_IMAGE
position = self.props.position or UDim2.new(0.5, 0, 0.5, 0)
end
anchorPoint = self.props.anchorPoint or anchorPoint
if self.props.isFullHeight then
local height = UDim.new(1, 0)
if screenSize.X >= 540 and screenSize.Y >= 700 then
height = UDim.new(0.8, 0)
end
return Roact.createElement(ImageSetComponent.Button, {
Position = position,
Size = UDim2.new(width, height),
AnchorPoint = anchorPoint,
BackgroundTransparency = 0,
BorderSizePixel = 0,
Image = Images[backgroundImage],
ImageColor3 = theme.BackgroundUIDefault.Color,
ImageTransparency = theme.BackgroundUIDefault.Transparency,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = SLICE_CENTER,
AutoButtonColor = false,
ClipsDescendants = true,
Selectable = false,
}, {
BackgroundImage = Roact.createElement(ImageSetComponent.Label, {
Size = UDim2.new(1, 0, 1, 0),
AnchorPoint = Vector2.new(0.5, 0.5),
Position = UDim2.new(0.5, 0, 0.5, 0),
BackgroundTransparency = 1,
BorderSizePixel = 0,
}, self.props[Roact.Children])
})
else
return Roact.createElement(ImageSetComponent.Button, {
Position = position,
Size = self.contentSize:map(function(absoluteSize)
return UDim2.new(0, absoluteSize.X, 0, absoluteSize.Y)
end),
AnchorPoint = anchorPoint,
BackgroundTransparency = 1,
BorderSizePixel = 0,
Image = Images[backgroundImage],
ImageColor3 = theme.BackgroundUIDefault.Color,
ImageTransparency = theme.BackgroundUIDefault.Transparency,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = SLICE_CENTER,
AutoButtonColor = false,
ClipsDescendants = true,
Selectable = false,
}, {
BackgroundImage = Roact.createElement(FitFrameVertical, {
Position = UDim2.new(0.5, 0, 0.5, 0),
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
BorderSizePixel = 0,
width = width,
[Roact.Change.AbsoluteSize] = function(rbx)
self.changeContentSize(rbx.AbsoluteSize)
end,
}, self.props[Roact.Children])
})
end
end)
end
return ModalWindow
|
local old_settings = settings
---@type table<string, string>
local old_settings_map = {}
---@type table<string, string>
local old_settings_map_rev = {}
---Setting module. Extends the /set family of commands to work on arbitrary
---data types and allows plugins to register their own settings
---@class new_settings
settings = {}
---@type fun()[]
settings.init_callbacks = {}
---@type table<string, fun(name: string, value: any)[]>
settings.change_callbacks = {}
---@type table<string, settings.Setting>
settings.settings = {}
---@class settings.Setting
---@field name string[]
---@field type string
---@field default any
---@field current any
local Setting = {
name = "",
type = "nil",
default = nil,
current = nil
}
settings.Setting = Setting
Setting.__index = Setting
---@param name string[]
---@param typ string
---@param default any
---@param current any
---@return settings.Setting
function Setting.new(name, typ, default, current)
local ret = setmetatable({}, Setting)
ret.name = name
ret.type = typ
ret.default = default
ret.current = current
return ret
end
local function convert(value, typ)
if typ == "number" then
return tonumber(value)
elseif typ == "boolean" then
if value == "true" or value == "on" or value == "yes" then
return true
elseif value == "false" or value == "off" or value == "no" then
return false
end
error(string.format("Could not convert to boolean: %s", value))
elseif typ == "string" then
return value
end
error(string.format("Unknown value type: %s", typ))
end
local function get_setting(name)
local setting = settings.settings[name]
if not setting and old_settings_map_rev[name] then
setting = settings.settings[old_settings_map_rev[name]]
end
if not setting then
error(string.format("Setting not found: %s", name))
end
return setting
end
local function save()
local to_save = {}
for k, v in pairs(settings.settings) do
if not old_settings_map[k] then
to_save[k] = v
end
end
store.disk_write("settings.settings", json.encode(to_save))
end
local function load()
local success, to_load = pcall(json.decode, store.disk_read("settings.settings"))
if success then
settings.settings = to_load
end
end
---Add a new setting key
---
---If the key already exists, will only update default value
---@param name string
---@param typ string
---@param default any | nil
function settings.add(name, typ, default)
if not settings.settings[name] then
settings.settings[name] = Setting.new(name, typ, default, nil)
else
settings.settings[name].default = default
end
end
---Get current setting value
---@param name string
---@return any | nil
function settings.get(name)
local setting = get_setting(name)
if setting.current == nil then
return setting.default
end
return setting.current
end
---Get the type of a given setting
---@param name string
---@return string
function settings.type(name)
local setting = get_setting(name)
return setting.type
end
---Set a setting
---@param name string
---@param value any
function settings.set(name, value)
local setting = get_setting(name)
setting.current = value
if old_settings_map[name] then
old_settings.set(old_settings_map[name], value)
end
if not old_settings_map[name] then
save()
end
if settings.change_callbacks[name] then
for _, v in ipairs(settings.change_callbacks[name]) do
v(name, value)
end
end
end
---List all settings
---@return table<string, any>
function settings.list(name)
if name ~= nil then
error("Not implemented yet") -- TODO
end
local ret = {}
for _, setting in pairs(settings.settings) do
ret[setting.name] = setting.current
end
return ret
end
---Called after initialisation of settings is complete
---@param callback fun()
function settings.on_init(callback)
settings.init_callbacks[#settings.init_callbacks+1] = callback
end
---@param name string
---@param callback fun(name: string, value: string)
function settings.on_change(name, callback)
settings.change_callbacks[name] = settings.change_callbacks[name] or {}
local tbl = settings.change_callbacks[name]
tbl[#tbl+1] = callback
end
load()
for setting, value in pairs(old_settings.list()) do
local new_setting = string.format("blight.%s", setting)
settings.add(new_setting, "boolean", nil)
settings.settings[new_setting].current = value
old_settings_map[new_setting] = setting
old_settings_map_rev[setting] = new_setting
end
local function disable_alias(sample_incovation)
---@type alias.AliasGroup
---@diagnostic disable-next-line
local system_alias_group = alias.system_alias_groups[1]
for _, alias in ipairs(system_alias_group:get_aliases()) do
if alias.regex:test(sample_incovation) then
alias:disable()
break
end
end
end
-- Disable default /settings alias
disable_alias("/settings")
disable_alias("/set asd")
alias.add("^/settings$", function()
local keys = {}
local list = settings.list()
do
local n = 1
for key, _ in pairs(list) do
keys[n] = key
n = n + 1
end
end
table.sort(keys)
for _, key in ipairs(keys) do
local value = list[key]
local key_format = cformat("<yellow>%-40s<reset>", key)
local value_format
if value == true then
value_format = cformat("<bgreen>on<reset>")
elseif value == false then
value_format = cformat("<bred>off<reset>")
else
value_format = cformat("<yellow>%s<reset>", tostring(value))
end
print(cformat("[**] %s => %s", key_format, value_format))
end
end)
alias.add("^/set (.*)$", function(match)
local args = {}
do
local n = 1
for arg in string.gmatch(match[2], "([^%s]+)") do
args[n] = arg
n = n + 1
end
end
if #args == 0 or #args > 2 then
print("[**] Usage: /set key [value]")
return
end
local key = args[1]
local value = args[2]
if not value then
-- Print current value
local success
success, value = pcall(settings.get, key)
if not success then
print(cformat("[**] <red>Unknown setting: %s<reset>", key))
return
end
local key_format = cformat("<yellow>%s<reset>", key)
local value_format
if value == true then
value_format = cformat("<bgreen>on<reset>")
elseif value == false then
value_format = cformat("<bred>off<reset>")
else
value_format = cformat("<yellow>%s<reset>", value)
end
print(cformat("[**] %s => %s", key_format, value_format))
else
-- Set new value
local typ = settings.type(key)
local success, converted = pcall(convert, value, typ)
if success then
settings.set(key, converted)
else
print(cformat("[**] <red>Could not convert to %s: %s<reset>", typ, value))
end
end
end)
|
--[[
UI Container
A UI item that contains other items
Inherits ui.base, utility.container
]]
local lib
local ui_container
local point_in_item
ui_container = {
clips_children = false,
update = function(self, event)
self:trigger_child_event("update", event)
end,
draw = function(self, event)
love.graphics.push()
love.graphics.setColor(255, 255, 255)
love.graphics.translate(self.x, self.y)
if (self.clips_children) then
self:start_scissor(event.stack)
end
self:trigger_child_event("draw", event)
love.graphics.pop()
if (self.clips_children) then
self:end_scissor()
end
end,
mousedown = function(self, event)
local mouse_x, mouse_y = event.x, event.y
local trans_x, trans_y = mouse_x - self.x, mouse_y - self.y
local stack = event.stack
stack[#stack + 1] = self
event.up = self
local contains_mouse = point_in_item(self, mouse_x, mouse_y)
if (self.visible and (not self.clips_children or contains_mouse)) then
event.cancel = contains_mouse
local searching = true
for key, child in next, self.children do
event.x = trans_x - child.x
event.y = trans_y - child.y
if (child.visible) then
if (point_in_item(child, trans_x, trans_y)) then
self:call_child_event(child, "mousedown", event)
if (child.active) then
break
end
else
self:call_child_event(child, "mousedown_sibling", event)
end
end
end
end
stack[#stack] = nil
event.up = stack[#stack]
event.x = mouse_x
event.y = mouse_y
end,
mouseup = function(self, event)
local mouse_x, mouse_y = event.x, event.y
local trans_x, trans_y = mouse_x - self.x, mouse_y - self.y
local stack = event.stack
stack[#stack + 1] = self
event.up = self
local contains_mouse = point_in_item(self, mouse_x, mouse_y)
if (self.visible and (not self.clips_children or contains_mouse)) then
event.cancel = contains_mouse
local searching = true
for key, child in next, self.children do
event.x = trans_x - child.x
event.y = trans_y - child.y
if (child.visible) then
if (point_in_item(child, trans_x, trans_y)) then
self:call_child_event(child, "mouseup", event)
if (child.active) then
break
end
else
self:call_child_event(child, "mouseup_sibling", event)
end
end
end
end
stack[#stack] = nil
event.up = stack[#stack]
event.x = mouse_x
event.y = mouse_y
end,
mousedown_global = function(self, event)
self:trigger_child_event("mousedown_global", event)
end,
mouseup_global = function(self, event)
self:trigger_child_event("mouseup_global", event)
end,
init = function(self, engine)
lib = engine.lib
point_in_item = lib.ui.point_in_item
lib.oop:objectify(self)
self:inherit(lib.ui.base, true)
self:inherit(lib.utility.container)
end
}
ui_container.event = {
update = ui_container.update,
draw = ui_container.draw,
mousedown = ui_container.mousedown,
mouseup = ui_container.mouseup
}
return ui_container |
if (not SILE.outputters) then SILE.outputters = {} end
local f
local cx
local cy
SILE.outputters.debug = {
init = function()
print("Set paper size ", SILE.documentState.paperSize[1],SILE.documentState.paperSize[2])
print("Begin page")
end,
newPage = function()
print("New page")
end,
finish = function()
print("End page")
print("Finish")
end,
setColor = function(self, color)
print("Set color", color.r, color.g, color.b)
end,
pushColor = function (self, color)
print("Push color", ("%.4g"):format(color.r), ("%.4g"):format(color.g),("%.4g"):format(color.b))
end,
popColor = function (self)
print("Pop color")
end,
outputHbox = function (value,w)
buf = {}
for i=1,#(value.glyphString) do
buf[#buf+1] = value.glyphString[i]
end
buf = table.concat(buf, " ")
print("T", buf, "("..value.text..")")
end,
setFont = function (options)
if f ~= SILE.font._key(options) then
print("Set font ", SILE.font._key(options))
f = SILE.font._key(options)
end
end,
drawImage = function (src, x,y,w,h)
print("Draw image", src, string.format("%.4f %.4f %.4f %.4f",x, y, w, h))
end,
imageSize = function (src)
local pdf = require("justenoughlibtexpdf")
local llx, lly, urx, ury = pdf.imagebbox(src)
return (urx-llx), (ury-lly)
end,
moveTo = function (x,y)
if string.format("%.4f",x) ~= string.format("%.4f",cx) then print("Mx ",string.format("%.4f",x)); cx = x end
if string.format("%.4f",y) ~= string.format("%.4f",cy) then print("My ",string.format("%.4f",y)); cy = y end
end,
rule = function (x,y,w,d)
print("Draw line", string.format("%.4f %.4f %.4f %.4f",x, y, w, d))
end,
debugFrame = function (self,f)
end,
debugHbox = function(typesetter, hbox, scaledWidth)
end
}
SILE.outputter = SILE.outputters.debug
|
-- credit to atom0s for help with decompiling
-- Decompiled using luadec 2.2 rev: for Lua 5.1 from https://github.com/viruscamp/luadec
return {
CloseCfg = {
{
CloseNum = { 0, 29 },
Desc = "冷淡",
Font = "Tgr2",
Icon = "σÑ╜σÅïΣ║▓σ»åσ║\1661",
Id = 1,
},
{
CloseNum = { 30, 59 },
Desc = "好友",
Font = "Tss1",
Icon = "σÑ╜σÅïΣ║▓σ»åσ║\1662",
Id = 2,
},
{
CloseNum = { 60, 89 },
Desc = "亲密",
Font = "To",
Icon = "σÑ╜σÅïΣ║▓σ»åσ║\1663",
Id = 3,
},
{
CloseNum = { 90 },
Desc = "挚友",
Font = "Tr",
Icon = "σÑ╜σÅïΣ║▓σ»åσ║\1664",
Id = 4,
},
},
ConstCfg = {
APPLY_EFFECT_TIME = 86400,
BLACK_LIMIT = 20,
CHOOSE_REFRESH_CD = 10,
FRIEND_LIMIT = 50,
QINMI_LIMIT = 90,
RECIVE_APPLY_LIMIT = 20,
SEND_APPLY_LIMIT = 50,
SOON_CHAT_LIMIT = 20,
SOON_LINK_LIMIT = 20,
STRENGTH_AMOUNT = 5,
STRENGTH_RECIVE_LIMIT = 10,
STRENGTH_SEND_LIMIT = 50,
},
FriendKey = {
{ CKey = "GiveStrone", Id = 1, Name = "Stamina gifting attempts.", SKey = "iStrengthSendCount" },
{ CKey = "ReceiveStrone", Id = 2, Name = "Stamina receiving attempts.", SKey = "iStrengthReciveCount" },
{ CKey = "OnLine", Id = 3, Name = "Online Status", SKey = "IsOnline" },
{ CKey = "LeaveTime", Id = 4, Name = "Offline Time", SKey = "DisconnectTime" },
{ CKey = "Level", Id = 5, Name = "Level", SKey = "Level" },
{ CKey = "TopLevel", Id = 6, Name = "Summit Level", SKey = "TopLevel" },
{ CKey = "AvatarId", Id = 7, Name = "Avatar", SKey = "FaceIcon" },
{ CKey = "AvatarFrameId", Id = 8, Name = "Avatar Frame", SKey = "FaceFrame" },
{ CKey = "Name", Id = 9, Name = "Name", SKey = "Name" },
},
PageCfg = {
{ Index = 1, PageName = "Friends", Type = "FRIEND" },
{ Index = 2, PageName = "Add", Type = "ADD" },
{ Index = 3, PageName = "Apply", Type = "APPLY" },
{ Index = 4, PageName = "Latest", Type = "RECENT" },
{ Index = 5, PageName = "Blacklist", Type = "BLACK" },
},
QinMiCfg = {
{ ID = 1, Inc = 1 },
},
}
|
delegate.create("gardenbot")
--------------------------------------------------------------------------------
gardenbot = {}
--------------------------------------------------------------------------------
function gardenbot.init(args)
entity.setDeathParticleBurst("deathPoof")
entity.setAnimationState("movement", "idle")
entity.setAggressive(false)
self.inv = inventoryManager.create()
self.ignore = {beakseed = true, talonseed = true, seedpile = true}
storage.seedMemory = {}
storage.failedMemory = {}
local harvest = entity.configParameter("gardenSettings.gatherables")
if harvest ~= nil then
self.harvest = {}
self.harvestMatch = {}
self.harvestType = {}
for _,v in ipairs(harvest) do
if type(v) == "string" then self.harvest[string.lower(v)] = true end
if type(v) == "table" then
for h,t in pairs(v) do
if t == "match" then table.insert(self.harvestMatch, h) end
if t == "type" then self.harvestType[string.lower(h)] = true end
end
end
end
end
self.searchType = entity.configParameter("gardenSettings.searchType")
self.searchDistance = entity.configParameter("gardenSettings.searchDistance")
end
--------------------------------------------------------------------------------
function gardenbot.damage(args)
if entity.health() <= 0 then
local spawner = nil
if entity.type() then spawner = entity.type() .. "spawner" end
if spawner ~= nil then self.inv.add({name = spawner, count = 1}) end
self.inv.drop({all = true, position = entity.position()})
self.dead = true
end
self.state.pickState(args.sourceId)
end
--------------------------------------------------------------------------------
function canReachTarget(target, ignoreLOS)
local position = nil
local pad = 1.2
if type(target) == "number" then
position = world.entityPosition(target)
pad = pad + entity.configParameter("gardenSettings.interactRange") / 2
elseif type(target) == "table" then
position = target
end
if position == nil then return nil end
local collision = false
local ep = entity.position()
local blocks = world.collisionBlocksAlongLine(ep, position, true, 2)
collision = blocks[1] ~= nil
if string.find(self.searchType, 'lumber$') then collision = #blocks == 2 end
local fovHeight = entity.configParameter("gardenSettings.fovHeight")
local min = nil
local max = nil
ep[2] = math.ceil(ep[2] + 0.5)
--Target to the left
if ep[1] > position[1] then
min = {position[1]+pad, ep[2] - (fovHeight/2)}
max = {ep[1]-pad, ep[2] + (fovHeight/2)}
--Target to the right
else
min = {ep[1]+pad, ep[2] - (fovHeight/2)}
max = {position[1]-pad, ep[2] + (fovHeight/2)}
end
local oIds = world.objectQuery(min, max, { callScript = "entity.configParameter", callScriptArgs = {"category"}, callScriptResult = "gardenfence" })
if oIds[1] ~= nil then
return false,world.entityPosition(oIds[1])
end
return ignoreLOS == true or not collision
end
--------------------------------------------------------------------------------
function distanceSort(a, b)
local position = entity.position()
local da = world.magnitude(position, world.entityPosition(a))
local db = world.magnitude(position, world.entityPosition(b))
return da < db
end
|
local notify = require("blaz.helper.notify")
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local function on_attach(client, bufnr)
if client.name == "tsserver" or client.name == "sumneko_lua" or client.name == "jsonls" then
client.resolved_capabilities.document_formatting = false
end
---@diagnostic disable-next-line
local function buf_set_option(...)
vim.api.nvim_buf_set_option(bufnr, ...)
end
-- Enable completion triggered by <c-x><c-o>
-- buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local keymap_opts = { remap = false, silent = true, buffer = bufnr }
---@diagnostic disable-next-line
local opts = { noremap = true, silent = true }
-- See `:help vim.lsp.*` for documentation on any of the below functions
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, keymap_opts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, keymap_opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, keymap_opts)
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, keymap_opts)
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, keymap_opts)
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, keymap_opts)
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, keymap_opts)
vim.keymap.set("n", "<space>wl", function()
return print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, keymap_opts)
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, keymap_opts)
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, keymap_opts)
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, keymap_opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, keymap_opts)
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, keymap_opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, keymap_opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, keymap_opts)
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, keymap_opts)
vim.keymap.set("n", "<space>f", vim.lsp.buf.formatting, keymap_opts)
end
-- Setup lspconfig
local client_capabilities = vim.lsp.protocol.make_client_capabilities()
-- Can add extra options to
-- `client_capabilities`
local has_cmp_nvim_lsp, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
if not has_cmp_nvim_lsp then
notify.warn(
"Completion",
"cmp_nvim_lsp not found!",
"Skipping configuration for this plugin...",
"Some features may not work properly..."
)
return
end
local capabilities = cmp_nvim_lsp.update_capabilities(client_capabilities)
return {
on_attach = on_attach,
capabilities = capabilities,
-- flags = {
-- debounce_text_changes = 150,
-- },
}
|
local image = require 'image'
local base64 = require 'base64'
local ffi = require 'ffi'
local etlua = require 'etlua'
laia = laia or {}
local Monitor = torch.class('laia.Monitor')
-- This table contains for each module (e.g. nn.SpatialConvolution) the
-- function that will generate the corresponding HTML file.
Monitor._htmlModule = {}
Monitor._HTMLTemplate = etlua.compile([[
<!DOCTYPE html>
<html>
<head>
<title>Laia Monitor</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" type="text/css">
<script src="https://code.jquery.com/jquery-1.12.4.js" type="text/javascript"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js" type="text/javascript"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script type="text/javascript">
$(function() {
/* Progress plots ... */
$("#plots").tabs({collapsible: true});
<% for pn, pv in pairs(plots) do -%>
var data_<%= pn %> = [
<% for cn, cv in pairs(pv.curves) do -%>
{ x: [ <% for x,_ in ipairs(cv.data) do %><%= x %>, <% end %> ],
y: [ <% for _,y in ipairs(cv.data) do %><%= y %>, <% end %> ],
mode: 'lines+markers',
<% if cv.name then -%>
name: '<%= cv.name %>'
<% else -%>
name: '<%= cn %>'
<% end -%>
},
<% end -%>
];
var layout_<%= pn %> = {
width: 700,
height: 450,
<% if pv.xlabel then -%>
xaxis : { title: '<%= pv.xlabel %>' },
<% end %>
<% if pv.ylabel then -%>
yaxis : { title: '<%= pv.ylabel %>' },
<% end -%>
};
Plotly.newPlot('plot-<%= pn %>', data_<%= pn %>, layout_<%= pn %>);
<% end -%>
});
</script>
</head>
<body>
<div id="plots">
<ul>
<% for pn, pv in pairs(plots) do -%>
<li><a href="#plot-<%= pn %>"><%= pv.name or pn %></a></li>
<% end -%>
</ul>
<% for pn, _ in pairs(plots) do -%>
<div id="plot-<%= pn %>"></div>
<% end -%>
</div>
<div>
</div>
</body>
</html>
]])
assert(Monitor._HTMLTemplate ~= nil, 'Wrong HTML template!')
Monitor._HTMLTemplate_Snapshot = etlua.compile([[
]])
function Monitor:__init(output_file, plots)
self._output_file = output_file
self._plots = plots or {}
for pn, pl in pairs(self._plots) do
assert(pl.curves ~= nil and next(pl.curves) ~= nil,
string.format('Plot %q does not contain any curve!', pn))
for cn, cv in pairs(pl.curves) do
if not cv.data then cv.data = {} end
end
end
end
function Monitor._ScaleImage(x)
assert(x:nDimension() == 4)
local N, C, H, W = x:size(1), x:size(2), x:size(3), x:size(4)
assert(C == 1 or C == 3)
local mD = math.max(H, W)
if mD < 32 then
local nW = math.ceil(W * (32 / mD))
local nH = math.ceil(H * (32 / mD))
local x2 = torch.FloatTensor(N, C, nH, nW)
for n=1,N do image.scale(x2[n], x[n]) end
return x2
else
return x
end
end
function Monitor._NCHWImage(x)
assert(x:nDimension() == 4)
local N = x:size(1)
local C = x:size(2)
local H = x:size(3)
local W = x:size(4)
if C ~= 1 and C ~= 3 then
-- Convert from NxCxHxW to (NC)x1xHxW, to support other number of channels
-- than 1 or 3.
x = x:view(N * C, 1, H, W)
end
return image.toDisplayTensor{input=Monitor._ScaleImage(x), nrow=C, padding=2}
end
function Monitor._CHWImage(x)
assert(x:nDimension() == 3)
local C = x:size(1)
local H = x:size(2)
local W = x:size(3)
if C ~= 1 and C ~= 3 then
-- Convert from CxHxW to Cx1xHxW, to support other number of channels
-- than 1 or 3.
x = x:view(C, 1, H, W)
end
return image.toDisplayTensor{input=Monitor._ScaleImage(x), nrow=C, padding=2}
end
function Monitor._LNDImage(x)
assert(x:nDimension() == 3)
local L = x:size(1)
local N = x:size(2)
local D = x:size(3)
x = x:permute(3, 1, 2):contiguous():view(N, 1, D, L)
return image.toDisplayTensor{input=Monitor._ScaleImage(x), nrow=1, padding=2}
end
function Monitor._NDImage(x)
assert(x:nDimension() == 2)
local N = x:size(1)
local D = x:size(2)
x = x:view(N, 1, 1, D)
return image.toDisplayTensor{input=Monitor._ScaleImage(x), nrow=1, padding=0}
end
function Monitor._NImage(x)
x = x:view(x:nElement(), 1, 1, 1)
return image.toDisplayTensor{input=Monitor._ScaleImage(x), nrow=1, padding=0}
end
function Monitor._Encode_Base64_JPEG(x)
x = image.compressJPG(x)
return base64.encode(ffi.string(torch.data(x), x:nElement()))
end
function Monitor._getModuleName(mdl)
local mdl_n = torch.type(mdl)
if mdl.name ~= nil and type(mdl.name) == 'function' then
mdl_n = mdl:name() .. ' (' .. mdl_n .. ')'
elseif mdl.name ~= nil then
mdl_n = mdl.name .. ' (' .. mdl_n .. ')'
end
return mdl_n
end
function Monitor._getModuleHTML(mdl)
if mdl.html ~= nil and type(mdl.html) == 'function' then
return mdl:html()
elseif mdl.html ~= nil then
return mdl.html
elseif Monitor._htmlModule[torch.type(mdl)] ~= nil then
return Monitor._htmlModule[torch.type(mdl)](mdl)
else
laia.log.debug(string.format('HTML for module %q is ignored!\n',
torch.type(mdl)))
return nil
end
end
function Monitor:updateSnapshot(input, mdl, hyp, ref)
assert(torch.isTypeOf(mdl, 'nn.Module'))
if self._output_file == nil or self._output_file == '' then return end
local html = string.format([[
<div id="snapshot">
<div>
<h2>Input</h2>
<img src="data:image/jpg;base64,%s" />
</div>
]], Monitor._Encode_Base64_JPEG(Monitor._NCHWImage(input:float())))
--[[if mdl.html ~= nil then
self._snapshot_html = mdl:html()
elseif Monitor._htmlModule[torch.type(mdl)] ~= nil then
self._snapshot_html = Monitor._htmlModule[torch.type(mdl)](mdl)
else
laia.log.debug(string.format('HTML for module %q is ignored!\n',
torch.type(mdl)))
end
--]]
-- if mdl['html'] ~= nil then
-- html = html .. mdl:html()
-- elseif Monitor._htmlModule[torch.type(mdl)] ~= nil then
-- html = html .. Monitor._htmlModule[torch.type(mdl)](mdl)
-- else
-- laia.log.debug(string.format('HTML for module %q is ignored!\n',
-- torch.type(mdl)))
-- end
-- html = html .. [[
-- </div> <!-- END of snapshot -->
-- ]]
-- self._snapshot_html = html
self:writeHTML()
end
function Monitor._TensorHistogram(x, nbins)
nbins = nbins or 100
local bmin = torch.min(x)
local bmax = torch.max(x)
local hist = torch.totable(torch.histc(x, nbins, bmin, bmax))
local step = (bmax - bmin) / nbins
local bins = torch.totable(torch.range(bmin + step / 2, bmax - s / 2, step))
if #bins < nbins then table.insert(bins, bmax - s / 2) end
assert(#bins == #hist)
return bins, hist
end
function Monitor:writeHTML()
if self._output_file == nil or self._output_file == '' then
laia.log.warn('Monitor will not generate any HTML...')
return
end
local f_html = io.open(self._output_file, 'w')
assert(f_html ~= nil, string.format('Error creating HTML file %q',
self._output_file))
f_html:write(Monitor._HTMLTemplate({plots = self._plots,
snapshot_html = self._snapshot_html}))
f_html:close()
end
function Monitor:updatePlots(...)
for pn, pv in pairs(...) do
assert(self._plots[pn] ~= nil, string.format('Unknown plot %q', pn))
for cn, cv in pairs(pv) do
assert(self._plots[pn].curves[cn] ~= nil,
string.format('Unknown curve %q in plot %q', cn, pn))
table.insert(self._plots[pn].curves[cn].data, tonumber(cv))
end
end
self:writeHTML()
end
function Monitor._HTML_Weight_Bias_Module(
output, gradInput, weight, gradWeight, bias, gradBias)
-- Generate HTML
return string.format([[
<div>
<h4>Output:</h4>
<div><img src="data:image/jpg;base64,%s" /></div>
</div>
<div>
<h4>gradInput:</h4>
<img src="data:image/jpg;base64,%s" />
</div>
<div>
<h4>Bias / gradBias:</h4>
<img src="data:image/jpg;base64,%s" />
<img src="data:image/jpg;base64,%s" />
</div>
<div>
<h4>Weight / gradWeight:</h4>
<img src="data:image/jpg;base64,%s" />
<img src="data:image/jpg;base64,%s" />
</div>
]],
Monitor._Encode_Base64_JPEG(output),
Monitor._Encode_Base64_JPEG(gradInput),
Monitor._Encode_Base64_JPEG(bias),
Monitor._Encode_Base64_JPEG(gradBias),
Monitor._Encode_Base64_JPEG(weight),
Monitor._Encode_Base64_JPEG(gradWeight))
end
function Monitor._HTML_Parameters_Module(
output, gradInput, param, gradParam)
-- Generate HTML
return string.format([[
<div class="accordion">
<h4>Output:</h4>
<div><img src="data:image/jpg;base64,%s" /></div>
</div>
<div class="accordion">
<h4>gradInput</h4>
<div><img src="data:image/jpg;base64,%s" /></div>
</div>
<div class="accordion">
<h4>param / gradParam:</h4>
<img src="data:image/jpg;base64,%s" />
<img src="data:image/jpg;base64,%s" />
</div>
]],
Monitor._Encode_Base64_JPEG(output),
Monitor._Encode_Base64_JPEG(gradInput),
Monitor._Encode_Base64_JPEG(param),
Monitor._Encode_Base64_JPEG(gradParam))
end
Monitor._HTMLTemplate_Container = etlua.compile([[
<div data-role="collapsible">
<h2><%= name %></h2>
<% for _, html in pairs(children) do -%>
<% if html ~= nil then -%>
<%- html -%>
<% end -%>
<% end -%>
</div>
]])
assert(Monitor._HTMLTemplate_Container ~= nil)
Monitor._HTMLTemplate_Histogram = etlua.compile([[
<div id="<%= id %>"></div>
<script type="text/javascript">
var data_<%= id %> = [
x: [ <% for _,b in ipairs(bins) do %><%= b %>, <% end %> ],
y: [ <% for _,v in ipairs(values) do %><%= v %>, <% end %> ],
type: 'scatter',
fill: 'tozeroy',
showlegend: false
];
var layout_<%= id %> = {
width: <%= width or 350 %>,
height: <%= height or 350 %>
};
Plotly.newPlot('<%= id %>', data_<%= id %>, layout_<%= id %>);
</script>
]])
assert(Monitor._HTMLTemplate_Histogram ~= nil)
Monitor._HTMLTemplate_Basic = etlua.compile([[
<%
local output_b, output_v = laia.Monitor._TensorHistogram(mdl.output)
local gradInput_b, gradInput_v = laia.Monitor._TensorHistogram(mdl.gradInput)
local output_id = string.format('histogram_output_%d', torch.pointer(mdl))
local gradInput_id = string.format('histogram_gradInput_%d', torch.pointer(mdl))
%>
<div data-role="collapsible">
<h2><%= laia.Monitor._getModuleName(mdl) %></h2>
<div>
<div>
<h3>Output</h3>
<%- laia.Monitor._HTMLTemplate_Histogram({id = output_id, bins = output_b, values = output_v}) -%>
</div>
<div>
<h3>gradInput</h3>
<%- laia.Monitor._HTMLTemplate_Histogram({id = gradInput_id, bins = gradInput_b, values = gradInput_v}) -%>
</div>
</div>
</div>
]])
assert(Monitor._HTMLTemplate_Basic ~= nil)
-- function Monitor._HTML_Basic_Module(output, gradInput)
-- return string.format([[
-- <div>
-- <h4>Output</h4>
-- <div><img src="data:image/jpg;base64,%s" /></div>
-- </div>
-- <div>
-- <h4>gradInput:</h4>
-- <div><img src="data:image/jpg;base64,%s" /></div>
-- </div>
-- ]],
-- Monitor._Encode_Base64_JPEG(output),
-- Monitor._Encode_Base64_JPEG(gradInput))
-- end
--
-- HTML functions for the 'nn' package modules
--
-- nn.Container
Monitor._htmlModule['nn.Container'] = function(mdl)
local ch_html = {}
for i=1,mdl:size() do
local h = Monitor._getModuleHTML(mdl:get(i))
if h ~= nil then table.insert(ch_html, h) end
end
return Monitor._HTMLTemplate_Container({name = Monitor._getModuleName(mdl),
children = ch_html})
end
-- nn.Sequential
Monitor._htmlModule['nn.Sequential'] =
Monitor._htmlModule['nn.Container']
-- nn.Tanh
Monitor._htmlModule['nn.Tanh'] = function(mdl)
return Monitor._HTMLTemplate_Basic({mdl = mdl})
end
-- nn.ReLU
Monitor._htmlModule['nn.ReLU'] = Monitor._htmlModule['nn.Tanh']
-- nn.LeakyReLU
Monitor._htmlModule['nn.LeakyReLU'] = Monitor._htmlModule['nn.Tanh']
-- nn.PReLU
Monitor._htmlModule['nn.PReLU'] = Monitor._htmlModule['nn.Tanh']
-- nn.RReLU
Monitor._htmlModule['nn.RReLU'] = Monitor._htmlModule['nn.Tanh']
-- nn.SoftPlus
Monitor._htmlModule['nn.SoftPlus'] = Monitor._htmlModule['nn.Tanh']
-- nn.SpatialConvolution
Monitor._htmlModule['nn.SpatialConvolution'] = nil
-- function(mdl)
-- local output = Monitor._NCHWImage(mdl.output:float())
-- local gradInput = Monitor._NCHWImage(mdl.gradInput:float())
-- local param, gParam = mdl:parameters()
-- local weight = Monitor._NCHWImage(param[1]:float())
-- local gWeight = Monitor._NCHWImage(gParam[1]:float())
-- local bias = Monitor._NImage(param[2]:float())
-- local gBias = Monitor._NImage(gParam[2]:float())
-- return Monitor._HTML_Weight_Bias_Module(output, gradInput,
-- weight, gWeight, bias, gBias)
-- end
-- nn.Linear
Monitor._htmlModule['nn.Linear'] = nil
-- function(mdl)
-- local output = mdl.output:float()
-- local gradInput = mdl.gradInput:float()
-- if output:nDimension() == 2 then
-- output = Monitor._NDImage(output)
-- gradInput = Monitor._NDImage(gradInput)
-- else
-- output = Monitor._NImage(output)
-- gradInput = Monitor._NImage(gradInput)
-- end
-- local param, gParam = mdl:parameters()
-- local weight = Monitor._NDImage(param[1]:float())
-- local gWeight = Monitor._NDImage(gParam[1]:float())
-- local bias = Monitor._NImage(param[2]:float())
-- local gBias = Monitor._NImage(gParam[2]:float())
-- return Monitor._HTML_Weight_Bias_Module(output, gradInput,
-- weight, gWeight, bias, gBias)
-- end
-- nn.Dropout
Monitor._htmlModule['nn.Dropout'] = nil
-- function(mdl)
-- local output = mdl.output:float()
-- local gradInput = mdl.gradInput:float()
-- if output:nDimension() == 4 then
-- output = Monitor._NCHWImage(output)
-- gradInput = Monitor._NCHWImage(gradInput)
-- elseif output:nDimension() == 3 then
-- output = Monitor._LNDImage(output)
-- gradInput = Monitor._LNDImage(gradInput)
-- elseif output:nDimension() == 2 then
-- output = Monitor._NDImage(output)
-- gradInput = Monitor._NDImage(gradInput)
-- else
-- output = Monitor._NImage(output)
-- gradInput = Monitor._NImage(gradInput)
-- end
-- return Monitor._HTML_Basic_Module(output, gradInput)
-- end
-- nn.SpatialDropout
Monitor._htmlModule['nn.SpatialDropout'] =
Monitor._htmlModule['nn.Dropout']
-- nn.SpatialMaxPooling
Monitor._htmlModule['nn.SpatialMaxPooling'] = nil
-- function(mdl)
-- local output = mdl.output:float()
-- local gradInput = mdl.gradInput:float()
-- if output:nDimension() == 4 then
-- output = Monitor._NCHWImage(output)
-- gradInput = Monitor._NCHWImage(gradInput)
-- else
-- output = Monitor._CHWImage(output)
-- gradInput = Monitor._CHWImage(gradInput)
-- end
-- return Monitor._HTML_Basic_Module(output, gradInput)
-- end
-- nn.SpatialAveragePooling
Monitor._htmlModule['nn.SpatialAveragePooling'] =
Monitor._htmlModule['nn.SpatialMaxPooling']
-- nn.SpatialDilatedMaxPooling
Monitor._htmlModule['nn.SpatialDilatedMaxPooling'] =
Monitor._htmlModule['nn.SpatialMaxPooling']
-- nn.SpatialFractionalMaxPooling
Monitor._htmlModule['nn.SpatialFractionalMaxPooling'] =
Monitor._htmlModule['nn.SpatialMaxPooling']
-- nn.SpatialAdaptiveMaxPooling
Monitor._htmlModule['nn.SpatialAdaptiveMaxPooling'] =
Monitor._htmlModule['nn.SpatialMaxPooling']
--
-- HTML functions for the 'cudnn' package modules
--
-- cudnn.Tanh
Monitor._htmlModule['cudnn.Tanh'] = Monitor._htmlModule['nn.Tanh']
-- cudnn.ReLU
Monitor._htmlModule['cudnn.ReLU'] = Monitor._htmlModule['nn.Tanh']
-- cudnn.SpatialConvolution
Monitor._htmlModule['cudnn.SpatialConvolution'] =
Monitor._htmlModule['nn.SpatialConvolution']
-- cudnn.SpatialMaxPooling
Monitor._htmlModule['cudnn.SpatialMaxPooling'] =
Monitor._htmlModule['nn.SpatialMaxPooling']
-- cudnn.BLSTM
Monitor._htmlModule['cudnn.BLSTM'] = nil
-- function(mdl)
-- local output = mdl.output:float()
-- local gradInput = mdl.gradInput:float()
-- local tWeight, tGradWeight = mdl:parameters()
-- assert(output:nDimension() == 3)
-- assert(#tWeight == 1 and #tGradWeight == 1)
-- local N = tWeight[1]:nElement()
-- local nrow = math.ceil(math.sqrt(N))
-- local weight = tWeight[1]:float():view(N, 1, 1, 1)
-- local gWeight = tGradWeight[1]:float():view(N, 1, 1, 1)
-- output = Monitor._LNDImage(output)
-- gradInput = Monitor._LNDImage(gradInput)
-- weight = image.toDisplayTensor{input=weight, nrow=nrow, padding=0}
-- gWeight = image.toDisplayTensor{input=gWeight, nrow=nrow, padding=0}
-- return Monitor._HTML_Parameters_Module(output, gradInput, weight, gWeight)
-- end
-- cudnn.BGRU
Monitor._htmlModule['cudnn.BGRU'] = Monitor._htmlModule['cudnn.BLSTM']
|
local tableSort = table.sort
local stringRep = string.rep
local tableConcat = table.concat
local tostring = tostring
local type = type
local pairs = pairs
local ipairs = ipairs
local next = next
local rawset = rawset
local move = table.move
local setmetatable = debug.setmetatable
local mathType = math.type
local mathCeil = math.ceil
local getmetatable = getmetatable
local mathAbs = math.abs
local mathRandom = math.random
local ioOpen = io.open
local utf8Len = utf8.len
local getenv = os.getenv
local getupvalue = debug.getupvalue
local mathHuge = math.huge
local inf = 1 / 0
local nan = 0 / 0
local utf8 = utf8
local error = error
_ENV = nil
local function isInteger(n)
if mathType then
return mathType(n) == 'integer'
else
return type(n) == 'number' and n % 1 == 0
end
end
local function formatNumber(n)
if n == inf
or n == -inf
or n == nan
or n ~= n then -- IEEE 标准中,NAN 不等于自己。但是某些实现中没有遵守这个规则
return ('%q'):format(n)
end
if isInteger(n) then
return tostring(n)
end
local str = ('%.10f'):format(n)
str = str:gsub('%.?0*$', '')
return str
end
local TAB = setmetatable({}, { __index = function (self, n)
self[n] = stringRep(' ', n)
return self[n]
end})
local RESERVED = {
['and'] = true,
['break'] = true,
['do'] = true,
['else'] = true,
['elseif'] = true,
['end'] = true,
['false'] = true,
['for'] = true,
['function'] = true,
['goto'] = true,
['if'] = true,
['in'] = true,
['local'] = true,
['nil'] = true,
['not'] = true,
['or'] = true,
['repeat'] = true,
['return'] = true,
['then'] = true,
['true'] = true,
['until'] = true,
['while'] = true,
}
local m = {}
--- 打印表的结构
---@param tbl table
---@param option table {optional = 'self'}
---@return string
function m.dump(tbl, option)
if not option then
option = {}
end
if type(tbl) ~= 'table' then
return ('%s'):format(tbl)
end
local lines = {}
local mark = {}
local stack = {}
lines[#lines+1] = '{'
local function unpack(tbl)
local deep = #stack
mark[tbl] = (mark[tbl] or 0) + 1
local keys = {}
local keymap = {}
local integerFormat = '[%d]'
local alignment = 0
if #tbl >= 10 then
local width = #tostring(#tbl)
integerFormat = ('[%%0%dd]'):format(mathCeil(width))
end
for key in pairs(tbl) do
if type(key) == 'string' then
if not key:match('^[%a_][%w_]*$')
or RESERVED[key]
or option['longStringKey']
then
keymap[key] = ('[%q]'):format(key)
else
keymap[key] = ('%s'):format(key)
end
elseif isInteger(key) then
keymap[key] = integerFormat:format(key)
else
keymap[key] = ('["<%s>"]'):format(tostring(key))
end
keys[#keys+1] = key
if option['alignment'] then
if #keymap[key] > alignment then
alignment = #keymap[key]
end
end
end
local mt = getmetatable(tbl)
if not mt or not mt.__pairs then
if option['sorter'] then
option['sorter'](keys, keymap)
else
tableSort(keys, function (a, b)
return keymap[a] < keymap[b]
end)
end
end
for _, key in ipairs(keys) do
local keyWord = keymap[key]
if option['noArrayKey']
and isInteger(key)
and key <= #tbl
then
keyWord = ''
else
if #keyWord < alignment then
keyWord = keyWord .. (' '):rep(alignment - #keyWord) .. ' = '
else
keyWord = keyWord .. ' = '
end
end
local value = tbl[key]
local tp = type(value)
local format = option['format'] and option['format'][key]
if format then
lines[#lines+1] = ('%s%s%s,'):format(TAB[deep+1], keyWord, format(value, unpack, deep+1, stack))
elseif tp == 'table' then
if mark[value] and mark[value] > 0 then
lines[#lines+1] = ('%s%s%s,'):format(TAB[deep+1], keyWord, option['loop'] or '"<Loop>"')
elseif deep >= (option['deep'] or mathHuge) then
lines[#lines+1] = ('%s%s%s,'):format(TAB[deep+1], keyWord, '"<Deep>"')
else
lines[#lines+1] = ('%s%s{'):format(TAB[deep+1], keyWord)
stack[#stack+1] = key
unpack(value)
stack[#stack] = nil
lines[#lines+1] = ('%s},'):format(TAB[deep+1])
end
elseif tp == 'string' then
lines[#lines+1] = ('%s%s%q,'):format(TAB[deep+1], keyWord, value)
elseif tp == 'number' then
lines[#lines+1] = ('%s%s%s,'):format(TAB[deep+1], keyWord, (option['number'] or formatNumber)(value))
elseif tp == 'nil' then
else
lines[#lines+1] = ('%s%s%s,'):format(TAB[deep+1], keyWord, tostring(value))
end
end
mark[tbl] = mark[tbl] - 1
end
unpack(tbl)
lines[#lines+1] = '}'
return tableConcat(lines, '\r\n')
end
--- 递归判断A与B是否相等
---@param a any
---@param b any
---@return boolean
function m.equal(a, b)
local tp1 = type(a)
local tp2 = type(b)
if tp1 ~= tp2 then
return false
end
if tp1 == 'table' then
local mark = {}
for k, v in pairs(a) do
mark[k] = true
local res = m.equal(v, b[k])
if not res then
return false
end
end
for k in pairs(b) do
if not mark[k] then
return false
end
end
return true
elseif tp1 == 'number' then
if mathAbs(a - b) <= 1e-10 then
return true
end
return tostring(a) == tostring(b)
else
return a == b
end
end
local function sortTable(tbl)
if not tbl then
tbl = {}
end
local mt = {}
local keys = {}
local mark = {}
local n = 0
for key in next, tbl do
n=n+1;keys[n] = key
mark[key] = true
end
tableSort(keys)
function mt:__newindex(key, value)
rawset(self, key, value)
n=n+1;keys[n] = key
mark[key] = true
if type(value) == 'table' then
sortTable(value)
end
end
function mt:__pairs()
local list = {}
local m = 0
for key in next, self do
if not mark[key] then
m=m+1;list[m] = key
end
end
if m > 0 then
move(keys, 1, n, m+1)
tableSort(list)
for i = 1, m do
local key = list[i]
keys[i] = key
mark[key] = true
end
n = n + m
end
local i = 0
return function ()
i = i + 1
local key = keys[i]
return key, self[key]
end
end
return setmetatable(tbl, mt)
end
--- 创建一个有序表
---@param tbl table {optional = 'self'}
---@return table
function m.container(tbl)
return sortTable(tbl)
end
--- 读取文件
---@param path string
function m.loadFile(path, keepBom)
local f, e = ioOpen(path, 'rb')
if not f then
return nil, e
end
local text = f:read 'a'
f:close()
if not keepBom then
if text:sub(1, 3) == '\xEF\xBB\xBF' then
return text:sub(4)
end
if text:sub(1, 2) == '\xFF\xFE'
or text:sub(1, 2) == '\xFE\xFF' then
return text:sub(3)
end
end
return text
end
--- 写入文件
---@param path string
---@param content string
function m.saveFile(path, content)
local f, e = ioOpen(path, "wb")
if f then
f:write(content)
f:close()
return true
else
return false, e
end
end
--- 计数器
---@param init integer {optional = 'after'}
---@param step integer {optional = 'after'}
---@return fun():integer
function m.counter(init, step)
if not step then
step = 1
end
local current = init and (init - 1) or 0
return function ()
current = current + step
return current
end
end
--- 排序后遍历
---@param t table
function m.sortPairs(t, sorter)
local keys = {}
for k in pairs(t) do
keys[#keys+1] = k
end
tableSort(keys, sorter)
local i = 0
return function ()
i = i + 1
local k = keys[i]
return k, t[k]
end
end
--- 深拷贝(不处理元表)
---@param source table
---@param target table {optional = 'self'}
function m.deepCopy(source, target)
local mark = {}
local function copy(a, b)
if type(a) ~= 'table' then
return a
end
if mark[a] then
return mark[a]
end
if not b then
b = {}
end
mark[a] = b
for k, v in pairs(a) do
b[copy(k)] = copy(v)
end
return b
end
return copy(source, target)
end
--- 序列化
function m.unpack(t)
local result = {}
local tid = 0
local cache = {}
local function unpack(o)
local id = cache[o]
if not id then
tid = tid + 1
id = tid
cache[o] = tid
if type(o) == 'table' then
local new = {}
result[tid] = new
for k, v in next, o do
new[unpack(k)] = unpack(v)
end
else
result[id] = o
end
end
return id
end
unpack(t)
return result
end
--- 反序列化
function m.pack(t)
local cache = {}
local function pack(id)
local o = cache[id]
if o then
return o
end
o = t[id]
if type(o) == 'table' then
local new = {}
cache[id] = new
for k, v in next, o do
new[pack(k)] = pack(v)
end
return new
else
cache[id] = o
return o
end
end
return pack(1)
end
--- defer
local deferMT = { __close = function (self) self[1]() end }
function m.defer(callback)
return setmetatable({ callback }, deferMT)
end
function m.enableCloseFunction()
setmetatable(function () end, { __close = function (f) f() end })
end
local esc = {
["'"] = [[\']],
['"'] = [[\"]],
['\r'] = [[\r]],
['\n'] = '\\\n',
}
function m.viewString(str, quo)
if not quo then
if str:find('[\r\n]') then
quo = '[['
elseif not str:find("'", 1, true) and str:find('"', 1, true) then
quo = "'"
else
quo = '"'
end
end
if quo == "'" then
str = str:gsub('[\000-\008\011-\012\014-\031\127]', function (char)
return ('\\%03d'):format(char:byte())
end)
return quo .. str:gsub([=[['\r\n]]=], esc) .. quo
elseif quo == '"' then
str = str:gsub('[\000-\008\011-\012\014-\031\127]', function (char)
return ('\\%03d'):format(char:byte())
end)
return quo .. str:gsub([=[["\r\n]]=], esc) .. quo
else
local eqnum = #quo - 2
local fsymb = ']' .. ('='):rep(eqnum) .. ']'
if not str:find(fsymb, 1, true) then
str = str:gsub('[\000-\008\011-\012\014-\031\127]', '')
return quo .. str .. fsymb
end
for i = 0, 10 do
local fsymb = ']' .. ('='):rep(i) .. ']'
if not str:find(fsymb, 1, true) then
local ssymb = '[' .. ('='):rep(i) .. '['
str = str:gsub('[\000-\008\011-\012\014-\031\127]', '')
return ssymb .. str .. fsymb
end
end
return m.viewString(str, '"')
end
end
function m.viewLiteral(v)
local tp = type(v)
if tp == 'nil' then
return 'nil'
elseif tp == 'string' then
return m.viewString(v)
elseif tp == 'boolean' then
return tostring(v)
elseif tp == 'number' then
if isInteger(v) then
return tostring(v)
else
return formatNumber(v)
end
end
return nil
end
function m.utf8Len(str, start, finish)
local len = 0
for _ = 1, 10000 do
local clen, pos = utf8Len(str, start, finish, true)
if clen then
len = len + clen
break
else
len = len + 1 + utf8Len(str, start, pos - 1, true)
start = pos + 1
end
end
return len
end
function m.revertTable(t)
local len = #t
if len <= 1 then
return t
end
for x = 1, len // 2 do
local y = len - x + 1
t[x], t[y] = t[y], t[x]
end
return t
end
function m.randomSortTable(t, max)
local len = #t
if len <= 1 then
return t
end
if not max or max > len then
max = len
end
for x = 1, max do
local y = mathRandom(len)
t[x], t[y] = t[y], t[x]
end
return t
end
function m.tableMultiRemove(t, index)
local mark = {}
for i = 1, #index do
local v = index[i]
mark[v] = true
end
local offset = 0
local me = 1
local len = #t
while true do
local it = me + offset
if it > len then
for i = me, len do
t[i] = nil
end
break
end
if mark[it] then
offset = offset + 1
else
if me ~= it then
t[me] = t[it]
end
me = me + 1
end
end
end
---遍历文本的每一行
---@param text string
---@param keepNL boolean # 保留换行符
---@return fun(text:string):string
function m.eachLine(text, keepNL)
local offset = 1
local lineCount = 0
local lastLine
return function ()
if offset > #text then
if not lastLine then
lastLine = ''
return ''
end
return nil
end
lineCount = lineCount + 1
local nl = text:find('[\r\n]', offset)
if not nl then
lastLine = text:sub(offset)
offset = #text + 1
return lastLine
end
local line
if text:sub(nl, nl + 1) == '\r\n' then
if keepNL then
line = text:sub(offset, nl + 1)
else
line = text:sub(offset, nl - 1)
end
offset = nl + 2
else
if keepNL then
line = text:sub(offset, nl)
else
line = text:sub(offset, nl - 1)
end
offset = nl + 1
end
return line
end
end
function m.sortByScore(tbl, callbacks)
if type(callbacks) ~= 'table' then
callbacks = { callbacks }
end
local size = #callbacks
local scoreCache = {}
for i = 1, size do
scoreCache[i] = {}
end
tableSort(tbl, function (a, b)
for i = 1, size do
local callback = callbacks[i]
local cache = scoreCache[i]
local sa = cache[a] or callback(a)
local sb = cache[b] or callback(b)
cache[a] = sa
cache[b] = sb
if sa > sb then
return true
elseif sa < sb then
return false
end
end
return false
end)
end
---裁剪字符串
---@param str string
---@param mode? '"left"'|'"right"'
---@return string
function m.trim(str, mode)
if mode == "left" then
return str:gsub('^%s+', '')
end
if mode == "right" then
return str:gsub('%s+$', '')
end
return str:match '^%s*(%S+)%s*$'
end
function m.expandPath(path)
if type(path) ~= 'string' then
return nil
end
if path:sub(1, 1) == '~' then
local home = getenv('HOME')
if not home then -- has to be Windows
home = getenv 'USERPROFILE' or (getenv 'HOMEDRIVE' .. getenv 'HOMEPATH')
end
return home .. path:sub(2)
elseif path:sub(1, 1) == '$' then
path = path:gsub('%$([%w_]+)', getenv)
return path
end
return path
end
function m.arrayToHash(l)
local t = {}
for i = 1, #l do
t[l[i]] = true
end
return t
end
function m.switch()
local map = {}
local cachedCases = {}
local obj = {
case = function (self, name)
cachedCases[#cachedCases+1] = name
return self
end,
call = function (self, callback)
for i = 1, #cachedCases do
local name = cachedCases[i]
cachedCases[i] = nil
if map[name] then
error('Repeated fields:' .. tostring(name))
end
map[name] = callback
end
return self
end,
getMap = function (self)
return map
end
}
return obj
end
---@param f async fun()
function m.getUpvalue(f, name)
for i = 1, 999 do
local uname, value = getupvalue(f, i)
if not uname then
break
end
if name == uname then
return value, true
end
end
return nil, false
end
function m.stringStartWith(str, head)
return str:sub(1, #head) == head
end
function m.stringEndWith(str, tail)
return str:sub(-#tail) == tail
end
return m
|
local skynet = require "skynet"
local UserEntity = require "UserEntity"
-- UserSingleEntity
local UserSingleEntity = class("UserSingleEntity", UserEntity)
-- self.recordset格式如下:
--[[
{
[uid1] = { field1 = 1, field2 = 2 },
[uid2] = { field1 = 1, field2 = 2 }
}
--]]
function UserSingleEntity:ctor()
UserSingleEntity.super.ctor(self)
self.ismulti = false -- 是否多行记录
end
-- 加载玩家数据
function UserSingleEntity:load(uid)
if not self.recordset[uid] then
local record = skynet.call("dbmgr", "lua", "get_user_single", self.tbname, uid)
if not table.empty(record) then
self.recordset[uid] = record
end
end
end
-- 将内存中的数据先同步回redis,再从redis加载到内存(该方法要不要待定)
function UserSingleEntity:reLoad(uid)
end
-- 卸载玩家数据
function UserSingleEntity:unload(uid)
local rs = self.recordset[uid]
if rs then
for k, v in pairs(rs) do
rs[k] = nil
end
self.recordset[uid] = nil
-- 是否需要移除待定
-- 从redis删除,但不删除mysql中的数据
end
end
-- record中包含uid字段(如果表主键是uid字段,不需要包含),record为k,v形式table
-- 内存中不存在,则添加,并同步到redis
function UserSingleEntity:add(record, nosync)
if record.uid and self.recordset[record.uid] then return end -- 记录已经存在,返回
local id = record[self.pk]
if not id or id == 0 then
id = self:getNextId()
record[self.pk] = id
end
local ret = skynet.call("dbmgr", "lua", "add", self.tbname, record, self.type, nosync)
if ret then
self.recordset[record.uid] = record
end
return ret, record
end
-- record中包含uid字段,record为k,v形式table
-- 从内存中删除,并同步到redis
function UserSingleEntity:delete(record, nosync)
if not record.uid then return end
local ret = skynet.call("dbmgr", "lua", "delete", self.tbname, record, self.type, nosync)
if ret then
self.recordset[record.uid] = nil
end
return ret
end
-- record中包含uid字段,record为k,v形式table
-- 仅从内存中移除,但不同步到redis
function UserSingleEntity:remove(record)
if not record.uid or not self.recordset[record.uid] then return end -- 记录不存在,返回
self.recordset[record.uid] = nil
return true
end
-- record中包含uid字段,record为k,v形式table
function UserSingleEntity:update(record, nosync)
if not record.uid or not self.recordset[record.uid] then return end -- 记录不存在,返回
local ret = skynet.call("dbmgr", "lua", "update", self.tbname, record, self.type, nosync)
if ret then
for k, v in pairs(record) do
self.recordset[record.uid][k] = v
end
end
return ret
end
-- 从内存中获取,如果不存在,说明是其他的离线玩家数据,则加载数据到redis
-- field为空,获取整行记录,返回k,v形式table
-- field为字符串表示获取单个字段的值,如果字段不存在,返回nil
-- field为一个数组形式table,表示获取数组中指定的字段的值,返回k,v形式table
function UserSingleEntity:get(uid, field)
-- 内存中存在
local record
if self.recordset[uid] then
if not field then
record = self.recordset[uid]
elseif type(field) == "string" then
record = self.recordset[uid][field]
elseif type(field) == "table" then
record = {}
for i=1, #field do
local t = self.recordset[uid]
record[field[i]] = t[field[i]]
end
end
return record
end
-- 从redis获取,如果redis不存在,从mysql加载
local orifield = field
if type(field) == "string" then
field = { field }
end
record = skynet.call("dbmgr", "lua", "get_user_single", self.tbname, uid) --不存在返回空的table {}
if not table.empty(record) then
self.recordset[uid] = record
if type(orifield) == "string" then
return record[orifield]
end
end
if table.empty(record) and type(orifield) == "string" then return end
return record
end
-- field为字符串表示获取单个字段的值
-- field为一个数组形式table,表示获取数组中指定的字段的值,返回k,v形式table
function UserSingleEntity:getValue(uid, field)
if not field then return end
local record = self:get(uid, field)
if record then
return record
end
end
-- 成功返回true,失败返回false或nil
-- 设置单个字段的值,field为字符串,value为值
-- 设置多个字段的值,field为k,v形式table,value为空
function UserSingleEntity:setValue(uid, field, value)
local record = {}
record["uid"] = uid
if value then
record[field] = value
else
for k, v in pairs(field) do
record[k] = v
end
end
return self:update(record)
end
return UserSingleEntity
|
common_io_validation.validate_instance_numbers("iot_spi") |
-- Strela-3 Russia Manpad
GT = {};
GT_t.ws = 0;
set_recursive_metatable(GT, GT_t.generic_human);
set_recursive_metatable(GT.chassis, GT_t.CH_t.HUMAN);
GT.animation = {};
set_recursive_metatable(GT.animation, GT_t.CH_t.HUMAN_ANIMATION);
GT.visual.shape = "soldier_ru_03";
GT.visual.shape_dstr = "soldier_ru_03_d";
GT.mobile = true;
GT.sensor = {};
set_recursive_metatable(GT.sensor, GT_t.SN_visual);
-- weapon systems
GT.WS = {};
GT.WS.maxTargetDetectionRange = 7500;
GT.WS.fire_on_march = false;
local ws = GT_t.inc_ws();
GT.WS[ws] = {};
set_recursive_metatable(GT.WS[ws], GT_t.WS_t.strela3_manpad);
GT.WS[ws].cockpit = {"IglaSight/IglaSight", {0.0, 0.0, 0.0}}
GT.WS[ws].pointer = "camera";
local __LN = GT.WS[ws].LN[1]
__LN.BR[1].connector_name = "POINT_LAUNCHER";
__LN.sightMasterMode = 1;
__LN.sightIndicationMode = 1;
GT.Name = "SA-14 Strela-3 manpad";
GT.DisplayName = _("SAM SA-14 Strela-3 manpad");
GT.Rate = 5;
GT.DetectionRange = GT.sensor.max_range_finding_target;
GT.ThreatRange = GT.WS[1].LN[1].distanceMax;
GT.mapclasskey = "P0091000202";
GT.attribute = {wsType_Ground,wsType_SAM,wsType_Miss,IglaRUS_1,
"MANPADS",
"IR Guided SAM",
"New infantry",
};
GT.category = "Air Defence";
GT.Transportable = {
size = 100
} |
-- Main.lua
-- Implements the entire NearestAvoid AI controller
-- The bots target the nearest enemy, but avoid going through a friend bot in front of it
--- Returns true if the first number is between the second and third numbers, inclusive
local function isBetweenOrEqual(a_Val, a_Bounds1, a_Bounds2)
-- Check params:
assert(type(a_Val) == "number")
assert(type(a_Bounds1) == "number")
assert(type(a_Bounds2) == "number")
if (a_Bounds1 < a_Bounds2) then
return (a_Val >= a_Bounds1) and (a_Val <= a_Bounds2)
else
return (a_Val >= a_Bounds2) and (a_Val <= a_Bounds1)
end
end
--- Returns the coords of the specified point projected onto the specified line
local function projectPtToLine(a_X, a_Y, a_LineX1, a_LineY1, a_LineX2, a_LineY2)
-- Check params:
assert(tonumber(a_X))
assert(tonumber(a_Y))
assert(tonumber(a_LineX1))
assert(tonumber(a_LineY1))
assert(tonumber(a_LineX2))
assert(tonumber(a_LineY2))
-- Calculate the coords:
local dx = a_LineX2 - a_LineX1;
local dy = a_LineY2 - a_LineY1;
local divisor = (dx * dx + dy * dy)
if (divisor < 0.0001) then
-- The divisor is too small, the line is too short, so return the first point's coords as the projection:
return a_LineX1, a_LineY1
end
local k = (dy * (a_Y - a_LineY1) + dx * (a_X - a_LineX1)) / divisor;
return a_LineX1 + dx * k, a_LineY1 + dy * k;
end
--- Returns the distance of the specified point from the specified line
local function distPtFromLine(a_X, a_Y, a_LineX1, a_LineY1, a_LineX2, a_LineY2)
-- Check params:
assert(tonumber(a_X))
assert(tonumber(a_Y))
assert(tonumber(a_LineX1))
assert(tonumber(a_LineY1))
assert(tonumber(a_LineX2))
assert(tonumber(a_LineY2))
-- Calculate the distance, divisor first:
local deltaX = a_LineX1 - a_LineX2
local deltaY = a_LineY1 - a_LineY2
local divisor = math.sqrt(deltaY * deltaY + deltaX * deltaX)
if (divisor < 0.0001) then
return 0
end
local numerator = math.abs(deltaY * a_X - deltaX * a_Y + a_LineX2 * a_LineY1 - a_LineY2 * a_LineX1)
return numerator / divisor
end
--- Returns the Euclidean distance between two points
local function distPtFromPt(a_X1, a_Y1, a_X2, a_Y2)
-- Check params:
assert(tonumber(a_X1))
assert(tonumber(a_Y1))
assert(tonumber(a_X2))
assert(tonumber(a_Y2))
-- Calculate the distance:
return math.sqrt((a_X1 - a_X2) * (a_X1 - a_X2) + (a_Y1 - a_Y2) * (a_Y1 - a_Y2))
end
--- Returns the Euclidean of the distance between two bots
local function botDistance(a_Bot1, a_Bot2)
-- Check params:
assert(type(a_Bot1) == "table")
assert(type(a_Bot2) == "table")
-- Calculate the distance:
return distPtFromPt(a_Bot1.x, a_Bot1.y, a_Bot2.x, a_Bot2.y)
end
--- Returns the command for srcBot to target dstBot
local function cmdTargetBot(a_SrcBot, a_DstBot, a_Game)
-- Check params:
assert(type(a_SrcBot) == "table")
assert(type(a_DstBot) == "table")
assert(type(a_Game) == "table")
local wantAngle = math.atan2(a_DstBot.y - a_SrcBot.y, a_DstBot.x - a_SrcBot.x) * 180 / math.pi
local angleDiff = wantAngle - a_SrcBot.angle
if (angleDiff < -180) then
angleDiff = angleDiff + 360
elseif (angleDiff > 180) then
angleDiff = angleDiff - 360
end
-- If the current heading is too off, adjust:
if (math.abs(angleDiff) > 5) then
if ((a_SrcBot.speedLevel > 1) and (math.abs(angleDiff) > 3 * a_SrcBot.maxAngularSpeed)) then
-- We're going too fast to steer, brake:
aiLog(a_SrcBot.id, "Too fast to steer, breaking. Angle is " .. a_SrcBot.angle .. ", wantAngle is " .. wantAngle .. ", angleDiff is " .. angleDiff)
return { cmd = "brake" }
else
aiLog(
a_SrcBot.id, "Steering, angle is " .. a_SrcBot.angle .. ", wantAngle is " .. wantAngle ..
", angleDiff is " .. angleDiff .. ", maxAngularSpeed is " .. a_SrcBot.maxAngularSpeed .. ", speed is " .. a_SrcBot.speed
)
return { cmd = "steer", angle = angleDiff }
end
end
-- If the enemy is further than 20 pixels away, accellerate, else nop:
local dist = botDistance(a_SrcBot, a_DstBot)
if ((dist > 20) and (a_SrcBot.speed < a_Game.maxBotSpeed)) then
aiLog(a_SrcBot.id, "Accellerating (dist is " .. dist .. ")")
return { cmd = "accelerate" }
else
aiLog(a_SrcBot.id, "En route to dst, no command")
return nil
end
end
--- Converts bot speed to speed level index:
local function getSpeedLevelIdxFromSpeed(a_Game, a_Speed)
-- Try the direct lookup first:
local level = a_Game.speedToSpeedLevel[a_Speed]
if (level) then
return level
end
-- Direct lookup failed, do a manual lookup:
print("speed level lookup failed for speed " .. a_Speed)
for idx, lvl in ipairs(a_Game.speedLevels) do
if (a_Speed <= lvl.linearSpeed) then
print("Manual speed lookup for speed " .. a_Speed .. " is idx " .. idx .. ", linear speed " .. lvl.linearSpeed)
return idx
end
end
return 1
end
--- Returns true if there is a bot (from a_Bots) between a_Bot1 and a_Bot2 within the specified distance of the line
local function isBotBetweenBots(a_Bot1, a_Bot2, a_Bots, a_Dist)
-- Check params:
assert(type(a_Bot1) == "table")
assert(type(a_Bot2) == "table")
assert(type(a_Bots) == "table")
assert(tonumber(a_Dist))
-- Check each friend's distance from the line between bot1 and bot2:
local minDist = 1500
local minDistId = 0
for _, f in ipairs(a_Bots) do
if ((f.id ~= a_Bot1.id) and (f.id ~= a_Bot2.id)) then
local x, y = projectPtToLine(f.x, f.y, a_Bot1.x, a_Bot1.y, a_Bot2.x, a_Bot2.y)
if (isBetweenOrEqual(x, a_Bot1.x, a_Bot2.x) and isBetweenOrEqual(y, a_Bot1.y, a_Bot2.y)) then
local dist = distPtFromPt(x, y, f.x, f.y)
if (dist < minDist) then
minDist = dist
minDistId = f.id
end
if (dist < a_Dist) then
aiLog(a_Bot1.id, "Cannot aim towards #" .. a_Bot2.id .. ", #" .. f.id .. " is in the way")
return true
end
end
end
end -- for f - a_Bots[]
aiLog(a_Bot1.id, "Friend nearest to the line of fire to #" .. a_Bot2.id .. " is #" .. minDistId .. " at distance " .. minDist)
return false
end
--- Updates each bot to target the nearest enemy:
local function updateTargets(a_Game)
-- Check params:
assert(type(a_Game) == "table")
assert(type(a_Game.world) == "table")
assert(tonumber(a_Game.world.botRadius))
-- Update each bot's stats, based on their speed level:
for _, m in ipairs(a_Game.myBots) do
m.speedLevel = getSpeedLevelIdxFromSpeed(a_Game, m.speed)
m.maxAngularSpeed = a_Game.speedLevels[m.speedLevel].maxAngularSpeed
end
for _, m in ipairs(a_Game.myBots) do
-- Pick the nearest target:
local minDist = a_Game.world.width * a_Game.world.width + a_Game.world.height * a_Game.world.height
local target
for _, e in ipairs(a_Game.enemyBots) do
if not(isBotBetweenBots(m, e, a_Game.myBots, 2 * a_Game.world.botRadius)) then
local dist = botDistance(m, e)
if (dist < minDist) then
minDist = dist
target = e
end
else
aiLog(m.id, "Cannot target enemy #" .. e.id .. ", there's a friend in the way")
end
end -- for idx2, e - enemyBots[]
-- Navigate towards the target:
if (target) then
aiLog(m.id, "Targetting enemy #" .. target.id)
a_Game.botCommands[m.id] = cmdTargetBot(m, target, a_Game)
else
-- No target available, wander around a bit:
local cmd
if (m.speed > 100) then
cmd = { cmd = "brake" }
else
cmd = { cmd = "steer", angle = 120 }
end
aiLog(m.id, "No a clear line of attack to any enemy. Idling at " .. cmd.cmd)
a_Game.botCommands[m.id] = cmd
end
end
end
function onGameStarted(a_Game)
-- Collect all my bots into an array, and enemy bots to another array:
a_Game.myBots = {}
a_Game.enemyBots = {}
for _, bot in pairs(a_Game.allBots) do
if (bot.isEnemy) then
table.insert(a_Game.enemyBots, bot)
else
table.insert(a_Game.myBots, bot)
end
end
-- Initialize the speed-to-speedLevel table, find min and max:
a_Game.speedToSpeedLevel = {}
local minSpeed = a_Game.speedLevels[1].linearSpeed
local maxSpeed = minSpeed
for idx, level in ipairs(a_Game.speedLevels) do
a_Game.speedToSpeedLevel[level.linearSpeed] = idx
if (level.linearSpeed < minSpeed) then
minSpeed = level.linearSpeed
end
if (level.linearSpeed > maxSpeed) then
maxSpeed = level.linearSpeed
end
end
a_Game.speedToSpeedLevel[0] = 1 -- Special case - bots with zero speed are handled as having the lowest speed
a_Game.maxBotSpeed = maxSpeed
a_Game.minBotSpeed = minSpeed
end
function onGameUpdate(a_Game)
assert(type(a_Game) == "table")
-- Nothing needed yet
end
function onGameFinished(a_Game)
assert(type(a_Game) == "table")
-- Nothing needed yet
end
function onBotDied(a_Game, a_BotID)
-- Remove the bot from one of the myBots / enemyBots arrays:
local whichArray
if (a_Game.allBots[a_BotID].isEnemy) then
whichArray = a_Game.enemyBots
else
whichArray = a_Game.myBots
end
for idx, bot in ipairs(whichArray) do
if (bot.id == a_BotID) then
table.remove(whichArray, idx)
break;
end
end -- for idx, bot - whichArray[]
-- Print an info message:
local friendliness
if (a_Game.allBots[a_BotID].isEnemy) then
friendliness = "(enemy)"
else
friendliness = "(my)"
end
print("LUA: onBotDied: bot #" .. a_BotID .. friendliness)
end
function onSendingCommands(a_Game)
-- Update the bot targets:
updateTargets(a_Game)
end
function onCommandsSent(a_Game)
assert(type(a_Game) == "table")
-- Nothing needed
end
|
local a, b, c
a = 1
b = 2
local d
d = 3
f()
summon = function(bid, count)
if type(bid) == "string" then
bid = beings[bid].nid
end
local last_being
for i = 1, count or 1 do
last_being = Level.drop_being(bid, Level.empty_coord())
end
return last_being
end
f()
--a, b = a and b, a or b
f()
--[[while a < c do
if(a == b) then
a = c
else
break
end
end]] --TODO
--[[while a < c do
if a==b then
c = 3
if c == b then
d = 6
end
end
end]] --FIXED!
--[[if a==b then
if c==d then
a = 4
if a == c then
a, b = 2, 3
end
end
else
c = 6
end]] --FIXED!
--[[while a == b do
if c == d then
c = 6
end
break
end]] --OKAY because compiles as
--[[while a == b and c == d do
c = 6
break
end]]
a, b, c, d = b, c, d, a
return f() |
hud = {}
-- HUD statbar values
hud.health = {}
hud.hunger = {}
hud.air = {}
hud.armor = {}
hud.hunger_out = {}
hud.armor_out = {}
-- HUD item ids
local health_hud = {}
local hunger_hud = {}
local air_hud = {}
local armor_hud = {}
local armor_hud_bg = {}
-- default settings
HUD_SCALEABLE = false
HUD_SIZE = ""
-- statbar positions
HUD_HEALTH_POS = {x=0.5,y=0.9}
HUD_HEALTH_OFFSET = {x=-175, y=2}
HUD_HUNGER_POS = {x=0.5,y=0.9}
HUD_HUNGER_OFFSET = {x=15, y=2}
HUD_AIR_POS = {x=0.5,y=0.9}
HUD_AIR_OFFSET = {x=15,y=-15}
HUD_ARMOR_POS = {x=0.5,y=0.9}
HUD_ARMOR_OFFSET = {x=-175, y=-15}
-- dirty way to check for new statbars
if dump(minetest.hud_replace_builtin) ~= "nil" then
HUD_SCALEABLE = true
HUD_SIZE = {x=24, y=24}
HUD_HEALTH_POS = {x=0.5,y=1}
HUD_HEALTH_OFFSET = {x=-262, y=-87}
HUD_HUNGER_POS = {x=0.5,y=1}
HUD_HUNGER_OFFSET = {x=15, y=-87}
HUD_AIR_POS = {x=0.5,y=1}
HUD_AIR_OFFSET = {x=15,y=-110}
HUD_ARMOR_POS = {x=0.5,y=1}
HUD_ARMOR_OFFSET = {x=-262, y=-110}
end
HUD_TICK = 0.1
--Some hunger settings
hud.exhaustion = {} -- Exhaustion is experimental!
HUD_HUNGER_TICK = 800 -- time in seconds after that 1 hunger point is taken
HUD_HUNGER_EXHAUST_DIG = 3 -- exhaustion increased this value after digged node
HUD_HUNGER_EXHAUST_PLACE = 1 -- exhaustion increased this value after placed
HUD_HUNGER_EXHAUST_MOVE = 0.3 -- exhaustion increased this value if player movement detected
HUD_HUNGER_EXHAUST_LVL = 160 -- at what exhaustion player saturation gets lowerd
HUD_ENABLE_HUNGER = minetest.setting_getbool("hud_hunger_enable")
if HUD_ENABLE_HUNGER == nil then
HUD_ENABLE_HUNGER = minetest.setting_getbool("enable_damage")
end
HUD_SHOW_ARMOR = false
if minetest.get_modpath("3d_armor") ~= nil then
HUD_SHOW_ARMOR = true
end
--load custom settings
local set = io.open(minetest.get_modpath("hud").."/hud.conf", "r")
if set then
dofile(minetest.get_modpath("hud").."/hud.conf")
set:close()
else
if not HUD_ENABLE_HUNGER then
HUD_AIR_OFFSET = HUD_HUNGER_OFFSET
end
end
local function hide_builtin(player)
player:hud_set_flags({crosshair = true, hotbar = true, healthbar = false, wielditem = true, breathbar = false})
end
local function custom_hud(player)
local name = player:get_player_name()
-- fancy hotbar (only when no crafting mod present)
if minetest.get_modpath("crafting") == nil then
player:hud_set_hotbar_image("hud_hotbar.png")
player:hud_set_hotbar_selected_image("hud_hotbar_selected.png")
end
if minetest.setting_getbool("enable_damage") then
--hunger
if HUD_ENABLE_HUNGER then
player:hud_add({
hud_elem_type = "statbar",
position = HUD_HUNGER_POS,
size = HUD_SIZE,
text = "hud_hunger_bg.png",
number = 20,
alignment = {x=-1,y=-1},
offset = HUD_HUNGER_OFFSET,
})
local h = hud.hunger[name]
if h == nil or h > 20 then h = 20 end
hunger_hud[name] = player:hud_add({
hud_elem_type = "statbar",
position = HUD_HUNGER_POS,
size = HUD_SIZE,
text = "hud_hunger_fg.png",
number = h,
alignment = {x=-1,y=-1},
offset = HUD_HUNGER_OFFSET,
})
end
--health
player:hud_add({
hud_elem_type = "statbar",
position = HUD_HEALTH_POS,
size = HUD_SIZE,
text = "hud_heart_bg.png",
number = 20,
alignment = {x=-1,y=-1},
offset = HUD_HEALTH_OFFSET,
})
health_hud[name] = player:hud_add({
hud_elem_type = "statbar",
position = HUD_HEALTH_POS,
size = HUD_SIZE,
text = "hud_heart_fg.png",
number = player:get_hp(),
alignment = {x=-1,y=-1},
offset = HUD_HEALTH_OFFSET,
})
--air
air_hud[name] = player:hud_add({
hud_elem_type = "statbar",
position = HUD_AIR_POS,
size = HUD_SIZE,
text = "hud_air_fg.png",
number = 0,
alignment = {x=-1,y=-1},
offset = HUD_AIR_OFFSET,
})
--armor
if HUD_SHOW_ARMOR then
armor_hud_bg[name] = player:hud_add({
hud_elem_type = "statbar",
position = HUD_ARMOR_POS,
size = HUD_SIZE,
text = "hud_armor_bg.png",
number = 0,
alignment = {x=-1,y=-1},
offset = HUD_ARMOR_OFFSET,
})
armor_hud[name] = player:hud_add({
hud_elem_type = "statbar",
position = HUD_ARMOR_POS,
size = HUD_SIZE,
text = "hud_armor_fg.png",
number = 0,
alignment = {x=-1,y=-1},
offset = HUD_ARMOR_OFFSET,
})
end
end
end
--needs to be defined for older version of 3darmor
function hud.set_armor()
end
if HUD_ENABLE_HUNGER then dofile(minetest.get_modpath("hud").."/hunger.lua") end
if HUD_SHOW_ARMOR then dofile(minetest.get_modpath("hud").."/armor.lua") end
-- update hud elemtens if value has changed
local function update_hud(player)
local name = player:get_player_name()
--air
local air = tonumber(hud.air[name])
if player:get_breath() ~= air then
air = player:get_breath()
hud.air[name] = air
if air > 10 then air = 0 end
player:hud_change(air_hud[name], "number", air*2)
end
--health
local hp = tonumber(hud.health[name])
if player:get_hp() ~= hp then
hp = player:get_hp()
hud.health[name] = hp
player:hud_change(health_hud[name], "number", hp)
end
--armor
local arm_out = tonumber(hud.armor_out[name])
if not arm_out then arm_out = 0 end
local arm = tonumber(hud.armor[name])
if not arm then arm = 0 end
if arm_out ~= arm then
hud.armor_out[name] = arm
player:hud_change(armor_hud[name], "number", arm)
-- hide armor bar completely when there is none
if (not armor.def[name].count or armor.def[name].count == 0) and arm == 0 then
player:hud_change(armor_hud_bg[name], "number", 0)
else
player:hud_change(armor_hud_bg[name], "number", 20)
end
end
--hunger
local h_out = tonumber(hud.hunger_out[name])
local h = tonumber(hud.hunger[name])
if h_out ~= h then
hud.hunger_out[name] = h
-- bar should not have more than 10 icons
if h>20 then h=20 end
player:hud_change(hunger_hud[name], "number", h)
end
end
hud.get_hunger = function(player)
local inv = player:get_inventory()
if not inv then return nil end
local hgp = inv:get_stack("hunger", 1):get_count()
if hgp == 0 then
hgp = 21
inv:set_stack("hunger", 1, ItemStack({name=":", count=hgp}))
else
hgp = hgp
end
return hgp-1
end
hud.set_hunger = function(player)
local inv = player:get_inventory()
local name = player:get_player_name()
local value = hud.hunger[name]
if not inv or not value then return nil end
if value > 30 then value = 30 end
if value < 0 then value = 0 end
inv:set_stack("hunger", 1, ItemStack({name=":", count=value+1}))
return true
end
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
local inv = player:get_inventory()
inv:set_size("hunger",1)
hud.health[name] = player:get_hp()
if HUD_ENABLE_HUNGER then
hud.hunger[name] = hud.get_hunger(player)
hud.hunger_out[name] = hud.hunger[name]
hud.exhaustion[name] = 0
end
hud.armor[name] = 0
hud.armor_out[name] = 0
local air = player:get_breath()
hud.air[name] = air
minetest.after(0.5, function()
hide_builtin(player)
custom_hud(player)
if HUD_ENABLE_HUNGER then hud.set_hunger(player) end
end)
end)
minetest.register_on_respawnplayer(function(player)
-- reset player breath since the engine doesnt
player:set_breath(11)
-- reset hunger (and save)
local name = player:get_player_name()
hud.hunger[name] = 20
if HUD_ENABLE_HUNGER then
minetest.after(0.5, hud.set_hunger, player)
hud.exhaustion[name] = 0
end
end)
local main_timer = 0
local timer = 0
local timer2 = 0
minetest.after(2.5, function()
minetest.register_globalstep(function(dtime)
main_timer = main_timer + dtime
timer = timer + dtime
timer2 = timer2 + dtime
if main_timer > HUD_TICK or timer > 4 or timer2 > HUD_HUNGER_TICK then
if main_timer > HUD_TICK then main_timer = 0 end
for _,player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()
-- only proceed if damage is enabled
if minetest.setting_getbool("enable_damage") then
local h = tonumber(hud.hunger[name])
local hp = player:get_hp()
if HUD_ENABLE_HUNGER and timer > 4 then
-- heal player by 1 hp if not dead and saturation is > 15 (of 30)
if h > 15 and hp > 0 and hud.air[name] > 0 then
player:set_hp(hp+1)
-- or damage player by 1 hp if saturation is < 2 (of 30)
elseif h <= 1 and minetest.setting_getbool("enable_damage") then
if hp-1 >= 0 then player:set_hp(hp-1) end
end
end
-- lower saturation by 1 point after xx seconds
if HUD_ENABLE_HUNGER and timer2 > HUD_HUNGER_TICK then
if h > 0 then
h = h-1
hud.hunger[name] = h
hud.set_hunger(player)
end
end
-- update current armor level
if HUD_SHOW_ARMOR then hud.get_armor(player) end
-- update all hud elements
update_hud(player)
if HUD_ENABLE_HUNGER then
local controls = player:get_player_control()
-- Determine if the player is walking
if controls.up or controls.down or controls.left or controls.right then
hud.handle_node_actions(nil, nil, player)
end
end
end
end
end
if timer > 4 then timer = 0 end
if timer2 > HUD_HUNGER_TICK then timer2 = 0 end
end)
end)
|
local oldBuildTechData = BuildTechData
function BuildTechData()
local techData = oldBuildTechData()
table.insert(techData, { [kTechDataId] = kTechId.ProwlerMenu, [kTechDataDisplayName] = "UPGRADE_PROWLER", [kTechDataTooltipInfo] = "UPGRADE_PROWLER_TOOLTIP", })
table.insert(techData, { [kTechDataId] = kTechId.UpgradeProwler, [kTechDataCostKey] = kUpgradeProwlerResearchCost, [kTechDataResearchTimeKey] = kUpgradeProwlerResearchTime, [kTechDataDisplayName] = "UPGRADE_PROWLER", [kTechDataTooltipInfo] = "UPGRADE_PROWLER_TOOLTIP", [kTechDataMenuPriority] = -1 })
table.insert(techData, { [kTechDataId] = kTechId.Howl, [kTechDataCategory] = kTechId.Prowler, [kTechDataDisplayName] = "Howl", [kTechDataCostKey] = kHowlResearchCost, [kTechDataResearchTimeKey] = kHowlResearchTime, [kTechDataTooltipInfo] = "With the correct Hive upgrade, Prowlers gain additional abilities. Shift: Enzyme, Shade: A skulk hallucination, Crag: Mucous membrane." })
table.insert(techData, {
[kTechDataId] = kTechId.Prowler,
[kTechDataUpgradeCost] = kProwlerUpgradeCost,
[kTechDataMapName] = Prowler.kMapName,
[kTechDataGestateName] = Prowler.kMapName,
[kTechDataGestateTime] = kProwlerGestateTime,
[kTechDataDisplayName] = "Prowler",
[kTechDataTooltipInfo] = "Ground support and pack leader. Has a low damage acid spray attack, and can buff nearby allies with Hive evolutions.",
[kTechDataModel] = Prowler.kModelName,
[kTechDataCostKey] = kProwlerCost,
[kTechDataMaxHealth] = Prowler.kHealth,
[kTechDataMaxArmor] = Prowler.kArmor,
[kTechDataEngagementDistance] = kPlayerEngagementDistance,
[kTechDataMaxExtents] = Vector(Prowler.kXExtents, Prowler.kYExtents, Prowler.kZExtents),
[kTechDataPointValue] = kProwlerPointValue
})
table.insert(techData, { [kTechDataId] = kTechId.HallucinateProwler, [kTechDataRequiresMature] = true, [kTechDataDisplayName] = "HALLUCINATE_DRIFTER", [kTechDataTooltipInfo] = "HALLUCINATE_DRIFTER_TOOLTIP", [kTechDataCostKey] = kHallucinateDrifterEnergyCost })
return techData
end
|
-----------------------------------------------------------------------------------------
-- Composites
-- Sequencer
-- Execute the child nodes in order or randonly and return Success if all children return
-- Success, else return Failure.
-- If is Dynamic, higher priority child status is revaluated.
-- If a child returns Failure the Sequencer will bail out immediately in Failure too.
-----------------------------------------------------------------------------------------
local Sequencer = bt.Class("Sequencer",bt.BTComposite)
bt.Sequencer = Sequencer
function Sequencer:ctor()
bt.BTComposite.ctor(self)
self.name = "Sequencer"
self.dynamic = false
self.random = false
self.lastRunningNodeIndex = 1
end
function Sequencer:init(jsonData)
if jsonData.dynamic then
self.dynamic = jsonData.dynamic
end
if jsonData.random then
self.random = jsonData.random
end
end
function Sequencer:onExecute(agent,blackboard)
local startIndex = self.lastRunningNodeIndex
if self.dynamic then
startIndex = 1
end
local size = #self.outConnections
for i = startIndex,size do
self.status = self.outConnections[i]:execute(agent,blackboard)
if self.status == bt.Status.Running then
if self.dynamic and i < self.lastRunningNodeIndex then
self.outConnections[self.lastRunningNodeIndex]:reset(true)
end
self.lastRunningNodeIndex = i
return bt.Status.Running
elseif self.status == bt.Status.Failure then
if self.dynamic and i < self.lastRunningNodeIndex then
for j = i + 1,self.lastRunningNodeIndex do
self.outConnections[j]:reset(true)
end
end
return bt.Status.Failure
end
end
return bt.Status.Success
end
function Sequencer:onReset()
self.lastRunningNodeIndex = 1
if self.random then
self:shuffle(self.outConnections)
end
end
function Sequencer:onGraphStarted()
self:onReset()
end
function Sequencer:shuffle(list)
local size = #list
for i = 1,size do
local j = math.random( i,size)
list[i],list[j] = list[j],list[i]
end
end |
function teleportUp(player, terrain)
local x, y, z = GetPlayerLocation(player)
CallEvent("SafeTeleport", player, x, y, terrain + 200)
end
AddRemoteEvent("Kuzkay:UnderMapFix", teleportUp) |
local insert, move = table.insert, table.move
local class = {
__newindex = function(t, k, v)
if type(v) ~= 'function' then
rawset(t, k, v)
return
end
rawset(t, k, function(self, ...)
if self.parents then return v(self, ...) end
local cls = {parents = {}}
for k, v in pairs(self) do
if type(v) == 'function' then cls[k] = v end
end
setmetatable(cls, cls)
return cls[k](cls, ...)
end)
end
}
setmetatable(class, class)
function class:is(...)
local parents = {...}
move(parents, 1, #parents, #self.parents + 1, self.parents)
return self
end
function class:__call(prototype)
local parents = self.parents
local parent_protos = {}
for _, parent in pairs(parents) do insert(parent_protos, parent.prototype) end
local mro = {prototype}
local function merge(lists)
local nonempty = {}
for _, list in ipairs(lists) do
if #list > 0 then insert(nonempty, list) end
end
local lasts, pos = {}, {}
for _, list in pairs(nonempty) do
for i, element in ipairs(list) do
if not lasts[element] then lasts[element] = {} end
lasts[element][list] = i
end
pos[list] = 1
end
local counter, length = #nonempty, #nonempty
while counter > 0 do
local element
for i = 1, length do
local list = nonempty[i]
element = list[pos[list]]
if element then
local last = lasts[element]
for _, other in pairs(nonempty) do
if last[other] and last[other] > pos[other] then
element = nil
break
end
end
if element then break end
end
end
assert(element, 'Cannot resolve MRO')
insert(mro, element)
for _, list in pairs(nonempty) do
if list[pos[list]] == element then
pos[list] = pos[list] + 1
if pos[list] > #list then counter = counter - 1 end
end
end
end
end
merge((function()
local lists = {}
for _, parent in pairs(parents) do insert(lists, parent.mro) end
insert(lists, parent_protos)
return lists
end)())
local specials = {
__prototype = prototype,
__parents = parent_protos,
__mro = mro,
__resolve = function(key)
return function(state, control)
if not state then return end
for i = control + 1, #state do
local value = state[i][key]
if value then return i, value end
end
end, mro, 0
end,
__is = function(cls)
for _, parent in pairs(mro) do if parent == cls then return true end end
return false
end
}
return setmetatable({
prototype = prototype,
parents = parent_protos,
mro = mro
}, {
__call = function(_, ...)
local obj = setmetatable({}, {
__index = function(_, key)
if specials[key] then return specials[key] end
for _, value in specials.__resolve(key) do return value end
end
})
if obj.__init then obj:__init(...) end
return obj
end
})
end
return class
|
local vim = vim
local api = vim.api
local M = {}
function M.cursor_offset()
-- Get the offset to the start of the line where our cursor is located,
-- which is index 1, so we need to subtract 1
local offset_to_line = api.nvim_call_function('line2byte', {'.'}) - 1
-- Get the offset from start of line to where our cursor is located,
-- which is index 1, so we need to subtract 1
local offset_to_column = api.nvim_call_function('col', {'.'}) - 1
return offset_to_line + offset_to_column
end
-- Changes the text in the current buffer starting at the specified offset
-- through the byte length.
--
-- Assumes that the offset is from the server, which is index 0.
function M.change_in_buffer(offset, len, text)
-- Adjust our offset and len to start at index 1
local offset = offset + 1
local len = len - 1
-- Calculate the starting and ending line/column positions for selection
local lstart = api.nvim_call_function('byte2line', {offset})
local cstart = offset - api.nvim_call_function('line2byte', {lstart}) + 1
local lend = api.nvim_call_function('byte2line', {offset + len})
local cend = offset + len - api.nvim_call_function('line2byte', {lend}) + 1
-- Insert our text into the unnamed register so we can paste it later
api.nvim_call_function('setreg', {'"', text})
-- Build the commands to apply in normal mode
--
-- Enter visual mode, jump to the beginning of our selection, then jump the
-- cursor to where we were before, move to the end of the selection, and
-- finally paste from our unnamed register
cmd = movement_string(lend, cend)..'v'..movement_string(lstart, cstart)..'""p'
api.nvim_command('normal! '..cmd)
end
-- Visually selects the byte range starting at offset with the specified
-- byte length.
--
-- Builds the key sequence to select in vim from the specified offset to some
-- end using the given length. Assumes that the offset provided is from our
-- server, which is index 0.
function M.select_in_buffer(offset, len)
-- Adjust our offset and len to start at index 1
local offset = offset + 1
local len = len - 1
-- Calculate the starting and ending line/column positions for selection
local lstart = api.nvim_call_function('byte2line', {offset})
local cstart = offset - api.nvim_call_function('line2byte', {lstart}) + 1
local lend = api.nvim_call_function('byte2line', {offset + len})
local cend = offset + len - api.nvim_call_function('line2byte', {lend}) + 1
-- Build the commands to apply in normal mode
--
-- Enter visual mode, jump to the beginning of our selection, then jump the
-- cursor to where we were before, and move to the end of the selection
cmd = movement_string(lend, cend)..'v'..movement_string(lstart, cstart)
api.nvim_command('normal! '..cmd)
end
-- Returns a list of line numbers that are contained within the starting
-- byte offset through the specified byte length.
--
-- Assumes that the offset provided is from our server, which is index 0.
function M.get_line_numbers(offset, len)
-- Adjust our offset and len to start at index 1
local offset = offset + 1
local len = len - 1
local lstart = api.nvim_call_function('byte2line', {offset})
local lend = api.nvim_call_function('byte2line', {offset + len})
local lines = {}
for i=lstart, lend do
table.insert(lines, i)
end
return lines
end
-- Returns a string representing movement in vim to the given line and column
-- using keystrokes, not commands
function movement_string(line, col)
-- Start by jumping to the specified line and starting from the beginning
-- of that line
s = line..'G0'
-- If we have a column that isn't the beginning of the line, we add <N>l
-- where <N> is the number of characters to move to the right
if col > 1 then
s = s..(col - 1)..'l'
end
return s
end
-- Short wrapper to get the buffer number when executing an autocommand
function M.get_autocmd_bufnr()
local abuf = api.nvim_call_function('expand', {'<abuf>'})
return api.nvim_call_function('str2nr', {abuf})
end
-- Short wrapper to check if a specific global variable exists
function M.nvim_has_var(name)
return api.nvim_call_function('exists', {'g:'..name}) == 1
end
-- Short wrapper to load a spcific global variable if it exists, returning
-- the default value if it does not
function M.nvim_get_var_or_default(name, default)
if M.nvim_has_var(name) then
return api.nvim_get_var(name)
else
return default
end
end
-- Short wrapper to remove a global variable if it exists, returning its
-- value; if it does not exist, nil is returned
function M.nvim_remove_var(name)
if not M.nvim_has_var(name) then
return nil
end
local value = api.nvim_get_var(name)
api.nvim_del_var(name)
return value
end
-- Short wrapper to remove a global variable if it exists, returning its
-- value; if it does not exist, nil is returned
--
-- NOTE: nvim_call_atomic seems to not be available via the Lua API right now,
-- so this is only kept here in case it becomes available later
function M.__unused_nvim_remove_var(name)
local results, errors = unpack(api.nvim_call_atomic({
{'nvim_get_var', {name}},
{'nvim_del_var', {name}},
}))
-- For now, we assume that if any error occurred, this was a failure
--
-- There is an edge case of get succeeding and del failing, but in that
-- case I'd rather flag it as an error as opposed to having the variable
-- floating around
if errors then
return nil
else
-- Otherwise, the very first result is our variable's value
local value = unpack(results)
return value
end
end
-- Returns a string with the given prefix removed if it is found in the string
function M.strip_prefix(s, prefix)
local offset = string.find(s, prefix, 1, true)
if offset == 1 then
return string.sub(s, string.len(prefix) + 1)
else
return s
end
end
-- Returns the value from the provided table using the given path to get to
-- it; if the table is nil or the path is unable to be completed, nil is returned
function M.get(tbl, path)
local keys = vim.split(path, '.', true)
local value = tbl
for i = 1, #keys do
value = value[keys[i]]
if value == nil or i == #keys then
return value
end
end
end
-- Returns the maximum value from the array, or nil if there are no elements
function M.max(array)
if not M.is_empty(array) then
local max = nil
for _, value in ipairs(array) do
if not max or value > max then
max = value
end
end
return max
end
end
-- Returns the minimum value from the array, or nil if there are no elements
function M.min(array)
if not M.is_empty(array) then
local min = nil
for _, value in ipairs(array) do
if not min or value < min then
min = value
end
end
return min
end
end
-- Maps and filters out nil elements in an array using the given function,
-- returning nil if given nil as the array
function M.filter_map(array, f)
if array == nil then
return nil
end
local new_array = {}
for i,v in ipairs(array) do
local el = f(v)
if el then
table.insert(new_array, el)
end
end
return new_array
end
-- Concats an array using the provided separator, returning the resulting
-- string if non-empty, otherwise will return nil
function M.concat_nonempty(array, sep)
if array and #array > 0 then
return table.concat(array, sep)
end
end
-- Checks if an array is empty, returning true if not nil and not empty
function M.is_empty(array)
return next(array or {}) == nil
end
-- Interpolates a string similar to Rust's println!(...) using {} to mark
-- a replacement and replacing one {} at a time using the given varargs
--
-- Does not check for dangling {} or missing {}!
function M.interpolate(s, ...)
-- For each item provided, we will replace the next instance of {} with it
for i = 1, select('#', ...) do
local item = select(i, ...)
s = string.gsub(s, '{}', item, 1)
end
return s
end
-- Interpolates variables provided in the form of {name="value", name_two=3}
-- into a string using $name and $name_two
--
-- Converts values from variables table into their tostring form. If value is
-- nil, the key/value pair is removed.
--
-- Names only allow alphanumeric characters and underscores
function M.interpolate_vars(s, variables)
local clean_variables = {}
-- Iterate through variables table, removing nil values and tostring-ing
-- all of the other values so they can be provided to gsub
for k, v in pairs(variables) do
if v ~= nil then
clean_variables[k] = tostring(v)
end
end
return string.gsub(s, '%$([%w_]+)', clean_variables)
end
-- Compresses a string by trimming whitespace on each line and replacing
-- newlines with a single space so that it can be sent as a single
-- line to command line interfaces while also ensuring that lines aren't
-- accidentally merged together
function M.compress(s)
return M.concat_nonempty(
M.filter_map(
vim.split(s, '\n', true),
(function(line)
return vim.trim(line)
end)
),
' '
)
end
-- Mirror of neovim 0.5's vim.api.nvim_exec() using a temporary file and
-- sourcing it to perform the evaluation
function M.nvim_exec(code, ret)
local lines = vim.split(code, '\n', true)
local tmp_path = api.nvim_call_function('tempname', {})
api.nvim_call_function('writefile', {lines, tmp_path, 'bS'})
local result = nil
if ret then
result = api.nvim_command_output('source '..tmp_path)
else
api.nvim_command('source '..tmp_path)
end
-- api.nvim_command('redir! END')
api.nvim_call_function('delete', {tmp_path})
return result
end
-- Returns true if provided string starts with other string
function M.starts_with(s, start)
return s ~= nil and start ~= nil and string.sub(s, 1, string.len(start)) == start
end
-- Escapes newline characters (and removes null byte characters)
function M.escape_newline(s)
s = string.gsub(s, '\0', '')
s = string.gsub(s, '\n', '\\n')
return s
end
-- Wrapper to provide clearer len check
function M.len(t)
return table.getn(t or {})
end
-- Converts a table to its values as a string, rather than a pointer
-- From https://stackoverflow.com/a/6081639
function M.serialize_table(val, name, skipnewlines, depth)
skipnewlines = skipnewlines or false
depth = depth or 0
local tmp = string.rep(" ", depth)
if name then tmp = tmp .. tostring(name) .. " = " end
if type(val) == "table" then
tmp = tmp .. "{" .. (not skipnewlines and "\n" or "")
for k, v in pairs(val) do
tmp = tmp .. M.serialize_table(v, k, skipnewlines, depth + 1) .. "," .. (not skipnewlines and "\n" or "")
end
tmp = tmp .. string.rep(" ", depth) .. "}"
elseif type(val) == "number" then
tmp = tmp .. tostring(val)
elseif type(val) == "string" then
tmp = tmp .. string.format("%q", val)
elseif type(val) == "boolean" then
tmp = tmp .. (val and "true" or "false")
else
tmp = tmp .. "\"[inserializeable datatype:" .. type(val) .. "]\""
end
return tmp
end
return M
|
pg = pg or {}
pg.guild_event_node = {
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 1,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17002,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 2,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17012,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 3,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17022,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 4,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17032,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 5,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17042,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 6,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17002,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 7,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17012,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 8,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17022,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 9,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17032,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 10,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17042,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 11,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17003,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 12,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17013,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 13,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17023,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 14,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17033,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 15,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17043,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 16,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17003,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 17,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17013,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 18,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17023,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 19,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17033,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 20,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17043,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 21,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17002,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 22,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17012,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 23,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17022,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 24,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17032,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 25,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17042,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 26,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17002,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 27,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17012,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 28,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17022,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 29,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17032,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "轻松歼灭了出现的零星塞壬,$2舰队在搜索战场时获得了$1",
id = 30,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17042,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
{
item = "sairendanchuan",
success_describe = "经过激战,消灭了中型塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 31,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17003,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "经过激战,消灭了中型塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 32,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17013,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "经过激战,消灭了中型塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 33,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17023,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "经过激战,消灭了中型塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 34,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17033,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "经过激战,消灭了中型塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 35,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17043,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "经过激战,消灭了中型塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 36,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17003,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "经过激战,消灭了中型塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 37,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17013,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "经过激战,消灭了中型塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 38,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17023,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "经过激战,消灭了中型塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 39,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17033,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "经过激战,消灭了中型塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 40,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17043,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 41,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17002,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 42,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17012,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 43,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17022,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 44,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17032,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 45,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17042,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 46,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17002,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 47,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17012,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 48,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17022,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 49,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17032,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 50,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17042,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭了包含主力舰在内的多支塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 51,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17003,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭了包含主力舰在内的多支塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 52,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17013,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭了包含主力舰在内的多支塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 53,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17023,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭了包含主力舰在内的多支塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 54,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17033,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭了包含主力舰在内的多支塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 55,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17043,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭了包含主力舰在内的多支塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 56,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17003,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭了包含主力舰在内的多支塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 57,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17013,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭了包含主力舰在内的多支塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 58,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17023,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭了包含主力舰在内的多支塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 59,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17033,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭了包含主力舰在内的多支塞壬舰队,$2舰队在打扫战场时获得了$1",
id = 60,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17043,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 61,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17002,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 62,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17012,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 63,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17022,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 64,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17032,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 65,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17042,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 66,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17002,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 67,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17012,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 68,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17022,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 69,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17032,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "成功消灭小型塞壬舰队,$2舰队在搜索战场时获得了$1",
id = 70,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17042,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
{
item = "sairendanchuan",
success_describe = "经过苦战,消灭了塞壬主力舰队,$2舰队在打扫战场时获得了$1",
id = 71,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17003,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
{
item = "sairendanchuan",
success_describe = "经过苦战,消灭了塞壬主力舰队,$2舰队在打扫战场时获得了$1",
id = 72,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17013,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
{
item = "sairendanchuan",
success_describe = "经过苦战,消灭了塞壬主力舰队,$2舰队在打扫战场时获得了$1",
id = 73,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17023,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
{
item = "sairendanchuan",
success_describe = "经过苦战,消灭了塞壬主力舰队,$2舰队在打扫战场时获得了$1",
id = 74,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17033,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
{
item = "sairendanchuan",
success_describe = "经过苦战,消灭了塞壬主力舰队,$2舰队在打扫战场时获得了$1",
id = 75,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17043,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
{
item = "sairendanchuan",
success_describe = "经过苦战,消灭了塞壬主力舰队,$2舰队在打扫战场时获得了$1",
id = 76,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17003,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
{
item = "sairendanchuan",
success_describe = "经过苦战,消灭了塞壬主力舰队,$2舰队在打扫战场时获得了$1",
id = 77,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17013,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
{
item = "sairendanchuan",
success_describe = "经过苦战,消灭了塞壬主力舰队,$2舰队在打扫战场时获得了$1",
id = 78,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17023,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
{
item = "sairendanchuan",
success_describe = "经过苦战,消灭了塞壬主力舰队,$2舰队在打扫战场时获得了$1",
id = 79,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17033,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
{
item = "sairendanchuan",
success_describe = "经过苦战,消灭了塞壬主力舰队,$2舰队在打扫战场时获得了$1",
id = 80,
icon = "battle",
fail_describe = "$2舰队报告,敌人逃离了战场,未能取得有效战果,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17043,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
[1001] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1001,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17002,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
[1002] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1002,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17012,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
[1003] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1003,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17022,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
[1004] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1004,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17032,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
[1005] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1005,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17042,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
[1006] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1006,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17002,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
[1007] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1007,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17012,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
[1008] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1008,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17022,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
[1009] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1009,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17032,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
[1010] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1010,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
22
},
{
2,
17042,
2
}
},
fail_award = {
{
1,
8,
10
}
}
},
[1011] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1011,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17003,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1012] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1012,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17013,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1013] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1013,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17023,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1014] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1014,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17033,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1015] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1015,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17043,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1016] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1016,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17003,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1017] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1017,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17013,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1018] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1018,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17023,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1019] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1019,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17033,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1020] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1020,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17043,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1021] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1021,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17002,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1022] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1022,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17012,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1023] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1023,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17022,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1024] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1024,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17032,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1025] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1025,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17042,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1026] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1026,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17002,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1027] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1027,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17012,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1028] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1028,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17022,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1029] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1029,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17032,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1030] = {
item = "box",
success_describe = "$2舰队发现了一些塞壬的储备物资,指挥部回收后,获得了$1",
id = 1030,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
24
},
{
2,
17042,
2
}
},
fail_award = {
{
1,
8,
11
}
}
},
[1031] = {
item = "box",
success_describe = "$2舰队发现了完整的常规塞壬设备,指挥部回收后,获得了$1",
id = 1031,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17003,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1032] = {
item = "box",
success_describe = "$2舰队发现了完整的常规塞壬设备,指挥部回收后,获得了$1",
id = 1032,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17013,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1033] = {
item = "box",
success_describe = "$2舰队发现了完整的常规塞壬设备,指挥部回收后,获得了$1",
id = 1033,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17023,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1034] = {
item = "box",
success_describe = "$2舰队发现了完整的常规塞壬设备,指挥部回收后,获得了$1",
id = 1034,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17033,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1035] = {
item = "box",
success_describe = "$2舰队发现了完整的常规塞壬设备,指挥部回收后,获得了$1",
id = 1035,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17043,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1036] = {
item = "box",
success_describe = "$2舰队发现了完整的常规塞壬设备,指挥部回收后,获得了$1",
id = 1036,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17003,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1037] = {
item = "box",
success_describe = "$2舰队发现了完整的常规塞壬设备,指挥部回收后,获得了$1",
id = 1037,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17013,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1038] = {
item = "box",
success_describe = "$2舰队发现了完整的常规塞壬设备,指挥部回收后,获得了$1",
id = 1038,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17023,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1039] = {
item = "box",
success_describe = "$2舰队发现了完整的常规塞壬设备,指挥部回收后,获得了$1",
id = 1039,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17033,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1040] = {
item = "box",
success_describe = "$2舰队发现了完整的常规塞壬设备,指挥部回收后,获得了$1",
id = 1040,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17043,
2
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1041] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1041,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17002,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1042] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1042,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17012,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1043] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1043,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17022,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1044] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1044,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17032,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1045] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1045,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17042,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1046] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1046,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17002,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1047] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1047,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17012,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1048] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1048,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17022,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1049] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1049,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17032,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1050] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1050,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
26
},
{
2,
17042,
3
}
},
fail_award = {
{
1,
8,
12
}
}
},
[1051] = {
item = "box",
success_describe = "$2舰队发现了型号未知的塞壬设备,指挥部回收后,获得了$1",
id = 1051,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17003,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1052] = {
item = "box",
success_describe = "$2舰队发现了型号未知的塞壬设备,指挥部回收后,获得了$1",
id = 1052,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17013,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1053] = {
item = "box",
success_describe = "$2舰队发现了型号未知的塞壬设备,指挥部回收后,获得了$1",
id = 1053,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17023,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1054] = {
item = "box",
success_describe = "$2舰队发现了型号未知的塞壬设备,指挥部回收后,获得了$1",
id = 1054,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17033,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1055] = {
item = "box",
success_describe = "$2舰队发现了型号未知的塞壬设备,指挥部回收后,获得了$1",
id = 1055,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17043,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1056] = {
item = "box",
success_describe = "$2舰队发现了型号未知的塞壬设备,指挥部回收后,获得了$1",
id = 1056,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17003,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1057] = {
item = "box",
success_describe = "$2舰队发现了型号未知的塞壬设备,指挥部回收后,获得了$1",
id = 1057,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17013,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1058] = {
item = "box",
success_describe = "$2舰队发现了型号未知的塞壬设备,指挥部回收后,获得了$1",
id = 1058,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17023,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1059] = {
item = "box",
success_describe = "$2舰队发现了型号未知的塞壬设备,指挥部回收后,获得了$1",
id = 1059,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17033,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1060] = {
item = "box",
success_describe = "$2舰队发现了型号未知的塞壬设备,指挥部回收后,获得了$1",
id = 1060,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17043,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1061] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1061,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17002,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1062] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1062,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17012,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1063] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1063,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17022,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1064] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1064,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17032,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1065] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1065,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17042,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1066] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1066,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17002,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1067] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1067,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17012,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1068] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1068,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17022,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1069] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1069,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17032,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1070] = {
item = "box",
success_describe = "$2舰队发现了遗留的塞壬科技部件,指挥部回收后,获得了$1",
id = 1070,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
28
},
{
2,
17042,
3
}
},
fail_award = {
{
1,
8,
13
}
}
},
[1071] = {
item = "box",
success_describe = "$2舰队发现了难以解读的信息存储设备,指挥部回收后,获得了$1",
id = 1071,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17003,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
[1072] = {
item = "box",
success_describe = "$2舰队发现了难以解读的信息存储设备,指挥部回收后,获得了$1",
id = 1072,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17013,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
[1073] = {
item = "box",
success_describe = "$2舰队发现了难以解读的信息存储设备,指挥部回收后,获得了$1",
id = 1073,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17023,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
[1074] = {
item = "box",
success_describe = "$2舰队发现了难以解读的信息存储设备,指挥部回收后,获得了$1",
id = 1074,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17033,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
[1075] = {
item = "box",
success_describe = "$2舰队发现了难以解读的信息存储设备,指挥部回收后,获得了$1",
id = 1075,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17043,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
[1076] = {
item = "box",
success_describe = "$2舰队发现了难以解读的信息存储设备,指挥部回收后,获得了$1",
id = 1076,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17003,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
[1077] = {
item = "box",
success_describe = "$2舰队发现了难以解读的信息存储设备,指挥部回收后,获得了$1",
id = 1077,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17013,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
[1078] = {
item = "box",
success_describe = "$2舰队发现了难以解读的信息存储设备,指挥部回收后,获得了$1",
id = 1078,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17023,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
[1079] = {
item = "box",
success_describe = "$2舰队发现了难以解读的信息存储设备,指挥部回收后,获得了$1",
id = 1079,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17033,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
[1080] = {
item = "box",
success_describe = "$2舰队发现了难以解读的信息存储设备,指挥部回收后,获得了$1",
id = 1080,
icon = "box",
fail_describe = "虽然$2舰队进行了全面的搜索,但并没有获得太有价值的东西,获得了$1",
success_award = {
{
1,
8,
30
},
{
2,
17043,
3
}
},
fail_award = {
{
1,
8,
14
}
}
},
all = {
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71,
72,
73,
74,
75,
76,
77,
78,
79,
80,
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
1010,
1011,
1012,
1013,
1014,
1015,
1016,
1017,
1018,
1019,
1020,
1021,
1022,
1023,
1024,
1025,
1026,
1027,
1028,
1029,
1030,
1031,
1032,
1033,
1034,
1035,
1036,
1037,
1038,
1039,
1040,
1041,
1042,
1043,
1044,
1045,
1046,
1047,
1048,
1049,
1050,
1051,
1052,
1053,
1054,
1055,
1056,
1057,
1058,
1059,
1060,
1061,
1062,
1063,
1064,
1065,
1066,
1067,
1068,
1069,
1070,
1071,
1072,
1073,
1074,
1075,
1076,
1077,
1078,
1079,
1080
}
}
return
|
--[[--------------------------------------------------------
-- Dragoon Framework - A Framework for Lua --
-- Copyright (c) 2014-2015 TsT worldmaster.fr --
--]]--------------------------------------------------------
-- Lua 5.2 have the ./?/init.lua in his path, but not Lua 5.1.
-- This module fix the problem by adding "./?/init.lua" after "./?.lua" if found
local function fix(path)
local p2 = ";" .. path .. ";"
if not p2:find(";./?/init.lua;", nil, true) then
local b, e = p2:find(";./?.lua;", nil, "plain")
return p2:sub(2, e) .. "./?/init.lua" .. p2:sub(e, -2)
end
return path
end
local function install()
local package = require("package")
-- check if the lua path separator character is still the same.
if package.config:sub(3,3) ~= ";" then
error("the lua path separator should be a ';'. Please fix the pathfix.lua script nefore using it.", 2)
end
package.path = fix(package.path)
end
return {
fix = fix,
install = install,
autoinstall = true,
}
|
-----------------------------------
-- Ability: Convert
-- Swaps current HP with MP.
-- Obtained: Red Mage Level 40
-- Recast Time: 10:00
-- Duration: Instant
-----------------------------------
require("scripts/globals/status")
-----------------------------------
function onAbilityCheck(player,target,ability)
return 0,0
end
function onUseAbility(player,target,ability)
local MP = player:getMP()
local HP = player:getHP()
if MP > 0 then
-- Murgleis sword augments Convert.
if player:getMod(tpz.mod.AUGMENTS_CONVERT) > 0 and HP > player:getMaxHP()/2 then
HP = HP * player:getMod(tpz.mod.AUGMENTS_CONVERT)
end
player:setHP(MP)
player:setMP(HP)
end
end
|
local sha1 = {
_VERSION = "sha.lua 0.5.0",
_URL = "https://github.com/kikito/sha.lua",
_DESCRIPTION = [[
SHA-1 secure hash computation, and HMAC-SHA1 signature computation in Lua (5.1)
Based on code originally by Jeffrey Friedl (http://regex.info/blog/lua/sha1)
And modified by Eike Decker - (http://cube3d.de/uploads/Main/sha1.txt)
]],
_LICENSE = [[
MIT LICENSE
Copyright (c) 2013 Enrique García Cota + Eike Decker + Jeffrey Friedl
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.
]]
}
-----------------------------------------------------------------------------------
-- loading this file (takes a while but grants a boost of factor 13)
local PRELOAD_CACHE = true
local BLOCK_SIZE = 64 -- 512 bits
-- local storing of global functions (minor speedup)
local floor,modf = math.floor,math.modf
local char,format,rep = string.char,string.format,string.rep
-- merge 4 bytes to an 32 bit word
local function bytes_to_w32(a,b,c,d) return a*0x1000000+b*0x10000+c*0x100+d end
-- split a 32 bit word into four 8 bit numbers
local function w32_to_bytes(i)
return floor(i/0x1000000)%0x100,floor(i/0x10000)%0x100,floor(i/0x100)%0x100,i%0x100
end
-- shift the bits of a 32 bit word. Don't use negative values for "bits"
local function w32_rot(bits,a)
local b2 = 2^(32-bits)
local a,b = modf(a/b2)
return a+b*b2*(2^(bits))
end
-- caching function for functions that accept 2 arguments, both of values between
-- 0 and 255. The function to be cached is passed, all values are calculated
-- during loading and a function is returned that returns the cached values (only)
local function cache2arg(fn)
if not PRELOAD_CACHE then return fn end
local lut = {}
for i=0,0xffff do
local a,b = floor(i/0x100),i%0x100
lut[i] = fn(a,b)
end
return function(a,b)
return lut[a*0x100+b]
end
end
-- splits an 8-bit number into 8 bits, returning all 8 bits as booleans
local function byte_to_bits(b)
local b = function(n)
local b = floor(b/n)
return b%2==1
end
return b(1),b(2),b(4),b(8),b(16),b(32),b(64),b(128)
end
-- builds an 8bit number from 8 booleans
local function bits_to_byte(a,b,c,d,e,f,g,h)
local function n(b,x) return b and x or 0 end
return n(a,1)+n(b,2)+n(c,4)+n(d,8)+n(e,16)+n(f,32)+n(g,64)+n(h,128)
end
-- bitwise "and" function for 2 8bit number
local band = cache2arg (function(a,b)
local A,B,C,D,E,F,G,H = byte_to_bits(b)
local a,b,c,d,e,f,g,h = byte_to_bits(a)
return bits_to_byte(
A and a, B and b, C and c, D and d,
E and e, F and f, G and g, H and h)
end)
-- bitwise "or" function for 2 8bit numbers
local bor = cache2arg(function(a,b)
local A,B,C,D,E,F,G,H = byte_to_bits(b)
local a,b,c,d,e,f,g,h = byte_to_bits(a)
return bits_to_byte(
A or a, B or b, C or c, D or d,
E or e, F or f, G or g, H or h)
end)
-- bitwise "xor" function for 2 8bit numbers
local bxor = cache2arg(function(a,b)
local A,B,C,D,E,F,G,H = byte_to_bits(b)
local a,b,c,d,e,f,g,h = byte_to_bits(a)
return bits_to_byte(
A ~= a, B ~= b, C ~= c, D ~= d,
E ~= e, F ~= f, G ~= g, H ~= h)
end)
-- bitwise complement for one 8bit number
local function bnot(x)
return 255-(x % 256)
end
-- creates a function to combine to 32bit numbers using an 8bit combination function
local function w32_comb(fn)
return function(a,b)
local aa,ab,ac,ad = w32_to_bytes(a)
local ba,bb,bc,bd = w32_to_bytes(b)
return bytes_to_w32(fn(aa,ba),fn(ab,bb),fn(ac,bc),fn(ad,bd))
end
end
-- create functions for and, xor and or, all for 2 32bit numbers
local w32_and = w32_comb(band)
local w32_xor = w32_comb(bxor)
local w32_or = w32_comb(bor)
-- xor function that may receive a variable number of arguments
local function w32_xor_n(a,...)
local aa,ab,ac,ad = w32_to_bytes(a)
for i=1,select('#',...) do
local ba,bb,bc,bd = w32_to_bytes(select(i,...))
aa,ab,ac,ad = bxor(aa,ba),bxor(ab,bb),bxor(ac,bc),bxor(ad,bd)
end
return bytes_to_w32(aa,ab,ac,ad)
end
-- combining 3 32bit numbers through binary "or" operation
local function w32_or3(a,b,c)
local aa,ab,ac,ad = w32_to_bytes(a)
local ba,bb,bc,bd = w32_to_bytes(b)
local ca,cb,cc,cd = w32_to_bytes(c)
return bytes_to_w32(
bor(aa,bor(ba,ca)), bor(ab,bor(bb,cb)), bor(ac,bor(bc,cc)), bor(ad,bor(bd,cd))
)
end
-- binary complement for 32bit numbers
local function w32_not(a)
return 4294967295-(a % 4294967296)
end
-- adding 2 32bit numbers, cutting off the remainder on 33th bit
local function w32_add(a,b) return (a+b) % 4294967296 end
-- adding n 32bit numbers, cutting off the remainder (again)
local function w32_add_n(a,...)
for i=1,select('#',...) do
a = (a+select(i,...)) % 4294967296
end
return a
end
-- converting the number to a hexadecimal string
local function w32_to_hexstring(w) return format("%08x",w) end
local function hex_to_binary(hex)
return hex:gsub('..', function(hexval)
return string.char(tonumber(hexval, 16))
end)
end
-- building the lookuptables ahead of time (instead of littering the source code
-- with precalculated values)
local xor_with_0x5c = {}
local xor_with_0x36 = {}
for i=0,0xff do
xor_with_0x5c[char(i)] = char(bxor(i,0x5c))
xor_with_0x36[char(i)] = char(bxor(i,0x36))
end
-- base64 encoding
-- character table string
local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
-- encoding
local function to_base64(data)
return ((data:gsub('.', function(x)
local r,b='',x:byte()
for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
return r;
end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
if (#x < 6) then return '' end
local c=0
for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end
return b:sub(c+1,c+1)
end)..({ '', '==', '=' })[#data%3+1])
end
-- decoding
local function from_base64(data)
data = string.gsub(data, '[^'..b..'=]', '')
return (data:gsub('.', function(x)
if (x == '=') then return '' end
local r,f='',(b:find(x)-1)
for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end
return r;
end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x)
if (#x ~= 8) then return '' end
local c=0
for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end
return string.char(c)
end))
end
-----------------------------------------------------------------------------
-- calculating the SHA1 for some text
function sha1.sha1(msg)
local H0,H1,H2,H3,H4 = 0x67452301,0xEFCDAB89,0x98BADCFE,0x10325476,0xC3D2E1F0
local msg_len_in_bits = #msg * 8
local first_append = char(0x80) -- append a '1' bit plus seven '0' bits
local non_zero_message_bytes = #msg +1 +8 -- the +1 is the appended bit 1, the +8 are for the final appended length
local current_mod = non_zero_message_bytes % 64
local second_append = current_mod>0 and rep(char(0), 64 - current_mod) or ""
-- now to append the length as a 64-bit number.
local B1, R1 = modf(msg_len_in_bits / 0x01000000)
local B2, R2 = modf( 0x01000000 * R1 / 0x00010000)
local B3, R3 = modf( 0x00010000 * R2 / 0x00000100)
local B4 = 0x00000100 * R3
local L64 = char( 0) .. char( 0) .. char( 0) .. char( 0) -- high 32 bits
.. char(B1) .. char(B2) .. char(B3) .. char(B4) -- low 32 bits
msg = msg .. first_append .. second_append .. L64
assert(#msg % 64 == 0)
local chunks = #msg / 64
local W = { }
local start, A, B, C, D, E, f, K, TEMP
local chunk = 0
while chunk < chunks do
--
-- break chunk up into W[0] through W[15]
--
start,chunk = chunk * 64 + 1,chunk + 1
for t = 0, 15 do
W[t] = bytes_to_w32(msg:byte(start, start + 3))
start = start + 4
end
--
-- build W[16] through W[79]
--
for t = 16, 79 do
-- For t = 16 to 79 let Wt = S1(Wt-3 XOR Wt-8 XOR Wt-14 XOR Wt-16).
W[t] = w32_rot(1, w32_xor_n(W[t-3], W[t-8], W[t-14], W[t-16]))
end
A,B,C,D,E = H0,H1,H2,H3,H4
for t = 0, 79 do
if t <= 19 then
-- (B AND C) OR ((NOT B) AND D)
f = w32_or(w32_and(B, C), w32_and(w32_not(B), D))
K = 0x5A827999
elseif t <= 39 then
-- B XOR C XOR D
f = w32_xor_n(B, C, D)
K = 0x6ED9EBA1
elseif t <= 59 then
-- (B AND C) OR (B AND D) OR (C AND D
f = w32_or3(w32_and(B, C), w32_and(B, D), w32_and(C, D))
K = 0x8F1BBCDC
else
-- B XOR C XOR D
f = w32_xor_n(B, C, D)
K = 0xCA62C1D6
end
-- TEMP = S5(A) + ft(B,C,D) + E + Wt + Kt;
A,B,C,D,E = w32_add_n(w32_rot(5, A), f, E, W[t], K),
A, w32_rot(30, B), C, D
end
-- Let H0 = H0 + A, H1 = H1 + B, H2 = H2 + C, H3 = H3 + D, H4 = H4 + E.
H0,H1,H2,H3,H4 = w32_add(H0, A),w32_add(H1, B),w32_add(H2, C),w32_add(H3, D),w32_add(H4, E)
end
local f = w32_to_hexstring
return f(H0) .. f(H1) .. f(H2) .. f(H3) .. f(H4)
end
function sha1.binary(msg)
return hex_to_binary(sha1.sha1(msg))
end
function sha1.base64(msg)
return sha1.to_base64(sha1.binary(msg))
end
function sha1.hmac(key, text)
assert(type(key) == 'string', "key passed to sha1.hmac should be a string")
assert(type(text) == 'string', "text passed to sha1.hmac should be a string")
if #key > BLOCK_SIZE then
key = sha1.binary(key)
end
local key_xord_with_0x36 = key:gsub('.', xor_with_0x36) .. string.rep(string.char(0x36), BLOCK_SIZE - #key)
local key_xord_with_0x5c = key:gsub('.', xor_with_0x5c) .. string.rep(string.char(0x5c), BLOCK_SIZE - #key)
return sha1.sha1(key_xord_with_0x5c .. sha1.binary(key_xord_with_0x36 .. text))
end
function sha1.hmac_binary(key, text)
return hex_to_binary(sha1.hmac(key, text))
end
setmetatable(sha1, {__call = function(_,msg) return sha1.sha1(msg) end })
return sha1
|
--------------------------------------------------------------------------
--------------------------------------------------------------------------
-- This class reads all the cache files in. It will on occasion
-- write a user cache file. This is a singleton class.
--
-- Rules: The rules about when to trust a cache file or not also when to
-- write a cache file out in the user directory.
--
-- 0. Cache files are trusted to know what module files are in the
-- MODULEPATH. This means that if one adds a modulefile WITHOUT
-- updating the cache, LMOD DOES NOT KNOW ABOUT IT!!!. This is
-- not a bug but a feature.
--
-- 1. A cache file can have a system timestamp associated with it.
-- If it does then as long as the cache file is the same or newer
-- then the timestamp then it is good forever.
-- 2. A cache file without a timestamp is considered good for no more
-- than "ancient" seconds old. It is whatever was configured with
-- Lmod. Typically "ancient" is 86400 seconds or 24 hours.
-- 3. Modulefiles under system control can (should?) have a timestamp
-- associated with but personal modulefiles typically do not.
-- 4. Any PATH in MODULEPATH that are not covered by any modulefiles
-- are walked. If the time associated with building the cache file
-- is short then no user cache file is written. Short is typically
-- 10 seconds and it is set at configure time.
-- @classmod Cache
local posix = require("posix")
_G._DEBUG = false
require("strict")
--------------------------------------------------------------------------
-- Lmod License
--------------------------------------------------------------------------
--
-- Lmod is licensed under the terms of the MIT license reproduced below.
-- This means that Lmod is free software and can be used for both academic
-- and commercial purposes at absolutely no cost.
--
-- ----------------------------------------------------------------------
--
-- Copyright (C) 2008-2018 Robert McLay
--
-- 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("myGlobals")
require("fileOps")
require("declare")
require("lmod_system_execute")
require("string_utils")
require("utils")
local CTimer = require("CTimer")
local FrameStk = require("FrameStk")
local M = {}
local MRC = require("MRC")
local ReadLmodRC = require('ReadLmodRC')
local Spider = require("Spider")
local concatTbl = table.concat
local cosmic = require("Cosmic"):singleton()
local dbg = require("Dbg"):dbg()
local hook = require("Hook")
local lfs = require("lfs")
local sort = table.sort
local s_cache = false
local timer = require("Timer"):singleton()
local ancient = cosmic:value("LMOD_ANCIENT_TIME")
local shortTime = cosmic:value("LMOD_SHORT_TIME")
local random = math.random
local randomseed = math.randomseed
--------------------------------------------------------------------------
-- This singleton construct reads the scDescriptT table that can be
-- defined in the lmodrc.lua. Typically this table, if it exists
-- by the configure script. If it does not then scDescriptT will
-- be an array with zero entries. This ctor finds all the system
-- and user directories where cache files are stored. It also
-- figure out the timestamps.
-- @param self A Cache object
-- @param t A table with possible dontWrite and quiet entries.
local function new(self, t)
local o = {}
setmetatable(o,self)
self.__index = self
dbg.start{"Cache:new()"}
local readLmodRC = ReadLmodRC:singleton()
local scDescriptT = readLmodRC:scDescriptT()
local scDirA = {}
local systemEpoch = epoch() - ancient
dbg.print{"#scDescriptT: ",#scDescriptT, "\n"}
local CLuaV = 0
for s in LuaV:split("%.") do
CLuaV = CLuaV*1000+tonumber(s)
end
CLuaV = tostring(CLuaV)
local compiled_ext_sys = "luac_"..LuaV
local compiled_ext_usr = "luac_"..CLuaV
for j = 1, #scDescriptT do
local entry = scDescriptT[j]
local tt = {}
if (entry.timestamp) then
local attr = lfs.attributes(entry.timestamp)
if (attr and type(attr) == "table") then
tt.lastUpdateEpoch = attr.modification
end
hook.apply("parse_updateFn", entry.timestamp, tt)
end
local lastUpdate = tt.lastUpdateEpoch or systemEpoch
local a = {}
if (tt.hostType and tt.hostType ~= "") then
a[#a+1] = tt.hostType
end
a[#a+1] = ""
for i = 1,#a do
local dir = pathJoin(entry.dir ,a[i])
local attr = lfs.attributes(dir) or {}
if (attr.mode == "directory") then
dbg.print{"Adding: dir: ",dir,", timestamp: ",lastUpdate, "\n"}
scDirA[#scDirA+1] =
{ fileA = { pathJoin(dir, "spiderT." .. compiled_ext_sys),
pathJoin(dir, "spiderT.old." .. compiled_ext_sys),
pathJoin(dir, "spiderT.lua"),
pathJoin(dir, "spiderT.old.lua"),
},
timestamp = lastUpdate,
fileT = "system",
}
break
end
end
end
local usrSpiderT = hook.apply("groupName","spiderT.lua")
local usrSpiderT_C = hook.apply("groupName","spiderT."..compiled_ext_usr)
local usrSpiderTFnA = {
{ fileA = { pathJoin(usrCacheDir, usrSpiderT_C),
pathJoin(usrCacheDir, usrSpiderT),
pathJoin(usrCacheDir, "spiderT."..compiled_ext_usr),
pathJoin(usrCacheDir, "spiderT.lua"),
},
fileT = "your",
timestamp = systemEpoch
},
}
t = t or {}
o.spiderDirT = {}
o.mDT = {}
o.usrCacheDir = usrCacheDir
o.usrCacheInvalidFn = pathJoin(usrCacheDir,"invalidated")
o.usrSpiderTFnA = usrSpiderTFnA
o.usrSpiderTFN = pathJoin(usrCacheDir,usrSpiderT)
o.systemDirA = scDirA
o.dontWrite = t.dontWrite or false
o.noMRC = t.noMRC or false
o.buildCache = false
o.buildFresh = false
o.quiet = t.quiet or false
o.dbT = {}
o.providedByT = {}
o.spiderT = {}
o.mpathMapT = {}
o.moduleDirA = {}
dbg.fini("Cache.new")
return o
end
local function uuid()
local time = epoch()
local seed = math.floor((time - math.floor(time))*1.0e+6)
if (seed == 0) then
seed = time
end
randomseed(seed)
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
return string.gsub(template, '[xy]', function (c)
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
return string.format('%x', v)
end)
end
--------------------------------------------------------------------------
-- This is the front-end to the singleton ctor. It
-- (obviously) constructs the static s_cache var once
-- then serves s_cache to subsequent callers. Since
-- the MODULEPATH can change during execution, we set
-- spiderDirT[path] to -1 for any we have not already
-- processed.
-- @param self a Cache object
-- @param t A table with possible dontWrite and quiet entries.
-- @return A singleton Cache object.
function M.singleton(self, t)
dbg.start{"Cache:cache()"}
t = t or {}
if (not s_cache) then
s_cache = new(self, t)
end
s_cache.quiet = t.quiet or s_cache.quiet
if (t.buildCache) then
s_cache.buildCache = t.buildCache
end
if (t.buildFresh) then
s_cache.buildFresh = t.buildFresh
end
dbg.print{"s_cache.buildCache: ",self.buildCache,"\n"}
local frameStk = FrameStk:singleton()
local mt = frameStk:mt()
local mpathA = mt:modulePathA()
-- Since this function can get called many times, we need to only recompute
-- on the directories we have not yet seen.
local mDT = s_cache.mDT
local spiderDirT = s_cache.spiderDirT
for i = 1, #mpathA do
local mpath = mpathA[i]
if (isDir(mpath)) then
local attr = lfs.attributes(mpath) or {}
if (attr.mode == "directory") then
mDT[mpath] = mDT[mpath] or -1
spiderDirT[mpath] = spiderDirT[mpath] or false
dbg.print{"spiderDirT[",mpath,"]: ",spiderDirT[mpath], "\n",level=2}
end
end
end
dbg.fini("Cache:cache")
return s_cache
end
--------------------------------------------------------------------------
-- This routine finds and reads in a cache file. If it
-- finds a cache file is simply does a "loadfile" on it
-- and updates moduleT and spiderDirT.
-- @param self a Cache object
-- @param spiderTFnA An array of cache files to read and process.
-- @return the number of directories read.
local function l_readCacheFile(self, spiderTFnA)
dbg.start{"Cache l_readCacheFile(spiderTFnA)"}
local dirsRead = 0
local ignore_cache = cosmic:value("LMOD_IGNORE_CACHE")
if (masterTbl().ignoreCache or ignore_cache) then
dbg.print{"LMOD_IGNORE_CACHE is true\n"}
dbg.fini("Cache l_readCacheFile")
return dirsRead
end
declare("spiderT")
declare("mpathMapT")
declare("mrcT")
local mDT = self.mDT
local mpathMapT = self.mpathMapT
local spiderDirT = self.spiderDirT
local spiderT = self.spiderT
local mrc = MRC:singleton()
dbg.print{"#spiderTFnA: ",#spiderTFnA,"\n"}
for i = 1,#spiderTFnA do
repeat
local fileA = spiderTFnA[i].fileA
local fn = false
local found = false
local attr = false
for j = 1,#fileA do
fn = fileA[j]
attr = lfs.attributes(fn) or {}
if (next(attr) ~= nil and attr.size > 0) then
found = true
break
else
dbg.print{"Did not find: ",fn,"\n"}
end
end
if (not found) then
dbg.print{"No cache files found\n"}
break
end
dbg.print{"cacheFile found: ",fn,"\n"}
-- Check Time
local diff = attr.modification - spiderTFnA[i].timestamp
local valid = diff >= 0
dbg.print{"valid: ",valid,", timeDiff: ",diff,"\n"}
if (valid) then
-- Check for matching default MODULEPATH.
local resultFunc = loadfile(fn)
if (resultFunc == nil) then
dbg.print{"Broken cache file: ",fn,"\n"}
break
end
resultFunc() --> Finish the loadfile()
if (_G.mrcT == nil or next(_G.mrcT) == nil) then
LmodError{msg="e_BrokenCacheFn",fn=fn}
end
mrc:import(_G.mrcT)
local G_spiderT = _G.spiderT
for k, v in pairs(G_spiderT) do
--dbg.print{"spiderT dir: ", k,", mDT[k]: ",mDT[k],"\n"}
if ( k:sub(1,1) == '/' ) then
local dirTime = mDT[k] or 0
if (attr.modification > dirTime) then
k = path_regularize(k)
mDT[k] = attr.modification
spiderDirT[k] = true
spiderT[k] = v
dirsRead = dirsRead + 1
end
else
spiderT[k] = spiderT[k] or v
end
end
local G_mpathMapT = _G.mpathMapT
for k, v in pairs(G_mpathMapT) do
mpathMapT[k] = v
end
end
until true
end
dbg.fini("Cache l_readCacheFile")
return dirsRead
end
--------------------------------------------------------------------------
-- This is the client code interface to getting the cache
-- files. It is also responsible for writing the user cache
-- file if it takes to long to build the cache data. If the
-- data already exists from previous calls then it just
-- re-used. If there are any directories that are not known
-- then this function call on Spider:findAllModules() to build
-- the cache data that is not known.
--
-- If the time to rebuild the cache is quick (time < short) then
-- the build time is recorded in the ModuleTable. That way if
-- it is quick, Lmod will report that it is rebuilding the spider
-- cache the first time but not any other times during a login
-- session.
--
-- There is a hook function "writeCache" that gets called.
-- There may be times when the cache file should never be written.
-- For example, if you have a build machine where packages
-- and modulefiles are being generated at random times then
-- the cache file could be out-of-date. So instead of trying
-- to rebuild the cache file every second, just do not write it
-- and live with slightly slower response time from Lmod.
--
-- The "fast" option. Lmod starts up in "fast" mode.
-- This mode means that Lmod will try to read any cache files
-- if it finds none, it doesn't try to build them, instead
-- Lmod will walk only the directories in MODULEPATH and not
-- spider everything.
--
-- @param self a Cache object
-- @param fast if true then only read cache files, do not build them.
function M.build(self, fast)
dbg.start{"Cache:build(fast=", fast,")"}
local spiderT = self.spiderT
local dbT = self.dbT
local providedByT = self.providedByT
local mpathMapT = self.mpathMapT
local spider = Spider:new()
-------------------------------------------------------------------
-- Ctor w/o system or user MODULERC files. We will update when
-- we need to.
local mrc = MRC:singleton({})
dbg.print{"self.buildCache: ",self.buildCache,"\n"}
if (not self.buildCache) then
dbg.fini("Cache:build")
mrc:update()
return false, false, false, false
end
if (next(spiderT) ~= nil) then
dbg.print{"Using pre-built spiderT!\n"}
dbg.fini("Cache:build")
return spiderT, dbT, mpathMapT, providedByT
end
local Pairs = dbg.active() and pairsByKeys or pairs
local frameStk = FrameStk:singleton()
local mt = frameStk:mt()
local mpathA = mt:modulePathA()
local masterTbl = masterTbl()
local T1 = epoch()
local sysDirsRead = 0
dbg.print{"buildFresh: ",self.buildFresh,"\n"}
if (not (self.buildFresh or masterTbl.checkSyntax)) then
sysDirsRead = l_readCacheFile(self, self.systemDirA)
end
------------------------------------------------------------------------
-- Read user cache file if it exists and is not out-of-date.
local spiderDirT = self.spiderDirT
local usrDirsRead = 0
if (not (self.buildFresh or isFile(self.usrCacheInvalidFn))) then
usrDirsRead = l_readCacheFile(self, self.usrSpiderTFnA)
end
local mpathT = {}
for i = 1, #mpathA do
mpathT[mpathA[i]] = i
end
local dirA = {}
local numMDT = 0
for k, v in Pairs(spiderDirT) do
numMDT = numMDT + 1
if (not v) then
dbg.print{"rebuilding cache for directory: ",k,"\n"}
local idx = mpathT[k] or 0
dirA[#dirA+1] = { mpath = k, idx = idx}
end
end
local function cmp(a,b)
return a.idx < b.idx
end
sort(dirA, cmp)
local mpA = {}
for i = 1, #dirA do
mpA[#mpA+1] = dirA[i].mpath
end
local dirsRead = sysDirsRead + usrDirsRead
if (dirsRead == 0 and fast and numMDT == #dirA) then
dbg.print{"Fast and dirsRead: ",dirsRead,"\n"}
dbg.fini("Cache:build")
mrc:update()
return false, false, false, false
end
local userSpiderTFN = self.usrSpiderTFN
local buildSpiderT = (#dirA > 0)
local userSpiderT = {}
dbg.print{"buildSpiderT: ",buildSpiderT,"\n"}
dbg.print{"mt: ", tostring(mt), "\n",level=2}
local short = mt:getShortTime()
if (not buildSpiderT) then
mt:setRebuildTime(ancient, short)
else
local tracing = cosmic:value("LMOD_TRACING")
if (tracing == "yes") then
local shell = _G.Shell
local stackDepth = FrameStk:singleton():stackDepth()
local indent = (" "):rep(stackDepth+1)
local b = {}
b[#b + 1] = indent
b[#b + 1] = "Building Spider cache for the following dir(s): "
b[#b + 1] = concatTbl(mpA,", ")
b[#b + 1] = "\n"
shell:echo(concatTbl(b,""))
end
local prtRbMsg = ((not quiet()) and
(not masterTbl.initial) and
((not short) or (short > shortTime)) and
(not self.quiet)
)
dbg.print{"short: ", short, ", shortTime: ", shortTime,"\n", level=2}
dbg.print{"quiet: ", quiet(),", initial: ", masterTbl.initial,"\n"}
dbg.print{"prtRbMsg: ",prtRbMsg,", quiet: ",self.quiet,"\n"}
local threshold = cosmic:value("LMOD_THRESHOLD")
local cTimer = CTimer:singleton("Rebuilding cache, please wait ...",
threshold, prtRbMsg, masterTbl.timeout)
local mcp_old = mcp
dbg.print{"Setting mcp to ", mcp:name(),"\n"}
mcp = MasterControl.build("spider")
local t1 = epoch()
local ok, msg = pcall(Spider.findAllModules, spider, mpA, userSpiderT)
if (not ok) then
if (msg) then io.stderr:write("Msg: ",msg,'\n') end
LmodSystemError{msg="e_Spdr_Timeout"}
end
local t = masterTbl.mpathMapT
if (next(t) ~= nil) then
for k,v in pairs(t) do
mpathMapT[k] = v
end
end
local t2 = epoch()
mcp = mcp_old
dbg.print{"Setting mcp to ", mcp:name(),"\n"}
dbg.print{"t2-t1: ",t2-t1, " shortTime: ", shortTime, "\n", level=2}
local r = {}
hook.apply("writeCache",r)
dbg.print{"self.dontWrite: ", self.dontWrite, ", r.dontWriteCache: ",
r.dontWriteCache, "\n"}
local dontWrite = self.dontWrite or r.dontWriteCache or cosmic:value("LMOD_IGNORE_CACHE")
if (tracing == "yes") then
local shell = _G.Shell
local stackDepth = FrameStk:singleton():stackDepth()
local indent = (" "):rep(stackDepth+1)
local b = {}
b[#b + 1] = indent
b[#b + 1] = "completed building cache. Saving cache: "
b[#b + 1] = tostring(not(t2 - t1 < shortTime or dontWrite))
b[#b + 1] = "\n"
shell:echo(concatTbl(b,""))
end
local doneMsg
mrc = MRC:singleton()
if (t2 - t1 < shortTime or dontWrite) then
ancient = shortLifeCache
------------------------------------------------------------------------
-- This is a bit of a hack. Lmod needs to know the time it takes to
-- build the cache and it needs to store it in the ModuleTable. The
-- trouble is with regression testing. The module table is only written
-- out when it value changes. We do not want a new module written out
-- if the only thing that has changed is the slight variation that it
-- took to build the cache between Lmod command runs during a regression
-- test. So if the previous t2-t1 is also less than shortTime DO NOT
-- reset short to the new value.
local newShortTime = t2-t1
if (short and short < shortTime) then
newShortTime = short
end
mt:setRebuildTime(ancient, newShortTime)
dbg.print{"mt: ", tostring(mt), "\n", level=2}
doneMsg = " (not written to file) done"
else
mkdir_recursive(self.usrCacheDir)
local userSpiderTFN_new = userSpiderTFN .. "_" .. uuid()
local f = io.open(userSpiderTFN_new,"w")
if (f) then
os.rename(userSpiderTFN, userSpiderTFN .. "~")
local s0 = "-- Date: " .. os.date("%c",os.time()) .. "\n"
local s1 = "ancient = " .. tostring(math.floor(ancient)) .."\n"
local s2 = mrc:export()
local s3 = serializeTbl{name="spiderT", value=userSpiderT, indent=true}
local s4 = serializeTbl{name="mpathMapT", value=mpathMapT, indent=true}
f:write(s0,s1,s2,s3,s4)
f:close()
ok, msg = os.rename(userSpiderTFN_new, userSpiderTFN)
if (not ok) then
LmodError{msg="e_Unable_2_rename",from=userSpiderTFN_new,to=userSpiderTFN, errMsg=msg}
end
posix.unlink(userSpiderTFN .. "~")
dbg.print{"Wrote: ",userSpiderTFN,"\n"}
end
if (LUAC_PATH ~= "") then
if (LUAC_PATH:sub(1,1) == "@") then
LUAC_PATH="luac"
end
local ext = ".luac_"..LuaV
local fn = userSpiderTFN:gsub(".lua$",ext)
local a = {}
a[#a+1] = LUAC_PATH
a[#a+1] = "-o"
a[#a+1] = fn
a[#a+1] = userSpiderTFN
lmod_system_execute(concatTbl(a," "))
end
if (isFile(self.usrCacheInvalidFn)) then
dbg.print{"unlinking: ",self.usrCacheInvalidFn,"\n"}
posix.unlink(self.usrCacheInvalidFn)
end
local buildT = t2-t1
local ancient2 = math.min(buildT * 120, ancient)
mt:setRebuildTime(ancient2, buildT)
dbg.print{"mt: ", tostring(mt), "\n"}
doneMsg = " (written to file) done."
end
cTimer:done(doneMsg)
dbg.print{"Transfer from userSpiderT to spiderT\n"}
for k in Pairs(userSpiderT) do
dbg.print{"k: ",k,"\n"}
spiderT[k] = userSpiderT[k]
end
dbg.print{"Show that these directories have been walked\n"}
t2 = epoch()
for i = 1,#dirA do
local k = dirA[i]
spiderDirT[k] = t2
end
end
-- With a valid spiderT build dbT if necessary:
if (next(dbT) == nil or buildSpiderT) then
local mpathA = mt:modulePathA()
spider:buildDbT(mpathA, mpathMapT, spiderT, dbT)
spider:buildProvideByT(dbT, providedByT)
end
-- remove user cache file if old
if (isFile(userSpiderTFN)) then
local attr = lfs.attributes(userSpiderTFN)
local diff = os.time() - attr.modification
if (diff > ancient) then
posix.unlink(userSpiderTFN);
dbg.print{"Deleted: ",userSpiderTFN,"\n"}
end
end
local T2 = epoch()
timer:deltaT("Cache:build", T2 - T1)
if (not self.noMRC) then
mrc:update()
end
dbg.fini("Cache:build")
return spiderT, dbT, mpathMapT, providedByT
end
return M
|
local status_ok, presence = pcall(require, "presence")
if not status_ok then
return
end
presence:setup{
-- General options
auto_update = true,
neovim_image_text = "NeoVim",
main_image = "file",
-- client_id = "793271441293967371",
log_level = nil,
debounce_timeout = 10,
enable_line_number = false,
blacklist = {},
buttons = false,
-- Rich Presence text options
-- editing_text = "Editing %s",
-- file_explorer_text = "Browsing %s",
-- git_commit_text = "Committing changes",
-- plugin_manager_text = "Managing plugins",
-- reading_text = "Reading %s",
-- workspace_text = "%s",
-- line_number_text = "Line %s out of %s",
}
|
--[[
Title: share world to datasource
Author(s): big
CreateDate: 2017.05.12
ModifyDate: 2021.09.10
Desc: It can take snapshot for the current world. It can quick save or full save the world to datasource.
use the lib:
------------------------------------------------------------
local ShareWorld = NPL.load('(gl)Mod/WorldShare/cellar/ShareWorld/ShareWorld.lua')
ShareWorld:Init()
-------------------------------------------------------
]]
-- libs
local PackageShareWorld = commonlib.gettable('MyCompany.Aries.Creator.Game.Desktop.Areas.ShareWorldPage')
local WorldCommon = commonlib.gettable('MyCompany.Aries.Creator.WorldCommon')
local CommandManager = commonlib.gettable('MyCompany.Aries.Game.CommandManager')
local SessionsData = NPL.load('(gl)Mod/WorldShare/database/SessionsData.lua')
-- UI
local SyncMain = NPL.load('(gl)Mod/WorldShare/cellar/Sync/Main.lua')
local LoginModal = NPL.load('(gl)Mod/WorldShare/cellar/LoginModal/LoginModal.lua')
local Certificate = NPL.load('(gl)Mod/WorldShare/cellar/Certificate/Certificate.lua')
-- service
local Compare = NPL.load('(gl)Mod/WorldShare/service/SyncService/Compare.lua')
local LocalService = NPL.load('(gl)Mod/WorldShare/service/LocalService.lua')
local KeepworkService = NPL.load('(gl)Mod/WorldShare/service/KeepworkService.lua')
local KeepworkServiceProject = NPL.load('(gl)Mod/WorldShare/service/KeepworkService/Project.lua')
local KeepworkServiceSession = NPL.load('(gl)Mod/WorldShare/service/KeepworkService/Session.lua')
local ShareWorld = NPL.export()
function ShareWorld:Init(callback)
if KeepworkServiceSession:GetUserWhere() == 'LOCAL' and
not KeepworkServiceSession:IsSignedIn() then
return
end
self.callback = callback
local currentEnterWorld = Mod.WorldShare.Store:Get('world/currentEnterWorld')
-- read only world
if GameLogic.IsReadOnly() or not currentEnterWorld or currentEnterWorld.is_zip then
self:ShowWorldCode(currentEnterWorld.kpProjectId)
return
end
-- confirm preview jpg exist
if not GameLogic.IsReadOnly() and
not ParaIO.DoesFileExist(self:GetPreviewImagePath(), false) then
PackageShareWorld.TakeSharePageImage()
end
-- must login
if not KeepworkService:IsSignedIn() then
function Handle()
KeepworkServiceProject:GetProjectIdByWorldName(
currentEnterWorld.foldername,
currentEnterWorld.shared,
function()
Compare:GetCurrentWorldInfo(
function()
Compare:Init(currentEnterWorld.worldpath, function(result)
if result then
self:CheckRealName(function()
self:ShowPage()
end)
end
end)
end
)
end
)
end
LoginModal:ShowPage()
Mod.WorldShare.Store:Set('user/AfterLogined', Handle)
return
end
Mod.WorldShare.MsgBox:Wait()
Compare:Init(currentEnterWorld.worldpath, function(result)
Mod.WorldShare.MsgBox:Close()
if result then
self:CheckRealName(function()
self:ShowPage()
end)
end
end)
end
function ShareWorld:CheckRealName(callback)
if not callback or type(callback) ~= 'function' then
return false
end
if KeepworkServiceSession:IsRealName() then
callback()
else
local username = Mod.WorldShare.Store:Get('user/username')
local session = SessionsData:GetSessionByUsername(username)
if not session.doNotNoticeVerify then
Certificate:Init(function()
callback()
end)
else
callback()
end
end
end
function ShareWorld:ShowPage()
local params = Mod.WorldShare.Utils.ShowWindow(
640,
415,
'Mod/WorldShare/cellar/ShareWorld/Theme/ShareWorld.html',
'Mod.WorldShare.ShareWorld'
)
local filePath = self:GetPreviewImagePath()
if ParaIO.DoesFileExist(filePath) and params._page then
params._page:SetNodeValue('share_world_image', filePath)
end
self:Refresh()
end
function ShareWorld:GetPreviewImagePath()
return format('%spreview.jpg', ParaWorld.GetWorldDirectory() or '')
end
function ShareWorld:GetPage()
return Mod.WorldShare.Store:Get('page/Mod.WorldShare.ShareWorld')
end
function ShareWorld:ClosePage()
if self:GetPage() then
self:GetPage():CloseWindow()
end
end
function ShareWorld:Refresh()
if self:GetPage() then
self:GetPage():Refresh(0)
end
end
function ShareWorld:GetWorldSize()
local worldpath = ParaWorld.GetWorldDirectory()
if not worldpath then
return 0
end
local filesTotal = LocalService:GetWorldSize(worldpath)
return Mod.WorldShare.Utils.FormatFileSize(filesTotal)
end
function ShareWorld:GetRemoteRevision()
return tonumber(Mod.WorldShare.Store:Get('world/remoteRevision')) or 0
end
function ShareWorld:GetCurrentRevision()
return tonumber(Mod.WorldShare.Store:Get('world/currentRevision')) or 0
end
function ShareWorld:OnClick()
local canBeShare = true
local msg = ''
if WorldCommon:IsModified() then
canBeShare = false
msg = L'当前世界未保存,是否继续上传世界?'
end
if canBeShare and self:GetRemoteRevision() > self:GetCurrentRevision() then
canBeShare = false
msg = L'当前本地版本小于远程版本,是否继续上传?'
end
local function Handle()
Mod.WorldShare.Store:Set('world/currentWorld', Mod.WorldShare.Store:Get('world/currentEnterWorld'))
SyncMain:CheckTagName(function()
SyncMain:SyncToDataSource(function(result, msg)
Compare:GetCurrentWorldInfo(function()
if self.callback and type(self.callback) == 'function' then
self.callback(true)
end
end)
end)
self:ClosePage()
-- act week
if self:GetCurrentRevision() > self:GetRemoteRevision() then
local ActWeek = NPL.load('(gl)script/apps/Aries/Creator/Game/Tasks/ActWeek/ActWeek.lua')
if ActWeek then
ActWeek.AchieveActTarget()
end
end
end)
end
if not canBeShare then
_guihelper.MessageBox(
msg,
function(res)
if (res and res == 6) then
Handle()
end
end
)
return false
end
Handle()
end
function ShareWorld:Snapshot()
-- take a new screenshot
PackageShareWorld.TakeSharePageImage()
self:UpdateImage(true)
-- incremental version number if version equal
if self:GetRemoteRevision() == self:GetCurrentRevision() then
CommandManager:RunCommand('/save')
local currentRevision = tonumber(Mod.WorldShare.Store:Get('world/currentRevision')) or 0
currentRevision = currentRevision + 1
self:GetPage():SetUIValue('current_revision', currentRevision)
end
end
function ShareWorld:UpdateImage(bRefreshAsset)
if self:GetPage() then
local filePath = self:GetPreviewImagePath()
self:GetPage():SetUIValue('share_world_image', filePath)
self:Refresh()
-- release asset
if bRefreshAsset then
ParaAsset.LoadTexture('', filePath, 1):UnloadAsset()
end
end
end
function ShareWorld:ShowWorldCode(projectId)
Mod.WorldShare.MsgBox:Wait()
KeepworkServiceProject:GenerateMiniProgramCode(
projectId,
function(bSucceed, wxacode)
Mod.WorldShare.MsgBox:Close()
if not bSucceed then
GameLogic.AddBBS(nil, L'生成二维码失败', 3000, '255 0 0')
return
end
Mod.WorldShare.Utils.ShowWindow(
520,
305,
'Mod/WorldShare/cellar/ShareWorld/Code.html?wxacode='.. (wxacode or ''),
'Mod.WorldShare.ShareWorld.Code'
)
end
)
end
-- get keepwork project url
function ShareWorld:GetShareUrl()
local currentEnterWorld = Mod.WorldShare.Store:Get('world/currentEnterWorld')
if not currentEnterWorld or
not currentEnterWorld.kpProjectId or
currentEnterWorld.kpProjectId == 0 then
return ''
end
return format('%s/pbl/project/%d/', KeepworkService:GetKeepworkUrl(), currentEnterWorld.kpProjectId)
end
function ShareWorld:GetWorldName()
local currentEnterWorld = Mod.WorldShare.Store:Get('world/currentEnterWorld')
return currentEnterWorld.text or ''
end
|
class 'Ammunition' extends 'ActiveRecord::Base'
Ammunition:belongs_to 'Character'
|
--[[-----------------------------------------------------------------------------
* Infected Wars, an open source Garry's Mod game-mode.
*
* Infected Wars is the work of multiple authors,
* a full list can be found in CONTRIBUTORS.md.
* For more information, visit https://github.com/JarnoVgr/InfectedWars
*
* Infected Wars is free software: you can redistribute it and/or modify
* it under the terms of the MIT License.
*
* A full copy of the MIT License can be found in LICENSE.txt.
-----------------------------------------------------------------------------]]
if SERVER then
AddCSLuaFile("shared.lua")
end
SWEP.HoldType = "ar2"
if CLIENT then
SWEP.PrintName = "Vaporizer Rifle"
SWEP.Slot = 2
SWEP.SlotPos = 1
SWEP.ViewModelFlip = false
SWEP.ViewModelFOV = 60
SWEP.IconLetter = "8"
SWEP.SelectFont = "HL2MPTypeDeath"
killicon.AddFont("iw_vaporizer", "HL2MPTypeDeath", SWEP.IconLetter, Color(255, 80, 0, 255 ))
end
function SWEP:InitializeClientsideModels()
self.ViewModelBoneMods = {
["Reload1"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0, -13.625, 0) },
["Claw2"] = { scale = Vector(2, 2, 2), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Shell1"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Claw1"] = { scale = Vector(2, 2, 2), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Reload"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(0, -11.775, 0) },
["Vent"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bolt1"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bolt2"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Shell2"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) }
}
self.VElements = {
["ball1+"] = { type = "Model", model = "models/Effects/combineball.mdl", bone = "Shell2", rel = "", pos = Vector(0, 0, -0.47), angle = Angle(-90, 0, 0), size = Vector(0.079, 0.079, 0.079), color = Color(71, 197, 254, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },
["glow2"] = { type = "Sprite", sprite = "sprites/strider_blackball", bone = "Base", rel = "ball1+", pos = Vector(0, 0, 0), size = { x = 2.531, y = 2.531 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = false, vertexcolor = true, ignorez = false},
["ball1"] = { type = "Model", model = "models/Effects/combineball.mdl", bone = "Shell1", rel = "", pos = Vector(0, 0, -1.101), angle = Angle(-90, 0, 0), size = Vector(0.079, 0.079, 0.079), color = Color(71, 197, 254, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },
["glow3"] = { type = "Sprite", sprite = "effects/redflare", bone = "Base", rel = "thing", pos = Vector(2.206, 0.206, 0.393), size = { x = 2.591, y = 2.591 }, color = Color(255, 255, 0, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = true},
["thing"] = { type = "Model", model = "models/Gibs/manhack_gib03.mdl", bone = "Bolt1", rel = "", pos = Vector(0.03, -0.506, -0.213), angle = Angle(-90, 0, 0), size = Vector(0.425, 0.425, 0.425), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },
["glow1"] = { type = "Sprite", sprite = "sprites/strider_blackball", bone = "Base", rel = "ball1", pos = Vector(0, 0, 0), size = { x = 2.287, y = 2.287 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = false, vertexcolor = true, ignorez = false}
}
self.WElements = {
["ball1"] = { type = "Model", model = "models/Effects/combineball.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(15.625, 0.749, -6.763), angle = Angle(0, 0, 0), size = Vector(0.065, 0.065, 0.065), color = Color(71, 197, 254, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },
["glow3"] = { type = "Sprite", sprite = "effects/redflare", bone = "ValveBiped.Bip01_R_Hand", rel = "thing", pos = Vector(2.206, 0.206, 0.393), size = { x = 2.591, y = 2.591 }, color = Color(255, 255, 0, 255), nocull = true, additive = true, vertexalpha = true, vertexcolor = true, ignorez = false},
["glow1"] = { type = "Sprite", sprite = "sprites/strider_blackball", bone = "ValveBiped.Bip01_R_Hand", rel = "ball1", pos = Vector(0.4, 0, 0), size = { x = 2.049, y = 2.049 }, color = Color(255, 255, 255, 255), nocull = true, additive = true, vertexalpha = false, vertexcolor = true, ignorez = false},
["thing"] = { type = "Model", model = "models/Gibs/manhack_gib03.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(9.029, 1.18, -6.369), angle = Angle(6.906, 180, -90), size = Vector(0.425, 0.425, 0.425), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
end
SWEP.Instructions = "Extreme power, dissolves enemies. Consumes suit power quick!"
SWEP.Base = "iw_pulserifle"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_IRifle.mdl"
SWEP.WorldModel = "models/weapons/w_IRifle.mdl"
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Primary.Sound = Sound("PropJeep.FireChargedCannon")//Sound("weapons/gauss/fire1.wav")
SWEP.Primary.Recoil = 16
SWEP.Primary.Unrecoil = 6
SWEP.Primary.Damage = 40
SWEP.Primary.NumShots = 1
SWEP.Primary.ClipSize = -1
SWEP.Primary.Delay = 0.4
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "none"
SWEP.Primary.Cone = 0.022
SWEP.Primary.ConeMoving = 0.08
SWEP.Primary.ConeCrouching = 0.014
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.MuzzleEffect = "rg_muzzle_rifle"
--SWEP.IronSightsPos = Vector(-4.5, -9.6, 3.1)
--SWEP.IronSightsAng = Vector(1.1, 0.6, -3.3)
SWEP.Drain = 12
function SWEP:ShootBullets(dmg, numbul, cone)
local bullet = {}
bullet.Num = numbul
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector(cone, cone, 0)
bullet.Tracer = 1
bullet.Force = 0
bullet.Damage = dmg
bullet.TracerName = "AR2Tracer"
-- Dissolve entity
bullet.Callback = function ( attacker, tr, dmginfo )
local ent = tr.Entity
if ent:IsValid() and ent:IsPlayer() and SERVER then
if ent:Team() ~= attacker:Team() and not ent.God then
ent.Dissolving = true
timer.Simple( 0.05, function( ply )
ply.Dissolving = false
end,ent)
end
end
end
self.Owner:FireBullets(bullet)
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self.Owner:MuzzleFlash()
self.Owner:SetAnimation(PLAYER_ATTACK1)
end
|
-----------------------------------
-- Area: Port Windurst
-- NPC: Rottata
-- Outpost Teleporter NPC
-- !pos 193.111 -12.999 215.638 240
-----------------------------------
require("scripts/globals/conquest")
-----------------------------------
local teleporterNation = tpz.nation.WINDURST
local teleporterEvent = 552
function onTrigger(player,npc)
tpz.conquest.teleporterOnTrigger(player, teleporterNation, teleporterEvent)
end
function onEventUpdate(player,csid,option)
tpz.conquest.teleporterOnEventUpdate(player, csid, option, teleporterEvent)
end
function onEventFinish(player,csid,option)
tpz.conquest.teleporterOnEventFinish(player, csid, option, teleporterEvent)
end
|
--[[
TheNexusAvenger
Prompt for the inventory.
--]]
local INVENTORY_GRID_SIZE = 5
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GuiService = game:GetService("GuiService")
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorageProject = require(ReplicatedStorage:WaitForChild("Project"):WaitForChild("ReplicatedStorage"))
local Armor = ReplicatedStorageProject:GetResource("Data.Armor")
local CutFrame = ReplicatedStorageProject:GetResource("External.NexusButton.Gui.CutFrame")
local ControllerIcon = ReplicatedStorageProject:GetResource("External.NexusButton.Gui.ControllerIcon")
local ClientInventory = ReplicatedStorageProject:GetResource("State.Inventory.ClientInventory")
local BlueTextButtonFactory = ReplicatedStorageProject:GetResource("UI.AudibleTextButtonFactory").CreateDefault(Color3.new(0,170/255,255/255))
local RedTextButtonFactory = ReplicatedStorageProject:GetResource("UI.AudibleTextButtonFactory").CreateDefault(Color3.new(170/255,0,0))
local ArmorIcon = ReplicatedStorageProject:GetResource("UI.Icon.ArmorIcon")
local PlayerInventoryIcon = ReplicatedStorageProject:GetResource("UI.Icon.PlayerInventoryIcon")
local InventoryPrompt = ReplicatedStorageProject:GetResource("UI.Prompt.BasePrompt"):Extend()
InventoryPrompt:SetClassName("InventoryPrompt")
--Create a dictionary of the armor ids to max health and model names.
local ArmorMaxHealth = {}
local ArmorModelNames = {}
local ArmorDataLookup = {}
for ArmorName,ArmorData in pairs(Armor) do
ArmorDataLookup[ArmorData.Id] = ArmorData
ArmorMaxHealth[ArmorData.Id] = ArmorData.MaxHealth
ArmorModelNames[ArmorData.Id] = ArmorName
end
--[[
Creates the inventory prompt.
--]]
function InventoryPrompt:__new()
self:InitializeSuper("InventoryPrompt")
--Create the prompt.
local InventoryAdorn = Instance.new("Frame")
InventoryAdorn.BackgroundTransparency = 1
InventoryAdorn.AnchorPoint = Vector2.new(0.5,0.55)
InventoryAdorn.Position = UDim2.new(0.5,0,0.5,0)
InventoryAdorn.Size = UDim2.new(0.8 * (3/2),0,0.8,0)
InventoryAdorn.SizeConstraint = Enum.SizeConstraint.RelativeYY
InventoryAdorn.Parent = self.AdornFrame
local CloseButton,CloseText = RedTextButtonFactory:Create()
CloseButton.AnchorPoint = Vector2.new(0,0.5)
CloseButton.Size = UDim2.new(0.1,0,0.1,0)
CloseButton.SizeConstraint = Enum.SizeConstraint.RelativeYY
CloseButton.Position = UDim2.new(1.01,0,0,0)
CloseButton.ZIndex = 5
CloseButton:MapKey(Enum.KeyCode.ButtonB,Enum.UserInputType.MouseButton1)
CloseButton.Parent = InventoryAdorn
CloseText.Text = "X"
local CharacterAdorn = Instance.new("Frame")
CharacterAdorn.BackgroundTransparency = 1
CharacterAdorn.Size = UDim2.new(1/3,0,1,0)
CharacterAdorn.Parent = InventoryAdorn
local CharacterIcon = PlayerInventoryIcon.new(Players.LocalPlayer)
CharacterIcon.AnchorPoint = Vector2.new(0.5,0)
CharacterIcon.Size = UDim2.new(0.7 * 3,0,0.7,0)
CharacterIcon.Position = UDim2.new(0.5,0,0,0)
CharacterIcon.Parent = CharacterAdorn
CharacterIcon:PlayAnimation("rbxassetid://507777826")
local ItemInfoAdorn = Instance.new("Frame")
ItemInfoAdorn.BackgroundTransparency = 1
ItemInfoAdorn.Size = UDim2.new(0.9,0,0.3,0)
ItemInfoAdorn.Position = UDim2.new(0.05,0,0.65,0)
ItemInfoAdorn.Parent = CharacterAdorn
local ItemInfoBackground = CutFrame.new(ItemInfoAdorn)
ItemInfoBackground.BackgroundColor3 = Color3.new(0,0,0)
ItemInfoBackground.BackgroundTransparency = 0.5
ItemInfoBackground:CutCorner("Top","Left",UDim2.new(0.1,0,0.1,0),Enum.SizeConstraint.RelativeYY)
ItemInfoBackground:CutCorner("Bottom","Right",UDim2.new(0.1,0,0.1,0),Enum.SizeConstraint.RelativeYY)
local ItemNameText = Instance.new("TextLabel")
ItemNameText.BackgroundTransparency = 1
ItemNameText.Size = UDim2.new(0.9,0,0.3,0)
ItemNameText.Position = UDim2.new(0.05,0,0.05,0)
ItemNameText.Font = Enum.Font.SourceSansBold
ItemNameText.TextScaled = true
ItemNameText.TextColor3 = Color3.new(1,1,1)
ItemNameText.TextStrokeColor3 = Color3.new(0,0,0)
ItemNameText.TextStrokeTransparency = 0
ItemNameText.Text = ""
ItemNameText.ZIndex = 5
ItemNameText.Parent = ItemInfoAdorn
local ItemDescriptionText = Instance.new("TextLabel")
ItemDescriptionText.BackgroundTransparency = 1
ItemDescriptionText.Size = UDim2.new(0.9,0,0.6,0)
ItemDescriptionText.Position = UDim2.new(0.05,0,0.35,0)
ItemDescriptionText.Font = Enum.Font.SourceSansBold
ItemDescriptionText.TextScaled = true
ItemDescriptionText.TextColor3 = Color3.new(1,1,1)
ItemDescriptionText.TextStrokeColor3 = Color3.new(0,0,0)
ItemDescriptionText.TextStrokeTransparency = 0
ItemDescriptionText.Text = ""
ItemDescriptionText.ZIndex = 5
ItemDescriptionText.TextYAlignment = Enum.TextYAlignment.Top
ItemDescriptionText.Parent = ItemInfoAdorn
local ControllerInfoFrame = Instance.new("Frame")
ControllerInfoFrame.BackgroundTransparency = 1
ControllerInfoFrame.Size = UDim2.new(0.9,0,0.4,0)
ControllerInfoFrame.Position = UDim2.new(0.05,0,1.05,0)
ControllerInfoFrame.Parent = ItemInfoAdorn
local XIcon = ControllerIcon.new()
XIcon.AdornFrame.Position = UDim2.new(0,0,0,0)
XIcon.AdornFrame.Size = UDim2.new(0.5,0,0.5,0)
XIcon.AdornFrame.SizeConstraint = Enum.SizeConstraint.RelativeYY
XIcon.AdornFrame.Parent = ControllerInfoFrame
XIcon:SetIcon(Enum.KeyCode.ButtonX)
local XButtonText = Instance.new("TextLabel")
XButtonText.BackgroundTransparency = 1
XButtonText.Size = UDim2.new(6,0,1,0)
XButtonText.Position = UDim2.new(1,0,0,0)
XButtonText.Font = Enum.Font.SourceSansBold
XButtonText.TextColor3 = Color3.new(0,0,0)
XButtonText.TextStrokeColor3 = Color3.new(1,1,1)
XButtonText.TextStrokeTransparency = 0
XButtonText.TextScaled = true
XButtonText.TextXAlignment = Enum.TextXAlignment.Left
XButtonText.Text = "Move Item"
XButtonText.Parent = XIcon.Icon
local BIcon = ControllerIcon.new()
BIcon.AdornFrame.Position = UDim2.new(0,0,0.5,0)
BIcon.AdornFrame.Size = UDim2.new(0.5,0,0.5,0)
BIcon.AdornFrame.SizeConstraint = Enum.SizeConstraint.RelativeYY
BIcon.AdornFrame.Visible = false
BIcon.AdornFrame.Parent = ControllerInfoFrame
BIcon:SetIcon(Enum.KeyCode.ButtonB)
local BButtonText = Instance.new("TextLabel")
BButtonText.BackgroundTransparency = 1
BButtonText.Size = UDim2.new(6,0,1,0)
BButtonText.Position = UDim2.new(1,0,0,0)
BButtonText.Font = Enum.Font.SourceSansBold
BButtonText.TextColor3 = Color3.new(0,0,0)
BButtonText.TextStrokeColor3 = Color3.new(1,1,1)
BButtonText.TextStrokeTransparency = 0
BButtonText.TextScaled = true
BButtonText.TextXAlignment = Enum.TextXAlignment.Left
BButtonText.Text = "Cancel"
BButtonText.Parent = BIcon.Icon
local GridAdorn = Instance.new("Frame")
GridAdorn.BackgroundTransparency = 1
GridAdorn.Size = UDim2.new(2/3,0,1,0)
GridAdorn.Position = UDim2.new(1/3,0,0,0)
GridAdorn.Parent = InventoryAdorn
local CurrentPageText = Instance.new("TextLabel")
CurrentPageText.BackgroundTransparency = 1
CurrentPageText.Size = UDim2.new(0.1,0,0.075,0)
CurrentPageText.Position = UDim2.new(0.45,0,1,0)
CurrentPageText.Font = Enum.Font.SourceSansBold
CurrentPageText.TextScaled = true
CurrentPageText.TextColor3 = Color3.new(0,0,0)
CurrentPageText.TextStrokeColor3 = Color3.new(1,1,1)
CurrentPageText.TextStrokeTransparency = 0
CurrentPageText.Text = "1"
CurrentPageText.ZIndex = 5
CurrentPageText.TextYAlignment = Enum.TextYAlignment.Top
CurrentPageText.Parent = GridAdorn
local PageLeftButton,PageLeftText = BlueTextButtonFactory:Create()
PageLeftButton.Size = UDim2.new(0.1,0,0.075,0)
PageLeftButton.Position = UDim2.new(0.35,0,1,0)
PageLeftButton:MapKey(Enum.KeyCode.ButtonL1,Enum.UserInputType.MouseButton1)
PageLeftButton.Parent = GridAdorn
PageLeftText.Text = "<"
local PageRightButton,PageRightText = BlueTextButtonFactory:Create()
PageRightButton.Size = UDim2.new(0.1,0,0.075,0)
PageRightButton.Position = UDim2.new(0.55,0,1,0)
PageRightButton:MapKey(Enum.KeyCode.ButtonR1,Enum.UserInputType.MouseButton1)
PageRightButton.Parent = GridAdorn
PageRightText.Text = ">"
local CurrentHoveringSlotFrame = nil
local InitialDragFrame = nil
local InitialDragSlot = nil
local MovingItemFrame = nil
local SlotFrames = {}
local SlotFrameLookup = {}
local CurrentPage = 1
local PlayerInventory = ClientInventory.new(Players.LocalPlayer:WaitForChild("PersistentStats"):WaitForChild("Inventory"))
--[[
Creates an item slot.
--]]
local function CreateItemSlot(SlotId,FrameProperties)
--Create the frames.
local SlotFrame = Instance.new("Frame")
SlotFrame.BorderSizePixel = 0
SlotFrame.BackgroundTransparency = 0.5
SlotFrame.BackgroundColor3 = Color3.new(1,1,1)
SlotFrame.SizeConstraint = Enum.SizeConstraint.RelativeYY
SlotFrame.Active = true
SlotFrame.Selectable = true
for Name,Value in pairs(FrameProperties) do
SlotFrame[Name] = Value
end
self.SelectionGroup:AddFrame(SlotFrame)
local SlotFrameUICorner = Instance.new("UICorner")
SlotFrameUICorner.CornerRadius = UDim.new(0.1,0)
SlotFrameUICorner.Parent = SlotFrame
local HealthBackground = Instance.new("Frame")
HealthBackground.BorderSizePixel = 0
HealthBackground.BackgroundColor3 = Color3.new(170/255,0,0)
HealthBackground.AnchorPoint = Vector2.new(0.5,0.5)
HealthBackground.Size = UDim2.new(0.9,0,0.05,0)
HealthBackground.Position = UDim2.new(0.5,0,0.75,0)
HealthBackground.Visible = false
HealthBackground.ZIndex = 3
HealthBackground.Parent = SlotFrame
local HealthBackgroundUICorner = Instance.new("UICorner")
HealthBackgroundUICorner.CornerRadius = UDim.new(0.5,0)
HealthBackgroundUICorner.Parent = HealthBackground
local HealthFill = Instance.new("Frame")
HealthFill.BorderSizePixel = 0
HealthFill.BackgroundColor3 = Color3.new(0,170/255,0)
HealthFill.ZIndex = 3
HealthFill.Parent = HealthBackground
local HealthFillUICorner = Instance.new("UICorner")
HealthFillUICorner.CornerRadius = UDim.new(0.5,0)
HealthFillUICorner.Parent = HealthFill
--Set up the slot data.
local SlotFrameData = {
Slot = SlotId,
SlotFrame = SlotFrame,
HealthBackground = HealthBackground,
HealthFill = HealthFill,
HiddenForSlotible = nil,
}
SlotFrames[SlotId] = SlotFrameData
SlotFrameLookup[SlotFrame] = SlotFrameData
--[[
Updates the displayed item.
--]]
function SlotFrameData:Update()
--Get the slot and item.
local Slot = SlotId
if typeof(Slot) == "number" then
Slot = Slot + (INVENTORY_GRID_SIZE * INVENTORY_GRID_SIZE * (CurrentPage - 1))
end
self.Slot = Slot
local Item = PlayerInventory:GetItemAtSlot(Slot)
--Update the display.
if Item then
--Create the icon.
if self.CurrentItemId ~= Item.Id then
self.CurrentItemId = Item.Id
if self.ArmorIcon then
self.ArmorIcon:Destroy()
end
self.ArmorIcon = ArmorIcon.new(ArmorModelNames[Item.Id])
self.ArmorIcon.Size = UDim2.new(0.9,0,0.9,0)
self.ArmorIcon.Position = UDim2.new(0.05,0,0.05,0)
self.ArmorIcon.Parent = self.SlotFrame
end
local Visible = (self.HiddenForSlot ~= self.Slot)
self.ArmorIcon.Visible = Visible
--Update the health.
if Item.Health and ArmorMaxHealth[Item.Id] then
self.HealthBackground.Visible = Visible
self.HealthFill.Size = UDim2.new(Item.Health/ArmorMaxHealth[Item.Id],0,1,0)
else
self.HealthBackground.Visible = false
end
else
--Hide the frame.
if self.ArmorIcon then
self.ArmorIcon:Destroy()
self.ArmorIcon = nil
self.CurrentItemId = nil
end
self.HealthBackground.Visible = false
end
end
--[[
Shows the slot.
--]]
function SlotFrameData:Show()
self.HiddenForSlot = nil
self:Update()
end
--[[
Hides the slot.
--]]
function SlotFrameData:Hide()
self.HiddenForSlot = self.Slot
self:Update()
end
--Connect updating the display.
SlotFrameData:Update()
PlayerInventory.InventoryChanged:Connect(function()
SlotFrameData:Update()
end)
--Return the slot frame.
return SlotFrame
end
--[[
Sets the hovered frame.
--]]
local function SetHoveredFrame(Frame)
CurrentHoveringSlotFrame = Frame
--Update the item information.
if CurrentHoveringSlotFrame and CurrentHoveringSlotFrame.CurrentItemId then
local ArmorData = ArmorDataLookup[CurrentHoveringSlotFrame.CurrentItemId]
ItemNameText.Text = ArmorData.Name
ItemDescriptionText.Text = ArmorData.Description
ControllerInfoFrame.Visible = true
else
ItemNameText.Text = ""
ItemDescriptionText.Text = ""
if not InitialDragFrame then
ControllerInfoFrame.Visible = false
end
end
end
--[[
Cancels dragging the current item.
--]]
local function CancelDragging(IgnoreCloseButton)
if IgnoreCloseButton ~= true then
--Delay showing the close button (leads to closing after pressing B).
delay(0,function()
CloseButton.Visible = true
end)
end
--End the existing drag if one exists.
if InitialDragFrame then
InitialDragFrame:Show()
InitialDragFrame = nil
end
if MovingItemFrame then
MovingItemFrame:Destroy()
MovingItemFrame = nil
end
InitialDragSlot = nil
XButtonText.Text = "Move Item"
BIcon.AdornFrame.Visible = false
end
--[[
Starts dragging an item at the starting slot.
--]]
local function StartDragging(StartX,StartY)
--End the existing drag if one exists.
CancelDragging(true)
if not CurrentHoveringSlotFrame or not CurrentHoveringSlotFrame.CurrentItemId then return end
--Start dragging.
InitialDragFrame = CurrentHoveringSlotFrame
InitialDragSlot = CurrentHoveringSlotFrame.Slot
CurrentHoveringSlotFrame:Hide()
MovingItemFrame = ArmorIcon.new(ArmorModelNames[CurrentHoveringSlotFrame.CurrentItemId])
MovingItemFrame.AnchorPoint = Vector2.new(0.5,0.5)
MovingItemFrame.Size = UDim2.new(0,CurrentHoveringSlotFrame.SlotFrame.AbsoluteSize.X,0,CurrentHoveringSlotFrame.SlotFrame.AbsoluteSize.Y)
MovingItemFrame.Position = UDim2.new(0,StartX,0,StartY)
MovingItemFrame.Parent = self.AdornFrame
XButtonText.Text = "Finish"
BIcon.AdornFrame.Visible = true
end
--[[
Stops dragging the current item.
--]]
local function StopDragging()
CloseButton.Visible = true
--End the existing drag if one exists.
if InitialDragFrame then
InitialDragFrame:Show()
end
if MovingItemFrame then
MovingItemFrame:Destroy()
MovingItemFrame = nil
end
if not CurrentHoveringSlotFrame or not InitialDragFrame then
InitialDragFrame = nil
InitialDragSlot = nil
XButtonText.Text = "Move Item"
BIcon.AdornFrame.Visible = false
return
end
--Attempt to swap the slots.
PlayerInventory:SwapItems(CurrentHoveringSlotFrame.Slot,InitialDragSlot)
InitialDragFrame = nil
InitialDragSlot = nil
XButtonText.Text = "Move Item"
BIcon.AdornFrame.Visible = false
end
--[[
Updates the page display.
--]]
local function UpdatePages()
--Determine the max slot and max pages.
local MaxSlot = 1
for _,ArmorData in pairs(PlayerInventory.Inventory) do
if typeof(ArmorData.Slot) == "number" then
MaxSlot = math.max(MaxSlot,ArmorData.Slot)
end
end
local MaxPage = math.ceil(MaxSlot / (INVENTORY_GRID_SIZE * INVENTORY_GRID_SIZE))
--Clamp the current page and update the display.
CurrentPage = math.clamp(CurrentPage,1,MaxPage)
PageLeftButton.Visible = (CurrentPage ~= 1)
PageRightButton.Visible = (CurrentPage ~= MaxPage)
CurrentPageText.Visible = (MaxPage ~= 1)
CurrentPageText.Text = tostring(CurrentPage)
for _,SlotFrame in pairs(SlotFrames) do
SlotFrame:Update()
end
SetHoveredFrame(CurrentHoveringSlotFrame)
end
--[[
Updates the size of the store.
--]]
local function UpdateSize()
--Determine how to orient the prompt.
local ScreenSize = self.AdornFrame.AbsoluteSize
local UseRelativeXX = (ScreenSize.Y * 0.8 * (3/2) > ScreenSize.X * 0.9)
local MakeVertical = UseRelativeXX and ScreenSize.X * 0.8 * (3/2) < ScreenSize.Y * 0.9
--Move the elements.
if MakeVertical then
CharacterAdorn.Size = UDim2.new(0.7 * 0.5,0,0.7 * 2/3,0)
CharacterAdorn.Position = UDim2.new(0.05,0,0.05,0)
ItemInfoAdorn.Size = UDim2.new(1.6,0,0.4,0)
ItemInfoAdorn.Position = UDim2.new(1.1,0,0.2,0)
GridAdorn.Size = UDim2.new(1,0,2/3,0)
GridAdorn.Position = UDim2.new(0,0,1/3,0)
CloseButton.AnchorPoint = Vector2.new(1,0)
CloseButton.Size = UDim2.new(0.05,0,0.05,0)
CloseButton.Position = UDim2.new(1,0,0.065,0)
else
CharacterAdorn.Size = UDim2.new(1/3,0,1,0)
CharacterAdorn.Position = UDim2.new(0,0,0,0)
ItemInfoAdorn.Size = UDim2.new(0.9,0,0.3,0)
ItemInfoAdorn.Position = UDim2.new(0.05,0,0.65,0)
GridAdorn.Size = UDim2.new(2/3,0,1,0)
GridAdorn.Position = UDim2.new(1/3,0,0,0)
CloseButton.AnchorPoint = Vector2.new(0,0.5)
CloseButton.Size = UDim2.new(0.1,0,0.1,0)
CloseButton.Position = UDim2.new(1.01,0,0,0)
end
--Change the prompt size.
if UseRelativeXX then
InventoryAdorn.Size = UDim2.new(0.9,0,0.9 * (MakeVertical and (3/2) or (2/3)),0)
InventoryAdorn.SizeConstraint = Enum.SizeConstraint.RelativeXX
else
InventoryAdorn.Size = UDim2.new(0.8 * (3/2),0,0.8,0)
InventoryAdorn.SizeConstraint = Enum.SizeConstraint.RelativeYY
end
end
--Create the slots.
local SlotFramesGrid = {}
for Y = 1,INVENTORY_GRID_SIZE do
SlotFramesGrid[Y] = {}
for X = 1,INVENTORY_GRID_SIZE do
SlotFramesGrid[Y][X] = CreateItemSlot(((Y - 1) * INVENTORY_GRID_SIZE) + X,{
AnchorPoint = Vector2.new(0.5,0.5),
Size = UDim2.new(0.9 * (1/INVENTORY_GRID_SIZE),0,0.9 * (1/INVENTORY_GRID_SIZE),0),
Position = UDim2.new((X - 0.5) * (1/INVENTORY_GRID_SIZE),0,(Y - 0.5) * (1/INVENTORY_GRID_SIZE),0),
Parent = GridAdorn,
})
end
end
local HeadSlotFrame = CreateItemSlot("Head",{
AnchorPoint = Vector2.new(1,0),
Size = UDim2.new(0.15,0,0.15,0),
Position = UDim2.new(1,0,0.025,0),
Parent = CharacterAdorn,
})
local BodySlotFrame = CreateItemSlot("Body",{
AnchorPoint = Vector2.new(1,0),
Size = UDim2.new(0.15,0,0.15,0),
Position = UDim2.new(1,0,0.225,0),
Parent = CharacterAdorn,
})
local LegsSlotFrame = CreateItemSlot("Legs",{
AnchorPoint = Vector2.new(1,0),
Size = UDim2.new(0.15,0,0.15,0),
Position = UDim2.new(1,0,0.425,0),
Parent = CharacterAdorn,
})
--Set up the selection order.
for Y,Column in pairs(SlotFramesGrid) do
for X,Frame in pairs(Column) do
Frame.NextSelectionUp = (SlotFramesGrid[Y - 1] and SlotFramesGrid[Y - 1][X]) or Frame
Frame.NextSelectionDown = (SlotFramesGrid[Y + 1] and SlotFramesGrid[Y + 1][X]) or Frame
Frame.NextSelectionLeft = Column[X - 1] or LegsSlotFrame
Frame.NextSelectionRight = Column[X + 1] or Frame
end
end
SlotFramesGrid[1][1].NextSelectionLeft = HeadSlotFrame
SlotFramesGrid[2][1].NextSelectionLeft = BodySlotFrame
HeadSlotFrame.NextSelectionUp = HeadSlotFrame
HeadSlotFrame.NextSelectionDown = BodySlotFrame
HeadSlotFrame.NextSelectionLeft = HeadSlotFrame
HeadSlotFrame.NextSelectionRight = SlotFramesGrid[1][1]
BodySlotFrame.NextSelectionUp = HeadSlotFrame
BodySlotFrame.NextSelectionDown = LegsSlotFrame
BodySlotFrame.NextSelectionLeft = BodySlotFrame
BodySlotFrame.NextSelectionRight = SlotFramesGrid[2][1]
LegsSlotFrame.NextSelectionUp = BodySlotFrame
LegsSlotFrame.NextSelectionDown = LegsSlotFrame
LegsSlotFrame.NextSelectionLeft = LegsSlotFrame
LegsSlotFrame.NextSelectionRight = SlotFramesGrid[3][1]
--Connect the mouse events.
UserInputService.InputChanged:Connect(function(Input)
if Input.UserInputType ~= Enum.UserInputType.MouseMovement and Input.UserInputType ~= Enum.UserInputType.Touch then return end
--Update the current hovering frame.
local NewHoveringSlotFrame = nil
for _,SlotFrame in pairs(SlotFrames) do
local FramePosition,FrameSize = SlotFrame.SlotFrame.AbsolutePosition,SlotFrame.SlotFrame.AbsoluteSize
if Input.Position.X >= FramePosition.X and Input.Position.X <= FramePosition.X + FrameSize.X and Input.Position.Y >= FramePosition.Y and Input.Position.Y <= FramePosition.Y + FrameSize.Y then
NewHoveringSlotFrame = SlotFrame
end
end
SetHoveredFrame(NewHoveringSlotFrame)
--Update the drag frame.
if MovingItemFrame then
MovingItemFrame.Position = UDim2.new(0,Input.Position.X,0,Input.Position.Y)
end
--Show the close button (may override controller selection).
CloseButton.Visible = true
end)
UserInputService.InputEnded:Connect(function(Input)
if Input.UserInputType ~= Enum.UserInputType.MouseButton1 and Input.UserInputType ~= Enum.UserInputType.Touch then return end
StopDragging()
end)
for _,SlotFrame in pairs(SlotFrames) do
SlotFrame.SlotFrame.InputBegan:Connect(function(Input)
if (Input.UserInputType ~= Enum.UserInputType.Touch and Input.UserInputType ~= Enum.UserInputType.MouseButton1) or InitialDragSlot then return end
SetHoveredFrame(SlotFrame)
StartDragging(Input.Position.X,Input.Position.Y)
end)
end
--Connect the gamepad events.
UserInputService.InputBegan:Connect(function(Input,Processed)
if not self:IsOpen() then return end
if Processed then return end
if Input.KeyCode == Enum.KeyCode.ButtonX and CurrentHoveringSlotFrame then
if InitialDragFrame then
--Stop dragging the current frame.
StopDragging()
else
--Start dragging the current frame.
local SlotFrame = CurrentHoveringSlotFrame
if SlotFrame and SlotFrame.CurrentItemId then
CloseButton.Visible = false
local SlotFramePosition,SlotFrameSize = SlotFrame.SlotFrame.AbsolutePosition,SlotFrame.SlotFrame.AbsoluteSize
StartDragging(SlotFramePosition.X + (SlotFrameSize.X/2),SlotFramePosition.Y + (SlotFrameSize.Y/2))
end
end
elseif Input.KeyCode == Enum.KeyCode.ButtonB then
--Cancel the dragging.
CancelDragging()
end
end)
GuiService:GetPropertyChangedSignal("SelectedObject"):Connect(function()
if GuiService.SelectedObject and SlotFrameLookup[GuiService.SelectedObject] then
--Set the hovered frame.
SetHoveredFrame(SlotFrameLookup[GuiService.SelectedObject])
--Update the dragging item position.
local SlotFrame = CurrentHoveringSlotFrame
if MovingItemFrame and SlotFrame then
local SlotFramePosition,SlotFrameSize = SlotFrame.SlotFrame.AbsolutePosition,SlotFrame.SlotFrame.AbsoluteSize
MovingItemFrame.Position = UDim2.new(0,SlotFramePosition.X + (SlotFrameSize.X/2),0,SlotFramePosition.Y + (SlotFrameSize.Y/2))
end
end
end)
--Connect changing pages.
PageLeftButton.MouseButton1Down:Connect(function()
if not self:IsOpen() then return end
CurrentPage = CurrentPage - 1
UpdatePages()
end)
PageRightButton.MouseButton1Down:Connect(function()
if not self:IsOpen() then return end
CurrentPage = CurrentPage + 1
UpdatePages()
end)
PlayerInventory.InventoryChanged:Connect(function()
UpdatePages()
end)
UpdatePages()
--Connect closing.
CloseButton.MouseButton1Down:Connect(function()
if not CloseButton.Visible or not self:IsOpen() then return end
self:Close()
end)
--Connect updating the size.
self.AdornFrame:GetPropertyChangedSignal("AbsoluteSize"):Connect(UpdateSize)
UpdateSize()
end
return InventoryPrompt |
-- ========== THIS IS AN AUTOMATICALLY GENERATED FILE! ==========
PlaceObj('XTemplate', {
group = "Infopanel Sections",
id = "customBlackCubeDump",
PlaceObj('XTemplateTemplate', {
'__context_of_kind', "BlackCubeDumpSite",
'__template', "InfopanelSection",
'RolloverText', T(492, --[[XTemplate customBlackCubeDump RolloverText]] "Amount of stored Black Cubes."),
'Title', T(489, --[[XTemplate customBlackCubeDump Title]] "Available resources"),
'Icon', "UI/Icons/Sections/BlackCube_4.tga",
}, {
PlaceObj('XTemplateTemplate', {
'__template', "InfopanelText",
'Text', T(493, --[[XTemplate customBlackCubeDump Text]] "<resource('BlackCube' )><right><blackcube(Stored_BlackCube, MaxAmount_BlackCube)>"),
}),
}),
})
|
--ZFUNC-rmedge-v1
local function rmedge( graph, from, to, undirected ) --> graph
if not graph[ from ] then return graph end
if not graph[ to ] then return graph end
graph[ from ][ to ] = nil
if undirected then
graph[ to ][ from ] = nil
end
return graph
end
return rmedge
|
-- This file is under a Creative Commons Attribution 4.0 International Licence
-- http://creativecommons.org/licenses/by/4.0/
-- You can mess around with it, mod it to your liking, and even redistribute it.
if !WireLib then return end -- Don't do anything if wiremod isn't installed.
AddCSLuaFile()
DEFINE_BASECLASS( "base_wire_entity" )
ENT.PrintName = "ARCBank Card Machine Controller"
ENT.WireDebugName = "Card Machine Controller"
if CLIENT then
return -- No more client
end
-- Server
function ENT:Initialize()
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:SetUseType( SIMPLE_USE )
self.Inputs = WireLib.CreateInputs( self, { "Amount","Enter","Cancel","GroupAccount [STRING]","Label [STRING]"} )
self.Outputs = WireLib.CreateOutputs( self,{"Amount","RequestingCustomer","Success","Entity [ENTITY]"})
self.WInputs = {}
self.WInputs["Amount"] = 0
self.WInputs["GroupAccount"] = ""
self.WInputs["Label"] = "Card Machine"
self:SetColor(Color(255,0,0,self:GetColor().a))
end
-- Accessor funcs for certain functions
function ENT:LinkEnt( CardM )
--MsgN(CardM:GetClass())
if !IsValid(CardM) || CardM:GetClass() != "sent_arc_pinmachine" then return false, "Must link to a ARCBank Card Machine" end
self:SetMachine( CardM )
WireLib.SendMarks(self, {CardM})
return true
end
function ENT:UnlinkEnt()
self.CardMachine = nil
WireLib.SendMarks(self, {})
WireLib.TriggerOutput( self, "Entity", NULL )
return true
end
function ENT:HasMachine() return IsValid(self.CardMachine) end
function ENT:GetMachine() return self.CardMachine end
function ENT:SetMachine( CardM )
if (!IsValid(CardM) || CardM:GetClass() != "sent_arc_pinmachine") then return false end
self.CardMachine = CardM
WireLib.TriggerOutput( self, "Entity", CardM )
return true
end
function ENT:TriggerInput( name, value )
if !self:HasMachine() then return end
if name == "Enter" then
if value > 0 && self.CardMachine.Status == 0 then
self.CardMachine.ToAccount = self.WInputs["GroupAccount"]
self.CardMachine.EnteredAmount = self.WInputs["Amount"]
self.CardMachine.DemandingMoney = true
self.CardMachine:SetScreenMsg("Cr "..tostring(self.WInputs["Amount"]),ARCBank.Msgs.CardMsgs.InsertCard)
self.CardMachine.Reason = self.WInputs["Label"]
end
elseif name == "Cancel" then
if self.CardMachine.DemandingMoney && value > 0 then
self.CardMachine.EnteredAmount = 0
self.CardMachine:EmitSound("buttons/button18.wav",75,255)
self.CardMachine.DemandingMoney = false
self.CardMachine:SetScreenMsg("*Operation*","*Cancelled*")
timer.Simple(1.5,function()
self.CardMachine:SetScreenMsg("**ARCBank**",string.Replace( ARCBank.Msgs.CardMsgs.Owner, "%PLAYER%", self.CardMachine._Owner:Nick() ))
end)
end
else
self.WInputs[name] = value
end
end
function ENT:Think()
if !self:HasMachine() then return end
WireLib.TriggerOutput(self, "Amount", self.CardMachine.EnteredAmount)
WireLib.TriggerOutput(self, "RequestingCustomer", ARCLib.BoolToNumber(self.CardMachine.DemandingMoney))
WireLib.TriggerOutput(self, "Success", self.CardMachine.Status)
end
duplicator.RegisterEntityClass("sent_arc_pinmachine_wire", WireLib.MakeWireEnt, "Data")
|
-- premake5.lua
-- Actions
newaction {
trigger = "clean",
description = "clean up project files",
execute = function()
os.rmdir("./Projects")
end
}
workspace "ZooRayTracer"
location ("./")
configurations { "Debug", "Release" }
project "ZooRayTracer"
location ("Projects/".. _ACTION .."/ZooRayTracer")
kind "ConsoleApp"
language "C++"
targetdir "Binaries/%{cfg.buildcfg}"
includedirs { "Source",
"Source/Framework",
"Source/Math",
"Source/Lib/Include",
"3rdParty/Build/assimp/include",
"3rdParty/RapidJSON/include"
}
files { "Source/**.h",
"Source/**.cpp",
"Source/**.c"
}
debugdir "./"
debugargs { "> Output/output.ppm" }
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
filter { "Debug", "action:vs2017" }
syslibdirs { "3rdParty/Build/assimp/Debug/x86-vs141" }
links { "assimp-vc141-mtd" }
postbuildcommands {
"{COPY} " .. path.getabsolute("3rdParty/Build/assimp/Debug/x86-vs141/assimp-vc141-mtd.dll") .." %{cfg.targetdir}"
}
filter { "Debug", "action:vs2015" }
syslibdirs { "3rdParty/Build/assimp/Debug/x86-vs140" }
links { "assimp-vc140-mtd" }
postbuildcommands {
"{COPY} " .. path.getabsolute("3rdParty/Build/assimp/Debug/x86-vs140/assimp-vc140-mtd.dll") .." %{cfg.targetdir}"
}
group "Tools"
|
return {'gil','gild','gilde','gildeboek','gildebrief','gildebrieven','gildebroeder','gildedeken','gildedekens','gildehuis','gildekamer','gildekeur','gildemeester','gildepatroon','gildepatroons','gildepenning','gildepenningen','gildeproef','gilderecht','gildewezen','gildos','gilet','gillen','giller','gilletje','gilling','gillerig','gilbert','gilles','gils','gilze','gilzenaar','gilissen','gillette','gil','gilberto','gill','gillian','gillis','gillissen','gille','giling','giliam','giljam','gilsing','giltay','gilhuis','gilijamse','gilds','gildeboeken','gildehuizen','gilden','gildeproeven','gilderechten','gildes','gilets','gillend','gillende','gilletjes','gillingen','gilt','gildebroeders','gildekamers','gildekeuren','gildemeesters','gillerige','gillers','gilberts','gilbertos','gills','gilles','gillians','gillis'} |
AddCSLuaFile()
E2Lib = {}
local type = type
local function checkargtype(argn, value, argtype)
if type(value) ~= argtype then error(string.format("bad argument #%d to 'E2Lib.%s' (%s expected, got %s)", argn, debug.getinfo(2, "n").name, argtype, type(value)), 2) end
end
-- -------------------------- Helper functions -----------------------------
local unpack = unpack
local IsValid = IsValid
-- This functions should not be used in functions that tend to be used very often, as it is slower than getting the arguments manually.
function E2Lib.getArguments(self, args)
local ret = {}
for i = 2, #args[7] + 1 do
ret[i - 1] = args[i][1](self, args[i])
end
return unpack(ret)
end
-- Backwards compatibility
E2Lib.isnan = WireLib.isnan
E2Lib.clampPos = WireLib.clampPos
E2Lib.setPos = WireLib.setPos
E2Lib.setAng = WireLib.setAng
function E2Lib.setMaterial(ent, material)
material = WireLib.IsValidMaterial(material)
ent:SetMaterial(material)
duplicator.StoreEntityModifier(ent, "material", { MaterialOverride = material })
end
function E2Lib.setSubMaterial(ent, index, material)
index = math.Clamp(index, 0, 255)
material = WireLib.IsValidMaterial(material)
ent:SetSubMaterial(index, material)
duplicator.StoreEntityModifier(ent, "submaterial", { ["SubMaterialOverride_"..index] = material })
end
-- Returns a default e2 table.
function E2Lib.newE2Table()
return {n={},ntypes={},s={},stypes={},size=0}
end
-- Returns a cloned table of the variable given if it is a table.
local istable = istable
local table_Copy = table.Copy
function E2Lib.fixDefault(var)
return istable(var) and table_Copy(var) or var
end
-- getHash
-- Returns a hash for the given string
-- local str_byte = string.byte
-- local str_sub = string.sub
local util_CRC = util.CRC
local tonumber = tonumber
function E2Lib.getHash(self, data)
--[[
-- Thanks to emspike for this code
self.prf = self.prf + #data
local a, b = 1, 0
for i = 1, #data do
a = (a + str_byte(str_sub(data,i,i))) % 65521
b = (b + a) % 65521
end
return b << 16 | a
-- but we're going to use Garry's function, since it's most likely done in C++, so it's probably faster.
-- For some reason, Garry's util.CRC returns a string... but it's always a number, so tonumbering it should work.
-- I'm making it default to -1 if it for some reason throws a letter in there, breaking tonumber.
]] --
if self then self.prf = self.prf + #data / 10 end
return tonumber(util_CRC(data)) or -1
end
-- -------------------------- signature generation -----------------------------
function E2Lib.typeName(typeid)
if typeid == "" then return "void" end
if typeid == "n" then return "number" end
local tp = wire_expression_types2[typeid]
if not tp then error("Type ID '" .. typeid .. "' not found", 2) end
local typename = tp[1]:lower()
return typename or "unknown"
end
function E2Lib.splitType(args)
local ret = {}
local thistype
local i = 1
while i <= #args do
local letter = args:sub(i, i)
if letter == ":" then
if #ret ~= 1 then error("Misplaced ':' in args", 2) end
thistype = ret[1]
ret = {}
elseif letter == "." then
if args:sub(i) ~= "..." then error("Misplaced '.' in args", 2) end
table.insert(ret, "...")
i = i + 2
elseif letter == "=" then
if #ret ~= 1 then error("Misplaced '=' in args", 2) end
ret = {}
else
local typeid = letter
if letter == "x" then
typeid = args:sub(i, i + 2)
i = i + 2
end
table.insert(ret, E2Lib.typeName(typeid))
end
i = i + 1
end
return thistype, ret
end
-- given a function signature like "setNumber(xwl:sn)" and an optional return typeid, generates a nice, readable signature
function E2Lib.generate_signature(signature, rets, argnames)
local funcname, args = string.match(signature, "([^(]+)%(([^)]*)%)")
if not funcname then error("malformed signature") end
local thistype, args = E2Lib.splitType(args)
if argnames then
for i = 1, #args do
if argnames[i] then args[i] = args[i] .. " " .. argnames[i] end
end
end
local new_signature = string.format("%s(%s)", funcname, table.concat(args, ","))
if thistype then new_signature = thistype .. ":" .. new_signature end
return (not rets or rets == "") and (new_signature) or (E2Lib.typeName(rets) .. "=" .. new_signature)
end
-- ------------------------ various entity checkers ----------------------------
-- replaces an E2Lib function (ex.: isOwner) and notifies plugins
function E2Lib.replace_function(funcname, func)
checkargtype(1, funcname, "string")
checkargtype(2, func, "function")
local oldfunc = E2Lib[funcname]
if not isfunction(oldfunc) then error("No E2Lib function by the name " .. funcname .. " found.", 2) end
E2Lib[funcname] = func
wire_expression2_CallHook("e2lib_replace_function", funcname, func, oldfunc)
end
function E2Lib.validPhysics(entity)
if IsValid(entity) then
if entity:IsWorld() then return false end
if entity:GetMoveType() ~= MOVETYPE_VPHYSICS then return false end
return entity:GetPhysicsObject():IsValid()
end
return false
end
-- This function gets wrapped when CPPI is detected, see very end of this file
function E2Lib.getOwner(self, entity)
if entity == nil then return end
if entity == self.entity or entity == self.player then return self.player end
if entity.GetPlayer then
local ply = entity:GetPlayer()
if IsValid(ply) then return ply end
end
local OnDieFunctions = entity.OnDieFunctions
if OnDieFunctions then
if OnDieFunctions.GetCountUpdate then
if OnDieFunctions.GetCountUpdate.Args then
if OnDieFunctions.GetCountUpdate.Args[1] then return OnDieFunctions.GetCountUpdate.Args[1] end
end
end
if OnDieFunctions.undo1 then
if OnDieFunctions.undo1.Args then
if OnDieFunctions.undo1.Args[2] then return OnDieFunctions.undo1.Args[2] end
end
end
end
if entity.GetOwner then
local ply = entity:GetOwner()
if IsValid(ply) then return ply end
end
return nil
end
function E2Lib.abuse(ply)
ply:Kick("Be good and don't abuse -- sincerely yours, the E2")
error("abuse", 0)
end
-- This function gets replaced when CPPI is detected, see very end of this file
function E2Lib.isFriend(owner, player)
return owner == player
end
function E2Lib.isOwner(self, entity)
if game.SinglePlayer() then return true end
local owner = E2Lib.getOwner(self, entity)
if not IsValid(owner) then return false end
return E2Lib.isFriend(owner, self.player)
end
local isOwner = E2Lib.isOwner
-- Checks whether the player is the chip's owner or in a pod owned by the chip's owner. Assumes that ply is really a player.
function E2Lib.canModifyPlayer(self, ply)
if ply == self.player then return true end
if not IsValid(ply) then return false end
if not ply:IsPlayer() then return false end
local vehicle = ply:GetVehicle()
if not IsValid(vehicle) then return false end
return isOwner(self, vehicle)
end
-- ------------------------ type guessing ------------------------------------------
local type_lookup = {
number = "n",
string = "s",
Vector = "v",
PhysObj = "b",
}
local table_length_lookup = {
[2] = "xv2",
[3] = "v",
[4] = "xv4",
[9] = "m",
[16] = "xm4",
}
function E2Lib.guess_type(value)
local vtype = type(value)
if type_lookup[vtype] then return type_lookup[vtype] end
if IsValid(value) then return "e" end
if value.EntIndex then return "e" end
if vtype == "table" then
if table_length_lookup[#value] then return table_length_lookup[#value] end
if value.HitPos then return "xrd" end
end
for typeid, v in pairs(wire_expression_types2) do
if v[5] then
local ok = pcall(v[5], value)
if ok then return typeid end
end
end
-- TODO: more type guessing here
return "" -- empty string = unknown type, for now.
end
-- Types that cannot possibly be guessed correctly:
-- angle (will be reported as vector)
-- matrix2 (will be reported as vector4)
-- wirelink (will be reported as entity)
-- complex (will be reported as vector2)
-- quaternion (will be reported as vector4)
-- all kinds of nil stuff
-- ------------------------ list filtering -------------------------------------------------
function E2Lib.filterList(list, criterion)
local index = 1
-- print("-- filterList: "..#list.." entries --")
while index <= #list do
if not criterion(list[index]) then
-- MsgC(Color(128,128,128), "- "..tostring(list[index]).."\n")
list[index] = list[#list]
table.remove(list)
else
-- print(string.format("+%3d %s", index, tostring(list[index])))
index = index + 1
end
end
-- print("--------")
return list
end
-- ----------------------------- compiler stuf ---------------------------------
-- A function suitable for use as xpcall's error handler. If the error is
-- generated by Compiler:Error, Parser:Error, etc., then the string will be a
-- usable error message. If not, then it's an error not caused by an error in
-- user code, and so we dump a stack trace to the console to help debug it.
function E2Lib.errorHandler(message)
if string.match(message, " at line ") then return message end
print("Internal error - please report to https://github.com/wiremod/wire/issues")
print(message)
debug.Trace()
return "Internal error, see console for more details"
end
E2Lib.optable_inv = {
add = "+",
sub = "-",
mul = "*",
div = "/",
mod = "%",
exp = "^",
ass = "=",
aadd = "+=",
asub = "-=",
amul = "*=",
adiv = "/=",
inc = "++",
dec = "--",
eq = "==",
neq = "!=",
lth = "<",
geq = ">=",
leq = "<=",
gth = ">",
band = "&&",
bor = "||",
bxor = "^^",
bshr = ">>",
bshl = "<<",
["not"] = "!",
["and"] = "&",
["or"] = "|",
qsm = "?",
col = ":",
def = "?:",
com = ",",
lpa = "(",
rpa = ")",
lcb = "{",
rcb = "}",
lsb = "[",
rsb = "]",
dlt = "$",
trg = "~",
imp = "->",
}
E2Lib.optable = {}
for token, op in pairs(E2Lib.optable_inv) do
local current = E2Lib.optable
for i = 1, #op do
local c = op:sub(i, i)
local nxt = current[c]
if not nxt then
nxt = {}
current[c] = nxt
end
if i == #op then
nxt[1] = token
else
if not nxt[2] then
nxt[2] = {}
end
current = nxt[2]
end
end
end
function E2Lib.printops()
local op_order = { ["+"] = 1, ["-"] = 2, ["*"] = 3, ["/"] = 4, ["%"] = 5, ["^"] = 6, ["="] = 7, ["!"] = 8, [">"] = 9, ["<"] = 10, ["&"] = 11, ["|"] = 12, ["?"] = 13, [":"] = 14, [","] = 15, ["("] = 16, [")"] = 17, ["{"] = 18, ["}"] = 19, ["["] = 20, ["]"] = 21, ["$"] = 22, ["~"] = 23 }
print("E2Lib.optable = {")
for k, v in pairs_sortkeys(E2Lib.optable, function(a, b) return (op_order[a] or math.huge) < (op_order[b] or math.huge) end) do
local tblstring = table.ToString(v)
tblstring = tblstring:gsub(",}", "}")
tblstring = tblstring:gsub("{(.)=", " {[\"%1\"] = ")
tblstring = tblstring:gsub(",(.)=", ", [\"%1\"] = ")
print(string.format("\t[%q] = %s,", k, tblstring))
end
print("}")
end
-- ------------------------------ string stuff ---------------------------------
-- limits the given string to the given length and adds "..." to the end if too long.
function E2Lib.limitString(text, length)
checkargtype(1, text, "string")
checkargtype(2, length, "number")
if #text <= length then
return text
else
return string.sub(text, 1, length) .. "..."
end
end
do
local enctbl = {}
local dectbl = {}
do
-- generate encode/decode lookup tables
-- local valid_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 +-*/#^!?~=@&|.,:(){}[]<>" -- list of "normal" chars that can be transferred without problems
local invalid_chars = "'\"\n\\%"
local hex = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }
for i = 1, #invalid_chars do
local char = invalid_chars:sub(i, i)
enctbl[char] = true
end
for byte = 1, 255 do
dectbl[hex[(byte - byte % 16) / 16 + 1] .. hex[byte % 16 + 1]] = string.char(byte)
if enctbl[string.char(byte)] then
enctbl[string.char(byte)] = "%" .. hex[(byte - byte % 16) / 16 + 1] .. hex[byte % 16 + 1]
else
enctbl[string.char(byte)] = string.char(byte)
end
end
--for i = 1, #valid_chars do
-- local char = valid_chars:sub(i, i)
-- enctbl[char] = char
--end
end
-- escapes special characters
function E2Lib.encode(str)
return str:gsub(".", enctbl)
end
-- decodes escaped characters
function E2Lib.decode(encoded)
return encoded:gsub("%%(..)", dectbl)
end
end
-- ------------------------------- extensions ----------------------------------
do
-- Shared stuff, defined later.
local extensions, printExtensions, conCommandSetExtensionStatus
function E2Lib.GetExtensions()
return extensions.list
end
function E2Lib.GetExtensionStatus(name)
name = name:Trim():lower()
return extensions.status[name]
end
function E2Lib.GetExtensionDocumentation(name)
return extensions.documentation[name] or {}
end
if SERVER then -- serverside stuff
util.AddNetworkString( "wire_expression2_server_send_extensions_list" )
util.AddNetworkString( "wire_expression2_client_request_print_extensions" )
util.AddNetworkString( "wire_expression2_client_request_set_extension_status" )
function wire_expression2_PreLoadExtensions()
hook.Run( "Expression2_PreLoadExtensions" )
extensions = { status = {}, list = {}, prettyList = {}, documentation = {} }
local list = sql.Query( "SELECT * FROM wire_expression2_extensions" )
if list then
for i = 1, #list do
local row = list[ i ]
E2Lib.SetExtensionStatus( row.name, row.enabled )
end
else
sql.Query( "CREATE TABLE wire_expression2_extensions ( name VARCHAR(32) PRIMARY KEY, enabled BOOLEAN )" )
end
extensions.save = true
end
function E2Lib.RegisterExtension(name, default, description, warning)
name = name:Trim():lower()
E2Lib.currentextension = name
if extensions.status[ name ] == nil then
E2Lib.SetExtensionStatus( name, default )
end
extensions.list[ #extensions.list + 1 ] = name
if description or warning then
extensions.documentation[name] = { Description = description, Warning = warning }
end
-- This line shouldn't be modified because it tells the parser that this extension is disabled,
-- thus making its functions not available in the E2 Editor (see function e2_include_pass2 in extloader.lua).
assert( extensions.status[ name ], "EXTENSION_DISABLED" )
end
function E2Lib.SetExtensionStatus( name, status )
name = name:Trim():lower()
status = tobool( status )
extensions.status[ name ] = status
if extensions.save then
sql.Query( "REPLACE INTO wire_expression2_extensions ( name, enabled ) VALUES ( " .. sql.SQLStr( name ) .. ", " .. ( status and 1 or 0 ) .. " )" )
end
end
-- After using E2Lib.SetExtensionStatus in an external script, this function should be called.
-- Its purpose is to update the clientside autocomplete list for the concommands.
function E2Lib.UpdateClientsideExtensionsList( ply )
net.Start( "wire_expression2_server_send_extensions_list" )
net.WriteTable(extensions)
if IsValid( ply ) then
net.Send( ply )
else
net.Broadcast()
end
end
local function buildPrettyList()
local function padLeft( str, len ) return (" "):rep( len - #str ) .. str end
local function padRight( str, len ) return str .. (" "):rep( len - #str ) end
local function padCenter( str, len ) return padRight( padLeft( str, math.floor( (len + #str) / 2 ) ), len ) end
local list, column1, column2, columnsWidth = extensions.list, {}, {}, 0
for i = 1, #list do
local name = list[ i ]
if #name > columnsWidth then columnsWidth = #name end
if extensions.status[ name ] == true then column1[ #column1 + 1 ] = name else column2[ #column2 + 1 ] = name end
end
local mainTitle, column1Title, column2Title = "E2 EXTENSIONS", "ENABLED", "DISABLED"
local maxWidth, maxRows = math.max( columnsWidth * 2, #column1Title + #column2Title, #mainTitle - 3 ), math.max( #column1, #column2 )
if maxWidth % 2 ~= 0 then maxWidth = maxWidth + 1 end
columnsWidth = maxWidth / 2
maxWidth = maxWidth + 3
local delimiter = " +-" .. ("-"):rep( columnsWidth ) .. "-+-" .. ("-"):rep( columnsWidth ) .. "-+"
list =
{
" +-" .. ("-"):rep( maxWidth ) .. "-+",
" | " .. padCenter( mainTitle, maxWidth ) .. " |",
delimiter,
" | " .. padCenter( column1Title, columnsWidth ) .. " | " .. padCenter( column2Title, columnsWidth ) .. " |",
delimiter,
}
for i = 1, maxRows do list[ #list + 1 ] = " | " .. padRight( column1[ i ] or "", columnsWidth ) .. " | " .. padRight( column2[ i ] or "", columnsWidth ) .. " |" end
list[ #list + 1 ] = delimiter
extensions.prettyList = list
end
function printExtensions( ply, str )
if IsValid( ply ) then
if str then ply:PrintMessage( 2, str ) end
for i = 1, #extensions.prettyList do ply:PrintMessage( 2, extensions.prettyList[ i ] ) end
else
if str then print( str ) end
for i = 1, #extensions.prettyList do print( extensions.prettyList[ i ] ) end
end
end
function conCommandSetExtensionStatus( ply, cmd, args )
if IsValid( ply ) and not ply:IsSuperAdmin() and not game.SinglePlayer() then
ply:PrintMessage( 2, "Sorry " .. ply:Name() .. ", you don't have access to this command." )
return
end
local name = args[ 1 ]
if name then
name = name:Trim():lower()
if extensions.status[ name ] ~= nil then
local status = tobool( cmd:find( "enable" ) )
if extensions.status[ name ] == status then
local str = "Extension '" .. name .. "' is already " .. ( status and "enabled" or "disabled" ) .. "."
if IsValid( ply ) then ply:PrintMessage( 2, str ) else print( str ) end
else
E2Lib.SetExtensionStatus( name, status )
E2Lib.UpdateClientsideExtensionsList()
local str = "E2 Extension '" .. name .. "' has been " .. ( status and "enabled" or "disabled" )
if not game.SinglePlayer() and IsValid( ply ) then MsgN( str .. " by " .. ply:Name() .. " (" .. ply:SteamID() .. ")." ) end
local canReloadNow = #player.GetAll() == 0
if canReloadNow then str = str .. ". Expression 2 will be reloaded now." else str = str .. ". Expression 2 will be reloaded in 10 seconds." end
if IsValid( ply ) then ply:PrintMessage( 2, str ) else print( str ) end
if canReloadNow then wire_expression2_reload( ply ) else timer.Create( "E2_AutoReloadTimer", 10, 1, function() wire_expression2_reload( ply ) end ) end
end
else printExtensions( ply, "Unknown extension '" .. name .. "'. Here is a list of available extensions:" ) end
else printExtensions( ply, "Usage: '" .. cmd .. " <name>'. Here is a list of available extensions:" ) end
end
net.Receive( "wire_expression2_client_request_print_extensions",
function( _, ply )
printExtensions( ply )
end
)
net.Receive( "wire_expression2_client_request_set_extension_status",
function( _, ply )
conCommandSetExtensionStatus( ply, net.ReadString(), net.ReadTable() )
end
)
hook.Add( "PlayerInitialSpawn", "wire_expression2_updateClientsideExtensions", E2Lib.UpdateClientsideExtensionsList )
function wire_expression2_PostLoadExtensions()
table.sort( extensions.list, function( a, b ) return a < b end )
E2Lib.UpdateClientsideExtensionsList()
buildPrettyList()
if not wire_expression2_is_reload then -- only print once on startup, not on each reload.
printExtensions()
end
hook.Run( "Expression2_PostLoadExtensions" )
end
else -- clientside stuff
extensions = { status = {}, list = {} }
function printExtensions()
net.Start( "wire_expression2_client_request_print_extensions" )
net.SendToServer()
end
function conCommandSetExtensionStatus( _, cmd, args )
net.Start( "wire_expression2_client_request_set_extension_status" )
net.WriteString( cmd )
net.WriteTable( args )
net.SendToServer()
end
net.Receive( "wire_expression2_server_send_extensions_list", function()
extensions = net.ReadTable()
end)
end
-- shared stuff
local function makeAutoCompleteList( cmd, args )
args = args:Trim():lower()
local status, list, tbl, j = tobool( cmd:find( "enable" ) ), extensions.list, {}, 1
for i = 1, #list do
local name = list[ i ]
if extensions.status[ name ] ~= status and name:find( args ) then
tbl[ j ] = cmd .. " " .. name
j = j + 1
end
end
return tbl
end
concommand.Add( "wire_expression2_extension_enable", conCommandSetExtensionStatus, makeAutoCompleteList )
concommand.Add( "wire_expression2_extension_disable", conCommandSetExtensionStatus, makeAutoCompleteList )
concommand.Add( "wire_expression2_extensions", function( ply ) printExtensions( ply ) end )
end
-- ------------------------ clientside reload command --------------------------
do
if SERVER then
util.AddNetworkString( "wire_expression2_client_request_reload" )
net.Receive( "wire_expression2_client_request_reload",
function( n, ply )
wire_expression2_reload( ply )
end
)
else
local function wire_expression2_reload()
net.Start( "wire_expression2_client_request_reload" )
net.SendToServer()
end
concommand.Add( "wire_expression2_reload", wire_expression2_reload )
end
end
-- ------------------------------ compatibility --------------------------------
-- Some functions need to be global for backwards-compatibility.
local makeglobal = {
["validPhysics"] = true,
["getOwner"] = true,
["isOwner"] = true,
}
-- Put all these functions into the global scope.
for funcname, _ in pairs(makeglobal) do
_G[funcname] = E2Lib[funcname]
end
hook.Add("InitPostEntity", "e2lib", function()
-- If changed, put them into the global scope again.
registerCallback("e2lib_replace_function", function(funcname, func, oldfunc)
if makeglobal[funcname] then
_G[funcname] = func
end
if funcname == "IsValid" then IsValid = func
elseif funcname == "isOwner" then isOwner = func
end
end)
-- check for a CPPI compliant plugin
if SERVER and CPPI then
if debug.getregistry().Player.CPPIGetFriends then
E2Lib.replace_function("isFriend", function(owner, player)
if owner == nil then return false end
if owner == player then return true end
if not owner:IsPlayer() then
return player:GetOwner() == owner
end
local friends = owner:CPPIGetFriends()
if not istable(friends) then return end
for _, friend in pairs(friends) do
if player == friend then return true end
end
return false
end)
end
if debug.getregistry().Entity.CPPIGetOwner then
local _getOwner = E2Lib.getOwner
E2Lib.replace_function("getOwner", function(self, entity)
if not IsValid(entity) then return end
if entity == self.entity or entity == self.player then return self.player end
local owner = entity:CPPIGetOwner()
if IsValid(owner) then return owner end
return _getOwner(self, entity)
end)
end
end
end)
--- Valid file extensions kept to avoid trying to make files with extensions gmod doesn't allow.
-- https://wiki.facepunch.com/gmod/file.Write
local file_extensions = {
["txt"] = true,
["dat"] = true,
["json"] = true,
["xml"] = true,
["csv"] = true,
["jpg"] = true,
["jpeg"] = true,
["png"] = true,
["vtf"] = true,
["vmt"] = true,
["mp3"] = true,
["wav"] = true,
["ogg"] = true
}
-- Returns whether the file has an extension garrysmod can write to, to avoid useless net messages, etc
function E2Lib.isValidFileWritePath(path)
local ext = string.GetExtensionFromFilename(path)
if ext then return file_extensions[string.lower(ext)] end
end
-- Different from Context:throw, which does not error the chip if
-- @strict is not enabled and instead returns a default value.
-- This is what Context:throw calls internally if @strict
-- By default E2 can catch these errors.
function E2Lib.raiseException(msg, level, trace, can_catch)
error({
catchable = (can_catch == nil) and true or can_catch,
msg = msg,
trace = trace
}, level)
end
--- Unpacks either an exception object as seen above or an error string.
function E2Lib.unpackException(struct)
if isstring(struct) then
return false, struct, nil
end
return struct.catchable, struct.msg, struct.trace
end |
module(..., package.seeall)
function save_discussion(node, request, sputnik)
request = request or {}
local params = {
author = request.user or "Anonymous user",
creation_time = tostring(os.time()),
activity_time = tostring(os.time()),
activity_node = node.id,
}
local title = request.params.title or node.title
if #node.title > 25 then
params.breadcrumb = title:sub(1, 25) .. "..."
else
params.breadcrumb = title
end
node = sputnik:update_node_with_params(node, params)
return node
end
local PARENT_PATTERN = "(.+)%/[^%/]+$" -- everything up to the last slash
function save_comment(node, request, sputnik)
request = request or {}
-- Update the parameters of the node being saved
node = sputnik:update_node_with_params(node, {
comment_timestamp = tostring(os.time()),
})
-- Update the parent node before returning from the hook
local parent_id = node.id:match(PARENT_PATTERN)
local parent = sputnik:get_node(parent_id)
parent = sputnik:update_node_with_params(parent, {
activity_time = tostring(os.time()),
activity_node = node.id,
})
parent = sputnik:activate_node(parent)
parent:save("Sputnik", "Updating activity time and node", {})
return node
end
|
local global = exports.global
local fonts = exports.fonts
local screenWidth, screenHeight = guiGetScreenSize()
local testShader, tec = nil, nil
local greenShader = nil
local previewObj = nil
local previewObjName = ""
local previewObjCost = 999999999
local defaultFont = nil
local firstClickDisabled = false
local rotZ = 0
local obstructed = false
function onClientResourceStart()
defaultFont = fonts:getFont("circular", "medium")
testShader, tec = dxCreateShader( "fx/block_world.fx", 0, 0, false, "object" )
if not testShader then
global:print( "Could not create shader. Please use debugscript 3" )
else
greenShader = dxCreateShader( "fx/block_world.fx", 0, 0, false, "object" )
end
end
function createPreview(objectId, objectName, objectCost)
if ( isElement( previewObj )) then
outputChatBox("* Cancel your current object placement first.", 255, 0, 0)
return false
end
previewObjName = objectName or "object"
previewObjCost = objectCost or 999999999
local playerPos = localPlayer:getPosition()
-- Prevents opening the menu whilst placing objects
localPlayer:setData("preview:enabled", true)
previewObj = Object(objectId, playerPos)
previewObj:setCollisionsEnabled(false)
previewObj:setAlpha(150)
previewObj:setData("store:preview", true)
showCursor(true)
bindKey("mouse1", "DOWN", placement_place)
bindKey("mouse2", "DOWN", placement_destroy)
bindKey("mouse_wheel_up", "both", placement_rotate)
bindKey("mouse_wheel_down", "both", placement_rotate)
if ( greenShader ) then
engineApplyShaderToWorldTexture( greenShader, string.format("*"), previewObj)
engineRemoveShaderFromWorldTexture( greenShader, "tx*" )
dxSetShaderValue ( greenShader, "COLORIZE", 0, 0.9, 0 )
end
addEventHandler("onClientCursorMove", root, placement_move)
addEventHandler("onClientRender", root, placement_render)
end
function placement_rotate( key )
if ( key == "mouse_wheel_up" ) then
rotZ = ( rotZ < 360 ) and rotZ + 10 or 0
else
rotZ = ( rotZ > 0 ) and rotZ - 10 or 360
end
previewObj:setRotation(0, 0, rotZ)
end
function placement_place()
if ( obstructed ) then
return false
end
if ( firstClickDisabled ) then
firstClickDisabled = false
return false
end
local previewPosition = previewObj.position
local previewRotation = previewObj.rotation
local previewModel = previewObj.model
local x, y, z = previewPosition.x, previewPosition.y, previewPosition.z
local rx, ry, rz = previewRotation.x, previewRotation.y, previewRotation.z
triggerServerEvent("placement:create", root, previewModel, x, y, z, rx, ry, rz, previewObjCost, previewObjName )
placement_destroy()
end
function placement_destroy()
if ( isElement(previewObj)) then
destroyElement(previewObj)
end
rotZ = 0
showCursor(false)
unbindKey("mouse1", "DOWN", placement_place)
unbindKey("mouse2", "DOWN", placement_destroy)
unbindKey("mouse_wheel_up", "both", placement_rotate)
unbindKey("mouse_wheel_down", "both", placement_rotate)
removeEventHandler("onClientCursorMove", root, placement_move)
removeEventHandler("onClientRender", root, placement_render)
end
function placement_move(cursorX, cursorY, absX, absY, worldX, worldY, worldZ)
if ( isElement( previewObj ) and isCursorShowing() ) then
local camX, camY, camZ = getCameraMatrix()
local hit, hitX, hitY, hitZ = processLineOfSight(camX, camY, camZ, worldX, worldY, worldZ, true, false, true, false, false, false, false, false, localPlayer )
if ( hit ) then
local ground = getGroundPosition(hitX, hitY, hitZ)
local x, y, z = getElementPosition(previewObj)
local x0, y0, z0, x1, y1, z1 = getElementBoundingBox( previewObj )
local hitLeft = processLineOfSight( x + ( x0 / 1.5 ), y, z + 0.5, x + ( x1 / 1.5 ), y, z + 0.5, true, true, true, true, true, false, false, false, previewObj )
local hitRight = processLineOfSight( x - ( x0 / 1.5 ), y, z + 0.5, x - ( x1 / 1.5 ), y, z + 0.5, true, true, true, true, true, false, false, false, previewObj )
local hitTop = processLineOfSight( x, y + y0, z + 0.5, x, y + ( y1 + 0.5), z + 0.5, true, true, true, true, true, false, false, false, previewObj )
local hitBottom = processLineOfSight( x, y - y0, z + 0.5, x, y - ( y1 + 0.5), z + 0.5, true, true, true, true, true, false, false, false, previewObj )
local hitDiagonal = processLineOfSight( x + x0, y, z + 0.5, x + x1, y + y1, z + 0.5, true, true, true, true, true, false, false, false, previewObj )
if ( hitLeft or hitRight or hitTop or hitBottom or hitDiagonal ) then
obstructed = true
dxSetShaderValue ( greenShader, "COLORIZE", 0.9, 0, 0 )
else
obstructed = false
dxSetShaderValue ( greenShader, "COLORIZE", 0, 0.9, 0 )
end
previewObj:setPosition(global:round(hitX, 1), global:round(hitY, 1), hitZ)
end
end
end
function placement_render()
local cX, cY = getCursorPosition()
local sX, sY = screenWidth * cX, screenHeight * cY
local fontScale = 0.8
local text = "Left-click to place #FFAA00" .. previewObjName .. "#FFFFFF\nRight-click to cancel\nScroll to rotate object"
local textWidth = dxGetTextWidth( text, fontScale, defaultFont, true )
local fontHeight = dxGetFontHeight(fontScale, defaultFont)
dxDrawRectangle( sX + 5, sY + 10, textWidth + 10, fontHeight * 3 + 5, tocolor(40,40,40,255))
dxDrawText(text, sX + 10, sY + 11, screenWidth, screenHeight, tocolor(255,255,255,255), fontScale, defaultFont, "left", "top", false, false, false, true )
end
addEventHandler( "onClientResourceStart", resourceRoot, onClientResourceStart ) |
-- Script: hello.lua
local glfw = require "moonglfw"
local nvg = require "nvg"
local color = require "nvg.color"
local pprint = require "pprint"
-- Allocate a window and deal with OpenGL
w = glfw.create_window(640, 480, "Hello world!")
glfw.make_context_current(w)
-- Only after this we can use nanovg
local ctx = nvg.new "antialias"
-- Load raster assets
raster = ctx:image("nanovg/example/images/image1.jpg")
local dx = (640 - raster.width)/2
local dy = (480 - raster.height)/2
raster:extent(dx, dy , raster.width, raster.height)
-- Load svg assets
vector = ctx:image("nanosvg/example/nano.svg")
local vdx = (640 - vector.width)/2
local vdy = (480 - vector.height)/2
vector:extent(vdx, vdy , vector.width, vector.height)
-- Repeatedly poll for events:
while not glfw.window_should_close(w) do
if glfw.get_key(w, "escape") == 'press' then break end
t = glfw.get_time()
ww, wh = glfw.get_window_size(w)
mx, my = glfw.get_cursor_pos(w)
local pw, _ = glfw.get_framebuffer_size(w)
local ratio = pw/ww
ctx:beginFrame(ww, wh, ratio)
ctx:clear "#4C4C51"
-- Raster
ctx:beginPath()
ctx:rect(dx,dy , raster.width, raster.height)
ctx.fillStyle = raster
ctx:fill()
-- Vector
ctx:beginPath()
ctx:rect(vdx,vdy , vector.width, vector.height)
ctx.fillStyle = vector
ctx:fill()
-- Flush
ctx:endFrame()
glfw.swap_buffers(w)
glfw.poll_events()
end
|
local Treesitter = {}
Treesitter.config = function()
if not lvim.builtin.treesitter.active then
return
end
-- if you don't want all the parsers change this to a table of the ones you want
lvim.builtin.treesitter.ensure_installed = "maintained"
lvim.builtin.treesitter.highlight.enabled = true
end
return Treesitter
|
-----------------------------------------------------------------
-- Logo Watermark- A Simple FiveM Script, Made By Jordan.#2139 --
-----------------------------------------------------------------
fx_version "bodacious"
game "gta5"
-- Define the resource metadata
name "Logo"
description "A Simple Logo Watermark"
author "Jordan.#2139"
version "v1.2.0"
client_scripts {
"client.lua",
'config.lua'
}
ui_page 'html/ui.html'
files {
'html/*',
'img/logo.gif'
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.